Mercurial > trustbridge
comparison ui/mainwindow.h @ 16:225a5ec20dad
Use QSettings and manage downloader from mainwindow.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 19 Feb 2014 10:45:29 +0000 |
parents | cf88cc432b9d |
children | c12825a651ed |
comparison
equal
deleted
inserted
replaced
15:95e1b6edf2fc | 16:225a5ec20dad |
---|---|
1 #ifndef MAINWINDOW_H | 1 #ifndef MAINWINDOW_H |
2 #define MAINWINDOW_H | 2 #define MAINWINDOW_H |
3 | 3 |
4 #include <QSystemTrayIcon> | 4 #include <QSystemTrayIcon> |
5 #include <QDialog> | 5 #include <QDialog> |
6 #include <QSettings> | |
7 | |
8 #include "downloader.h" | |
6 class QMenu; | 9 class QMenu; |
7 class QAction; | 10 class QAction; |
8 | 11 |
9 class MainWindow : public QDialog | 12 class MainWindow : public QDialog |
10 { | 13 { |
14 MainWindow(); | 17 MainWindow(); |
15 | 18 |
16 void setMessage(const QString message) {mCurMessage = message;} | 19 void setMessage(const QString message) {mCurMessage = message;} |
17 QString getMessage() {return mCurMessage;} | 20 QString getMessage() {return mCurMessage;} |
18 | 21 |
22 enum CurrentState { | |
23 BeforeDownload, | |
24 NewListAvailable, | |
25 NewSoftwareAvailable, | |
26 TransferError | |
27 }; | |
28 | |
29 CurrentState getState() {return mCurState;} | |
30 void setState(CurrentState state) {mCurState = state;} | |
31 | |
19 private slots: | 32 private slots: |
20 void showMessage(); | 33 void showMessage(); |
21 void iconActivated(QSystemTrayIcon::ActivationReason reason); | 34 void iconActivated(QSystemTrayIcon::ActivationReason reason); |
22 void manualCheck(); | 35 void checkUpdates(); |
36 void handleNewList(const QString& fileName, const QDateTime& modDate); | |
37 void handleNewSW(const QString& fileName, const QDateTime& modDate); | |
38 void downloaderError(const QString &message, Downloader::ErrorCode error); | |
23 | 39 |
24 private: | 40 private: |
41 void verifyAvailableData(); | |
25 void createTrayIcon(); | 42 void createTrayIcon(); |
26 void createActions(); | 43 void createActions(); |
27 | 44 |
28 QString mCurMessage; | 45 QString mCurMessage; |
46 QString mInstalledSWVersion; | |
47 QString mInstalledListVersion; | |
48 | |
49 QSettings mSettings(QSettings::IniFormat); | |
29 | 50 |
30 QSystemTrayIcon *mTrayIcon; | 51 QSystemTrayIcon *mTrayIcon; |
31 | 52 |
32 QMenu *mTrayMenu; | 53 QMenu *mTrayMenu; |
33 QAction *mCheckUpdates; | 54 QAction *mCheckUpdates; |
34 QAction *mQuitAction; | 55 QAction *mQuitAction; |
56 CurrentState mCurState; | |
35 }; | 57 }; |
36 | 58 |
37 #endif // MAINWINDOW_H | 59 #endif // MAINWINDOW_H |