feat(showdesktop):icon display and default sort

This commit is contained in:
shaojun 2019-09-04 13:43:47 +08:00
parent 71a45e8cea
commit 355bbc1a02
2 changed files with 14 additions and 4 deletions

View File

@ -126,7 +126,7 @@ void ShowDesktopPlugin::invokedMenuItem(const QString &itemKey, const QString &m
if (menuId == "show-desktop") {
QProcess::startDetached("/usr/lib/deepin-daemon/desktop-toggle");
} else if (menuId == "remove") {
m_proxyInter->itemRemoved(this, POWER_KEY);
pluginStateSwitched();
}
}
@ -141,7 +141,7 @@ int ShowDesktopPlugin::itemSortKey(const QString &itemKey)
{
const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
return m_proxyInter->getValue(this, key, displayMode() == Dock::DisplayMode::Fashion ? 3 : 3).toInt();
return m_proxyInter->getValue(this, key, 1).toInt();
}
void ShowDesktopPlugin::setSortKey(const QString &itemKey, const int order)
@ -163,7 +163,10 @@ PluginsItemInterface::PluginType ShowDesktopPlugin::type()
void ShowDesktopPlugin::updateBatteryVisible()
{
if (pluginIsDisable())
m_proxyInter->itemRemoved(this, POWER_KEY);
else
m_proxyInter->itemAdded(this, POWER_KEY);
}
void ShowDesktopPlugin::loadPlugin()

View File

@ -47,7 +47,14 @@ void ShowDesktopWidget::paintEvent(QPaintEvent *e)
Q_UNUSED(e);
const auto ratio = devicePixelRatioF();
QPixmap icon = QIcon::fromTheme("deepin-toggle-desktop").pixmap(size() * ratio);
QPixmap icon;
if (Dock::Fashion == qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>()) {
icon = QIcon::fromTheme("deepin-toggle-desktop").pixmap(size() * 0.8 * ratio);
} else {
icon = QIcon::fromTheme("deepin-toggle-desktop").pixmap(size() * 0.7 * ratio);
}
icon.setDevicePixelRatio(ratio);
QPainter painter(this);