author | zecke <zecke> | 2005-02-08 23:07:38 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-02-08 23:07:38 (UTC) |
commit | 5703c0b74a0866145a24a01e68530ed36a33e9cc (patch) (unidiff) | |
tree | 6cd77da956b55cd8bfd760f266ce23b10e6b5b48 | |
parent | 80144c63f04e798b10a966402f235d236e3e540f (diff) | |
download | opie-5703c0b74a0866145a24a01e68530ed36a33e9cc.zip opie-5703c0b74a0866145a24a01e68530ed36a33e9cc.tar.gz opie-5703c0b74a0866145a24a01e68530ed36a33e9cc.tar.bz2 |
Reuse the gained space and implement the "Scrollbars on Left" GUI Setting
-rw-r--r-- | noncore/settings/appearance2/appearance.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/appearance2/appearance.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/noncore/settings/appearance2/appearance.cpp b/noncore/settings/appearance2/appearance.cpp index d649ed6..82d8931 100644 --- a/noncore/settings/appearance2/appearance.cpp +++ b/noncore/settings/appearance2/appearance.cpp | |||
@@ -200,192 +200,206 @@ QWidget *Appearance::createDecoTab ( QWidget *parent, Config &cfg ) | |||
200 | 200 | ||
201 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) | 201 | if ( lib-> queryInterface ( IID_WindowDecoration, (QUnknownInterface **) &iface ) == QS_OK ) |
202 | { | 202 | { |
203 | DecoListItem *dlit = new DecoListItem ( lib, iface ); | 203 | DecoListItem *dlit = new DecoListItem ( lib, iface ); |
204 | m_deco_list-> insertItem ( dlit ); | 204 | m_deco_list-> insertItem ( dlit ); |
205 | 205 | ||
206 | if ( dlit-> key ( ) == s ) | 206 | if ( dlit-> key ( ) == s ) |
207 | m_deco_list-> setCurrentItem ( dlit ); | 207 | m_deco_list-> setCurrentItem ( dlit ); |
208 | } | 208 | } |
209 | else | 209 | else |
210 | delete lib; | 210 | delete lib; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | m_original_deco = m_deco_list-> currentItem ( ); | 214 | m_original_deco = m_deco_list-> currentItem ( ); |
215 | if ( m_deco_list-> currentItem ( ) < 0 ) | 215 | if ( m_deco_list-> currentItem ( ) < 0 ) |
216 | m_deco_list-> setCurrentItem ( 0 ); | 216 | m_deco_list-> setCurrentItem ( 0 ); |
217 | decoClicked ( m_original_deco ); | 217 | decoClicked ( m_original_deco ); |
218 | 218 | ||
219 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); | 219 | connect( m_deco_list, SIGNAL( highlighted(int) ), this, SLOT( decoClicked(int) ) ); |
220 | 220 | ||
221 | return tab; | 221 | return tab; |
222 | } | 222 | } |
223 | 223 | ||
224 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) | 224 | QWidget *Appearance::createFontTab ( QWidget *parent, Config &cfg ) |
225 | { | 225 | { |
226 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); | 226 | QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); |
227 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); | 227 | QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); |
228 | int size = cfg. readNumEntry ( "FontSize", 10 ); | 228 | int size = cfg. readNumEntry ( "FontSize", 10 ); |
229 | 229 | ||
230 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); | 230 | m_fontselect = new OFontSelector ( false, parent, "FontTab" ); |
231 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); | 231 | m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
232 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); | 232 | QWhatsThis::add( m_fontselect, tr( "Select the desired name, style and size of the default font applications will use." ) ); |
233 | 233 | ||
234 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 234 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
235 | this, SLOT( fontClicked(const QFont&))); | 235 | this, SLOT( fontClicked(const QFont&))); |
236 | 236 | ||
237 | return m_fontselect; | 237 | return m_fontselect; |
238 | } | 238 | } |
239 | 239 | ||
240 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) | 240 | QWidget *Appearance::createColorTab ( QWidget *parent, Config &cfg ) |
241 | { | 241 | { |
242 | QWidget *tab = new QWidget( parent, "ColorTab" ); | 242 | QWidget *tab = new QWidget( parent, "ColorTab" ); |
243 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); | 243 | QGridLayout *gridLayout = new QGridLayout( tab, 0, 0, 3, 3 ); |
244 | gridLayout->setRowStretch ( 3, 10 ); | 244 | gridLayout->setRowStretch ( 3, 10 ); |
245 | 245 | ||
246 | m_color_list = new QListBox ( tab ); | 246 | m_color_list = new QListBox ( tab ); |
247 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); | 247 | gridLayout->addMultiCellWidget ( m_color_list, 0, 3, 0, 0 ); |
248 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); | 248 | connect( m_color_list, SIGNAL( highlighted(int) ), this, SLOT( colorClicked(int) ) ); |
249 | QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); | 249 | QWhatsThis::add( m_color_list, tr( "Color schemes are a collection of colors which are used for various parts of the display.\n\nClick here to select an available scheme." ) ); |
250 | 250 | ||
251 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); | 251 | m_color_list-> insertItem ( new ColorListItem ( tr( "Current scheme" ), cfg )); |
252 | 252 | ||
253 | QString path = QPEApplication::qpeDir ( ); | 253 | QString path = QPEApplication::qpeDir ( ); |
254 | path.append( "/etc/colors/" ); | 254 | path.append( "/etc/colors/" ); |
255 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); | 255 | QStringList sl = QDir ( path ). entryList ( "*.scheme" ); |
256 | 256 | ||
257 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 257 | for ( QStringList::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
258 | { | 258 | { |
259 | QString name = (*it). left ((*it). find ( ".scheme" )); | 259 | QString name = (*it). left ((*it). find ( ".scheme" )); |
260 | QString pathstr = path; | 260 | QString pathstr = path; |
261 | pathstr.append( *it ); | 261 | pathstr.append( *it ); |
262 | Config config ( pathstr, Config::File ); | 262 | Config config ( pathstr, Config::File ); |
263 | config. setGroup ( "Colors" ); | 263 | config. setGroup ( "Colors" ); |
264 | 264 | ||
265 | m_color_list-> insertItem ( new ColorListItem ( name, config )); | 265 | m_color_list-> insertItem ( new ColorListItem ( name, config )); |
266 | } | 266 | } |
267 | 267 | ||
268 | m_color_list-> setCurrentItem ( 0 ); | 268 | m_color_list-> setCurrentItem ( 0 ); |
269 | 269 | ||
270 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); | 270 | QPushButton* tempButton = new QPushButton( tab, "editSchemeButton" ); |
271 | tempButton->setText( tr( "Edit..." ) ); | 271 | tempButton->setText( tr( "Edit..." ) ); |
272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); | 272 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( editSchemeClicked() ) ); |
273 | gridLayout->addWidget( tempButton, 0, 1 ); | 273 | gridLayout->addWidget( tempButton, 0, 1 ); |
274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); | 274 | QWhatsThis::add( tempButton, tr( "Click here to change the colors in the current color scheme." ) ); |
275 | 275 | ||
276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); | 276 | tempButton = new QPushButton( tab, "deleteSchemeButton" ); |
277 | tempButton->setText( tr( "Delete" ) ); | 277 | tempButton->setText( tr( "Delete" ) ); |
278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); | 278 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( deleteSchemeClicked() ) ); |
279 | gridLayout->addWidget( tempButton, 1, 1 ); | 279 | gridLayout->addWidget( tempButton, 1, 1 ); |
280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); | 280 | QWhatsThis::add( tempButton, tr( "Click here to delete the color scheme selected in the list to the left." ) ); |
281 | 281 | ||
282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); | 282 | tempButton = new QPushButton( tab, "saveSchemeButton" ); |
283 | tempButton->setText( tr( "Save" ) ); | 283 | tempButton->setText( tr( "Save" ) ); |
284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); | 284 | connect( tempButton, SIGNAL( clicked() ), this, SLOT( saveSchemeClicked() ) ); |
285 | gridLayout->addWidget( tempButton, 2, 1 ); | 285 | gridLayout->addWidget( tempButton, 2, 1 ); |
286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); | 286 | QWhatsThis::add( tempButton, tr( "Click here to name and save the current color scheme." ) ); |
287 | 287 | ||
288 | return tab; | 288 | return tab; |
289 | } | 289 | } |
290 | 290 | ||
291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) | 291 | QWidget *Appearance::createAdvancedTab ( QWidget *parent, Config &cfg ) |
292 | { | 292 | { |
293 | QWidget *tab = new QWidget ( parent ); | 293 | QWidget *tab = new QWidget ( parent ); |
294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 294 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
295 | 295 | ||
296 | /* | ||
297 | * show scrollbars on the left? | ||
298 | */ | ||
299 | m_leftHand = new QCheckBox( tr("Show Scrollbars on the left"), tab ); | ||
300 | m_leftHand->setChecked( cfg.readBoolEntry( "LeftHand", false ) ); | ||
301 | QWhatsThis::add( m_leftHand, tr( "Click here to display scrollbars on the left side instead of the right." ) ); | ||
302 | vertLayout->addWidget( m_leftHand ); | ||
303 | |||
304 | QFrame *f = new QFrame ( tab ); | ||
305 | f-> setFrameStyle ( QFrame::HLine | QFrame::Sunken ); | ||
306 | vertLayout-> addWidget ( f ); | ||
307 | vertLayout-> addSpacing ( 3 ); | ||
308 | |||
309 | |||
296 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); | 310 | QGridLayout* gridLayout = new QGridLayout ( vertLayout, 0, 0, 3, 0 ); |
297 | 311 | ||
298 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; | 312 | int style = cfg. readNumEntry ( "TabStyle", 2 ) - 1; |
299 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); | 313 | bool tabtop = ( cfg. readEntry ( "TabPosition", "Top" ) == "Top" ); |
300 | 314 | ||
301 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); | 315 | QLabel* label = new QLabel( tr( "Tab style:" ), tab ); |
302 | gridLayout-> addWidget ( label, 0, 0 ); | 316 | gridLayout-> addWidget ( label, 0, 0 ); |
303 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 317 | QWhatsThis::add( label, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
304 | 318 | ||
305 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); | 319 | QButtonGroup* btngrp = new QButtonGroup( tab, "buttongroup" ); |
306 | btngrp-> hide ( ); | 320 | btngrp-> hide ( ); |
307 | btngrp-> setExclusive ( true ); | 321 | btngrp-> setExclusive ( true ); |
308 | 322 | ||
309 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); | 323 | m_tabstyle_list = new QComboBox ( false, tab, "tabstyle" ); |
310 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); | 324 | m_tabstyle_list-> insertItem ( tr( "Tabs" )); |
311 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); | 325 | m_tabstyle_list-> insertItem ( tr( "Tabs w/icons" )); |
312 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); | 326 | m_tabstyle_list-> insertItem ( tr( "Drop down list" )); |
313 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); | 327 | m_tabstyle_list-> insertItem ( tr( "Drop down list w/icons" )); |
314 | m_tabstyle_list-> setCurrentItem ( style ); | 328 | m_tabstyle_list-> setCurrentItem ( style ); |
315 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); | 329 | gridLayout-> addMultiCellWidget ( m_tabstyle_list, 0, 0, 1, 2 ); |
316 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); | 330 | QWhatsThis::add( m_tabstyle_list, tr( "Click here to select a desired style for tabbed dialogs (such as this application). The styles available are:\n\n1. Tabs - normal tabs with text labels only\n2. Tabs w/icons - tabs with icons for each tab, text label only appears on current tab\n3. Drop down list - a vertical listing of tabs\n4. Drop down list w/icons - a vertical listing of tabs with icons" ) ); |
317 | 331 | ||
318 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); | 332 | m_tabstyle_top = new QRadioButton( tr( "Top" ), tab, "tabpostop" ); |
319 | btngrp-> insert ( m_tabstyle_top ); | 333 | btngrp-> insert ( m_tabstyle_top ); |
320 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); | 334 | gridLayout-> addWidget( m_tabstyle_top, 1, 1 ); |
321 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); | 335 | QWhatsThis::add( m_tabstyle_top, tr( "Click here so that tabs appear at the top of the window." ) ); |
322 | 336 | ||
323 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); | 337 | m_tabstyle_bottom = new QRadioButton( tr( "Bottom" ), tab, "tabposbottom" ); |
324 | btngrp-> insert ( m_tabstyle_bottom ); | 338 | btngrp-> insert ( m_tabstyle_bottom ); |
325 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); | 339 | gridLayout-> addWidget( m_tabstyle_bottom, 1, 2 ); |
326 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); | 340 | QWhatsThis::add( m_tabstyle_bottom, tr( "Click here so that tabs appear at the bottom of the window." ) ); |
327 | 341 | ||
328 | m_tabstyle_top-> setChecked ( tabtop ); | 342 | m_tabstyle_top-> setChecked ( tabtop ); |
329 | m_tabstyle_bottom-> setChecked ( !tabtop ); | 343 | m_tabstyle_bottom-> setChecked ( !tabtop ); |
330 | 344 | ||
331 | m_original_tabstyle = style; | 345 | m_original_tabstyle = style; |
332 | m_original_tabpos = tabtop; | 346 | m_original_tabpos = tabtop; |
333 | 347 | ||
334 | vertLayout-> addSpacing ( 3 ); | 348 | vertLayout-> addSpacing ( 3 ); |
335 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); | 349 | QHBoxLayout *rotLay = new QHBoxLayout ( vertLayout, 3 ); |
336 | 350 | ||
337 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); | 351 | QLabel* rotlabel = new QLabel( tr( "Rotation direction:" ), tab ); |
338 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); | 352 | m_rotdir_cw = new QRadioButton( tab, "rotdir_cw" ); |
339 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); | 353 | QPixmap cw1 = Resource::loadIconSet("redo"). pixmap( ); |
340 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); | 354 | m_rotdir_ccw = new QRadioButton( tab, "rotdir_ccw" ); |
341 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); | 355 | QImage ccwImage = cw1. convertToImage( ). mirror( 1, 0 ); |
342 | QPixmap ccw1; | 356 | QPixmap ccw1; |
343 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); | 357 | m_rotdir_flip = new QRadioButton( tab, "rotdir_flip" ); |
344 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); | 358 | QPixmap flip1 = Resource::loadIconSet("pass"). pixmap( ); |
345 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); | 359 | QButtonGroup* rotbtngrp = new QButtonGroup( tab, "rotbuttongroup" ); |
346 | 360 | ||
347 | rotbtngrp-> hide ( ); | 361 | rotbtngrp-> hide ( ); |
348 | rotbtngrp-> setExclusive ( true ); | 362 | rotbtngrp-> setExclusive ( true ); |
349 | rotbtngrp-> insert ( m_rotdir_cw ); | 363 | rotbtngrp-> insert ( m_rotdir_cw ); |
350 | rotbtngrp-> insert ( m_rotdir_ccw ); | 364 | rotbtngrp-> insert ( m_rotdir_ccw ); |
351 | rotbtngrp-> insert ( m_rotdir_flip ); | 365 | rotbtngrp-> insert ( m_rotdir_flip ); |
352 | 366 | ||
353 | ccw1. convertFromImage( ccwImage ); | 367 | ccw1. convertFromImage( ccwImage ); |
354 | m_rotdir_cw-> setPixmap( cw1 ); | 368 | m_rotdir_cw-> setPixmap( cw1 ); |
355 | m_rotdir_ccw-> setPixmap( ccw1 ); | 369 | m_rotdir_ccw-> setPixmap( ccw1 ); |
356 | m_rotdir_flip-> setPixmap( flip1 ); | 370 | m_rotdir_flip-> setPixmap( flip1 ); |
357 | 371 | ||
358 | rotLay-> addWidget ( rotlabel, 0 ); | 372 | rotLay-> addWidget ( rotlabel, 0 ); |
359 | rotLay-> addWidget ( m_rotdir_cw, 0 ); | 373 | rotLay-> addWidget ( m_rotdir_cw, 0 ); |
360 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); | 374 | rotLay-> addWidget ( m_rotdir_ccw, 0 ); |
361 | rotLay-> addWidget ( m_rotdir_flip, 0 ); | 375 | rotLay-> addWidget ( m_rotdir_flip, 0 ); |
362 | 376 | ||
363 | int rotDirection = cfg.readNumEntry( "rotatedir" ); | 377 | int rotDirection = cfg.readNumEntry( "rotatedir" ); |
364 | ODirection rot = CW; | 378 | ODirection rot = CW; |
365 | 379 | ||
366 | if (rotDirection == -1) | 380 | if (rotDirection == -1) |
367 | { | 381 | { |
368 | rot = ODevice::inst ( )-> direction ( ); | 382 | rot = ODevice::inst ( )-> direction ( ); |
369 | } | 383 | } |
370 | else | 384 | else |
371 | { | 385 | { |
372 | rot = (ODirection)rotDirection; | 386 | rot = (ODirection)rotDirection; |
373 | } | 387 | } |
374 | 388 | ||
375 | m_rotdir_cw-> setChecked ( rot == CW ); | 389 | m_rotdir_cw-> setChecked ( rot == CW ); |
376 | m_rotdir_ccw-> setChecked ( rot == CCW ); | 390 | m_rotdir_ccw-> setChecked ( rot == CCW ); |
377 | m_rotdir_flip-> setChecked ( rot == Flip ); | 391 | m_rotdir_flip-> setChecked ( rot == Flip ); |
378 | 392 | ||
379 | 393 | ||
380 | /* | 394 | /* |
381 | * add a spacing | 395 | * add a spacing |
382 | */ | 396 | */ |
383 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 397 | vertLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
384 | return tab; | 398 | return tab; |
385 | } | 399 | } |
386 | 400 | ||
387 | 401 | ||
388 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | 402 | Appearance::Appearance( QWidget* parent, const char* name, WFlags ) |
389 | : QDialog ( parent, name, true, WStyle_ContextHelp ) | 403 | : QDialog ( parent, name, true, WStyle_ContextHelp ) |
390 | { | 404 | { |
391 | setCaption( tr( "Appearance Settings" ) ); | 405 | setCaption( tr( "Appearance Settings" ) ); |
@@ -400,192 +414,194 @@ Appearance::Appearance( QWidget* parent, const char* name, WFlags ) | |||
400 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); | 414 | m_sample-> setDecoration ( new DefaultWindowDecoration ( ) ); |
401 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); | 415 | QWhatsThis::add( m_sample, tr( "This is a preview window. Look here to see your new appearance as options are changed." ) ); |
402 | 416 | ||
403 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 417 | OTabWidget* tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
404 | QWidget *styletab; | 418 | QWidget *styletab; |
405 | 419 | ||
406 | m_color_list = 0; | 420 | m_color_list = 0; |
407 | 421 | ||
408 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); | 422 | tw-> addTab ( styletab = createStyleTab ( tw, config ), "appearance", tr( "Style" )); |
409 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); | 423 | tw-> addTab ( createFontTab ( tw, config ), "font", tr( "Font" )); |
410 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); | 424 | tw-> addTab ( createColorTab ( tw, config ), "appearance/color", tr( "Colors" ) ); |
411 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); | 425 | tw-> addTab ( createDecoTab ( tw, config ), "appearance/deco", tr( "Windows" ) ); |
412 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); | 426 | tw-> addTab ( m_advtab = createAdvancedTab ( tw, config ), "SettingsIcon", tr( "Advanced" ) ); |
413 | 427 | ||
414 | top-> addWidget ( tw, 10 ); | 428 | top-> addWidget ( tw, 10 ); |
415 | top-> addWidget ( m_sample, 1 ); | 429 | top-> addWidget ( m_sample, 1 ); |
416 | 430 | ||
417 | tw-> setCurrentTab ( styletab ); | 431 | tw-> setCurrentTab ( styletab ); |
418 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); | 432 | connect ( tw, SIGNAL( currentChanged(QWidget*)), this, SLOT( tabChanged(QWidget*))); |
419 | 433 | ||
420 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; | 434 | m_style_changed = m_font_changed = m_color_changed = m_deco_changed = false; |
421 | } | 435 | } |
422 | 436 | ||
423 | Appearance::~Appearance() | 437 | Appearance::~Appearance() |
424 | {} | 438 | {} |
425 | 439 | ||
426 | void Appearance::tabChanged ( QWidget *w ) | 440 | void Appearance::tabChanged ( QWidget *w ) |
427 | { | 441 | { |
428 | if ( w == m_advtab ) | 442 | if ( w == m_advtab ) |
429 | { | 443 | { |
430 | m_sample-> hide ( ); | 444 | m_sample-> hide ( ); |
431 | updateGeometry ( ); // shouldn't be necessary ... | 445 | updateGeometry ( ); // shouldn't be necessary ... |
432 | } | 446 | } |
433 | else | 447 | else |
434 | m_sample-> show ( ); | 448 | m_sample-> show ( ); |
435 | } | 449 | } |
436 | 450 | ||
437 | void Appearance::accept ( ) | 451 | void Appearance::accept ( ) |
438 | { | 452 | { |
439 | bool newtabpos = m_tabstyle_top-> isChecked ( ); | 453 | bool newtabpos = m_tabstyle_top-> isChecked ( ); |
440 | int newtabstyle = m_tabstyle_list-> currentItem ( ); | 454 | int newtabstyle = m_tabstyle_list-> currentItem ( ); |
441 | 455 | ||
442 | Config config ( "qpe" ); | 456 | Config config ( "qpe" ); |
443 | config. setGroup ( "Appearance" ); | 457 | config. setGroup ( "Appearance" ); |
444 | 458 | ||
445 | if ( m_style_changed ) | 459 | if ( m_style_changed ) |
446 | { | 460 | { |
447 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 461 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
448 | if ( item ) | 462 | if ( item ) |
449 | config.writeEntry( "Style", item-> key ( )); | 463 | config.writeEntry( "Style", item-> key ( )); |
450 | } | 464 | } |
451 | 465 | ||
452 | if ( m_deco_changed ) | 466 | if ( m_deco_changed ) |
453 | { | 467 | { |
454 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); | 468 | DecoListItem *item = (DecoListItem *) m_deco_list-> item ( m_deco_list-> currentItem ( )); |
455 | if ( item ) | 469 | if ( item ) |
456 | config.writeEntry( "Decoration", item-> key ( )); | 470 | config.writeEntry( "Decoration", item-> key ( )); |
457 | } | 471 | } |
458 | 472 | ||
459 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) | 473 | if (( newtabstyle != m_original_tabstyle ) || ( newtabpos != m_original_tabpos )) |
460 | { | 474 | { |
461 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); | 475 | config. writeEntry ( "TabStyle", newtabstyle + 1 ); |
462 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); | 476 | config. writeEntry ( "TabPosition", newtabpos ? "Top" : "Bottom" ); |
463 | } | 477 | } |
464 | 478 | ||
465 | if ( m_font_changed ) | 479 | if ( m_font_changed ) |
466 | { | 480 | { |
467 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); | 481 | config. writeEntry ( "FontFamily", m_fontselect-> fontFamily ( )); |
468 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); | 482 | config. writeEntry ( "FontStyle", m_fontselect-> fontStyle ( )); |
469 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); | 483 | config. writeEntry ( "FontSize", m_fontselect-> fontSize ( )); |
470 | } | 484 | } |
471 | 485 | ||
472 | 486 | ||
473 | if ( m_color_changed ) | 487 | if ( m_color_changed ) |
474 | { | 488 | { |
475 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 489 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
476 | 490 | ||
477 | if ( item ) | 491 | if ( item ) |
478 | item-> save ( config ); | 492 | item-> save ( config ); |
479 | } | 493 | } |
480 | 494 | ||
481 | ODirection rot; | 495 | ODirection rot; |
482 | if (m_rotdir_ccw-> isChecked ( )) | 496 | if (m_rotdir_ccw-> isChecked ( )) |
483 | { | 497 | { |
484 | rot = CCW; | 498 | rot = CCW; |
485 | } | 499 | } |
486 | else if (m_rotdir_cw-> isChecked ( )) | 500 | else if (m_rotdir_cw-> isChecked ( )) |
487 | { | 501 | { |
488 | rot = CW; | 502 | rot = CW; |
489 | } | 503 | } |
490 | else | 504 | else |
491 | { | 505 | { |
492 | rot = Flip; | 506 | rot = Flip; |
493 | } | 507 | } |
494 | config. writeEntry ( "rotatedir", (int)rot ); | 508 | config. writeEntry ( "rotatedir", (int)rot ); |
495 | 509 | ||
510 | config. writeEntry( "LeftHand", m_leftHand->isChecked() ); | ||
511 | |||
496 | config. write ( ); // need to flush the config info first | 512 | config. write ( ); // need to flush the config info first |
497 | Global::applyStyle ( ); | 513 | Global::applyStyle ( ); |
498 | 514 | ||
499 | QDialog::accept ( ); | 515 | QDialog::accept ( ); |
500 | } | 516 | } |
501 | 517 | ||
502 | void Appearance::done ( int r ) | 518 | void Appearance::done ( int r ) |
503 | { | 519 | { |
504 | QDialog::done ( r ); | 520 | QDialog::done ( r ); |
505 | close ( ); | 521 | close ( ); |
506 | } | 522 | } |
507 | 523 | ||
508 | 524 | ||
509 | void Appearance::styleClicked ( int index ) | 525 | void Appearance::styleClicked ( int index ) |
510 | { | 526 | { |
511 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); | 527 | StyleListItem *sli = (StyleListItem *) m_style_list-> item ( index ); |
512 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); | 528 | m_style_settings-> setEnabled ( sli ? sli-> hasSettings ( ) : false ); |
513 | 529 | ||
514 | if ( m_sample && sli && sli-> style ( )) | 530 | if ( m_sample && sli && sli-> style ( )) |
515 | { | 531 | { |
516 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; | 532 | int ci = m_color_list ? m_color_list-> currentItem ( ) : -1; |
517 | 533 | ||
518 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); | 534 | m_sample-> setStyle2 ( sli-> style ( ), ci < 0 ? palette ( ) : ((ColorListItem *) m_color_list-> item ( ci ))-> palette ( )); |
519 | } | 535 | } |
520 | 536 | ||
521 | m_style_changed |= ( index != m_original_style ); | 537 | m_style_changed |= ( index != m_original_style ); |
522 | } | 538 | } |
523 | 539 | ||
524 | void Appearance::styleSettingsClicked ( ) | 540 | void Appearance::styleSettingsClicked ( ) |
525 | { | 541 | { |
526 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); | 542 | StyleListItem *item = (StyleListItem *) m_style_list-> item ( m_style_list-> currentItem ( )); |
527 | 543 | ||
528 | if ( item && item-> hasSettings ( )) | 544 | if ( item && item-> hasSettings ( )) |
529 | { | 545 | { |
530 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); | 546 | QDialog *d = new QDialog ( this, "SETTINGS-DLG", true ); |
531 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); | 547 | QVBoxLayout *vbox = new QVBoxLayout ( d, 3, 0 ); |
532 | 548 | ||
533 | QWidget *w = item-> settings ( d ); | 549 | QWidget *w = item-> settings ( d ); |
534 | 550 | ||
535 | if ( w ) | 551 | if ( w ) |
536 | { | 552 | { |
537 | vbox-> addWidget ( w ); | 553 | vbox-> addWidget ( w ); |
538 | 554 | ||
539 | d-> setCaption ( w-> caption ( )); | 555 | d-> setCaption ( w-> caption ( )); |
540 | 556 | ||
541 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); | 557 | bool accepted = ( QPEApplication::execDialog ( d ) == QDialog::Accepted ); |
542 | 558 | ||
543 | if ( item-> setSettings ( accepted )) | 559 | if ( item-> setSettings ( accepted )) |
544 | m_style_changed = true; | 560 | m_style_changed = true; |
545 | } | 561 | } |
546 | delete d; | 562 | delete d; |
547 | } | 563 | } |
548 | } | 564 | } |
549 | 565 | ||
550 | void Appearance::decoClicked ( int index ) | 566 | void Appearance::decoClicked ( int index ) |
551 | { | 567 | { |
552 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); | 568 | DecoListItem *dli = (DecoListItem *) m_deco_list-> item ( index ); |
553 | 569 | ||
554 | if ( m_sample ) | 570 | if ( m_sample ) |
555 | { | 571 | { |
556 | if ( dli && dli-> interface ( )) | 572 | if ( dli && dli-> interface ( )) |
557 | m_sample-> setDecoration ( dli-> interface ( )); | 573 | m_sample-> setDecoration ( dli-> interface ( )); |
558 | else | 574 | else |
559 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); | 575 | m_sample-> setDecoration ( new DefaultWindowDecoration ( )); |
560 | m_sample-> repaint ( ); | 576 | m_sample-> repaint ( ); |
561 | } | 577 | } |
562 | m_deco_changed |= ( index != m_original_deco ); | 578 | m_deco_changed |= ( index != m_original_deco ); |
563 | } | 579 | } |
564 | 580 | ||
565 | void Appearance::fontClicked ( const QFont &f ) | 581 | void Appearance::fontClicked ( const QFont &f ) |
566 | { | 582 | { |
567 | m_font_changed |= ( f != m_sample-> font ( )); | 583 | m_font_changed |= ( f != m_sample-> font ( )); |
568 | m_sample-> setFont ( f ); | 584 | m_sample-> setFont ( f ); |
569 | } | 585 | } |
570 | 586 | ||
571 | void Appearance::colorClicked ( int index ) | 587 | void Appearance::colorClicked ( int index ) |
572 | { | 588 | { |
573 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); | 589 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( index ); |
574 | 590 | ||
575 | if ( item ) | 591 | if ( item ) |
576 | m_sample-> setPalette ( item-> palette ( )); | 592 | m_sample-> setPalette ( item-> palette ( )); |
577 | 593 | ||
578 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); | 594 | m_color_changed |= ( item-> palette ( ) != qApp-> palette ( )); |
579 | } | 595 | } |
580 | 596 | ||
581 | 597 | ||
582 | void Appearance::editSchemeClicked ( ) | 598 | void Appearance::editSchemeClicked ( ) |
583 | { | 599 | { |
584 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); | 600 | ColorListItem *item = (ColorListItem *) m_color_list-> item ( m_color_list-> currentItem ( )); |
585 | 601 | ||
586 | int cnt = 0; | 602 | int cnt = 0; |
587 | QString labels [QColorGroup::NColorRoles]; | 603 | QString labels [QColorGroup::NColorRoles]; |
588 | QColor colors [QColorGroup::NColorRoles]; | 604 | QColor colors [QColorGroup::NColorRoles]; |
589 | 605 | ||
590 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) | 606 | for ( int role = 0; role < (int) QColorGroup::NColorRoles; ++role ) |
591 | { | 607 | { |
diff --git a/noncore/settings/appearance2/appearance.h b/noncore/settings/appearance2/appearance.h index de2f1ab..287f9f7 100644 --- a/noncore/settings/appearance2/appearance.h +++ b/noncore/settings/appearance2/appearance.h | |||
@@ -26,99 +26,100 @@ | |||
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef APPEARANCESETTINGS_H | 29 | #ifndef APPEARANCESETTINGS_H |
30 | #define APPEARANCESETTINGS_H | 30 | #define APPEARANCESETTINGS_H |
31 | 31 | ||
32 | #include <opie2/ofontselector.h> | 32 | #include <opie2/ofontselector.h> |
33 | 33 | ||
34 | #include <qpe/fontdatabase.h> | 34 | #include <qpe/fontdatabase.h> |
35 | 35 | ||
36 | #include <qdialog.h> | 36 | #include <qdialog.h> |
37 | 37 | ||
38 | using Opie::Ui::OFontSelector; | 38 | using Opie::Ui::OFontSelector; |
39 | 39 | ||
40 | class QCheckBox; | 40 | class QCheckBox; |
41 | class QComboBox; | 41 | class QComboBox; |
42 | class QLabel; | 42 | class QLabel; |
43 | class QLineEdit; | 43 | class QLineEdit; |
44 | class QListBox; | 44 | class QListBox; |
45 | class QMultiLineEdit; | 45 | class QMultiLineEdit; |
46 | class QPushButton; | 46 | class QPushButton; |
47 | class QRadioButton; | 47 | class QRadioButton; |
48 | class QToolButton; | 48 | class QToolButton; |
49 | class SampleWindow; | 49 | class SampleWindow; |
50 | namespace Opie {namespace Ui {class OFontSelector;}} | 50 | namespace Opie {namespace Ui {class OFontSelector;}} |
51 | class QListView; | 51 | class QListView; |
52 | class QListViewItem; | 52 | class QListViewItem; |
53 | class Config; | 53 | class Config; |
54 | 54 | ||
55 | class Appearance : public QDialog | 55 | class Appearance : public QDialog |
56 | { | 56 | { |
57 | Q_OBJECT | 57 | Q_OBJECT |
58 | 58 | ||
59 | public: | 59 | public: |
60 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 60 | Appearance( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
61 | ~Appearance(); | 61 | ~Appearance(); |
62 | static QString appName() { return QString::fromLatin1("appearance"); } | 62 | static QString appName() { return QString::fromLatin1("appearance"); } |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual void accept ( ); | 65 | virtual void accept ( ); |
66 | virtual void done ( int r ); | 66 | virtual void done ( int r ); |
67 | 67 | ||
68 | protected slots: | 68 | protected slots: |
69 | void styleClicked ( int ); | 69 | void styleClicked ( int ); |
70 | void styleSettingsClicked ( ); | 70 | void styleSettingsClicked ( ); |
71 | void decoClicked ( int ); | 71 | void decoClicked ( int ); |
72 | void fontClicked ( const QFont & ); | 72 | void fontClicked ( const QFont & ); |
73 | void colorClicked ( int ); | 73 | void colorClicked ( int ); |
74 | 74 | ||
75 | void editSchemeClicked(); | 75 | void editSchemeClicked(); |
76 | void saveSchemeClicked(); | 76 | void saveSchemeClicked(); |
77 | void deleteSchemeClicked(); | 77 | void deleteSchemeClicked(); |
78 | 78 | ||
79 | void tabChanged ( QWidget * ); | 79 | void tabChanged ( QWidget * ); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | void changeText(); | 82 | void changeText(); |
83 | 83 | ||
84 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); | 84 | QWidget *createStyleTab ( QWidget *parent, Config &cfg ); |
85 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); | 85 | QWidget *createDecoTab ( QWidget *parent, Config &cfg ); |
86 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); | 86 | QWidget *createFontTab ( QWidget *parent, Config &cfg ); |
87 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); | 87 | QWidget *createColorTab ( QWidget *parent, Config &cfg ); |
88 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); | 88 | QWidget *createAdvancedTab ( QWidget *parent, Config &cfg ); |
89 | 89 | ||
90 | private: | 90 | private: |
91 | bool m_style_changed; | 91 | bool m_style_changed; |
92 | bool m_font_changed; | 92 | bool m_font_changed; |
93 | bool m_scheme_changed; | 93 | bool m_scheme_changed; |
94 | bool m_deco_changed; | 94 | bool m_deco_changed; |
95 | bool m_color_changed; | 95 | bool m_color_changed; |
96 | 96 | ||
97 | int m_original_style; | 97 | int m_original_style; |
98 | int m_original_deco; | 98 | int m_original_deco; |
99 | int m_original_tabstyle; | 99 | int m_original_tabstyle; |
100 | bool m_original_tabpos; | 100 | bool m_original_tabpos; |
101 | 101 | ||
102 | QListBox * m_style_list; | 102 | QListBox * m_style_list; |
103 | QPushButton * m_style_settings; | 103 | QPushButton * m_style_settings; |
104 | 104 | ||
105 | QListBox * m_deco_list; | 105 | QListBox * m_deco_list; |
106 | 106 | ||
107 | QListBox * m_color_list; | 107 | QListBox * m_color_list; |
108 | 108 | ||
109 | Opie::Ui::OFontSelector *m_fontselect; | 109 | Opie::Ui::OFontSelector *m_fontselect; |
110 | 110 | ||
111 | SampleWindow *m_sample; | 111 | SampleWindow *m_sample; |
112 | 112 | ||
113 | QComboBox * m_tabstyle_list; | 113 | QComboBox * m_tabstyle_list; |
114 | QRadioButton *m_tabstyle_top; | 114 | QRadioButton *m_tabstyle_top; |
115 | QRadioButton *m_tabstyle_bottom; | 115 | QRadioButton *m_tabstyle_bottom; |
116 | 116 | ||
117 | QRadioButton *m_rotdir_cw; | 117 | QRadioButton *m_rotdir_cw; |
118 | QRadioButton *m_rotdir_ccw; | 118 | QRadioButton *m_rotdir_ccw; |
119 | QRadioButton *m_rotdir_flip; | 119 | QRadioButton *m_rotdir_flip; |
120 | 120 | ||
121 | QWidget * m_advtab; | 121 | QWidget * m_advtab; |
122 | QCheckBox *m_leftHand; | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | #endif | 125 | #endif |