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->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
}

View File

@ -29,6 +29,7 @@
#define PUZZLEMAINWINDOW_H
#include <QMainWindow>
#include <QMessageBox>
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

View File

@ -1,24 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PuzzleMainWindow</class>
<widget class="QMainWindow" name="PuzzleMainWindow" >
<property name="geometry" >
<widget class="QMainWindow" name="PuzzleMainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>1427</width>
<height>904</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>PuzzleMainWindow</string>
</property>
<widget class="QMenuBar" name="menuBar" />
<widget class="QToolBar" name="mainToolBar" />
<widget class="QWidget" name="centralWidget" />
<widget class="QStatusBar" name="statusBar" />
<widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<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>
<layoutDefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@ -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 */

View File

@ -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