KDEGames

kgamethemeselector.h
1/*
2 SPDX-FileCopyrightText: 2012 Stefan Majewsky <majewsky@gmx.net>
3
4 SPDX-License-Identifier: LGPL-2.0-only
5*/
6
7#ifndef KGAMETHEMESELECTOR_H
8#define KGAMETHEMESELECTOR_H
9
10// own
11#include "kdegames_export.h"
12#include "kgamethemeprovider.h"
13// Qt
14#include <QWidget>
15// Std
16#include <memory>
17
18/**
19 * @class KGameThemeSelector kgamethemeselector.h <KGameThemeSelector>
20 * @brief Theme selection widget.
21 *
22 * This widget allows the user to change the theme selection of a
23 * KGameThemeProvider. Selections are immediately applied to allow the user
24 * to quickly preview themes. In simple cases, the widget can be used
25 * standalone with the showAsDialog() method.
26 *
27 * @code
28 * K_GLOBAL_STATIC_WITH_ARGS(KGameThemeSelector, selector, (provider))
29 * ...
30 * selector->showAsDialog();
31 * @endcode
32 */
33class KDEGAMES_EXPORT KGameThemeSelector : public QWidget
34{
35 Q_OBJECT
36 Q_DISABLE_COPY(KGameThemeSelector)
37
38public:
39 /// Flags which control the behavior of KGameThemeSelector.
40 enum Option {
41 DefaultBehavior = 0,
42 /// Enable downloading of additional themes with KNewStuff3.
43 /// This requires a KNS3 config file to be installed for this app.
44 EnableNewStuffDownload = 1 << 0
45 };
46 /**
47 * Stores a combination of #Option values.
48 */
49 Q_DECLARE_FLAGS(Options, Option)
50
51 explicit KGameThemeSelector(KGameThemeProvider *provider, Options options = DefaultBehavior, QWidget *parent = nullptr);
52 ~KGameThemeSelector() override;
53
54 void setNewStuffConfigFileName(const QString &configFileName);
55
56public Q_SLOTS:
57 /// Create and show a non-modal dialog which displays this selector.
58 /// The dialog will be automatically cleaned up when it's closed, but it
59 /// is ensured that the selector is not deleted.
60 ///
61 /// This method does nothing if the selector widget is already visible.
62 void showAsDialog(const QString &caption = QString());
63
64private:
65 class Dialog;
66 std::unique_ptr<class KGameThemeSelectorPrivate> const d_ptr;
67 Q_DECLARE_PRIVATE(KGameThemeSelector)
68};
69
70Q_DECLARE_OPERATORS_FOR_FLAGS(KGameThemeSelector::Options)
71
72#endif // KGAMETHEMESELECTOR_H
A theme provider manages KGameTheme instances, and maintains a selection of the currentTheme().
Theme selection widget.
Option
Flags which control the behavior of KGameThemeSelector.
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.