2017-09-18 14:33:44 +08:00
|
|
|
|
/*
|
2018-02-07 11:52:47 +08:00
|
|
|
|
* Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
|
2016-10-14 15:47:43 +08:00
|
|
|
|
*
|
2017-09-18 14:33:44 +08:00
|
|
|
|
* Author: sbw <sbw@sbw.so>
|
|
|
|
|
*
|
|
|
|
|
* Maintainer: sbw <sbw@sbw.so>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2016-10-14 15:47:43 +08:00
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2017-09-18 14:33:44 +08:00
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2016-10-14 15:47:43 +08:00
|
|
|
|
|
|
|
|
|
#include "dbusdockadaptors.h"
|
2021-09-22 10:17:16 +08:00
|
|
|
|
#include "utils.h"
|
|
|
|
|
#include "dockitemmanager.h"
|
2022-08-25 19:31:31 +00:00
|
|
|
|
#include "windowmanager.h"
|
2022-11-02 06:35:04 +00:00
|
|
|
|
#include "quicksettingcontroller.h"
|
2022-10-19 03:50:12 +00:00
|
|
|
|
#include "pluginsitem.h"
|
2022-11-18 03:19:58 +00:00
|
|
|
|
#include "settingconfig.h"
|
2023-01-12 11:06:36 +08:00
|
|
|
|
#include "customevent.h"
|
2021-09-22 10:17:16 +08:00
|
|
|
|
|
2022-11-23 05:27:16 +00:00
|
|
|
|
#include <DGuiApplicationHelper>
|
|
|
|
|
|
2016-10-14 15:47:43 +08:00
|
|
|
|
#include <QScreen>
|
2018-05-11 20:29:44 +08:00
|
|
|
|
#include <QDebug>
|
2021-09-22 10:17:16 +08:00
|
|
|
|
#include <QGSettings>
|
2022-11-18 03:19:58 +00:00
|
|
|
|
#include <QDBusMetaType>
|
|
|
|
|
|
|
|
|
|
const QSize defaultIconSize = QSize(20, 20);
|
|
|
|
|
|
|
|
|
|
QDebug operator<<(QDebug argument, const DockItemInfo &info)
|
|
|
|
|
{
|
|
|
|
|
argument << "name:" << info.name << ", displayName:" << info.displayName
|
|
|
|
|
<< "itemKey:" << info.itemKey << "SettingKey:" << info.settingKey
|
2022-11-23 05:27:16 +00:00
|
|
|
|
<< "icon_light:" << info.iconLight << "icon_dark:" << info.iconDark << "visible:" << info.visible;
|
2022-11-18 03:19:58 +00:00
|
|
|
|
return argument;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDBusArgument &operator<<(QDBusArgument &arg, const DockItemInfo &info)
|
|
|
|
|
{
|
|
|
|
|
arg.beginStructure();
|
2022-11-23 05:27:16 +00:00
|
|
|
|
arg << info.name << info.displayName << info.itemKey << info.settingKey << info.iconLight << info.iconDark << info.visible;
|
2022-11-18 03:19:58 +00:00
|
|
|
|
arg.endStructure();
|
|
|
|
|
return arg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const QDBusArgument &operator>>(const QDBusArgument &arg, DockItemInfo &info)
|
|
|
|
|
{
|
|
|
|
|
arg.beginStructure();
|
2022-11-23 05:27:16 +00:00
|
|
|
|
arg >> info.name >> info.displayName >> info.itemKey >> info.settingKey >> info.iconLight >> info.iconDark >> info.visible;
|
2022-11-18 03:19:58 +00:00
|
|
|
|
arg.endStructure();
|
|
|
|
|
return arg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void registerPluginInfoMetaType()
|
|
|
|
|
{
|
|
|
|
|
qRegisterMetaType<DockItemInfo>("DockItemInfo");
|
|
|
|
|
qDBusRegisterMetaType<DockItemInfo>();
|
|
|
|
|
qRegisterMetaType<DockItemInfos>("DockItemInfos");
|
|
|
|
|
qDBusRegisterMetaType<DockItemInfos>();
|
|
|
|
|
}
|
2016-10-14 15:47:43 +08:00
|
|
|
|
|
2022-08-25 19:31:31 +00:00
|
|
|
|
DBusDockAdaptors::DBusDockAdaptors(WindowManager* parent)
|
2021-09-22 10:17:16 +08:00
|
|
|
|
: QDBusAbstractAdaptor(parent)
|
|
|
|
|
, m_gsettings(Utils::SettingsPtr("com.deepin.dde.dock.mainwindow", QByteArray(), this))
|
2022-08-25 19:31:31 +00:00
|
|
|
|
, m_windowManager(parent)
|
2016-10-14 15:47:43 +08:00
|
|
|
|
{
|
2022-08-25 19:31:31 +00:00
|
|
|
|
connect(parent, &WindowManager::panelGeometryChanged, this, [ = ] {
|
2016-10-14 15:47:43 +08:00
|
|
|
|
emit DBusDockAdaptors::geometryChanged(geometry());
|
|
|
|
|
});
|
2021-09-22 10:17:16 +08:00
|
|
|
|
|
|
|
|
|
if (m_gsettings) {
|
|
|
|
|
connect(m_gsettings, &QGSettings::changed, this, [ = ] (const QString &key) {
|
|
|
|
|
if (key == "onlyShowPrimary") {
|
|
|
|
|
Q_EMIT showInPrimaryChanged(m_gsettings->get(key).toBool());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-18 03:19:58 +00:00
|
|
|
|
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
2021-09-22 10:17:16 +08:00
|
|
|
|
connect(DockItemManager::instance(), &DockItemManager::itemInserted, this, [ = ] (const int index, DockItem *item) {
|
|
|
|
|
Q_UNUSED(index);
|
|
|
|
|
if (item->itemType() == DockItem::Plugins
|
|
|
|
|
|| item->itemType() == DockItem::FixedPlugin) {
|
|
|
|
|
PluginsItem *pluginItem = static_cast<PluginsItem *>(item);
|
2022-11-02 06:35:04 +00:00
|
|
|
|
for (auto *p : allPlugin) {
|
2021-09-22 10:17:16 +08:00
|
|
|
|
if (p->pluginName() == pluginItem->pluginName()) {
|
|
|
|
|
Q_EMIT pluginVisibleChanged(p->pluginDisplayName(), getPluginVisible(p->pluginDisplayName()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(DockItemManager::instance(), &DockItemManager::itemRemoved, this, [ = ] (DockItem *item) {
|
|
|
|
|
if (item->itemType() == DockItem::Plugins
|
|
|
|
|
|| item->itemType() == DockItem::FixedPlugin) {
|
|
|
|
|
PluginsItem *pluginItem = static_cast<PluginsItem *>(item);
|
2022-11-02 06:35:04 +00:00
|
|
|
|
for (auto *p : allPlugin) {
|
2021-09-22 10:17:16 +08:00
|
|
|
|
if (p->pluginName() == pluginItem->pluginName()) {
|
|
|
|
|
Q_EMIT pluginVisibleChanged(p->pluginDisplayName(), getPluginVisible(p->pluginDisplayName()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2022-11-18 03:19:58 +00:00
|
|
|
|
|
|
|
|
|
registerPluginInfoMetaType();
|
2016-10-14 15:47:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DBusDockAdaptors::~DBusDockAdaptors()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-13 15:35:11 +08:00
|
|
|
|
void DBusDockAdaptors::callShow()
|
|
|
|
|
{
|
2022-08-25 19:31:31 +00:00
|
|
|
|
m_windowManager->callShow();
|
2020-10-13 15:35:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-21 15:31:25 +08:00
|
|
|
|
void DBusDockAdaptors::ReloadPlugins()
|
|
|
|
|
{
|
2022-08-25 19:31:31 +00:00
|
|
|
|
if (qApp->property("PLUGINSLOADED").toBool())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// 发送事件,通知代理来加载插件
|
|
|
|
|
PluginLoadEvent event;
|
|
|
|
|
QCoreApplication::sendEvent(qApp, &event);
|
|
|
|
|
|
|
|
|
|
qApp->setProperty("PLUGINSLOADED", true);
|
|
|
|
|
// 退出安全模式
|
|
|
|
|
qApp->setProperty("safeMode", false);
|
2021-01-21 15:31:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-22 10:17:16 +08:00
|
|
|
|
QStringList DBusDockAdaptors::GetLoadedPlugins()
|
|
|
|
|
{
|
2022-11-18 03:19:58 +00:00
|
|
|
|
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
2021-09-22 10:17:16 +08:00
|
|
|
|
QStringList nameList;
|
|
|
|
|
QMap<QString, QString> map;
|
2022-11-02 06:35:04 +00:00
|
|
|
|
for (auto plugin : allPlugin) {
|
2021-09-22 10:17:16 +08:00
|
|
|
|
// 托盘本身也是一个插件,这里去除掉这个特殊的插件,还有一些没有实际名字的插件
|
|
|
|
|
if (plugin->pluginName() == "tray"
|
|
|
|
|
|| plugin->pluginDisplayName().isEmpty()
|
|
|
|
|
|| !isPluginValid(plugin->pluginName()))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
nameList << plugin->pluginName();
|
|
|
|
|
map.insert(plugin->pluginName(), plugin->pluginDisplayName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 排序,保持和原先任务栏右键菜单中的插件列表顺序一致
|
2022-11-04 06:29:03 +00:00
|
|
|
|
std::sort(nameList.begin(), nameList.end(), [ = ] (const QString &name1, const QString &name2) {
|
2021-09-22 10:17:16 +08:00
|
|
|
|
return name1 > name2;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
QStringList newList;
|
|
|
|
|
for (auto name : nameList) {
|
|
|
|
|
newList.push_back(map[name]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return newList;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-18 03:19:58 +00:00
|
|
|
|
DockItemInfos DBusDockAdaptors::plugins()
|
|
|
|
|
{
|
2023-01-12 11:06:36 +08:00
|
|
|
|
#define DOCK_QUICK_PLUGINS "Dock_Quick_Plugins"
|
2022-11-18 03:19:58 +00:00
|
|
|
|
// 获取本地加载的插件
|
|
|
|
|
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
|
|
|
|
DockItemInfos pluginInfos;
|
2023-01-12 11:06:36 +08:00
|
|
|
|
QStringList quickSettingKeys = SETTINGCONFIG->value(DOCK_QUICK_PLUGINS).toStringList();
|
2022-11-18 03:19:58 +00:00
|
|
|
|
for (PluginsItemInterface *plugin : allPlugin) {
|
|
|
|
|
DockItemInfo info;
|
|
|
|
|
info.name = plugin->pluginName();
|
|
|
|
|
info.displayName = plugin->pluginDisplayName();
|
|
|
|
|
info.itemKey = plugin->pluginName();
|
2023-01-12 11:06:36 +08:00
|
|
|
|
info.settingKey = DOCK_QUICK_PLUGINS;
|
2022-11-18 03:19:58 +00:00
|
|
|
|
info.visible = quickSettingKeys.contains(info.itemKey);
|
|
|
|
|
QSize pixmapSize;
|
2022-11-23 05:27:16 +00:00
|
|
|
|
QIcon lightIcon = getSettingIcon(plugin, pixmapSize, DGuiApplicationHelper::ColorType::LightType);
|
|
|
|
|
if (!lightIcon.isNull()) {
|
|
|
|
|
QBuffer buffer(&info.iconLight);
|
|
|
|
|
if (buffer.open(QIODevice::WriteOnly)) {
|
|
|
|
|
QPixmap pixmap = lightIcon.pixmap(pixmapSize);
|
|
|
|
|
pixmap.save(&buffer, "png");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
QIcon darkIcon = getSettingIcon(plugin, pixmapSize, DGuiApplicationHelper::ColorType::DarkType);
|
|
|
|
|
if (!darkIcon.isNull()) {
|
|
|
|
|
QBuffer buffer(&info.iconDark);
|
2022-11-18 03:19:58 +00:00
|
|
|
|
if (buffer.open(QIODevice::WriteOnly)) {
|
2022-11-23 05:27:16 +00:00
|
|
|
|
QPixmap pixmap = darkIcon.pixmap(pixmapSize);
|
|
|
|
|
pixmap.save(&buffer, "png");
|
2022-11-18 03:19:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
pluginInfos << info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pluginInfos;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-05 13:10:09 +08:00
|
|
|
|
void DBusDockAdaptors::resizeDock(int offset, bool dragging)
|
2021-10-13 11:27:50 +08:00
|
|
|
|
{
|
2022-08-25 19:31:31 +00:00
|
|
|
|
m_windowManager->resizeDock(offset, dragging);
|
2021-10-13 11:27:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-11 11:14:40 +08:00
|
|
|
|
// 返回每个插件的识别Key(所以此值应始终不变),供个性化插件根据key去匹配每个插件对应的图标
|
|
|
|
|
QString DBusDockAdaptors::getPluginKey(const QString &pluginName)
|
|
|
|
|
{
|
2022-11-18 03:19:58 +00:00
|
|
|
|
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
2022-11-02 06:35:04 +00:00
|
|
|
|
for (auto plugin : allPlugin) {
|
2021-10-11 11:14:40 +08:00
|
|
|
|
if (plugin->pluginDisplayName() == pluginName)
|
|
|
|
|
return plugin->pluginName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-22 10:17:16 +08:00
|
|
|
|
bool DBusDockAdaptors::getPluginVisible(const QString &pluginName)
|
|
|
|
|
{
|
2022-11-18 03:19:58 +00:00
|
|
|
|
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
2022-11-02 06:35:04 +00:00
|
|
|
|
for (auto *p : allPlugin) {
|
2021-09-22 10:17:16 +08:00
|
|
|
|
if (!p->pluginIsAllowDisable())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
const QString &display = p->pluginDisplayName();
|
|
|
|
|
if (display != pluginName)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
const QString &name = p->pluginName();
|
|
|
|
|
if (!isPluginValid(name))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
return !p->pluginIsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qInfo() << "Unable to get information about this plugin";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DBusDockAdaptors::setPluginVisible(const QString &pluginName, bool visible)
|
|
|
|
|
{
|
2022-11-18 03:19:58 +00:00
|
|
|
|
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
2022-11-02 06:35:04 +00:00
|
|
|
|
for (auto *p : allPlugin) {
|
2021-09-22 10:17:16 +08:00
|
|
|
|
if (!p->pluginIsAllowDisable())
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
const QString &display = p->pluginDisplayName();
|
|
|
|
|
if (display != pluginName)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
const QString &name = p->pluginName();
|
|
|
|
|
if (!isPluginValid(name))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (p->pluginIsDisable() == visible) {
|
|
|
|
|
p->pluginStateSwitched();
|
|
|
|
|
Q_EMIT pluginVisibleChanged(pluginName, visible);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qInfo() << "Unable to set information for this plugin";
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-18 03:19:58 +00:00
|
|
|
|
void DBusDockAdaptors::setItemOnDock(const QString settingKey, const QString &itemKey, bool visible)
|
|
|
|
|
{
|
|
|
|
|
QStringList settings = SETTINGCONFIG->value(settingKey).toStringList();
|
|
|
|
|
if (visible && !settings.contains(itemKey))
|
|
|
|
|
settings << itemKey;
|
|
|
|
|
else if (!visible && settings.contains(itemKey))
|
|
|
|
|
settings.removeOne(itemKey);
|
|
|
|
|
|
|
|
|
|
SETTINGCONFIG->setValue(settingKey, settings);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-14 15:47:43 +08:00
|
|
|
|
QRect DBusDockAdaptors::geometry() const
|
|
|
|
|
{
|
2022-08-25 19:31:31 +00:00
|
|
|
|
return m_windowManager->geometry();
|
2016-10-14 15:47:43 +08:00
|
|
|
|
}
|
2021-09-22 10:17:16 +08:00
|
|
|
|
|
|
|
|
|
bool DBusDockAdaptors::showInPrimary() const
|
|
|
|
|
{
|
|
|
|
|
return Utils::SettingValue("com.deepin.dde.dock.mainwindow", QByteArray(), "onlyShowPrimary", false).toBool();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DBusDockAdaptors::setShowInPrimary(bool showInPrimary)
|
|
|
|
|
{
|
|
|
|
|
if (this->showInPrimary() == showInPrimary)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (Utils::SettingSaveValue("com.deepin.dde.dock.mainwindow", QByteArray(), "onlyShowPrimary", showInPrimary)) {
|
|
|
|
|
Q_EMIT showInPrimaryChanged(showInPrimary);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DBusDockAdaptors::isPluginValid(const QString &name)
|
|
|
|
|
{
|
|
|
|
|
// 插件被全局禁用时,理应获取不到此插件的任何信息
|
2021-12-15 15:41:35 +08:00
|
|
|
|
if (!Utils::SettingValue("com.deepin.dde.dock.module." + name, QByteArray(), "enable", true).toBool())
|
2021-09-22 10:17:16 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// 未开启窗口特效时,不显示多任务视图插件
|
|
|
|
|
if (name == "multitasking" && !DWindowManagerHelper::instance()->hasComposite())
|
2021-10-11 11:14:40 +08:00
|
|
|
|
return false;
|
2021-09-22 10:17:16 +08:00
|
|
|
|
|
|
|
|
|
// 录屏插件不显示,插件名如果有变化,建议发需求,避免任务栏反复适配
|
|
|
|
|
if (name == "deepin-screen-recorder-plugin")
|
2021-10-11 11:14:40 +08:00
|
|
|
|
return false;
|
2021-09-22 10:17:16 +08:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-11-02 06:35:04 +00:00
|
|
|
|
|
2022-11-18 03:19:58 +00:00
|
|
|
|
QList<PluginsItemInterface *> DBusDockAdaptors::localPlugins() const
|
2022-11-02 06:35:04 +00:00
|
|
|
|
{
|
|
|
|
|
return QuickSettingController::instance()->pluginInSettings();
|
|
|
|
|
}
|
2022-11-18 03:19:58 +00:00
|
|
|
|
|
2022-12-02 15:41:34 +08:00
|
|
|
|
QIcon DBusDockAdaptors::getSettingIcon(PluginsItemInterface *plugin, QSize &pixmapSize, DGuiApplicationHelper::ColorType colorType) const
|
2022-11-18 03:19:58 +00:00
|
|
|
|
{
|
|
|
|
|
auto iconSize = [](const QIcon &icon) {
|
|
|
|
|
QList<QSize> iconSizes = icon.availableSizes();
|
|
|
|
|
if (iconSizes.size() > 0)
|
|
|
|
|
return iconSizes[0];
|
|
|
|
|
|
|
|
|
|
return defaultIconSize;
|
|
|
|
|
};
|
|
|
|
|
// 先获取控制中心的设置图标
|
2022-11-23 05:27:16 +00:00
|
|
|
|
QIcon icon = plugin->icon(DockPart::DCCSetting, colorType);
|
2022-11-18 03:19:58 +00:00
|
|
|
|
if (!icon.isNull()) {
|
|
|
|
|
pixmapSize = iconSize(icon);
|
|
|
|
|
return icon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果插件中没有设置图标,则根据插件的类型,获取其他的图标
|
|
|
|
|
QuickSettingController::PluginAttribute pluginAttr = QuickSettingController::instance()->pluginAttribute(plugin);
|
|
|
|
|
switch(pluginAttr) {
|
|
|
|
|
case QuickSettingController::PluginAttribute::System: {
|
2022-11-23 05:27:16 +00:00
|
|
|
|
icon = plugin->icon(DockPart::SystemPanel, colorType);
|
2022-11-18 03:19:58 +00:00
|
|
|
|
pixmapSize = defaultIconSize;
|
|
|
|
|
QList<QSize> iconSizes = icon.availableSizes();
|
|
|
|
|
if (iconSizes.size() > 0)
|
|
|
|
|
pixmapSize = iconSizes[0];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case QuickSettingController::PluginAttribute::Quick: {
|
2022-11-23 05:27:16 +00:00
|
|
|
|
icon = plugin->icon(DockPart::QuickShow, colorType);
|
2022-11-18 03:19:58 +00:00
|
|
|
|
if (icon.isNull())
|
2022-11-23 05:27:16 +00:00
|
|
|
|
icon = plugin->icon(DockPart::QuickPanel, colorType);
|
2022-11-18 03:19:58 +00:00
|
|
|
|
pixmapSize = defaultIconSize;
|
|
|
|
|
QList<QSize> iconSizes = icon.availableSizes();
|
|
|
|
|
if (iconSizes.size() > 0)
|
|
|
|
|
pixmapSize = iconSizes[0];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (icon.isNull()) {
|
|
|
|
|
icon = QIcon(":/icons/resources/dcc_dock_plug_in.svg");
|
|
|
|
|
pixmapSize = QSize(20, 20);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return icon;
|
|
|
|
|
}
|