-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathKeyhoteeApplication.hpp
88 lines (62 loc) · 2.36 KB
/
KeyhoteeApplication.hpp
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
#pragma once
#include <bts/application.hpp>
#include <QApplication>
#include <vector>
class KeyhoteeMainWindow;
class ProfileWizard;
class QTemporaryFile;
/** Subclass needed to reimplement 'notify' method and catch unknown exceptions.
This class also is responsible for temporary files management (removing them) created while
opening attachement items.
*/
class TKeyhoteeApplication : protected QApplication
{
Q_OBJECT
public:
/// Returns instance of the app - non-null when app object has been built (app is running).
static TKeyhoteeApplication* getInstance();
/** Builds & starts the app.
When this function completes it also destroys application object.
Returned value is application exit status.
*/
static int run(int& argc, char** argv);
void displayMainWindow();
void quit();
/// Gives access to the application name.
std::string getAppName() const;
std::string getVersionNumberString() const;
/// Returns selected (from command line) current profile to load.
QString getLoadedProfileName() const {return _loaded_profile_name;};
void setLoadedProfileName(QString loaded_profile_name) {_loaded_profile_name = loaded_profile_name;};
KeyhoteeMainWindow* getMainWindow() const { return _main_window; }
void displayLogin();
void displayProfileWizard();
private:
enum TExitStatus
{
SUCCESS,
INTERNAL_ERROR,
LAST_EXIT_STATUS
};
TKeyhoteeApplication(int& argc, char** argv);
virtual ~TKeyhoteeApplication();
int run();
void onExceptionCaught(const fc::exception& e);
void onUnknownExceptionCaught();
void displayFailureInfo(const std::string& detail);
void startup();
static void linuxSignalHandler(int);
/// Overrided from QApplication to catch all exceptions.
virtual bool notify(QObject * receiver, QEvent * e) override;
/// Class attributes;
private:
typedef std::vector<QTemporaryFile*> TTemporaryFileContainer;
TTemporaryFileContainer _allocated_temps;
bts::application_ptr _backend_app;
QString _loaded_profile_name;
KeyhoteeMainWindow* _main_window;
ProfileWizard* _profile_wizard;
int _exit_status;
bool _last_loaded_profile_name;
std::string _keyhoteeVersionNumber;
};