mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
Revert "appitem: make fetch icon asynchronous"
This reverts commit a5b044e58532f7bb3106730cae53329258cec2dc. because QIcon used with multithread are not safe Change-Id: I1502a23358b7b2f90d164f36861870f6c9df280c
This commit is contained in:
parent
0584380b20
commit
db3fe712d3
Notes:
Deepin Code Review
2017-06-27 09:25:50 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: Hualet Wang <mr.asianwang@gmail.com> Submitted-by: Hualet Wang <mr.asianwang@gmail.com> Submitted-at: Tue, 27 Jun 2017 09:25:45 +0800 Reviewed-on: https://cr.deepin.io/24032 Project: dde/dde-dock Branch: refs/heads/master
@ -1,7 +1,7 @@
|
||||
|
||||
include(../interfaces/interfaces.pri)
|
||||
|
||||
QT += core gui widgets dbus x11extras svg concurrent
|
||||
QT += core gui widgets dbus x11extras svg
|
||||
|
||||
TARGET = dde-dock
|
||||
DESTDIR = $$_PRO_FILE_PWD_/../
|
||||
|
@ -15,9 +15,6 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItemAnimation>
|
||||
#include <QTimeLine>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
#include <QtConcurrent>
|
||||
|
||||
#define APP_DRAG_THRESHOLD 20
|
||||
|
||||
@ -96,13 +93,8 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
connect(m_appPreviewTips, &_PreviewContainer::requestHidePreview, this, &AppItem::hidePopup, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &_PreviewContainer::requestCheckWindows, m_itemEntry, &DBusDockEntry::Check);
|
||||
|
||||
connect(m_smallWatcher, &QFutureWatcher<QPixmap>::finished, this, &AppItem::gotSmallIcon);
|
||||
connect(m_largeWatcher, &QFutureWatcher<QPixmap>::finished, this, &AppItem::gotLargeIcon);
|
||||
|
||||
QTimer::singleShot(1, this, [=] {
|
||||
updateTitle();
|
||||
refershIcon();
|
||||
});
|
||||
updateTitle();
|
||||
refershIcon();
|
||||
}
|
||||
|
||||
AppItem::~AppItem()
|
||||
@ -492,22 +484,17 @@ void AppItem::refershIcon()
|
||||
const QString icon = m_itemEntry->icon();
|
||||
const int iconSize = qMin(width(), height());
|
||||
|
||||
m_smallWatcher->cancel();
|
||||
m_largeWatcher->cancel();
|
||||
|
||||
if (DockDisplayMode == Efficient)
|
||||
{
|
||||
// m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.7);
|
||||
// m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.9);
|
||||
m_smallWatcher->setFuture(QtConcurrent::run(ThemeAppIcon::getIcon, icon, iconSize * 0.7));
|
||||
m_largeWatcher->setFuture(QtConcurrent::run(ThemeAppIcon::getIcon, icon, iconSize * 0.9));
|
||||
m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.7);
|
||||
m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.9);
|
||||
} else {
|
||||
// m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.6);
|
||||
// m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8);
|
||||
m_smallWatcher->setFuture(QtConcurrent::run(ThemeAppIcon::getIcon, icon, iconSize * 0.6));
|
||||
m_largeWatcher->setFuture(QtConcurrent::run(ThemeAppIcon::getIcon, icon, iconSize * 0.8));
|
||||
m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.6);
|
||||
m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8);
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
m_updateIconGeometryTimer->start();
|
||||
}
|
||||
|
||||
@ -541,16 +528,3 @@ void AppItem::showPreview()
|
||||
showPopupWindow(m_appPreviewTips, true);
|
||||
}
|
||||
|
||||
void AppItem::gotSmallIcon()
|
||||
{
|
||||
m_smallIcon = m_smallWatcher->result();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void AppItem::gotLargeIcon()
|
||||
{
|
||||
m_largeIcon = m_largeWatcher->result();
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsItem>
|
||||
#include <QFuture>
|
||||
|
||||
class AppItem : public DockItem
|
||||
{
|
||||
@ -57,9 +56,6 @@ private slots:
|
||||
void activeChanged();
|
||||
void showPreview();
|
||||
|
||||
void gotSmallIcon();
|
||||
void gotLargeIcon();
|
||||
|
||||
private:
|
||||
QLabel *m_appNameTips;
|
||||
_PreviewContainer *m_appPreviewTips;
|
||||
|
@ -14,7 +14,7 @@ ThemeAppIcon::~ThemeAppIcon()
|
||||
|
||||
}
|
||||
|
||||
QPixmap ThemeAppIcon::getIcon(const QString iconName, const int size)
|
||||
const QPixmap ThemeAppIcon::getIcon(const QString iconName, const int size)
|
||||
{
|
||||
const int s = size & ~1;
|
||||
|
||||
|
@ -10,7 +10,7 @@ public:
|
||||
explicit ThemeAppIcon(QObject *parent = 0);
|
||||
~ThemeAppIcon();
|
||||
|
||||
static QPixmap getIcon(const QString iconName, const int size);
|
||||
static const QPixmap getIcon(const QString iconName, const int size);
|
||||
};
|
||||
|
||||
#endif // THEMEAPPICON_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user