mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix(app): icon is null
Change-Id: I1fb4415d97bf35572bf4f5e7ea8fd4291e62a83f
This commit is contained in:
parent
481137678b
commit
da407f77db
@ -60,6 +60,8 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
|
||||
m_dragging(false),
|
||||
|
||||
m_retryTimes(0),
|
||||
|
||||
m_appIcon(QPixmap()),
|
||||
|
||||
m_horizontalIndicator(QPixmap(":/indicator/resources/indicator.png")),
|
||||
@ -67,6 +69,7 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
m_activeHorizontalIndicator(QPixmap(":/indicator/resources/indicator_active.png")),
|
||||
m_activeVerticalIndicator(QPixmap(":/indicator/resources/indicator_active_ver.png")),
|
||||
m_updateIconGeometryTimer(new QTimer(this)),
|
||||
m_retryObtainIconTimer(new QTimer(this)),
|
||||
|
||||
m_smallWatcher(new QFutureWatcher<QPixmap>(this)),
|
||||
m_largeWatcher(new QFutureWatcher<QPixmap>(this))
|
||||
@ -90,12 +93,16 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
m_updateIconGeometryTimer->setInterval(500);
|
||||
m_updateIconGeometryTimer->setSingleShot(true);
|
||||
|
||||
m_retryObtainIconTimer->setInterval(500);
|
||||
m_retryObtainIconTimer->setSingleShot(true);
|
||||
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, &AppItem::activeChanged);
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
||||
connect(m_itemEntryInter, &DockEntryInter::WindowInfosChanged, this, &AppItem::updateWindowInfos, Qt::QueuedConnection);
|
||||
connect(m_itemEntryInter, &DockEntryInter::IconChanged, this, &AppItem::refershIcon);
|
||||
|
||||
connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries, Qt::QueuedConnection);
|
||||
connect(m_retryObtainIconTimer, &QTimer::timeout, this, &AppItem::refershIcon, Qt::QueuedConnection);
|
||||
|
||||
updateWindowInfos(m_itemEntryInter->windowInfos());
|
||||
refershIcon();
|
||||
@ -511,6 +518,18 @@ void AppItem::refershIcon()
|
||||
else
|
||||
m_appIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8);
|
||||
|
||||
if (m_appIcon.isNull()) {
|
||||
if (m_retryTimes < 5) {
|
||||
m_retryTimes++;
|
||||
qDebug() << m_itemEntryInter->name() << "obtain app icon failed, retry times" << m_retryTimes;
|
||||
m_retryObtainIconTimer->start();
|
||||
}
|
||||
return;
|
||||
} else if (m_retryTimes > 0) {
|
||||
// reset times
|
||||
m_retryTimes = 0;
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
m_updateIconGeometryTimer->start();
|
||||
|
@ -109,6 +109,8 @@ private:
|
||||
|
||||
bool m_dragging;
|
||||
bool m_active;
|
||||
int m_retryTimes;
|
||||
|
||||
WindowInfoMap m_windowInfos;
|
||||
QString m_id;
|
||||
QPixmap m_appIcon;
|
||||
@ -118,6 +120,7 @@ private:
|
||||
QPixmap m_activeVerticalIndicator;
|
||||
|
||||
QTimer *m_updateIconGeometryTimer;
|
||||
QTimer *m_retryObtainIconTimer;
|
||||
|
||||
QFutureWatcher<QPixmap> *m_smallWatcher;
|
||||
QFutureWatcher<QPixmap> *m_largeWatcher;
|
||||
|
Loading…
x
Reference in New Issue
Block a user