author | alwin <alwin> | 2004-11-08 20:26:03 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-08 20:26:03 (UTC) |
commit | 1480f96170cb7cd7c262a14ad56ff08f384de10f (patch) (unidiff) | |
tree | ef83e5ce722809c0e84fd88ff885132098a67bf4 /core/launcher/launcherview.cpp | |
parent | cce0a7a0d315993645870e88591b4afd647480a7 (diff) | |
download | opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.zip opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.tar.gz opie-1480f96170cb7cd7c262a14ad56ff08f384de10f.tar.bz2 |
timer for releasing a reference to opie-eye_slave if exists when unused for ten
minutes.
Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/launcherview.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index 506c11e..42704ba 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -262,24 +262,25 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon) | |||
262 | 262 | ||
263 | //=========================================================================== | 263 | //=========================================================================== |
264 | // Implemantation of LauncherIconview start | 264 | // Implemantation of LauncherIconview start |
265 | //=========================================================================== | 265 | //=========================================================================== |
266 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) | 266 | LauncherIconView::LauncherIconView( QWidget* parent, const char* name ) |
267 | : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) | 267 | : QIconView(parent,name),tf(""),cf(0),bsy(0),busyTimer(0),bigIcns(TRUE),bgColor(white) |
268 | { | 268 | { |
269 | m_EyeCallBack = 0; | 269 | m_EyeCallBack = 0; |
270 | sortmeth = Name; | 270 | sortmeth = Name; |
271 | hidden.setAutoDelete(TRUE); | 271 | hidden.setAutoDelete(TRUE); |
272 | ike = FALSE; | 272 | ike = FALSE; |
273 | calculateGrid( Bottom ); | 273 | calculateGrid( Bottom ); |
274 | connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer())); | ||
274 | } | 275 | } |
275 | 276 | ||
276 | LauncherIconView::~LauncherIconView() | 277 | LauncherIconView::~LauncherIconView() |
277 | { | 278 | { |
278 | #if 0 // debuggery | 279 | #if 0 // debuggery |
279 | QListIterator<AppLnk> it(hidden); | 280 | QListIterator<AppLnk> it(hidden); |
280 | AppLnk* l; | 281 | AppLnk* l; |
281 | while ((l=it.current())) { | 282 | while ((l=it.current())) { |
282 | ++it; | 283 | ++it; |
283 | //odebug << "" << l << ": hidden (should remove)" << oendl; | 284 | //odebug << "" << l << ": hidden (should remove)" << oendl; |
284 | } | 285 | } |
285 | #endif | 286 | #endif |
@@ -446,30 +447,41 @@ void LauncherIconView::checkCallback() | |||
446 | void LauncherIconView::addCheckItem(AppLnk* app) | 447 | void LauncherIconView::addCheckItem(AppLnk* app) |
447 | { | 448 | { |
448 | LauncherItem*item = new LauncherItem( this, app, bigIcns ); | 449 | LauncherItem*item = new LauncherItem( this, app, bigIcns ); |
449 | if (item->isEyeImage()) { | 450 | if (item->isEyeImage()) { |
450 | checkCallback(); | 451 | checkCallback(); |
451 | } | 452 | } |
452 | } | 453 | } |
453 | 454 | ||
454 | void LauncherIconView::requestEyePix(const LauncherItem*item) | 455 | void LauncherIconView::requestEyePix(const LauncherItem*item) |
455 | { | 456 | { |
456 | if (!item) return; | 457 | if (!item) return; |
457 | if (item->isEyeImage()) { | 458 | if (item->isEyeImage()) { |
459 | m_eyeTimer.changeInterval(600000); | ||
458 | checkCallback(); | 460 | checkCallback(); |
459 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); | 461 | int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize(); |
460 | m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); | 462 | m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s); |
461 | } | 463 | } |
462 | } | 464 | } |
463 | 465 | ||
466 | void LauncherIconView::stopEyeTimer() | ||
467 | { | ||
468 | odebug << "Launcherview: delete opie-eye handle" << oendl; | ||
469 | if (m_EyeCallBack) { | ||
470 | delete m_EyeCallBack; | ||
471 | m_EyeCallBack=0; | ||
472 | } | ||
473 | m_eyeTimer.stop(); | ||
474 | } | ||
475 | |||
464 | void LauncherIconView::addItem(AppLnk* app, bool resort) | 476 | void LauncherIconView::addItem(AppLnk* app, bool resort) |
465 | { | 477 | { |
466 | addCatsAndMimes(app); | 478 | addCatsAndMimes(app); |
467 | if ( (tf.isEmpty() || tf.match(app->type()) >= 0) | 479 | if ( (tf.isEmpty() || tf.match(app->type()) >= 0) |
468 | && (cf == 0 || app->categories().contains(cf) | 480 | && (cf == 0 || app->categories().contains(cf) |
469 | || cf == -1 && app->categories().count() == 0 ) ) { | 481 | || cf == -1 && app->categories().count() == 0 ) ) { |
470 | addCheckItem(app); | 482 | addCheckItem(app); |
471 | } else { | 483 | } else { |
472 | hidden.append(app); | 484 | hidden.append(app); |
473 | } | 485 | } |
474 | if ( resort ){ | 486 | if ( resort ){ |
475 | sort(); | 487 | sort(); |
@@ -592,24 +604,39 @@ void LauncherIconView::calculateGrid( ItemTextPos pos ) | |||
592 | cols = viewerWidth/150; | 604 | cols = viewerWidth/150; |
593 | setSpacing( 2 ); | 605 | setSpacing( 2 ); |
594 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); | 606 | setGridX( (viewerWidth-(cols+1)*spacing())/cols ); |
595 | setGridY( fontMetrics().height()+2 ); | 607 | setGridY( fontMetrics().height()+2 ); |
596 | } | 608 | } |
597 | } | 609 | } |
598 | 610 | ||
599 | void LauncherIconView::styleChange( QStyle &old ) | 611 | void LauncherIconView::styleChange( QStyle &old ) |
600 | { | 612 | { |
601 | QIconView::styleChange( old ); | 613 | QIconView::styleChange( old ); |
602 | calculateGrid( itemTextPos() ); | 614 | calculateGrid( itemTextPos() ); |
603 | } | 615 | } |
616 | |||
617 | void LauncherIconView::keyPressEvent(QKeyEvent* e) | ||
618 | { | ||
619 | ike = TRUE; | ||
620 | if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { | ||
621 | if ( (e->state() & ShiftButton) ) | ||
622 | emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); | ||
623 | else | ||
624 | returnPressed(currentItem()); | ||
625 | } | ||
626 | |||
627 | QIconView::keyPressEvent(e); | ||
628 | ike = FALSE; | ||
629 | } | ||
630 | |||
604 | //=========================================================================== | 631 | //=========================================================================== |
605 | // Implemantation of LauncherIconview end | 632 | // Implemantation of LauncherIconview end |
606 | //=========================================================================== | 633 | //=========================================================================== |
607 | 634 | ||
608 | 635 | ||
609 | //=========================================================================== | 636 | //=========================================================================== |
610 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) | 637 | LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) |
611 | : QVBox( parent, name, fl ) | 638 | : QVBox( parent, name, fl ) |
612 | { | 639 | { |
613 | catmb = 0; | 640 | catmb = 0; |
614 | icons = new LauncherIconView( this ); | 641 | icons = new LauncherIconView( this ); |
615 | setFocusProxy(icons); | 642 | setFocusProxy(icons); |
@@ -1114,25 +1141,24 @@ LauncherThumbReceiver::~LauncherThumbReceiver() | |||
1114 | } | 1141 | } |
1115 | 1142 | ||
1116 | void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) | 1143 | void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) |
1117 | { | 1144 | { |
1118 | PixmapInfos pixinfos; | 1145 | PixmapInfos pixinfos; |
1119 | QDataStream stream( at, IO_ReadOnly ); | 1146 | QDataStream stream( at, IO_ReadOnly ); |
1120 | 1147 | ||
1121 | /* we are just interested in thumbmails */ | 1148 | /* we are just interested in thumbmails */ |
1122 | if ( str == "pixmapsHandled(PixmapList)" ) | 1149 | if ( str == "pixmapsHandled(PixmapList)" ) |
1123 | stream >> pixinfos; | 1150 | stream >> pixinfos; |
1124 | 1151 | ||
1125 | for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) { | 1152 | for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) { |
1126 | odebug << "Pixinfos: " << (*it).file << " - " << (*it).width << oendl; | ||
1127 | emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width); | 1153 | emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width); |
1128 | } | 1154 | } |
1129 | } | 1155 | } |
1130 | 1156 | ||
1131 | void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height) | 1157 | void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height) |
1132 | { | 1158 | { |
1133 | PixmapInfo rItem; | 1159 | PixmapInfo rItem; |
1134 | rItem.file = file; | 1160 | rItem.file = file; |
1135 | rItem.width = width; | 1161 | rItem.width = width; |
1136 | rItem.height = height; | 1162 | rItem.height = height; |
1137 | m_inThumbNail.append(rItem); | 1163 | m_inThumbNail.append(rItem); |
1138 | QTimer::singleShot(0, this, SLOT(sendRequest())); | 1164 | QTimer::singleShot(0, this, SLOT(sendRequest())); |