File indexing completed on 2023-09-24 04:01:19
0001 /* 0002 SPDX-FileCopyrightText: 2006 Mauricio Piacentini <mauricio@tabuleiro.com> 0003 SPDX-FileCopyrightText: 2007 Matt Williams <matt@milliams.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KGAMETHEMESELECTOR_H 0008 #define KGAMETHEMESELECTOR_H 0009 0010 #include <QWidget> 0011 0012 //#include <libkdegames_export.h> 0013 0014 class KGameTheme; 0015 class KConfigSkeleton; 0016 class KGameThemeSelectorPrivate; 0017 0018 /** 0019 * \class KGameThemeSelector kgamethemeselector.h <KGameThemeSelector> 0020 * 0021 * @short A widget used to select the game's theme 0022 * 0023 * The most common way to use the theme selector is to add it as page to a KConfigDialog 0024 * \code 0025 * KConfigDialog *dialog = new KConfigDialog(this, "settings", Settings::self()); 0026 * dialog->addPage(new KGameThemeSelector(dialog, Settings::self()), i18n("Theme"), "game_theme"); 0027 * dialog->show(); 0028 * \endcode 0029 * This will create a page in your KConfigDialog with the title "Theme" and using the 0030 * "game_theme" icon. By default, the widget will search in the share/apps/appname/themes 0031 * directory for .desktop files with a group called "KGameTheme". 0032 * 0033 * @author Mauricio Piacentini 0034 **/ 0035 class KGameThemeSelector : public QWidget 0036 { 0037 Q_OBJECT 0038 public: 0039 enum NewStuffState { NewStuffDisableDownload, NewStuffEnableDownload }; 0040 /** 0041 * Load a specific theme file. 0042 * @param parent the parent widget 0043 * @param config configuration data 0044 * @param knsflags KDE New Stuff flags 0045 * @param groupName the title of the config group in the theme .desktop file 0046 * @param directory subdirectory (of share/apps/appname) to search in 0047 * @return true if the theme files and properties could be loaded 0048 */ 0049 KGameThemeSelector(QWidget *parent, 0050 KConfigSkeleton *config, 0051 KGameThemeSelector::NewStuffState knsflags = KGameThemeSelector::NewStuffEnableDownload, 0052 const QString &groupName = QStringLiteral("KGameTheme"), 0053 const QString &directory = QStringLiteral("themes")); 0054 ~KGameThemeSelector() override; 0055 0056 private: 0057 KGameThemeSelectorPrivate *const d_ptr; 0058 0059 Q_DISABLE_COPY(KGameThemeSelector) 0060 Q_DECLARE_PRIVATE(KGameThemeSelector) 0061 0062 Q_PRIVATE_SLOT(d_func(), void _k_updatePreview()) 0063 Q_PRIVATE_SLOT(d_func(), void _k_updateThemeList(const QString &)) 0064 }; 0065 0066 #endif