File indexing completed on 2024-04-14 03:40:32

0001 // SPDX-FileCopyrightText: 2010 Adam Rakowski <foo-script@o2.pl>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 #ifndef KHMTHEMEFACTORY_H
0005 #define KHMTHEMEFACTORY_H
0006 
0007 #include <QRect>
0008 #include <QColor>
0009 #include <QList>
0010 #include <QDir>
0011 #include <QDomElement>
0012 
0013 #include "khmtheme.h"
0014 
0015 class KHMTheme;
0016 
0017 class KHMThemeFactory
0018 {
0019 public:
0020     bool addTheme(const QString &filePath);    //returns "true" if theme has been added successfully, "false" otherwise
0021     void walkDirectory(const QDir &dir);   //walks the directory loads valid themes files. No recursion
0022 
0023     int getQty() const; //returns quantity of list
0024     QStringList getNames() const; //returns short names(worknames) of all the themes
0025     QStringList themeList() const;    //returns user interface names of all the themes
0026     const KHMTheme * getTheme(int id) const;  //Returns theme at "index". An "index" must exists
0027 
0028 private:
0029     QList<KHMTheme> themesList;
0030 
0031     static QRect makeRect(const QDomElement &element, const QString &propertyName);
0032     static QColor getColor(const QDomElement &element, const QString &propertyName);
0033     static bool checkTheme(const QDomElement &root, const QString &themeVersion);
0034     void doTheme(const QDomElement &theme, const QString &version);
0035 };
0036 
0037 #endif // KHMTHEMEFACTORY_H