-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.h
98 lines (77 loc) · 2.17 KB
/
application.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef APPLICATION_H
#define APPLICATION_H
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFont>
#include <QMap>
#include <QMessageBox>
#include <QMessageBox>
#include <QMutex>
#include <QObject>
#include <QPointer>
#include <QSettings>
#include <QSplashScreen>
#include <QStatusBar>
#include <QString>
#include <QThreadPool>
#ifdef ADD_FS_WATCHER
#include <QFileSystemWatcher>
#endif
#include <list>
#include <vector>
#include "webdatasynchronizer.h"
#include "views/mainwindow.h"
#include "views/homeview.h"
#include "views/streamview.h"
#include "views/aboutview.h"
#include "views/singlestreamview.h"
#include "views/invertebrateview.h"
#include "views/settingsview.h"
class Application : public QApplication
{
static const int application_data_version = 9;
QPointer<WebDataSynchronizer> syncer;
QMap<QString, Invertebrate> invertebrates;
QMap<QString, Stream> streams;
QMutex mutex;
bool isUpgrade = false;
SyncStatus syncStatus = SyncStatus::READY_TO_SYNC;
QString dataPath;
QString imagePath;
QPointer<SettingsView> settings;
MainWindow mainWindow;
void loadVariableFromDisk(bool &needToSync, QString variable);
void stageBundledData();
std::list<int> view_index_stack;
#ifdef ADD_FS_WATCHER
QFileSystemWatcher watcher;
#endif
public:
Application(int argc, char *argv[]);
void performSetUp();
~Application();
int last_view_index();
void set_last_view_index(int index);
private slots:
void transitionToAllStreams();
void transitionToHome();
void transitionToAbout();
void transitionToSingleStream(const QString &streamName);
void transitionSingleStreamToStreams();
void transitionToInvertebrate(const QString &invertebrate, const QString &streamName);
void transitionInvertebrateToSingleStream();
void transitionToSettings();
void transitionSettingsToHome();
void startSync();
void stopSync();
void loadDataFromDisk();
void saveDataToDisk();
void syncMessage(const QString& message);
void updateLastSync();
void updateAboutText(const QString &about);
#ifdef ADD_FS_WATCHER
void reloadStyles();
#endif
};
#endif // APPLICATION_H