annotate ui/mainwindow.h @ 365:75f7288ad67b

Switch from listupdatedialog to installwrapper. Minor UI improvements
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 14 Apr 2014 16:59:08 +0000
parents 1ae15ea73850
children 6cc124e79066
rev   line source
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
1 #ifndef MAINWINDOW_H
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
2 #define MAINWINDOW_H
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
3
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
4 /**
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
5 * @file mainwindow.h
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
6 * @brief Main UI controller
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
7 */
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
8
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9 #include <QSystemTrayIcon>
153
252ffe6e27fd Changed type of MainWindow from QDialog to QMainWindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 71
diff changeset
10 #include <QMainWindow>
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
11 #include <QSettings>
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 153
diff changeset
12 #include <QMenuBar>
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
13 #include <QListWidget>
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
14 #include <QTextEdit>
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 212
diff changeset
15 #include <QPushButton>
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
17 #include "downloader.h"
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
18 #include "certificatelist.h"
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 class QMenu;
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20 class QAction;
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
21 class QTimer;
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22
153
252ffe6e27fd Changed type of MainWindow from QDialog to QMainWindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 71
diff changeset
23 class MainWindow : public QMainWindow
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25 Q_OBJECT
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
26
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
27 public:
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
28 /**@brief create a new Main Window object
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
29 *
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
30 * In tray mode this window is not shown and only shows
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
31 * notification messages if there is some actionable state
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
32 * reached. If tray mode is true it also exits after
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
33 * an update check.
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
34 *
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
35 * @param[in] trayMode set the tray mode
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
36 * */
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
37 MainWindow(bool trayMode);
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
38
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
39 void setMessage(const QString message) {mCurMessage = message;}
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
40 QString getMessage() {return mCurMessage;}
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
41
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
42 enum CurrentState {
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
43 BeforeDownload,
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
44 NewListAvailable,
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
45 NewSoftwareAvailable,
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
46 TransferError
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
47 };
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
48
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
49 CurrentState getState() {return mCurState;}
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
50 void setState(CurrentState state) {mCurState = state;}
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
51
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
52 private slots:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
53 void showMessage();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
54 void iconActivated(QSystemTrayIcon::ActivationReason reason);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
55 void checkUpdates();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
56 void handleNewList(const QString& fileName, const QDateTime& modDate);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
57 void handleNewSW(const QString& fileName, const QDateTime& modDate);
45
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 19
diff changeset
58 void downloaderError(const QString &message, SSLConnection::ErrorCode error);
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
59 /** @brief Trigger the appropiate action depending on the state */
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
60 void messageClicked();
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 153
diff changeset
61 void showSettings();
212
f7176140d20d Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 189
diff changeset
62 void showStatus();
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 153
diff changeset
63 void showHelp();
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 153
diff changeset
64 void showAbout();
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
65 void showDetails(QListWidgetItem*);
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 212
diff changeset
66 void resizeButtons();
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
67 void installerError(const QString& errMsg);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
68 void installCerts();
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
69
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
70 private:
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
71 /** @brief check the integrity of available files.
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
72 *
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
73 * Do not use this as a trust check as this only works on
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
74 * FileNames where the underlying files can change. This
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
75 * is just meant to check if the downloaded data was somehow
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
76 * removed or corrupted.
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
77 *
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
78 */
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
79 void verifyAvailableData();
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
80 void createTrayIcon();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
81 void createActions();
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 153
diff changeset
82 void createMenuBar();
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
83 void createContent();
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
84 void loadCertificateList();
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
85
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
86 /* Are we running in tray mode ?*/
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
87 const bool mTrayMode;
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
88 /* The message currently shown at intervals */
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
89 QString mCurMessage;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
90 QString mInstalledSWVersion;
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
91 QString mInstalledListVersion;
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
92
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
93 QSettings mSettings;
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
94
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
95 QSystemTrayIcon *mTrayIcon;
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
96 QTimer *mMessageTimer;
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
97 QMenu *mTrayMenu;
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
98 QAction *mCheckUpdates;
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
99 QAction *mQuitAction;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
100 CurrentState mCurState;
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 153
diff changeset
101 QMenuBar *mMenuBar;
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
102
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
103 CertificateList mListToInstall;
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
104
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 271
diff changeset
105 QListWidget *mCertListWidget;
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
106 QTextEdit *certificateDetails;
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 212
diff changeset
107 QPushButton *installButton;
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 212
diff changeset
108 QPushButton *quitButton;
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
109 };
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
110
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
111 #endif // MAINWINDOW_H

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