1 | /* |
2 | * KCMStyle |
3 | * Copyright (C) 2002 Karol Szwed <gallium@kde.org> |
4 | * Copyright (C) 2002 Daniel Molkentin <molkentin@kde.org> |
5 | * Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org> |
6 | * |
7 | * Portions Copyright (C) TrollTech AS. |
8 | * |
9 | * Based on kcmdisplay |
10 | * Copyright (C) 1997-2002 kcmdisplay Authors. |
11 | * (see Help -> About Style Settings) |
12 | * |
13 | * This program is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU General Public |
15 | * License version 2 as published by the Free Software Foundation. |
16 | * |
17 | * This program is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
20 | * General Public License for more details. |
21 | * |
22 | * You should have received a copy of the GNU General Public License |
23 | * along with this program; see the file COPYING. If not, write to |
24 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 | * Boston, MA 02110-1301, USA. |
26 | */ |
27 | |
28 | #ifndef KCMSTYLE_H |
29 | #define KCMSTYLE_H |
30 | |
31 | #include <QHash> |
32 | #include <QLayout> |
33 | #include <QMap> |
34 | |
35 | #include <kcmodule.h> |
36 | #include <kvbox.h> |
37 | |
38 | #include "ui_finetuning.h" |
39 | |
40 | class KComboBox; |
41 | class KConfig; |
42 | class QCheckBox; |
43 | class QComboBox; |
44 | class QLabel; |
45 | class QPushButton; |
46 | class StylePreview; |
47 | class QTabWidget; |
48 | |
49 | struct StyleEntry { |
50 | QString name; |
51 | QString desc; |
52 | QString configPage; |
53 | bool hidden; |
54 | }; |
55 | |
56 | class KCMStyle : public KCModule |
57 | { |
58 | Q_OBJECT |
59 | |
60 | public: |
61 | KCMStyle( QWidget* parent, const QVariantList& ); |
62 | ~KCMStyle(); |
63 | |
64 | virtual void load(); |
65 | virtual void save(); |
66 | virtual void defaults(); |
67 | |
68 | protected: |
69 | bool findStyle( const QString& str, int& combobox_item ); |
70 | void switchStyle(const QString& styleName, bool force = false); |
71 | void setStyleRecursive(QWidget* w, QStyle* s); |
72 | |
73 | void loadStyle( KConfig& config ); |
74 | void loadEffects( KConfig& config ); |
75 | void addWhatsThis(); |
76 | |
77 | virtual void changeEvent( QEvent *event ); |
78 | |
79 | protected Q_SLOTS: |
80 | void styleSpecificConfig(); |
81 | void updateConfigButton(); |
82 | |
83 | void setStyleDirty(); |
84 | void setEffectsDirty(); |
85 | |
86 | void styleChanged(); |
87 | |
88 | private: |
89 | QString currentStyle(); |
90 | static QString toolbarButtonText(int index); |
91 | static int toolbarButtonIndex(const QString &text); |
92 | static QString (int index); |
93 | static int (const QString &text); |
94 | |
95 | bool m_bStyleDirty, m_bEffectsDirty; |
96 | QHash <QString,StyleEntry*> styleEntries; |
97 | QMap <QString,QString> nameToStyleKey; |
98 | |
99 | QVBoxLayout* mainLayout; |
100 | QTabWidget* tabWidget; |
101 | QWidget *page0, *page1, *page2; |
102 | QVBoxLayout* page1Layout; |
103 | |
104 | // Page1 widgets |
105 | QVBoxLayout* gbWidgetStyleLayout; |
106 | QHBoxLayout* hbLayout; |
107 | KComboBox* cbStyle; |
108 | QPushButton* pbConfigStyle; |
109 | QLabel* lblStyleDesc; |
110 | StylePreview* stylePreview; |
111 | QStyle* appliedStyle; |
112 | QPalette palette; |
113 | |
114 | // Page2 widgets |
115 | Ui::FineTuning fineTuningUi; |
116 | }; |
117 | |
118 | #endif // __KCMSTYLE_H |
119 | |
120 | // vim: set noet ts=4: |
121 | |