dde-dock/frame/controller/toolapphelper.h
donghualin 8cb6cb89d7 feat: 增加回收站和电源插件在控制中心的显示和隐藏
响应DConfig配置文件的变化,根据当前新增或删除的配置来新增或删除插件

Log:
Influence: 从控制中心勾选或者取消勾选回收站和电源插件,观察任务栏的变化
Task: https://pms.uniontech.com/task-view-216841.html
Change-Id: Ia79ae924180d07e1b11f26bd119c83a8932cb80d
2022-11-30 13:08:19 +08:00

71 lines
1.9 KiB
C++

/*
* 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/>.
*/
#ifndef TOOLAPPHELPER_H
#define TOOLAPPHELPER_H
#include "constants.h"
#include <QObject>
class QWidget;
class DockItem;
class PluginsItem;
class PluginsItemInterface;
using namespace Dock;
class ToolAppHelper : public QObject
{
Q_OBJECT
public:
explicit ToolAppHelper(QWidget *toolAreaWidget, QObject *parent = nullptr);
void setDisplayMode(DisplayMode displayMode);
void setPosition(Dock::Position position);
bool toolIsVisible() const;
Q_SIGNALS:
void requestUpdate();
void toolVisibleChanged(bool);
private:
void appendToToolArea(int index, DockItem *dockItem);
bool removeToolArea(PluginsItemInterface *itemInter);
void moveToolWidget();
void updateToolArea();
void updateWidgetStatus();
bool pluginInTool(PluginsItemInterface *itemInter) const;
void pluginItemAdded(PluginsItemInterface *itemInter);
void pluginItemRemoved(PluginsItemInterface *itemInter);
bool pluginExists(PluginsItemInterface *itemInter) const;
private:
QWidget *m_toolAreaWidget;
DisplayMode m_displayMode;
Dock::Position m_position;
QList<DockItem *> m_sequentPluginItems;
};
#endif // TOOLAPPHELPER_H