mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: 修复任务栏“显示桌面”无法移除
插件加载完成判断有误,导致插件加载完成信号未发出,使得插件位置标签未写入到json变量里,最终导致在保存插件是否显示状态值时,将位置值写到了状态标签上 Log: 修复任务栏“显示桌面”无法移除,按下菜单的显示桌面无法移除显示桌面插件 Bug: https://pms.uniontech.com/zentao/bug-view-74956.html Change-Id: If88040bc027561b9a1127568f7fab6d24d61389d
This commit is contained in:
parent
32014afc27
commit
a2ebf6d04c
@ -153,6 +153,12 @@ PluginsItemInterface *AbstractPluginsController::pluginInterAt(QObject *destItem
|
||||
void AbstractPluginsController::startLoader(PluginLoader *loader)
|
||||
{
|
||||
connect(loader, &PluginLoader::finished, loader, &PluginLoader::deleteLater, Qt::QueuedConnection);
|
||||
connect(loader, &PluginLoader::pluginFounded, this, [ = ](const QString &pluginFile){
|
||||
QPair<QString, PluginsItemInterface *> pair;
|
||||
pair.first = pluginFile;
|
||||
pair.second = nullptr;
|
||||
m_pluginLoadMap.insert(pair, false);
|
||||
});
|
||||
connect(loader, &PluginLoader::pluginFounded, this, &AbstractPluginsController::loadPlugin, Qt::QueuedConnection);
|
||||
|
||||
int delay = Utils::SettingValue("com.deepin.dde.dock", "/com/deepin/dde/dock/", "delay-plugins-time", 0).toInt();
|
||||
@ -203,20 +209,38 @@ void AbstractPluginsController::loadPlugin(const QString &pluginFile)
|
||||
}
|
||||
|
||||
if (!pluginIsValid) {
|
||||
for (auto &pair: m_pluginLoadMap.keys()) {
|
||||
if (pair.first == pluginFile) {
|
||||
m_pluginLoadMap.remove(pair);
|
||||
}
|
||||
}
|
||||
QString notifyMessage(tr("The plugin %1 is not compatible with the system."));
|
||||
Dtk::Core::DUtil::DNotifySender(notifyMessage.arg(QFileInfo(pluginFile).fileName())).appIcon("dialog-warning").call();
|
||||
return;
|
||||
}
|
||||
|
||||
if (interface->pluginName() == "multitasking") {
|
||||
if (qEnvironmentVariable("XDG_SESSION_TYPE").contains("wayland") or Dtk::Core::DSysInfo::deepinType() == Dtk::Core::DSysInfo::DeepinServer)
|
||||
if (qEnvironmentVariable("XDG_SESSION_TYPE").contains("wayland") or Dtk::Core::DSysInfo::deepinType() == Dtk::Core::DSysInfo::DeepinServer){
|
||||
for (auto &pair: m_pluginLoadMap.keys()) {
|
||||
if (pair.first == pluginFile) {
|
||||
m_pluginLoadMap.remove(pair);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QPair<QString, PluginsItemInterface *> newPair;
|
||||
newPair.first = pluginFile;
|
||||
newPair.second = interface;
|
||||
m_pluginLoadMap.insert(newPair, true);
|
||||
for (auto &pair: m_pluginLoadMap.keys()) {
|
||||
if (pair.first == pluginFile) {
|
||||
m_pluginLoadMap.remove(pair);
|
||||
|
||||
QPair<QString, PluginsItemInterface *> newPair;
|
||||
newPair.first = pluginFile;
|
||||
newPair.second = interface;
|
||||
m_pluginLoadMap.insert(newPair, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 保存 PluginLoader 对象指针
|
||||
QMap<QString, QObject *> interfaceData;
|
||||
@ -250,7 +274,21 @@ void AbstractPluginsController::initPlugin(PluginsItemInterface *interface)
|
||||
{
|
||||
qDebug() << objectName() << "init plugin: " << interface->pluginName();
|
||||
interface->init(this);
|
||||
if (qApp->property("PLUGINSNUMBER").toInt() == m_pluginLoadMap.keys().size()) {
|
||||
|
||||
for (const auto &pair : m_pluginLoadMap.keys()) {
|
||||
if (pair.second == interface)
|
||||
m_pluginLoadMap.insert(pair, true);
|
||||
}
|
||||
|
||||
bool loaded = true;
|
||||
for (int i = 0; i < m_pluginLoadMap.keys().size(); ++i) {
|
||||
if (!m_pluginLoadMap.values()[i]) {
|
||||
loaded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (loaded) {
|
||||
emit pluginLoaderFinished();
|
||||
}
|
||||
qDebug() << objectName() << "init plugin finished: " << interface->pluginName();
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <QDebug>
|
||||
#include <QLibrary>
|
||||
#include <QGSettings>
|
||||
#include <QApplication>
|
||||
|
||||
PluginLoader::PluginLoader(const QString &pluginDirPath, QObject *parent)
|
||||
: QThread(parent)
|
||||
, m_pluginDirPath(pluginDirPath)
|
||||
@ -64,9 +64,8 @@ void PluginLoader::run()
|
||||
continue;
|
||||
}
|
||||
plugins << file;
|
||||
}
|
||||
qApp->setProperty("PLUGINSNUMBER", plugins.count());
|
||||
|
||||
}
|
||||
for (auto plugin : plugins) {
|
||||
emit pluginFounded(pluginsDir.absoluteFilePath(plugin));
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ protected:
|
||||
|
||||
private:
|
||||
QString m_pluginDirPath;
|
||||
|
||||
};
|
||||
|
||||
#endif // PLUGINLOADER_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user