Commit 16b60798 authored by Daniel Teske's avatar Daniel Teske Committed by hjk
Browse files

Open project from command line: Postpone the actual opening via a timer



This feels better, should not break anything.

Change-Id: Ibd0b8c20dce346e10cb7a35d6785ea2cb29f0e51
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 3e9ed798
......@@ -134,6 +134,7 @@
#include <QFileDialog>
#include <QMenu>
#include <QMessageBox>
#include <QTimer>
#include <QWizard>
/*!
......@@ -247,6 +248,7 @@ struct ProjectExplorerPluginPrivate {
KitManager *m_kitManager;
ToolChainManager *m_toolChainManager;
bool m_shuttingDown;
QStringList m_arguments;
};
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
......@@ -1597,10 +1599,17 @@ void ProjectExplorerPlugin::restoreSession()
connect(d->m_welcomePage, SIGNAL(requestSession(QString)), this, SLOT(loadSession(QString)));
connect(d->m_welcomePage, SIGNAL(requestProject(QString)), this, SLOT(openProjectWelcomePage(QString)));
Core::ICore::openFiles(arguments, Core::ICore::OpenFilesFlags(Core::ICore::CanContainLineNumbers | Core::ICore::SwitchMode));
d->m_arguments = arguments;
QTimer::singleShot(0, this, SLOT(restoreSession2()));
updateActions();
}
void ProjectExplorerPlugin::restoreSession2()
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
Core::ICore::openFiles(d->m_arguments, Core::ICore::OpenFilesFlags(Core::ICore::CanContainLineNumbers | Core::ICore::SwitchMode));
}
void ProjectExplorerPlugin::loadSession(const QString &session)
{
if (debug)
......
......@@ -188,6 +188,7 @@ private slots:
void determineSessionToRestoreAtStartup();
void restoreSession();
void restoreSession2();
void loadSession(const QString &session);
void runProject();
void runProjectWithoutDeploy();
......
......@@ -880,6 +880,10 @@ bool SessionManager::loadSession(const QString &session)
m_future.setProgressRange(0, fileList.count() + openEditorsCount + 2);
m_future.setProgressValue(1);
// if one processEvents doesn't get the job done
// just use two!
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
restoreProjects(fileList);
sessionLoadingProgress();
restoreDependencies(reader);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment