Diffstat (limited to 'noncore/settings/appearance2/appearance.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index b39203b..8ae87fe 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -28,559 +28,559 @@ | |||
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 | 42 | ||
43 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
44 | #include <qpe/global.h> | 44 | #include <qpe/global.h> |
45 | #include <qpe/qpeapplication.h> | 45 | #include <qpe/qpeapplication.h> |
46 | #include <qpe/qpemessagebox.h> | 46 | #include <qpe/qpemessagebox.h> |
47 | #include <qpe/qcopenvelope_qws.h> | 47 | #include <qpe/qcopenvelope_qws.h> |
48 | #include <qpe/qpestyle.h> | 48 | #include <qpe/qpestyle.h> |
49 | #include <qpe/lightstyle.h> | 49 | #include <qpe/lightstyle.h> |
50 | #include <qpe/styleinterface.h> | 50 | #include <qpe/styleinterface.h> |
51 | 51 | ||
52 | /* QT */ | 52 | /* QT */ |
53 | #include <qbuttongroup.h> | 53 | #include <qbuttongroup.h> |
54 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
55 | #include <qcombobox.h> | 55 | #include <qcombobox.h> |
56 | #include <qdialog.h> | 56 | #include <qdialog.h> |
57 | #include <qdir.h> | 57 | #include <qdir.h> |
58 | #include <qlabel.h> | 58 | #include <qlabel.h> |
59 | #include <qlayout.h> | 59 | #include <qlayout.h> |
60 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
61 | #include <qlistbox.h> | 61 | #include <qlistbox.h> |
62 | #include <qmessagebox.h> | 62 | #include <qmessagebox.h> |
63 | #include <qpushbutton.h> | 63 | #include <qpushbutton.h> |
64 | #include <qradiobutton.h> | 64 | #include <qradiobutton.h> |
65 | #if QT_VERSION >= 300 | 65 | #if QT_VERSION >= 300 |
66 | #include <qstylefactory.h> | 66 | #include <qstylefactory.h> |
67 | #endif | 67 | #endif |
68 | #include <qtoolbutton.h> | 68 | #include <qtoolbutton.h> |
69 | #include <qwindowsstyle.h> | 69 | #include <qwindowsstyle.h> |
70 | #include <qlistview.h> | 70 | #include <qlistview.h> |
71 | #include <qheader.h> | 71 | #include <qheader.h> |
72 | #include <qvbox.h> | 72 | #include <qvbox.h> |
73 | #include <qwhatsthis.h> | 73 | #include <qwhatsthis.h> |
74 | 74 | ||
75 | using namespace Opie; | 75 | using namespace Opie; |
76 | 76 | ||
77 | 77 | ||
78 | class DefaultWindowDecoration : public WindowDecorationInterface | 78 | class DefaultWindowDecoration : public WindowDecorationInterface |
79 | { | 79 | { |
80 | public: | 80 | public: |
81 | DefaultWindowDecoration() : ref(0) {} | 81 | DefaultWindowDecoration() : ref(0) {} |
82 | QString name() const | 82 | QString name() const |
83 | { | 83 | { |
84 | return "Default"; | 84 | return "Default"; |
85 | } | 85 | } |
86 | QPixmap icon() const | 86 | QPixmap icon() const |
87 | { | 87 | { |
88 | return QPixmap(); | 88 | return QPixmap(); |
89 | } | 89 | } |
90 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 90 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
91 | { | 91 | { |
92 | *iface = 0; | 92 | *iface = 0; |
93 | if ( uuid == IID_QUnknown ) | 93 | if ( uuid == IID_QUnknown ) |
94 | *iface = this; | 94 | *iface = this; |
95 | else if ( uuid == IID_WindowDecoration ) | 95 | else if ( uuid == IID_WindowDecoration ) |
96 | *iface = this; | 96 | *iface = this; |
97 | 97 | ||
98 | if ( *iface ) | 98 | if ( *iface ) |
99 | (*iface)->addRef(); | 99 | (*iface)->addRef(); |
100 | return QS_OK; | 100 | return QS_OK; |
101 | } | 101 | } |
102 | Q_REFCOUNT | 102 | Q_REFCOUNT |
103 | 103 | ||
104 | private: | 104 | private: |
105 | ulong ref; | 105 | ulong ref; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) | 114 | QWidget *Appearance::createStyleTab ( QWidget *parent, Config &cfg ) |
115 | { | 115 | { |
116 | QWidget* tab = new QWidget( parent, "StyleTab" ); | 116 | QWidget* tab = new QWidget( parent, "StyleTab" ); |
117 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); | 117 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); |
118 | 118 | ||
119 | m_style_list = new QListBox( tab, "m_style_list" ); | 119 | m_style_list = new QListBox( tab, "m_style_list" ); |
120 | vertLayout->addWidget( m_style_list ); | 120 | vertLayout->addWidget( m_style_list ); |
121 | 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." ) ); | 121 | 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." ) ); |
122 | 122 | ||
123 | m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); | 123 | m_style_settings = new QPushButton ( tr( "Settings..." ), tab ); |
124 | connect ( m_style_settings, SIGNAL( clicked ( )), this, SLOT( styleSettingsClicked ( ))); | 124 | connect ( m_style_settings, SIGNAL( clicked()), this, SLOT( styleSettingsClicked())); |
125 | vertLayout-> addWidget ( m_style_settings ); | 125 | vertLayout-> addWidget ( m_style_settings ); |
126 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); | 126 | QWhatsThis::add( m_style_settings, tr( "Click here to configure the currently selected style.\n\nNote: This option is not available for all styles." ) ); |
127 | 127 | ||
128 | QString s = cfg. readEntry ( "Style", "Light" ); | 128 | QString s = cfg. readEntry ( "Style", "Light" ); |
129 | 129 | ||
130 | 130 | ||
131 | #if QT_VERSION >= 300 | 131 | #if QT_VERSION >= 300 |
132 | m_style_list->insertStringList(QStyleFactory::styles()); | 132 | m_style_list->insertStringList(QStyleFactory::styles()); |
133 | #else | 133 | #else |
134 | m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); | 134 | m_style_list-> insertItem ( new StyleListItem ( "Windows", new QWindowsStyle ( ))); |
135 | m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); | 135 | m_style_list-> insertItem ( new StyleListItem ( "Light", new LightStyle ( ))); |
136 | m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); | 136 | m_style_list-> insertItem ( new StyleListItem ( "QPE", new QPEStyle ( ))); |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | { | 139 | { |
140 | QString path = QPEApplication::qpeDir ( ); | 140 | QString path = QPEApplication::qpeDir ( ); |
141 | path.append( "/plugins/styles/" ); | 141 | path.append( "/plugins/styles/" ); |
142 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 142 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
143 | 143 | ||
144 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 144 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
145 | { | 145 | { |
146 | QString libstr = path; | 146 | QString libstr = path; |
147 | libstr.append( "/" ); | 147 | libstr.append( "/" ); |
148 | libstr.append( *it ); | 148 | libstr.append( *it ); |
149 | QLibrary *lib = new QLibrary ( libstr ); | 149 | QLibrary *lib = new QLibrary ( libstr ); |
150 | StyleInterface *iface; | 150 | StyleInterface *iface; |
151 | 151 | ||
152 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) | 152 | if (( lib-> queryInterface ( IID_Style, (QUnknownInterface **) &iface ) == QS_OK ) && iface ) |
153 | { | 153 | { |
154 | StyleListItem *slit = new StyleListItem ( lib, iface ); | 154 | StyleListItem *slit = new StyleListItem ( lib, iface ); |
155 | m_style_list-> insertItem ( slit ); | 155 | m_style_list-> insertItem ( slit ); |
156 | 156 | ||
157 | if ( slit-> key ( ) == s ) | 157 | if ( slit-> key ( ) == s ) |
158 | m_style_list-> setCurrentItem ( slit ); | 158 | m_style_list-> setCurrentItem ( slit ); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | delete lib; | 161 | delete lib; |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | m_original_style = m_style_list-> currentItem ( ); | 165 | m_original_style = m_style_list-> currentItem ( ); |
166 | styleClicked ( m_original_style ); | 166 | styleClicked ( m_original_style ); |
167 | 167 | ||
168 | connect( m_style_list, SIGNAL( highlighted( int ) ), this, SLOT( styleClicked( int ) ) ); | 168 | connect( m_style_list, SIGNAL( highlighted(int) ), this, SLOT( styleClicked(int) ) ); |
169 | 169 | ||
170 | return tab; | 170 | return tab; |
171 | } | 171 | } |
172 | 172 | ||
173 | QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | 173 | QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) |
174 | { | 174 | { |
175 | QWidget* tab = new QWidget( parent, "DecoTab" ); | 175 | QWidget* tab = new QWidget( parent, "DecoTab" ); |
176 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); | 176 | QVBoxLayout* vertLayout = new QVBoxLayout( tab, 3, 3 ); |
177 | 177 | ||
178 | m_deco_list = new QListBox( tab, "m_deco_list" ); | 178 | m_deco_list = new QListBox( tab, "m_deco_list" ); |
179 | vertLayout->addWidget( m_deco_list ); | 179 | vertLayout->addWidget( m_deco_list ); |
180 | 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." ) ); | 180 | 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." ) ); |
181 | 181 | ||
182 | QString s = cfg. readEntry ( "Decoration", "libflat.so" ); | 182 | QString s = cfg. readEntry ( "Decoration", "libflat.so" ); |
183 | 183 | ||
184 | m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); | 184 | m_deco_list-> insertItem ( new DecoListItem ( "QPE" )); |
185 | 185 | ||
186 | { | 186 | { |
187 | QString path = QPEApplication::qpeDir(); | 187 | QString path = QPEApplication::qpeDir(); |
188 | path.append( "/plugins/decorations/" ); | 188 | path.append( "/plugins/decorations/" ); |
189 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); | 189 | QStringList sl = QDir ( path, "lib*.so" ). entryList ( ); |
190 | 190 | ||
191 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 191 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
192 | { | 192 | { |
193 | QString libstr = path; | 193 | QString libstr = path; |
194 | libstr.append( "/" ); | 194 | libstr.append( "/" ); |
195 | libstr.append( *it ); | 195 | libstr.append( *it ); |
196 | QLibrary *lib = new QLibrary ( libstr ); | 196 | QLibrary *lib = new QLibrary ( libstr ); |
197 | WindowDecorationInterface *iface; | 197 | WindowDecorationInterface *iface; |
198 | 198 | ||
199 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) | 199 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) |
200 | { | 200 | { |
201 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | 201 | DecoListItem *dlit = new DecoListItem ( lib, iface ); |
202 | m_deco_list-> insertItem ( dlit ); | 202 | m_deco_list-> insertItem ( dlit ); |
203 | 203 | ||
204 | if ( dlit-> key ( ) == s ) | 204 | if ( dlit-> key ( ) == s ) |
205 | m_deco_list-> setCurrentItem ( dlit ); | 205 | m_deco_list-> setCurrentItem ( dlit ); |
206 | } | 206 | } |
207 | else | 207 | else |
208 | delete lib; | 208 | delete lib; |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | m_original_deco = m_deco_list-> currentItem ( ); | 212 | m_original_deco = m_deco_list-> currentItem ( ); |
213 | if ( m_deco_list-> currentItem ( ) < 0 ) | 213 | if ( m_deco_list-> currentItem ( ) < 0 ) |
214 | m_deco_list-> setCurrentItem ( 0 ); | 214 | m_deco_list-> setCurrentItem ( 0 ); |
215 | decoClicked ( m_original_deco ); | 215 | decoClicked ( m_original_deco ); |
216 | 216 | ||
217 | connect( m_deco_list, SIGNAL( highlighted( int ) ), this, SLOT( decoClicked( int ) ) ); | 217 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); |
218 | 218 | ||
219 | return tab; | 219 | return tab; |
220 | } | 220 | } |
221 | 221 | ||
222 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) | 222 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) |
223 | { | 223 | { |
224 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); | 224 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); |
225 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); | 225 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); |
226 | int size = cfg. readNumEntry ( "FontSize", 10 ); | 226 | int size = cfg. readNumEntry ( "FontSize", 10 ); |
227 | 227 | ||
228 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); | 228 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); |
229 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); | 229 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
230 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); | 230 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); |
231 | 231 | ||
232 | connect( m_fontselect, SIGNAL( fontSelected ( const QFont & )), | 232 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
233 | this, SLOT( fontClicked ( const QFont & ))); | 233 | this, SLOT( fontClicked(const QFont&))); |
234 | 234 | ||
235 | return m_fontselect; | 235 | return m_fontselect; |
236 | } | 236 | } |
237 | 237 | ||
238 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | 238 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) |
239 | { | 239 | { |
240 | QWidget *tab = new QWidget( parent, "ColorTab" ); | 240 | QWidget *tab = new QWidget( parent, "ColorTab" ); |
241 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); | 241 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); |
242 | gridLayout->setRowStretch ( 3, 10 ); | 242 | gridLayout->setRowStretch ( 3, 10 ); |
243 | 243 | ||
244 | m_color_list = new QListBox ( tab ); | 244 | m_color_list = new QListBox ( tab ); |
245 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); | 245 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); |
246 | connect( m_color_list, SIGNAL( highlighted( int ) ), this, SLOT( colorClicked( int ) ) ); | 246 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); |
247 | 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." ) ); | 247 | 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." ) ); |
248 | 248 | ||
249 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); | 249 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); |
250 | 250 | ||
251 | QString path = QPEApplication::qpeDir ( ); | 251 | QString path = QPEApplication::qpeDir ( ); |
252 | path.append( "/etc/colors/" ); | 252 | path.append( "/etc/colors/" ); |
253 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 253 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
254 | 254 | ||
255 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 255 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
256 | { | 256 | { |
257 | QString name = (*it). left ((*it). find ( ".scheme" )); | 257 | QString name = (*it). left ((*it). find ( ".scheme" )); |
258 | QString pathstr = path; | 258 | QString pathstr = path; |
259 | pathstr.append( *it ); | 259 | pathstr.append( *it ); |
260 | Config config ( pathstr, Config::File ); | 260 | Config config ( pathstr, Config::File ); |
261 | config. setGroup ( "Colors" ); | 261 | config. setGroup ( "Colors" ); |
262 | 262 | ||
263 | m_color_list-> insertItem ( new ColorListItem ( name, config )); | 263 | m_color_list-> insertItem ( new ColorListItem ( name, config )); |
264 | } | 264 | } |
265 | 265 | ||
266 | m_color_list-> setCurrentItem ( 0 ); | 266 | m_color_list-> setCurrentItem ( 0 ); |
267 | 267 | ||
268 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); | 268 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); |
269 | tempButton->setText( tr( "Edit..." ) ); | 269 | tempButton->setText( tr( "Edit..." ) ); |
270 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 270 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
271 | gridLayout->addWidget( tempButton, 0, 1 ); | 271 | gridLayout->addWidget( tempButton, 0, 1 ); |
272 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 272 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
273 | 273 | ||
274 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 274 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
275 | tempButton->setText( tr( "Delete" ) ); | 275 | tempButton->setText( tr( "Delete" ) ); |
276 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 276 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
277 | gridLayout->addWidget( tempButton, 1, 1 ); | 277 | gridLayout->addWidget( tempButton, 1, 1 ); |
278 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 278 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
279 | 279 | ||
280 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 280 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
281 | tempButton->setText( tr( "Save" ) ); | 281 | tempButton->setText( tr( "Save" ) ); |
282 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 282 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
283 | gridLayout->addWidget( tempButton, 2, 1 ); | 283 | gridLayout->addWidget( tempButton, 2, 1 ); |
284 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 284 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
285 | 285 | ||
286 | return tab; | 286 | return tab; |
287 | } | 287 | } |
288 | 288 | ||
289 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 289 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
290 | { | 290 | { |
291 | QWidget *tab = new QWidget ( parent ); | 291 | QWidget *tab = new QWidget ( parent ); |
292 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 292 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
293 | 293 | ||
294 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 294 | QGridLayout *lay = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
295 | 295 | ||
296 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); | 296 | m_force = new QCheckBox ( tr( "Force styling for all applications." ), tab ); |
297 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); | 297 | m_force-> setChecked ( cfg. readBoolEntry ( "ForceStyle" )); |
298 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); | 298 | lay-> addMultiCellWidget ( m_force, 0, 0, 0, 1 ); |
299 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); | 299 | QWhatsThis::add( m_force, tr( "Click here to allow all applications to use global appearance settings." ) ); |
300 | 300 | ||
301 | QLabel *l = new QLabel ( tab ); | 301 | QLabel *l = new QLabel ( tab ); |
302 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); | 302 | l-> setText ( QString ( "<p>%1</p>" ). arg ( tr( "Disable styling for these applications ( <b>*</b> can be used as a wildcard):" ))); |
303 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); | 303 | lay-> addMultiCellWidget ( l, 1, 1, 0, 1 ); |
304 | QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 304 | QWhatsThis::add( l, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
305 | 305 | ||
306 | m_except = new QListView ( tab ); | 306 | m_except = new QListView ( tab ); |
307 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); | 307 | m_except-> addColumn ( Resource::loadIconSet ( "appearance" ), "", 24 ); |
308 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); | 308 | m_except-> addColumn ( Resource::loadIconSet ( "font" ), "", 24 ); |
309 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); | 309 | m_except-> addColumn ( Resource::loadIconSet ( "appearance/deco" ), "", 24 ); |
310 | m_except-> addColumn ( tr( "Binary file(s)" )); | 310 | m_except-> addColumn ( tr( "Binary file(s)" )); |
311 | m_except-> setColumnAlignment ( 0, AlignCenter ); | 311 | m_except-> setColumnAlignment ( 0, AlignCenter ); |
312 | m_except-> setColumnAlignment ( 1, AlignCenter ); | 312 | m_except-> setColumnAlignment ( 1, AlignCenter ); |
313 | m_except-> setColumnAlignment ( 2, AlignCenter ); | 313 | m_except-> setColumnAlignment ( 2, AlignCenter ); |
314 | m_except-> setAllColumnsShowFocus ( true ); | 314 | m_except-> setAllColumnsShowFocus ( true ); |
315 | m_except-> setMinimumHeight ( 30 ); | 315 | m_except-> setMinimumHeight ( 30 ); |
316 | m_except-> header ( )-> setClickEnabled ( false ); | 316 | m_except-> header ( )-> setClickEnabled ( false ); |
317 | m_except-> header ( )-> setResizeEnabled ( false ); | 317 | m_except-> header ( )-> setResizeEnabled ( false ); |
318 | m_except-> header ( )-> setMovingEnabled ( false ); | 318 | m_except-> header ( )-> setMovingEnabled ( false ); |
319 | m_except-> setSorting ( -1 ); | 319 | m_except-> setSorting ( -1 ); |
320 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); | 320 | lay-> addMultiCellWidget ( m_except, 2, 6, 0, 0 ); |
321 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); | 321 | QWhatsThis::add( m_except, tr( "If some applications do not display correctly with the global appearance settings, certain features can be turned off for that application.\n\nThis area allows you to select an application and which settings you wish to disable." ) ); |
322 | 322 | ||
323 | connect ( m_except, SIGNAL( clicked ( QListViewItem *, const QPoint &, int )), this, SLOT( clickedExcept ( QListViewItem *, const QPoint &, int ))); | 323 | connect ( m_except, SIGNAL( clicked(QListViewItem*,const QPoint&,int)), this, SLOT( clickedExcept(QListViewItem*,const QPoint&,int))); |
324 | 324 | ||
325 | QToolButton *tb = new QToolButton ( tab ); | 325 | QToolButton *tb = new QToolButton ( tab ); |
326 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); | 326 | tb-> setIconSet ( Resource::loadIconSet ( "appearance/add" )); |
327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 327 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
328 | lay-> addWidget ( tb, 2, 1 ); | 328 | lay-> addWidget ( tb, 2, 1 ); |
329 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( addExcept ( ))); | 329 | connect ( tb, SIGNAL( clicked()), this, SLOT( addExcept())); |
330 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); | 330 | QWhatsThis::add( tb, tr( "Click here to add an application to the list above." ) ); |
331 | 331 | ||
332 | tb = new QToolButton ( tab ); | 332 | tb = new QToolButton ( tab ); |
333 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); | 333 | tb-> setIconSet ( Resource::loadIconSet ( "editdelete" )); |
334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 334 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
335 | lay-> addWidget ( tb, 3, 1 ); | 335 | lay-> addWidget ( tb, 3, 1 ); |
336 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( delExcept ( ))); | 336 | connect ( tb, SIGNAL( clicked()), this, SLOT( delExcept())); |
337 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); | 337 | QWhatsThis::add( tb, tr( "Click here to delete the currently selected application." ) ); |
338 | 338 | ||
339 | tb = new QToolButton ( tab ); | 339 | tb = new QToolButton ( tab ); |
340 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); | 340 | tb-> setIconSet ( Resource::loadIconSet ( "up" )); |
341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 341 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
342 | lay-> addWidget ( tb, 4, 1 ); | 342 | lay-> addWidget ( tb, 4, 1 ); |
343 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( upExcept ( ))); | 343 | connect ( tb, SIGNAL( clicked()), this, SLOT( upExcept())); |
344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); | 344 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application up in the list." ) ); |
345 | 345 | ||
346 | tb = new QToolButton ( tab ); | 346 | tb = new QToolButton ( tab ); |
347 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); | 347 | tb-> setIconSet ( Resource::loadIconSet ( "down" )); |
348 | tb-> setFocusPolicy ( QWidget::StrongFocus ); | 348 | tb-> setFocusPolicy ( QWidget::StrongFocus ); |
349 | lay-> addWidget ( tb, 5, 1 ); | 349 | lay-> addWidget ( tb, 5, 1 ); |
350 | connect ( tb, SIGNAL( clicked ( )), this, SLOT( downExcept ( ))); | 350 | connect ( tb, SIGNAL( clicked()), this, SLOT( downExcept())); |
351 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); | 351 | QWhatsThis::add( tb, tr( "Click here to move the currently selected application down in the list." ) ); |
352 | 352 | ||
353 | lay-> setRowStretch ( 6, 10 ); | 353 | lay-> setRowStretch ( 6, 10 ); |
354 | lay-> setColStretch ( 0, 10 ); | 354 | lay-> setColStretch ( 0, 10 ); |
355 | 355 | ||
356 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); | 356 | QStringList sl = cfg. readListEntry ( "NoStyle", ';' ); |
357 | QListViewItem *lvit = 0; | 357 | QListViewItem *lvit = 0; |
358 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 358 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
359 | { | 359 | { |
360 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 360 | int fl = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
361 | 361 | ||
362 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); | 362 | lvit = new ExceptListItem ( m_except, lvit, ( *it ). mid ( 1 ), fl & 0x01, fl & 0x02, fl & 0x04 ); |
363 | } | 363 | } |
364 | 364 | ||
365 | 365 | ||
366 | vertLayout-> addSpacing ( 3 ); | 366 | vertLayout-> addSpacing ( 3 ); |
367 | QFrame *f = new QFrame ( tab ); | 367 | QFrame *f = new QFrame ( tab ); |
368 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | 368 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); |
369 | vertLayout-> addWidget ( f ); | 369 | vertLayout-> addWidget ( f ); |
370 | vertLayout-> addSpacing ( 3 ); | 370 | vertLayout-> addSpacing ( 3 ); |
371 | 371 | ||
372 | 372 | ||
373 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 373 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
374 | 374 | ||
375 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 375 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
376 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 376 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
377 | 377 | ||
378 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 378 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
379 | gridLayout-> addWidget ( label, 0, 0 ); | 379 | gridLayout-> addWidget ( label, 0, 0 ); |
380 | 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" ) ); | 380 | 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" ) ); |
381 | 381 | ||
382 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 382 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
383 | btngrp-> hide ( ); | 383 | btngrp-> hide ( ); |
384 | btngrp-> setExclusive ( true ); | 384 | btngrp-> setExclusive ( true ); |
385 | 385 | ||
386 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 386 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
387 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 387 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
388 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 388 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
389 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 389 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
390 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 390 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
391 | m_tabstyle_list-> setCurrentItem ( style ); | 391 | m_tabstyle_list-> setCurrentItem ( style ); |
392 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 392 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
393 | 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" ) ); | 393 | 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" ) ); |
394 | 394 | ||
395 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 395 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
396 | btngrp-> insert ( m_tabstyle_top ); | 396 | btngrp-> insert ( m_tabstyle_top ); |
397 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 397 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
398 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 398 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
399 | 399 | ||
400 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 400 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
401 | btngrp-> insert ( m_tabstyle_bottom ); | 401 | btngrp-> insert ( m_tabstyle_bottom ); |
402 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 402 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
403 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 403 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
404 | 404 | ||
405 | m_tabstyle_top-> setChecked ( tabtop ); | 405 | m_tabstyle_top-> setChecked ( tabtop ); |
406 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 406 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
407 | 407 | ||
408 | m_original_tabstyle = style; | 408 | m_original_tabstyle = style; |
409 | m_original_tabpos = tabtop; | 409 | m_original_tabpos = tabtop; |
410 | 410 | ||
411 | vertLayout-> addSpacing ( 3 ); | 411 | vertLayout-> addSpacing ( 3 ); |
412 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 412 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
413 | 413 | ||
414 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 414 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
415 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 415 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
416 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); | 416 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); |
417 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 417 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
418 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); | 418 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); |
419 | QPixmap ccw1; | 419 | QPixmap ccw1; |
420 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 420 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
421 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); | 421 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); |
422 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 422 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
423 | 423 | ||
424 | rotbtngrp-> hide ( ); | 424 | rotbtngrp-> hide ( ); |
425 | rotbtngrp-> setExclusive ( true ); | 425 | rotbtngrp-> setExclusive ( true ); |
426 | rotbtngrp-> insert ( m_rotdir_cw ); | 426 | rotbtngrp-> insert ( m_rotdir_cw ); |
427 | rotbtngrp-> insert ( m_rotdir_ccw ); | 427 | rotbtngrp-> insert ( m_rotdir_ccw ); |
428 | rotbtngrp-> insert ( m_rotdir_flip ); | 428 | rotbtngrp-> insert ( m_rotdir_flip ); |
429 | 429 | ||
430 | ccw1. convertFromImage( ccwImage ); | 430 | ccw1. convertFromImage( ccwImage ); |
431 | m_rotdir_cw-> setPixmap( cw1 ); | 431 | m_rotdir_cw-> setPixmap( cw1 ); |
432 | m_rotdir_ccw-> setPixmap( ccw1 ); | 432 | m_rotdir_ccw-> setPixmap( ccw1 ); |
433 | m_rotdir_flip-> setPixmap( flip1 ); | 433 | m_rotdir_flip-> setPixmap( flip1 ); |
434 | 434 | ||
435 | rotLay-> addWidget ( rotlabel, 0 ); | 435 | rotLay-> addWidget ( rotlabel, 0 ); |
436 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 436 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
437 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 437 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
438 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 438 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
439 | 439 | ||
440 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 440 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
441 | ODirection rot = CW; | 441 | ODirection rot = CW; |
442 | 442 | ||
443 | if (rotDirection == -1) | 443 | if (rotDirection == -1) |
444 | { | 444 | { |
445 | rot = ODevice::inst ( )-> direction ( ); | 445 | rot = ODevice::inst ( )-> direction ( ); |
446 | } | 446 | } |
447 | else | 447 | else |
448 | { | 448 | { |
449 | rot = (ODirection)rotDirection; | 449 | rot = (ODirection)rotDirection; |
450 | } | 450 | } |
451 | 451 | ||
452 | m_rotdir_cw-> setChecked ( rot == CW ); | 452 | m_rotdir_cw-> setChecked ( rot == CW ); |
453 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 453 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
454 | m_rotdir_flip-> setChecked ( rot == Flip ); | 454 | m_rotdir_flip-> setChecked ( rot == Flip ); |
455 | 455 | ||
456 | return tab; | 456 | return tab; |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 460 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
461 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 461 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
462 | { | 462 | { |
463 | setCaption( tr( "Appearance Settings" ) ); | 463 | setCaption( tr( "Appearance Settings" ) ); |
464 | 464 | ||
465 | Config config( "qpe" ); | 465 | Config config( "qpe" ); |
466 | config.setGroup( "Appearance" ); | 466 | config.setGroup( "Appearance" ); |
467 | 467 | ||
468 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); | 468 | QVBoxLayout *top = new QVBoxLayout ( this, 3, 3 ); |
469 | 469 | ||
470 | m_sample = new SampleWindow ( this ); | 470 | m_sample = new SampleWindow ( this ); |
471 | 471 | ||
472 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 472 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
473 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 473 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
474 | 474 | ||
475 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 475 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
476 | QWidget *styletab; | 476 | QWidget *styletab; |
477 | 477 | ||
478 | m_color_list = 0; | 478 | m_color_list = 0; |
479 | 479 | ||
480 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 480 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
481 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 481 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
482 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 482 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
483 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 483 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
484 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 484 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
485 | 485 | ||
486 | top-> addWidget ( tw, 10 ); | 486 | top-> addWidget ( tw, 10 ); |
487 | top-> addWidget ( m_sample, 1 ); | 487 | top-> addWidget ( m_sample, 1 ); |
488 | 488 | ||
489 | tw-> setCurrentTab ( styletab ); | 489 | tw-> setCurrentTab ( styletab ); |
490 | connect ( tw, SIGNAL( currentChanged ( QWidget * )), this, SLOT( tabChanged ( QWidget * ))); | 490 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); |
491 | 491 | ||
492 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 492 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
493 | } | 493 | } |
494 | 494 | ||
495 | Appearance::~Appearance() | 495 | Appearance::~Appearance() |
496 | {} | 496 | {} |
497 | 497 | ||
498 | void Appearance::tabChanged ( QWidget *w ) | 498 | void Appearance::tabChanged ( QWidget *w ) |
499 | { | 499 | { |
500 | if ( w == m_advtab ) | 500 | if ( w == m_advtab ) |
501 | { | 501 | { |
502 | m_sample-> hide ( ); | 502 | m_sample-> hide ( ); |
503 | updateGeometry ( ); // shouldn't be necessary ... | 503 | updateGeometry ( ); // shouldn't be necessary ... |
504 | } | 504 | } |
505 | else | 505 | else |
506 | m_sample-> show ( ); | 506 | m_sample-> show ( ); |
507 | } | 507 | } |
508 | 508 | ||
509 | void Appearance::accept ( ) | 509 | void Appearance::accept ( ) |
510 | { | 510 | { |
511 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 511 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
512 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 512 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
513 | 513 | ||
514 | Config config ( "qpe" ); | 514 | Config config ( "qpe" ); |
515 | config. setGroup ( "Appearance" ); | 515 | config. setGroup ( "Appearance" ); |
516 | 516 | ||
517 | if ( m_style_changed ) | 517 | if ( m_style_changed ) |
518 | { | 518 | { |
519 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 519 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
520 | if ( item ) | 520 | if ( item ) |
521 | config.writeEntry( "Style", item-> key ( )); | 521 | config.writeEntry( "Style", item-> key ( )); |
522 | } | 522 | } |
523 | 523 | ||
524 | if ( m_deco_changed ) | 524 | if ( m_deco_changed ) |
525 | { | 525 | { |
526 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 526 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
527 | if ( item ) | 527 | if ( item ) |
528 | config.writeEntry( "Decoration", item-> key ( )); | 528 | config.writeEntry( "Decoration", item-> key ( )); |
529 | } | 529 | } |
530 | 530 | ||
531 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) | 531 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
532 | { | 532 | { |
533 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 533 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
534 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 534 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
535 | } | 535 | } |
536 | 536 | ||
537 | if ( m_font_changed ) | 537 | if ( m_font_changed ) |
538 | { | 538 | { |
539 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 539 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
540 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 540 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
541 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 541 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
542 | } | 542 | } |
543 | 543 | ||
544 | 544 | ||
545 | if ( m_color_changed ) | 545 | if ( m_color_changed ) |
546 | { | 546 | { |
547 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 547 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
548 | 548 | ||
549 | if ( item ) | 549 | if ( item ) |
550 | item-> save ( config ); | 550 | item-> save ( config ); |
551 | } | 551 | } |
552 | 552 | ||
553 | ODirection rot; | 553 | ODirection rot; |
554 | if (m_rotdir_ccw-> isChecked ( )) | 554 | if (m_rotdir_ccw-> isChecked ( )) |
555 | { | 555 | { |
556 | rot = CCW; | 556 | rot = CCW; |
557 | } | 557 | } |
558 | else if (m_rotdir_cw-> isChecked ( )) | 558 | else if (m_rotdir_cw-> isChecked ( )) |
559 | { | 559 | { |
560 | rot = CW; | 560 | rot = CW; |
561 | } | 561 | } |
562 | else | 562 | else |
563 | { | 563 | { |
564 | rot = Flip; | 564 | rot = Flip; |
565 | } | 565 | } |
566 | config. writeEntry ( "rotatedir", (int)rot ); | 566 | config. writeEntry ( "rotatedir", (int)rot ); |
567 | 567 | ||
568 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated | 568 | m_except-> setFocus ( ); // if the focus was on the embedded line-edit, we have to move it away first, so the contents are updated |
569 | 569 | ||
570 | QStringList sl; | 570 | QStringList sl; |
571 | QString exceptstr; | 571 | QString exceptstr; |
572 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) | 572 | for ( ExceptListItem *it = (ExceptListItem *) m_except-> firstChild ( ); it; it = (ExceptListItem *) it-> nextSibling ( )) |
573 | { | 573 | { |
574 | int fl = 0; | 574 | int fl = 0; |
575 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); | 575 | fl |= ( it-> noStyle ( ) ? 0x01 : 0 ); |
576 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); | 576 | fl |= ( it-> noFont ( ) ? 0x02 : 0 ); |
577 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); | 577 | fl |= ( it-> noDeco ( ) ? 0x04 : 0 ); |
578 | exceptstr = QString::number ( fl, 32 ); | 578 | exceptstr = QString::number ( fl, 32 ); |
579 | exceptstr.append( it-> pattern ( )); | 579 | exceptstr.append( it-> pattern ( )); |
580 | sl << exceptstr; | 580 | sl << exceptstr; |
581 | } | 581 | } |
582 | config. writeEntry ( "NoStyle", sl, ';' ); | 582 | config. writeEntry ( "NoStyle", sl, ';' ); |
583 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); | 583 | config. writeEntry ( "ForceStyle", m_force-> isChecked ( )); |
584 | 584 | ||
585 | config. write ( ); // need to flush the config info first | 585 | config. write ( ); // need to flush the config info first |
586 | Global::applyStyle ( ); | 586 | Global::applyStyle ( ); |