~kubuntu-members/libkdegames/4.11

« back to all changes in this revision

Viewing changes to libkdegamesprivate/kgametheme.h

  • Committer: Stefan Majewsky
  • Date: 2012-05-01 15:34:35 UTC
  • Revision ID: git-v1:82376fb5ca6f29f862641b6ca68603cb76258831
Begin to move stuff into libkdegamesprivate.

The build is now broken because I'm moving stuff without adjusting the
CMake files. But I figured it's cleaner to have the move in one commit
and the various edits in CMake and source files in the next commits.

svn path=/trunk/KDE/kdegames/libkdegames/; revision=1292461

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2007 Mauricio Piacentini   <mauricio@tabuleiro.com>
 
3
    Copyright (C) 2007 Matt Williams   <matt@milliams.com>
 
4
 
 
5
    This library is free software; you can redistribute it and/or modify
 
6
    it under the terms of the GNU General Public License as published by
 
7
    the Free Software Foundation; either version 2 of the License, or
 
8
    (at your option) any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License
 
16
    along with this program; if not, write to the Free Software
 
17
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
*/
 
19
 
 
20
#ifndef KGAMETHEME_H
 
21
#define KGAMETHEME_H
 
22
 
 
23
#include <libkdegames_export.h>
 
24
 
 
25
#include <QtCore/QString>
 
26
 
 
27
class KGameThemePrivate;
 
28
class QPixmap;
 
29
 
 
30
/**
 
31
 * \class KGameTheme kgametheme.h <KGameTheme>
 
32
 * 
 
33
 * @short Class for loading theme files
 
34
 *
 
35
 * Essentially just a wrapper around a .desktop theme file. Load a file with
 
36
 * load() and then access its properties.
 
37
 *
 
38
 * For more advanced feaures like dynamic themes or custom game rules, it
 
39
 * will likely be necessary to derive from this class
 
40
 *
 
41
 * @author Mauricio Piacentini
 
42
 * @deprecated Use KgTheme instead.
 
43
 **/
 
44
class KDEGAMES_EXPORT_DEPRECATED KGameTheme
 
45
{
 
46
    public:
 
47
        KGameTheme(const QString &themeGroup = QLatin1String("KGameTheme"));
 
48
        virtual ~KGameTheme();
 
49
 
 
50
        /**
 
51
         * Load the default theme file. Called "default.desktop"
 
52
         * @return true if the theme files and properties could be loaded
 
53
         */
 
54
        virtual bool loadDefault();
 
55
        /**
 
56
         * Load a specific theme file.
 
57
         * Note that although theme could be successfully loaded,
 
58
         * no check on the validity of theme's SVG file contents is done.
 
59
         * Application writers will need to perform this check manually
 
60
         * e.g. by calling QSvgRenderer::isValid()
 
61
         * @param file the name of the theme file relative to the share/apps/appname
 
62
         * directory. e.g. "themes/classic.desktop"
 
63
         * @return true if the theme files and properties could be loaded
 
64
         */
 
65
        virtual bool load(const QString &file);
 
66
        /// @return the full path of the .desktop file
 
67
        QString path() const;
 
68
        /// @return just the "*.desktop" part
 
69
        QString fileName() const;
 
70
        /// @return the full path of the svg file which is specified in "FileName" key
 
71
        virtual QString graphics() const;
 
72
        /// @return a property directly from the .desktop file
 
73
        QString property(const QString &key) const;
 
74
        /// @return a preview pixmap
 
75
        QPixmap preview() const;
 
76
        /**
 
77
         * Possible keys:
 
78
         * - Name
 
79
         * - Author
 
80
         * - Description
 
81
         * - AuthorEmail
 
82
         * @param key the key of the wanted property
 
83
         * @return the data related to 'key'
 
84
         */
 
85
        virtual QString themeProperty(const QString &key) const;
 
86
 
 
87
    private:
 
88
        friend class KGameThemePrivate;
 
89
        KGameThemePrivate *const d;
 
90
};
 
91
 
 
92
#endif