From ffcb6fa20308238006dde81c187ecc17d6cb1a1b Mon Sep 17 00:00:00 2001 From: Pyramond Date: Sat, 21 Jun 2025 13:14:54 +0200 Subject: [PATCH 1/2] Add step btn --- mainwindow.cpp | 10 +++++++++- mainwindow.h | 2 +- mainwindow.ui | 30 ++++++++++++++++++------------ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index f5d94f2..92ddc8a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -166,7 +166,12 @@ void MainWindow::addNewPath() void MainWindow::addNewStep() { + this->on_validateBtn_clicked(); + currentPath->getStep().append(Step()); + ui->stepNumber->setMaximum(currentPath->getStep().length()); + ui->stepNumber->setSuffix("/" + QString::number(currentPath->getStep().length())); } + void MainWindow::exportHTMLMap(int index) { std::ofstream file("./pages/parcours" + std::to_string(index) + ".html"); @@ -921,5 +926,8 @@ void MainWindow::on_actionFont_color_triggered() this->setColor(); } - +void MainWindow::on_addStep_clicked() +{ + this->addNewStep(); +} diff --git a/mainwindow.h b/mainwindow.h index 8090e39..0839c0a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -119,9 +119,9 @@ private slots: void on_actionNewFile_triggered(); - void on_actionFont_color_triggered(); + void on_addStep_clicked(); private: Ui::MainWindow *ui; diff --git a/mainwindow.ui b/mainwindow.ui index 53b0b79..5c49127 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -79,7 +79,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -333,7 +333,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -341,9 +341,15 @@ + + /1 + 1 + + 1 + @@ -478,7 +484,7 @@ 0 0 800 - 21 + 22 @@ -579,7 +585,7 @@ New File - QAction::NoRole + QAction::MenuRole::NoRole @@ -591,7 +597,7 @@ Save - QAction::NoRole + QAction::MenuRole::NoRole @@ -603,7 +609,7 @@ Save as - QAction::NoRole + QAction::MenuRole::NoRole @@ -615,7 +621,7 @@ Copy - QAction::NoRole + QAction::MenuRole::NoRole @@ -627,7 +633,7 @@ Paste - QAction::NoRole + QAction::MenuRole::NoRole @@ -639,7 +645,7 @@ Cut - QAction::NoRole + QAction::MenuRole::NoRole @@ -651,7 +657,7 @@ Undo - QAction::NoRole + QAction::MenuRole::NoRole @@ -663,7 +669,7 @@ Redo - QAction::NoRole + QAction::MenuRole::NoRole @@ -675,7 +681,7 @@ Open file - QAction::NoRole + QAction::MenuRole::NoRole From b2457787b784ed3faf486bf5806f11f22158c486 Mon Sep 17 00:00:00 2001 From: Giovanni JOSSERAND Date: Sat, 21 Jun 2025 13:19:40 +0200 Subject: [PATCH 2/2] add of automatique validate --- mainwindow.cpp | 7 +++++++ mainwindow.h | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 61c7ef6..ae879e6 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -482,6 +482,7 @@ void MainWindow::setCurrentPath(Path *newCurrentPath) } void MainWindow::saveFile(){ + on_validateBtn_clicked(); QString fileName; if (currentFile.isEmpty()) { fileName = QFileDialog::getSaveFileName(this, "Save"); @@ -605,6 +606,7 @@ void MainWindow::on_actionEditCut_triggered() void MainWindow::on_pathNumber_valueChanged(int arg1) { + on_validateBtn_clicked(); this->loadPath(path.at(ui->pathNumber->value()-1)); currentPath = path.at(arg1-1); } @@ -612,12 +614,14 @@ void MainWindow::on_pathNumber_valueChanged(int arg1) void MainWindow::on_stepNumber_valueChanged(int arg1) { + on_validateBtn_clicked(); this->loadStep(currentPath->getStep().at(arg1-1)); } void MainWindow::on_validateBtn_clicked() { + std::cout << "ok" << std::endl; this->currentPath->setName(ui->titleEdit->text()); this->currentPath->setCity(ui->locEdit->text()); this->currentPath->setImage(ui->imagePath->text()); @@ -871,6 +875,7 @@ void MainWindow::on_actionFont_size_triggered() void MainWindow::saveAsFile(){ + on_validateBtn_clicked(); QString fileName = QFileDialog::getSaveFileName(this, "Save as"); QFile file(fileName); @@ -921,6 +926,7 @@ void MainWindow::on_actionSave_as_triggered() void MainWindow::on_exportHTMLBtn_clicked() { + on_validateBtn_clicked(); for(int i = 0; i < path.length(); i++) { this->exportHTMLMap(i); } @@ -988,3 +994,4 @@ void MainWindow::on_actionFont_color_triggered() { this->setColor(); } + diff --git a/mainwindow.h b/mainwindow.h index f7c92a3..4fad0ba 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -123,7 +123,6 @@ private slots: void on_actionFont_color_triggered(); - private: Ui::MainWindow *ui; QString currentFile;