diff --git a/.gitignore b/.gitignore index e19bf19..76265f9 100644 --- a/.gitignore +++ b/.gitignore @@ -454,3 +454,4 @@ compile_commands.json *creator.user* *_qmlcache.qrc +build diff --git a/mainwindow.cpp b/mainwindow.cpp index 2740a6e..69a8d9e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,6 +1,9 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#include +#include + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) @@ -11,4 +14,98 @@ MainWindow::MainWindow(QWidget *parent) MainWindow::~MainWindow() { delete ui; + delete currentPath; + + for(Path* p : path) { + delete p; + } } + +void MainWindow::updatePathView() +{ + +} + +void MainWindow::updateStepView(size_t num) +{ + +} + +void MainWindow::onTextChanged() +{ + textChanged = true; +} + +void MainWindow::loadPath(QTextStream &in) +{ + +} + +void MainWindow::addNewPath() +{ + +} + +void MainWindow::addNewStep() +{ + +} + +void MainWindow::exportHTMLMap() +{ + +} + +void MainWindow::on_pushButton_clicked() +{ + + QString ext[] = {"png", "jpeg", "jpg"}; + + QString fileName = QFileDialog::getOpenFileName(this, "Open the file"); + if (fileName.isEmpty()) return; + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly | QFile::Text)) { + QMessageBox::warning(this, "Warning", "Cannot open file: " + + file.errorString()); + return; + } + 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(); + + +} + + +void MainWindow::on_actionOpen_triggered() +{ + + QString fileName = QFileDialog::getOpenFileName(this, "Open the file"); + if(fileName.isEmpty()) return; + QFile file(fileName); + if(!file.open(QIODevice::ReadOnly | QFile::Text)) { + QMessageBox::warning(this, "Warning", "Fichier non valide" + file.errorString()); + return; + } + + +} + diff --git a/mainwindow.h b/mainwindow.h index d622c71..38e219a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -3,6 +3,8 @@ #include +#include "path.h" + QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; @@ -24,9 +26,16 @@ public: void addNewStep(); void exportHTMLMap(); +private slots: + void on_pushButton_clicked(); + + void on_actionOpen_triggered(); + private: Ui::MainWindow *ui; QString currentFile; bool textChanged; + QList path; + Path* currentPath; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index c6854ca..8c3b28b 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,13 +7,281 @@ 0 0 800 - 600 + 626 MainWindow - + + + + 800 + 521 + + + + + + + + 0 + 0 + + + + + 16777215 + 20 + + + + Path information + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + + + + + + 16777215 + 16777215 + + + + QFrame::Shape::StyledPanel + + + QFrame::Shadow::Raised + + + + + 10 + 20 + 45 + 27 + + + + + + + 60 + 20 + 391 + 26 + + + + + + + 10 + 60 + 441 + 45 + + + + + 0 + + + 0 + + + + + Localisation + + + + + + + + + + + + + + + 470 + 20 + 281 + 191 + + + + + + + + + + 0 + 110 + 451 + 63 + + + + + 0 + + + 0 + + + + + + + + Difficulty + + + + + + + /5 + + + 5 + + + + + + + + + + + + + Duration + + + + + + + h + + + 1 + + + 0.100000000000000 + + + + + + + + + + + + + Length + + + + + + + Km + + + 1 + + + 500.000000000000000 + + + 0.100000000000000 + + + + + + + + + + + + 0 + 180 + 451 + 44 + + + + + 9 + + + 0 + + + + + Image + + + + + + + + + + Select Image File + + + + + + + + + + + + 16777215 + 20 + + + + Step information + + + Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop + + + + + + + QFrame::Shape::StyledPanel + + + QFrame::Shadow::Raised + + + + + @@ -23,8 +291,192 @@ 23 + + + File + + + + + + + + Edit + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + + + + + + + + + + + + + + Open + + + Ctrl+O + + + + + Save + + + Ctrl+S + + + + + Save as + + + Ctrl+Shift+S + + + + + + + + NewFile + + + QAction::MenuRole::NoRole + + + + + + + + SaveFile + + + QAction::MenuRole::NoRole + + + + + + + + SaveAsFile + + + QAction::MenuRole::NoRole + + + + + + + + PrintFile + + + QAction::MenuRole::NoRole + + + + + + + + EditCopy + + + QAction::MenuRole::NoRole + + + + + + + + EditPaste + + + QAction::MenuRole::NoRole + + + + + + + + EditCut + + + QAction::MenuRole::NoRole + + + + + + + + EditDelete + + + QAction::MenuRole::NoRole + + + + + + + + EditUndo + + + QAction::MenuRole::NoRole + + + + + + + + EditRedo + + + QAction::MenuRole::NoRole + + + + + + + + New + + + QAction::MenuRole::NoRole + +