00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef COLORMANAGER_H
00024 #define COLORMANAGER_H
00025
00026 #include <QObject>
00027 #include <QColor>
00028 #include <QFont>
00029 #include <QHash>
00030 #include <QCursor>
00031 #include <QString>
00032 #include <QVariant>
00033 #include <QPalette>
00034
00035 class QFileSystemWatcher;
00036
00037 class Themer : public QObject
00038 {
00039 Q_OBJECT
00040 public:
00041 void save();
00042 void load();
00043
00044 void set_path_and_theme(const QString& path, const QString& theme);
00045 void use_builtin_theme(const QString& theme);
00046 void set_color_adjust_value(int value);
00047
00048 QColor get_color(const QString& name) const;
00049 QFont get_font(const QString& fontname) const;
00050 QVariant get_property(const QString& propertyname, const QVariant& defaultValue=0) const;
00051 QPalette system_palette() const {return m_systempallete;}
00052 QStringList get_builtin_themes();
00053 QCursor get_cursor(const QString& name) const;
00054
00055 static Themer* instance();
00056
00057 private:
00058 Themer();
00059
00060 QHash<QString, QColor> m_colors;
00061 QHash<QString, QVariant> m_properties;
00062 QHash<QString, QFont> m_fonts;
00063 QHash<QString, QCursor> m_cursors;
00064 QFileSystemWatcher* m_watcher;
00065 QString m_themefile;
00066 int m_coloradjust;
00067 QPalette m_systempallete;
00068 QString m_currentTheme;
00069
00070 QColor get_default_color(const QString& name);
00071
00072 static Themer* m_instance;
00073
00074
00075 private slots:
00076 void reload_on_themefile_change(const QString&);
00077
00078 signals:
00079 void themeLoaded();
00080 };
00081
00082
00083 Themer* themer();
00084
00085 #endif
00086