KDEGames
kgamethemeprovider.cpp
177void KGameThemeProvider::discoverThemes(const QString &directory, const QString &defaultThemeName, const QMetaObject *themeClass)
220 const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::AppDataLocation, d->m_dtDirectory, QStandardPaths::LocateDirectory);
247 const QByteArray id = QString(d->m_dtDirectory + QLatin1Char('/') + themeDesktopFileName).toUtf8();
262 theme = qobject_cast<KGameTheme *>(d->m_dtThemeClass->newInstance(Q_ARG(QByteArray, id), Q_ARG(QObject *, this)));
263 Q_ASSERT_X(theme, "KGameThemeProvider::discoverThemes", "Could not create theme instance. Is your constructor Q_INVOKABLE?");
288 auto it = std::find_if(d->m_themes.cbegin(), d->m_themes.cend(), [id](const KGameTheme *theme) {
333 QPixmap pixmap = QPixmap(theme->previewPath()).scaled(size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation);
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
A theme provider manages KGameTheme instances, and maintains a selection of the currentTheme().
Definition kgamethemeprovider.h:31
QList< const KGameTheme * > themes() const
Definition kgamethemeprovider.cpp:95
void currentThemeChanged(const KGameTheme *theme)
Emitted when the current theme changes.
void rediscoverThemes()
After this provider has been set up with discoverThemes(), this method may be used to read additional...
Definition kgamethemeprovider.cpp:206
void discoverThemes(const QString &directory, const QString &defaultThemeName=QStringLiteral("default"), const QMetaObject *themeClass=nullptr)
This method reads theme description files from a standard location.
Definition kgamethemeprovider.cpp:177
virtual QPixmap generatePreview(const KGameTheme *theme, QSize size)
Generate a preview pixmap for the given theme.
Definition kgamethemeprovider.cpp:330
void currentThemeNameChanged(const QString &themeName)
Emitted when the name of the current theme changes.
void setDefaultTheme(const KGameTheme *theme)
Definition kgamethemeprovider.cpp:123
void setDeclarativeEngine(const QString &name, QQmlEngine *engine)
Registers this KGameThemeProvider with engine's root context with ID name and constructs a KGameImage...
Definition kgamethemeprovider.cpp:338
void setCurrentTheme(const KGameTheme *theme)
Select a new theme.
Definition kgamethemeprovider.cpp:159
const KGameTheme * defaultTheme() const
Definition kgamethemeprovider.cpp:116
KGameThemeProvider(const QByteArray &configKey=QByteArrayLiteral("Theme"), QObject *parent=nullptr)
Constructor.
Definition kgamethemeprovider.cpp:55
virtual bool readFromDesktopFile(const QString &path)
Initializes a KGameTheme instance by reading a description file.
Definition kgametheme.cpp:104
Dirs
QStringList entryList(Filters filters, SortFlags sort) const const
QString fileName() const const
void append(QList< T > &&value)
bool contains(const AT &value) const const
qsizetype count() const const
bool isEmpty() const const
void prepend(parameter_type value)
void reserve(qsizetype size)
qsizetype size() const const
T value(qsizetype i) const const
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
T qobject_cast(QObject *object)
void setParent(QObject *parent)
qreal devicePixelRatio() const const
QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const const
void setDevicePixelRatio(qreal scaleFactor)
void setContextProperty(const QString &name, QObject *value)
void addImageProvider(const QString &providerId, QQmlImageProviderBase *provider)
QQmlContext * rootContext() const const
LocateDirectory
AppDataLocation
QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options)
QByteArray toUtf8() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
KeepAspectRatio
SmoothTransformation
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.