summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-12 02:13:52 (UTC)
committer alwin <alwin>2005-03-12 02:13:52 (UTC)
commitcd1b9f7c11c73ef0df0ce66c53466c979a3a4d42 (patch) (side-by-side diff)
treed4ed9b082abe2aa645fbd58b86d65f5ce9c48348
parent84af289057291a49a52a60b390bc5320c02b5a55 (diff)
downloadopie-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 (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp34
-rw-r--r--core/launcher/launcherview.h4
2 files changed, 31 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
@@ -110,8 +110,10 @@ private:
bool m_EyeImage;
iconstate_t m_EyeImageSet;
};
+static bool s_IgnoreNextPix = false;
+
LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk, bool bigIcon )
: QIconViewItem( parent, applnk->name(),
bigIcon ? applnk->bigPixmap() :applnk->pixmap() ),
isBigIcon( bigIcon ),
@@ -140,9 +142,9 @@ LauncherItem::~LauncherItem()
}
QPixmap*LauncherItem::pixmap()const
{
- if (m_EyeImage && m_EyeImageSet == BASE_ICON) {
+ if (m_EyeImage && m_EyeImageSet == BASE_ICON && s_IgnoreNextPix==false) {
LauncherIconView* liv = (LauncherIconView*)iconView();
liv->requestEyePix(this);
}
return QIconViewItem::pixmap();
@@ -293,9 +295,9 @@ LauncherIconView::LauncherIconView( QWidget* parent, const char* name )
calculateGrid( Bottom );
connect(&m_eyeTimer,SIGNAL(timeout()),this,SLOT(stopEyeTimer()));
Config config( "Launcher" );
config.setGroup( "GUI" );
- setStaticBackgroundPicture( config.readBoolEntry( "StaticBackground", true ) );
+ setStaticBackgroundPicture( config.readBoolEntry( "StaticBackground", true ) );
}
LauncherIconView::~LauncherIconView()
{
@@ -309,8 +311,22 @@ LauncherIconView::~LauncherIconView()
}
#endif
}
+void LauncherIconView::unsetPalette()
+{
+ s_IgnoreNextPix = true;
+ QIconView::unsetPalette();
+ s_IgnoreNextPix = false;
+}
+
+void LauncherIconView::setPalette(const QPalette & palette)
+{
+ s_IgnoreNextPix = true;
+ QIconView::setPalette(palette);
+ s_IgnoreNextPix = false;
+}
+
void LauncherIconView::setStaticBackgroundPicture( bool enable )
{
staticBackground = enable;
if ( staticBackground )
@@ -321,10 +337,10 @@ void LauncherIconView::setStaticBackgroundPicture( bool enable )
else
{
setStaticBackground( false );
verticalScrollBar()->setTracking( true );
- }
-}
+ }
+}
int LauncherIconView::compare(const AppLnk* a, const AppLnk* b)
{
switch (sortmeth) {
@@ -485,10 +501,10 @@ void LauncherIconView::checkCallback()
if (!m_EyeCallBack) {
m_EyeCallBack = new LauncherThumbReceiver();
connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
+ m_eyeTimer.changeInterval(600000);
}
- m_eyeTimer.changeInterval(600000);
}
void LauncherIconView::addCheckItem(AppLnk* app)
{
@@ -1207,10 +1223,12 @@ QDataStream &operator<<( QDataStream& s, const PixmapInfo& inf) {
return s << inf.file << inf.width << inf.height;
}
LauncherThumbReceiver::LauncherThumbReceiver()
- :QObject()
+ :QObject(),requestTimer(this)
{
+
+ connect(&requestTimer,SIGNAL(timeout()),SLOT(sendRequest()));
QCopChannel * chan = new QCopChannel( "QPE/opie-eye",this );
connect(chan, SIGNAL(received(const QCString&,const QByteArray&)),
this, SLOT(recieve(const QCString&,const QByteArray&)) );
@@ -1246,9 +1264,11 @@ void LauncherThumbReceiver::requestThumb(const QString&file,int width,int height
rItem.file = file;
rItem.width = width;
rItem.height = height;
m_inThumbNail.append(rItem);
- QTimer::singleShot(2, this, SLOT(sendRequest()));
+ if (!requestTimer.isActive()) {
+ requestTimer.start(100,true);
+ }
}
void LauncherThumbReceiver::sendRequest()
{
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index 6a2d197..792c6d1 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -152,8 +152,9 @@ protected slots:
signals:
void sig_Thumbnail(const QPixmap&,const QString&,int);
protected:
+ QTimer requestTimer;
PixmapInfos m_inThumbNail;
};
class LauncherIconView : public QIconView {
@@ -213,8 +214,11 @@ public:
void requestEyePix(const LauncherItem*which);
static QMap<QString,QPixmap>* sm_EyeCache;
+ virtual void setPalette(const QPalette & palette);
+ virtual void unsetPalette();
+
protected:
virtual void timerEvent( QTimerEvent *te );
void styleChange( QStyle &old );
void calculateGrid( ItemTextPos pos );