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