# HG changeset patch # User Raimund Renkert # Date 1395735775 -3600 # Node ID c0fdb8d336cf7d01fd0f4f6d7a38693bb83fba6c # Parent 3349c9596043ded6c3ec0dc9d41652eeb01e9e01 Added menubar/menu and method stubs to mainwindow. diff -r 3349c9596043 -r c0fdb8d336cf ui/mainwindow.cpp --- 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"); 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"; +} diff -r 3349c9596043 -r c0fdb8d336cf ui/mainwindow.h --- 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 #include #include +#include #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; };