From f4e4f100f3dd92b0960caed1eef9279f0a608b54 Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Fri, 10 Apr 2020 21:08:29 +0200 Subject: [PATCH] MenuBar edit, first signals and slots --- src/app/puzzle/puzzlemainwindow.cpp | 113 ++++++++++++++++++++++ src/app/puzzle/puzzlemainwindow.h | 14 +++ src/app/puzzle/puzzlemainwindow.ui | 140 +++++++++++++++++++++++++--- src/app/puzzle/stable.h | 2 +- src/app/puzzle/version.h | 2 +- 5 files changed, 258 insertions(+), 13 deletions(-) diff --git a/src/app/puzzle/puzzlemainwindow.cpp b/src/app/puzzle/puzzlemainwindow.cpp index 8e1c556f9..2fec23266 100644 --- a/src/app/puzzle/puzzlemainwindow.cpp +++ b/src/app/puzzle/puzzlemainwindow.cpp @@ -34,6 +34,8 @@ PuzzleMainWindow::PuzzleMainWindow(QWidget *parent) : ui(new Ui::PuzzleMainWindow) { ui->setupUi(this); + + InitMenuBar(); } //--------------------------------------------------------------------------------------------------------------------- @@ -48,3 +50,114 @@ bool PuzzleMainWindow::LoadFile(const QString &path) Q_UNUSED(path) return true; } + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::InitMenuBar() +{ + // connects the actions for the file menu + connect(ui->actionNew, &QAction::triggered, this, &PuzzleMainWindow::New); + connect(ui->actionOpen, &QAction::triggered, this, &PuzzleMainWindow::Open); + connect(ui->actionSave, &QAction::triggered, this, &PuzzleMainWindow::Save); + connect(ui->actionSaveAs, &QAction::triggered, this, &PuzzleMainWindow::SaveAs); + connect(ui->actionImportRawLayout, &QAction::triggered, this, &PuzzleMainWindow::ImportRawLayout); + connect(ui->actionExit, &QAction::triggered, this, &PuzzleMainWindow::close); + + // connects the actions for the edit menu + // TODO : initialise the undo / redo + + // connects the actions for the windows menu + // TODO : initialise the entries for the different windows + connect(ui->actionCloseLayout, &QAction::triggered, this, &PuzzleMainWindow::CloseLayout); + + // connects the action for the Help Menu + connect(ui->actionAboutQt, &QAction::triggered, this, &PuzzleMainWindow::AboutQt); + connect(ui->actionAboutPuzzle, &QAction::triggered, this, &PuzzleMainWindow::AboutPuzzle); + +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::New() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::New"); + int ret = msgBox.exec(); + + // TODO + + +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::Open() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::Open"); + int ret = msgBox.exec(); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::Save() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::Save"); + int ret = msgBox.exec(); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::SaveAs() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::SaveAs"); + int ret = msgBox.exec(); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::ImportRawLayout() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::ImportRawLayout"); + int ret = msgBox.exec(); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::CloseLayout() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::CloseLayout"); + int ret = msgBox.exec(); + + // TODO +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::AboutQt() +{ + QMessageBox::aboutQt(this, tr("About Qt")); +} + +//--------------------------------------------------------------------------------------------------------------------- +void PuzzleMainWindow::AboutPuzzle() +{ + // just for test purpuses, to be removed: + QMessageBox msgBox; + msgBox.setText("TODO PuzzleMainWindow::AboutPuzzle"); + int ret = msgBox.exec(); + + // TODO +} + + diff --git a/src/app/puzzle/puzzlemainwindow.h b/src/app/puzzle/puzzlemainwindow.h index 8f489647d..ac1ba0cb6 100644 --- a/src/app/puzzle/puzzlemainwindow.h +++ b/src/app/puzzle/puzzlemainwindow.h @@ -29,6 +29,7 @@ #define PUZZLEMAINWINDOW_H #include +#include namespace Ui { class PuzzleMainWindow; @@ -47,6 +48,19 @@ public: private: Q_DISABLE_COPY(PuzzleMainWindow) Ui::PuzzleMainWindow *ui; + + void InitMenuBar(); + + void New(); + void Open(); + void Save(); + void SaveAs(); + void ImportRawLayout(); + void CloseLayout(); + + void AboutQt(); + void AboutPuzzle(); + }; #endif // PUZZLEMAINWINDOW_H diff --git a/src/app/puzzle/puzzlemainwindow.ui b/src/app/puzzle/puzzlemainwindow.ui index 9de7e2667..0dee51b58 100644 --- a/src/app/puzzle/puzzlemainwindow.ui +++ b/src/app/puzzle/puzzlemainwindow.ui @@ -1,24 +1,142 @@ + PuzzleMainWindow - - + + 0 0 - 400 - 300 + 1427 + 904 - + PuzzleMainWindow - - - - + + + + + 0 + 0 + 1427 + 22 + + + + + &File + + + + + + + + + + + + + &Edit + + + + + + &Windows + + + + + + &Help + + + + + + + + + + + + TopToolBarArea + + + false + + + + + + Open + + + Ctrl+O + + + + + Save + + + Ctrl+S + + + + + Save As + + + Ctrl+Shift+S + + + + + Close Layout + + + + + Import Raw Layout Data + + + + + true + + + + + + E&xit + + + Ctrl+Q + + + + + New + + + Ctrl+N + + + + + About &Qt + + + + + About &Puzzle + + - - + diff --git a/src/app/puzzle/stable.h b/src/app/puzzle/stable.h index 4611a10a7..22e9d4702 100644 --- a/src/app/puzzle/stable.h +++ b/src/app/puzzle/stable.h @@ -30,7 +30,7 @@ #define STABLE_H /* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */ -#pragma message("Compiling precompiled headers for tape utility.\n") +#pragma message("Compiling precompiled headers for puzzle utility.\n") /* Add C includes here */ diff --git a/src/app/puzzle/version.h b/src/app/puzzle/version.h index 76e256844..bde0ae5b0 100644 --- a/src/app/puzzle/version.h +++ b/src/app/puzzle/version.h @@ -33,7 +33,7 @@ #define VER_INTERNALNAME_STR "Puzzle" #define VER_ORIGINALFILENAME_STR "puzzle.exe" -#define VER_PRODUCTNAME_STR "Tape" +#define VER_PRODUCTNAME_STR "Puzzle" #define VER_FILEDESCRIPTION_STR "Valentina's manual layout creator." #endif // VERSION_H