diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2740a6e..65b2f1a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -6,9 +6,44 @@ MainWindow::MainWindow(QWidget *parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
+ createActions();
+ createMenus();
+ this->setWindowIcon(QIcon::fromTheme(QIcon::ThemeIcon::Computer));
}
MainWindow::~MainWindow()
{
delete ui;
}
+
+void MainWindow::createActions()
+{
+ exitAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::ApplicationExit),
+ tr("E&xit"), this);
+ exitAct->setShortcuts(QKeySequence::Quit);
+ connect(exitAct, &QAction::triggered, this, &QWidget::close);
+
+ aboutAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::HelpAbout),
+ tr("&About"), this);
+ connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
+
+ aboutQtAct = new QAction(QIcon::fromTheme(QIcon::ThemeIcon::HelpAbout),
+ tr("About &Qt"), this);
+ connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
+}
+
+void MainWindow::createMenus()
+{
+ fileMenu = menuBar()->addMenu(tr("&File"));
+ fileMenu->addAction(exitAct);
+
+ helpMenu = menuBar()->addMenu(tr("&Help"));
+ helpMenu->addAction(aboutAct);
+ helpMenu->addAction(aboutQtAct);
+}
+
+void MainWindow::about()
+{
+ QMessageBox::about(this, tr("About SOM"),
+ tr("SOM is a tool to manage and organise Sparkleverse OS building."));
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index f7a3da3..8ed4437 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -2,11 +2,15 @@
#define MAINWINDOW_H
#include
+#include
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
+class QAction;
+class QLabel;
+class QMenu;
QT_END_NAMESPACE
class MainWindow : public QMainWindow
@@ -19,5 +23,17 @@ public:
private:
Ui::MainWindow *ui;
+ void createActions();
+ void createMenus();
+ QMenu *fileMenu;
+ QMenu *editMenu;
+ QMenu *helpMenu;
+ QAction *exitAct;
+ QAction *aboutAct;
+ QAction *aboutQtAct;
+
+private slots:
+ void about();
+
};
#endif // MAINWINDOW_H