From 957956a92ec111e1495c19af09600896881fbc0f Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 11:41:24 +0200 Subject: [PATCH 01/18] Fix toolbar open icon --- mainwindow.cpp | 6 ++++++ mainwindow.h | 2 ++ mainwindow.ui | 32 ++++++++++++++++---------------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index bee0fdd..66811b9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -131,3 +131,9 @@ void MainWindow::on_toolButton_clicked() loadImage(fileName); } + +void MainWindow::on_actionopenFile_triggered() +{ + this->loadPath(); +} + diff --git a/mainwindow.h b/mainwindow.h index 24fc256..618fba0 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -33,6 +33,8 @@ private slots: void on_toolButton_clicked(); + void on_actionopenFile_triggered(); + private: Ui::MainWindow *ui; QString currentFile; diff --git a/mainwindow.ui b/mainwindow.ui index 95edce2..36c1980 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -249,7 +249,7 @@ ... - + :/data/images/data/images/add.png:/data/images/data/images/add.png @@ -330,7 +330,7 @@ false - + @@ -368,7 +368,7 @@ - + :/data/images/data/images/new.png:/data/images/data/images/new.png @@ -380,7 +380,7 @@ - + :/data/images/data/images/save_as.png:/data/images/data/images/save_as.png @@ -392,7 +392,7 @@ - + :/data/images/data/images/save.png:/data/images/data/images/save.png @@ -404,7 +404,7 @@ - + :/data/images/data/images/print.png:/data/images/data/images/print.png @@ -416,7 +416,7 @@ - + :/data/images/data/images/copy.png:/data/images/data/images/copy.png @@ -428,7 +428,7 @@ - + :/data/images/data/images/paste.png:/data/images/data/images/paste.png @@ -440,7 +440,7 @@ - + :/data/images/data/images/cut.png:/data/images/data/images/cut.png @@ -452,7 +452,7 @@ - + :/data/images/data/images/edit_undo.png:/data/images/data/images/edit_undo.png @@ -464,7 +464,7 @@ - + :/data/images/data/images/edit_redo.png:/data/images/data/images/edit_redo.png @@ -474,13 +474,13 @@ QAction::MenuRole::NoRole - + - - :/data/images/data/images/new.png:/data/images/data/images/new.png + + :/data/images/data/images/open.png:/data/images/data/images/open.png - New + openFile QAction::MenuRole::NoRole @@ -488,7 +488,7 @@ - + From 57d77cf7cf0e093931beb0b16d414bcac7ab999e Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 12:04:56 +0200 Subject: [PATCH 02/18] scale image --- mainwindow.ui | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mainwindow.ui b/mainwindow.ui index 36c1980..0e18c9f 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -120,6 +120,9 @@ + + true + From 0cd4f958650f801ac969903d49fdc5b06aba174f Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 19:29:12 +0200 Subject: [PATCH 03/18] Undo and Redo command --- Undo.h | 21 +++++++++++++++++++++ mainwindow.cpp | 37 +++++++++++++++++++++++++++++++++++-- mainwindow.h | 4 +++- sae201.pro | 1 + 4 files changed, 60 insertions(+), 3 deletions(-) create mode 100644 Undo.h diff --git a/Undo.h b/Undo.h new file mode 100644 index 0000000..e4ad16d --- /dev/null +++ b/Undo.h @@ -0,0 +1,21 @@ +#ifndef UNDO_H +#define UNDO_H + +#include +#include + +class LineEditCommand : public QUndoCommand { +public: + LineEditCommand(QLineEdit* edit, const QString& oldText, const QString& newText) + : m_edit(edit), m_oldText(oldText), m_newText(newText) {} + + void undo() override { m_edit->setText(m_oldText); } + void redo() override { m_edit->setText(m_newText); } + +private: + QLineEdit* m_edit; + QString m_oldText; + QString m_newText; +}; + +#endif // UNDO_H diff --git a/mainwindow.cpp b/mainwindow.cpp index 66811b9..5daf812 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,15 +1,49 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include "path.h" - +#include "Undo.h" #include #include +#include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) + , undoStack(new QUndoStack(this)) { ui->setupUi(this); + + + connect(ui->titleEdit, &QLineEdit::editingFinished, this, [this]() { + static QString previousText; + QString currentText = ui->titleEdit->text(); + if(previousText != currentText) { + undoStack->push(new LineEditCommand(ui->titleEdit, previousText, currentText)); + previousText = currentText; + } + }); + + connect(ui->locEdit, &QLineEdit::editingFinished, this, [this]() { + static QString previousText; + QString currentText = ui->locEdit->text(); + if(previousText != currentText) { + undoStack->push(new LineEditCommand(ui->locEdit, previousText, currentText)); + previousText = currentText; + } + }); + + connect(ui->imagePath, &QLineEdit::editingFinished, this, [this]() { + static QString previousText; + QString currentText = ui->imagePath->text(); + if(previousText != currentText) { + undoStack->push(new LineEditCommand(ui->imagePath, previousText, currentText)); + previousText = currentText; + } + }); + + connect(ui->actionEditUndo, &QAction::triggered, undoStack, &QUndoStack::undo); + connect(ui->actionEditRedo, &QAction::triggered, undoStack, &QUndoStack::redo); } MainWindow::~MainWindow() @@ -136,4 +170,3 @@ void MainWindow::on_actionopenFile_triggered() { this->loadPath(); } - diff --git a/mainwindow.h b/mainwindow.h index 618fba0..93e248f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -2,7 +2,7 @@ #define MAINWINDOW_H #include - +#include #include "path.h" QT_BEGIN_NAMESPACE @@ -35,6 +35,7 @@ private slots: void on_actionopenFile_triggered(); + private: Ui::MainWindow *ui; QString currentFile; @@ -42,5 +43,6 @@ private: QList path; Path* currentPath; void loadImage(QString fileName); + QUndoStack *undoStack; }; #endif // MAINWINDOW_H diff --git a/sae201.pro b/sae201.pro index 8cb9d3f..04a7b14 100644 --- a/sae201.pro +++ b/sae201.pro @@ -15,6 +15,7 @@ SOURCES += \ path.cpp \ HEADERS += \ + Undo.h \ mainwindow.h \ step.h \ path.h \ From 44c858805c2ec37b20d11e8a9961ba25d7119c02 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 22:30:01 +0200 Subject: [PATCH 04/18] Add copy function --- mainwindow.cpp | 12 ++++++++++++ mainwindow.h | 4 ++++ mainwindow.ui | 20 ++++++++++---------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 5daf812..8debc7c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -11,6 +11,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) , undoStack(new QUndoStack(this)) + , Clipboard(QGuiApplication::clipboard()) { ui->setupUi(this); @@ -170,3 +171,14 @@ void MainWindow::on_actionopenFile_triggered() { this->loadPath(); } + +void MainWindow::on_actionEditCopy_triggered() +{ + QWidget *focused = QApplication::focusWidget(); + QLineEdit* lineEdit = qobject_cast(focused); + + if(lineEdit) { + Clipboard->setText(lineEdit->selectedText()); + } +} + diff --git a/mainwindow.h b/mainwindow.h index 93e248f..d8757ac 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -3,6 +3,7 @@ #include #include +#include #include "path.h" QT_BEGIN_NAMESPACE @@ -36,6 +37,8 @@ private slots: void on_actionopenFile_triggered(); + void on_actionEditCopy_triggered(); + private: Ui::MainWindow *ui; QString currentFile; @@ -44,5 +47,6 @@ private: Path* currentPath; void loadImage(QString fileName); QUndoStack *undoStack; + QClipboard* Clipboard; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 0e18c9f..2f533da 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -375,7 +375,7 @@ :/data/images/data/images/new.png:/data/images/data/images/new.png - NewFile + New File QAction::MenuRole::NoRole @@ -387,7 +387,7 @@ :/data/images/data/images/save_as.png:/data/images/data/images/save_as.png - SaveFile + Save QAction::MenuRole::NoRole @@ -399,7 +399,7 @@ :/data/images/data/images/save.png:/data/images/data/images/save.png - SaveAsFile + Save as QAction::MenuRole::NoRole @@ -411,7 +411,7 @@ :/data/images/data/images/print.png:/data/images/data/images/print.png - PrintFile + Print QAction::MenuRole::NoRole @@ -423,7 +423,7 @@ :/data/images/data/images/copy.png:/data/images/data/images/copy.png - EditCopy + Copy QAction::MenuRole::NoRole @@ -435,7 +435,7 @@ :/data/images/data/images/paste.png:/data/images/data/images/paste.png - EditPaste + Paste QAction::MenuRole::NoRole @@ -447,7 +447,7 @@ :/data/images/data/images/cut.png:/data/images/data/images/cut.png - EditCut + Cut QAction::MenuRole::NoRole @@ -459,7 +459,7 @@ :/data/images/data/images/edit_undo.png:/data/images/data/images/edit_undo.png - EditUndo + Undo QAction::MenuRole::NoRole @@ -471,7 +471,7 @@ :/data/images/data/images/edit_redo.png:/data/images/data/images/edit_redo.png - EditRedo + Redo QAction::MenuRole::NoRole @@ -483,7 +483,7 @@ :/data/images/data/images/open.png:/data/images/data/images/open.png - openFile + Open file QAction::MenuRole::NoRole From f4454d513e5f0b5d8d0ec3c352ad08a92fd03858 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 22:38:00 +0200 Subject: [PATCH 05/18] Add paste function --- mainwindow.cpp | 20 ++++++++++++++++++++ mainwindow.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index 8debc7c..ebc514a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -182,3 +182,23 @@ void MainWindow::on_actionEditCopy_triggered() } } + +void MainWindow::on_actionEditPaste_triggered() +{ + QWidget *focused = QApplication::focusWidget(); + QLineEdit* lineEdit = qobject_cast(focused); + + if(lineEdit) { + QString text = lineEdit->text(); + int pos = lineEdit->cursorPosition(); + text.insert(pos, Clipboard->text()); + lineEdit->setText(text); + } +} + + +void MainWindow::on_actionEditCut_triggered() +{ + +} + diff --git a/mainwindow.h b/mainwindow.h index d8757ac..3d6640e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -39,6 +39,8 @@ private slots: void on_actionEditCopy_triggered(); + void on_actionEditPaste_triggered(); + private: Ui::MainWindow *ui; QString currentFile; From 2aa518bc1d028e460116d45002df1db263c5f466 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 22:55:11 +0200 Subject: [PATCH 06/18] Add cut function --- mainwindow.cpp | 10 ++++++++++ mainwindow.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index ebc514a..b37664a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -199,6 +199,16 @@ void MainWindow::on_actionEditPaste_triggered() void MainWindow::on_actionEditCut_triggered() { + QWidget *focused = QApplication::focusWidget(); + QLineEdit* lineEdit = qobject_cast(focused); + if(lineEdit) { + QString text = lineEdit->text(); + QString selectedText = lineEdit->selectedText(); + int pos = lineEdit->selectionStart(); + text.remove(pos, selectedText.length()); + Clipboard->setText(selectedText); + lineEdit->setText(text); + } } diff --git a/mainwindow.h b/mainwindow.h index 3d6640e..7c78516 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -41,6 +41,8 @@ private slots: void on_actionEditPaste_triggered(); + void on_actionEditCut_triggered(); + private: Ui::MainWindow *ui; QString currentFile; From 33970b36a708e22e79402c24bb62b6ccffe6fbf3 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 23:11:31 +0200 Subject: [PATCH 07/18] Add step title, number and add step btn --- mainwindow.ui | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/mainwindow.ui b/mainwindow.ui index 2f533da..019029d 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -292,6 +292,39 @@ QFrame::Shadow::Raised + + + + 0 + 10 + 781 + 45 + + + + + + + 1 + + + + + + + + + + ... + + + + :/data/images/data/images/add.png:/data/images/data/images/add.png + + + + + From ce6614e29de3ac9ac53606129ab4e9bcee393c50 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 23:14:25 +0200 Subject: [PATCH 08/18] Display step title --- mainwindow.cpp | 7 ++++++- path.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index b37664a..340d269 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,6 +1,7 @@ #include "mainwindow.h" #include "ui_mainwindow.h" #include "path.h" +#include "step.h" #include "Undo.h" #include #include @@ -84,6 +85,7 @@ void MainWindow::loadPath() file.close(); Path* p = new Path(&file); + QList steps = p->getStep(); currentPath = p; path.append(p); @@ -93,8 +95,11 @@ void MainWindow::loadPath() ui->lengthSpin->setValue(p->getLength()); ui->durationSpin->setValue(p->getDuration()); ui->imagePath->setText(p->getImage()); - loadImage(p->getImage()); + + if(!steps.isEmpty()) { + ui->stepTitle->setText(p->getStep().first().getTitle()); + } } void MainWindow::addNewPath() diff --git a/path.cpp b/path.cpp index 7a421f7..26a2558 100644 --- a/path.cpp +++ b/path.cpp @@ -75,7 +75,7 @@ Path::Path(QFile *file){ QJsonArray stepsArray = json["steps"].toArray(); for (const QJsonValue &stepValue : stepsArray) { QJsonObject stepObj = stepValue.toObject(); - //step.append(Step(stepObj)); + step.append(Step(stepObj)); } } From 4f508adbb9ebb0ca86ac12fdec7c38f4550408e5 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 23:22:19 +0200 Subject: [PATCH 09/18] Display path number --- mainwindow.cpp | 5 +++++ mainwindow.ui | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 340d269..582913c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -100,6 +100,11 @@ void MainWindow::loadPath() if(!steps.isEmpty()) { ui->stepTitle->setText(p->getStep().first().getTitle()); } + + int pathCount = path.length(); + ui->pathNumber->setMaximum(pathCount); + ui->pathNumber->setSuffix("/" + QString::number(pathCount)); + ui->pathNumber->setValue(path.indexOf(currentPath)+1); } void MainWindow::addNewPath() diff --git a/mainwindow.ui b/mainwindow.ui index 019029d..3781e08 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -57,7 +57,7 @@ QFrame::Shadow::Raised - + 10 From 2126a66c96d23060cca1e3110928b3bddc8bc17a Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Thu, 19 Jun 2025 23:34:31 +0200 Subject: [PATCH 10/18] Add longitude and latitude --- mainwindow.ui | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/mainwindow.ui b/mainwindow.ui index 3781e08..759d4d5 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -325,6 +325,83 @@ + + + + 0 + 60 + 781 + 63 + + + + + + + + + + Latitude + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 6 + + + + + + + + + + + + + Longitude + + + Qt::AlignmentFlag::AlignCenter + + + + + + + 6 + + + + + + + + + + + + + Response + + + Qt::AlignmentFlag::AlignCenter + + + + + + + + + + + From aed27c2483c68856f98c5fde49487ec81da28171 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 09:16:07 +0200 Subject: [PATCH 11/18] Display coordinates --- mainwindow.cpp | 2 ++ mainwindow.ui | 9 +++++++++ step.cpp | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 582913c..867ab0e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -99,6 +99,8 @@ void MainWindow::loadPath() if(!steps.isEmpty()) { ui->stepTitle->setText(p->getStep().first().getTitle()); + ui->LatitudeSpin->setValue(p->getStep().first().getLatitude()); + ui->longitudeSpin->setValue(p->getStep().first().getLongitude()); } int pathCount = path.length(); diff --git a/mainwindow.ui b/mainwindow.ui index 759d4d5..a380958 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -353,6 +353,9 @@ 6 + + 90.000000000000000 + @@ -376,6 +379,12 @@ 6 + + -180.000000000000000 + + + 180.000000000000000 + diff --git a/step.cpp b/step.cpp index 861f414..491ab22 100644 --- a/step.cpp +++ b/step.cpp @@ -41,7 +41,7 @@ Step::Step( QJsonObject &in) QString gps = in["GPS"].toString(); QStringList parts = gps.split(" ", Qt::SkipEmptyParts); - QChar latDir = parts[0][0]; // c'est le premier QChar du QString t'as capté + QChar latDir = parts[0][0]; int latDeg = parts[1].toInt(); float latMin = parts[2].toFloat(); setLatitude(latDeg, latMin, latDir); From c4bcb8f0b855bddb0325eaa52a4f7383815d7595 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:00:41 +0200 Subject: [PATCH 12/18] Add getters for dialog Lists --- step.cpp | 10 ++++++++++ step.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/step.cpp b/step.cpp index 491ab22..1398647 100644 --- a/step.cpp +++ b/step.cpp @@ -34,6 +34,16 @@ Step::Step() { } +QList Step::getPersonnage() const +{ + return personnage; +} + +QList Step::getTexte() const +{ + return texte; +} + Step::Step( QJsonObject &in) { title = in["title"].toString(); diff --git a/step.h b/step.h index 8d93c46..1607679 100644 --- a/step.h +++ b/step.h @@ -26,6 +26,8 @@ public: float getLatitude() const; float getLongitude() const; int getResponse() const; + QList getPersonnage() const; + QList getTexte() const; }; #endif // STEP_H From 55837df72e924b4c1322206c7b0d068d3a007e4b Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:01:03 +0200 Subject: [PATCH 13/18] display dialog --- mainwindow.cpp | 12 +++++++++--- mainwindow.ui | 42 +++++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 867ab0e..224cb9a 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -98,9 +98,15 @@ void MainWindow::loadPath() loadImage(p->getImage()); if(!steps.isEmpty()) { - ui->stepTitle->setText(p->getStep().first().getTitle()); - ui->LatitudeSpin->setValue(p->getStep().first().getLatitude()); - ui->longitudeSpin->setValue(p->getStep().first().getLongitude()); + Step firstStep = p->getStep().first(); + ui->stepTitle->setText(firstStep.getTitle()); + ui->LatitudeSpin->setValue(firstStep.getLatitude()); + ui->longitudeSpin->setValue(firstStep.getLongitude()); + + for(int i = 0; i < firstStep.getTexte().length(); i++) { + QString q = firstStep.getPersonnage().at(i) + ": " + firstStep.getTexte().at(i); + ui->dialogEdit->appendPlainText(q); + } } int pathCount = path.length(); diff --git a/mainwindow.ui b/mainwindow.ui index a380958..9f5614c 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,9 +7,21 @@ 0 0 800 - 626 + 598 + + + 0 + 0 + + + + + 0 + 0 + + MainWindow @@ -285,14 +297,20 @@ - + + + + 0 + 0 + + QFrame::Shape::StyledPanel QFrame::Shadow::Raised - + 0 @@ -325,7 +343,7 @@ - + 0 @@ -336,7 +354,7 @@ - + @@ -362,7 +380,7 @@ - + @@ -391,7 +409,7 @@ - + @@ -411,6 +429,16 @@ + + + + 10 + 130 + 761 + 81 + + + From ace7763606ec823c2184d3ff6de3ea788df094c6 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:01:18 +0200 Subject: [PATCH 14/18] add new parcours --- data/parcours2.json | 80 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 data/parcours2.json diff --git a/data/parcours2.json b/data/parcours2.json new file mode 100644 index 0000000..6ed3056 --- /dev/null +++ b/data/parcours2.json @@ -0,0 +1,80 @@ +{ + "name": "Chemin des Saveurs", + "city": "Bourg en Bresse", + "departement": 1, + "difficulty": 3, + "duration": 3.8, + "length": 24.6, + "description": "Parcours gourmand et culturel entre ville et campagne, à la découverte des trésors cachés de Bourg en Bresse.", + "image": "data/parcours1.png", + "steps": [ + { + "numero": 1, + "title": "Départ au centre-ville", + "GPS": "N 46 12.321 E 5 13.245", + "indice": "Sous la grande horloge, cherchez la plaque dorée.", + "reponse": "Horloge", + "dialogue": [ + { + "personnage": "Clémentine", + "texte": "Bienvenue à tous, voici le centre historique !" + }, + { + "personnage": "Léo", + "texte": "Regardez cette magnifique horloge, elle date du XIXe siècle !" + } + ] + }, + { + "numero": 2, + "title": "Marché couvert", + "GPS": "N 46 12.500 E 5 13.800", + "indice": "Le nombre de colonnes à l'entrée principale vous donnera la solution.", + "reponse": 6, + "dialogue": [ + { + "personnage": "Aurélie", + "texte": "Ici, on trouve les meilleurs fromages de la région !" + }, + { + "personnage": "Sami", + "texte": "Combien de colonnes vois-tu à l'entrée ?" + } + ] + }, + { + "numero": 3, + "title": "Au bord de la Reyssouze", + "GPS": "N 46 12.900 E 5 13.900", + "indice": "Sous le vieux pont de pierre, cherchez une gravure effacée.", + "reponse": "1912", + "dialogue": [ + { + "personnage": "Juliette", + "texte": "La Reyssouze apporte de la fraîcheur en été." + }, + { + "personnage": "Marc", + "texte": "Regarde cette inscription ancienne sur la pierre, tu arrives à la lire ?" + } + ] + }, + { + "numero": 4, + "title": "Arrivée à l'abbaye", + "GPS": "N 46 13.024 E 5 14.160", + "indice": "L'année inscrite au-dessus du portail principal.", + "reponse": 1655, + "dialogue": [ + { + "personnage": "Claire", + "texte": "Voilà l'abbaye ! Admire l'architecture." + }, + { + "personnage": "Nathalie", + "texte": "C'est ici la dernière étape. Observez bien la date !" + } + ] + } + ] +} From 1be6f69c035dec7310f670489c6a1762ae805502 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:30:12 +0200 Subject: [PATCH 15/18] Add minimum value for pathNumberSpin --- mainwindow.ui | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mainwindow.ui b/mainwindow.ui index 9f5614c..eef97a1 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -78,6 +78,12 @@ 27 + + 1 + + + 1 + From dda5d3e724fd78162a5e933eac4875b78d922651 Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:30:25 +0200 Subject: [PATCH 16/18] Add loadNewPath function --- mainwindow.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mainwindow.h b/mainwindow.h index 7c78516..eeed028 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -22,7 +22,8 @@ public: void updatePathView(); void updateStepView(size_t num); void onTextChanged(); - void loadPath(); + void loadNewPath(); + void loadPath(Path* p); void addNewPath(); void addNewStep(); void exportHTMLMap(); @@ -43,6 +44,8 @@ private slots: void on_actionEditCut_triggered(); + void on_pathNumber_valueChanged(int arg1); + private: Ui::MainWindow *ui; QString currentFile; From c2151515f5e85d90731faf30fcbdb87684722c0d Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:30:45 +0200 Subject: [PATCH 17/18] Possibility to change the current Path --- mainwindow.cpp | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 224cb9a..bfde8c8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -73,7 +73,7 @@ void MainWindow::onTextChanged() textChanged = true; } -void MainWindow::loadPath() +void MainWindow::loadNewPath() { QString fileName = QFileDialog::getOpenFileName(this, "Open the file"); if(fileName.isEmpty()) return; @@ -85,9 +85,20 @@ void MainWindow::loadPath() file.close(); Path* p = new Path(&file); - QList steps = p->getStep(); currentPath = p; path.append(p); + loadPath(p); + + int pathCount = path.length(); + ui->pathNumber->setMaximum(pathCount); + ui->pathNumber->setSuffix("/" + QString::number(pathCount)); + ui->pathNumber->setValue(path.indexOf(currentPath)+1); +} + +void MainWindow::loadPath(Path* p) { + + QList steps = p->getStep(); + ui->titleEdit->setText(p->getName()); ui->locEdit->setText(p->getCity()); @@ -97,6 +108,8 @@ void MainWindow::loadPath() ui->imagePath->setText(p->getImage()); loadImage(p->getImage()); + ui->dialogEdit->clear(); + if(!steps.isEmpty()) { Step firstStep = p->getStep().first(); ui->stepTitle->setText(firstStep.getTitle()); @@ -108,11 +121,6 @@ void MainWindow::loadPath() ui->dialogEdit->appendPlainText(q); } } - - int pathCount = path.length(); - ui->pathNumber->setMaximum(pathCount); - ui->pathNumber->setSuffix("/" + QString::number(pathCount)); - ui->pathNumber->setValue(path.indexOf(currentPath)+1); } void MainWindow::addNewPath() @@ -174,7 +182,7 @@ void MainWindow::on_pushButton_clicked() void MainWindow::on_actionOpen_triggered() { - this->loadPath(); + this->loadNewPath(); } void MainWindow::on_toolButton_clicked() @@ -187,7 +195,7 @@ void MainWindow::on_toolButton_clicked() void MainWindow::on_actionopenFile_triggered() { - this->loadPath(); + this->loadNewPath(); } void MainWindow::on_actionEditCopy_triggered() @@ -230,3 +238,9 @@ void MainWindow::on_actionEditCut_triggered() } } + +void MainWindow::on_pathNumber_valueChanged(int arg1) +{ + this->loadPath(path.at(ui->pathNumber->value()-1)); +} + From 9ae7d4e834c3cad3c139859c5450529f3e3cc70b Mon Sep 17 00:00:00 2001 From: T'JAMPENS QUENTIN p2406187 Date: Fri, 20 Jun 2025 11:52:46 +0200 Subject: [PATCH 18/18] Can change step --- mainwindow.cpp | 21 +++++++++++++++++++++ mainwindow.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/mainwindow.cpp b/mainwindow.cpp index bfde8c8..5570c48 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -120,6 +120,21 @@ void MainWindow::loadPath(Path* p) { QString q = firstStep.getPersonnage().at(i) + ": " + firstStep.getTexte().at(i); ui->dialogEdit->appendPlainText(q); } + + ui->stepNumber->setValue(1); + ui->stepNumber->setSuffix("/" + QString::number(steps.length())); + ui->stepNumber->setMaximum(steps.length()); + } +} + +void MainWindow::loadStep(Step s) { + ui->stepTitle->setText(s.getTitle()); + ui->LatitudeSpin->setValue(s.getLatitude()); + ui->longitudeSpin->setValue(s.getLongitude()); + + for(int i = 0; i < s.getTexte().length(); i++) { + QString q = s.getPersonnage().at(i) + ": " + s.getTexte().at(i); + ui->dialogEdit->appendPlainText(q); } } @@ -244,3 +259,9 @@ void MainWindow::on_pathNumber_valueChanged(int arg1) this->loadPath(path.at(ui->pathNumber->value()-1)); } + +void MainWindow::on_stepNumber_valueChanged(int arg1) +{ + this->loadStep(currentPath->getStep().at(arg1-1)); +} + diff --git a/mainwindow.h b/mainwindow.h index eeed028..7b9cccc 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -24,6 +24,7 @@ public: void onTextChanged(); void loadNewPath(); void loadPath(Path* p); + void loadStep(Step s); void addNewPath(); void addNewStep(); void exportHTMLMap(); @@ -46,6 +47,8 @@ private slots: void on_pathNumber_valueChanged(int arg1); + void on_stepNumber_valueChanged(int arg1); + private: Ui::MainWindow *ui; QString currentFile;