comparison ui/mainwindow.cpp @ 2:cf88cc432b9d

Add quit action
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 10 Feb 2014 16:23:15 +0000
parents cb0cde2c5eb9
children 992c0ec57660
comparison
equal deleted inserted replaced
1:524cd4908656 2:cf88cc432b9d
4 #include <QMessageBox> 4 #include <QMessageBox>
5 #include <QSystemTrayIcon> 5 #include <QSystemTrayIcon>
6 #include <QAction> 6 #include <QAction>
7 #include <QDialog> 7 #include <QDialog>
8 #include <QMenu> 8 #include <QMenu>
9 #include <QApplication>
9 10
10 MainWindow::MainWindow() { 11 MainWindow::MainWindow() {
11 createActions(); 12 createActions();
12 createTrayIcon(); 13 createTrayIcon();
13 14
43 44
44 void MainWindow::createActions() 45 void MainWindow::createActions()
45 { 46 {
46 mCheckUpdates = new QAction(tr("Check for Updates"), this); 47 mCheckUpdates = new QAction(tr("Check for Updates"), this);
47 connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(manualCheck())); 48 connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(manualCheck()));
49 mQuitAction = new QAction(tr("Quit"), this);
50 connect(mQuitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
48 } 51 }
49 52
50 void MainWindow::createTrayIcon() 53 void MainWindow::createTrayIcon()
51 { 54 {
52 QIcon trayImg = QIcon(":/img/tray_22.png"); 55 QIcon trayImg = QIcon(":/img/tray_22.png");
53 56
54 qDebug() << "Creating tray icon";
55 mTrayMenu = new QMenu(this); 57 mTrayMenu = new QMenu(this);
56 mTrayMenu->addAction(mCheckUpdates); 58 mTrayMenu->addAction(mCheckUpdates);
59 mTrayMenu->addAction(mQuitAction);
57 60
58 mTrayIcon = new QSystemTrayIcon(this); 61 mTrayIcon = new QSystemTrayIcon(this);
59 mTrayIcon->setContextMenu(mTrayMenu); 62 mTrayIcon->setContextMenu(mTrayMenu);
60 63
61 mTrayIcon->setIcon(trayImg); 64 mTrayIcon->setIcon(trayImg);

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