-rw-r--r-- | core/launcher/launcherview.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 9f86136..dbcb0d7 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -12,193 +12,195 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "launcherview.h" #include <qpe/qpeapplication.h> #include <qpe/applnk.h> #include <qpe/qpedebug.h> #include <qpe/categories.h> #include <qpe/categoryselect.h> #include <qpe/menubutton.h> #include <qpe/mimetype.h> #include <qpe/resource.h> #include <qpe/qpetoolbar.h> //#include <qtopia/private/palmtoprecord.h> #include <qtimer.h> #include <qtextstream.h> #include <qdict.h> #include <qfile.h> #include <qfileinfo.h> #include <qhbox.h> #include <qiconview.h> #include <qpainter.h> #include <qregexp.h> #include <qtoolbutton.h> #include <qimage.h> class BgPixmap { public: BgPixmap( const QPixmap &p ) : pm(p), ref(1) {} QPixmap pm; int ref; }; static QMap<QString,BgPixmap*> *bgCache = 0; class LauncherIconView : public QIconView { public: LauncherIconView( QWidget* parent, const char* name=0 ) : QIconView(parent,name), tf(""), cf(0), bsy(0), bigIcns(TRUE), bgColor(white) { sortmeth = Name; hidden.setAutoDelete(TRUE); ike = FALSE; busytimer = 0; calculateGrid( Bottom ); } ~LauncherIconView() { #if 0 // debuggery QListIterator<AppLnk> it(hidden); AppLnk* l; while ((l=it.current())) { ++it; //qDebug("%p: hidden (should remove)",l); } #endif } QPixmap* busyPixmap() const { return (QPixmap*)&bpm; } QIconViewItem* busyItem() const { return bsy; } void setBigIcons( bool bi ) { bigIcns = bi; } void updateCategoriesAndMimeTypes(); void doAutoScroll() { // We don't want rubberbanding (yet) } void setBusy(bool on) { QIconViewItem *c = on ? currentItem() : 0; if ( bsy != c ) { if ( bsy ) bsy-> repaint ( ); bsy = c; if ( bsy ) { busytimer = startTimer ( 150 ); busystate = 50; - startTimer ( 0 ); + // not sure what this startTimer is for, maybe i am just to tired. But + // currently that causes 100% cpuload on app launch + //startTimer ( 0 ); } else killTimer ( busytimer ); } } virtual void timerEvent ( QTimerEvent *te ) { if ( !te || ( te-> timerId ( ) == busytimer )) { if ( bsy ) { QPixmap *src = bsy-> QIconViewItem::pixmap(); QImage img = src->convertToImage(); QRgb* rgb; int count; if ( img.depth() == 32 ) { rgb = (QRgb*)img.bits(); count = img.bytesPerLine()/sizeof(QRgb)*img.height(); } else { rgb = img.colorTable(); count = img.numColors(); } int rc, gc, bc; int bs = ::abs ( busystate ) + 25; colorGroup().highlight().rgb( &rc, &gc, &bc ); rc = rc * bs / 100; gc = gc * bs / 100; bc = bc * bs / 100; for ( int r = 0; r < count; r++, rgb++ ) { int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; int ai = qAlpha ( *rgb ); *rgb = qRgba ( ri, gi, bi, ai ); } bpm.convertFromImage( img ); bsy-> repaint ( ); busystate += 10; if ( busystate > 50 ) busystate = -40; } } } bool inKeyEvent() const { return ike; } void keyPressEvent(QKeyEvent* e) { ike = TRUE; if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) returnPressed(currentItem()); QIconView::keyPressEvent(e); ike = FALSE; } void addItem(AppLnk* app, bool resort=TRUE); bool removeLink(const QString& linkfile); QStringList mimeTypes() const; QStringList categories() const; void clear() { mimes.clear(); cats.clear(); QIconView::clear(); hidden.clear(); } void addCatsAndMimes(AppLnk* app) { // QStringList c = app->categories(); // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) { // cats.replace(*cit,(void*)1); // } QString maj=app->type(); int sl=maj.find('/'); if (sl>=0) { QString k; k = maj.left(12) == "application/" ? maj : maj.left(sl); mimes.replace(k,(void*)1); } } void setBackgroundPixmap( const QPixmap &pm ) { bgPixmap = pm; } void setBackgroundColor( const QColor &c ) { bgColor = c; } void drawBackground( QPainter *p, const QRect &r ) { |