mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 调整插件的尺寸
调整任务栏插件尺寸 Log: 调整插件尺寸 Influence: 观察任务栏插件是否对齐 Task: https://pms.uniontech.com/task-view-222353.html Change-Id: I30b9e1b1862fd9ba5ff3a2a931cd73204ead4292
This commit is contained in:
parent
0c414397e1
commit
a1748e3ca1
@ -23,6 +23,7 @@
|
|||||||
#include "bluetoothplugin.h"
|
#include "bluetoothplugin.h"
|
||||||
#include "adaptersmanager.h"
|
#include "adaptersmanager.h"
|
||||||
#include "bluetoothmainwidget.h"
|
#include "bluetoothmainwidget.h"
|
||||||
|
#include "imageutil.h"
|
||||||
|
|
||||||
#include <DGuiApplicationHelper>
|
#include <DGuiApplicationHelper>
|
||||||
|
|
||||||
@ -140,10 +141,22 @@ QIcon BluetoothPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::Col
|
|||||||
if (dockPart == DockPart::QuickPanel)
|
if (dockPart == DockPart::QuickPanel)
|
||||||
return QIcon();
|
return QIcon();
|
||||||
|
|
||||||
|
QString iconFile;
|
||||||
if (themeType == DGuiApplicationHelper::ColorType::DarkType)
|
if (themeType == DGuiApplicationHelper::ColorType::DarkType)
|
||||||
return QIcon(":/bluetooth-active-symbolic.svg");
|
iconFile = ":/bluetooth-active-symbolic.sv";
|
||||||
|
else
|
||||||
|
iconFile = ":/bluetooth-active-symbolic-dark.svg";
|
||||||
|
|
||||||
return QIcon(":/bluetooth-active-symbolic-dark.svg");
|
switch (dockPart) {
|
||||||
|
case DockPart::DCCSetting:
|
||||||
|
return ImageUtil::loadSvg(iconFile, QSize(18, 18));
|
||||||
|
case DockPart::QuickShow:
|
||||||
|
return ImageUtil::loadSvg(iconFile, QSize(18, 16));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsItemInterface::PluginMode BluetoothPlugin::status() const
|
PluginsItemInterface::PluginMode BluetoothPlugin::status() const
|
||||||
|
@ -46,14 +46,14 @@ OnboardItem::OnboardItem(QWidget *parent)
|
|||||||
m_icon = QIcon::fromTheme(":/icons/icon/deepin-virtualkeyboard.svg");
|
m_icon = QIcon::fromTheme(":/icons/icon/deepin-virtualkeyboard.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap OnboardItem::iconPixmap(int iconSize) const
|
QPixmap OnboardItem::iconPixmap(int iconWidth, int iconHeight) const
|
||||||
{
|
{
|
||||||
QString iconName = "deepin-virtualkeyboard";
|
QString iconName = "deepin-virtualkeyboard";
|
||||||
if (std::min(width(), height()) <= PLUGIN_BACKGROUND_MIN_SIZE
|
if (std::min(width(), height()) <= PLUGIN_BACKGROUND_MIN_SIZE
|
||||||
|| DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
|
|| DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
|
||||||
iconName.append(PLUGIN_MIN_ICON_NAME);
|
iconName.append(PLUGIN_MIN_ICON_NAME);
|
||||||
|
|
||||||
return loadSvg(iconName, QSize(iconSize, iconSize));
|
return loadSvg(iconName, QSize(iconWidth, iconHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnboardItem::paintEvent(QPaintEvent *e)
|
void OnboardItem::paintEvent(QPaintEvent *e)
|
||||||
@ -102,7 +102,7 @@ void OnboardItem::paintEvent(QPaintEvent *e)
|
|||||||
painter.fillPath(path, color);
|
painter.fillPath(path, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap pixmap = iconPixmap(PLUGIN_ICON_MAX_SIZE);
|
QPixmap pixmap = iconPixmap(PLUGIN_ICON_MAX_SIZE, PLUGIN_ICON_MAX_SIZE);
|
||||||
painter.setOpacity(1);
|
painter.setOpacity(1);
|
||||||
const QRectF &rf = QRectF(rect());
|
const QRectF &rf = QRectF(rect());
|
||||||
const QRectF &rfp = QRectF(pixmap.rect());
|
const QRectF &rfp = QRectF(pixmap.rect());
|
||||||
|
@ -33,7 +33,7 @@ class OnboardItem : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OnboardItem(QWidget *parent = nullptr);
|
explicit OnboardItem(QWidget *parent = nullptr);
|
||||||
QPixmap iconPixmap(int iconSize) const;
|
QPixmap iconPixmap(int iconWidth, int iconHeight) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
@ -184,9 +184,9 @@ QIcon OnboardPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::Color
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dockPart == DockPart::QuickPanel)
|
if (dockPart == DockPart::QuickPanel)
|
||||||
return m_onboardItem->iconPixmap(24);
|
return m_onboardItem->iconPixmap(24, 24);
|
||||||
|
|
||||||
return m_onboardItem->iconPixmap(20);
|
return m_onboardItem->iconPixmap(18, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsItemInterface::PluginMode OnboardPlugin::status() const
|
PluginsItemInterface::PluginMode OnboardPlugin::status() const
|
||||||
|
@ -244,7 +244,7 @@ QPixmap SoundItem::pixmap() const
|
|||||||
return m_iconPixmap;
|
return m_iconPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap SoundItem::pixmap(DGuiApplicationHelper::ColorType colorType) const
|
QPixmap SoundItem::pixmap(DGuiApplicationHelper::ColorType colorType, int iconWidth, int iconHeight) const
|
||||||
{
|
{
|
||||||
const Dock::DisplayMode displayMode = Dock::DisplayMode::Efficient;
|
const Dock::DisplayMode displayMode = Dock::DisplayMode::Efficient;
|
||||||
|
|
||||||
@ -280,12 +280,10 @@ QPixmap SoundItem::pixmap(DGuiApplicationHelper::ColorType colorType) const
|
|||||||
iconString = QString("audio-volume-%1-symbolic").arg(volumeString);
|
iconString = QString("audio-volume-%1-symbolic").arg(volumeString);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ratio = devicePixelRatioF();
|
|
||||||
int iconSize = PLUGIN_ICON_MAX_SIZE;
|
|
||||||
if (colorType == DGuiApplicationHelper::LightType)
|
if (colorType == DGuiApplicationHelper::LightType)
|
||||||
iconString.append(PLUGIN_MIN_ICON_NAME);
|
iconString.append(PLUGIN_MIN_ICON_NAME);
|
||||||
|
|
||||||
return ImageUtil::loadSvg(iconString, ":/", iconSize, ratio);
|
return ImageUtil::loadSvg(":/" + iconString, QSize(iconWidth, iconHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundItem::sinkChanged(DBusSink *sink)
|
void SoundItem::sinkChanged(DBusSink *sink)
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
void refreshIcon();
|
void refreshIcon();
|
||||||
void refreshTips(const int volume, const bool force = false);
|
void refreshTips(const int volume, const bool force = false);
|
||||||
QPixmap pixmap() const;
|
QPixmap pixmap() const;
|
||||||
QPixmap pixmap(DGuiApplicationHelper::ColorType colorType) const;
|
QPixmap pixmap(DGuiApplicationHelper::ColorType colorType, int iconWidth, int iconHeight) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestContextMenu() const;
|
void requestContextMenu() const;
|
||||||
|
@ -149,7 +149,15 @@ void SoundPlugin::pluginSettingsChanged()
|
|||||||
|
|
||||||
QIcon SoundPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
|
QIcon SoundPlugin::icon(const DockPart &dockPart, DGuiApplicationHelper::ColorType themeType)
|
||||||
{
|
{
|
||||||
return m_soundItem->pixmap(themeType);
|
switch (dockPart) {
|
||||||
|
case DockPart::QuickShow:
|
||||||
|
return m_soundItem->pixmap(themeType, 18, 16);
|
||||||
|
case DockPart::DCCSetting:
|
||||||
|
return m_soundItem->pixmap(themeType, 18, 18);
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginsItemInterface::PluginMode SoundPlugin::status() const
|
PluginsItemInterface::PluginMode SoundPlugin::status() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user