Warning, file /education/parley/src/settings/kgametheme/kgametheme.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2007 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 KGAMETHEME_H
0008 #define KGAMETHEME_H
0009 
0010 #include <QString>
0011 
0012 class KGameThemePrivate;
0013 class QPixmap;
0014 
0015 /**
0016  * \class KGameTheme kgametheme.h <KGameTheme>
0017  *
0018  * @short Class for loading theme files
0019  *
0020  * Essentially just a wrapper around a .desktop theme file. Load a file with
0021  * load() and then access its properties.
0022  *
0023  * For more advanced features like dynamic themes or custom game rules, it
0024  * will likely be necessary to derive from this class
0025  *
0026  * @author Mauricio Piacentini
0027  **/
0028 class KGameTheme
0029 {
0030 public:
0031     explicit KGameTheme(const QString &themeGroup = QStringLiteral("KGameTheme"));
0032     virtual ~KGameTheme();
0033 
0034     /**
0035      * Load the default theme file. Called "default.desktop"
0036      * @return true if the theme files and properties could be loaded
0037      */
0038     virtual bool loadDefault();
0039     /**
0040      * Load a specific theme file.
0041      * Note that although theme could be successfully loaded,
0042      * no check on the validity of theme's SVG file contents is done.
0043      * Application writers will need to perform this check manually
0044      * e.g. by calling KSvgRenderer::isValid()
0045      * @param file the name of the theme file relative to the share/apps/appname
0046      * directory. e.g. "themes/classic.desktop"
0047      * @return true if the theme files and properties could be loaded
0048      */
0049     virtual bool load(const QString &file);
0050     /// @return the full path of the .desktop file
0051     QString path() const;
0052     /// @return just the "*.desktop" part
0053     QString fileName() const;
0054     /// @return the full path of the svg file which is specified in "FileName" key
0055     virtual QString graphics() const;
0056     /// @return a property directly from the .desktop file
0057     QString property(const QString &key) const;
0058     /// @return a preview pixmap
0059     QPixmap preview() const;
0060     /**
0061      * Possible keys:
0062      * - Name
0063      * - Author
0064      * - Description
0065      * - AuthorEmail
0066      * @param key the key of the wanted property
0067      * @return the data related to 'key'
0068      */
0069     virtual QString themeProperty(const QString &key) const;
0070 
0071 private:
0072     friend class KGameThemePrivate;
0073     KGameThemePrivate *const d;
0074 };
0075 
0076 #endif