2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2023 Vladimir Golovnev <glassez@yandex.ru>
4 * Copyright (C) 2019 Prince Gupta <jagannatharjun11@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 * In addition, as a special exception, the copyright holders give permission to
22 * link this program with the OpenSSL project's "OpenSSL" library (or with
23 * modified versions of it that use the same license as the "OpenSSL" library),
24 * and distribute the linked executables. You must obey the GNU General Public
25 * License in all respects for all of the code used other than "OpenSSL". If
26 * you modify file(s), you may extend this exception to your version of the
27 * file(s), but you are not obligated to do so. If you do not wish to do so,
28 * delete this exception statement from your version.
36 #include <QCoreApplication>
41 #include "base/path.h"
42 #include "uithemecommon.h"
52 Q_DECLARE_TR_FUNCTIONS(UIThemeSource
)
55 virtual ~UIThemeSource() = default;
57 virtual QColor
getColor(const QString
&colorId
, ColorMode colorMode
) const = 0;
58 virtual Path
getIconPath(const QString
&iconId
, ColorMode colorMode
) const = 0;
59 virtual QByteArray
readStyleSheet() = 0;
62 class DefaultThemeSource final
: public UIThemeSource
67 QByteArray
readStyleSheet() override
;
68 QColor
getColor(const QString
&colorId
, ColorMode colorMode
) const override
;
69 Path
getIconPath(const QString
&iconId
, ColorMode colorMode
) const override
;
74 const Path m_defaultPath
;
75 const Path m_userPath
;
76 QHash
<QString
, UIThemeColor
> m_colors
;
79 class CustomThemeSource
: public UIThemeSource
82 QColor
getColor(const QString
&colorId
, ColorMode colorMode
) const override
;
83 Path
getIconPath(const QString
&iconId
, ColorMode colorMode
) const override
;
84 QByteArray
readStyleSheet() override
;
87 explicit CustomThemeSource(const Path
&themeRootPath
);
89 DefaultThemeSource
*defaultThemeSource() const;
92 Path
themeRootPath() const;
95 const std::unique_ptr
<DefaultThemeSource
> m_defaultThemeSource
= std::make_unique
<DefaultThemeSource
>();
97 QHash
<QString
, QColor
> m_colors
;
98 QHash
<QString
, QColor
> m_darkModeColors
;
101 class QRCThemeSource final
: public CustomThemeSource
107 class FolderThemeSource
: public CustomThemeSource
110 explicit FolderThemeSource(const Path
&folderPath
);
112 QByteArray
readStyleSheet() override
;