author | drw <drw> | 2005-03-02 20:36:36 (UTC) |
---|---|---|
committer | drw <drw> | 2005-03-02 20:36:36 (UTC) |
commit | 05be6e2a303522d3ec59841c028f97d524d44317 (patch) (unidiff) | |
tree | d31b6f964e0684ae868e54d0f0500e8f88b163bd | |
parent | d6e85e8d0d5eee2c1f647b1ddfc49a1c8bfe3302 (diff) | |
download | opie-05be6e2a303522d3ec59841c028f97d524d44317.zip opie-05be6e2a303522d3ec59841c028f97d524d44317.tar.gz opie-05be6e2a303522d3ec59841c028f97d524d44317.tar.bz2 |
Scale icons approprtely
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index 82d8931..1aa91bb 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -1,708 +1,709 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | Copyright (c) 2002 Trolltech AS <info@trolltech.com> | 3 | Copyright (c) 2002 Trolltech AS <info@trolltech.com> |
4 | =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | =. Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 5 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "appearance.h" | 30 | #include "appearance.h" |
31 | #include "editScheme.h" | 31 | #include "editScheme.h" |
32 | #include "stylelistitem.h" | 32 | #include "stylelistitem.h" |
33 | #include "decolistitem.h" | 33 | #include "decolistitem.h" |
34 | #include "colorlistitem.h" | 34 | #include "colorlistitem.h" |
35 | #include "exceptlistitem.h" | 35 | #include "exceptlistitem.h" |
36 | #include "sample.h" | 36 | #include "sample.h" |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <opie2/odevice.h> | 39 | #include <opie2/odevice.h> |
40 | #include <opie2/ofiledialog.h> | 40 | #include <opie2/ofiledialog.h> |
41 | #include <opie2/otabwidget.h> | 41 | #include <opie2/otabwidget.h> |
42 | #include <opie2/odebug.h> | 42 | #include <opie2/odebug.h> |
43 | 43 | ||
44 | #include <qpe/config.h> | 44 | #include <qpe/config.h> |
45 | #include <qpe/global.h> | 45 | #include <qpe/global.h> |
46 | #include <qpe/qpeapplication.h> | 46 | #include <qpe/qpeapplication.h> |
47 | #include <qpe/qpemessagebox.h> | 47 | #include <qpe/qpemessagebox.h> |
48 | #include <qpe/qcopenvelope_qws.h> | 48 | #include <qpe/qcopenvelope_qws.h> |
49 | #include <qpe/qpestyle.h> | 49 | #include <qpe/qpestyle.h> |
50 | #include <qpe/lightstyle.h> | 50 | #include <qpe/lightstyle.h> |
51 | #include <qpe/styleinterface.h> | 51 | #include <qpe/styleinterface.h> |
52 | 52 | ||
53 | /* QT */ | 53 | /* QT */ |
54 | #include <qbuttongroup.h> | 54 | #include <qbuttongroup.h> |
55 | #include <qcheckbox.h> | 55 | #include <qcheckbox.h> |
56 | #include <qcombobox.h> | 56 | #include <qcombobox.h> |
57 | #include <qdialog.h> | 57 | #include <qdialog.h> |
58 | #include <qdir.h> | 58 | #include <qdir.h> |
59 | #include <qlabel.h> | 59 | #include <qlabel.h> |
60 | #include <qlayout.h> | 60 | #include <qlayout.h> |
61 | #include <qlineedit.h> | 61 | #include <qlineedit.h> |
62 | #include <qlistbox.h> | 62 | #include <qlistbox.h> |
63 | #include <qmessagebox.h> | 63 | #include <qmessagebox.h> |
64 | #include <qpushbutton.h> | 64 | #include <qpushbutton.h> |
65 | #include <qradiobutton.h> | 65 | #include <qradiobutton.h> |
66 | #if QT_VERSION >= 0x030000 | 66 | #if QT_VERSION >= 0x030000 |
67 | #include <qstylefactory.h> | 67 | #include <qstylefactory.h> |
68 | #endif | 68 | #endif |
69 | #include <qtoolbutton.h> | 69 | #include <qtoolbutton.h> |
70 | #include <qwindowsstyle.h> | 70 | #include <qwindowsstyle.h> |
71 | #include <qlistview.h> | 71 | #include <qlistview.h> |
72 | #include <qheader.h> | 72 | #include <qheader.h> |
73 | #include <qvbox.h> | 73 | #include <qvbox.h> |
74 | #include <qwhatsthis.h> | 74 | #include <qwhatsthis.h> |
75 | 75 | ||
76 | using namespace Opie; | 76 | using namespace Opie; |
77 | using namespace Opie::Ui; | 77 | using namespace Opie::Ui; |
78 | using namespace Opie::Core; | 78 | using namespace Opie::Core; |
79 | 79 | ||
80 | class DefaultWindowDecoration : public WindowDecorationInterface | 80 | class DefaultWindowDecoration : public WindowDecorationInterface |
81 | { | 81 | { |
82 | public: | 82 | public: |
83 | DefaultWindowDecoration() : ref(0) {} | 83 | DefaultWindowDecoration() : ref(0) {} |
84 | QString name() const | 84 | QString name() const |
85 | { | 85 | { |
86 | return "Default"; | 86 | return "Default"; |
87 | } | 87 | } |
88 | QPixmap icon() const | 88 | QPixmap icon() const |
89 | { | 89 | { |
90 | return QPixmap(); | 90 | return QPixmap(); |
91 | } | 91 | } |
92 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 92 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
93 | { | 93 | { |
94 | *iface = 0; | 94 | *iface = 0; |
95 | if ( uuid == IID_QUnknown ) | 95 | if ( uuid == IID_QUnknown ) |
96 | *iface = this; | 96 | *iface = this; |
97 | else if ( uuid == IID_WindowDecoration ) | 97 | else if ( uuid == IID_WindowDecoration ) |
98 | *iface = this; | 98 | *iface = this; |
99 | 99 | ||
100 | if ( *iface ) | 100 | if ( *iface ) |
101 | (*iface)->addRef(); | 101 | (*iface)->addRef(); |
102 | return QS_OK; | 102 | return QS_OK; |
103 | } | 103 | } |
104 | Q_REFCOUNT | 104 | Q_REFCOUNT |
105 | 105 | ||
106 | private: | 106 | private: |
107 | ulong ref; | 107 | ulong ref; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | ||
115 | 115 | ||
116 | QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | 116 | QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) |
117 | { | 117 | { |
118 | QWidget* tab = new QWidget( parent, "StyleTab" ); | 118 | QWidget* tab = new QWidget( parent, "StyleTab" ); |
119 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); | 119 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); |
120 | 120 | ||
121 | m_style_list = new QListBox( tab, "m_style_list" ); | 121 | m_style_list = new QListBox( tab, "m_style_list" ); |
122 | vertLayout->addWidget( m_style_list ); | 122 | vertLayout->addWidget( m_style_list ); |
123 | QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); | 123 | QWhatsThis::add( m_style_list, tr( "Styles control the way items such as buttons and scroll bars appear in all applications.\n\nClick here to select an available style." ) ); |
124 | 124 | ||
125 | m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); | 125 | m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); |
126 | connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); | 126 | connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); |
127 | vertLayout-> addWidget ( m_style_settings ); | 127 | vertLayout-> addWidget ( m_style_settings ); |
128 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); | 128 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); |
129 | 129 | ||
130 | QString s = cfg. readEntry ( "Style", "Light" ); | 130 | QString s = cfg. readEntry ( "Style", "Light" ); |
131 | 131 | ||
132 | 132 | ||
133 | #if QT_VERSION >= 0x030000 | 133 | #if QT_VERSION >= 0x030000 |
134 | m_style_list->insertStringList(QStyleFactory::styles()); | 134 | m_style_list->insertStringList(QStyleFactory::styles()); |
135 | #else | 135 | #else |
136 | m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); | 136 | m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); |
137 | m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); | 137 | m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); |
138 | m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); | 138 | m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | { | 141 | { |
142 | QString path = QPEApplication::qpeDir ( ); | 142 | QString path = QPEApplication::qpeDir ( ); |
143 | path.append( "/plugins/styles/" ); | 143 | path.append( "/plugins/styles/" ); |
144 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 144 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
145 | 145 | ||
146 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 146 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
147 | { | 147 | { |
148 | QString libstr = path; | 148 | QString libstr = path; |
149 | libstr.append( "/" ); | 149 | libstr.append( "/" ); |
150 | libstr.append( *it ); | 150 | libstr.append( *it ); |
151 | QLibrary *lib = new QLibrary ( libstr ); | 151 | QLibrary *lib = new QLibrary ( libstr ); |
152 | StyleInterface *iface; | 152 | StyleInterface *iface; |
153 | 153 | ||
154 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) | 154 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) |
155 | { | 155 | { |
156 | StyleListItem *slit = new StyleListItem ( lib, iface ); | 156 | StyleListItem *slit = new StyleListItem ( lib, iface ); |
157 | m_style_list-> insertItem ( slit ); | 157 | m_style_list-> insertItem ( slit ); |
158 | 158 | ||
159 | if ( slit-> key ( ) == s ) | 159 | if ( slit-> key ( ) == s ) |
160 | m_style_list-> setCurrentItem ( slit ); | 160 | m_style_list-> setCurrentItem ( slit ); |
161 | } | 161 | } |
162 | else | 162 | else |
163 | delete lib; | 163 | delete lib; |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | m_original_style = m_style_list-> currentItem ( ); | 167 | m_original_style = m_style_list-> currentItem ( ); |
168 | styleClicked ( m_original_style ); | 168 | styleClicked ( m_original_style ); |
169 | 169 | ||
170 | connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); | 170 | connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); |
171 | 171 | ||
172 | return tab; | 172 | return tab; |
173 | } | 173 | } |
174 | 174 | ||
175 | QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | 175 | QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) |
176 | { | 176 | { |
177 | QWidget* tab = new QWidget( parent, "DecoTab" ); | 177 | QWidget* tab = new QWidget( parent, "DecoTab" ); |
178 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); | 178 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); |
179 | 179 | ||
180 | m_deco_list = new QListBox( tab, "m_deco_list" ); | 180 | m_deco_list = new QListBox( tab, "m_deco_list" ); |
181 | vertLayout->addWidget( m_deco_list ); | 181 | vertLayout->addWidget( m_deco_list ); |
182 | QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); | 182 | QWhatsThis::add( m_deco_list, tr( "Window decorations control the way the application title bar and its buttons appear.\n\nClick here to select an available decoration." ) ); |
183 | 183 | ||
184 | QString s = cfg. readEntry ( "Decoration", "libflat.so" ); | 184 | QString s = cfg. readEntry ( "Decoration", "libflat.so" ); |
185 | 185 | ||
186 | m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); | 186 | m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); |
187 | 187 | ||
188 | { | 188 | { |
189 | QString path = QPEApplication::qpeDir(); | 189 | QString path = QPEApplication::qpeDir(); |
190 | path.append( "/plugins/decorations/" ); | 190 | path.append( "/plugins/decorations/" ); |
191 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 191 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
192 | 192 | ||
193 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 193 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
194 | { | 194 | { |
195 | QString libstr = path; | 195 | QString libstr = path; |
196 | libstr.append( "/" ); | 196 | libstr.append( "/" ); |
197 | libstr.append( *it ); | 197 | libstr.append( *it ); |
198 | QLibrary *lib = new QLibrary ( libstr ); | 198 | QLibrary *lib = new QLibrary ( libstr ); |
199 | WindowDecorationInterface *iface; | 199 | WindowDecorationInterface *iface; |
200 | 200 | ||
201 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) | 201 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) |
202 | { | 202 | { |
203 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | 203 | DecoListItem *dlit = new DecoListItem ( lib, iface ); |
204 | m_deco_list-> insertItem ( dlit ); | 204 | m_deco_list-> insertItem ( dlit ); |
205 | 205 | ||
206 | if ( dlit-> key ( ) == s ) | 206 | if ( dlit-> key ( ) == s ) |
207 | m_deco_list-> setCurrentItem ( dlit ); | 207 | m_deco_list-> setCurrentItem ( dlit ); |
208 | } | 208 | } |
209 | else | 209 | else |
210 | delete lib; | 210 | delete lib; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | m_original_deco = m_deco_list-> currentItem ( ); | 214 | m_original_deco = m_deco_list-> currentItem ( ); |
215 | if ( m_deco_list-> currentItem ( ) < 0 ) | 215 | if ( m_deco_list-> currentItem ( ) < 0 ) |
216 | m_deco_list-> setCurrentItem ( 0 ); | 216 | m_deco_list-> setCurrentItem ( 0 ); |
217 | decoClicked ( m_original_deco ); | 217 | decoClicked ( m_original_deco ); |
218 | 218 | ||
219 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); | 219 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); |
220 | 220 | ||
221 | return tab; | 221 | return tab; |
222 | } | 222 | } |
223 | 223 | ||
224 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) | 224 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) |
225 | { | 225 | { |
226 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); | 226 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); |
227 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); | 227 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); |
228 | int size = cfg. readNumEntry ( "FontSize", 10 ); | 228 | int size = cfg. readNumEntry ( "FontSize", 10 ); |
229 | 229 | ||
230 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); | 230 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); |
231 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); | 231 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
232 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); | 232 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); |
233 | 233 | ||
234 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 234 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
235 | this, SLOT( fontClicked(const QFont&))); | 235 | this, SLOT( fontClicked(const QFont&))); |
236 | 236 | ||
237 | return m_fontselect; | 237 | return m_fontselect; |
238 | } | 238 | } |
239 | 239 | ||
240 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | 240 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) |
241 | { | 241 | { |
242 | QWidget *tab = new QWidget( parent, "ColorTab" ); | 242 | QWidget *tab = new QWidget( parent, "ColorTab" ); |
243 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); | 243 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); |
244 | gridLayout->setRowStretch ( 3, 10 ); | 244 | gridLayout->setRowStretch ( 3, 10 ); |
245 | 245 | ||
246 | m_color_list = new QListBox ( tab ); | 246 | m_color_list = new QListBox ( tab ); |
247 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); | 247 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); |
248 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); | 248 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); |
249 | QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); | 249 | QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); |
250 | 250 | ||
251 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); | 251 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); |
252 | 252 | ||
253 | QString path = QPEApplication::qpeDir ( ); | 253 | QString path = QPEApplication::qpeDir ( ); |
254 | path.append( "/etc/colors/" ); | 254 | path.append( "/etc/colors/" ); |
255 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 255 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
256 | 256 | ||
257 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 257 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
258 | { | 258 | { |
259 | QString name = (*it). left ((*it). find ( ".scheme" )); | 259 | QString name = (*it). left ((*it). find ( ".scheme" )); |
260 | QString pathstr = path; | 260 | QString pathstr = path; |
261 | pathstr.append( *it ); | 261 | pathstr.append( *it ); |
262 | Config config ( pathstr, Config::File ); | 262 | Config config ( pathstr, Config::File ); |
263 | config. setGroup ( "Colors" ); | 263 | config. setGroup ( "Colors" ); |
264 | 264 | ||
265 | m_color_list-> insertItem ( new ColorListItem ( name, config )); | 265 | m_color_list-> insertItem ( new ColorListItem ( name, config )); |
266 | } | 266 | } |
267 | 267 | ||
268 | m_color_list-> setCurrentItem ( 0 ); | 268 | m_color_list-> setCurrentItem ( 0 ); |
269 | 269 | ||
270 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); | 270 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); |
271 | tempButton->setText( tr( "Edit..." ) ); | 271 | tempButton->setText( tr( "Edit..." ) ); |
272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
273 | gridLayout->addWidget( tempButton, 0, 1 ); | 273 | gridLayout->addWidget( tempButton, 0, 1 ); |
274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
275 | 275 | ||
276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
277 | tempButton->setText( tr( "Delete" ) ); | 277 | tempButton->setText( tr( "Delete" ) ); |
278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
279 | gridLayout->addWidget( tempButton, 1, 1 ); | 279 | gridLayout->addWidget( tempButton, 1, 1 ); |
280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
281 | 281 | ||
282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
283 | tempButton->setText( tr( "Save" ) ); | 283 | tempButton->setText( tr( "Save" ) ); |
284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
285 | gridLayout->addWidget( tempButton, 2, 1 ); | 285 | gridLayout->addWidget( tempButton, 2, 1 ); |
286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
287 | 287 | ||
288 | return tab; | 288 | return tab; |
289 | } | 289 | } |
290 | 290 | ||
291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
292 | { | 292 | { |
293 | QWidget *tab = new QWidget ( parent ); | 293 | QWidget *tab = new QWidget ( parent ); |
294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
295 | 295 | ||
296 | /* | 296 | /* |
297 | * show scrollbars on the left? | 297 | * show scrollbars on the left? |
298 | */ | 298 | */ |
299 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); | 299 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); |
300 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); | 300 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); |
301 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); | 301 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); |
302 | vertLayout->addWidget( m_leftHand ); | 302 | vertLayout->addWidget( m_leftHand ); |
303 | 303 | ||
304 | QFrame *f = new QFrame ( tab ); | 304 | QFrame *f = new QFrame ( tab ); |
305 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 305 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
306 | vertLayout-> addWidget ( f ); | 306 | vertLayout-> addWidget ( f ); |
307 | vertLayout-> addSpacing ( 3 ); | 307 | vertLayout-> addSpacing ( 3 ); |
308 | 308 | ||
309 | 309 | ||
310 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 310 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
311 | 311 | ||
312 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 312 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
313 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 313 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
314 | 314 | ||
315 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 315 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
316 | gridLayout-> addWidget ( label, 0, 0 ); | 316 | gridLayout-> addWidget ( label, 0, 0 ); |
317 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 317 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
318 | 318 | ||
319 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 319 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
320 | btngrp-> hide ( ); | 320 | btngrp-> hide ( ); |
321 | btngrp-> setExclusive ( true ); | 321 | btngrp-> setExclusive ( true ); |
322 | 322 | ||
323 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 323 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
324 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 324 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
325 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 325 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
326 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 326 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
327 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 327 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
328 | m_tabstyle_list-> setCurrentItem ( style ); | 328 | m_tabstyle_list-> setCurrentItem ( style ); |
329 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 329 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
330 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 330 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
331 | 331 | ||
332 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 332 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
333 | btngrp-> insert ( m_tabstyle_top ); | 333 | btngrp-> insert ( m_tabstyle_top ); |
334 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 334 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
335 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 335 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
336 | 336 | ||
337 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 337 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
338 | btngrp-> insert ( m_tabstyle_bottom ); | 338 | btngrp-> insert ( m_tabstyle_bottom ); |
339 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 339 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
340 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 340 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
341 | 341 | ||
342 | m_tabstyle_top-> setChecked ( tabtop ); | 342 | m_tabstyle_top-> setChecked ( tabtop ); |
343 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 343 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
344 | 344 | ||
345 | m_original_tabstyle = style; | 345 | m_original_tabstyle = style; |
346 | m_original_tabpos = tabtop; | 346 | m_original_tabpos = tabtop; |
347 | 347 | ||
348 | vertLayout-> addSpacing ( 3 ); | 348 | vertLayout-> addSpacing ( 3 ); |
349 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 349 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
350 | 350 | ||
351 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 351 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
352 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 352 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
353 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); | ||
354 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 353 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
355 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); | ||
356 | QPixmap ccw1; | ||
357 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 354 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
358 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); | ||
359 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 355 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
360 | 356 | ||
361 | rotbtngrp-> hide ( ); | 357 | rotbtngrp-> hide ( ); |
362 | rotbtngrp-> setExclusive ( true ); | 358 | rotbtngrp-> setExclusive ( true ); |
363 | rotbtngrp-> insert ( m_rotdir_cw ); | 359 | rotbtngrp-> insert ( m_rotdir_cw ); |
364 | rotbtngrp-> insert ( m_rotdir_ccw ); | 360 | rotbtngrp-> insert ( m_rotdir_ccw ); |
365 | rotbtngrp-> insert ( m_rotdir_flip ); | 361 | rotbtngrp-> insert ( m_rotdir_flip ); |
366 | 362 | ||
367 | ccw1. convertFromImage( ccwImage ); | 363 | QImage ccwImage = Resource::loadImage( "redo" ); |
368 | m_rotdir_cw-> setPixmap( cw1 ); | 364 | QPixmap cw, ccw, flip; |
369 | m_rotdir_ccw-> setPixmap( ccw1 ); | 365 | cw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); |
370 | m_rotdir_flip-> setPixmap( flip1 ); | 366 | ccw.convertFromImage( ccwImage.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ).mirror( 1, 0 ) ); |
367 | flip.convertFromImage( Resource::loadImage( "pass" ).smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ) ); | ||
368 | |||
369 | m_rotdir_cw-> setPixmap( cw ); | ||
370 | m_rotdir_ccw-> setPixmap( ccw ); | ||
371 | m_rotdir_flip-> setPixmap( flip ); | ||
371 | 372 | ||
372 | rotLay-> addWidget ( rotlabel, 0 ); | 373 | rotLay-> addWidget ( rotlabel, 0 ); |
373 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 374 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
374 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 375 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
375 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 376 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
376 | 377 | ||
377 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 378 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
378 | ODirection rot = CW; | 379 | ODirection rot = CW; |
379 | 380 | ||
380 | if (rotDirection == -1) | 381 | if (rotDirection == -1) |
381 | { | 382 | { |
382 | rot = ODevice::inst ( )-> direction ( ); | 383 | rot = ODevice::inst ( )-> direction ( ); |
383 | } | 384 | } |
384 | else | 385 | else |
385 | { | 386 | { |
386 | rot = (ODirection)rotDirection; | 387 | rot = (ODirection)rotDirection; |
387 | } | 388 | } |
388 | 389 | ||
389 | m_rotdir_cw-> setChecked ( rot == CW ); | 390 | m_rotdir_cw-> setChecked ( rot == CW ); |
390 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 391 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
391 | m_rotdir_flip-> setChecked ( rot == Flip ); | 392 | m_rotdir_flip-> setChecked ( rot == Flip ); |
392 | 393 | ||
393 | 394 | ||
394 | /* | 395 | /* |
395 | * add a spacing | 396 | * add a spacing |
396 | */ | 397 | */ |
397 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 398 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
398 | return tab; | 399 | return tab; |
399 | } | 400 | } |
400 | 401 | ||
401 | 402 | ||
402 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 403 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
403 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 404 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
404 | { | 405 | { |
405 | setCaption( tr( "Appearance Settings" ) ); | 406 | setCaption( tr( "Appearance Settings" ) ); |
406 | 407 | ||
407 | Config config( "qpe" ); | 408 | Config config( "qpe" ); |
408 | config.setGroup( "Appearance" ); | 409 | config.setGroup( "Appearance" ); |
409 | 410 | ||
410 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 411 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
411 | 412 | ||
412 | m_sample = new SampleWindow ( this ); | 413 | m_sample = new SampleWindow ( this ); |
413 | 414 | ||
414 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 415 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
415 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 416 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
416 | 417 | ||
417 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 418 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
418 | QWidget *styletab; | 419 | QWidget *styletab; |
419 | 420 | ||
420 | m_color_list = 0; | 421 | m_color_list = 0; |
421 | 422 | ||
422 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 423 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
423 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 424 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
424 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 425 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
425 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 426 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
426 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 427 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
427 | 428 | ||
428 | top-> addWidget ( tw, 10 ); | 429 | top-> addWidget ( tw, 10 ); |
429 | top-> addWidget ( m_sample, 1 ); | 430 | top-> addWidget ( m_sample, 1 ); |
430 | 431 | ||
431 | tw-> setCurrentTab ( styletab ); | 432 | tw-> setCurrentTab ( styletab ); |
432 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); | 433 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); |
433 | 434 | ||
434 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 435 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
435 | } | 436 | } |
436 | 437 | ||
437 | Appearance::~Appearance() | 438 | Appearance::~Appearance() |
438 | {} | 439 | {} |
439 | 440 | ||
440 | void Appearance::tabChanged ( QWidget *w ) | 441 | void Appearance::tabChanged ( QWidget *w ) |
441 | { | 442 | { |
442 | if ( w == m_advtab ) | 443 | if ( w == m_advtab ) |
443 | { | 444 | { |
444 | m_sample-> hide ( ); | 445 | m_sample-> hide ( ); |
445 | updateGeometry ( ); // shouldn't be necessary ... | 446 | updateGeometry ( ); // shouldn't be necessary ... |
446 | } | 447 | } |
447 | else | 448 | else |
448 | m_sample-> show ( ); | 449 | m_sample-> show ( ); |
449 | } | 450 | } |
450 | 451 | ||
451 | void Appearance::accept ( ) | 452 | void Appearance::accept ( ) |
452 | { | 453 | { |
453 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 454 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
454 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 455 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
455 | 456 | ||
456 | Config config ( "qpe" ); | 457 | Config config ( "qpe" ); |
457 | config. setGroup ( "Appearance" ); | 458 | config. setGroup ( "Appearance" ); |
458 | 459 | ||
459 | if ( m_style_changed ) | 460 | if ( m_style_changed ) |
460 | { | 461 | { |
461 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 462 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
462 | if ( item ) | 463 | if ( item ) |
463 | config.writeEntry( "Style", item-> key ( )); | 464 | config.writeEntry( "Style", item-> key ( )); |
464 | } | 465 | } |
465 | 466 | ||
466 | if ( m_deco_changed ) | 467 | if ( m_deco_changed ) |
467 | { | 468 | { |
468 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 469 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
469 | if ( item ) | 470 | if ( item ) |
470 | config.writeEntry( "Decoration", item-> key ( )); | 471 | config.writeEntry( "Decoration", item-> key ( )); |
471 | } | 472 | } |
472 | 473 | ||
473 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) | 474 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
474 | { | 475 | { |
475 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 476 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
476 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 477 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
477 | } | 478 | } |
478 | 479 | ||
479 | if ( m_font_changed ) | 480 | if ( m_font_changed ) |
480 | { | 481 | { |
481 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 482 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
482 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 483 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
483 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 484 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
484 | } | 485 | } |
485 | 486 | ||
486 | 487 | ||
487 | if ( m_color_changed ) | 488 | if ( m_color_changed ) |
488 | { | 489 | { |
489 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 490 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
490 | 491 | ||
491 | if ( item ) | 492 | if ( item ) |
492 | item-> save ( config ); | 493 | item-> save ( config ); |
493 | } | 494 | } |
494 | 495 | ||
495 | ODirection rot; | 496 | ODirection rot; |
496 | if (m_rotdir_ccw-> isChecked ( )) | 497 | if (m_rotdir_ccw-> isChecked ( )) |
497 | { | 498 | { |
498 | rot = CCW; | 499 | rot = CCW; |
499 | } | 500 | } |
500 | else if (m_rotdir_cw-> isChecked ( )) | 501 | else if (m_rotdir_cw-> isChecked ( )) |
501 | { | 502 | { |
502 | rot = CW; | 503 | rot = CW; |
503 | } | 504 | } |
504 | else | 505 | else |
505 | { | 506 | { |
506 | rot = Flip; | 507 | rot = Flip; |
507 | } | 508 | } |
508 | config. writeEntry ( "rotatedir", (int)rot ); | 509 | config. writeEntry ( "rotatedir", (int)rot ); |
509 | 510 | ||
510 | config. writeEntry( "LeftHand", m_leftHand->isChecked() ); | 511 | config. writeEntry( "LeftHand", m_leftHand->isChecked() ); |
511 | 512 | ||
512 | config. write ( ); // need to flush the config info first | 513 | config. write ( ); // need to flush the config info first |
513 | Global::applyStyle ( ); | 514 | Global::applyStyle ( ); |
514 | 515 | ||
515 | QDialog::accept ( ); | 516 | QDialog::accept ( ); |
516 | } | 517 | } |
517 | 518 | ||
518 | void Appearance::done ( int r ) | 519 | void Appearance::done ( int r ) |
519 | { | 520 | { |
520 | QDialog::done ( r ); | 521 | QDialog::done ( r ); |
521 | close ( ); | 522 | close ( ); |
522 | } | 523 | } |
523 | 524 | ||
524 | 525 | ||
525 | void Appearance::styleClicked ( int index ) | 526 | void Appearance::styleClicked ( int index ) |
526 | { | 527 | { |
527 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 528 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
528 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 529 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
529 | 530 | ||
530 | if ( m_sample && sli && sli-> style ( )) | 531 | if ( m_sample && sli && sli-> style ( )) |
531 | { | 532 | { |
532 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 533 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
533 | 534 | ||
534 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 535 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
535 | } | 536 | } |
536 | 537 | ||
537 | m_style_changed |= ( index != m_original_style ); | 538 | m_style_changed |= ( index != m_original_style ); |
538 | } | 539 | } |
539 | 540 | ||
540 | void Appearance::styleSettingsClicked ( ) | 541 | void Appearance::styleSettingsClicked ( ) |
541 | { | 542 | { |
542 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 543 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
543 | 544 | ||
544 | if ( item && item-> hasSettings ( )) | 545 | if ( item && item-> hasSettings ( )) |
545 | { | 546 | { |
546 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 547 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
547 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 548 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
548 | 549 | ||
549 | QWidget *w = item-> settings ( d ); | 550 | QWidget *w = item-> settings ( d ); |
550 | 551 | ||
551 | if ( w ) | 552 | if ( w ) |
552 | { | 553 | { |
553 | vbox-> addWidget ( w ); | 554 | vbox-> addWidget ( w ); |
554 | 555 | ||
555 | d-> setCaption ( w-> caption ( )); | 556 | d-> setCaption ( w-> caption ( )); |
556 | 557 | ||
557 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); | 558 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
558 | 559 | ||
559 | if ( item-> setSettings ( accepted )) | 560 | if ( item-> setSettings ( accepted )) |
560 | m_style_changed = true; | 561 | m_style_changed = true; |
561 | } | 562 | } |
562 | delete d; | 563 | delete d; |
563 | } | 564 | } |
564 | } | 565 | } |
565 | 566 | ||
566 | void Appearance::decoClicked ( int index ) | 567 | void Appearance::decoClicked ( int index ) |
567 | { | 568 | { |
568 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 569 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
569 | 570 | ||
570 | if ( m_sample ) | 571 | if ( m_sample ) |
571 | { | 572 | { |
572 | if ( dli && dli-> interface ( )) | 573 | if ( dli && dli-> interface ( )) |
573 | m_sample-> setDecoration ( dli-> interface ( )); | 574 | m_sample-> setDecoration ( dli-> interface ( )); |
574 | else | 575 | else |
575 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 576 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
576 | m_sample-> repaint ( ); | 577 | m_sample-> repaint ( ); |
577 | } | 578 | } |
578 | m_deco_changed |= ( index != m_original_deco ); | 579 | m_deco_changed |= ( index != m_original_deco ); |
579 | } | 580 | } |
580 | 581 | ||
581 | void Appearance::fontClicked ( const QFont &f ) | 582 | void Appearance::fontClicked ( const QFont &f ) |
582 | { | 583 | { |
583 | m_font_changed |= ( f != m_sample-> font ( )); | 584 | m_font_changed |= ( f != m_sample-> font ( )); |
584 | m_sample-> setFont ( f ); | 585 | m_sample-> setFont ( f ); |
585 | } | 586 | } |
586 | 587 | ||
587 | void Appearance::colorClicked ( int index ) | 588 | void Appearance::colorClicked ( int index ) |
588 | { | 589 | { |
589 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 590 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
590 | 591 | ||
591 | if ( item ) | 592 | if ( item ) |
592 | m_sample-> setPalette ( item-> palette ( )); | 593 | m_sample-> setPalette ( item-> palette ( )); |
593 | 594 | ||
594 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 595 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
595 | } | 596 | } |
596 | 597 | ||
597 | 598 | ||
598 | void Appearance::editSchemeClicked ( ) | 599 | void Appearance::editSchemeClicked ( ) |
599 | { | 600 | { |
600 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 601 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
601 | 602 | ||
602 | int cnt = 0; | 603 | int cnt = 0; |
603 | QString labels [QColorGroup::NColorRoles]; | 604 | QString labels [QColorGroup::NColorRoles]; |
604 | QColor colors [QColorGroup::NColorRoles]; | 605 | QColor colors [QColorGroup::NColorRoles]; |
605 | 606 | ||
606 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) | 607 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
607 | { | 608 | { |
608 | QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); | 609 | QColor col = item->color( static_cast<QColorGroup::ColorRole>( role ) ); |
609 | 610 | ||
610 | if ( col. isValid ( )) | 611 | if ( col. isValid ( )) |
611 | { | 612 | { |
612 | labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); | 613 | labels[cnt] = item->label( static_cast<QColorGroup::ColorRole>( role ) ); |
613 | colors[cnt] = col; | 614 | colors[cnt] = col; |
614 | 615 | ||
615 | cnt++; | 616 | cnt++; |
616 | } | 617 | } |
617 | } | 618 | } |
618 | 619 | ||
619 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); | 620 | EditScheme* editdlg = new EditScheme( cnt, labels, colors, this, "editScheme", true ); |
620 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) | 621 | if ( QPEApplication::execDialog( editdlg ) == QDialog::Accepted ) |
621 | { | 622 | { |
622 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); | 623 | ColorListItem *citem = (ColorListItem *) m_color_list-> item ( 0 ); |
623 | cnt = 0; | 624 | cnt = 0; |
624 | 625 | ||
625 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) | 626 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
626 | { | 627 | { |
627 | if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) | 628 | if ( item->color( static_cast<QColorGroup::ColorRole>( role ) ).isValid() ) |
628 | { | 629 | { |
629 | citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); | 630 | citem->setColor( static_cast<QColorGroup::ColorRole>( role ), colors[cnt] ); |
630 | cnt++; | 631 | cnt++; |
631 | } | 632 | } |
632 | } | 633 | } |
633 | 634 | ||
634 | m_color_list-> setCurrentItem ( 0 ); | 635 | m_color_list-> setCurrentItem ( 0 ); |
635 | colorClicked ( 0 ); | 636 | colorClicked ( 0 ); |
636 | 637 | ||
637 | m_color_changed = true; | 638 | m_color_changed = true; |
638 | } | 639 | } |
639 | delete editdlg; | 640 | delete editdlg; |
640 | } | 641 | } |
641 | 642 | ||
642 | 643 | ||
643 | void Appearance::saveSchemeClicked() | 644 | void Appearance::saveSchemeClicked() |
644 | { | 645 | { |
645 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 646 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
646 | 647 | ||
647 | if ( !item ) | 648 | if ( !item ) |
648 | return; | 649 | return; |
649 | 650 | ||
650 | QDialog *d = new QDialog ( this, 0, true ); | 651 | QDialog *d = new QDialog ( this, 0, true ); |
651 | d-> setCaption ( tr( "Save Scheme" )); | 652 | d-> setCaption ( tr( "Save Scheme" )); |
652 | QLineEdit *ed = new QLineEdit ( d ); | 653 | QLineEdit *ed = new QLineEdit ( d ); |
653 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); | 654 | ( new QVBoxLayout ( d, 3, 3 ))-> addWidget ( ed ); |
654 | ed-> setFocus ( ); | 655 | ed-> setFocus ( ); |
655 | 656 | ||
656 | if ( d-> exec ( ) == QDialog::Accepted ) | 657 | if ( d-> exec ( ) == QDialog::Accepted ) |
657 | { | 658 | { |
658 | QString schemename = ed-> text ( ); | 659 | QString schemename = ed-> text ( ); |
659 | QString filestr = QPEApplication::qpeDir(); | 660 | QString filestr = QPEApplication::qpeDir(); |
660 | filestr.append( "/etc/colors/" ); | 661 | filestr.append( "/etc/colors/" ); |
661 | filestr.append( schemename ); | 662 | filestr.append( schemename ); |
662 | filestr.append( ".scheme" ); | 663 | filestr.append( ".scheme" ); |
663 | QFile file ( filestr ); | 664 | QFile file ( filestr ); |
664 | if ( !file. exists ( )) | 665 | if ( !file. exists ( )) |
665 | { | 666 | { |
666 | QPalette p = item-> palette ( ); | 667 | QPalette p = item-> palette ( ); |
667 | 668 | ||
668 | Config config ( file.name(), Config::File ); | 669 | Config config ( file.name(), Config::File ); |
669 | config. setGroup( "Colors" ); | 670 | config. setGroup( "Colors" ); |
670 | 671 | ||
671 | item-> save ( config ); | 672 | item-> save ( config ); |
672 | 673 | ||
673 | config. write ( ); // need to flush the config info first | 674 | config. write ( ); // need to flush the config info first |
674 | 675 | ||
675 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); | 676 | m_color_list-> insertItem ( new ColorListItem ( schemename, config )); |
676 | } | 677 | } |
677 | else | 678 | else |
678 | { | 679 | { |
679 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); | 680 | QMessageBox::information ( this, tr( "Save scheme" ), tr( "Scheme does already exist." )); |
680 | } | 681 | } |
681 | } | 682 | } |
682 | delete d; | 683 | delete d; |
683 | } | 684 | } |
684 | 685 | ||
685 | void Appearance::deleteSchemeClicked() | 686 | void Appearance::deleteSchemeClicked() |
686 | { | 687 | { |
687 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 688 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
688 | 689 | ||
689 | if ( !item ) | 690 | if ( !item ) |
690 | return; | 691 | return; |
691 | 692 | ||
692 | if ( m_color_list-> currentItem ( ) > 0 ) | 693 | if ( m_color_list-> currentItem ( ) > 0 ) |
693 | { | 694 | { |
694 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) | 695 | if ( QPEMessageBox::confirmDelete ( this, tr( "Delete scheme" ), item-> text ( ) ) ) |
695 | { | 696 | { |
696 | QString filestr = QPEApplication::qpeDir ( ); | 697 | QString filestr = QPEApplication::qpeDir ( ); |
697 | filestr.append( "/etc/colors/" ); | 698 | filestr.append( "/etc/colors/" ); |
698 | filestr.append( item-> text ( ) ); | 699 | filestr.append( item-> text ( ) ); |
699 | filestr.append( ".scheme" ); | 700 | filestr.append( ".scheme" ); |
700 | QFile::remove ( filestr ); | 701 | QFile::remove ( filestr ); |
701 | delete item; | 702 | delete item; |
702 | } | 703 | } |
703 | } | 704 | } |
704 | else | 705 | else |
705 | { | 706 | { |
706 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); | 707 | QMessageBox::information( this, tr( "Delete scheme" ), tr( "Unable to delete current scheme." )); |
707 | } | 708 | } |
708 | } | 709 | } |