author | sandman <sandman> | 2002-09-27 00:59:52 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-27 00:59:52 (UTC) |
commit | ac99721b91f3c61d37236932a5d0f6bc09caaa54 (patch) (unidiff) | |
tree | e8397c2fd2636452485c5192bbe8166052d08df9 | |
parent | 6ac98209a82c5aa24ab09faf79525cd9aa5a8a1d (diff) | |
download | opie-ac99721b91f3c61d37236932a5d0f6bc09caaa54.zip opie-ac99721b91f3c61d37236932a5d0f6bc09caaa54.tar.gz opie-ac99721b91f3c61d37236932a5d0f6bc09caaa54.tar.bz2 |
- fixed bg image location
-rw-r--r-- | core/launcher/launcherview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 047fe45..c2bde53 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -610,193 +610,193 @@ void LauncherView::updateTools() | |||
610 | catmb->setAllCategories( TRUE ); | 610 | catmb->setAllCategories( TRUE ); |
611 | 611 | ||
612 | connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); | 612 | connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); |
613 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); | 613 | connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); |
614 | } | 614 | } |
615 | 615 | ||
616 | void LauncherView::sortBy(int s) | 616 | void LauncherView::sortBy(int s) |
617 | { | 617 | { |
618 | icons->setSortMethod((LauncherIconView::SortMethod)s); | 618 | icons->setSortMethod((LauncherIconView::SortMethod)s); |
619 | } | 619 | } |
620 | 620 | ||
621 | void LauncherView::showType(int t) | 621 | void LauncherView::showType(int t) |
622 | { | 622 | { |
623 | if ( t >= (int)typelist.count() ) { | 623 | if ( t >= (int)typelist.count() ) { |
624 | icons->setTypeFilter("",TRUE); | 624 | icons->setTypeFilter("",TRUE); |
625 | } else { | 625 | } else { |
626 | QString ty = typelist[t]; | 626 | QString ty = typelist[t]; |
627 | if ( !ty.contains('/') ) | 627 | if ( !ty.contains('/') ) |
628 | ty += "/*"; | 628 | ty += "/*"; |
629 | icons->setTypeFilter(ty,TRUE); | 629 | icons->setTypeFilter(ty,TRUE); |
630 | } | 630 | } |
631 | } | 631 | } |
632 | 632 | ||
633 | void LauncherView::showCategory( int c ) | 633 | void LauncherView::showCategory( int c ) |
634 | { | 634 | { |
635 | icons->setCategoryFilter( c, TRUE ); | 635 | icons->setCategoryFilter( c, TRUE ); |
636 | } | 636 | } |
637 | 637 | ||
638 | void LauncherView::setViewMode( ViewMode m ) | 638 | void LauncherView::setViewMode( ViewMode m ) |
639 | { | 639 | { |
640 | if ( vmode != m ) { | 640 | if ( vmode != m ) { |
641 | bool bigIcons = m == Icon; | 641 | bool bigIcons = m == Icon; |
642 | icons->viewport()->setUpdatesEnabled( FALSE ); | 642 | icons->viewport()->setUpdatesEnabled( FALSE ); |
643 | icons->setBigIcons( bigIcons ); | 643 | icons->setBigIcons( bigIcons ); |
644 | switch ( m ) { | 644 | switch ( m ) { |
645 | case List: | 645 | case List: |
646 | icons->setItemTextPos( QIconView::Right ); | 646 | icons->setItemTextPos( QIconView::Right ); |
647 | break; | 647 | break; |
648 | case Icon: | 648 | case Icon: |
649 | icons->setItemTextPos( QIconView::Bottom ); | 649 | icons->setItemTextPos( QIconView::Bottom ); |
650 | break; | 650 | break; |
651 | } | 651 | } |
652 | icons->hideOrShowItems( FALSE ); | 652 | icons->hideOrShowItems( FALSE ); |
653 | icons->viewport()->setUpdatesEnabled( TRUE ); | 653 | icons->viewport()->setUpdatesEnabled( TRUE ); |
654 | vmode = m; | 654 | vmode = m; |
655 | } | 655 | } |
656 | } | 656 | } |
657 | 657 | ||
658 | void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) | 658 | void LauncherView::setBackgroundType( BackgroundType t, const QString &val ) |
659 | { | 659 | { |
660 | if ( !bgCache ) | 660 | if ( !bgCache ) |
661 | bgCache = new QMap<QString,BgPixmap*>; | 661 | bgCache = new QMap<QString,BgPixmap*>; |
662 | if ( bgCache->contains( bgName ) ) | 662 | if ( bgCache->contains( bgName ) ) |
663 | (*bgCache)[bgName]->ref--; | 663 | (*bgCache)[bgName]->ref--; |
664 | 664 | ||
665 | switch ( t ) { | 665 | switch ( t ) { |
666 | case Ruled: { | 666 | case Ruled: { |
667 | bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr | 667 | bgName = QString("Ruled_%1").arg(colorGroup().background().name()); // No tr |
668 | QPixmap bg; | 668 | QPixmap bg; |
669 | if ( bgCache->contains( bgName ) ) { | 669 | if ( bgCache->contains( bgName ) ) { |
670 | (*bgCache)[bgName]->ref++; | 670 | (*bgCache)[bgName]->ref++; |
671 | bg = (*bgCache)[bgName]->pm; | 671 | bg = (*bgCache)[bgName]->pm; |
672 | } else { | 672 | } else { |
673 | bg.resize( width(), 9 ); | 673 | bg.resize( width(), 9 ); |
674 | QPainter painter( &bg ); | 674 | QPainter painter( &bg ); |
675 | for ( int i = 0; i < 3; i++ ) { | 675 | for ( int i = 0; i < 3; i++ ) { |
676 | painter.setPen( white ); | 676 | painter.setPen( white ); |
677 | painter.drawLine( 0, i*3, width()-1, i*3 ); | 677 | painter.drawLine( 0, i*3, width()-1, i*3 ); |
678 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); | 678 | painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); |
679 | painter.setPen( colorGroup().background().light(105) ); | 679 | painter.setPen( colorGroup().background().light(105) ); |
680 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); | 680 | painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); |
681 | } | 681 | } |
682 | painter.end(); | 682 | painter.end(); |
683 | bgCache->insert( bgName, new BgPixmap(bg) ); | 683 | bgCache->insert( bgName, new BgPixmap(bg) ); |
684 | } | 684 | } |
685 | icons->setBackgroundPixmap( bg ); | 685 | icons->setBackgroundPixmap( bg ); |
686 | break; | 686 | break; |
687 | } | 687 | } |
688 | 688 | ||
689 | case SolidColor: | 689 | case SolidColor: |
690 | icons->setBackgroundPixmap( QPixmap() ); | 690 | icons->setBackgroundPixmap( QPixmap() ); |
691 | if ( val.isEmpty() ) { | 691 | if ( val.isEmpty() ) { |
692 | icons->setBackgroundColor( colorGroup().base() ); | 692 | icons->setBackgroundColor( colorGroup().base() ); |
693 | } else { | 693 | } else { |
694 | icons->setBackgroundColor( val ); | 694 | icons->setBackgroundColor( val ); |
695 | } | 695 | } |
696 | bgName = ""; | 696 | bgName = ""; |
697 | break; | 697 | break; |
698 | 698 | ||
699 | case Image: | 699 | case Image: |
700 | bgName = val; | 700 | bgName = val; |
701 | if ( bgCache->contains( bgName ) ) { | 701 | if ( bgCache->contains( bgName ) ) { |
702 | (*bgCache)[bgName]->ref++; | 702 | (*bgCache)[bgName]->ref++; |
703 | icons->setBackgroundPixmap( (*bgCache)[bgName]->pm ); | 703 | icons->setBackgroundPixmap( (*bgCache)[bgName]->pm ); |
704 | } else { | 704 | } else { |
705 | qDebug( "Loading image: %s", val.latin1() ); | 705 | qDebug( "Loading image: %s", val.latin1() ); |
706 | QPixmap bg( Resource::loadPixmap( "wallpaper/" + val ) ); | 706 | QPixmap bg( Resource::loadPixmap( val ) ); |
707 | if ( bg.isNull() ) { | 707 | if ( bg.isNull() ) { |
708 | QImageIO imgio; | 708 | QImageIO imgio; |
709 | imgio.setFileName( bgName ); | 709 | imgio.setFileName( bgName ); |
710 | QSize ds = qApp->desktop()->size(); | 710 | QSize ds = qApp->desktop()->size(); |
711 | QString param( "Scale( %1, %2, ScaleMin )" ); // No tr | 711 | QString param( "Scale( %1, %2, ScaleMin )" ); // No tr |
712 | imgio.setParameters( param.arg(ds.width()).arg(ds.height()).latin1() ); | 712 | imgio.setParameters( param.arg(ds.width()).arg(ds.height()).latin1() ); |
713 | imgio.read(); | 713 | imgio.read(); |
714 | bg = imgio.image(); | 714 | bg = imgio.image(); |
715 | } | 715 | } |
716 | bgCache->insert( bgName, new BgPixmap(bg) ); | 716 | bgCache->insert( bgName, new BgPixmap(bg) ); |
717 | icons->setBackgroundPixmap( bg ); | 717 | icons->setBackgroundPixmap( bg ); |
718 | } | 718 | } |
719 | break; | 719 | break; |
720 | } | 720 | } |
721 | 721 | ||
722 | // remove unreferenced backgrounds. | 722 | // remove unreferenced backgrounds. |
723 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); | 723 | QMap<QString,BgPixmap*>::Iterator it = bgCache->begin(); |
724 | while ( it != bgCache->end() ) { | 724 | while ( it != bgCache->end() ) { |
725 | QMap<QString,BgPixmap*>::Iterator curr = it; | 725 | QMap<QString,BgPixmap*>::Iterator curr = it; |
726 | ++it; | 726 | ++it; |
727 | if ( (*curr)->ref == 0 ) { | 727 | if ( (*curr)->ref == 0 ) { |
728 | delete (*curr); | 728 | delete (*curr); |
729 | bgCache->remove( curr ); | 729 | bgCache->remove( curr ); |
730 | } | 730 | } |
731 | } | 731 | } |
732 | 732 | ||
733 | bgType = t; | 733 | bgType = t; |
734 | icons->viewport()->update(); | 734 | icons->viewport()->update(); |
735 | } | 735 | } |
736 | 736 | ||
737 | void LauncherView::setTextColor( const QColor &tc ) | 737 | void LauncherView::setTextColor( const QColor &tc ) |
738 | { | 738 | { |
739 | textCol = tc; | 739 | textCol = tc; |
740 | QColorGroup cg = icons->colorGroup(); | 740 | QColorGroup cg = icons->colorGroup(); |
741 | cg.setColor( QColorGroup::Text, tc ); | 741 | cg.setColor( QColorGroup::Text, tc ); |
742 | icons->setPalette( QPalette(cg,cg,cg) ); | 742 | icons->setPalette( QPalette(cg,cg,cg) ); |
743 | icons->viewport()->update(); | 743 | icons->viewport()->update(); |
744 | } | 744 | } |
745 | 745 | ||
746 | void LauncherView::setViewFont( const QFont &f ) | 746 | void LauncherView::setViewFont( const QFont &f ) |
747 | { | 747 | { |
748 | icons->setFont( f ); | 748 | icons->setFont( f ); |
749 | } | 749 | } |
750 | 750 | ||
751 | void LauncherView::resizeEvent(QResizeEvent *e) | 751 | void LauncherView::resizeEvent(QResizeEvent *e) |
752 | { | 752 | { |
753 | QVBox::resizeEvent( e ); | 753 | QVBox::resizeEvent( e ); |
754 | if ( e->size().width() != e->oldSize().width() ) | 754 | if ( e->size().width() != e->oldSize().width() ) |
755 | sort(); | 755 | sort(); |
756 | } | 756 | } |
757 | 757 | ||
758 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) | 758 | void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) |
759 | { | 759 | { |
760 | icons->clear(); | 760 | icons->clear(); |
761 | internalPopulate( folder, typefilter ); | 761 | internalPopulate( folder, typefilter ); |
762 | } | 762 | } |
763 | 763 | ||
764 | QString LauncherView::getAllDocLinkInfo() const | 764 | QString LauncherView::getAllDocLinkInfo() const |
765 | { | 765 | { |
766 | return icons->getAllDocLinkInfo(); | 766 | return icons->getAllDocLinkInfo(); |
767 | } | 767 | } |
768 | 768 | ||
769 | void LauncherView::selectionChanged() | 769 | void LauncherView::selectionChanged() |
770 | { | 770 | { |
771 | QIconViewItem* item = icons->currentItem(); | 771 | QIconViewItem* item = icons->currentItem(); |
772 | if ( item && item->isSelected() ) { | 772 | if ( item && item->isSelected() ) { |
773 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 773 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
774 | if ( icons->inKeyEvent() ) // not for mouse press | 774 | if ( icons->inKeyEvent() ) // not for mouse press |
775 | emit clicked( appLnk ); | 775 | emit clicked( appLnk ); |
776 | item->setSelected(FALSE); | 776 | item->setSelected(FALSE); |
777 | } | 777 | } |
778 | } | 778 | } |
779 | 779 | ||
780 | void LauncherView::returnPressed( QIconViewItem *item ) | 780 | void LauncherView::returnPressed( QIconViewItem *item ) |
781 | { | 781 | { |
782 | if ( item ) { | 782 | if ( item ) { |
783 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 783 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
784 | emit clicked( appLnk ); | 784 | emit clicked( appLnk ); |
785 | } | 785 | } |
786 | } | 786 | } |
787 | 787 | ||
788 | void LauncherView::itemClicked( int btn, QIconViewItem *item ) | 788 | void LauncherView::itemClicked( int btn, QIconViewItem *item ) |
789 | { | 789 | { |
790 | if ( item ) { | 790 | if ( item ) { |
791 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); | 791 | AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); |
792 | if ( btn == LeftButton ) { | 792 | if ( btn == LeftButton ) { |
793 | // Make sure it's the item we execute that gets highlighted | 793 | // Make sure it's the item we execute that gets highlighted |
794 | icons->setCurrentItem( item ); | 794 | icons->setCurrentItem( item ); |
795 | emit clicked( appLnk ); | 795 | emit clicked( appLnk ); |
796 | } | 796 | } |
797 | item->setSelected(FALSE); | 797 | item->setSelected(FALSE); |
798 | } | 798 | } |
799 | } | 799 | } |
800 | 800 | ||
801 | void LauncherView::itemPressed( int btn, QIconViewItem *item ) | 801 | void LauncherView::itemPressed( int btn, QIconViewItem *item ) |
802 | { | 802 | { |