File indexing completed on 2024-05-12 16:01:59
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2004-08-02 0007 * Description : theme manager 0008 * 0009 * SPDX-FileCopyrightText: 2006-2011 Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #ifndef THEMEMANAGER_H 0016 #define THEMEMANAGER_H 0017 0018 // Qt includes 0019 0020 #include <QObject> 0021 #include <QPixmap> 0022 #include <QString> 0023 0024 // KDE includes 0025 0026 #include <ksharedconfig.h> 0027 0028 class KisKActionCollection; 0029 class KActionMenu; 0030 0031 namespace Digikam 0032 { 0033 0034 0035 class ThemeManager : public QObject 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 0041 /** 0042 * @brief ThemeManager 0043 * @param theme the currently active theme: the palette will not be changed to this theme 0044 * @param parent 0045 */ 0046 explicit ThemeManager(const QString &theme = "", QObject *parent = 0); 0047 ~ThemeManager() override; 0048 0049 QString currentThemeName() const; 0050 void setCurrentTheme(const QString& name); 0051 0052 void setThemeMenuAction(KActionMenu* const action); 0053 void registerThemeActions(KisKActionCollection *actionCollection); 0054 0055 Q_SIGNALS: 0056 0057 void signalThemeChanged(); 0058 0059 private Q_SLOTS: 0060 0061 void slotChangePalette(); 0062 0063 private: 0064 void populateThemeMap(); 0065 void populateThemeMenu(); 0066 QPixmap createSchemePreviewIcon(const KSharedConfigPtr& config); 0067 0068 private: 0069 0070 class ThemeManagerPriv; 0071 ThemeManagerPriv* const d; 0072 }; 0073 0074 } // namespace Digikam 0075 0076 #endif /* THEMEMANAGER_H */