Mercurial > trustbridge
annotate ui/mainwindow.h @ 199:4790a26c2e8b
Added about dialog.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 26 Mar 2014 13:29:49 +0100 |
parents | 5f0d45ca9de4 |
children | f7176140d20d |
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> |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
15 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
16 #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
|
17 #include "certificatelist.h" |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
18 class QMenu; |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
19 class QAction; |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
20 class QTimer; |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
21 |
153
252ffe6e27fd
Changed type of MainWindow from QDialog to QMainWindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
71
diff
changeset
|
22 class MainWindow : public QMainWindow |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 Q_OBJECT |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 public: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 MainWindow(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 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
|
30 QString getMessage() {return mCurMessage;} |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
32 enum CurrentState { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
33 BeforeDownload, |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
34 NewListAvailable, |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
35 NewSoftwareAvailable, |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
36 TransferError |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
37 }; |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
38 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
39 CurrentState getState() {return mCurState;} |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
40 void setState(CurrentState state) {mCurState = state;} |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
41 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
42 private slots: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
43 void showMessage(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
44 void iconActivated(QSystemTrayIcon::ActivationReason reason); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
45 void checkUpdates(); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 /** @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
|
50 void messageClicked(); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
51 void showSettings(); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
52 void showHelp(); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
53 void showAbout(); |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
54 void showDetails(QListWidgetItem*); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
55 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
56 private: |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
57 /** @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
|
58 * |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
59 * 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
|
60 * 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
|
61 * 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
|
62 * removed or corrupted. |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
63 * |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
64 */ |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
65 void verifyAvailableData(); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
66 void createTrayIcon(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
67 void createActions(); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
68 void createMenuBar(); |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
69 void createContent(); |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
70 void loadCertificateList(); |
2 | 71 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
72 QString mCurMessage; |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
73 QString mInstalledSWVersion; |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
74 QString mInstalledListVersion; |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
75 |
17
c12825a651ed
Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents:
16
diff
changeset
|
76 QSettings mSettings; |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
77 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
78 QSystemTrayIcon *mTrayIcon; |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
79 QTimer *mMessageTimer; |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
80 QMenu *mTrayMenu; |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
81 QAction *mCheckUpdates; |
2 | 82 QAction *mQuitAction; |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
83 CurrentState mCurState; |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
153
diff
changeset
|
84 QMenuBar *mMenuBar; |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
85 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
86 CertificateList mListToInstall; |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
87 |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
88 QListWidget *certificateList; |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
89 QTextEdit *certificateDetails; |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
90 }; |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
91 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
92 #endif // MAINWINDOW_H |