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

0001 /***************************************************************************
0002  *   Copyright (C) 2010 Adam Rakowski <foo-script@o2.pl>  (GSoC 2010)      *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 
0020 #ifndef KHMTHEMEFACTORY_H
0021 #define KHMTHEMEFACTORY_H
0022 
0023 #include <QRect>
0024 #include <QColor>
0025 #include <QList>
0026 #include <QDir>
0027 #include <QDomElement>
0028 
0029 #include "khmtheme.h"
0030 
0031 class KHMTheme;
0032 
0033 class KHMThemeFactory
0034 {
0035 public:
0036     bool addTheme(const QString &filePath);    //returns "true" if theme has been added successfully, "false" otherwise
0037     void walkDirectory(const QDir &dir);   //walks the directory loads valid themes files. No recursion
0038 
0039     int getQty() const; //returns quantity of list
0040     QStringList getNames() const; //returns short names(worknames) of all the themes
0041     QStringList themeList() const;    //returns user interface names of all the themes
0042     const KHMTheme * getTheme(int id) const;  //Returns theme at "index". An "index" must exists
0043 
0044 private:
0045     QList<KHMTheme> themesList;
0046 
0047     static QRect makeRect(const QDomElement &element, const QString &propertyName);
0048     static QColor getColor(const QDomElement &element, const QString &propertyName);
0049     static bool checkTheme(const QDomElement &root, const QString &themeVersion);
0050     void doTheme(const QDomElement &theme, const QString &version);
0051 };
0052 
0053 #endif // KHMTHEMEFACTORY_H