forked from gyunaev/birdtray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.h
186 lines (135 loc) · 5.66 KB
/
settings.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QSize>
#include <QFont>
#include <QColor>
#include <QMap>
#include <QPixmap>
#include <QSettings>
#include "setting_newemail.h"
class QSettings;
class Settings
{
public:
// Icon size constant
static constexpr int ICON_SIZE = 128;
explicit Settings(bool verboseOutput);
~Settings();
// Desired icon size
QSize mIconSize;
// Notification icon for unread emails.
// If null, the mNotificationIcon is used
QPixmap mNotificationIconUnread;
// Font for use in notifications
QFont mNotificationFont;
// Notification font weight (0 - 99)
unsigned int mNotificationFontWeight;
// Default notification color
QColor mNotificationDefaultColor;
/**
* The border color to use when drawing the unread mail counter.
*/
QColor mNotificationBorderColor;
/**
* The width of the border for the unread mail counter.
*/
unsigned int mNotificationBorderWidth;
// Blinking speed
unsigned int mBlinkSpeed;
// Opacity level for the tray icon when unread email is present (0.0-1.0)
double mUnreadOpacityLevel;
// Path to Thunderbird folder
QString mThunderbirdFolderPath;
// The command to start Thunderbird. The first element is the executable to launch.
QStringList mThunderbirdCmdLine;
// Thunderbird window match
QString mThunderbirdWindowMatch;
// Whether to show/hide Thunderbird on button click
bool mShowHideThunderbird;
// Whether to hide Thunderbird when its window is minimized
bool mHideWhenMinimized;
// Whether to launch Thunderbird when the app starts
bool mLaunchThunderbird;
// The delay in seconds to launch Thunderbird
int mLaunchThunderbirdDelay;
// Whether to hide Thunderbird window after starting
bool mHideWhenStarted;
// Whether to quit Thunderbird when the app quits
bool mExitThunderbirdWhenQuit;
// Whether to restart Thunderbird if it was closed
bool mRestartThunderbird;
// Whether to hide Thunderbird window after restarting
bool mHideWhenRestarted;
// Whether to monitor Thunderbird running
bool mMonitorThunderbirdWindow;
// Whether to use Mork parser for new mail scanning; if false, sqlite is used
bool mUseMorkParser;
// Whether to use alpha transition when blinking
bool mBlinkingUseAlphaTransition;
// Whether to check for a new Birdtray version on startup or not.
bool mUpdateOnStartup;
// The new Birdtray version that the user selected to ignore.
QString mIgnoreUpdateVersion;
// Whether to allow suppression of unread emails
bool mAllowSuppressingUnreads;
// Whether to show the unread email count
bool mShowUnreadEmailCount;
/**
* Ignore the total number of unread emails that are present at startup.
*/
bool ignoreStartUnreadCount;
/**
* Enables or disabled the dialog on startup that shows if no accounts were configured.
*/
bool showDialogIfNoAccountsConfigured;
/**
* Whether to show the Birdtray system tray icon only if there are unread Mail messages.
*/
bool onlyShowIconOnUnreadMessages;
// Watching file timeout (ms)
unsigned int mWatchFileTimeout;
// The smallest and the largest allowed font in notification
unsigned int mNotificationMinimumFontSize;
unsigned int mNotificationMaximumFontSize;
// New email data
bool mNewEmailMenuEnabled;
QList< Setting_NewEmail > mNewEmailData;
// Maps the folder URI or full path (for Mork) to the notification color.
// The original order of strings is stored in mFolderNotificationList (to show in UI)
QMap< QString, QColor > mFolderNotificationColors;
QStringList mFolderNotificationList;
// Whether to spam debugging stuff
bool mVerboseOutput;
// If non-zero, specifies an interval in seconds for rereading index files even if they didn't change. 0 disables.
unsigned int mIndexFilesRereadIntervalSec;
// Load and save them
void save();
void load();
/**
* @param executable The actual executable necessary to start (not necessary Thunderbird itself - may be shell or script).
* @param arguments The arguments necessary to start Thunderbird.
* @return true if executable/arguments is set, false if error
*/
bool getStartThunderbirdCmdline( QString& executable, QStringList &arguments );
/**
* @return The icon to use for the system tray.
*/
const QPixmap& getNotificationIcon();
/**
* Set the icon to use for the system tray to the new icon.
*
* @param icon The new icon.
*/
void setNotificationIcon(const QPixmap& icon);
private:
// Notification icon
QPixmap mNotificationIcon;
QSettings *mSettings;
void savePixmap( const QString& key, const QPixmap& pixmap );
QPixmap loadPixmap( const QString& key );
/**
* At first start, load the configuration configured during installation of Birdtray.
*/
void loadInstallerConfiguration();
};
#endif // SETTINGS_H