Prepare 1.0 alpha3 release.
[tagua/yd.git] / src / pref_theme.h
blob034038b60d91199c71e3530e75099717d3877ca9
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program 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 */
11 #ifndef PREFERENCES__THEME_H
12 #define PREFERENCES__THEME_H
14 #include <set>
15 #include <map>
16 #include <boost/shared_ptr.hpp>
17 #include <QDateTime>
18 #include <QDir>
19 #include "option.h"
20 #include "themeinfo.h"
21 #include "ui_pref_theme.h"
22 #include "ui_pref_theme_page.h"
23 #include "fwd.h"
25 class VariantInfo;
26 class Settings;
27 class QAction;
29 class PrefTheme : public QWidget
30 , private Ui::PrefTheme {
31 Q_OBJECT
32 friend class PrefThemeCategory;
33 typedef class PrefThemeCategory Category;
35 typedef QList<ThemeInfo> ThemeInfoList;
36 typedef std::map<QString, Category*> CategoryMap;
38 std::map<QString, OptList> m_new_theme_options;
39 CategoryMap m_categories;
41 OptList get_file_options(const QString&, bool reload_defaults = false);
42 static ThemeInfoList to_theme_info_list(const QStringList& files, const Settings& s);
43 static int theme_ok_for_variant(const ThemeInfo&, const QString&);
44 static void update_list_view(QListWidget* list, const ThemeInfoList& themes,
45 QString variant, QString settings);
46 private Q_SLOTS:
47 void variantChanged();
49 public:
50 PrefTheme(const QString&, QWidget *parent = 0);
51 ~PrefTheme();
53 void apply();
55 static ThemeInfo getBestTheme(const VariantPtr& vi, const QString&);
59 class PrefThemeCategory : public QWidget
60 , private Ui::PrefThemePage {
61 Q_OBJECT
63 public:
64 friend class PrefTheme;
65 QAction* m_reset;
66 PrefTheme* m_parent;
67 QString m_id;
68 PrefTheme::ThemeInfoList m_themes;
69 std::map<QString, QString> m_new_themes;
70 std::map<QString, bool> m_new_use_def;
72 QLayout *m_opt_layout;
73 QWidget *m_opt_widget;
75 PrefThemeCategory(QWidget* parent, PrefTheme* owner);
77 public Q_SLOTS:
78 void reset();
79 void themeChanged();
80 void themeChecked(bool ck);
84 #endif //PREFERENCES__THEME_H