mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
optimize icon size
Change-Id: I9baecb3881cf8267246e41c853138514bda1b61b
This commit is contained in:
parent
e5b63e9dcb
commit
aa56197885
@ -24,11 +24,11 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
|||||||
|
|
||||||
m_id = m_itemEntry->id();
|
m_id = m_itemEntry->id();
|
||||||
|
|
||||||
connect(m_itemEntry, &DBusDockEntry::TitlesChanged, this, &AppItem::titlesChanged);
|
connect(m_itemEntry, &DBusDockEntry::TitlesChanged, this, &AppItem::updateTitle);
|
||||||
connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
||||||
|
|
||||||
titlesChanged();
|
updateTitle();
|
||||||
iconChanged();
|
updateIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AppItem::appId() const
|
const QString AppItem::appId() const
|
||||||
@ -98,6 +98,13 @@ void AppItem::mouseMoveEvent(QMouseEvent *e)
|
|||||||
startDrag();
|
startDrag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppItem::resizeEvent(QResizeEvent *e)
|
||||||
|
{
|
||||||
|
DockItem::resizeEvent(e);
|
||||||
|
|
||||||
|
updateIcon();
|
||||||
|
}
|
||||||
|
|
||||||
void AppItem::startDrag()
|
void AppItem::startDrag()
|
||||||
{
|
{
|
||||||
m_draging = true;
|
m_draging = true;
|
||||||
@ -130,16 +137,17 @@ void AppItem::initClientManager()
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::titlesChanged()
|
void AppItem::updateTitle()
|
||||||
{
|
{
|
||||||
m_titles = m_itemEntry->titles();
|
m_titles = m_itemEntry->titles();
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppItem::iconChanged()
|
void AppItem::updateIcon()
|
||||||
{
|
{
|
||||||
const QString icon = m_itemEntry->icon();
|
const QString icon = m_itemEntry->icon();
|
||||||
|
const int iconSize = qMin(width(), height()) * 0.8;
|
||||||
|
|
||||||
m_icon = ThemeAppIcon::getIcon(icon, 48);
|
m_icon = ThemeAppIcon::getIcon(icon, iconSize);
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,14 @@ private:
|
|||||||
void mouseReleaseEvent(QMouseEvent *e);
|
void mouseReleaseEvent(QMouseEvent *e);
|
||||||
void mousePressEvent(QMouseEvent *e);
|
void mousePressEvent(QMouseEvent *e);
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
void mouseMoveEvent(QMouseEvent *e);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
void startDrag();
|
void startDrag();
|
||||||
void initClientManager();
|
void initClientManager();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void titlesChanged();
|
void updateTitle();
|
||||||
void iconChanged();
|
void updateIcon();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DBusDockEntry *m_itemEntry;
|
DBusDockEntry *m_itemEntry;
|
||||||
|
@ -10,7 +10,7 @@ MainPanel::MainPanel(QWidget *parent)
|
|||||||
m_itemController(DockItemController::instance(this))
|
m_itemController(DockItemController::instance(this))
|
||||||
{
|
{
|
||||||
m_itemLayout->setSpacing(0);
|
m_itemLayout->setSpacing(0);
|
||||||
m_itemLayout->setContentsMargins(5, 5, 5, 5);
|
m_itemLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
setObjectName("MainPanel");
|
setObjectName("MainPanel");
|
||||||
|
@ -70,7 +70,7 @@ void MainWindow::updatePosition()
|
|||||||
setFixedWidth(screenRect.width());
|
setFixedWidth(screenRect.width());
|
||||||
setFixedHeight(60);
|
setFixedHeight(60);
|
||||||
|
|
||||||
move(0, screenRect.bottom() - 60);
|
move(0, screenRect.height() - 60);
|
||||||
|
|
||||||
setStrutPartial();
|
setStrutPartial();
|
||||||
}
|
}
|
||||||
@ -82,6 +82,9 @@ void MainWindow::clearStrutPartial()
|
|||||||
|
|
||||||
void MainWindow::setStrutPartial()
|
void MainWindow::setStrutPartial()
|
||||||
{
|
{
|
||||||
|
// first, clear old strut partial
|
||||||
|
clearStrutPartial();
|
||||||
|
|
||||||
const DockSettings::DockSide side = m_settings->side();
|
const DockSettings::DockSide side = m_settings->side();
|
||||||
const int maxScreenHeight = m_displayInter->screenHeight();
|
const int maxScreenHeight = m_displayInter->screenHeight();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user