Debian Codegraph @

src/librssguard/definitions/definitions.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.
2
3 #ifndef DEFINITIONS_H
4 #define DEFINITIONS_H
5
6 #include <QDebug>
7 #include <QtGlobal>
8
9 #define SERVICE_CODE_STD_RSS "std-rss"
10 #define SERVICE_CODE_TT_RSS "tt-rss"
11 #define SERVICE_CODE_NEXTCLOUD "nextcloud"
12 #define SERVICE_CODE_GREADER "greader"
13 #define SERVICE_CODE_FEEDLY "feedly"
14 #define SERVICE_CODE_INOREADER "inoreader"
15 #define SERVICE_CODE_GMAIL "gmail"
16 #define SERVICE_CODE_REDDIT "reddit"
17 #define SERVICE_CODE_NEWSBLUR "newsblur"
18
19 #define ADBLOCK_SERVER_FILE "adblock-server.js"
20 #define ADBLOCK_SERVER_PORT 48484
21 #define ADBLOCK_HOWTO APP_URL_DOCUMENTATION "#adbl"
22 #define ADBLOCK_ICON_ACTIVE "adblock"
23 #define ADBLOCK_ICON_DISABLED "adblock-disabled"
24
25 #define OAUTH_DECRYPTION_KEY 11451167756100761335ul
26 #define OAUTH_REDIRECT_URI "http://localhost"
27
28 #define ENCLOSURES_OUTER_SEPARATOR '#'
29 #define ECNLOSURES_INNER_SEPARATOR '&'
30
31 #define URI_SCHEME_FEED_SHORT "feed:"
32 #define URI_SCHEME_FEED "feed://"
33
34 #define URI_SCHEME_HTTP_SHORT "http:"
35 #define URI_SCHEME_HTTP "http://"
36
37 #define URI_SCHEME_HTTPS_SHORT "https:"
38 #define URI_SCHEME_HTTPS "https://"
39
40 #define DEFAULT_LOCALE "en_US"
41
42 #define NO_PARENT_CATEGORY -1
43 #define ID_RECYCLE_BIN -2
44 #define ID_IMPORTANT -3
45 #define ID_LABELS -4
46 #define ID_UNREAD -5
47 #define ID_PROBES -6
48
49 #define MSG_SCORE_MAX 100.0
50 #define MSG_SCORE_MIN 0.0
51
52 #define LOWER_TITLE_ROLE 64
53 #define HIGHLIGHTED_FOREGROUND_TITLE_ROLE 65
54 #define TEXT_DIRECTION_ROLE 66
55
56 #define SOUNDS_BUILTIN_DIRECTORY ":/sounds"
57 #define ARGUMENTS_LIST_SEPARATOR "\n"
58 #define IS_IN_ARRAY(offset, array) ((offset >= 0) && (offset < array.count()))
59 #define DEFAULT_SQL_MESSAGES_FILTER "0 > 1"
60 #define MAX_MULTICOLUMN_SORT_STATES 3
61
62 #define RELEASES_LIST "https://api.github.com/repos/martinrotter/rssguard/releases"
63 #define MSG_FILTERING_HELP APP_URL_DOCUMENTATION "#fltr"
64 #define URL_REGEXP \
65 "^(http|https|feed|ftp):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/" \
66 "~\\+#])?$"
67 #define SCRIPT_SOURCE_TYPE_REGEXP "^.+#.*$"
68 #define TEXT_TITLE_LIMIT 30
69 #define TEXT_TOOLTIP_LIMIT 50
70 #define RESELECT_MESSAGE_THRESSHOLD 500
71 #define ICON_SIZE_SETTINGS 16
72 #define TRAY_ICON_BUBBLE_TIMEOUT 20000
73 #define MSG_DATETIME_DIFF_THRESSHOLD 1000 * 120 // In seconds.
74 #define CLOSE_LOCK_TIMEOUT 500
75 #define DOWNLOAD_TIMEOUT 30000
76 #define MESSAGES_VIEW_DEFAULT_COL 100
77 #define MESSAGES_VIEW_MINIMUM_COL 16
78 #define FEEDS_VIEW_COLUMN_COUNT 2
79 #define DEFAULT_DAYS_TO_DELETE_MSG 14
80 #define ELLIPSIS_LENGTH 3
81 #define DEFAULT_AUTO_UPDATE_INTERVAL 900 // In seconds.
82 #define AUTO_UPDATE_INTERVAL 10 // In seconds.
83 #define STARTUP_UPDATE_DELAY 15.0 // In seconds.
84 #define TIMEZONE_OFFSET_LIMIT 6
85 #define CHANGE_EVENT_DELAY 250
86 #define FLAG_ICON_SUBFOLDER "flags"
87 #define SEARCH_BOX_ACTION_NAME "search"
88 #define HIGHLIGHTER_ACTION_NAME "highlighter"
89 #define FILTER_ACTION_NAME "filter"
90 #define SPACER_ACTION_NAME "spacer"
91 #define SEPARATOR_ACTION_NAME "separator"
92 #define FILTER_WIDTH 125
93 #define FILTER_RIGHT_MARGIN 5
94 #define FEEDS_VIEW_INDENTATION 10
95 #define MIME_TYPE_ITEM_POINTER "rssguard/itempointer"
96 #define DOWNLOADER_ICON_SIZE 48
97 #define ENCRYPTION_FILE_NAME "key.private"
98 #define RELOAD_MODEL_BORDER_NUM 10
99 #define COOKIE_URL_IDENTIFIER ":COOKIE:"
100 #define DEFAULT_NOTIFICATION_VOLUME 50
101 #define MAX_THREADPOOL_THREADS 32
102 #define WEB_BROWSER_SCROLL_STEP 50.0
103 #define MAX_NUMBER_OF_REDIRECTIONS 4
104
105 #define NOTIFICATIONS_MARGIN 16
106 #define NOTIFICATIONS_WIDTH 300
107 #define NOTIFICATIONS_TIMEOUT 10s
108 #define NOTIFICATION_SHORT_TIMEOUT 3s
109 #define NOTIFICATIONS_PAGE_SIZE 10
110
111 #define GOOGLE_SEARCH_URL "https://www.google.com/search?q=%1&ie=utf-8&oe=utf-8"
112 #define GOOGLE_SUGGEST_URL "http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=%1"
113
114 #define EXTERNAL_TOOL_SEPARATOR "|||"
115
116 #define USER_DATA_PLACEHOLDER "%data%"
117 #define SKIN_STYLE_PLACEHOLDER "%style%"
118
119 #define CLI_VER_SHORT "v"
120 #define CLI_VER_LONG "version"
121
122 #define CLI_HELP_SHORT "h"
123 #define CLI_HELP_LONG "help"
124
125 #define CLI_LOG_SHORT "l"
126 #define CLI_LOG_LONG "log"
127
128 #define CLI_DAT_SHORT "d"
129 #define CLI_DAT_LONG "data"
130
131 #define CLI_SIN_SHORT "s"
132 #define CLI_SIN_LONG "no-single-instance"
133
134 #define CLI_USERAGENT_SHORT "u"
135 #define CLI_USERAGENT_LONG "user-agent"
136
137 #define CLI_ADBLOCKPORT_SHORT "p"
138 #define CLI_ADBLOCKPORT_LONG "adblock-port"
139
140 #define CLI_NSTDOUTERR_SHORT "n"
141 #define CLI_NSTDOUTERR_LONG "no-standard-output"
142
143 #define CLI_STYLE_SHORT "t"
144 #define CLI_STYLE_LONG "style"
145
146 #define CLI_NDEBUG_SHORT "g"
147 #define CLI_NDEBUG_LONG "no-debug-output"
148
149 #define CLI_FORCE_LITE_SHORT "w"
150 #define CLI_FORCE_LITE_LONG "lite"
151
152 #define CLI_QUIT_INSTANCE "q"
153 #define CLI_IS_RUNNING "a"
154
155 #define CLI_THREADS "threads"
156
157 #define HTTP_CODE_NOT_MODIFIED 304
158 #define HTTP_CODE_TOO_MANY_REQUESTS 429
159 #define HTTP_CODE_UNAVAILABLE 503
160
161 #define HTTP_HEADERS_ACCEPT "Accept"
162 #define HTTP_HEADERS_CONTENT_TYPE "Content-Type"
163 #define HTTP_HEADERS_CONTENT_LENGTH "Content-Length"
164 #define HTTP_HEADERS_AUTHORIZATION "Authorization"
165 #define HTTP_HEADERS_USER_AGENT "User-Agent"
166 #define HTTP_HEADERS_COOKIE "Cookie"
167
168 #define LOGSEC_NETWORK "network: "
169 #define LOGSEC_ADBLOCK "adblock: "
170 #define LOGSEC_FEEDMODEL "feed-model: "
171 #define LOGSEC_FEEDDOWNLOADER "feed-downloader: "
172 #define LOGSEC_MESSAGEMODEL "message-model: "
173 #define LOGSEC_JS "javascript: "
174 #define LOGSEC_GUI "gui: "
175 #define LOGSEC_MPV "libmpv: "
176 #define LOGSEC_QTMULTIMEDIA "qtmultimedia: "
177 #define LOGSEC_NOTIFICATIONS "notifications: "
178 #define LOGSEC_CORE "core: "
179 #define LOGSEC_NODEJS "nodejs: "
180 #define LOGSEC_DB "database: "
181 #define LOGSEC_NEXTCLOUD "nextcloud: "
182 #define LOGSEC_GREADER "greader: "
183 #define LOGSEC_FEEDLY "feedly: "
184 #define LOGSEC_TTRSS "tt-rss: "
185 #define LOGSEC_GMAIL "gmail: "
186 #define LOGSEC_OAUTH "oauth: "
187 #define LOGSEC_REDDIT "reddit: "
188 #define LOGSEC_NEWSBLUR "newsblur: "
189
190 #define MAX_ZOOM_FACTOR 5.0f
191 #define MIN_ZOOM_FACTOR 0.25f
192 #define DEFAULT_ZOOM_FACTOR 1.0f
193 #define ZOOM_FACTOR_STEP 0.05f
194
195 #if defined(NO_LITE)
196 #define HTTP_COMPLETE_USERAGENT \
197 (qApp->web()->engineProfile()->httpUserAgent().toLocal8Bit() + QByteArrayLiteral(" ") + \
198 QByteArrayLiteral(APP_USERAGENT))
199 #else
200 #define HTTP_COMPLETE_USERAGENT \
201 (QByteArrayLiteral("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0 ") + \
202 QByteArrayLiteral(APP_USERAGENT))
203 #endif
204
205 #define INTERNAL_URL_MESSAGE "http://rssguard.message"
206 #define INTERNAL_URL_BLANK "http://rssguard.blank"
207 #define INTERNAL_URL_INFO "http://rssguard.info"
208 #define INTERNAL_URL_ADBLOCKED "http://rssguard.adblocked"
209 #define INTERNAL_URL_MESSAGE_HOST "rssguard.message"
210
211 #define FEED_REGEX_MATCHER "<link[^>]+type=\"application\\/(?:atom\\+xml|rss\\+xml|feed\\+json|json)\"[^>]*>"
212 #define FEED_HREF_REGEX_MATCHER "href=\"([^\"]+)\""
213
214 #define PLACEHOLDER_UNREAD_COUNTS "%unread"
215 #define PLACEHOLDER_ALL_COUNTS "%all"
216
217 #define BACKUP_NAME_SETTINGS "config"
218 #define BACKUP_SUFFIX_SETTINGS ".ini.backup"
219 #define BACKUP_NAME_DATABASE "database"
220 #define BACKUP_SUFFIX_DATABASE ".db.backup"
221
222 #define APP_DB_MYSQL_DRIVER "QMYSQL"
223 #define APP_DB_MYSQL_INIT "db_init_mysql.sql"
224 #define APP_DB_MYSQL_TEST "MySQLTest"
225 #define APP_DB_MYSQL_PORT 3306
226
227 #define APP_DB_SQLITE_DRIVER "QSQLITE"
228 #define APP_DB_SQLITE_INIT "db_init_sqlite.sql"
229 #define APP_DB_SQLITE_PATH "database"
230 #define APP_DB_SQLITE_FILE "database.db"
231
232 // Keep this in sync with schema versions declared in SQL initialization code.
233 #define APP_DB_SCHEMA_VERSION "10"
234 #define APP_DB_UPDATE_FILE_PATTERN "db_update_%1_%2_%3.sql"
235 #define APP_DB_COMMENT_SPLIT "-- !\n"
236 #define APP_DB_INCLUDE_PLACEHOLDER "!!"
237 #define APP_DB_NAME_PLACEHOLDER "##"
238 #define APP_DB_AUTO_INC_PRIM_KEY_PLACEHOLDER "$$"
239 #define APP_DB_BLOB_PLACEHOLDER "^^"
240 #define APP_DB_TEXT_PLACEHOLDER "**"
241
242 #define APP_CFG_PATH "config"
243 #define APP_CFG_FILE "config.ini"
244
245 #define APP_SKIN_USER_FOLDER "skins"
246 #define APP_SKIN_DEFAULT "nudus-light"
247 #define APP_SKIN_METADATA_FILE "metadata.xml"
248
249 // #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && !defined(FORCE_BUNDLE_ICONS)
250 // #define APP_ICON_THEME_DEFAULT ""
251 // #else
252 // #define APP_ICON_THEME_DEFAULT "Breeze"
253 // #endif
254
255 #if defined(Q_OS_WIN)
256 #define APP_STYLE_DEFAULT "windowsvista"
257 #elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
258 // Do not force default style on Linux.
259 #define APP_STYLE_DEFAULT ""
260 #else
261 #define APP_STYLE_DEFAULT "Fusion"
262 #endif
263
264 #if defined(FORCE_BUNDLE_ICONS)
265 // Forcibly bundle icons.
266 #define APP_ICON_THEME_DEFAULT "Breeze"
267 #elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
268 // Do not force default icon theme on Linux.
269 #define APP_ICON_THEME_DEFAULT ""
270 #else
271 // Use some default theme otherwise.
272 #define APP_ICON_THEME_DEFAULT "Breeze"
273 #endif
274
275 #define APP_LOCAL_ICON_THEME_FOLDER "icons"
276 #define APP_NO_THEME ""
277
278 // Indexes of columns as they are DEFINED IN THE TABLE for MESSAGES.
279 #define MSG_DB_ID_INDEX 0
280 #define MSG_DB_READ_INDEX 1
281 #define MSG_DB_IMPORTANT_INDEX 2
282 #define MSG_DB_DELETED_INDEX 3
283 #define MSG_DB_PDELETED_INDEX 4
284 #define MSG_DB_FEED_CUSTOM_ID_INDEX 5
285 #define MSG_DB_TITLE_INDEX 6
286 #define MSG_DB_URL_INDEX 7
287 #define MSG_DB_AUTHOR_INDEX 8
288 #define MSG_DB_DCREATED_INDEX 9
289 #define MSG_DB_CONTENTS_INDEX 10
290 #define MSG_DB_ENCLOSURES_INDEX 11
291 #define MSG_DB_SCORE_INDEX 12
292 #define MSG_DB_ACCOUNT_ID_INDEX 13
293 #define MSG_DB_CUSTOM_ID_INDEX 14
294 #define MSG_DB_CUSTOM_HASH_INDEX 15
295 #define MSG_DB_FEED_TITLE_INDEX 16
296 #define MSG_DB_FEED_IS_RTL_INDEX 17
297 #define MSG_DB_HAS_ENCLOSURES 18
298 #define MSG_DB_LABELS 19
299 #define MSG_DB_LABELS_IDS 20
300
301 // Indexes of columns as they are DEFINED IN THE TABLE for CATEGORIES.
302 #define CAT_DB_ID_INDEX 0
303 #define CAT_DB_ORDER_INDEX 1
304 #define CAT_DB_PARENT_ID_INDEX 2
305 #define CAT_DB_TITLE_INDEX 3
306 #define CAT_DB_DESCRIPTION_INDEX 4
307 #define CAT_DB_DCREATED_INDEX 5
308 #define CAT_DB_ICON_INDEX 6
309 #define CAT_DB_ACCOUNT_ID_INDEX 7
310 #define CAT_DB_CUSTOM_ID_INDEX 8
311
312 // Indexes of columns as they are DEFINED IN THE TABLE for FEEDS.
313 #define FDS_DB_ID_INDEX 0
314 #define FDS_DB_ORDER_INDEX 1
315 #define FDS_DB_TITLE_INDEX 2
316 #define FDS_DB_DESCRIPTION_INDEX 3
317 #define FDS_DB_DCREATED_INDEX 4
318 #define FDS_DB_ICON_INDEX 5
319 #define FDS_DB_CATEGORY_INDEX 6
320 #define FDS_DB_SOURCE_INDEX 7
321 #define FDS_DB_UPDATE_TYPE_INDEX 8
322 #define FDS_DB_UPDATE_INTERVAL_INDEX 9
323 #define FDS_DB_IS_OFF_INDEX 10
324 #define FDS_DB_IS_QUIET_INDEX 11
325 #define FDS_DB_IS_RTL_INDEX 12
326 #define FDS_DB_ADD_ANY_DATETIME_ARTICLES_INDEX 13
327 #define FDS_DB_DATETIME_TO_AVOID_INDEX 14
328 #define FDS_DB_KEEP_CUSTOMIZE 15
329 #define FDS_DB_KEEP_ARTICLES_COUNT 16
330 #define FDS_DB_KEEP_UNREAD_ARTICLES 17
331 #define FDS_DB_KEEP_STARRED_ARTICLES 18
332 #define RECYCLE_ARTICLE_DONT_PURGE 19
333 #define FDS_DB_OPEN_ARTICLES_INDEX 20
334 #define FDS_DB_ACCOUNT_ID_INDEX 21
335 #define FDS_DB_CUSTOM_ID_INDEX 22
336 #define FDS_DB_CUSTOM_DATA_INDEX 23
337
338 // Indexes of columns for feed models.
339 #define FDS_MODEL_TITLE_INDEX 0
340 #define FDS_MODEL_COUNTS_INDEX 1
341
342 // Indexes of columns for message filter manager models.
343 #define MFM_MODEL_ISREAD 0
344 #define MFM_MODEL_ISIMPORTANT 1
345 #define MFM_MODEL_ISDELETED 2
346 #define MFM_MODEL_TITLE 3
347 #define MFM_MODEL_URL 4
348 #define MFM_MODEL_AUTHOR 5
349 #define MFM_MODEL_CREATED 6
350 #define MFM_MODEL_SCORE 7
351
352 #if defined(Q_OS_LINUX)
353 #define OS_ID "Linux"
354 #elif defined(Q_OS_FREEBSD)
355 #define OS_ID "FreeBSD"
356 #elif defined(Q_OS_NETBSD)
357 #define OS_ID "NetBSD"
358 #elif defined(Q_OS_OPENBSD)
359 #define OS_ID "OpenBSD"
360 #elif defined(Q_OS_OS2)
361 #define OS_ID "OS2"
362 #elif defined(Q_OS_MACOS)
363 #define OS_ID "macOS"
364 #elif defined(Q_OS_WIN)
365 #define OS_ID "Windows"
366 #elif defined(Q_OS_ANDROID)
367 #define OS_ID "Android"
368 #elif defined(Q_OS_UNIX)
369 #define OS_ID "Unix"
370 #else
371 #define OS_ID ""
372 #endif
373
374 // Paths.
375 #define APP_THEME_PATH QSL(":/graphics")
376 #define APP_SQL_PATH QSL(":/sql")
377 #define APP_INFO_PATH QSL(":/text")
378
379 #define BUILTIN_JS_FOLDER QSL(":/scripts/builtin_js")
380 #define OBSERVER_JS_FILE QSL("observer.js")
381
382 #define WEB_UI_FOLDER QSL(":/scripts/web_ui")
383 #define WEB_UI_FILE QSL("rssguard.html")
384
385 #define APP_ICON_PATH QSL(":/graphics/rssguard.png")
386 #define APP_ICON_PLAIN_PATH QSL(":/graphics/rssguard_plain.png")
387
388 #define APP_ICON_MONO_PATH QSL(":/graphics/rssguard_mono.png")
389 #define APP_ICON_MONO_PLAIN_PATH QSL(":/graphics/rssguard_plain_mono.png")
390
391 #define APP_SKIN_PATH QSL(":/skins")
392 #define APP_INITIAL_FEEDS_PATH QSL(":/initial_feeds")
393 #define APP_LANG_PATH QSL(":/localization")
394
395 #if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
396 #define APP_DESKTOP_ENTRY_FILE "rssguard.desktop.in"
397
398 #define APP_DESKTOP_ENTRY_PATH QSL(":/desktop")
399 #endif
400
401 //
402 // Source code specific enhancements.
403 //
404 #if QT_VERSION >= 0x050E00 // Qt >= 5.14.0
405 #define FROM_STD_LIST(x, y) (x(y.begin(), y.end()))
406 #define FROM_LIST_TO_SET(x, y) (x(y.begin(), y.end()))
407 #else
408 #define FROM_STD_LIST(x, y) (x::fromStdList(y))
409 #define FROM_LIST_TO_SET(x, y) (x::fromList(y))
410 #endif
411
412 #ifndef qDebugNN
413 #define qDebugNN qDebug().noquote().nospace()
414 #endif
415
416 #ifndef qWarningNN
417 #define qWarningNN qWarning().noquote().nospace()
418 #endif
419
420 #ifndef qCriticalNN
421 #define qCriticalNN qCritical().noquote().nospace()
422 #endif
423
424 #ifndef qInfoNN
425 #define qInfoNN qInfo().noquote().nospace()
426 #endif
427
428 #define NONQUOTE_W_SPACE_DOT(x) " " << (x) << "."
429 #define NONQUOTE_W_SPACE(x) " " << (x) << " "
430 #define QUOTE_W_SPACE_DOT(x) " '" << (x) << "'."
431 #define QUOTE_W_SPACE_COMMA(x) " '" << (x) << "',"
432 #define QUOTE_W_SPACE(x) " '" << (x) << "' "
433 #define QUOTE_NO_SPACE(x) "'" << (x) << "'"
434
435 #ifndef QSL
436
437 // Thin macro wrapper for literal strings.
438 // They are much more memory efficient and faster.
439 // Use it for all literals except for two cases:
440 // a) Methods which take QLatin1String (use QLatin1String for literal argument too),
441 // b) Construction of empty literals "", use QString() instead of QStringLiteral("").
442 #define QSL(x) QStringLiteral(x)
443 #endif
444
445 #ifndef QL1S
446
447 // Macro for latin strings. Latin strings are
448 // faster than QStrings created from literals.
449 #define QL1S(x) QLatin1String(x)
450 #endif
451
452 #ifndef QL1C
453
454 // Macro for latin chars.
455 #define QL1C(x) QLatin1Char(x)
456 #endif
457
458 #endif // DEFINITIONS_H