author | mickeyl <mickeyl> | 2005-01-11 17:32:06 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-01-11 17:32:06 (UTC) |
commit | f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc (patch) (unidiff) | |
tree | db41b30ad733fc476746e1a9c7576a5a083240fa | |
parent | f82173157bdba4fa99afde9cc999bfe9b511ce07 (diff) | |
download | opie-f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc.zip opie-f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc.tar.gz opie-f8fd8556da5649f54af740a5dbb9a8c1ead2bcfc.tar.bz2 |
finish per-tab column setting. it now works on the fly and is persistent
-rw-r--r-- | core/launcher/launcher.cpp | 7 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 2 | ||||
-rw-r--r-- | core/settings/launcher/tabconfig.h | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabdialog.cpp | 1 | ||||
-rw-r--r-- | core/settings/launcher/tabssettings.cpp | 6 |
5 files changed, 15 insertions, 2 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 4f81076..4255b44 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -354,128 +354,135 @@ void LauncherTabWidget::setProgressStyle() | |||
354 | * bkc - 17/6/2004 | 354 | * bkc - 17/6/2004 |
355 | * | 355 | * |
356 | */ | 356 | */ |
357 | 357 | ||
358 | void LauncherTabWidget::setBusy(bool on) | 358 | void LauncherTabWidget::setBusy(bool on) |
359 | { | 359 | { |
360 | if ( on ) | 360 | if ( on ) |
361 | currentView()->setBusy(TRUE); | 361 | currentView()->setBusy(TRUE); |
362 | else { | 362 | else { |
363 | for ( int i = 0; i < categoryBar->count(); i++ ) { | 363 | for ( int i = 0; i < categoryBar->count(); i++ ) { |
364 | if (categoryBar->tab(i)) { | 364 | if (categoryBar->tab(i)) { |
365 | LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; | 365 | LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; |
366 | view->setBusy( FALSE ); | 366 | view->setBusy( FALSE ); |
367 | } else { | 367 | } else { |
368 | odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl; | 368 | odebug << "Averting Disaster with tab " << i << " == NULL! " << oendl; |
369 | } | 369 | } |
370 | } | 370 | } |
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { | 374 | void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { |
375 | for (int i = 0; i < categoryBar->count(); i++ ) { | 375 | for (int i = 0; i < categoryBar->count(); i++ ) { |
376 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; | 376 | LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; |
377 | view->setBusyIndicatorType( str ); | 377 | view->setBusyIndicatorType( str ); |
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | LauncherView *LauncherTabWidget::currentView(void) | 381 | LauncherView *LauncherTabWidget::currentView(void) |
382 | { | 382 | { |
383 | return (LauncherView*)stack->visibleWidget(); | 383 | return (LauncherView*)stack->visibleWidget(); |
384 | } | 384 | } |
385 | 385 | ||
386 | 386 | ||
387 | 387 | ||
388 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) | 388 | void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) |
389 | { | 389 | { |
390 | QDataStream stream( data, IO_ReadOnly ); | 390 | QDataStream stream( data, IO_ReadOnly ); |
391 | if ( msg == "setTabView(QString,int)" ) { | 391 | if ( msg == "setTabView(QString,int)" ) { |
392 | QString id; | 392 | QString id; |
393 | stream >> id; | 393 | stream >> id; |
394 | int mode; | 394 | int mode; |
395 | stream >> mode; | 395 | stream >> mode; |
396 | if ( view(id) ) | 396 | if ( view(id) ) |
397 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 397 | view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
398 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 398 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
399 | QString id; | 399 | QString id; |
400 | stream >> id; | 400 | stream >> id; |
401 | int mode; | 401 | int mode; |
402 | stream >> mode; | 402 | stream >> mode; |
403 | QString pixmapOrColor; | 403 | QString pixmapOrColor; |
404 | stream >> pixmapOrColor; | 404 | stream >> pixmapOrColor; |
405 | if ( view(id) ) | 405 | if ( view(id) ) |
406 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 406 | view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
407 | if ( id == "Documents" ) | 407 | if ( id == "Documents" ) |
408 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 408 | docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
409 | } else if ( msg == "setTextColor(QString,QString)" ) { | 409 | } else if ( msg == "setTextColor(QString,QString)" ) { |
410 | QString id; | 410 | QString id; |
411 | stream >> id; | 411 | stream >> id; |
412 | QString color; | 412 | QString color; |
413 | stream >> color; | 413 | stream >> color; |
414 | if ( view(id) ) | 414 | if ( view(id) ) |
415 | view(id)->setTextColor( QColor(color) ); | 415 | view(id)->setTextColor( QColor(color) ); |
416 | if ( id == "Documents" ) | 416 | if ( id == "Documents" ) |
417 | docLoadingWidget->setTextColor( QColor(color) ); | 417 | docLoadingWidget->setTextColor( QColor(color) ); |
418 | } else if ( msg == "setIconColumns(QString,int)" ) { | ||
419 | QString id; | ||
420 | stream >> id; | ||
421 | int number; | ||
422 | stream >> number; | ||
423 | if ( view(id ) ) | ||
424 | view(id)->setColNumber( number ); | ||
418 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 425 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
419 | QString id; | 426 | QString id; |
420 | stream >> id; | 427 | stream >> id; |
421 | QString fam; | 428 | QString fam; |
422 | stream >> fam; | 429 | stream >> fam; |
423 | int size; | 430 | int size; |
424 | stream >> size; | 431 | stream >> size; |
425 | int weight; | 432 | int weight; |
426 | stream >> weight; | 433 | stream >> weight; |
427 | int italic; | 434 | int italic; |
428 | stream >> italic; | 435 | stream >> italic; |
429 | if ( view(id) ) { | 436 | if ( view(id) ) { |
430 | if ( !fam.isEmpty() ) { | 437 | if ( !fam.isEmpty() ) { |
431 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 438 | view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
432 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; | 439 | odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; |
433 | } else { | 440 | } else { |
434 | view(id)->clearViewFont(); | 441 | view(id)->clearViewFont(); |
435 | } | 442 | } |
436 | } | 443 | } |
437 | }else if ( msg == "setBusyIndicatorType(QString)" ) { | 444 | }else if ( msg == "setBusyIndicatorType(QString)" ) { |
438 | QString type; | 445 | QString type; |
439 | stream >> type; | 446 | stream >> type; |
440 | setBusyIndicatorType( type ); | 447 | setBusyIndicatorType( type ); |
441 | }else if ( msg == "home()" ) { | 448 | }else if ( msg == "home()" ) { |
442 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { | 449 | if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { |
443 | if (categoryBar) | 450 | if (categoryBar) |
444 | categoryBar->nextTab(); | 451 | categoryBar->nextTab(); |
445 | }else { | 452 | }else { |
446 | static_cast<QWidget*>(parent())->raise(); | 453 | static_cast<QWidget*>(parent())->raise(); |
447 | } | 454 | } |
448 | } else if (msg=="doctabEnabled(int)") { | 455 | } else if (msg=="doctabEnabled(int)") { |
449 | int id; stream >> id; | 456 | int id; stream >> id; |
450 | odebug << "Doctab enabled " << id << oendl; | 457 | odebug << "Doctab enabled " << id << oendl; |
451 | reCheckDoctab(id); | 458 | reCheckDoctab(id); |
452 | } | 459 | } |
453 | } | 460 | } |
454 | 461 | ||
455 | void LauncherTabWidget::reCheckDoctab(int how) | 462 | void LauncherTabWidget::reCheckDoctab(int how) |
456 | { | 463 | { |
457 | if ((bool)how == docTabEnabled) { | 464 | if ((bool)how == docTabEnabled) { |
458 | /* nothing to do */ | 465 | /* nothing to do */ |
459 | return; | 466 | return; |
460 | } | 467 | } |
461 | if (docLoadingWidget) { | 468 | if (docLoadingWidget) { |
462 | stack->removeWidget(docLoadingWidget); | 469 | stack->removeWidget(docLoadingWidget); |
463 | delete docLoadingWidget; | 470 | delete docLoadingWidget; |
464 | docLoadingWidget = 0; | 471 | docLoadingWidget = 0; |
465 | } | 472 | } |
466 | createDocLoadingWidget(); | 473 | createDocLoadingWidget(); |
467 | { | 474 | { |
468 | QCopEnvelope( "QPE/System", "reforceDocuments()" ); | 475 | QCopEnvelope( "QPE/System", "reforceDocuments()" ); |
469 | odebug << "Sending doc rescan" << oendl; | 476 | odebug << "Sending doc rescan" << oendl; |
470 | } | 477 | } |
471 | } | 478 | } |
472 | 479 | ||
473 | //--------------------------------------------------------------------------- | 480 | //--------------------------------------------------------------------------- |
474 | 481 | ||
475 | Launcher::Launcher() | 482 | Launcher::Launcher() |
476 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 483 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
477 | { | 484 | { |
478 | tabs = 0; | 485 | tabs = 0; |
479 | tb = 0; | 486 | tb = 0; |
480 | Config cfg( "Launcher" ); | 487 | Config cfg( "Launcher" ); |
481 | cfg.setGroup( "DocTab" ); | 488 | cfg.setGroup( "DocTab" ); |
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 9d78c0d..2b34cc5 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -578,129 +578,129 @@ void LauncherIconView::addItem(AppLnk* app, bool resort) | |||
578 | } | 578 | } |
579 | } | 579 | } |
580 | 580 | ||
581 | void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink) | 581 | void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink) |
582 | { | 582 | { |
583 | QString oldfile = old.file(); | 583 | QString oldfile = old.file(); |
584 | QString newfile = nlink->file(); | 584 | QString newfile = nlink->file(); |
585 | 585 | ||
586 | if (newfile != oldfile) { | 586 | if (newfile != oldfile) { |
587 | QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile); | 587 | QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile); |
588 | if (it != sm_EyeCache->end()) { | 588 | if (it != sm_EyeCache->end()) { |
589 | (*sm_EyeCache)[newfile]=(*it); | 589 | (*sm_EyeCache)[newfile]=(*it); |
590 | } | 590 | } |
591 | removeLink(old.linkFile()); | 591 | removeLink(old.linkFile()); |
592 | } else { | 592 | } else { |
593 | removeLink(old.linkFile(),false); | 593 | removeLink(old.linkFile(),false); |
594 | } | 594 | } |
595 | addItem(nlink,false); | 595 | addItem(nlink,false); |
596 | } | 596 | } |
597 | 597 | ||
598 | void LauncherIconView::timerEvent( QTimerEvent *te ) | 598 | void LauncherIconView::timerEvent( QTimerEvent *te ) |
599 | { | 599 | { |
600 | if ( te->timerId() == busyTimer ) { | 600 | if ( te->timerId() == busyTimer ) { |
601 | if ( bsy ) | 601 | if ( bsy ) |
602 | bsy->animateIcon(); | 602 | bsy->animateIcon(); |
603 | } else { | 603 | } else { |
604 | QIconView::timerEvent( te ); | 604 | QIconView::timerEvent( te ); |
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | void LauncherIconView::setBigIcons( bool bi ) | 608 | void LauncherIconView::setBigIcons( bool bi ) |
609 | { | 609 | { |
610 | sm_EyeCache->clear(); | 610 | sm_EyeCache->clear(); |
611 | bigIcns = bi; | 611 | bigIcns = bi; |
612 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY | 612 | #ifdef USE_ANIMATED_BUSY_ICON_OVERLAY |
613 | busyPix.resize(0,0); | 613 | busyPix.resize(0,0); |
614 | #endif | 614 | #endif |
615 | } | 615 | } |
616 | 616 | ||
617 | QIconViewItem* LauncherIconView::busyItem() const | 617 | QIconViewItem* LauncherIconView::busyItem() const |
618 | { | 618 | { |
619 | return bsy; | 619 | return bsy; |
620 | } | 620 | } |
621 | 621 | ||
622 | void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } | 622 | void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } |
623 | 623 | ||
624 | void LauncherIconView::calculateGrid( ItemTextPos pos ) | 624 | void LauncherIconView::calculateGrid( ItemTextPos pos ) |
625 | { | 625 | { |
626 | int dw = QApplication::desktop()->width(); | 626 | int dw = QApplication::desktop()->width(); |
627 | int viewerWidth = dw-style().scrollBarExtent().width(); | 627 | int viewerWidth = dw-style().scrollBarExtent().width(); |
628 | if ( pos == Bottom ) { | 628 | if ( pos == Bottom ) { |
629 | if( !numColumns ) { | 629 | if( !numColumns ) { |
630 | if ( viewerWidth <= 200 ) numColumns = 2; | 630 | if ( viewerWidth <= 200 ) numColumns = 2; |
631 | else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96; | 631 | else if ( viewerWidth >= 400 ) numColumns = viewerWidth/96; |
632 | else numColumns = 3; | 632 | else numColumns = 3; |
633 | } | 633 | } |
634 | setSpacing( 4 ); | 634 | setSpacing( 4 ); |
635 | setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); | 635 | setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); |
636 | setGridY( fontMetrics().height()*2+24 ); | 636 | setGridY( fontMetrics().height()*2+24 ); |
637 | } else { | 637 | } else { |
638 | if( !numColumns ) { | 638 | if( !numColumns ) { |
639 | if ( viewerWidth < 150 ) numColumns = 1; | 639 | if ( viewerWidth < 150 ) numColumns = 1; |
640 | else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150; | 640 | else if ( viewerWidth >= 400 ) numColumns = viewerWidth/150; |
641 | else numColumns = 2; | 641 | else numColumns = 2; |
642 | } | 642 | } |
643 | setSpacing( 2 ); | 643 | setSpacing( 2 ); |
644 | setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); | 644 | setGridX( (viewerWidth-(numColumns+1)*spacing())/numColumns ); |
645 | setGridY( fontMetrics().height()+2 ); | 645 | setGridY( fontMetrics().height()+2 ); |
646 | } | 646 | } |
647 | } | 647 | } |
648 | 648 | ||
649 | void LauncherIconView::styleChange( QStyle &old ) | 649 | void LauncherIconView::styleChange( QStyle &old ) |
650 | { | 650 | { |
651 | QIconView::styleChange( old ); | 651 | QIconView::styleChange( old ); |
652 | calculateGrid( itemTextPos() ); | 652 | calculateGrid( itemTextPos() ); |
653 | } | 653 | } |
654 | 654 | ||
655 | void LauncherIconView::keyPressEvent(QKeyEvent* e) | 655 | void LauncherIconView::keyPressEvent(QKeyEvent* e) |
656 | { | 656 | { |
657 | ike = TRUE; | 657 | ike = TRUE; |
658 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { | 658 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { |
659 | if ( (e->state() & ShiftButton) ) | 659 | if ( (e->state() & ShiftButton) ) |
660 | emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); | 660 | emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); |
661 | else | 661 | else |
662 | returnPressed(currentItem()); | 662 | returnPressed(currentItem()); |
663 | } | 663 | } |
664 | 664 | ||
665 | QIconView::keyPressEvent(e); | 665 | QIconView::keyPressEvent(e); |
666 | ike = FALSE; | 666 | ike = FALSE; |
667 | } | 667 | } |
668 | 668 | ||
669 | //=========================================================================== | 669 | //=========================================================================== |
670 | // Implemantation of LauncherIconview end | 670 | // Implemantation of LauncherIconview end |
671 | //=========================================================================== | 671 | //=========================================================================== |
672 | 672 | ||
673 | 673 | ||
674 | //=========================================================================== | 674 | //=========================================================================== |
675 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) | 675 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) |
676 | : QVBox( parent, name, fl ) | 676 | : QVBox( parent, name, fl ) |
677 | { | 677 | { |
678 | catmb = 0; | 678 | catmb = 0; |
679 | icons = new LauncherIconView( this ); | 679 | icons = new LauncherIconView( this ); |
680 | setFocusProxy(icons); | 680 | setFocusProxy(icons); |
681 | QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); | 681 | QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); |
682 | 682 | ||
683 | icons->setItemsMovable( FALSE ); | 683 | icons->setItemsMovable( FALSE ); |
684 | icons->setAutoArrange( TRUE ); | 684 | icons->setAutoArrange( TRUE ); |
685 | icons->setSorting( TRUE ); | 685 | icons->setSorting( TRUE ); |
686 | icons->setFrameStyle( QFrame::NoFrame ); | 686 | icons->setFrameStyle( QFrame::NoFrame ); |
687 | icons->setMargin( 0 ); | 687 | icons->setMargin( 0 ); |
688 | icons->setSelectionMode( QIconView::NoSelection ); | 688 | icons->setSelectionMode( QIconView::NoSelection ); |
689 | icons->setBackgroundMode( PaletteBase ); | 689 | icons->setBackgroundMode( PaletteBase ); |
690 | icons->setResizeMode( QIconView::Adjust ); | 690 | icons->setResizeMode( QIconView::Adjust ); |
691 | vmode = (ViewMode)-1; | 691 | vmode = (ViewMode)-1; |
692 | setViewMode( Icon ); | 692 | setViewMode( Icon ); |
693 | 693 | ||
694 | connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), | 694 | connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), |
695 | SLOT(itemClicked(int,QIconViewItem*)) ); | 695 | SLOT(itemClicked(int,QIconViewItem*)) ); |
696 | connect( icons, SIGNAL(selectionChanged()), | 696 | connect( icons, SIGNAL(selectionChanged()), |
697 | SLOT(selectionChanged()) ); | 697 | SLOT(selectionChanged()) ); |
698 | connect( icons, SIGNAL(returnPressed(QIconViewItem*)), | 698 | connect( icons, SIGNAL(returnPressed(QIconViewItem*)), |
699 | SLOT(returnPressed(QIconViewItem*)) ); | 699 | SLOT(returnPressed(QIconViewItem*)) ); |
700 | connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), | 700 | connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), |
701 | SLOT(itemPressed(int,QIconViewItem*)) ); | 701 | SLOT(itemPressed(int,QIconViewItem*)) ); |
702 | 702 | ||
703 | tools = 0; | 703 | tools = 0; |
704 | setBackgroundType( Ruled, QString::null ); | 704 | setBackgroundType( Ruled, QString::null ); |
705 | } | 705 | } |
706 | 706 | ||
diff --git a/core/settings/launcher/tabconfig.h b/core/settings/launcher/tabconfig.h index 7844673..9ea2418 100644 --- a/core/settings/launcher/tabconfig.h +++ b/core/settings/launcher/tabconfig.h | |||
@@ -1,73 +1,74 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | #ifndef __TABCONFIG_H__ | 27 | #ifndef __TABCONFIG_H__ |
28 | #define __TABCONFIG_H__ | 28 | #define __TABCONFIG_H__ |
29 | 29 | ||
30 | struct TabConfig { | 30 | struct TabConfig { |
31 | enum ViewMode { | 31 | enum ViewMode { |
32 | Icon, | 32 | Icon, |
33 | List | 33 | List |
34 | }; | 34 | }; |
35 | enum BackgroundType { | 35 | enum BackgroundType { |
36 | Ruled, | 36 | Ruled, |
37 | SolidColor, | 37 | SolidColor, |
38 | Image | 38 | Image |
39 | }; | 39 | }; |
40 | 40 | ||
41 | ViewMode m_view; | 41 | ViewMode m_view; |
42 | BackgroundType m_bg_type; | 42 | BackgroundType m_bg_type; |
43 | QString m_last_directory; | 43 | QString m_last_directory; |
44 | QString m_bg_image; | 44 | QString m_bg_image; |
45 | QString m_bg_color; | 45 | QString m_bg_color; |
46 | int m_iconcolumns; | 46 | int m_iconcolumns; |
47 | QString m_text_color; | 47 | QString m_text_color; |
48 | bool m_font_use; | 48 | bool m_font_use; |
49 | QString m_font_family; | 49 | QString m_font_family; |
50 | int m_font_size; | 50 | int m_font_size; |
51 | int m_font_weight; | 51 | int m_font_weight; |
52 | bool m_font_italic; | 52 | bool m_font_italic; |
53 | bool m_changed; | 53 | bool m_changed; |
54 | 54 | ||
55 | bool operator == ( const TabConfig &tc ) | 55 | bool operator == ( const TabConfig &tc ) |
56 | { | 56 | { |
57 | return ( m_view == tc. m_view ) && | 57 | return ( m_view == tc. m_view ) && |
58 | ( m_bg_type == tc. m_bg_type ) && | 58 | ( m_bg_type == tc. m_bg_type ) && |
59 | ( m_bg_image == tc. m_bg_image ) && | 59 | ( m_bg_image == tc. m_bg_image ) && |
60 | ( m_bg_color == tc. m_bg_color ) && | 60 | ( m_bg_color == tc. m_bg_color ) && |
61 | ( m_iconcolumns == tc. m_iconcolumns ) && | ||
61 | ( m_text_color == tc. m_text_color ) && | 62 | ( m_text_color == tc. m_text_color ) && |
62 | ( m_font_use == tc. m_font_use ) && | 63 | ( m_font_use == tc. m_font_use ) && |
63 | ( m_font_use ? ( | 64 | ( m_font_use ? ( |
64 | ( m_font_family == tc. m_font_family ) && | 65 | ( m_font_family == tc. m_font_family ) && |
65 | ( m_font_size == tc. m_font_size ) && | 66 | ( m_font_size == tc. m_font_size ) && |
66 | ( m_font_weight == tc. m_font_weight ) && | 67 | ( m_font_weight == tc. m_font_weight ) && |
67 | ( m_font_italic == tc. m_font_italic ) | 68 | ( m_font_italic == tc. m_font_italic ) |
68 | ) : true ); | 69 | ) : true ); |
69 | 70 | ||
70 | } | 71 | } |
71 | }; | 72 | }; |
72 | 73 | ||
73 | #endif | 74 | #endif |
diff --git a/core/settings/launcher/tabdialog.cpp b/core/settings/launcher/tabdialog.cpp index abe310f..bd51628 100644 --- a/core/settings/launcher/tabdialog.cpp +++ b/core/settings/launcher/tabdialog.cpp | |||
@@ -244,128 +244,129 @@ public: | |||
244 | } | 244 | } |
245 | 245 | ||
246 | void setBackgroundPixmap ( const QPixmap &pm ) | 246 | void setBackgroundPixmap ( const QPixmap &pm ) |
247 | { | 247 | { |
248 | m_bgpix = pm; | 248 | m_bgpix = pm; |
249 | } | 249 | } |
250 | 250 | ||
251 | void setBackgroundColor ( const QColor &c ) | 251 | void setBackgroundColor ( const QColor &c ) |
252 | { | 252 | { |
253 | m_bgcolor = c; | 253 | m_bgcolor = c; |
254 | } | 254 | } |
255 | 255 | ||
256 | void drawBackground ( QPainter *p, const QRect &r ) | 256 | void drawBackground ( QPainter *p, const QRect &r ) |
257 | { | 257 | { |
258 | if ( !m_bgpix. isNull ( )) { | 258 | if ( !m_bgpix. isNull ( )) { |
259 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), | 259 | p-> drawTiledPixmap ( r, m_bgpix, QPoint (( r. x ( ) + contentsX ( )) % m_bgpix. width ( ), |
260 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); | 260 | ( r. y ( ) + contentsY ( )) % m_bgpix. height ( ))); |
261 | } | 261 | } |
262 | else | 262 | else |
263 | p-> fillRect ( r, m_bgcolor ); | 263 | p-> fillRect ( r, m_bgcolor ); |
264 | } | 264 | } |
265 | 265 | ||
266 | private: | 266 | private: |
267 | QColor m_textcolor; | 267 | QColor m_textcolor; |
268 | QColor m_bgcolor; | 268 | QColor m_bgcolor; |
269 | QPixmap m_bgpix; | 269 | QPixmap m_bgpix; |
270 | TabConfig::BackgroundType m_bgtype; | 270 | TabConfig::BackgroundType m_bgtype; |
271 | }; | 271 | }; |
272 | 272 | ||
273 | 273 | ||
274 | 274 | ||
275 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) | 275 | TabDialog::TabDialog ( const QPixmap *tabicon, const QString &tabname, TabConfig &tc, QWidget *parent, const char *dname, bool modal, WFlags fl ) |
276 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) | 276 | : QDialog ( parent, dname, modal, fl | WStyle_ContextHelp ), m_tc ( tc ) |
277 | { | 277 | { |
278 | setCaption ( tr( "Edit Tab" )); | 278 | setCaption ( tr( "Edit Tab" )); |
279 | 279 | ||
280 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); | 280 | QVBoxLayout *lay = new QVBoxLayout ( this, 3, 3 ); |
281 | 281 | ||
282 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); | 282 | OTabWidget *tw = new OTabWidget ( this, "tabwidget", OTabWidget::Global, OTabWidget::Bottom ); |
283 | QWidget *bgtab; | 283 | QWidget *bgtab; |
284 | 284 | ||
285 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); | 285 | tw-> addTab ( bgtab = createBgTab ( tw ), "appearance/color", tr( "Background" )); |
286 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); | 286 | tw-> addTab ( createFontTab ( tw ), "font", tr( "Font" )); |
287 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); | 287 | tw-> addTab ( createIconTab ( tw ), "pixmap", tr( "Icons" ) ); |
288 | 288 | ||
289 | tw-> setCurrentTab ( bgtab ); | 289 | tw-> setCurrentTab ( bgtab ); |
290 | 290 | ||
291 | QWidget *sample = new QVBox ( this ); | 291 | QWidget *sample = new QVBox ( this ); |
292 | QTabBar *tb = new QTabBar ( sample ); | 292 | QTabBar *tb = new QTabBar ( sample ); |
293 | QString name ( tr( "Previewing %1" ). arg ( tabname )); | 293 | QString name ( tr( "Previewing %1" ). arg ( tabname )); |
294 | 294 | ||
295 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); | 295 | tb-> addTab ( tabicon ? new QTab ( *tabicon, name ) : new QTab ( name )); |
296 | 296 | ||
297 | m_sample = new SampleView ( sample ); | 297 | m_sample = new SampleView ( sample ); |
298 | 298 | ||
299 | lay-> addWidget ( tw, 10 ); | 299 | lay-> addWidget ( tw, 10 ); |
300 | lay-> addWidget ( sample, 1 ); | 300 | lay-> addWidget ( sample, 1 ); |
301 | 301 | ||
302 | m_iconsize-> setButton ( tc. m_view ); | 302 | m_iconsize-> setButton ( tc. m_view ); |
303 | iconSizeClicked ( tc. m_view ); | 303 | iconSizeClicked ( tc. m_view ); |
304 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); | 304 | //m_iconcolor-> setColor ( QColor ( m_tc. m_text_color )); |
305 | iconColorClicked ( m_iconcolor-> color ( )); | 305 | iconColorClicked ( m_iconcolor-> color ( )); |
306 | m_bgtype-> setButton ( tc. m_bg_type ); | 306 | m_bgtype-> setButton ( tc. m_bg_type ); |
307 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); | 307 | //m_solidcolor-> setColor ( QColor ( tc. m_bg_color )); |
308 | m_iconcolumns->setValue( tc. m_iconcolumns ); | ||
308 | m_bgimage = tc. m_bg_image; | 309 | m_bgimage = tc. m_bg_image; |
309 | bgTypeClicked ( tc. m_bg_type ); | 310 | bgTypeClicked ( tc. m_bg_type ); |
310 | m_fontuse-> setChecked ( tc. m_font_use ); | 311 | m_fontuse-> setChecked ( tc. m_font_use ); |
311 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); | 312 | m_fontselect-> setSelectedFont ( QFont ( tc. m_font_family, tc. m_font_size, tc. m_font_weight, tc. m_font_italic )); |
312 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); | 313 | m_fontselect-> setEnabled ( m_fontuse-> isChecked ( )); |
313 | fontClicked ( m_fontselect-> selectedFont ( )); | 314 | fontClicked ( m_fontselect-> selectedFont ( )); |
314 | 315 | ||
315 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); | 316 | QWhatsThis::add ( sample, tr( "This is a rough preview of what the currently selected Tab will look like." )); |
316 | } | 317 | } |
317 | 318 | ||
318 | 319 | ||
319 | TabDialog::~TabDialog ( ) | 320 | TabDialog::~TabDialog ( ) |
320 | { | 321 | { |
321 | } | 322 | } |
322 | 323 | ||
323 | QWidget *TabDialog::createFontTab ( QWidget *parent ) | 324 | QWidget *TabDialog::createFontTab ( QWidget *parent ) |
324 | { | 325 | { |
325 | QWidget *tab = new QWidget ( parent, "FontTab" ); | 326 | QWidget *tab = new QWidget ( parent, "FontTab" ); |
326 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); | 327 | QVBoxLayout *vertLayout = new QVBoxLayout ( tab, 3, 3 ); |
327 | 328 | ||
328 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); | 329 | m_fontuse = new QCheckBox ( tr( "Use a custom font" ), tab ); |
329 | vertLayout-> addWidget ( m_fontuse ); | 330 | vertLayout-> addWidget ( m_fontuse ); |
330 | 331 | ||
331 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); | 332 | m_fontselect = new OFontSelector ( false, tab, "fontsel" ); |
332 | vertLayout-> addWidget ( m_fontselect ); | 333 | vertLayout-> addWidget ( m_fontselect ); |
333 | 334 | ||
334 | connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); | 335 | connect ( m_fontuse, SIGNAL( toggled(bool)), m_fontselect, SLOT( setEnabled(bool))); |
335 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 336 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
336 | this, SLOT( fontClicked(const QFont&))); | 337 | this, SLOT( fontClicked(const QFont&))); |
337 | 338 | ||
338 | return tab; | 339 | return tab; |
339 | } | 340 | } |
340 | 341 | ||
341 | QWidget *TabDialog::createBgTab ( QWidget *parent ) | 342 | QWidget *TabDialog::createBgTab ( QWidget *parent ) |
342 | { | 343 | { |
343 | QWidget *tab = new QWidget( parent, "BgTab" ); | 344 | QWidget *tab = new QWidget( parent, "BgTab" ); |
344 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); | 345 | QVBoxLayout *vertLayout = new QVBoxLayout( tab, 3, 3 ); |
345 | 346 | ||
346 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); | 347 | QGridLayout* gridLayout = new QGridLayout ( vertLayout ); |
347 | gridLayout-> setColStretch ( 1, 10 ); | 348 | gridLayout-> setColStretch ( 1, 10 ); |
348 | 349 | ||
349 | QLabel* label = new QLabel( tr( "Type:" ), tab ); | 350 | QLabel* label = new QLabel( tr( "Type:" ), tab ); |
350 | gridLayout-> addWidget ( label, 0, 0 ); | 351 | gridLayout-> addWidget ( label, 0, 0 ); |
351 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); | 352 | m_bgtype = new QButtonGroup( tab, "buttongroup" ); |
352 | m_bgtype-> hide ( ); | 353 | m_bgtype-> hide ( ); |
353 | m_bgtype-> setExclusive ( true ); | 354 | m_bgtype-> setExclusive ( true ); |
354 | 355 | ||
355 | QRadioButton *rb; | 356 | QRadioButton *rb; |
356 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); | 357 | rb = new QRadioButton( tr( "Ruled" ), tab, "ruled" ); |
357 | m_bgtype-> insert ( rb, TabConfig::Ruled ); | 358 | m_bgtype-> insert ( rb, TabConfig::Ruled ); |
358 | gridLayout-> addWidget( rb, 0, 1 ); | 359 | gridLayout-> addWidget( rb, 0, 1 ); |
359 | 360 | ||
360 | QHBoxLayout *hb = new QHBoxLayout ( ); | 361 | QHBoxLayout *hb = new QHBoxLayout ( ); |
361 | hb-> setSpacing ( 3 ); | 362 | hb-> setSpacing ( 3 ); |
362 | 363 | ||
363 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); | 364 | rb = new QRadioButton( tr( "Solid color" ), tab, "solid" ); |
364 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); | 365 | m_bgtype-> insert ( rb, TabConfig::SolidColor ); |
365 | hb-> addWidget ( rb ); | 366 | hb-> addWidget ( rb ); |
366 | hb-> addSpacing ( 10 ); | 367 | hb-> addSpacing ( 10 ); |
367 | 368 | ||
368 | m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); | 369 | m_solidcolor = new Opie::OColorButton ( tab, QColor ( m_tc. m_bg_color ) ); |
369 | connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); | 370 | connect ( m_solidcolor, SIGNAL( colorSelected(const QColor&)), this, SLOT( bgColorClicked(const QColor&))); |
370 | hb-> addWidget ( m_solidcolor ); | 371 | hb-> addWidget ( m_solidcolor ); |
371 | hb-> addStretch ( 10 ); | 372 | hb-> addStretch ( 10 ); |
diff --git a/core/settings/launcher/tabssettings.cpp b/core/settings/launcher/tabssettings.cpp index ab64331..42f0568 100644 --- a/core/settings/launcher/tabssettings.cpp +++ b/core/settings/launcher/tabssettings.cpp | |||
@@ -109,218 +109,222 @@ void TabsSettings::init ( ) | |||
109 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); | 109 | m_list-> insertItem ( rootFolder. typePixmap ( *it ), rootFolder. typeName ( *it )); |
110 | m_ids << *it; | 110 | m_ids << *it; |
111 | } | 111 | } |
112 | QImage img ( Resource::loadImage ( "DocsIcon" )); | 112 | QImage img ( Resource::loadImage ( "DocsIcon" )); |
113 | QPixmap pix; | 113 | QPixmap pix; |
114 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); | 114 | pix = img. smoothScale ( AppLnk::smallIconSize ( ), AppLnk::smallIconSize ( )); |
115 | m_list-> insertItem ( pix, tr( "Documents" )); | 115 | m_list-> insertItem ( pix, tr( "Documents" )); |
116 | m_ids += "Documents"; // No tr | 116 | m_ids += "Documents"; // No tr |
117 | 117 | ||
118 | Config cfg ( "Launcher" ); | 118 | Config cfg ( "Launcher" ); |
119 | 119 | ||
120 | readTabSettings ( cfg ); | 120 | readTabSettings ( cfg ); |
121 | 121 | ||
122 | cfg. setGroup ( "GUI" ); | 122 | cfg. setGroup ( "GUI" ); |
123 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); | 123 | m_busyani-> setChecked ( cfg. readEntry ( "BusyType" ). lower ( ) == "animated" ); |
124 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); | 124 | m_bigbusy->setChecked( cfg. readBoolEntry ( "BigBusy" ) ); |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | void TabsSettings::readTabSettings ( Config &cfg ) | 128 | void TabsSettings::readTabSettings ( Config &cfg ) |
129 | { | 129 | { |
130 | QString grp ( "Tab %1" ); // No tr | 130 | QString grp ( "Tab %1" ); // No tr |
131 | m_tabs. clear ( ); | 131 | m_tabs. clear ( ); |
132 | 132 | ||
133 | TabConfig global_def; | 133 | TabConfig global_def; |
134 | global_def. m_view = TabConfig::Icon; | 134 | global_def. m_view = TabConfig::Icon; |
135 | global_def. m_bg_type = TabConfig::Ruled; | 135 | global_def. m_bg_type = TabConfig::Ruled; |
136 | global_def. m_bg_image = "launcher/opie-background"; | 136 | global_def. m_bg_image = "launcher/opie-background"; |
137 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); | 137 | global_def. m_bg_color = colorGroup ( ). color ( QColorGroup::Base ). name ( ); |
138 | global_def. m_iconcolumns = 0; // automatic | 138 | global_def. m_iconcolumns = 0; // automatic |
139 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); | 139 | global_def. m_text_color = colorGroup ( ). color ( QColorGroup::Text ). name ( ); |
140 | global_def. m_font_use = false; | 140 | global_def. m_font_use = false; |
141 | global_def. m_font_family = font ( ). family ( ); | 141 | global_def. m_font_family = font ( ). family ( ); |
142 | global_def. m_font_size = font ( ). pointSize ( ); | 142 | global_def. m_font_size = font ( ). pointSize ( ); |
143 | global_def. m_font_weight = 50; | 143 | global_def. m_font_weight = 50; |
144 | global_def. m_font_italic = false; | 144 | global_def. m_font_italic = false; |
145 | global_def. m_changed = false; | 145 | global_def. m_changed = false; |
146 | 146 | ||
147 | Config cfg2 = Config( "Launchersettings" ); | 147 | Config cfg2 = Config( "Launchersettings" ); |
148 | 148 | ||
149 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 149 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
150 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; | 150 | TabConfig tc = ( it != m_ids. begin ( )) ? m_tabs [GLOBALID] : global_def; |
151 | 151 | ||
152 | cfg. setGroup ( grp. arg ( *it )); | 152 | cfg. setGroup ( grp. arg ( *it )); |
153 | cfg2. setGroup( grp. arg ( *it )); | 153 | cfg2. setGroup( grp. arg ( *it )); |
154 | 154 | ||
155 | QString view = cfg. readEntry ( "View" ); | 155 | QString view = cfg. readEntry ( "View" ); |
156 | if ( view == "Icon" ) // No tr | 156 | if ( view == "Icon" ) // No tr |
157 | tc. m_view = TabConfig::Icon; | 157 | tc. m_view = TabConfig::Icon; |
158 | if ( view == "List" ) // No tr | 158 | if ( view == "List" ) // No tr |
159 | tc. m_view = TabConfig::List; | 159 | tc. m_view = TabConfig::List; |
160 | 160 | ||
161 | QString bgType = cfg. readEntry ( "BackgroundType" ); | 161 | QString bgType = cfg. readEntry ( "BackgroundType" ); |
162 | if ( bgType == "Image" ) | 162 | if ( bgType == "Image" ) |
163 | tc. m_bg_type = TabConfig::Image; | 163 | tc. m_bg_type = TabConfig::Image; |
164 | else if ( bgType == "SolidColor" ) | 164 | else if ( bgType == "SolidColor" ) |
165 | tc. m_bg_type = TabConfig::SolidColor; | 165 | tc. m_bg_type = TabConfig::SolidColor; |
166 | else if ( bgType == "Image" ) // No tr | 166 | else if ( bgType == "Image" ) // No tr |
167 | tc. m_bg_type = TabConfig::Image; | 167 | tc. m_bg_type = TabConfig::Image; |
168 | 168 | ||
169 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); | 169 | tc. m_bg_image = cfg. readEntry ( "BackgroundImage", tc. m_bg_image ); |
170 | tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); | 170 | tc. m_last_directory = cfg2.readEntry( "DefaultDir", "" ); |
171 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); | 171 | tc. m_bg_color = cfg. readEntry ( "BackgroundColor", tc. m_bg_color ); |
172 | tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns ); | 172 | tc. m_iconcolumns = cfg. readNumEntry ( "Columns", tc. m_iconcolumns ); |
173 | qDebug( "m_iconcolumns for %s = %d", (const char*) *it, tc.m_iconcolumns ); | ||
173 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); | 174 | tc. m_text_color = cfg. readEntry ( "TextColor", tc. m_text_color ); |
174 | QStringList f = cfg. readListEntry ( "Font", ',' ); | 175 | QStringList f = cfg. readListEntry ( "Font", ',' ); |
175 | if ( f. count ( ) == 4 ) { | 176 | if ( f. count ( ) == 4 ) { |
176 | tc. m_font_use = true; | 177 | tc. m_font_use = true; |
177 | tc. m_font_family = f [0]; | 178 | tc. m_font_family = f [0]; |
178 | tc. m_font_size = f [1]. toInt ( ); | 179 | tc. m_font_size = f [1]. toInt ( ); |
179 | tc. m_font_weight = f [2]. toInt ( ); | 180 | tc. m_font_weight = f [2]. toInt ( ); |
180 | tc. m_font_italic = ( f [3]. toInt ( )); | 181 | tc. m_font_italic = ( f [3]. toInt ( )); |
181 | } | 182 | } |
182 | m_tabs [*it] = tc; | 183 | m_tabs [*it] = tc; |
183 | } | 184 | } |
184 | 185 | ||
185 | // if all tabs have the same config, then initialize the GLOBALID tab to these values | 186 | // if all tabs have the same config, then initialize the GLOBALID tab to these values |
186 | 187 | ||
187 | TabConfig *first = 0; | 188 | TabConfig *first = 0; |
188 | bool same = true; | 189 | bool same = true; |
189 | 190 | ||
190 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 191 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
191 | if ( *it == GLOBALID ) | 192 | if ( *it == GLOBALID ) |
192 | continue; | 193 | continue; |
193 | else if ( !first ) | 194 | else if ( !first ) |
194 | first = &m_tabs [*it]; | 195 | first = &m_tabs [*it]; |
195 | else | 196 | else |
196 | same &= ( *first == m_tabs [*it] ); | 197 | same &= ( *first == m_tabs [*it] ); |
197 | } | 198 | } |
198 | if ( same ) { | 199 | if ( same ) { |
199 | m_tabs [GLOBALID] = *first; | 200 | m_tabs [GLOBALID] = *first; |
200 | m_tabs [GLOBALID]. m_changed = true; | 201 | m_tabs [GLOBALID]. m_changed = true; |
201 | } | 202 | } |
202 | } | 203 | } |
203 | 204 | ||
204 | 205 | ||
205 | void TabsSettings::accept ( ) | 206 | void TabsSettings::accept ( ) |
206 | { | 207 | { |
207 | Config cfg ( "Launcher" ); | 208 | Config cfg ( "Launcher" ); |
208 | Config cfg2 ( "Launchersettings" ); | 209 | Config cfg2 ( "Launchersettings" ); |
209 | 210 | ||
210 | // Launcher Tab | 211 | // Launcher Tab |
211 | QString grp ( "Tab %1" ); // No tr | 212 | QString grp ( "Tab %1" ); // No tr |
212 | 213 | ||
213 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 214 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
214 | TabConfig &tc = m_tabs [*it]; | 215 | TabConfig &tc = m_tabs [*it]; |
215 | 216 | ||
216 | if ( !tc. m_changed ) | 217 | if ( !tc. m_changed ) |
217 | continue; | 218 | continue; |
218 | 219 | ||
219 | cfg. setGroup ( grp. arg ( *it )); | 220 | cfg. setGroup ( grp. arg ( *it )); |
220 | cfg2. setGroup ( grp. arg ( *it )); | 221 | cfg2. setGroup ( grp. arg ( *it )); |
221 | switch ( tc. m_view ) { | 222 | switch ( tc. m_view ) { |
222 | case TabConfig::Icon: | 223 | case TabConfig::Icon: |
223 | cfg.writeEntry ( "View", "Icon" ); | 224 | cfg.writeEntry ( "View", "Icon" ); |
224 | break; | 225 | break; |
225 | case TabConfig::List: | 226 | case TabConfig::List: |
226 | cfg.writeEntry ( "View", "List" ); | 227 | cfg.writeEntry ( "View", "List" ); |
227 | break; | 228 | break; |
228 | } | 229 | } |
229 | 230 | ||
230 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); | 231 | QCopEnvelope e ( "QPE/Launcher", "setTabView(QString,int)" ); |
231 | e << *it << tc. m_view; | 232 | e << *it << tc. m_view; |
232 | 233 | ||
233 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); | 234 | cfg. writeEntry ( "BackgroundImage", tc. m_bg_image ); |
234 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); | 235 | cfg. writeEntry ( "BackgroundColor", tc. m_bg_color ); |
235 | cfg. writeEntry ( "Columns", tc. m_iconcolumns ); | 236 | cfg. writeEntry ( "Columns", tc. m_iconcolumns ); |
236 | cfg. writeEntry ( "TextColor", tc. m_text_color ); | 237 | cfg. writeEntry ( "TextColor", tc. m_text_color ); |
237 | cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); | 238 | cfg2. writeEntry ( "DefaultDir", tc.m_last_directory ); |
238 | 239 | ||
239 | if ( tc. m_font_use ) { | 240 | if ( tc. m_font_use ) { |
240 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); | 241 | QString f = tc. m_font_family + "," + QString::number ( tc. m_font_size ) + "," + QString::number ( tc. m_font_weight ) + "," + ( tc. m_font_italic ? "1" : "0" ); |
241 | cfg. writeEntry ( "Font", f ); | 242 | cfg. writeEntry ( "Font", f ); |
242 | } | 243 | } |
243 | else | 244 | else |
244 | cfg. removeEntry ( "Font" ); | 245 | cfg. removeEntry ( "Font" ); |
245 | 246 | ||
246 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); | 247 | QCopEnvelope be ( "QPE/Launcher", "setTabBackground(QString,int,QString)" ); |
247 | 248 | ||
248 | switch ( tc. m_bg_type ) { | 249 | switch ( tc. m_bg_type ) { |
249 | case TabConfig::Ruled: | 250 | case TabConfig::Ruled: |
250 | cfg.writeEntry( "BackgroundType", "Ruled" ); | 251 | cfg.writeEntry( "BackgroundType", "Ruled" ); |
251 | be << *it << tc. m_bg_type << QString(""); | 252 | be << *it << tc. m_bg_type << QString(""); |
252 | break; | 253 | break; |
253 | case TabConfig::SolidColor: | 254 | case TabConfig::SolidColor: |
254 | cfg.writeEntry( "BackgroundType", "SolidColor" ); | 255 | cfg.writeEntry( "BackgroundType", "SolidColor" ); |
255 | be << *it << tc. m_bg_type << tc. m_bg_color; | 256 | be << *it << tc. m_bg_type << tc. m_bg_color; |
256 | break; | 257 | break; |
257 | case TabConfig::Image: | 258 | case TabConfig::Image: |
258 | cfg.writeEntry( "BackgroundType", "Image" ); | 259 | cfg.writeEntry( "BackgroundType", "Image" ); |
259 | be << *it << tc. m_bg_type << tc. m_bg_image; | 260 | be << *it << tc. m_bg_type << tc. m_bg_image; |
260 | break; | 261 | break; |
261 | } | 262 | } |
262 | 263 | ||
263 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); | 264 | QCopEnvelope te( "QPE/Launcher", "setTextColor(QString,QString)" ); |
264 | te << *it << tc. m_text_color; | 265 | te << *it << tc. m_text_color; |
265 | 266 | ||
266 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | 267 | QCopEnvelope ic( "QPE/Launcher", "setIconColumns(QString,int)" ); |
268 | ic << *it << tc. m_iconcolumns; | ||
269 | |||
270 | QCopEnvelope fe ( "QPE/Launcher", "setFont(QString,QString,int,int,int)" ); | ||
267 | fe << *it; | 271 | fe << *it; |
268 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); | 272 | fe << ( tc. m_font_use ? tc. m_font_family : QString::null ); |
269 | fe << tc. m_font_size; | 273 | fe << tc. m_font_size; |
270 | fe << tc. m_font_weight; | 274 | fe << tc. m_font_weight; |
271 | fe << ( tc. m_font_italic ? 1 : 0 ); | 275 | fe << ( tc. m_font_italic ? 1 : 0 ); |
272 | 276 | ||
273 | tc. m_changed = false; | 277 | tc. m_changed = false; |
274 | } | 278 | } |
275 | cfg. setGroup ( "GUI" ); | 279 | cfg. setGroup ( "GUI" ); |
276 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); | 280 | QString busytype = QString ( m_busyani-> isChecked ( ) ? "Animated" : "" ); |
277 | cfg. writeEntry ( "BusyType", busytype ); | 281 | cfg. writeEntry ( "BusyType", busytype ); |
278 | 282 | ||
279 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); | 283 | cfg. writeEntry ( "BigBusy", m_bigbusy->isChecked( ) ); |
280 | 284 | ||
281 | { | 285 | { |
282 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); | 286 | QCopEnvelope e ( "QPE/Launcher", "setBusyIndicatorType(QString)" ); |
283 | e << busytype; | 287 | e << busytype; |
284 | } | 288 | } |
285 | } | 289 | } |
286 | 290 | ||
287 | void TabsSettings::newClicked ( ) | 291 | void TabsSettings::newClicked ( ) |
288 | { | 292 | { |
289 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 293 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
290 | } | 294 | } |
291 | 295 | ||
292 | void TabsSettings::deleteClicked ( ) | 296 | void TabsSettings::deleteClicked ( ) |
293 | { | 297 | { |
294 | int ind = m_list-> currentItem ( ); | 298 | int ind = m_list-> currentItem ( ); |
295 | 299 | ||
296 | if ( ind < 0 ) | 300 | if ( ind < 0 ) |
297 | return; | 301 | return; |
298 | 302 | ||
299 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); | 303 | QMessageBox::information ( this, tr( "Error" ), tr( "Not implemented yet" )); |
300 | } | 304 | } |
301 | 305 | ||
302 | void TabsSettings::editClicked ( ) | 306 | void TabsSettings::editClicked ( ) |
303 | { | 307 | { |
304 | int ind = m_list-> currentItem ( ); | 308 | int ind = m_list-> currentItem ( ); |
305 | 309 | ||
306 | if ( ind < 0 ) | 310 | if ( ind < 0 ) |
307 | return; | 311 | return; |
308 | 312 | ||
309 | TabConfig tc = m_tabs [m_ids [ind]]; | 313 | TabConfig tc = m_tabs [m_ids [ind]]; |
310 | 314 | ||
311 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); | 315 | TabDialog *d = new TabDialog ( m_list-> pixmap ( ind ), m_list-> text ( ind ), tc, this, "TabDialog", true ); |
312 | 316 | ||
313 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { | 317 | if ( QPEApplication::execDialog( d ) == QDialog::Accepted ) { |
314 | tc. m_changed = true; | 318 | tc. m_changed = true; |
315 | m_tabs [m_ids [ind]] = tc; | 319 | m_tabs [m_ids [ind]] = tc; |
316 | 320 | ||
317 | if ( m_ids [ind] == GLOBALID ) { | 321 | if ( m_ids [ind] == GLOBALID ) { |
318 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { | 322 | for ( QStringList::Iterator it = m_ids. begin ( ); it != m_ids. end ( ); ++it ) { |
319 | if ( *it != GLOBALID ) | 323 | if ( *it != GLOBALID ) |
320 | m_tabs [*it] = tc; | 324 | m_tabs [*it] = tc; |
321 | } | 325 | } |
322 | } | 326 | } |
323 | } | 327 | } |
324 | 328 | ||
325 | delete d; | 329 | delete d; |
326 | } | 330 | } |