summaryrefslogtreecommitdiff
path: root/core/launcher/launcherview.cpp
authormickeyl <mickeyl>2005-07-03 22:13:00 (UTC)
committer mickeyl <mickeyl>2005-07-03 22:13:00 (UTC)
commit2cabd9ad4b49eefccdf99ad59550c76546b473c9 (patch) (unidiff)
tree00bab275ac356aecc5a39b86ca22ce172d01f622 /core/launcher/launcherview.cpp
parent47011752d4457a1055894479e5bf855e100fddac (diff)
downloadopie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.zip
opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.tar.gz
opie-2cabd9ad4b49eefccdf99ad59550c76546b473c9.tar.bz2
Resource -> OResource
This is a large diff and I'd appreciate some additional pairs of eyes checking it
Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index d960908..6275fcb 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -1,54 +1,61 @@
1/********************************************************************** 1/*
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2                 This file is part of the Opie Project
3** 3 =. (C) 2000-2002 Trolltech AS
4** This file is part of the Qtopia Environment. 4 .=l. (C) 2002-2005 The Opie Team <opie-devel@handhelds.org>
5** 5           .>+-=
6** This file may be distributed and/or modified under the terms of the 6 _;:,     .>    :=|. This program is free software; you can
7** GNU General Public License version 2 as published by the Free Software 7.> <`_,   >  .   <= redistribute it and/or modify it under
8** Foundation and appearing in the file LICENSE.GPL included in the 8 :`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9** packaging of this file. 9.="- .-=="i,     .._ License as published by the Free Software
10** 10 - .   .-<_>     .<> Foundation; version 2 of the License.
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11     ._= =}       :
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12    .%`+i>       _;_.
13** 13    .i_,=:_.      -<s. This program is distributed in the hope that
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15** 15 : ..    .:,     . . . without even the implied warranty of
16** Contact info@trolltech.com if any conditions of this licensing are 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17** not clear to you. 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18** 18..}^=.=       =       ; Library General Public License for more
19**********************************************************************/ 19++=   -.     .`     .: details.
20 20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27*/
21#include "launcherview.h" 28#include "launcherview.h"
22 29
23/* OPIE */ 30/* OPIE */
24#include <opie2/odebug.h> 31#include <opie2/odebug.h>
32#include <opie2/oresource.h>
25#include <qpe/config.h> 33#include <qpe/config.h>
26#include <qtopia/qpeapplication.h> 34#include <qtopia/qpeapplication.h>
27#include <qtopia/private/categories.h> 35#include <qtopia/private/categories.h>
28#include <qtopia/categoryselect.h> 36#include <qtopia/categoryselect.h>
29#include <qtopia/mimetype.h> 37#include <qtopia/mimetype.h>
30#include <qtopia/resource.h>
31using namespace Opie::Core; 38using namespace Opie::Core;
32 39
33#include <qpe/qcopenvelope_qws.h> 40#include <qpe/qcopenvelope_qws.h>
34 41
35/* QT */ 42/* QT */
36#include <qtimer.h> 43#include <qtimer.h>
37#include <qfileinfo.h> 44#include <qfileinfo.h>
38#include <qiconview.h> 45#include <qiconview.h>
39#include <qobjectlist.h> 46#include <qobjectlist.h>
40 47
41 48
42// These define how the busy icon is animated and highlighted 49// These define how the busy icon is animated and highlighted
43#define BRIGHTEN_BUSY_ICON 50#define BRIGHTEN_BUSY_ICON
44//#define ALPHA_FADE_BUSY_ICON 51//#define ALPHA_FADE_BUSY_ICON
45//#define USE_ANIMATED_BUSY_ICON_OVERLAY 52//#define USE_ANIMATED_BUSY_ICON_OVERLAY
46#define BOUNCE_BUSY_ICON 53#define BOUNCE_BUSY_ICON
47 54
48typedef QMap<QString,QPixmap>::Iterator pixiter; 55typedef QMap<QString,QPixmap>::Iterator pixiter;
49 56
50class BgPixmap 57class BgPixmap
51{ 58{
52public: 59public:
53 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} 60 BgPixmap( const QPixmap &p ) : pm(p), ref(1) {}
54 QPixmap pm; 61 QPixmap pm;
@@ -405,49 +412,49 @@ void LauncherIconView::drawBackground( QPainter *p, const QRect &r )
405 } 412 }
406 } 413 }
407} 414}
408 415
409void LauncherIconView::addCatsAndMimes(AppLnk* app) 416void LauncherIconView::addCatsAndMimes(AppLnk* app)
410{ 417{
411 // QStringList c = app->categories(); 418 // QStringList c = app->categories();
412 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { 419 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
413 // cats.replace(*cit,(void*)1); 420 // cats.replace(*cit,(void*)1);
414 // } 421 // }
415 QString maj=app->type(); 422 QString maj=app->type();
416 int sl=maj.find('/'); 423 int sl=maj.find('/');
417 if (sl>=0) { 424 if (sl>=0) {
418 QString k; 425 QString k;
419 k = maj.left(12) == "application/" ? maj : maj.left(sl); 426 k = maj.left(12) == "application/" ? maj : maj.left(sl);
420 mimes.replace(k,(void*)1); 427 mimes.replace(k,(void*)1);
421 } 428 }
422} 429}
423 430
424void LauncherIconView::setBusy(bool on) 431void LauncherIconView::setBusy(bool on)
425{ 432{
426#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 433#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
427 if ( busyPix.isNull() ) { 434 if ( busyPix.isNull() ) {
428 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); 435 int size = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
429 busyPix.convertFromImage( Resource::loadImage( "busy" ).smoothScale( size * 16, size ) ); 436 busyPix.convertFromImage( OResource::loadImage( "busy", OResource::NoScale ).smoothScale( size * 16, size ) );
430 } 437 }
431#endif 438#endif
432 439
433 if ( on ) { 440 if ( on ) {
434 busyTimer = startTimer( 100 ); 441 busyTimer = startTimer( 100 );
435 } else { 442 } else {
436 if ( busyTimer ) { 443 if ( busyTimer ) {
437 killTimer( busyTimer ); 444 killTimer( busyTimer );
438 busyTimer = 0; 445 busyTimer = 0;
439 } 446 }
440 } 447 }
441 448
442 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0; 449 LauncherItem *c = on ? (LauncherItem*)currentItem() : 0;
443 450
444 if ( bsy != c ) { 451 if ( bsy != c ) {
445 LauncherItem *oldBusy = bsy; 452 LauncherItem *oldBusy = bsy;
446 bsy = c; 453 bsy = c;
447 if ( oldBusy ) { 454 if ( oldBusy ) {
448 oldBusy->resetIcon(); 455 oldBusy->resetIcon();
449 } 456 }
450 if ( bsy ) { 457 if ( bsy ) {
451 bsy->setBusyIndicatorType( busyType ) ; 458 bsy->setBusyIndicatorType( busyType ) ;
452 bsy->animateIcon(); 459 bsy->animateIcon();
453 } 460 }
@@ -980,49 +987,49 @@ void LauncherView::setBackgroundType( BackgroundType t, const QString &val )
980 QPainter painter( &bg ); 987 QPainter painter( &bg );
981 for ( int i = 0; i < 3; i++ ) { 988 for ( int i = 0; i < 3; i++ ) {
982 painter.setPen( white ); 989 painter.setPen( white );
983 painter.drawLine( 0, i*3, width()-1, i*3 ); 990 painter.drawLine( 0, i*3, width()-1, i*3 );
984 painter.drawLine( 0, i*3+1, width()-1, i*3+1 ); 991 painter.drawLine( 0, i*3+1, width()-1, i*3+1 );
985 painter.setPen( colorGroup().background().light(105) ); 992 painter.setPen( colorGroup().background().light(105) );
986 painter.drawLine( 0, i*3+2, width()-1, i*3+2 ); 993 painter.drawLine( 0, i*3+2, width()-1, i*3+2 );
987 } 994 }
988 painter.end(); 995 painter.end();
989 bgCache->insert( bgName, new BgPixmap(bg) ); 996 bgCache->insert( bgName, new BgPixmap(bg) );
990 } 997 }
991 break; 998 break;
992 } 999 }
993 1000
994 case Image: 1001 case Image:
995 if (!val.isEmpty()) { 1002 if (!val.isEmpty()) {
996 bgName = val; 1003 bgName = val;
997 if ( bgCache->contains( bgName ) ) { 1004 if ( bgCache->contains( bgName ) ) {
998 (*bgCache)[bgName]->ref++; 1005 (*bgCache)[bgName]->ref++;
999 bg = (*bgCache)[bgName]->pm; 1006 bg = (*bgCache)[bgName]->pm;
1000 } else { 1007 } else {
1001 QString imgFile = bgName; 1008 QString imgFile = bgName;
1002 bool tile = FALSE; 1009 bool tile = FALSE;
1003 if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) { 1010 if ( imgFile[0]!='/' || !QFile::exists(imgFile) ) {
1004 imgFile = Resource::findPixmap( imgFile ); 1011 imgFile = OResource::findPixmap( imgFile );
1005 tile = TRUE; 1012 tile = TRUE;
1006 } 1013 }
1007 QImage img = loadBackgroundImage(imgFile); 1014 QImage img = loadBackgroundImage(imgFile);
1008 1015
1009 1016
1010 if ( img.depth() == 1 ) 1017 if ( img.depth() == 1 )
1011 img = img.convertDepth(8); 1018 img = img.convertDepth(8);
1012 img.setAlphaBuffer(FALSE); 1019 img.setAlphaBuffer(FALSE);
1013 bg.convertFromImage(img); 1020 bg.convertFromImage(img);
1014 bgCache->insert( bgName, new BgPixmap(bg) ); 1021 bgCache->insert( bgName, new BgPixmap(bg) );
1015 } 1022 }
1016 } 1023 }
1017 break; 1024 break;
1018 1025
1019 case SolidColor: 1026 case SolidColor:
1020 default: 1027 default:
1021 break; 1028 break;
1022 } 1029 }
1023 1030
1024 const QObjectList *list = queryList( "QWidget", 0, FALSE ); 1031 const QObjectList *list = queryList( "QWidget", 0, FALSE );
1025 QObject *obj; 1032 QObject *obj;
1026 for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) { 1033 for ( QObjectListIt it( *list ); (obj=it.current()); ++it ) {
1027 if ( obj->isWidgetType() ) { 1034 if ( obj->isWidgetType() ) {
1028 QWidget *w = (QWidget*)obj; 1035 QWidget *w = (QWidget*)obj;