-rw-r--r-- | core/launcher/launcherview.cpp | 91 | ||||
-rw-r--r-- | core/launcher/launcherview.h | 5 |
2 files changed, 64 insertions, 32 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 673e53c..506c11e 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -75,2 +75,8 @@ class LauncherItem : public QIconViewItem | |||
75 | public: | 75 | public: |
76 | enum iconstate_t { | ||
77 | BASE_ICON, | ||
78 | WAITING_ICON, | ||
79 | EYE_ICON | ||
80 | }; | ||
81 | |||
76 | LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); | 82 | LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE ); |
@@ -90,2 +96,4 @@ public: | |||
90 | void setEyePixmap(const QPixmap&aIcon); | 96 | void setEyePixmap(const QPixmap&aIcon); |
97 | virtual QPixmap*pixmap()const; | ||
98 | |||
91 | protected: | 99 | protected: |
@@ -101,19 +109,5 @@ private: | |||
101 | bool m_EyeImage; | 109 | bool m_EyeImage; |
110 | iconstate_t m_EyeImageSet; | ||
102 | }; | 111 | }; |
103 | 112 | ||
104 | |||
105 | bool LauncherView::bsy=FALSE; | ||
106 | |||
107 | void LauncherView::setBusy(bool on) | ||
108 | { | ||
109 | icons->setBusy(on); | ||
110 | } | ||
111 | |||
112 | void LauncherView::setBusyIndicatorType( const QString& type ) { | ||
113 | if ( type. lower ( ) == "animated" ) | ||
114 | icons->setBusyIndicatorType( BIT_Animated ) ; | ||
115 | else | ||
116 | icons->setBusyIndicatorType( BIT_Normal ) ; | ||
117 | } | ||
118 | |||
119 | LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) | 113 | LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) |
@@ -126,3 +120,4 @@ LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) | |||
126 | m_iPixmap(), | 120 | m_iPixmap(), |
127 | m_EyeImage(false) | 121 | m_EyeImage(false), |
122 | m_EyeImageSet(BASE_ICON) | ||
128 | { | 123 | { |
@@ -142,2 +137,11 @@ LauncherItem::~LauncherItem() | |||
142 | 137 | ||
138 | QPixmap*LauncherItem::pixmap()const | ||
139 | { | ||
140 | if (m_EyeImage && m_EyeImageSet == BASE_ICON) { | ||
141 | LauncherIconView* liv = (LauncherIconView*)iconView(); | ||
142 | liv->requestEyePix(this); | ||
143 | } | ||
144 | return QIconViewItem::pixmap(); | ||
145 | } | ||
146 | |||
143 | int LauncherItem::compare ( QIconViewItem * i ) const | 147 | int LauncherItem::compare ( QIconViewItem * i ) const |
@@ -154,4 +158,4 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg ) | |||
154 | if ( liv->currentItem() == this ) { | 158 | if ( liv->currentItem() == this ) { |
155 | liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); | 159 | liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) ); |
156 | mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); | 160 | mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) ); |
157 | } | 161 | } |
@@ -162,10 +166,8 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg ) | |||
162 | if ( liv->busyItem() == this ) | 166 | if ( liv->busyItem() == this ) |
163 | paintAnimatedIcon(p); | 167 | paintAnimatedIcon(p); |
164 | 168 | ||
165 | if ( liv->currentItem() == this ) | 169 | if ( liv->currentItem() == this ) |
166 | liv->setItemTextBackground( oldBrush ); | 170 | liv->setItemTextBackground( oldBrush ); |
167 | } | 171 | } |
168 | 172 | ||
169 | |||
170 | |||
171 | void LauncherItem::paintAnimatedIcon( QPainter *p ) | 173 | void LauncherItem::paintAnimatedIcon( QPainter *p ) |
@@ -257,2 +259,3 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon) | |||
257 | setPixmap(aIcon); | 259 | setPixmap(aIcon); |
260 | m_EyeImageSet = EYE_ICON; | ||
258 | } | 261 | } |
@@ -423,7 +426,8 @@ LauncherItem*LauncherIconView::findDocItem(const QString&fname) | |||
423 | 426 | ||
424 | void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile) | 427 | void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width) |
425 | { | 428 | { |
429 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | ||
430 | if (s!=width) return; | ||
426 | LauncherItem*item = findDocItem(aFile); | 431 | LauncherItem*item = findDocItem(aFile); |
427 | if (!item||!item->isEyeImage()) return; | 432 | if (!item||!item->isEyeImage()) return; |
428 | |||
429 | item->setEyePixmap(aPixmap); | 433 | item->setEyePixmap(aPixmap); |
@@ -437,4 +441,4 @@ void LauncherIconView::checkCallback() | |||
437 | m_EyeCallBack = new LauncherThumbReceiver(); | 441 | m_EyeCallBack = new LauncherThumbReceiver(); |
438 | connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&)), | 442 | connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), |
439 | this,SLOT(setEyePixmap(const QPixmap&,const QString&))); | 443 | this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); |
440 | } | 444 | } |
@@ -446,4 +450,12 @@ void LauncherIconView::addCheckItem(AppLnk* app) | |||
446 | checkCallback(); | 450 | checkCallback(); |
451 | } | ||
452 | } | ||
453 | |||
454 | void LauncherIconView::requestEyePix(const LauncherItem*item) | ||
455 | { | ||
456 | if (!item) return; | ||
457 | if (item->isEyeImage()) { | ||
458 | checkCallback(); | ||
447 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | 459 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); |
448 | m_EyeCallBack->requestThumb(app->file(),s,s); | 460 | m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); |
449 | } | 461 | } |
@@ -635,2 +647,17 @@ LauncherView::~LauncherView() | |||
635 | 647 | ||
648 | |||
649 | bool LauncherView::bsy=FALSE; | ||
650 | |||
651 | void LauncherView::setBusy(bool on) | ||
652 | { | ||
653 | icons->setBusy(on); | ||
654 | } | ||
655 | |||
656 | void LauncherView::setBusyIndicatorType( const QString& type ) { | ||
657 | if ( type. lower ( ) == "animated" ) | ||
658 | icons->setBusyIndicatorType( BIT_Animated ) ; | ||
659 | else | ||
660 | icons->setBusyIndicatorType( BIT_Normal ) ; | ||
661 | } | ||
662 | |||
636 | void LauncherView::hideIcons() | 663 | void LauncherView::hideIcons() |
@@ -1055,2 +1082,6 @@ void LauncherView::flushBgCache() | |||
1055 | 1082 | ||
1083 | /* | ||
1084 | * Launcherthumbnail handling for image files | ||
1085 | */ | ||
1086 | |||
1056 | /* special image handling - based on opie eye */ | 1087 | /* special image handling - based on opie eye */ |
@@ -1095,3 +1126,3 @@ void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) | |||
1095 | odebug << "Pixinfos: " << (*it).file << " - " << (*it).width << oendl; | 1126 | odebug << "Pixinfos: " << (*it).file << " - " << (*it).width << oendl; |
1096 | emit sig_Thumbnail((*it).pixmap,(*it).file); | 1127 | emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width); |
1097 | } | 1128 | } |
@@ -1106,3 +1137,3 @@ void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height | |||
1106 | m_inThumbNail.append(rItem); | 1137 | m_inThumbNail.append(rItem); |
1107 | QTimer::singleShot(2, this, SLOT(sendRequest())); | 1138 | QTimer::singleShot(0, this, SLOT(sendRequest())); |
1108 | } | 1139 | } |
@@ -1114,4 +1145,4 @@ void LauncherThumbReceiver::sendRequest() | |||
1114 | env << m_inThumbNail; | 1145 | env << m_inThumbNail; |
1146 | m_inThumbNail.clear(); | ||
1115 | } | 1147 | } |
1116 | m_inThumbNail.clear(); | ||
1117 | } | 1148 | } |
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h index 3cca7f7..0be9a1f 100644 --- a/core/launcher/launcherview.h +++ b/core/launcher/launcherview.h | |||
@@ -148,3 +148,3 @@ protected slots: | |||
148 | signals: | 148 | signals: |
149 | void sig_Thumbnail(const QPixmap&,const QString&); | 149 | void sig_Thumbnail(const QPixmap&,const QString&,int); |
150 | 150 | ||
@@ -218,2 +218,3 @@ public: | |||
218 | int compare(const AppLnk* a, const AppLnk* b); | 218 | int compare(const AppLnk* a, const AppLnk* b); |
219 | void requestEyePix(const LauncherItem*which); | ||
219 | 220 | ||
@@ -230,3 +231,3 @@ protected: | |||
230 | protected slots: | 231 | protected slots: |
231 | void setEyePixmap(const QPixmap&,const QString&); | 232 | void setEyePixmap(const QPixmap&,const QString&,int width); |
232 | 233 | ||