author | alwin <alwin> | 2005-03-12 02:13:52 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-12 02:13:52 (UTC) |
commit | cd1b9f7c11c73ef0df0ce66c53466c979a3a4d42 (patch) (unidiff) | |
tree | d4ed9b082abe2aa645fbd58b86d65f5ce9c48348 /core/launcher/launcherview.cpp | |
parent | 84af289057291a49a52a60b390bc5320c02b5a55 (diff) | |
download | opie-cd1b9f7c11c73ef0df0ce66c53466c979a3a4d42.zip opie-cd1b9f7c11c73ef0df0ce66c53466c979a3a4d42.tar.gz opie-cd1b9f7c11c73ef0df0ce66c53466c979a3a4d42.tar.bz2 |
And I'm wondering why opie sometimes is that slow. Hopefully reduced
the calls to opie-eye for images in documenttab when changing layout
and so on.
Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/launcherview.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index a4c7561..d960908 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -108,12 +108,14 @@ private: | |||
108 | BusyIndicatorType busyType; | 108 | BusyIndicatorType busyType; |
109 | int psize; | 109 | int psize; |
110 | bool m_EyeImage; | 110 | bool m_EyeImage; |
111 | iconstate_t m_EyeImageSet; | 111 | iconstate_t m_EyeImageSet; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static bool s_IgnoreNextPix = false; | ||
115 | |||
114 | LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) | 116 | LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) |
115 | : QIconViewItem( parent, applnk->name(), | 117 | : QIconViewItem( parent, applnk->name(), |
116 | bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), | 118 | bigIcon ? applnk->bigPixmap() :applnk->pixmap() ), |
117 | isBigIcon( bigIcon ), | 119 | isBigIcon( bigIcon ), |
118 | iteration(0), | 120 | iteration(0), |
119 | app(applnk), // Takes ownership | 121 | app(applnk), // Takes ownership |
@@ -138,13 +140,13 @@ LauncherItem::~LauncherItem() | |||
138 | liv->setBusy(FALSE); | 140 | liv->setBusy(FALSE); |
139 | delete app; | 141 | delete app; |
140 | } | 142 | } |
141 | 143 | ||
142 | QPixmap*LauncherItem::pixmap()const | 144 | QPixmap*LauncherItem::pixmap()const |
143 | { | 145 | { |
144 | if (m_EyeImage && m_EyeImageSet == BASE_ICON) { | 146 | if (m_EyeImage && m_EyeImageSet == BASE_ICON && s_IgnoreNextPix==false) { |
145 | LauncherIconView* liv = (LauncherIconView*)iconView(); | 147 | LauncherIconView* liv = (LauncherIconView*)iconView(); |
146 | liv->requestEyePix(this); | 148 | liv->requestEyePix(this); |
147 | } | 149 | } |
148 | return QIconViewItem::pixmap(); | 150 | return QIconViewItem::pixmap(); |
149 | } | 151 | } |
150 | 152 | ||
@@ -291,13 +293,13 @@ LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) | |||
291 | hidden.setAutoDelete(TRUE); | 293 | hidden.setAutoDelete(TRUE); |
292 | ike = FALSE; | 294 | ike = FALSE; |
293 | calculateGrid( Bottom ); | 295 | calculateGrid( Bottom ); |
294 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); | 296 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); |
295 | Config config( "Launcher" ); | 297 | Config config( "Launcher" ); |
296 | config.setGroup( "GUI" ); | 298 | config.setGroup( "GUI" ); |
297 | setStaticBackgroundPicture( config.readBoolEntry( "StaticBackground", true ) ); | 299 | setStaticBackgroundPicture( config.readBoolEntry( "StaticBackground", true ) ); |
298 | } | 300 | } |
299 | 301 | ||
300 | LauncherIconView::~LauncherIconView() | 302 | LauncherIconView::~LauncherIconView() |
301 | { | 303 | { |
302 | odebug << "LauncherIconView::~LauncherIconView()" << oendl; | 304 | odebug << "LauncherIconView::~LauncherIconView()" << oendl; |
303 | #if 0 // debuggery | 305 | #if 0 // debuggery |
@@ -307,26 +309,40 @@ LauncherIconView::~LauncherIconView() | |||
307 | ++it; | 309 | ++it; |
308 | //odebug << "" << l << ": hidden (should remove)" << oendl; | 310 | //odebug << "" << l << ": hidden (should remove)" << oendl; |
309 | } | 311 | } |
310 | #endif | 312 | #endif |
311 | } | 313 | } |
312 | 314 | ||
315 | void LauncherIconView::unsetPalette() | ||
316 | { | ||
317 | s_IgnoreNextPix = true; | ||
318 | QIconView::unsetPalette(); | ||
319 | s_IgnoreNextPix = false; | ||
320 | } | ||
321 | |||
322 | void LauncherIconView::setPalette(const QPalette & palette) | ||
323 | { | ||
324 | s_IgnoreNextPix = true; | ||
325 | QIconView::setPalette(palette); | ||
326 | s_IgnoreNextPix = false; | ||
327 | } | ||
328 | |||
313 | void LauncherIconView::setStaticBackgroundPicture( bool enable ) | 329 | void LauncherIconView::setStaticBackgroundPicture( bool enable ) |
314 | { | 330 | { |
315 | staticBackground = enable; | 331 | staticBackground = enable; |
316 | if ( staticBackground ) | 332 | if ( staticBackground ) |
317 | { | 333 | { |
318 | setStaticBackground( true ); | 334 | setStaticBackground( true ); |
319 | verticalScrollBar()->setTracking( false ); | 335 | verticalScrollBar()->setTracking( false ); |
320 | } | 336 | } |
321 | else | 337 | else |
322 | { | 338 | { |
323 | setStaticBackground( false ); | 339 | setStaticBackground( false ); |
324 | verticalScrollBar()->setTracking( true ); | 340 | verticalScrollBar()->setTracking( true ); |
325 | } | 341 | } |
326 | } | 342 | } |
327 | 343 | ||
328 | int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) | 344 | int LauncherIconView::compare(const AppLnk* a, const AppLnk* b) |
329 | { | 345 | { |
330 | switch (sortmeth) { | 346 | switch (sortmeth) { |
331 | case Name: | 347 | case Name: |
332 | return a->name().lower().compare(b->name().lower()); | 348 | return a->name().lower().compare(b->name().lower()); |
@@ -483,14 +499,14 @@ void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,in | |||
483 | void LauncherIconView::checkCallback() | 499 | void LauncherIconView::checkCallback() |
484 | { | 500 | { |
485 | if (!m_EyeCallBack) { | 501 | if (!m_EyeCallBack) { |
486 | m_EyeCallBack = new LauncherThumbReceiver(); | 502 | m_EyeCallBack = new LauncherThumbReceiver(); |
487 | connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), | 503 | connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)), |
488 | this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); | 504 | this,SLOT(setEyePixmap(const QPixmap&,const QString&,int))); |
505 | m_eyeTimer.changeInterval(600000); | ||
489 | } | 506 | } |
490 | m_eyeTimer.changeInterval(600000); | ||
491 | } | 507 | } |
492 | 508 | ||
493 | void LauncherIconView::addCheckItem(AppLnk* app) | 509 | void LauncherIconView::addCheckItem(AppLnk* app) |
494 | { | 510 | { |
495 | LauncherItem*item = new LauncherItem( this, app, bigIcns ); | 511 | LauncherItem*item = new LauncherItem( this, app, bigIcns ); |
496 | if (item->isEyeImage()) { | 512 | if (item->isEyeImage()) { |
@@ -1205,14 +1221,16 @@ QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { | |||
1205 | 1221 | ||
1206 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { | 1222 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { |
1207 | return s << inf.file << inf.width << inf.height; | 1223 | return s << inf.file << inf.width << inf.height; |
1208 | } | 1224 | } |
1209 | 1225 | ||
1210 | LauncherThumbReceiver::LauncherThumbReceiver() | 1226 | LauncherThumbReceiver::LauncherThumbReceiver() |
1211 | :QObject() | 1227 | :QObject(),requestTimer(this) |
1212 | { | 1228 | { |
1229 | |||
1230 | connect(&requestTimer,SIGNAL(timeout()),SLOT(sendRequest())); | ||
1213 | QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this ); | 1231 | QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this ); |
1214 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), | 1232 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), |
1215 | this, SLOT(recieve(const QCString&,const QByteArray&)) ); | 1233 | this, SLOT(recieve(const QCString&,const QByteArray&)) ); |
1216 | 1234 | ||
1217 | { | 1235 | { |
1218 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | 1236 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); |
@@ -1244,13 +1262,15 @@ void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height | |||
1244 | { | 1262 | { |
1245 | PixmapInfo rItem; | 1263 | PixmapInfo rItem; |
1246 | rItem.file = file; | 1264 | rItem.file = file; |
1247 | rItem.width = width; | 1265 | rItem.width = width; |
1248 | rItem.height = height; | 1266 | rItem.height = height; |
1249 | m_inThumbNail.append(rItem); | 1267 | m_inThumbNail.append(rItem); |
1250 | QTimer::singleShot(2, this, SLOT(sendRequest())); | 1268 | if (!requestTimer.isActive()) { |
1269 | requestTimer.start(100,true); | ||
1270 | } | ||
1251 | } | 1271 | } |
1252 | 1272 | ||
1253 | void LauncherThumbReceiver::sendRequest() | 1273 | void LauncherThumbReceiver::sendRequest() |
1254 | { | 1274 | { |
1255 | if (m_inThumbNail.count()>0) { | 1275 | if (m_inThumbNail.count()>0) { |
1256 | QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); | 1276 | QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); |