MenuBar edit, first signals and slots

This commit is contained in:
Ronan Le Tiec 2020-04-10 21:08:29 +02:00
parent 3ce9de7181
commit f4e4f100f3
5 changed files with 258 additions and 13 deletions

View File

@ -34,6 +34,8 @@ PuzzleMainWindow::PuzzleMainWindow(QWidget *parent) :
ui(new Ui::PuzzleMainWindow) ui(new Ui::PuzzleMainWindow)
{ {
ui->setupUi(this); ui->setupUi(this);
InitMenuBar();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -48,3 +50,114 @@ bool PuzzleMainWindow::LoadFile(const QString &path)
Q_UNUSED(path) Q_UNUSED(path)
return true; 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
}

View File

@ -29,6 +29,7 @@
#define PUZZLEMAINWINDOW_H #define PUZZLEMAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#include <QMessageBox>
namespace Ui { namespace Ui {
class PuzzleMainWindow; class PuzzleMainWindow;
@ -47,6 +48,19 @@ public:
private: private:
Q_DISABLE_COPY(PuzzleMainWindow) Q_DISABLE_COPY(PuzzleMainWindow)
Ui::PuzzleMainWindow *ui; Ui::PuzzleMainWindow *ui;
void InitMenuBar();
void New();
void Open();
void Save();
void SaveAs();
void ImportRawLayout();
void CloseLayout();
void AboutQt();
void AboutPuzzle();
}; };
#endif // PUZZLEMAINWINDOW_H #endif // PUZZLEMAINWINDOW_H

View File

@ -1,24 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PuzzleMainWindow</class> <class>PuzzleMainWindow</class>
<widget class="QMainWindow" name="PuzzleMainWindow" > <widget class="QMainWindow" name="PuzzleMainWindow">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>1427</width>
<height>300</height> <height>904</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string>PuzzleMainWindow</string> <string>PuzzleMainWindow</string>
</property> </property>
<widget class="QMenuBar" name="menuBar" /> <widget class="QWidget" name="centralWidget"/>
<widget class="QToolBar" name="mainToolBar" /> <widget class="QMenuBar" name="menuBar">
<widget class="QWidget" name="centralWidget" /> <property name="geometry">
<widget class="QStatusBar" name="statusBar" /> <rect>
<x>0</x>
<y>0</y>
<width>1427</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionOpen"/>
<addaction name="actionSave"/>
<addaction name="actionSaveAs"/>
<addaction name="separator"/>
<addaction name="actionImportRawLayout"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
<string>&amp;Edit</string>
</property>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuWindows">
<property name="title">
<string>&amp;Windows</string>
</property>
<addaction name="actionCloseLayout"/>
</widget>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>&amp;Help</string>
</property>
<addaction name="actionAboutQt"/>
<addaction name="actionAboutPuzzle"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuWindows"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionSave">
<property name="text">
<string>Save</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="actionSaveAs">
<property name="text">
<string>Save As</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="actionCloseLayout">
<property name="text">
<string>Close Layout</string>
</property>
</action>
<action name="actionImportRawLayout">
<property name="text">
<string>Import Raw Layout Data</string>
</property>
</action>
<action name="actionExit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="icon">
<iconset theme="application-exit"/>
</property>
<property name="text">
<string>E&amp;xit</string>
</property>
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionNew">
<property name="text">
<string>New</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="actionAboutQt">
<property name="text">
<string>About &amp;Qt</string>
</property>
</action>
<action name="actionAboutPuzzle">
<property name="text">
<string>About &amp;Puzzle</string>
</property>
</action>
</widget> </widget>
<layoutDefault spacing="6" margin="11" /> <layoutdefault spacing="6" margin="11"/>
<pixmapfunction></pixmapfunction>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View File

@ -30,7 +30,7 @@
#define STABLE_H #define STABLE_H
/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */ /* 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 */ /* Add C includes here */

View File

@ -33,7 +33,7 @@
#define VER_INTERNALNAME_STR "Puzzle" #define VER_INTERNALNAME_STR "Puzzle"
#define VER_ORIGINALFILENAME_STR "puzzle.exe" #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." #define VER_FILEDESCRIPTION_STR "Valentina's manual layout creator."
#endif // VERSION_H #endif // VERSION_H