summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-08 15:22:07 (UTC)
committer alwin <alwin>2004-11-08 15:22:07 (UTC)
commitcce0a7a0d315993645870e88591b4afd647480a7 (patch) (side-by-side diff)
treebeb8886020fe12a0f77bbb22bf0da76d4a73a3d5
parent40bbaace5492ce6420a2d4a353b24df64c142287 (diff)
downloadopie-cce0a7a0d315993645870e88591b4afd647480a7.zip
opie-cce0a7a0d315993645870e88591b4afd647480a7.tar.gz
opie-cce0a7a0d315993645870e88591b4afd647480a7.tar.bz2
image preview for documenttab again, I think, for first shot it is
working fine now.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp83
-rw-r--r--core/launcher/launcherview.h5
2 files changed, 60 insertions, 28 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
public:
+ enum iconstate_t {
+ BASE_ICON,
+ WAITING_ICON,
+ EYE_ICON
+ };
+
LauncherItem( QIconView *parent, AppLnk* applnk, bool bigIcon=TRUE );
@@ -90,2 +96,4 @@ public:
void setEyePixmap(const QPixmap&aIcon);
+ virtual QPixmap*pixmap()const;
+
protected:
@@ -101,19 +109,5 @@ private:
bool m_EyeImage;
+ iconstate_t m_EyeImageSet;
};
-
-bool LauncherView::bsy=FALSE;
-
-void LauncherView::setBusy(bool on)
-{
- icons->setBusy(on);
-}
-
-void LauncherView::setBusyIndicatorType( const QString& type ) {
- if ( type. lower ( ) == "animated" )
- icons->setBusyIndicatorType( BIT_Animated ) ;
- else
- icons->setBusyIndicatorType( BIT_Normal ) ;
-}
-
LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
@@ -126,3 +120,4 @@ LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
m_iPixmap(),
- m_EyeImage(false)
+ m_EyeImage(false),
+ m_EyeImageSet(BASE_ICON)
{
@@ -142,2 +137,11 @@ LauncherItem::~LauncherItem()
+QPixmap*LauncherItem::pixmap()const
+{
+ if (m_EyeImage && m_EyeImageSet == BASE_ICON) {
+ LauncherIconView* liv = (LauncherIconView*)iconView();
+ liv->requestEyePix(this);
+ }
+ return QIconViewItem::pixmap();
+}
+
int LauncherItem::compare ( QIconViewItem * i ) const
@@ -168,4 +172,2 @@ void LauncherItem::paintItem( QPainter *p, const QColorGroup &cg )
-
-
void LauncherItem::paintAnimatedIcon( QPainter *p )
@@ -257,2 +259,3 @@ void LauncherItem::setEyePixmap(const QPixmap&aIcon)
setPixmap(aIcon);
+ m_EyeImageSet = EYE_ICON;
}
@@ -423,7 +426,8 @@ LauncherItem*LauncherIconView::findDocItem(const QString&fname)
-void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile)
+void LauncherIconView::setEyePixmap(const QPixmap&aPixmap,const QString&aFile,int width)
{
+ int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
+ if (s!=width) return;
LauncherItem*item = findDocItem(aFile);
if (!item||!item->isEyeImage()) return;
-
item->setEyePixmap(aPixmap);
@@ -437,4 +441,4 @@ void LauncherIconView::checkCallback()
m_EyeCallBack = new LauncherThumbReceiver();
- connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&)),
- this,SLOT(setEyePixmap(const QPixmap&,const QString&)));
+ connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
+ this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
}
@@ -446,4 +450,12 @@ void LauncherIconView::addCheckItem(AppLnk* app)
checkCallback();
+ }
+}
+
+void LauncherIconView::requestEyePix(const LauncherItem*item)
+{
+ if (!item) return;
+ if (item->isEyeImage()) {
+ checkCallback();
int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
- m_EyeCallBack->requestThumb(app->file(),s,s);
+ m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s);
}
@@ -635,2 +647,17 @@ LauncherView::~LauncherView()
+
+bool LauncherView::bsy=FALSE;
+
+void LauncherView::setBusy(bool on)
+{
+ icons->setBusy(on);
+}
+
+void LauncherView::setBusyIndicatorType( const QString& type ) {
+ if ( type. lower ( ) == "animated" )
+ icons->setBusyIndicatorType( BIT_Animated ) ;
+ else
+ icons->setBusyIndicatorType( BIT_Normal ) ;
+}
+
void LauncherView::hideIcons()
@@ -1055,2 +1082,6 @@ void LauncherView::flushBgCache()
+/*
+ * Launcherthumbnail handling for image files
+ */
+
/* special image handling - based on opie eye */
@@ -1095,3 +1126,3 @@ void LauncherThumbReceiver::recieve( const QCString&str, const QByteArray&at )
odebug << "Pixinfos: " << (*it).file << " - " << (*it).width << oendl;
- emit sig_Thumbnail((*it).pixmap,(*it).file);
+ emit sig_Thumbnail((*it).pixmap,(*it).file,(*it).width);
}
@@ -1106,3 +1137,3 @@ void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height
m_inThumbNail.append(rItem);
- QTimer::singleShot(2, this, SLOT(sendRequest()));
+ QTimer::singleShot(0, this, SLOT(sendRequest()));
}
@@ -1114,4 +1145,4 @@ void LauncherThumbReceiver::sendRequest()
env << m_inThumbNail;
- }
m_inThumbNail.clear();
}
+}
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:
signals:
- void sig_Thumbnail(const QPixmap&,const QString&);
+ void sig_Thumbnail(const QPixmap&,const QString&,int);
@@ -218,2 +218,3 @@ public:
int compare(const AppLnk* a, const AppLnk* b);
+ void requestEyePix(const LauncherItem*which);
@@ -230,3 +231,3 @@ protected:
protected slots:
- void setEyePixmap(const QPixmap&,const QString&);
+ void setEyePixmap(const QPixmap&,const QString&,int width);