File indexing completed on 2025-04-27 03:58:32

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-08-02
0007  * Description : colors theme manager
0008  *
0009  * SPDX-FileCopyrightText: 2006-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_THEME_MANAGER_H
0016 #define DIGIKAM_THEME_MANAGER_H
0017 
0018 // Qt includes
0019 
0020 #include <QObject>
0021 #include <QPixmap>
0022 #include <QString>
0023 
0024 // Local includes
0025 
0026 #include "digikam_export.h"
0027 
0028 class QMenu;
0029 
0030 namespace Digikam
0031 {
0032 
0033 class DXmlGuiWindow;
0034 class Theme;
0035 
0036 class DIGIKAM_EXPORT ThemeManager : public QObject
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041 
0042     ~ThemeManager()                   override;
0043     static ThemeManager* instance();
0044 
0045     QString currentThemeName() const;
0046     void    setCurrentTheme(const QString& name);
0047 
0048     QString defaultThemeName() const;
0049 
0050     void    setThemeMenuAction(QMenu* const action);
0051     void    registerThemeActions(DXmlGuiWindow* const win);
0052 
0053     void    updateThemeMenu();
0054 
0055 Q_SIGNALS:
0056 
0057     void signalThemeChanged();
0058 
0059 private Q_SLOTS:
0060 
0061     void slotChangePalette();
0062 
0063 private:
0064 
0065     // Disable
0066     ThemeManager();
0067     explicit ThemeManager(QObject*);
0068 
0069     void    populateThemeMenu();
0070     QString currentDesktopdefaultTheme() const;
0071     void    updateCurrentDesktopDefaultThemePreview();
0072 
0073 private:
0074 
0075     friend class ThemeManagerCreator;
0076 
0077     class Private;
0078     Private* const d;
0079 };
0080 
0081 } // namespace Digikam
0082 
0083 #endif // DIGIKAM_THEME_MANAGER_H