diff --git a/.gitignore b/.gitignore
index 76265f9..6b6b7d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+*.json
+*.html
+
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
## and Ignore Qt objects and libs.
diff --git a/data/images/d.json b/data/images/d.json
new file mode 100644
index 0000000..e69de29
diff --git a/data/parcours1.json b/data/parcours1.json
deleted file mode 100644
index bb5a755..0000000
--- a/data/parcours1.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "name": "parcous1",
- "city": "Bourg en bresse",
- "departement": 1,
- "difficulty": 2,
- "duration": 2.3,
- "length": 17.3,
- "image": "data/parcours1.png",
- "steps": [
- {
- "numero": 1,
- "title": "Première étape",
- "GPS": "N 45 37.199 W 1 2.009",
- "reponse": -1,
- "dialogue": [
- {
- "personnage": "Quentin",
- "texte": "ligne de dialogue 1"
- },
- {
- "personnage": "Malo",
- "texte": "ligne de dialogue 2"
- }
- ]
- },
- {
- "numero": 2,
- "title": "Deuxième étape",
- "GPS": "S 45 37.199 E 1 2.009",
- "reponse": 4156,
- "dialogue": [
- {
- "personnage": "Antoine",
- "texte": "ligne de dialogue 1"
- },
- {
- "personnage": "Giovanni",
- "texte": "ligne de dialogue 2"
- }
- ]
- }
- ]
-
-}
diff --git a/data/parcours1.png b/data/parcours1.png
deleted file mode 100644
index 11eb818..0000000
Binary files a/data/parcours1.png and /dev/null differ
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..376df10
--- /dev/null
+++ b/index.html
@@ -0,0 +1,53 @@
+
+
+
+
+ Liste des parcours
+
+
+
+ Liste des parcours
+
+
+
diff --git a/main.cpp b/main.cpp
index d268092..20f3942 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,12 +1,11 @@
#include "mainwindow.h"
-
#include "path.h"
-
#include
#include
#include
using namespace std;
+
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 8b88f75..c08434c 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1,9 +1,11 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "path.h"
+#include "step.h"
#include "Undo.h"
#include
#include
+#include
#include
#include
#include
@@ -11,6 +13,13 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include "web.h"
+
+int MainWindow::indexPath = 0;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
@@ -19,6 +28,14 @@ MainWindow::MainWindow(QWidget *parent)
, Clipboard(QGuiApplication::clipboard())
{
ui->setupUi(this);
+ indexPath++;
+ Path* p = new Path();
+ currentPath = p;
+ path.append(p);
+ loadPath(p);
+ int pathCount = path.length();
+ ui->pathNumber->setMaximum(pathCount);
+ ui->pathNumber->setSuffix("/" + QString::number(pathCount));
connect(ui->titleEdit, &QLineEdit::editingFinished, this, [this]() {
@@ -50,6 +67,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(ui->actionEditUndo, &QAction::triggered, undoStack, &QUndoStack::undo);
connect(ui->actionEditRedo, &QAction::triggered, undoStack, &QUndoStack::redo);
+ currentPath->getStep().append(Step());
}
MainWindow::~MainWindow()
@@ -61,23 +79,18 @@ MainWindow::~MainWindow()
delete p;
}
}
-
void MainWindow::updatePathView()
-{
-
-}
+{}
void MainWindow::updateStepView(size_t num)
-{
-
-}
+{}
void MainWindow::onTextChanged()
{
textChanged = true;
}
-void MainWindow::loadPath()
+void MainWindow::loadNewPath()
{
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
if(fileName.isEmpty()) return;
@@ -91,6 +104,19 @@ void MainWindow::loadPath()
Path* p = new Path(&file);
currentPath = p;
path.append(p);
+ loadPath(p);
+ currentFile = fileName;
+
+ 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());
@@ -98,56 +124,276 @@ void MainWindow::loadPath()
ui->lengthSpin->setValue(p->getLength());
ui->durationSpin->setValue(p->getDuration());
ui->imagePath->setText(p->getImage());
-
+ ui->depSpin->setValue(p->getDepartement());
loadImage(p->getImage());
+
+
+ ui->dialogEdit->clear();
+
+ if(!steps.isEmpty()) {
+ 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);
+ }
+
+ 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());
+ ui->responseSpin->setValue(s.getResponse());
+
+ for(int i = 0; i < s.getTexte().length(); i++) {
+ QString q = s.getPersonnage().at(i) + ": " + s.getTexte().at(i);
+ ui->dialogEdit->appendPlainText(q);
+ }
}
void MainWindow::addNewPath()
{
-
+ path.append(currentPath);
}
void MainWindow::addNewStep()
{
-
}
-
-void MainWindow::exportHTMLMap()
+void MainWindow::exportHTMLMap(int index)
{
+ std::ofstream file("./pages/parcours" + std::to_string(index) + ".html");
+ if (!file.is_open()) {
+ QMessageBox::warning(this, "Erreur", "Impossible d'ouvrir le fichier.");
+ return;
+ }
+
+ file << R"(
+
+
+
+ Carte du parcours
+
+
+
+
+
+ Fiche du parcours
+
+
+
+)";
+
+ if (currentPath) {
+ Path* p = currentPath;
+ file << "
" << p->getName().toStdString() << "
\n";
+ file << "
Ville : " << p->getCity().toStdString() << "
\n";
+ file << "
Département : " << p->getDepartement() << "
\n";
+ file << "
Difficulté : " << p->getDifficulty() << "
\n";
+ file << "
Durée (heures) : " << p->getDuration() << "
\n";
+ file << "
Longueur (km) : " << p->getLength() << "
\n";
+ if (!p->getImage().isEmpty()) {
+ file << "

getImage().toStdString() << "\">\n";
+ }
+ int stepNum = 1;
+ for (const Step& s : p->getStep()) {
+ file << "
Étape " << stepNum << "
\n";
+ const QList
persos = s.getPersonnage();
+ const QList textes = s.getTexte();
+
+ if (!persos.isEmpty()) {
+ file << "Personnages :
\n";
+ for (const QString& pers : persos) {
+ file << "- " << pers.toStdString() << "
\n";
+ }
+ file << "
\n";
+ }
+
+ if (!textes.isEmpty()) {
+ file << "Dialogues :
\n";
+ for (const QString& txt : textes) {
+ file << "- " << txt.toStdString() << "
\n";
+ }
+ file << "
\n";
+ }
+
+ stepNum++;
+ }
+ }
+
+ file << R"(
+
+
+
+
+
+
+
+)";
+ file.close();
+}
+
+
+
void MainWindow::loadImage(QString fileName) {
-
QString ext[] = {"png", "jpeg", "jpg"};
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QFile::Text)) {
- QMessageBox::warning(this, "Warning", "Cannot open file: " +
+ QMessageBox::warning(this, "Warning", "Cannot open image: " +
file.errorString());
- return;
- }
- QString text = file.fileName();
- bool acceptedExt = false;
- for(QString e : ext) {
- if(text.endsWith(e)) acceptedExt = true;
+ }else{
+ QString text = file.fileName();
+ bool acceptedExt = false;
+ for(QString e : ext) {
+ if(text.endsWith(e)) acceptedExt = true;
+ }
+ if(!acceptedExt) {
+ QMessageBox::warning(this, "Warning", "Format de fichier incorrect");
+ return;
+ }
+
+
+ ui->imagePath->setText(text);
+
+
+ QPixmap px(fileName);
+
+ ui->imageLbl->setPixmap(px);
+
+ file.close();
}
- if(!acceptedExt) {
- QMessageBox::warning(this, "Warning", "Format de fichier incorrect");
- return;
- }
-
-
- ui->imagePath->setText(text);
-
-
- QPixmap px(fileName);
-
- ui->imageLbl->setPixmap(px);
-
- file.close();
}
@@ -161,7 +407,7 @@ void MainWindow::on_pushButton_clicked()
void MainWindow::on_actionOpen_triggered()
{
- this->loadPath();
+ this->loadNewPath();
}
void MainWindow::on_toolButton_clicked()
@@ -171,49 +417,207 @@ void MainWindow::on_toolButton_clicked()
loadImage(fileName);
}
+int MainWindow::getIndexPath() const
+{
+ return indexPath;
+}
+
+void MainWindow::setIndexPath(int newIndexPath)
+{
+ indexPath = newIndexPath;
+}
+
+QString MainWindow::getCurrentFile() const
+{
+ return currentFile;
+}
+
+void MainWindow::setCurrentFile(const QString &newCurrentFile)
+{
+ currentFile = newCurrentFile;
+}
+
+QList MainWindow::getPath() const
+{
+ return path;
+}
+
+void MainWindow::setPath(const QList &newPath)
+{
+ path = newPath;
+}
+
+Path *MainWindow::getCurrentPath() const
+{
+ return currentPath;
+}
+
+void MainWindow::setCurrentPath(Path *newCurrentPath)
+{
+ currentPath = newCurrentPath;
+}
+
+void MainWindow::saveFile(){
+ QString fileName;
+ if (currentFile.isEmpty()) {
+ fileName = QFileDialog::getSaveFileName(this, "Save");
+ currentFile = fileName;
+ } else {
+ fileName = currentFile;
+ }
+ QFile file(fileName);
+ if (!file.open(QIODevice::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
+ return;
+ }
+ setWindowTitle(fileName);
+ QJsonObject json;
+ json["name"] = ui->titleEdit->text();
+ json["city"] =ui->locEdit->text();
+ json["departement"] = ui->depSpin->text();
+ json["difficulty"] = ui->diffSpin->value();
+ json["duration"] = ui->durationSpin->value();
+ json["length"] = ui->lengthSpin->value();
+ json["image"] = ui->imagePath->text();
+
+ QJsonArray steps;
+ int cpt=0;
+ for(Step step: currentPath->getStep()){
+ cpt++;
+ QJsonObject stepObject;
+ stepObject["numero"] = cpt;
+ stepObject["title"] = step.getTitle();
+ stepObject["GPS"] = step.toGPSFormat();
+ stepObject["reponse"] = step.getResponse();
+ QJsonArray dialogues;
+ for(int i=0; isaveFile();
+}
void MainWindow::on_actionopenFile_triggered()
{
- this->loadPath();
+ this->loadNewPath();
+}
+
+void MainWindow::copyText(){
+ QWidget *focused = QApplication::focusWidget();
+ QLineEdit* lineEdit = qobject_cast(focused);
+ QPlainTextEdit* plainTextEdit = qobject_cast(focused);
+
+ if (lineEdit && !lineEdit->selectedText().isEmpty()) {
+ Clipboard->setText(lineEdit->selectedText());
+ } else if (plainTextEdit) {
+ QTextCursor cursor = plainTextEdit->textCursor();
+ if (cursor.hasSelection()) {
+ Clipboard->setText(cursor.selectedText());
+ }
+ }
+
}
void MainWindow::on_actionEditCopy_triggered()
{
- QWidget *focused = QApplication::focusWidget();
- QLineEdit* lineEdit = qobject_cast(focused);
-
- if(lineEdit) {
- Clipboard->setText(lineEdit->selectedText());
- }
+ this->copyText();
}
+void MainWindow::pastText(){
+ QWidget *focused = QApplication::focusWidget();
+ QLineEdit* lineEdit = qobject_cast(focused);
+ QPlainTextEdit* plainTextEdit = qobject_cast(focused);
+ if (lineEdit) {
+ lineEdit->insert(Clipboard->text());
+ } else if (plainTextEdit) {
+ plainTextEdit->insertPlainText(Clipboard->text());
+ }
+}
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);
- }
+ this->pastText();
}
-void MainWindow::on_actionEditCut_triggered()
-{
+void MainWindow::cutText(){
QWidget *focused = QApplication::focusWidget();
QLineEdit* lineEdit = qobject_cast(focused);
+ QPlainTextEdit* plainTextEdit = qobject_cast(focused);
- if(lineEdit) {
- QString text = lineEdit->text();
+ if (lineEdit) {
QString selectedText = lineEdit->selectedText();
- int pos = lineEdit->selectionStart();
- text.remove(pos, selectedText.length());
- Clipboard->setText(selectedText);
- lineEdit->setText(text);
+ if (!selectedText.isEmpty()) {
+ Clipboard->setText(selectedText);
+ lineEdit->del();
+ }
+ } else if (plainTextEdit) {
+ QTextCursor cursor = plainTextEdit->textCursor();
+ if (cursor.hasSelection()) {
+ Clipboard->setText(cursor.selectedText());
+ cursor.removeSelectedText();
+ }
+ }
+}
+void MainWindow::on_actionEditCut_triggered()
+{
+ this->cutText();
+}
+
+
+void MainWindow::on_pathNumber_valueChanged(int arg1)
+{
+ this->loadPath(path.at(ui->pathNumber->value()-1));
+ currentPath = path.at(arg1-1);
+}
+
+
+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());
+ currentPath->getStep()[ui->stepNumber->value()-1].setTitle(ui->stepTitle->text());
+ currentPath->getStep()[ui->stepNumber->value()-1].setResponse(ui->responseSpin->value());
+}
+
+void MainWindow::loadAndExportPaths(QStringList fichiers) {
+
+
+ for (const QString& nomFichier : fichiers) {
+ QFile* f = new QFile(nomFichier);
+
+ Path* p = new Path(f);
+ path.append(p);
+ }
+
+ int exportIndex = 1;
+ for (Path* p : path) {
+ currentPath = p;
+ exportHTMLMap(exportIndex++);
}
}
@@ -402,3 +806,116 @@ void MainWindow::on_actionFont_size_triggered()
this->setSize();
}
+
+
+void MainWindow::saveAsFile(){
+ QString fileName = QFileDialog::getSaveFileName(this, "Save as");
+ QFile file(fileName);
+
+ if (!file.open(QFile::WriteOnly | QFile::Text)) {
+ QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
+ return;
+ }
+ setWindowTitle(fileName);
+ currentFile = fileName;
+ QJsonObject json;
+ json["name"] = ui->titleEdit->text();
+ json["city"] =ui->locEdit->text();
+ json["departement"] = ui->depSpin->text();
+ json["difficulty"] = ui->diffSpin->value();
+ json["duration"] = ui->durationSpin->value();
+ json["length"] = ui->lengthSpin->value();
+ json["image"] = ui->imagePath->text();
+
+ QJsonArray steps;
+ int cpt=0;
+ for(Step step: currentPath->getStep()){
+ cpt++;
+ QJsonObject stepObject;
+ stepObject["numero"] = cpt;
+ stepObject["title"] = step.getTitle();
+ stepObject["GPS"] = step.toGPSFormat();
+ stepObject["reponse"] = step.getResponse();
+ QJsonArray dialogues;
+ for(int i=0; isaveAsFile();
+}
+
+
+void MainWindow::on_exportHTMLBtn_clicked()
+{
+ for(int i = 0; i < path.length(); i++) {
+ this->exportHTMLMap(i);
+ }
+
+ Web w(path);
+ w.siteHtml();
+}
+
+
+void MainWindow::on_actionSaveFile_triggered()
+{
+ this->saveFile();
+}
+
+
+void MainWindow::on_actionSaveAsFile_triggered()
+{
+ this->saveAsFile();
+}
+
+
+void MainWindow::on_actionCopy_triggered()
+{
+ this->copyText();
+}
+
+
+void MainWindow::on_actionPast_triggered()
+{
+ this->pastText();
+}
+
+
+void MainWindow::on_actionCut_triggered()
+{
+ this->cutText();
+}
+
+void MainWindow::newPath(){
+ Path* p = new Path();
+ 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::on_actionNew_triggered()
+{
+ this->newPath();
+}
+
+
+void MainWindow::on_actionNewFile_triggered()
+{
+ this->newPath();
+}
diff --git a/mainwindow.h b/mainwindow.h
index 2b41a0a..62737dc 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -22,9 +22,25 @@ public:
void updatePathView();
void updateStepView(size_t num);
void onTextChanged();
- void loadPath();
+ void loadNewPath();
+ void loadPath(Path* p);
+ void loadStep(Step s);
void addNewPath();
void addNewStep();
+ void exportHTMLMap(int index);
+ void loadAndExportPaths(QStringList fichiers);
+ QString getCurrentFile() const;
+ void setCurrentFile(const QString &newCurrentFile);
+ QList getPath() const;
+ void setPath(const QList &newPath);
+ Path *getCurrentPath() const;
+ void setCurrentPath(Path *newCurrentPath);
+ void saveAsFile();
+ void copyText();
+ void pastText();
+ void cutText();
+ int getIndexPath() const;
+ void setIndexPath(int newIndexPath);
void exportHTMLMap();
void setBold();
void setItalic();
@@ -33,6 +49,8 @@ public:
void setOverline();
void setSize();
void setFont();
+ void saveFile();
+ void newPath();
private slots:
void on_pushButton_clicked();
@@ -41,8 +59,9 @@ private slots:
void on_toolButton_clicked();
- void on_actionopenFile_triggered();
+ void on_actionSave_triggered();
+ void on_actionopenFile_triggered();
void on_actionEditCopy_triggered();
@@ -78,9 +97,35 @@ private slots:
void on_actionFont_size_triggered();
+ void on_pathNumber_valueChanged(int arg1);
+
+ void on_stepNumber_valueChanged(int arg1);
+
+ void on_validateBtn_clicked();
+
+ void on_actionSave_as_triggered();
+
+ void on_exportHTMLBtn_clicked();
+
+ void on_actionSaveFile_triggered();
+
+ void on_actionSaveAsFile_triggered();
+
+ void on_actionCopy_triggered();
+
+ void on_actionPast_triggered();
+
+ void on_actionCut_triggered();
+
+ void on_actionNew_triggered();
+
+ void on_actionNewFile_triggered();
+
+
private:
Ui::MainWindow *ui;
QString currentFile;
+ static int indexPath;
bool textChanged;
QList path;
Path* currentPath;
diff --git a/mainwindow.ui b/mainwindow.ui
index 28ebdf3..ddabe8c 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -7,17 +7,41 @@
0
0
800
- 626
+ 868
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
MainWindow
+
+
+ 0
+ 30
+
+
+
+
+ 0
+ 0
+
+
800
- 521
+ 1000
@@ -42,6 +66,12 @@
-
+
+
+ 0
+ 0
+
+
16777215
@@ -51,215 +81,228 @@
QFrame::NoFrame
-
-
-
- 10
- 20
- 45
- 27
-
-
-
-
-
-
- 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
+
+
+
+
+ 16777215
+ 200
+
+
+
+
+
+
+ true
+
+
+
+
-
@@ -276,20 +319,155 @@
-
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
QFrame::NoFrame
-
-
-
- 200
- 80
- 391
- 101
-
-
-
+
+
-
+
+
+
-
+
+
+ 1
+
+
+
+ -
+
+
+ -
+
+
+ ...
+
+
+
+ :/data/images/data/images/add.png:/data/images/data/images/add.png
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+
-
+
+
+ Latitude
+
+
+
+ -
+
+
+ 6
+
+
+ 90.000000000000000
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+ Longitude
+
+
+
+ -
+
+
+ 6
+
+
+ -180.000000000000000
+
+
+ 180.000000000000000
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+ Response
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 255
+
+
+
+
+ 0
+ 0
+
+
+
+ false
+
+
+
+ -
+
+
+ Valider
+
+
+
+ -
+
+
+ Export HTML
+
+
+
+
@@ -307,6 +485,7 @@
File
+
@@ -315,6 +494,11 @@
Edit
+
+
+
+
+
-
toolBar
@@ -348,7 +531,6 @@
-
@@ -424,18 +606,6 @@
QAction::NoRole
-
-
-
- :/data/images/data/images/print.png:/data/images/data/images/print.png
-
-
- Print
-
-
- QAction::NoRole
-
-
@@ -508,111 +678,52 @@
QAction::NoRole
-
-
-
- :/data/images/data/images/bold.png:/data/images/data/images/bold.png
-
+
- Bold
-
-
-
-
-
- :/data/images/data/images/italic.png:/data/images/data/images/italic.png
-
-
- Italic
-
-
-
-
-
- :/data/images/data/images/underline.png:/data/images/data/images/underline.png
-
-
- Underline
-
-
-
-
-
- :/data/images/data/images/font-color.png:/data/images/data/images/font-color.png
-
-
- Color
-
-
-
-
-
- :/data/images/data/images/overline.png:/data/images/data/images/overline.png
-
-
- Overline
-
-
-
-
-
- :/data/images/data/images/font.png:/data/images/data/images/font.png
-
-
- Font
-
-
-
-
-
- :/data/images/data/images/font-size.png:/data/images/data/images/font-size.png
-
-
- Size
-
-
-
-
- Font color
-
-
-
-
- Font
-
-
-
-
- Font size
-
-
-
-
- Bold
+ New path
- Ctrl+B
+ Ctrl+N
-
+
- Italic
+ Copy
- Ctrl+I
+ Ctrl+C
-
+
- Underline
+ Past
- Ctrl+U
+ Ctrl+V
-
+
- Overline
+ Cut
+
+
+ Ctrl+X
+
+
+
+
+ Undo
+
+
+ Ctrl+Z
+
+
+
+
+ Redo
+
+
+ Ctrl+Y
diff --git a/pages/parcours1.html b/pages/parcours1.html
new file mode 100644
index 0000000..7f4959a
--- /dev/null
+++ b/pages/parcours1.html
@@ -0,0 +1,124 @@
+
+
+
+
+ Carte du parcours
+
+
+
+
+
+ Fiche du parcours
+
+
+
+
parcous123
+
Ville : Bourg en bresse
+
Département : 0
+
Difficulté : 2
+
Durée (heures) : 2.3
+
Longueur (km) : 17.3
+

+
Étape 1
+
Personnages :
+
+
Dialogues :
+
+
Étape 2
+
Personnages :
+
+
Dialogues :
+
+
+
+
+
+
+
+
+
diff --git a/path.cpp b/path.cpp
index 26a2558..9f670e0 100644
--- a/path.cpp
+++ b/path.cpp
@@ -45,11 +45,48 @@ QString Path::getImage() const
return image;
}
-QList Path::getStep() const
+QList& Path::getStep()
{
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(){}
+
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..fef7334 100644
--- a/path.h
+++ b/path.h
@@ -28,7 +28,14 @@ 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);
+ void setDifficulty(unsigned int newDifficulty);
+ void setDuration(float newDuration);
+ void setLength(float newLength);
+ void setImage(const QString &newImage);
};
#endif // PATH_H
diff --git a/sae201.pro b/sae201.pro
index 04a7b14..e046919 100644
--- a/sae201.pro
+++ b/sae201.pro
@@ -13,12 +13,14 @@ SOURCES += \
mainwindow.cpp \
step.cpp \
path.cpp \
+ web.cpp
HEADERS += \
Undo.h \
mainwindow.h \
step.h \
path.h \
+ web.h
FORMS += \
mainwindow.ui
diff --git a/step.cpp b/step.cpp
index 861f414..419f676 100644
--- a/step.cpp
+++ b/step.cpp
@@ -27,13 +27,42 @@ int Step::getResponse() const
return response;
}
+QList Step::getPersonnage() const
+{
+ return personnage;
+}
+
+QList Step::getTexte() const
+{
+ return texte;
+}
+
+void Step::setTitle(const QString &newTitle)
+{
+ title = newTitle;
+}
+
+void Step::setResponse(int newResponse)
+{
+ response = newResponse;
+}
+
+void Step::setPersonnage(const QList &newPersonnage)
+{
+ personnage = newPersonnage;
+}
+
+void Step::setTexte(const QList &newTexte)
+{
+ texte = newTexte;
+}
+
Step::Step() {
latitude = 0.0;
longitude = 0.0;
response = 0;
}
-
Step::Step( QJsonObject &in)
{
title = in["title"].toString();
@@ -41,7 +70,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);
@@ -80,3 +109,25 @@ void Step::setLongitude(int degree, float minute, QChar EW)
if (EW.toUpper() == 'W')
longitude = -longitude;
}
+
+QString Step::toGPSFormat(){
+ int latDeg = static_cast(latitude);
+ float latMin = (latitude - latDeg) * 60.0;
+ QChar latDir = latitude >= 0 ? 'N' : 'S';
+ latDeg = abs(latDeg);
+
+ int lonDeg = static_cast(longitude);
+ float lonMin = (longitude - lonDeg) * 60.0;
+ QChar lonDir = longitude >= 0 ? 'E' : 'W';
+ lonDeg = abs(lonDeg);
+
+ QString gpsString = QString("%1 %2 %3 %4 %5 %6")
+ .arg(latDir)
+ .arg(latDeg, 2)
+ .arg(latMin, 5, 'f', 3)
+ .arg(lonDir)
+ .arg(lonDeg, 2)
+ .arg(lonMin, 5, 'f', 3);
+
+ return gpsString;
+}
diff --git a/step.h b/step.h
index 8d93c46..eb2bc9e 100644
--- a/step.h
+++ b/step.h
@@ -26,6 +26,13 @@ public:
float getLatitude() const;
float getLongitude() const;
int getResponse() const;
+ QList getPersonnage() const;
+ QList getTexte() const;
+ void setTitle(const QString &newTitle);
+ void setResponse(int newResponse);
+ void setPersonnage(const QList &newPersonnage);
+ void setTexte(const QList &newTexte);
+ QString toGPSFormat();
};
#endif // STEP_H
diff --git a/web.cpp b/web.cpp
new file mode 100644
index 0000000..7dd0a2d
--- /dev/null
+++ b/web.cpp
@@ -0,0 +1,85 @@
+#include "web.h"
+#include
+Web::Web()
+{}
+
+Web::Web(const QList& list) : list(list)
+{}
+
+void Web::siteHtml()
+{
+ std::ofstream file("index.html");
+ if (!file.is_open()) {
+ qWarning("Impossible d'ouvrir le fichier index.html");
+ return;
+ }
+
+ file << R"(
+
+
+
+ Liste des parcours
+
+
+
+ Liste des parcours
+
+)";
+
+ int index = 0;
+ for (const Path* p : list) {
+ QString fileName = QString("parcours%1.html").arg(index);
+ QString name = p->getName();
+ file << " - "
+ << name.toStdString()
+ << "
\n";
+ ++index;
+ }
+
+ file << R"(
+
+
+)";
+
+ file.close();
+}
diff --git a/web.h b/web.h
new file mode 100644
index 0000000..81a4b6b
--- /dev/null
+++ b/web.h
@@ -0,0 +1,17 @@
+#ifndef WEB_H
+#define WEB_H
+#include
+#include
+#include "path.h"
+class Web
+{
+private:
+ QList list;
+public:
+ Web();
+ Web(const QList &list);
+ void siteHtml();
+
+};
+
+#endif // WEB_H