changeset 156:f09a0817e3bc

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 25 Mar 2014 09:23:47 +0100
parents c0fdb8d336cf (diff) dbbd761959ae (current diff)
children fb3b2d77518f 0c06a608e15f
files
diffstat 5 files changed, 52 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ui/listupdatedialog.cpp	Mon Mar 24 17:45:59 2014 +0000
+++ b/ui/listupdatedialog.cpp	Tue Mar 25 09:23:47 2014 +0100
@@ -11,7 +11,7 @@
 #include <QVBoxLayout>
 #include "certificate.h"
 
-ListUpdateDialog::ListUpdateDialog(QDialog *parent,
+ListUpdateDialog::ListUpdateDialog(QMainWindow *parent,
                                    const CertificateList &listToInstall) :
     QDialog(parent),
     mCertificateList(listToInstall)
--- a/ui/listupdatedialog.h	Mon Mar 24 17:45:59 2014 +0000
+++ b/ui/listupdatedialog.h	Tue Mar 25 09:23:47 2014 +0100
@@ -3,6 +3,7 @@
 
 #include "certificatelist.h"
 #include <QDialog>
+#include <QMainWindow>
 /**
  * @file listupdatedialog.h
  * @brief The dialog for certificate selection.
@@ -14,7 +15,7 @@
 {
 public:
     /** @brief Create a list update dialog for the listToInstall */
-    ListUpdateDialog(QDialog *parent, const CertificateList &listToInstall);
+    ListUpdateDialog(QMainWindow *parent, const CertificateList &listToInstall);
 
 private:
     CertificateList mCertificateList;
--- a/ui/main.cpp	Mon Mar 24 17:45:59 2014 +0000
+++ b/ui/main.cpp	Tue Mar 25 09:23:47 2014 +0100
@@ -28,6 +28,9 @@
 {
     QApplication app (argc, argv);
 
+    QStringList arguments = QApplication::arguments();
+    bool trayMode = arguments.contains("--tray");
+
     if (!QSystemTrayIcon::isSystemTrayAvailable() ||
             !QSystemTrayIcon::supportsMessages()) {
         QMessageBox::critical(0, QString::fromLatin1(APPNAME),
@@ -44,6 +47,9 @@
     QSettings::setDefaultFormat(QSettings::IniFormat);
 
     MainWindow mainWin;
+    if (!trayMode) {
+        mainWin.show();
+    }
 
     return app.exec();
 }
--- a/ui/mainwindow.cpp	Mon Mar 24 17:45:59 2014 +0000
+++ b/ui/mainwindow.cpp	Tue Mar 25 09:23:47 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	Mon Mar 24 17:45:59 2014 +0000
+++ b/ui/mainwindow.h	Tue Mar 25 09:23:47 2014 +0100
@@ -7,8 +7,9 @@
  */
 
 #include <QSystemTrayIcon>
-#include <QDialog>
+#include <QMainWindow>
 #include <QSettings>
+#include <QMenuBar>
 
 #include "downloader.h"
 #include "certificatelist.h"
@@ -16,7 +17,7 @@
 class QAction;
 class QTimer;
 
-class MainWindow : public QDialog
+class MainWindow : public QMainWindow
 {
     Q_OBJECT
 
@@ -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/