digiKam
Loading...
Searching...
No Matches
thememanager_p.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2004-08-02
7 * Description : colors theme manager - private classes
8 *
9 * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2007 by Matthew Woehlke <mw_triad at users dot sourceforge dot net>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18#include "thememanager.h"
19
20// C++ includes
21
22#include <cmath>
23
24// Qt includes
25
26#include <QWidget>
27#include <QPainter>
28#include <QStringList>
29#include <QFileInfo>
30#include <QPalette>
31#include <QColor>
32#include <QPixmap>
33#include <QApplication>
34#include <QAction>
35#include <QStandardPaths>
36#include <QDirIterator>
37#include <QMenu>
38#include <QStyle>
39#include <QExplicitlySharedDataPointer>
40#include <QBrush>
41#include <QBitmap>
42#include <QActionGroup>
43
44// KDE includes
45
46#if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
47# pragma GCC diagnostic push
48# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
49#endif
50
51#if defined(Q_CC_CLANG)
52# pragma clang diagnostic push
53# pragma clang diagnostic ignored "-Wdeprecated-declarations"
54#endif
55
56#include <ksharedconfig.h>
57#include <kactioncollection.h>
58#include <kconfiggroup.h>
59#include <klocalizedstring.h>
60
61// Restore warnings
62#if !defined(Q_OS_DARWIN) && defined(Q_CC_GNU)
63# pragma GCC diagnostic pop
64#endif
65
66#if defined(Q_CC_CLANG)
67# pragma clang diagnostic pop
68#endif
69
70// Local includes
71
72#include "digikam_debug.h"
73#include "dxmlguiwindow.h"
74
75namespace Digikam
76{
77
78class SchemeManagerPrivate;
79
110class Q_DECL_HIDDEN SchemeManager
111{
112public:
113
171
182 {
186 NormalBackground = 0,
193 AlternateBackground = 1,
203 ActiveBackground = 2,
212 LinkBackground = 3,
220 VisitedBackground = 4,
224 NegativeBackground = 5,
228 NeutralBackground = 6,
232 PositiveBackground = 7
233 };
234
252 {
256 NormalText = 0,
263 InactiveText = 1,
268 ActiveText = 2,
274 LinkText = 3,
282 VisitedText = 4,
287 NegativeText = 5,
291 NeutralText = 6,
296 PositiveText = 7
297 };
298
309 {
318 HoverColor
319 };
320
354
355public:
356
361
365 ~SchemeManager() = default;
366
370 SchemeManager& operator=(const SchemeManager&);
371
376 explicit SchemeManager(QPalette::ColorGroup state,
377 ColorSet set = View,
378 KSharedConfigPtr config = KSharedConfigPtr());
379
383 QBrush background(BackgroundRole = NormalBackground) const;
384
388 QBrush foreground(ForegroundRole = NormalText) const;
389
393 QBrush decoration(DecorationRole) const;
394
408 QColor shade(ShadeRole) const;
409
415 static int contrast();
416
424 static qreal contrastF(const KSharedConfigPtr& config = KSharedConfigPtr());
425
436 static QColor shade(const QColor&, ShadeRole);
437
455 static QColor shade(const QColor&,
456 ShadeRole,
457 qreal contrast,
458 qreal chromaAdjust = 0.0);
459
469 static void adjustBackground(QPalette&,
470 BackgroundRole newRole = NormalBackground,
471 QPalette::ColorRole color = QPalette::Base,
472 ColorSet set = View,
473 const KSharedConfigPtr& config = KSharedConfigPtr());
474
484 static void adjustForeground(QPalette&,
485 ForegroundRole newRole = NormalText,
486 QPalette::ColorRole color = QPalette::Text,
487 ColorSet set = View,
488 const KSharedConfigPtr& config = KSharedConfigPtr());
489
498 static QPalette createApplicationPalette(const KSharedConfigPtr& config);
499
500private:
501
502 QExplicitlySharedDataPointer<SchemeManagerPrivate> d;
503};
504
505// --------------------------------------------------------------------------
506
507class Q_DECL_HIDDEN ThemeManager::Private
508{
509public:
510
511 Private();
512
513 QPixmap createSchemePreviewIcon(const KSharedConfigPtr& config) const;
514
515public:
516
517 const QString defaultThemeName;
518 QMap<QString, QString> themeMap;
519
520 QActionGroup* themeMenuActionGroup = nullptr;
521 QMenu* themeMenuAction = nullptr;
522};
523
524} // namespace Digikam
Definition thememanager_p.h:111
ColorSet
Definition thememanager_p.h:122
@ View
Definition thememanager_p.h:128
@ Button
Definition thememanager_p.h:142
@ Tooltip
Definition thememanager_p.h:159
@ Window
Definition thememanager_p.h:134
@ Selection
Definition thememanager_p.h:150
DecorationRole
Definition thememanager_p.h:309
@ FocusColor
Definition thememanager_p.h:313
BackgroundRole
Definition thememanager_p.h:182
ForegroundRole
Definition thememanager_p.h:252
ShadeRole
Definition thememanager_p.h:330
@ MidShade
Definition thememanager_p.h:343
@ MidlightShade
Definition thememanager_p.h:339
@ LightShade
Definition thememanager_p.h:335
@ DarkShade
Definition thememanager_p.h:347
Definition thememanager_p.h:508
const QString defaultThemeName
Definition thememanager_p.h:517
QMap< QString, QString > themeMap
map<theme name, theme config path>
Definition thememanager_p.h:518
Definition thememanager.h:36
Definition datefolderview.cpp:34