dde-dock/frame/util/pluginloader.cpp
listenerri 55f5770694 Merge branch 'master' into dev/daemon-plugin-settings
Change-Id: Ifed765c278e0063685916e1f3e01896044f091fc
2019-01-28 17:19:58 +08:00

60 lines
1.6 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>
PluginLoader::PluginLoader(const QString &pluginDirPath, QObject *parent)
: QThread(parent)
, m_pluginDirPath(pluginDirPath)
{
}
void PluginLoader::run()
{
QDir pluginsDir("../plugins");
if (!pluginsDir.exists()) {
pluginsDir.setPath("/usr/lib/dde-dock/plugins");
}
qDebug() << "using dock plugins dir:" << pluginsDir.absolutePath();
const QStringList plugins = pluginsDir.entryList(QDir::Files);
for (const QString file : plugins)
{
if (!QLibrary::isLibrary(file))
continue;
// TODO: old dock plugins is uncompatible
if (file.startsWith("libdde-dock-"))
continue;
emit pluginFounded(pluginsDir.absoluteFilePath(file));
msleep(500);
}
emit finished();
}