2022-05-17 20:57:09 +08:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
|
|
|
|
*
|
|
|
|
|
* Author: donghualin <donghualin@uniontech.com>
|
|
|
|
|
*
|
|
|
|
|
* Maintainer: donghualin <donghualin@uniontech.com>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* 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/>.
|
|
|
|
|
*/
|
2022-05-12 17:35:50 +08:00
|
|
|
|
#ifndef QUICKSETTINGCONTROLLER_H
|
|
|
|
|
#define QUICKSETTINGCONTROLLER_H
|
|
|
|
|
|
|
|
|
|
#include "abstractpluginscontroller.h"
|
2022-11-28 15:30:34 +08:00
|
|
|
|
#include "pluginsiteminterface.h"
|
2022-05-12 17:35:50 +08:00
|
|
|
|
|
|
|
|
|
class QuickSettingItem;
|
2022-10-19 03:50:12 +00:00
|
|
|
|
class PluginsItem;
|
2022-05-12 17:35:50 +08:00
|
|
|
|
|
|
|
|
|
class QuickSettingController : public AbstractPluginsController
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
2022-10-19 03:50:12 +00:00
|
|
|
|
public:
|
|
|
|
|
enum class PluginAttribute {
|
2022-11-28 15:30:34 +08:00
|
|
|
|
None = 0, // 不在任何区域显示的插件
|
|
|
|
|
Quick, // 快捷区域插件
|
2022-11-02 06:35:04 +00:00
|
|
|
|
Tool, // 工具插件(回收站和窗管开发的另一套插件)
|
|
|
|
|
System, // 系统插件(关机插件)
|
|
|
|
|
Tray, // 托盘插件(U盘图标等)
|
|
|
|
|
Fixed // 固定区域插件(显示桌面和多任务视图)
|
2022-10-19 03:50:12 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-05-12 17:35:50 +08:00
|
|
|
|
public:
|
|
|
|
|
static QuickSettingController *instance();
|
2022-10-19 03:50:12 +00:00
|
|
|
|
QList<PluginsItemInterface *> pluginItems(const PluginAttribute &pluginClass) const;
|
2023-01-12 11:06:36 +08:00
|
|
|
|
QJsonObject metaData(PluginsItemInterface *pluginItem);
|
2022-10-19 03:50:12 +00:00
|
|
|
|
PluginsItem *pluginItemWidget(PluginsItemInterface *pluginItem);
|
2022-11-02 06:35:04 +00:00
|
|
|
|
QList<PluginsItemInterface *> pluginInSettings();
|
2022-11-02 06:57:46 +00:00
|
|
|
|
PluginAttribute pluginAttribute(PluginsItemInterface * const itemInter) const;
|
2023-01-12 11:06:36 +08:00
|
|
|
|
QString itemKey(PluginsItemInterface *pluginItem) const;
|
2022-05-12 17:35:50 +08:00
|
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
2022-11-04 07:28:51 +00:00
|
|
|
|
void pluginInserted(PluginsItemInterface *itemInter, const PluginAttribute);
|
2022-10-19 03:50:12 +00:00
|
|
|
|
void pluginRemoved(PluginsItemInterface *itemInter);
|
2022-11-04 07:28:51 +00:00
|
|
|
|
void pluginUpdated(PluginsItemInterface *, const DockPart);
|
2023-01-12 11:06:36 +08:00
|
|
|
|
void requestAppletVisible(PluginsItemInterface * itemInter, const QString &itemKey, bool visible);
|
2022-05-12 17:35:50 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
2022-05-17 20:57:09 +08:00
|
|
|
|
explicit QuickSettingController(QObject *parent = Q_NULLPTR);
|
2022-05-12 17:35:50 +08:00
|
|
|
|
~QuickSettingController() override;
|
|
|
|
|
|
|
|
|
|
protected:
|
2023-01-12 11:06:36 +08:00
|
|
|
|
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
|
|
|
|
void itemUpdate(PluginsItemInterface * const itemInter, const QString &) override;
|
|
|
|
|
void itemRemoved(PluginsItemInterface * const itemInter, const QString &) override;
|
|
|
|
|
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
2022-10-28 10:00:09 +00:00
|
|
|
|
|
2022-06-09 13:16:49 +08:00
|
|
|
|
void updateDockInfo(PluginsItemInterface * const itemInter, const DockPart &part) override;
|
2022-05-12 17:35:50 +08:00
|
|
|
|
|
2022-05-30 13:50:09 +08:00
|
|
|
|
private:
|
2022-10-19 03:50:12 +00:00
|
|
|
|
QMap<PluginAttribute, QList<PluginsItemInterface *>> m_quickPlugins;
|
|
|
|
|
QMap<PluginsItemInterface *, PluginsItem *> m_pluginItemWidgetMap;
|
2022-05-12 17:35:50 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // CONTAINERPLUGINSCONTROLLER_H
|