dde-dock/frame/util/pluginloader.cpp
曹威 b342f6f884 feat: 增加集中管控相关功能,所有功能可通过全局一个配置启用或禁用。
1. 模块可配置显示隐藏,能打开控制中心的右键菜单全屏蔽。
2. gsettings最终生效的设置在各个用户之间是互相隔离的,而且root用户读取不到普通用户的gsettings配置。
3. 集中管控版本右下解关机按钮右菜菜单的锁定功能改为调用SwitchTTYAndShow

Log: 引用头文件分类规范化
Task: https://pms.uniontech.com/zentao/task-view-30817.html
Change-Id: I5ae833f61864ba1874c8ceb75351d569614ab235
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2377
Reviewed-by: <mailman@uniontech.com>
Reviewed-by: niecheng <niecheng@uniontech.com>
Reviewed-by: wangwei <wangwei@uniontech.com>
Tested-by: <mailman@uniontech.com>
2020-08-28 14:20:32 +08:00

72 lines
2.2 KiB
C++

/*
* Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw <sbw@sbw.so>
*
* Maintainer: sbw <sbw@sbw.so>
*
* 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/>.
*/
#include "pluginloader.h"
#include <QDir>
#include <QDebug>
#include <QLibrary>
#include <QGSettings>
PluginLoader::PluginLoader(const QString &pluginDirPath, QObject *parent)
: QThread(parent)
, m_pluginDirPath(pluginDirPath)
{
}
void PluginLoader::run()
{
QDir pluginsDir(m_pluginDirPath);
const QStringList plugins = pluginsDir.entryList(QDir::Files);
static const QGSettings gsetting("com.deepin.dde.dock.disableplugins", "/com/deepin/dde/dock/disableplugins/");
static const auto disable_plugins_list = gsetting.get("disable-plugins-list").toStringList();
for (const QString& file : plugins)
{
if (!QLibrary::isLibrary(file)){
#ifdef QT_DEBUG
qDebug() << "--------not a library: " << pluginsDir.absoluteFilePath(file);
#endif
continue;
}
// TODO: old dock plugins is uncompatible
if (file.startsWith("libdde-dock-")) {
#ifdef QT_DEBUG
qDebug() << "--------uncompatible library: " << pluginsDir.absoluteFilePath(file);
#endif
continue;
}
if (disable_plugins_list.contains(file)) {
qDebug() << "disable loading plugin:" << pluginsDir.absoluteFilePath(file);
continue;
}
#ifdef QT_DEBUG
qDebug() << "----------loaded: " << pluginsDir.absoluteFilePath(file);
#endif
emit pluginFounded(pluginsDir.absoluteFilePath(file));
}
emit finished();
}