Diffstat (limited to 'core/launcher/launcherview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/launcher/launcherview.cpp | 98 |
1 files changed, 95 insertions, 3 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index cd9c14b..1317bda 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -31,2 +31,4 @@ using namespace Opie::Core; | |||
31 | 31 | ||
32 | #include <qpe/qcopenvelope_qws.h> | ||
33 | |||
32 | /* QT */ | 34 | /* QT */ |
@@ -81,2 +83,3 @@ public: | |||
81 | void resetIcon(); | 83 | void resetIcon(); |
84 | bool isEyeImage()const{return m_EyeImage;} | ||
82 | 85 | ||
@@ -86,2 +89,3 @@ public: | |||
86 | void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } | 89 | void setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } |
90 | void setEyePixmap(const QPixmap&aIcon); | ||
87 | protected: | 91 | protected: |
@@ -90,2 +94,3 @@ protected: | |||
90 | AppLnk* app; | 94 | AppLnk* app; |
95 | |||
91 | private: | 96 | private: |
@@ -93,2 +98,6 @@ private: | |||
93 | BusyIndicatorType busyType; | 98 | BusyIndicatorType busyType; |
99 | int psize; | ||
100 | QPixmap m_iPixmap; | ||
101 | bool m_EyeImage; | ||
102 | LauncherThumbReceiver*m_EyeCallback; | ||
94 | }; | 103 | }; |
@@ -379,4 +388,13 @@ LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon ) | |||
379 | iteration(0), | 388 | iteration(0), |
380 | app(applnk) // Takes ownership | 389 | app(applnk), // Takes ownership |
390 | psize( (bigIcon ? applnk->bigPixmap().width() :applnk->pixmap().width() ) ), | ||
391 | m_iPixmap(), | ||
392 | m_EyeImage(false) | ||
381 | { | 393 | { |
394 | m_EyeCallback = new LauncherThumbReceiver(this); | ||
395 | if (applnk->type().lower().startsWith("image/") && applnk->exec().contains("opie-eye",false)) { | ||
396 | m_EyeImage = true; | ||
397 | m_iPixmap = (bigIcon ? applnk->bigPixmap():applnk->pixmap()); | ||
398 | m_EyeCallback->requestThumb(applnk->file(),m_iPixmap.width(),m_iPixmap.height()); | ||
399 | } | ||
382 | } | 400 | } |
@@ -389,2 +407,3 @@ LauncherItem::~LauncherItem() | |||
389 | delete app; | 407 | delete app; |
408 | if (m_EyeCallback) delete m_EyeCallback; | ||
390 | } | 409 | } |
@@ -462,3 +481,3 @@ void LauncherItem::animateIcon() | |||
462 | if ( iteration == 0 ) { | 481 | if ( iteration == 0 ) { |
463 | QPixmap src = isBigIcon ? app->bigPixmap() : app->pixmap(); | 482 | QPixmap src = (isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap())); |
464 | QImage img = src.convertToImage(); | 483 | QImage img = src.convertToImage(); |
@@ -498,3 +517,10 @@ void LauncherItem::resetIcon() | |||
498 | iteration = 0; | 517 | iteration = 0; |
499 | setPixmap( isBigIcon ? app->bigPixmap() : app->pixmap() ); | 518 | setPixmap((isEyeImage()?m_iPixmap:(isBigIcon ? app->bigPixmap() : app->pixmap()))); |
519 | } | ||
520 | |||
521 | void LauncherItem::setEyePixmap(const QPixmap&aIcon) | ||
522 | { | ||
523 | if (!isEyeImage()) return; | ||
524 | m_iPixmap = aIcon; | ||
525 | setPixmap(aIcon); | ||
500 | } | 526 | } |
@@ -1061 +1087,67 @@ void LauncherView::flushBgCache() | |||
1061 | 1087 | ||
1088 | /* special image handling - based on opie eye */ | ||
1089 | QDataStream &operator>>( QDataStream& s, PixmapInfo& inf ) { | ||
1090 | s >> inf.file >> inf.pixmap >> inf.width >> inf.height; | ||
1091 | return s; | ||
1092 | } | ||
1093 | |||
1094 | QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) { | ||
1095 | return s << inf.file << inf.width << inf.height; | ||
1096 | } | ||
1097 | |||
1098 | LauncherThumbReceiver::LauncherThumbReceiver(LauncherItem*parent) | ||
1099 | :QObject() | ||
1100 | { | ||
1101 | m_parent = parent; | ||
1102 | QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this ); | ||
1103 | connect(chan, SIGNAL(received(const QCString&,const QByteArray&)), | ||
1104 | this, SLOT(recieve(const QCString&,const QByteArray&)) ); | ||
1105 | |||
1106 | { | ||
1107 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); | ||
1108 | } | ||
1109 | m_waiting = false; | ||
1110 | } | ||
1111 | |||
1112 | LauncherThumbReceiver::~LauncherThumbReceiver() | ||
1113 | { | ||
1114 | { | ||
1115 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | ||
1116 | } | ||
1117 | } | ||
1118 | |||
1119 | void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at ) | ||
1120 | { | ||
1121 | PixmapInfos pixinfos; | ||
1122 | QDataStream stream( at, IO_ReadOnly ); | ||
1123 | if (!m_parent || !m_waiting) return; | ||
1124 | /* we are just interested in thumbmails */ | ||
1125 | if ( str == "pixmapsHandled(PixmapList)" ) | ||
1126 | stream >> pixinfos; | ||
1127 | |||
1128 | for ( PixmapInfos::Iterator it = pixinfos.begin(); it != pixinfos.end(); ++it ) { | ||
1129 | if ((*it).file==m_reqFile) { | ||
1130 | m_parent->setEyePixmap((*it).pixmap); | ||
1131 | m_waiting = false; | ||
1132 | break; | ||
1133 | } | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height) | ||
1138 | { | ||
1139 | m_reqFile = file; | ||
1140 | rItem.file = file; | ||
1141 | rItem.width = width; | ||
1142 | rItem.height = height; | ||
1143 | QTimer::singleShot(1, this, SLOT(sendRequest())); | ||
1144 | } | ||
1145 | |||
1146 | void LauncherThumbReceiver::sendRequest() | ||
1147 | { | ||
1148 | PixmapInfos m_inThumbNail; | ||
1149 | m_inThumbNail.append(rItem); | ||
1150 | QCopEnvelope env("QPE/opie-eye_slave", "pixmapInfos(PixmapInfos)" ); | ||
1151 | env << m_inThumbNail; | ||
1152 | m_waiting = true; | ||
1153 | } | ||