summaryrefslogtreecommitdiff
path: root/core/launcher/launcherview.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp109
1 files changed, 79 insertions, 30 deletions
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 )