summaryrefslogtreecommitdiff
authoralwin <alwin>2004-11-09 00:44:31 (UTC)
committer alwin <alwin>2004-11-09 00:44:31 (UTC)
commit5bfef5f15db1698505405605f6ed50b9d7855a22 (patch) (side-by-side diff)
tree5199765dbc2a4c4eac0c7aa12dd1e30f6610c9eb
parent4638c11f127d420818e2356359ae6f2223fb4407 (diff)
downloadopie-5bfef5f15db1698505405605f6ed50b9d7855a22.zip
opie-5bfef5f15db1698505405605f6ed50b9d7855a22.tar.gz
opie-5bfef5f15db1698505405605f6ed50b9d7855a22.tar.bz2
again some improvements to image icons
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp23
-rw-r--r--core/launcher/launcherview.h2
2 files changed, 17 insertions, 8 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 42704ba..72313e3 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -408,89 +408,96 @@ QStringList LauncherIconView::mimeTypes() const
while (it.current()) {
r.append(it.currentKey());
++it;
}
r.sort();
return r;
}
LauncherItem*LauncherIconView::findDocItem(const QString&fname)
{
LauncherItem* item = (LauncherItem*)firstItem();
while (item) {
if (item->appLnk()->file()==fname) {
break;
}
item = (LauncherItem*)item->nextItem();
}
return item;
}
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);
+ LauncherItem*item = 0;
+ QMap<QString,LauncherItem*>::Iterator it;
+ if ( ( it = m_itemCache.find(aFile))!=m_itemCache.end()) {
+ item = it.data();
+ m_itemCache.remove(it);
+ } else {
+ item = findDocItem(aFile);
+ }
if (!item||!item->isEyeImage()) return;
item->setEyePixmap(aPixmap);
}
void LauncherIconView::checkCallback()
{
- if (m_EyeCallBack) {
- return;
+ 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_EyeCallBack = new LauncherThumbReceiver();
- connect(m_EyeCallBack,SIGNAL(sig_Thumbnail(const QPixmap&,const QString&,int)),
- this,SLOT(setEyePixmap(const QPixmap&,const QString&,int)));
}
void LauncherIconView::addCheckItem(AppLnk* app)
{
LauncherItem*item = new LauncherItem( this, app, bigIcns );
if (item->isEyeImage()) {
checkCallback();
}
}
void LauncherIconView::requestEyePix(const LauncherItem*item)
{
if (!item) return;
if (item->isEyeImage()) {
- m_eyeTimer.changeInterval(600000);
checkCallback();
int s = ( bigIcns ) ? AppLnk::bigIconSize() : AppLnk::smallIconSize();
+ m_itemCache[item->appLnk()->file()]=(LauncherItem*)item;
m_EyeCallBack->requestThumb(item->appLnk()->file(),s,s);
}
}
void LauncherIconView::stopEyeTimer()
{
- odebug << "Launcherview: delete opie-eye handle" << oendl;
if (m_EyeCallBack) {
delete m_EyeCallBack;
m_EyeCallBack=0;
}
+ m_itemCache.clear();
m_eyeTimer.stop();
}
void LauncherIconView::addItem(AppLnk* app, bool resort)
{
addCatsAndMimes(app);
if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
&& (cf == 0 || app->categories().contains(cf)
|| cf == -1 && app->categories().count() == 0 ) ) {
addCheckItem(app);
} else {
hidden.append(app);
}
if ( resort ){
sort();
}
}
void LauncherIconView::updateCategoriesAndMimeTypes()
{
mimes.clear();
cats.clear();
LauncherItem* item = (LauncherItem*)firstItem();
while (item) {
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
index ebb1362..94c367c 100644
--- a/core/launcher/launcherview.h
+++ b/core/launcher/launcherview.h
@@ -5,48 +5,49 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef LAUNCHERVIEW_H
#define LAUNCHERVIEW_H
#include <qtopia/storage.h>
#include <qtopia/applnk.h>
#include <qvbox.h>
#include <qiconview.h>
#include <qtimer.h>
+#include <qmap.h>
class CategorySelect;
class LauncherIconView;
class LauncherItem;
class QIconViewItem;
class QLabel;
class QWidgetStack;
class MenuButton;
class QComboBox;
enum BusyIndicatorType {
BIT_Normal = 0,
BIT_Animated
};
class LauncherView : public QVBox
{
Q_OBJECT
public:
LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~LauncherView();
@@ -218,27 +219,28 @@ protected:
protected slots:
void setEyePixmap(const QPixmap&,const QString&,int width);
void stopEyeTimer();
private:
QList<AppLnk> hidden;
QDict<void> mimes;
QDict<void> cats;
SortMethod sortmeth;
QRegExp tf;
int cf;
LauncherItem* bsy;
int busyTimer;
bool ike;
bool bigIcns;
QPixmap bgPixmap;
QColor bgColor;
LauncherThumbReceiver*m_EyeCallBack;
#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
QPixmap busyPix;
#endif
BusyIndicatorType busyType;
QTimer m_eyeTimer;
+ QMap<QString,LauncherItem*> m_itemCache;
};
#endif // LAUNCHERVIEW_H