diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/mainmenu.cpp | 37 | ||||
-rw-r--r-- | src/gui/mainmenu.h | 6 | ||||
-rw-r--r-- | src/gui/mainmenu.ui | 28 | ||||
-rw-r--r-- | src/gui/mainwindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/mainwindow.h | 2 |
5 files changed, 78 insertions, 0 deletions
diff --git a/src/gui/mainmenu.cpp b/src/gui/mainmenu.cpp index 7d74fbe..b530f58 100644 --- a/src/gui/mainmenu.cpp +++ b/src/gui/mainmenu.cpp @@ -20,10 +20,19 @@ #include "tikzit.h" #include <QDebug> +#include <QSettings> +#include <QMessageBox> MainMenu::MainMenu() { + QSettings settings("tikzit", "tikzit"); ui.setupUi(this); + + if (!settings.value("check-for-updates").isNull()) { + ui.actionCheck_for_updates_automatically->blockSignals(true); + ui.actionCheck_for_updates_automatically->setChecked(settings.value("check-for-updates").toBool()); + ui.actionCheck_for_updates_automatically->blockSignals(false); + } } void MainMenu::addDocks(QMenu *m) @@ -34,6 +43,11 @@ void MainMenu::addDocks(QMenu *m) } } +QAction *MainMenu::updatesAction() +{ + return ui.actionCheck_for_updates_automatically; +} + // File void MainMenu::on_actionNew_triggered() { @@ -225,3 +239,26 @@ void MainMenu::on_actionZoom_Out_triggered() { if (tikzit->activeWindow() != 0) tikzit->activeWindow()->tikzView()->zoomOut(); } + +void MainMenu::on_actionAbout_triggered() +{ + QMessageBox::about(this, + "TikZiT", + "<h2><b>TikZiT</b></h2>" + "<p><i>version " TIKZIT_VERSION "</i></p>" + "<p>TikZiT is a GUI diagram editor for PGF/TikZ. It is licensed under the " + "<a href=\"https://www.gnu.org/licenses/gpl-3.0.en.html\">GNU General " + "Public License, version 3.0</a>.</p>" + "<p>For more info and updates, visit: " + "<a href=\"https://tikzit.github.io\">tikzit.github.io</a></p>"); +} + +void MainMenu::on_actionCheck_for_updates_automatically_triggered() +{ + qDebug() << "check automatically:" << ui.actionCheck_for_updates_automatically->isChecked(); +} + +void MainMenu::on_actionCheck_now_triggered() +{ + qDebug() << "check now"; +} diff --git a/src/gui/mainmenu.h b/src/gui/mainmenu.h index 82c447e..c14a284 100644 --- a/src/gui/mainmenu.h +++ b/src/gui/mainmenu.h @@ -29,6 +29,7 @@ class MainMenu : public QMenuBar public: MainMenu(); void addDocks(QMenu *m); + QAction *updatesAction(); private: Ui::MainMenu ui; @@ -70,6 +71,11 @@ public slots: // View void on_actionZoom_In_triggered(); void on_actionZoom_Out_triggered(); + + // Help + void on_actionAbout_triggered(); + void on_actionCheck_for_updates_automatically_triggered(); + void on_actionCheck_now_triggered(); }; #endif // MAINMENU_H diff --git a/src/gui/mainmenu.ui b/src/gui/mainmenu.ui index d144fce..0481c1d 100644 --- a/src/gui/mainmenu.ui +++ b/src/gui/mainmenu.ui @@ -82,6 +82,15 @@ <addaction name="actionZoom_In"/> <addaction name="actionZoom_Out"/> </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="actionAbout"/> + <addaction name="separator"/> + <addaction name="actionCheck_for_updates_automatically"/> + <addaction name="actionCheck_now"/> + </widget> <action name="actionNew"> <property name="text"> <string>New...</string> @@ -308,10 +317,29 @@ <string>Ctrl+[</string> </property> </action> + <action name="actionCheck_for_updates_automatically"> + <property name="checkable"> + <bool>true</bool> + </property> + <property name="text"> + <string>Check for updates automatically</string> + </property> + </action> + <action name="actionCheck_now"> + <property name="text"> + <string>Check now</string> + </property> + </action> + <action name="actionAbout"> + <property name="text"> + <string>About</string> + </property> + </action> <addaction name="menuFile"/> <addaction name="menuEdit"/> <addaction name="menuView"/> <addaction name="menuTikz"/> + <addaction name="menuHelp"/> </widget> <resources/> <connections/> diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index d4d13b5..c450b5b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -144,6 +144,11 @@ void MainWindow::changeEvent(QEvent *event) QMainWindow::changeEvent(event); } +MainMenu *MainWindow::menu() const +{ + return _menu; +} + StylePalette *MainWindow::stylePalette() const { return _stylePalette; diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index a000784..21fbd5a 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -40,6 +40,8 @@ public: QString tikzSource(); void setSourceLine(int line); + MainMenu *menu() const; + public slots: void on_tikzSource_textChanged(); void updateFileName(); |