Add delay between load plugins

Change-Id: I6eefc81fe3792f5d8b7397b75fc8fd71d40150e7
This commit is contained in:
石博文 2017-04-20 17:22:19 +08:00
parent f233970dc8
commit b0c9dfb414
Notes: Deepin Code Review 2017-04-20 17:39:03 +08:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Thu, 20 Apr 2017 17:39:03 +0800
Reviewed-on: https://cr.deepin.io/22442
Project: dde/dde-dock
Branch: refs/heads/master
3 changed files with 5 additions and 3 deletions

View File

@ -27,8 +27,9 @@ void DockPluginLoader::run()
if (file.startsWith("libdde-dock-"))
continue;
msleep(150);
emit pluginFounded(pluginsDir.absoluteFilePath(file));
msleep(500);
}
emit finished();

View File

@ -12,7 +12,7 @@ DockPluginsController::DockPluginsController(DockItemController *itemControllerI
{
qApp->installEventFilter(this);
QMetaObject::invokeMethod(this, "startLoader", Qt::QueuedConnection);
QTimer::singleShot(1, this, &DockPluginsController::startLoader);
}
DockPluginsController::~DockPluginsController()
@ -94,7 +94,7 @@ void DockPluginsController::startLoader()
connect(loader, &DockPluginLoader::finished, loader, &DockPluginLoader::deleteLater, Qt::QueuedConnection);
connect(loader, &DockPluginLoader::pluginFounded, this, &DockPluginsController::loadPlugin, Qt::QueuedConnection);
loader->start(QThread::LowestPriority);
QTimer::singleShot(1, loader, [=] { loader->start(QThread::LowestPriority); });
}
void DockPluginsController::displayModeChanged()

View File

@ -37,6 +37,7 @@ const QString DatetimePlugin::pluginName() const
void DatetimePlugin::init(PluginProxyInterface *proxyInter)
{
m_proxyInter = proxyInter;
m_proxyInter->itemAdded(this, QString());
}