From f1d1578554f86b18cf6a6d20e3d1746453435a02 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 14:34:15 +0200 Subject: [PATCH 1/4] add setters --- path.cpp | 35 +++++++++++++++++++++++++++++++++++ path.h | 7 +++++++ step.cpp | 10 ++++++++++ step.h | 2 ++ 4 files changed, 54 insertions(+) diff --git a/path.cpp b/path.cpp index 26a2558..75f4687 100644 --- a/path.cpp +++ b/path.cpp @@ -50,6 +50,41 @@ QList Path::getStep() const return step; } +void Path::setCity(const QString &newCity) +{ + city = newCity; +} + +void Path::setDepartement(int newDepartement) +{ + departement = newDepartement; +} + +void Path::setName(const QString &newName) +{ + name = newName; +} + +void Path::setDifficulty(unsigned int newDifficulty) +{ + difficulty = newDifficulty; +} + +void Path::setDuration(float newDuration) +{ + duration = newDuration; +} + +void Path::setLength(float newLength) +{ + length = newLength; +} + +void Path::setImage(const QString &newImage) +{ + image = newImage; +} + Path::Path(QFile *file){ if (!file->open(QIODevice::ReadOnly)) { qWarning() << "Could not open file:" << file->errorString(); diff --git a/path.h b/path.h index 7eb9315..919a89a 100644 --- a/path.h +++ b/path.h @@ -29,6 +29,13 @@ public: float getLength() const; QString getImage() const; QList getStep() const; + void setCity(const QString &newCity); + void setDepartement(int newDepartement); + void setName(const QString &newName); + void setDifficulty(unsigned int newDifficulty); + void setDuration(float newDuration); + void setLength(float newLength); + void setImage(const QString &newImage); }; #endif // PATH_H diff --git a/step.cpp b/step.cpp index 1398647..fd7813c 100644 --- a/step.cpp +++ b/step.cpp @@ -27,6 +27,16 @@ int Step::getResponse() const return response; } +void Step::setTitle(const QString &newTitle) +{ + title = newTitle; +} + +void Step::setResponse(int newResponse) +{ + response = newResponse; +} + Step::Step() { latitude = 0.0; longitude = 0.0; diff --git a/step.h b/step.h index 1607679..3f711c1 100644 --- a/step.h +++ b/step.h @@ -28,6 +28,8 @@ public: int getResponse() const; QList getPersonnage() const; QList getTexte() const; + void setTitle(const QString &newTitle); + void setResponse(int newResponse); }; #endif // STEP_H From 591737118bffd1b4c0604a0ada149f4fd9e25e1e Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 14:34:28 +0200 Subject: [PATCH 2/4] ValidateBtn --- mainwindow.cpp | 17 ++ mainwindow.h | 3 +- mainwindow.ui | 679 ++++++++++++++++++++++++------------------------- 3 files changed, 353 insertions(+), 346 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 5570c48..da5eacc 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -257,6 +257,7 @@ void MainWindow::on_actionEditCut_triggered() void MainWindow::on_pathNumber_valueChanged(int arg1) { this->loadPath(path.at(ui->pathNumber->value()-1)); + currentPath = path.at(arg1-1); } @@ -265,3 +266,19 @@ void MainWindow::on_stepNumber_valueChanged(int arg1) this->loadStep(currentPath->getStep().at(arg1-1)); } + +void MainWindow::on_validateBtn_clicked() +{ + currentPath->setName(ui->titleEdit->text()); + currentPath->setCity(ui->locEdit->text()); + currentPath->setImage(ui->imagePath->text()); + currentPath->setLength(ui->lengthSpin->value()); + currentPath->setDifficulty(ui->diffSpin->value()); + currentPath->setDuration(ui->durationSpin->value()); + + Step currentStep = currentPath->getStep().at(ui->stepNumber->value()-1); + + currentStep.setTitle(ui->stepTitle->text()); + currentStep.setResponse(ui->responseSpin->value()); +} + diff --git a/mainwindow.h b/mainwindow.h index 7b9cccc..3baae80 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -38,7 +38,6 @@ private slots: void on_actionopenFile_triggered(); - void on_actionEditCopy_triggered(); void on_actionEditPaste_triggered(); @@ -49,6 +48,8 @@ private slots: void on_stepNumber_valueChanged(int arg1); + void on_validateBtn_clicked(); + private: Ui::MainWindow *ui; QString currentFile; diff --git a/mainwindow.ui b/mainwindow.ui index eef97a1..2ef38bb 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 800 - 598 + 693 @@ -69,221 +69,222 @@ QFrame::Shadow::Raised - - - - 10 - 20 - 45 - 27 - - - - 1 - - - 1 - - - - - - 60 - 20 - 391 - 26 - - - - - - - 10 - 60 - 441 - 45 - - - - - 0 - - - 0 - - - - - Localisation - - - - - - - - - - - - - - - 470 - 20 - 281 - 191 - - - - - - - true - - - - - - 0 - 110 - 451 - 63 - - - - - 0 - - - 0 - - - - - - - - Difficulty + + + + + + + + + + + 1 + + + 1 + + + + + + + + + + + + + + 0 - - - - - - /5 + + 0 - - 5 + + + + Localisation + + + + + + + + + + + + + + + + + 0 - - - - - - - - - - - - Duration + + 0 - - - - - - h + + + + + 0 + + + 0 + + + + + Difficulty + + + + + + + /5 + + + 5 + + + + + + + + + + + 0 + + + 0 + + + + + Duration + + + + + + + h + + + 1 + + + 0.100000000000000 + + + + + + + + + + + 0 + + + 0 + + + + + Length + + + + + + + Km + + + 1 + + + 500.000000000000000 + + + 0.100000000000000 + + + + + + + + + + + + + + 9 - - 1 + + 0 - - 0.100000000000000 - - - - - - - - - - - - - Length - - - - - - - Km - - - 1 - - - 500.000000000000000 - - - 0.100000000000000 - - - - - - - - - - - - 0 - 180 - 451 - 44 - - - - - 9 - - - 0 - - - - - Image - - - - - - - - - - ... - - - - :/data/images/data/images/add.png:/data/images/data/images/add.png - - - - - - - Select Image File - - - - - + + + + Image + + + + + + + + + + ... + + + + :/data/images/data/images/add.png:/data/images/data/images/add.png + + + + + + + Select Image File + + + + + + + + + + + + + + 300 + 0 + + + + + + + true + + + + @@ -316,135 +317,129 @@ QFrame::Shadow::Raised - - - - 0 - 10 - 781 - 45 - - - - - - - 1 - - - - - - - - - - ... - - - - :/data/images/data/images/add.png:/data/images/data/images/add.png - - - - - - - - - 0 - 60 - 781 - 63 - - - - - - - - - - Latitude - - - Qt::AlignmentFlag::AlignCenter - - - - - - - 6 - - - 90.000000000000000 - - - - - - - - - - - - - Longitude - - - Qt::AlignmentFlag::AlignCenter - - - - - - - 6 - - - -180.000000000000000 - - - 180.000000000000000 - - - - - - - - - - - - - Response - - - Qt::AlignmentFlag::AlignCenter - - - - - - - - - - - - - - - 10 - 130 - 761 - 81 - - - + + + + + + + + 1 + + + + + + + + + + ... + + + + :/data/images/data/images/add.png:/data/images/data/images/add.png + + + + + + + + + + + + + + + + Latitude + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 6 + + + 90.000000000000000 + + + + + + + + + + + + + Longitude + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 6 + + + -180.000000000000000 + + + 180.000000000000000 + + + + + + + + + + + + + Response + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + + + + + + + + + false + + + + + + + Valider + + + + @@ -466,13 +461,7 @@ - - - Edit - - - From c591f2dbdbd6b184da79929c1f7519adf78136e7 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 15:54:06 +0200 Subject: [PATCH 3/4] Fix textEdit height --- mainwindow.ui | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/mainwindow.ui b/mainwindow.ui index 2ef38bb..d5270c3 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 800 - 693 + 868 @@ -26,10 +26,22 @@ MainWindow + + + 0 + 30 + + + + + 0 + 0 + + 800 - 521 + 1000 @@ -57,6 +69,12 @@ + + + 0 + 0 + + 16777215 @@ -276,6 +294,12 @@ 0 + + + 16777215 + 200 + + @@ -306,11 +330,17 @@ - + 0 0 + + + 0 + 0 + + QFrame::Shape::StyledPanel @@ -427,6 +457,18 @@ + + + 0 + 255 + + + + + 0 + 0 + + false @@ -463,7 +505,6 @@ - toolBar From 992874a6035e5d00fe4566174cf27e85bef55571 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 15:54:23 +0200 Subject: [PATCH 4/4] Save step info --- mainwindow.cpp | 6 +++--- path.cpp | 2 +- path.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index da5eacc..5eeefe6 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -131,6 +131,7 @@ void MainWindow::loadStep(Step s) { ui->stepTitle->setText(s.getTitle()); ui->LatitudeSpin->setValue(s.getLatitude()); ui->longitudeSpin->setValue(s.getLongitude()); + ui->responseSpin->setValue(s.getResponse()); for(int i = 0; i < s.getTexte().length(); i++) { QString q = s.getPersonnage().at(i) + ": " + s.getTexte().at(i); @@ -276,9 +277,8 @@ void MainWindow::on_validateBtn_clicked() currentPath->setDifficulty(ui->diffSpin->value()); currentPath->setDuration(ui->durationSpin->value()); - Step currentStep = currentPath->getStep().at(ui->stepNumber->value()-1); + currentPath->getStep()[ui->stepNumber->value()-1].setTitle(ui->stepTitle->text()); + currentPath->getStep()[ui->stepNumber->value()-1].setResponse(ui->responseSpin->value()); - currentStep.setTitle(ui->stepTitle->text()); - currentStep.setResponse(ui->responseSpin->value()); } diff --git a/path.cpp b/path.cpp index 75f4687..d4ed62b 100644 --- a/path.cpp +++ b/path.cpp @@ -45,7 +45,7 @@ QString Path::getImage() const return image; } -QList Path::getStep() const +QList& Path::getStep() { return step; } diff --git a/path.h b/path.h index 919a89a..fef7334 100644 --- a/path.h +++ b/path.h @@ -28,7 +28,7 @@ public: float getDuration() const; float getLength() const; QString getImage() const; - QList getStep() const; + QList& getStep(); void setCity(const QString &newCity); void setDepartement(int newDepartement); void setName(const QString &newName);