File indexing completed on 2024-05-12 05:46:36
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 * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * This program is free software; you can redistribute it 0012 * and/or modify it under the terms of the GNU General 0013 * Public License as published by the Free Software Foundation; 0014 * either version 2, or (at your option) 0015 * any later version. 0016 * 0017 * This program is distributed in the hope that it will be useful, 0018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0020 * GNU General Public License for more details. 0021 * 0022 * ============================================================ */ 0023 0024 #ifndef THEMEMANAGER_H 0025 #define THEMEMANAGER_H 0026 0027 // Qt includes 0028 0029 #include <QObject> 0030 #include <QPixmap> 0031 #include <QString> 0032 0033 // KDE includes 0034 0035 #include <ksharedconfig.h> 0036 0037 class KActionCollection; 0038 class KActionMenu; 0039 0040 namespace Digikam 0041 { 0042 0043 0044 class ThemeManager : public QObject 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 0050 /** 0051 * @brief ThemeManager 0052 * @param theme the currently active theme: the palette will not be changed to this theme 0053 * @param parent 0054 */ 0055 explicit ThemeManager(const QString &theme = "", QObject *parent = 0); 0056 ~ThemeManager() override; 0057 0058 QString currentThemeName() const; 0059 void setCurrentTheme(const QString& name); 0060 0061 void setThemeMenuAction(KActionMenu* const action); 0062 void registerThemeActions(KActionCollection *actionCollection); 0063 0064 Q_SIGNALS: 0065 0066 void signalThemeChanged(); 0067 0068 private Q_SLOTS: 0069 0070 void slotChangePalette(); 0071 0072 private: 0073 void populateThemeMap(); 0074 void populateThemeMenu(); 0075 QPixmap createSchemePreviewIcon(const KSharedConfigPtr& config); 0076 0077 private: 0078 0079 class ThemeManagerPriv; 0080 ThemeManagerPriv* const d; 0081 }; 0082 0083 } // namespace Digikam 0084 0085 #endif /* THEMEMANAGER_H */