-rw-r--r-- | core/launcher/launcher.cpp | 43 | ||||
-rw-r--r-- | core/launcher/launcher.h | 4 | ||||
-rw-r--r-- | core/launcher/launcherview.cpp | 109 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 7 |
4 files changed, 113 insertions, 50 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 5ec1cf8..ccc2114 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -79,3 +79,3 @@ static bool isVisibleWindow( int ); LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : - QVBox( parent ), docview( 0 ) + QVBox( parent ), docview( 0 ),docTabEnabled(true),m_DocumentTabId(0) { @@ -130,3 +130,3 @@ void LauncherTabWidget::createDocLoadingWidget() cfg.setGroup( "DocTab" ); - bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); + docTabEnabled = cfg.readBoolEntry( "Enable", true ); @@ -171,3 +171,3 @@ void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) if ( message == "nextView()" ) - categoryBar->nextTab(); + categoryBar->nextTab(); } @@ -177,7 +177,7 @@ void LauncherTabWidget::raiseTabWidget() if ( categoryBar->currentView() == docView() - && docLoadingWidgetEnabled ) { - stack->raiseWidget( docLoadingWidget ); - docLoadingWidget->updateGeometry(); + && docLoadingWidgetEnabled ) { + stack->raiseWidget( docLoadingWidget ); + docLoadingWidget->updateGeometry(); } else { - stack->raiseWidget( categoryBar->currentView() ); + stack->raiseWidget( categoryBar->currentView() ); } @@ -194,3 +194,3 @@ void LauncherTabWidget::tabProperties() if ( rv >= 0 && rv != view->viewMode() ) { - view->setViewMode( (LauncherView::ViewMode)rv ); + view->setViewMode( (LauncherView::ViewMode)rv ); } @@ -204,5 +204,5 @@ void LauncherTabWidget::deleteView( const QString& id ) if ( t ) { - stack->removeWidget( t->view ); - delete t->view; - categoryBar->removeTab( t ); + stack->removeWidget( t->view ); + delete t->view; + categoryBar->removeTab( t ); } @@ -218,3 +218,5 @@ LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, + int n = categoryBar->count(); + stack->addWidget( view, n ); @@ -223,5 +225,6 @@ LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, categoryBar->insertTab( tab, n-1 ); - - if ( id == "Documents" ) - docview = view; + if ( id == "Documents" ) { + docview = view; + m_DocumentTabId = n; + } @@ -242,3 +245,3 @@ LauncherView *LauncherTabWidget::view( const QString &id ) if ( !t ) - return 0; + return 0; return t->view; @@ -254,4 +257,4 @@ void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { - docLoadingWidgetEnabled = v; - raiseTabWidget(); + docLoadingWidgetEnabled = v; + raiseTabWidget(); } @@ -606,3 +609,2 @@ void Launcher::properties( AppLnk *appLnk ) if (QPEApplication::execDialog( &prop )==QDialog::Accepted && tabs->currentView()==tabs->docView()) { - tabs->docView()->updateTools(); } @@ -723,4 +725,9 @@ void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) { +#if 0 documentRemoved( oldDoc ); documentAdded( newDoc ); +// tabs->docView()->updateTools(); +#else + tabs->docView()->changeItem(oldDoc,new DocLnk(newDoc)); +#endif } diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 2eaf77c..db6ac54 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h @@ -92,2 +92,4 @@ private: bool docLoadingWidgetEnabled; + bool docTabEnabled; + int m_DocumentTabId; }; @@ -137,3 +139,3 @@ signals: private slots: - void systemMessage( const QCString &, const QByteArray &); + void systemMessage( const QCString &, const QByteArray &); diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index ff26133..c9efacb 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp @@ -46,2 +46,3 @@ using namespace Opie::Core; +typedef QMap<QString,QPixmap>::Iterator pixiter; @@ -107,3 +108,2 @@ private: int psize; - QPixmap m_iPixmap; bool m_EyeImage; @@ -119,3 +119,2 @@ LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) psize( (bigIcon ? applnk->bigPixmap().width() :applnk->pixmap().width() ) ), - m_iPixmap(), m_EyeImage(false), @@ -125,3 +124,7 @@ LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) m_EyeImage = true; - m_iPixmap = (bigIcon ? applnk->bigPixmap():applnk->pixmap()); + QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(applnk->file()); + if (it != LauncherIconView::sm_EyeCache->end()) { + m_EyeImageSet = EYE_ICON; + setPixmap(*it); + } } @@ -215,3 +218,9 @@ void LauncherItem::animateIcon() if ( iteration == 0 ) { - QPixmap src = (isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap())); + QPixmap src; + pixiter it; + if (isEyeImage() && (it=LauncherIconView::sm_EyeCache->find(appLnk()->file()))!=LauncherIconView::sm_EyeCache->end()) { + src = (*it); + } else { + src = ((isBigIcon ? app->bigPixmap() : app->pixmap())); + } QImage img = src.convertToImage(); @@ -251,3 +260,10 @@ void LauncherItem::resetIcon() iteration = 0; - setPixmap((isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap()))); + if (isEyeImage()) { + QMap<QString,QPixmap>::Iterator it = LauncherIconView::sm_EyeCache->find(appLnk()->file()); + if (it != LauncherIconView::sm_EyeCache->end()) { + setPixmap(*it); + return; + } + } + setPixmap(isBigIcon ? app->bigPixmap() : app->pixmap()); } @@ -257,3 +273,2 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon) if (!isEyeImage()) return; - m_iPixmap = aIcon; setPixmap(aIcon); @@ -265,2 +280,5 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon) //=========================================================================== + +QMap<QString,QPixmap>* LauncherIconView::sm_EyeCache=0; + LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) @@ -269,2 +287,3 @@ LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) m_EyeCallBack = 0; + if (!sm_EyeCache) sm_EyeCache = new QMap<QString,QPixmap>(); sortmeth = Name; @@ -434,2 +453,3 @@ void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,in if (!item||!item->isEyeImage()) return; + (*sm_EyeCache)[aFile]=aPixmap; item->setEyePixmap(aPixmap); @@ -443,4 +463,4 @@ void LauncherIconView::checkCallback() this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); - m_eyeTimer.changeInterval(600000); } + m_eyeTimer.changeInterval(600000); } @@ -468,2 +488,4 @@ void LauncherIconView::stopEyeTimer() if (m_EyeCallBack) { + disconnect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), + this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); delete m_EyeCallBack; @@ -474,17 +496,2 @@ void LauncherIconView::stopEyeTimer() -void LauncherIconView::addItem(AppLnk* app, bool resort) -{ - addCatsAndMimes(app); - if ( (tf.isEmpty() || tf.match(app->type()) >= 0) - && (cf == 0 || app->categories().contains(cf) - || cf == -1 && app->categories().count() == 0 ) ) { - addCheckItem(app); - } else { - hidden.append(app); - } - if ( resort ){ - sort(); - } -} - void LauncherIconView::updateCategoriesAndMimeTypes() @@ -530,3 +537,3 @@ void LauncherIconView::hideOrShowItems(bool resort) -bool LauncherIconView::removeLink(const QString& linkfile) +bool LauncherIconView::removeLink(const QString& linkfile,bool removeCache) { @@ -541,2 +548,3 @@ bool LauncherIconView::removeLink(const QString& linkfile) ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) { + if (removeCache) sm_EyeCache->remove(l->file()); delete item; @@ -559,2 +567,34 @@ bool LauncherIconView::removeLink(const QString& linkfile) +void LauncherIconView::addItem(AppLnk* app, bool resort) +{ + addCatsAndMimes(app); + if ( (tf.isEmpty() || tf.match(app->type()) >= 0) + && (cf == 0 || app->categories().contains(cf) + || cf == -1 && app->categories().count() == 0 ) ) { + addCheckItem(app); + } else { + hidden.append(app); + } + if ( resort ){ + sort(); + } +} + +void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink) +{ + QString oldfile = old.file(); + QString newfile = nlink->file(); + + if (newfile != oldfile) { + QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile); + if (it != sm_EyeCache->end()) { + (*sm_EyeCache)[newfile]=(*it); + } + removeLink(old.linkFile()); + } else { + removeLink(old.linkFile(),false); + } + addItem(nlink,false); +} + void LauncherIconView::timerEvent( QTimerEvent *te ) @@ -571,2 +611,3 @@ void LauncherIconView::setBigIcons( bool bi ) { + sm_EyeCache->clear(); bigIcns = bi; @@ -758,4 +799,7 @@ void LauncherView::updateTools() int pcat = catmb ? catmb->currentCategory() : -2; - if ( !catmb ) + if ( !catmb ) { catmb = new CategorySelect(tools); + } else if (pcat!=-2) { + + } Categories cats( 0 ); @@ -1022,3 +1066,3 @@ void LauncherView::itemClicked( int btn, QIconViewItem *item ) } - item->setSelected(FALSE); + item->setSelected(FALSE); } @@ -1049,2 +1093,12 @@ bool LauncherView::removeLink(const QString& linkfile) +void LauncherView::addItem(AppLnk* app, bool resort) +{ + icons->addItem(app,resort); +} + +void LauncherView::changeItem(const AppLnk&old,AppLnk*nlink) +{ + icons->changeItem(old,nlink); +} + void LauncherView::setSortEnabled( bool v ) @@ -1066,7 +1120,2 @@ void LauncherView::sort() -void LauncherView::addItem(AppLnk* app, bool resort) -{ - icons->addItem(app,resort); -} - void LauncherView::paletteChange( const QPalette &p ) diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 6d94539..05073ab 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h @@ -58,2 +58,4 @@ public: void addItem(AppLnk* app, bool resort=TRUE); + void changeItem(const AppLnk&old,AppLnk*nlink); + void removeAllItems(); @@ -178,3 +180,4 @@ public: void addItem(AppLnk* app, bool resort=TRUE); - bool removeLink(const QString& linkfile); + bool removeLink(const QString& linkfile,bool removeCache = true); + void changeItem(const AppLnk&old,AppLnk*nlink); @@ -208,2 +211,4 @@ public: + static QMap<QString,QPixmap>* sm_EyeCache; + protected: |