From b70637687de3dd99b5bdc45f4abcbeba8ee8fd51 Mon Sep 17 00:00:00 2001 From: darkelfe14728 Date: Sun, 20 Sep 2020 18:08:37 +0200 Subject: [PATCH] Manage "help" menu and add FontAwesome icons --- .idea/codeStyles/codeStyleConfig.xml | 5 ++++ CMakeLists.txt | 2 ++ FontAwesome/FontAwesome.qrc | 7 ++++++ FontAwesome/icons/info-circle.svg | 1 + FontAwesome/icons/pencil-alt.svg | 1 + MainWindow/MainWindow.cpp | 35 ++++++++++++++++++++++++---- MainWindow/MainWindow.h | 9 ++++--- MainWindow/MainWindow.ui | 11 ++++++++- 8 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 FontAwesome/FontAwesome.qrc create mode 100644 FontAwesome/icons/info-circle.svg create mode 100644 FontAwesome/icons/pencil-alt.svg diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..a55e7a1 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 590cc54..12a9cff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,5 +14,7 @@ add_executable( main.cpp MainWindow/MainWindow.ui MainWindow/MainWindow.h MainWindow/MainWindow.cpp + + FontAwesome/FontAwesome.qrc ) target_link_libraries(NBTModifier Qt5::Widgets) \ No newline at end of file diff --git a/FontAwesome/FontAwesome.qrc b/FontAwesome/FontAwesome.qrc new file mode 100644 index 0000000..ef1cba6 --- /dev/null +++ b/FontAwesome/FontAwesome.qrc @@ -0,0 +1,7 @@ + + + + icons/pencil-alt.svg + icons/info-circle.svg + + \ No newline at end of file diff --git a/FontAwesome/icons/info-circle.svg b/FontAwesome/icons/info-circle.svg new file mode 100644 index 0000000..2b556c7 --- /dev/null +++ b/FontAwesome/icons/info-circle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/FontAwesome/icons/pencil-alt.svg b/FontAwesome/icons/pencil-alt.svg new file mode 100644 index 0000000..bcc3c73 --- /dev/null +++ b/FontAwesome/icons/pencil-alt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/MainWindow/MainWindow.cpp b/MainWindow/MainWindow.cpp index 85e9a8f..b22b9a8 100644 --- a/MainWindow/MainWindow.cpp +++ b/MainWindow/MainWindow.cpp @@ -1,12 +1,39 @@ #include "MainWindow.h" #include "ui_MainWindow.h" -MainWindow::MainWindow(QWidget* parent) : +#include + +MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), - m_ui(new Ui::MainWindow) { + ui(new Ui::MainWindow) { + + ui->setupUi(this); - m_ui->setupUi(this); + connect(ui->actionHelpAboutQt, &QAction::triggered, qApp, &QApplication::aboutQt); } + MainWindow::~MainWindow() { - delete m_ui; + delete ui; +} + +void MainWindow::on_actionHelpAboutNBTModifier_triggered() { + QMessageBox info(this); + + info.setIcon(QMessageBox::Information); + info.setWindowTitle(tr("About NBTModifier")); + + info.setStandardButtons(QMessageBox::Ok); + + info.setTextFormat(Qt::RichText); + info.setText(tr( + "NBTModifier 1.0.0
" + "Copyright © 2020 Julien Rosset
" + "
" + "Use Qt 5.10.0 and FontAwesone icon pack
" + "
" + "jul.rosset@gmail.com
" + "Page du projet" + )); + + info.exec(); } \ No newline at end of file diff --git a/MainWindow/MainWindow.h b/MainWindow/MainWindow.h index c1a8f1d..618dfee 100644 --- a/MainWindow/MainWindow.h +++ b/MainWindow/MainWindow.h @@ -8,14 +8,17 @@ namespace Ui { } class MainWindow : public QMainWindow { -Q_OBJECT + Q_OBJECT public: explicit MainWindow(QWidget *parent = nullptr); - ~MainWindow() override; + virtual ~MainWindow() override; private: - Ui::MainWindow *m_ui; + Ui::MainWindow *ui; + +private slots: + void on_actionHelpAboutNBTModifier_triggered(); }; #endif //NBTMODIFIER_MAINWINDOW_H diff --git a/MainWindow/MainWindow.ui b/MainWindow/MainWindow.ui index f717d47..ea023f1 100644 --- a/MainWindow/MainWindow.ui +++ b/MainWindow/MainWindow.ui @@ -298,6 +298,10 @@ + + + .. + Modify name/value @@ -370,6 +374,9 @@ + + + About NBTModifier @@ -383,7 +390,9 @@ treeWidget - + + + actionFileQuit