forked from qt-creator/qt-creator
Open project from command line: Postpone the actual opening via a timer
This feels better, should not break anything. Change-Id: Ibd0b8c20dce346e10cb7a35d6785ea2cb29f0e51 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -134,6 +134,7 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTimer>
|
||||||
#include <QWizard>
|
#include <QWizard>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -247,6 +248,7 @@ struct ProjectExplorerPluginPrivate {
|
|||||||
KitManager *m_kitManager;
|
KitManager *m_kitManager;
|
||||||
ToolChainManager *m_toolChainManager;
|
ToolChainManager *m_toolChainManager;
|
||||||
bool m_shuttingDown;
|
bool m_shuttingDown;
|
||||||
|
QStringList m_arguments;
|
||||||
};
|
};
|
||||||
|
|
||||||
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
|
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(requestSession(QString)), this, SLOT(loadSession(QString)));
|
||||||
connect(d->m_welcomePage, SIGNAL(requestProject(QString)), this, SLOT(openProjectWelcomePage(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();
|
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)
|
void ProjectExplorerPlugin::loadSession(const QString &session)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ private slots:
|
|||||||
|
|
||||||
void determineSessionToRestoreAtStartup();
|
void determineSessionToRestoreAtStartup();
|
||||||
void restoreSession();
|
void restoreSession();
|
||||||
|
void restoreSession2();
|
||||||
void loadSession(const QString &session);
|
void loadSession(const QString &session);
|
||||||
void runProject();
|
void runProject();
|
||||||
void runProjectWithoutDeploy();
|
void runProjectWithoutDeploy();
|
||||||
|
|||||||
@@ -880,6 +880,10 @@ bool SessionManager::loadSession(const QString &session)
|
|||||||
m_future.setProgressRange(0, fileList.count() + openEditorsCount + 2);
|
m_future.setProgressRange(0, fileList.count() + openEditorsCount + 2);
|
||||||
m_future.setProgressValue(1);
|
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);
|
restoreProjects(fileList);
|
||||||
sessionLoadingProgress();
|
sessionLoadingProgress();
|
||||||
restoreDependencies(reader);
|
restoreDependencies(reader);
|
||||||
|
|||||||
Reference in New Issue
Block a user