forked from baumgarr/nixnote2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.h
166 lines (141 loc) · 5.31 KB
/
global.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
/*********************************************************************************
NixNote - An open-source client for the Evernote service.
Copyright (C) 2013 Randy Baumgarte
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
***********************************************************************************/
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QString>
#include "application.h"
#include <QSettings>
#include "logger/qslog.h"
#include "logger/qslogdest.h"
#include "settings/filemanager.h"
#include "settings/startupconfig.h"
#include "filters/filtercriteria.h"
#include "models/notecache.h"
#include "gui/shortcutkeys.h"
#include "settings/accountsmanager.h"
#include "reminders/remindermanager.h"
#include <string>
#include <QSharedMemory>
#include <QSqlDatabase>
//*******************************
//* This class is used to store
//* global values across the
//* program.
//*******************************
#define NOTE_TABLE_LID_POSITION 0
#define NOTE_TABLE_DATE_CREATED_POSITION 1
#define NOTE_TABLE_DATE_UPDATED_POSITION 2
#define NOTE_TABLE_TITLE_POSITION 3
#define NOTE_TABLE_NOTEBOOK_LID_POSITION 4
#define NOTE_TABLE_NOTEBOOK_POSITION 5
#define NOTE_TABLE_TAGS_POSITION 6
#define NOTE_TABLE_AUTHOR_POSITION 7
#define NOTE_TABLE_DATE_SUBJECT_POSITION 8
#define NOTE_TABLE_DATE_DELETED_POSITION 9
#define NOTE_TABLE_SOURCE_POSITION 10
#define NOTE_TABLE_SOURCE_URL_POSITION 11
#define NOTE_TABLE_SOURCE_APPLICATION_POSITION 12
#define NOTE_TABLE_LATITUDE_POSITION 13
#define NOTE_TABLE_LONGITUDE_POSITION 14
#define NOTE_TABLE_ALTITUDE_POSITION 15
#define NOTE_TABLE_HAS_ENCRYPTION_POSITION 16
#define NOTE_TABLE_HAS_TODO_POSITION 17
#define NOTE_TABLE_IS_DIRTY_POSITION 18
#define NOTE_TABLE_SIZE_POSITION 19
#define NOTE_TABLE_REMINDER_ORDER_POSITION 20
#define NOTE_TABLE_REMINDER_TIME_POSITION 21
#define NOTE_TABLE_REMINDER_TIME_DONE_POSITION 22
#define NOTE_TABLE_PINNED_POSITION 23
#define NOTE_TABLE_COLOR_POSITION 24
#define NOTE_TABLE_THUMBNAIL_POSITION 25
#define NOTE_TABLE_COLUMN_COUNT 26
using namespace std;
class Global
{
public:
enum CountBehavior {
CountAll = 1,
CountNone = 2
};
CountBehavior countBehavior;
bool disableUploads;
Global(); // Generic constructor
~Global(); // destructor
enum ListViewSetup {
ListViewWide = 1,
listViewNarrow = 2
};
ListViewSetup listView;
int argc; // Initial argument count from the program start
char** argv; // List of arguments from the program start
FileManager fileManager;
AccountsManager *accountsManager;\
Application *application;
unsigned int cryptCounter;
QString attachmentNameDelimeter;
string username;
string password;
bool connected;
bool pdfPreview;
QSharedMemory *sharedMemory;
bool confirmDeletes();
QString tagBehavior();
QString server;
QSettings *settings;
QSettings *globalSettings;
QClipboard *clipboard;
ShortcutKeys *shortcutKeys;
QList<qint32> expungedResources;
QFileSystemWatcher resourceWatcher;
bool showTrayIcon();
bool closeToTray();
bool minimizeToTray();
void setMinimizeToTray(bool value);
void setCloseToTray(bool value);
void setColumnPosition(QString col, int position);
void setColumnWidth(QString col, int width);
int getColumnPosition(QString col);
int getColumnWidth(QString col);
int getMinimumRecognitionWeight();
void setSynchronizeAttachments(bool value);
bool synchronizeAttachments();
qlonglong getLastReminderTime();
void setLastReminderTime(qlonglong value);
void setMinimumRecognitionWeight(int weight);
QString dateFormat;
QString timeFormat;
QSqlDatabase *db;
bool javaFound;
QString defaultFont;
int defaultFontSize;
bool forceNoStartMimized;
bool syncAndExit;
// Filter criteria. Used for things like the back & forward buttons
QList<FilterCriteria*> filterCriteria;
qint32 filterPosition;
// Note cache
QHash<int, NoteCache*> cache;
void setup(StartupConfig config); // Setup the global variables
QString getProgramDirPath(); // Get the path the program is executing from
QList< QPair<QString, QString> > passwordRemember; // Cache of passwords
QHash< QString, QPair <QString, QString> > passwordSafe; // Saved passwords
void appendFilter(FilterCriteria *criteria);
void setupDateTimeFormat();
QString getWindowIcon();
ReminderManager *reminderManager;
};
bool caseInsensitiveLessThan(const QString &s1, const QString &s2);
#endif // GLOBAL_H