changeset 155:c0fdb8d336cf

Added menubar/menu and method stubs to mainwindow.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 25 Mar 2014 09:22:55 +0100
parents 3349c9596043
children f09a0817e3bc
files ui/mainwindow.cpp ui/mainwindow.h
diffstat 2 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Tue Mar 25 08:59:58 2014 +0100
+++ b/ui/mainwindow.cpp	Tue Mar 25 09:22:55 2014 +0100
@@ -25,6 +25,7 @@
 MainWindow::MainWindow() {
     createActions();
     createTrayIcon();
+    createMenuBar();
     qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
 
     connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
@@ -191,3 +192,37 @@
 
     connect(mTrayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
 }
+
+void MainWindow::createMenuBar()
+{
+    mMenuBar = new QMenuBar(this);
+    QMenu *mMenu = new QMenu(tr("Menu"), mMenuBar);
+    mMenuBar->addMenu(mMenu);
+    QAction *update = mMenu->addAction(tr("Force Update"));
+    QAction *settings = mMenu->addAction(tr("Settings"));
+    mMenu->addSeparator();
+    QAction *help = mMenu->addAction(tr("Help"));
+    QAction *about = mMenu->addAction(tr("About"));
+    mMenu->addSeparator();
+    QAction *quit = mMenu->addAction(tr("Quit"));
+    connect(update, SIGNAL(triggered()), this, SLOT(checkUpdates()));
+    connect(settings, SIGNAL(triggered()), this, SLOT(showSettings()));
+    connect(help, SIGNAL(triggered()), this, SLOT(showHelp()));
+    connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
+    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
+    setMenuBar(mMenuBar);
+}
+
+void MainWindow::showSettings() {
+    qDebug() << "show settingsdialog";
+}
+
+void MainWindow::showHelp()
+{
+    qDebug() << "show helpdialog";
+}
+
+void MainWindow::showAbout()
+{
+    qDebug() << "show aboutdialog";
+}
--- a/ui/mainwindow.h	Tue Mar 25 08:59:58 2014 +0100
+++ b/ui/mainwindow.h	Tue Mar 25 09:22:55 2014 +0100
@@ -9,6 +9,7 @@
 #include <QSystemTrayIcon>
 #include <QMainWindow>
 #include <QSettings>
+#include <QMenuBar>
 
 #include "downloader.h"
 #include "certificatelist.h"
@@ -45,6 +46,9 @@
     void downloaderError(const QString &message, SSLConnection::ErrorCode error);
     /** @brief Trigger the appropiate action depending on the state */
     void messageClicked();
+    void showSettings();
+    void showHelp();
+    void showAbout();
 
 private:
     /** @brief check the integrity of available files.
@@ -58,6 +62,7 @@
     void verifyAvailableData();
     void createTrayIcon();
     void createActions();
+    void createMenuBar();
 
     QString mCurMessage;
     QString mInstalledSWVersion;
@@ -71,6 +76,7 @@
     QAction *mCheckUpdates;
     QAction *mQuitAction;
     CurrentState mCurState;
+    QMenuBar *mMenuBar;
 
     CertificateList mListToInstall;
 };

http://wald.intevation.org/projects/trustbridge/