Use tray icon from system theme only if option is set
[qBittorrent.git] / src / gui / uithemecommon.h
blob9f1a3319213d809095a8b0af80e04ac671b3d446
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2023 Vladimir Golovnev <glassez@yandex.ru>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18 * USA.
20 * In addition, as a special exception, the copyright holders give permission to
21 * link this program with the OpenSSL project's "OpenSSL" library (or with
22 * modified versions of it that use the same license as the "OpenSSL" library),
23 * and distribute the linked executables. You must obey the GNU General Public
24 * License in all respects for all of the code used other than "OpenSSL". If
25 * you modify file(s), you may extend this exception to your version of the
26 * file(s), but you are not obligated to do so. If you do not wish to do so,
27 * delete this exception statement from your version.
30 #pragma once
32 #include <QtGlobal>
33 #include <QApplication>
34 #include <QColor>
35 #include <QHash>
36 #include <QPalette>
37 #include <QSet>
38 #include <QString>
40 #include "base/global.h"
41 #include "color.h"
43 inline const QString CONFIG_FILE_NAME = u"config.json"_qs;
44 inline const QString STYLESHEET_FILE_NAME = u"stylesheet.qss"_qs;
45 inline const QString KEY_COLORS = u"colors"_qs;
46 inline const QString KEY_COLORS_LIGHT = u"colors.light"_qs;
47 inline const QString KEY_COLORS_DARK = u"colors.dark"_qs;
49 struct UIThemeColor
51 QColor light;
52 QColor dark;
55 inline QHash<QString, UIThemeColor> defaultUIThemeColors()
57 const QPalette palette = QApplication::palette();
58 return {
59 {u"Log.TimeStamp"_qs, {Color::Primer::Light::fgSubtle, Color::Primer::Dark::fgSubtle}},
60 {u"Log.Normal"_qs, {palette.color(QPalette::Active, QPalette::WindowText), palette.color(QPalette::Active, QPalette::WindowText)}},
61 {u"Log.Info"_qs, {Color::Primer::Light::accentFg, Color::Primer::Dark::accentFg}},
62 {u"Log.Warning"_qs, {Color::Primer::Light::severeFg, Color::Primer::Dark::severeFg}},
63 {u"Log.Critical"_qs, {Color::Primer::Light::dangerFg, Color::Primer::Dark::dangerFg}},
64 {u"Log.BannedPeer"_qs, {Color::Primer::Light::dangerFg, Color::Primer::Dark::dangerFg}},
66 {u"RSS.ReadArticle"_qs, {palette.color(QPalette::Inactive, QPalette::WindowText), palette.color(QPalette::Inactive, QPalette::WindowText)}},
67 {u"RSS.UnreadArticle"_qs, {palette.color(QPalette::Active, QPalette::Link), palette.color(QPalette::Active, QPalette::Link)}},
69 {u"TransferList.Downloading"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
70 {u"TransferList.StalledDownloading"_qs, {Color::Primer::Light::successEmphasis, Color::Primer::Dark::successEmphasis}},
71 {u"TransferList.DownloadingMetadata"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
72 {u"TransferList.ForcedDownloadingMetadata"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
73 {u"TransferList.ForcedDownloading"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
74 {u"TransferList.Uploading"_qs, {Color::Primer::Light::accentFg, Color::Primer::Dark::accentFg}},
75 {u"TransferList.StalledUploading"_qs, {Color::Primer::Light::accentEmphasis, Color::Primer::Dark::accentEmphasis}},
76 {u"TransferList.ForcedUploading"_qs, {Color::Primer::Light::accentFg, Color::Primer::Dark::accentFg}},
77 {u"TransferList.QueuedDownloading"_qs, {Color::Primer::Light::scaleYellow6, Color::Primer::Dark::scaleYellow6}},
78 {u"TransferList.QueuedUploading"_qs, {Color::Primer::Light::scaleYellow6, Color::Primer::Dark::scaleYellow6}},
79 {u"TransferList.CheckingDownloading"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
80 {u"TransferList.CheckingUploading"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
81 {u"TransferList.CheckingResumeData"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
82 {u"TransferList.PausedDownloading"_qs, {Color::Primer::Light::fgMuted, Color::Primer::Dark::fgMuted}},
83 {u"TransferList.PausedUploading"_qs, {Color::Primer::Light::doneFg, Color::Primer::Dark::doneFg}},
84 {u"TransferList.Moving"_qs, {Color::Primer::Light::successFg, Color::Primer::Dark::successFg}},
85 {u"TransferList.MissingFiles"_qs, {Color::Primer::Light::dangerFg, Color::Primer::Dark::dangerFg}},
86 {u"TransferList.Error"_qs, {Color::Primer::Light::dangerFg, Color::Primer::Dark::dangerFg}}
90 inline QSet<QString> defaultUIThemeIcons()
92 return {
93 u"application-exit"_qs,
94 u"application-rss"_qs,
95 u"application-url"_qs,
96 u"browser-cookies"_qs,
97 u"chart-line"_qs,
98 u"checked-completed"_qs,
99 u"configure"_qs,
100 u"connected"_qs,
101 u"dialog-warning"_qs,
102 u"directory"_qs,
103 u"disconnected"_qs,
104 u"download"_qs,
105 u"downloading"_qs,
106 u"edit-clear"_qs,
107 u"edit-copy"_qs,
108 u"edit-find"_qs,
109 u"edit-rename"_qs,
110 u"error"_qs,
111 u"fileicon"_qs,
112 u"filter-active"_qs,
113 u"filter-all"_qs,
114 u"filter-inactive"_qs,
115 u"filter-stalled"_qs,
116 u"firewalled"_qs,
117 u"folder-documents"_qs,
118 u"folder-new"_qs,
119 u"folder-remote"_qs,
120 u"force-recheck"_qs,
121 u"go-bottom"_qs,
122 u"go-down"_qs,
123 u"go-top"_qs,
124 u"go-up"_qs,
125 u"hash"_qs,
126 u"help-about"_qs,
127 u"help-contents"_qs,
128 u"insert-link"_qs,
129 u"ip-blocked"_qs,
130 u"list-add"_qs,
131 u"list-remove"_qs,
132 u"loading"_qs,
133 u"mail-inbox"_qs,
134 u"name"_qs,
135 u"network-connect"_qs,
136 u"network-server"_qs,
137 u"object-locked"_qs,
138 u"peers"_qs,
139 u"peers-add"_qs,
140 u"peers-remove"_qs,
141 u"plugins"_qs,
142 u"preferences-advanced"_qs,
143 u"preferences-bittorrent"_qs,
144 u"preferences-desktop"_qs,
145 u"preferences-webui"_qs,
146 u"qbittorrent-tray"_qs,
147 u"qbittorrent-tray-dark"_qs,
148 u"qbittorrent-tray-light"_qs,
149 u"queued"_qs,
150 u"ratio"_qs,
151 u"reannounce"_qs,
152 u"security-high"_qs,
153 u"security-low"_qs,
154 u"set-location"_qs,
155 u"slow"_qs,
156 u"slow_off"_qs,
157 u"speedometer"_qs,
158 u"stalledDL"_qs,
159 u"stalledUP"_qs,
160 u"stopped"_qs,
161 u"system-log-out"_qs,
162 u"tags"_qs,
163 u"task-complete"_qs,
164 u"task-reject"_qs,
165 u"torrent-creator"_qs,
166 u"torrent-magnet"_qs,
167 u"torrent-start"_qs,
168 u"torrent-start-forced"_qs,
169 u"torrent-stop"_qs,
170 u"tracker-error"_qs,
171 u"tracker-warning"_qs,
172 u"trackerless"_qs,
173 u"trackers"_qs,
174 u"upload"_qs,
175 u"view-categories"_qs,
176 u"view-preview"_qs,
177 u"view-refresh"_qs,
178 u"view-statistics"_qs,
179 u"wallet-open"_qs