mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00

之前用QTimer定时1秒钟后将插件的配置信息写入GSettings,但在配置比较差的机型上插件还没有加载完,导致往GSettings里写配置信息的时候漏了一两个插件。 改为当有插件被用户移动、移除或检测到新的插件时,直接调用更新GSettings中的插件配置信息。 Log: 修复自动化测试发现任务栏插件参数缺失的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-59243.html Change-Id: I4dc37ad7f611fabf479375f100506ef84f3f78d3
87 lines
2.6 KiB
C++
87 lines
2.6 KiB
C++
/*
|
|
* Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
|
|
*
|
|
* Author: wangshaojun <wangshaojun_cm@deepin.com>
|
|
*
|
|
* Maintainer: wangshaojun <wangshaojun_cm@deepin.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 DOCKITEMMANAGER_H
|
|
#define DOCKITEMMANAGER_H
|
|
|
|
#include "dockpluginscontroller.h"
|
|
#include "pluginsiteminterface.h"
|
|
#include "item/dockitem.h"
|
|
#include "item/appitem.h"
|
|
#include "item/placeholderitem.h"
|
|
|
|
#include <com_deepin_dde_daemon_dock.h>
|
|
|
|
#include <QObject>
|
|
|
|
using DBusDock = com::deepin::dde::daemon::Dock;
|
|
|
|
class DockItemManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static DockItemManager *instance(QObject *parent = nullptr);
|
|
|
|
const QList<QPointer<DockItem> > itemList() const;
|
|
const QList<PluginsItemInterface *> pluginList() const;
|
|
bool appIsOnDock(const QString &appDesktop) const;
|
|
void startLoadPlugins() const;
|
|
|
|
signals:
|
|
void itemInserted(const int index, DockItem *item) const;
|
|
void itemRemoved(DockItem *item) const;
|
|
void itemUpdated(DockItem *item) const;
|
|
void trayVisableCountChanged(const int &count) const;
|
|
void requestWindowAutoHide(const bool autoHide) const;
|
|
void requestRefershWindowVisible() const;
|
|
|
|
void requestUpdateDockItem() const;
|
|
|
|
public slots:
|
|
void refershItemsIcon();
|
|
void sortPluginItems();
|
|
void itemMoved(DockItem *const sourceItem, DockItem *const targetItem);
|
|
void itemAdded(const QString &appDesktop, int idx);
|
|
|
|
private:
|
|
explicit DockItemManager(QObject *parent = nullptr);
|
|
void appItemAdded(const QDBusObjectPath &path, const int index);
|
|
void appItemRemoved(const QString &appId);
|
|
void appItemRemoved(AppItem *appItem);
|
|
void pluginItemInserted(PluginsItem *item);
|
|
void pluginItemRemoved(PluginsItem *item);
|
|
void updatePluginsItemOrderKey();
|
|
void reloadAppItems();
|
|
void manageItem(DockItem *item);
|
|
|
|
private:
|
|
DBusDock *m_appInter;
|
|
DockPluginsController *m_pluginsInter;
|
|
|
|
static DockItemManager *INSTANCE;
|
|
|
|
QList<QPointer<DockItem>> m_itemList;
|
|
QList<QString> m_appIDist;
|
|
};
|
|
|
|
#endif // DOCKITEMMANAGER_H
|