forked from qt-creator/qt-creator
Do not temporary show the welcome mode when passing a session as argument
Reviewed-by: con
This commit is contained in:
@@ -109,6 +109,7 @@ public:
|
|||||||
virtual void openFiles(const QStringList &fileNames) = 0;
|
virtual void openFiles(const QStringList &fileNames) = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void coreAboutToOpen();
|
||||||
void coreOpened();
|
void coreOpened();
|
||||||
void saveSettingsRequested();
|
void saveSettingsRequested();
|
||||||
void optionsDialogRequested();
|
void optionsDialogRequested();
|
||||||
|
|||||||
@@ -348,8 +348,9 @@ void MainWindow::extensionsInitialized()
|
|||||||
m_actionManager->initialize();
|
m_actionManager->initialize();
|
||||||
readSettings();
|
readSettings();
|
||||||
updateContext();
|
updateContext();
|
||||||
show();
|
|
||||||
|
|
||||||
|
emit m_coreImpl->coreAboutToOpen();
|
||||||
|
show();
|
||||||
emit m_coreImpl->coreOpened();
|
emit m_coreImpl->coreOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -703,6 +703,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
|
|
||||||
updateActions();
|
updateActions();
|
||||||
|
|
||||||
|
connect(Core::ICore::instance(), SIGNAL(coreAboutToOpen()),
|
||||||
|
this, SLOT(determineSessionToRestoreAtStartup()));
|
||||||
connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
|
connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1041,6 +1043,24 @@ void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode)
|
|||||||
updateWelcomePage(welcomeMode);
|
updateWelcomePage(welcomeMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
|
||||||
|
{
|
||||||
|
QStringList sessions = m_session->sessions();
|
||||||
|
// We have command line arguments, try to find a session in them
|
||||||
|
QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments();
|
||||||
|
// Default to no session loading
|
||||||
|
m_sessionToRestoreAtStartup = QString::null;
|
||||||
|
foreach (const QString &arg, arguments) {
|
||||||
|
if (sessions.contains(arg)) {
|
||||||
|
// Session argument
|
||||||
|
m_sessionToRestoreAtStartup = arg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!m_sessionToRestoreAtStartup.isNull())
|
||||||
|
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_EDIT);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void ProjectExplorerPlugin::restoreSession()
|
\fn void ProjectExplorerPlugin::restoreSession()
|
||||||
|
|
||||||
@@ -1049,37 +1069,20 @@ void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode)
|
|||||||
default session and puts the list of recent projects and sessions
|
default session and puts the list of recent projects and sessions
|
||||||
onto the welcome page.
|
onto the welcome page.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ProjectExplorerPlugin::restoreSession()
|
void ProjectExplorerPlugin::restoreSession()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectExplorerPlugin::restoreSession";
|
qDebug() << "ProjectExplorerPlugin::restoreSession";
|
||||||
|
|
||||||
QStringList sessions = m_session->sessions();
|
|
||||||
|
|
||||||
// We have command line arguments, try to find a session in them
|
// We have command line arguments, try to find a session in them
|
||||||
QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments();
|
QStringList arguments = ExtensionSystem::PluginManager::instance()->arguments();
|
||||||
|
arguments.removeOne(m_sessionToRestoreAtStartup);
|
||||||
// Default to no session loading
|
|
||||||
QString sessionToLoad = QString::null;
|
|
||||||
if (!arguments.isEmpty()) {
|
|
||||||
foreach (const QString &arg, arguments) {
|
|
||||||
if (sessions.contains(arg)) {
|
|
||||||
// Session argument
|
|
||||||
sessionToLoad = arg;
|
|
||||||
arguments.removeOne(arg);
|
|
||||||
if (debug)
|
|
||||||
qDebug() << "Found session argument, restoring session" << sessionToLoad;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore latest session or what was passed on the command line
|
// Restore latest session or what was passed on the command line
|
||||||
if (sessionToLoad == QString::null) {
|
if (m_sessionToRestoreAtStartup == QString::null) {
|
||||||
m_session->createAndLoadNewDefaultSession();
|
m_session->createAndLoadNewDefaultSession();
|
||||||
} else {
|
} else {
|
||||||
m_session->loadSession(sessionToLoad);
|
m_session->loadSession(m_sessionToRestoreAtStartup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update welcome page
|
// update welcome page
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ private slots:
|
|||||||
void updateSessionMenu();
|
void updateSessionMenu();
|
||||||
void setSession(QAction *action);
|
void setSession(QAction *action);
|
||||||
|
|
||||||
|
void determineSessionToRestoreAtStartup();
|
||||||
void restoreSession();
|
void restoreSession();
|
||||||
void loadSession(const QString &session);
|
void loadSession(const QString &session);
|
||||||
void runProject();
|
void runProject();
|
||||||
@@ -260,6 +261,7 @@ private:
|
|||||||
|
|
||||||
Internal::ProjectWindow *m_proWindow;
|
Internal::ProjectWindow *m_proWindow;
|
||||||
SessionManager *m_session;
|
SessionManager *m_session;
|
||||||
|
QString m_sessionToRestoreAtStartup;
|
||||||
|
|
||||||
Project *m_currentProject;
|
Project *m_currentProject;
|
||||||
Node *m_currentNode;
|
Node *m_currentNode;
|
||||||
|
|||||||
Reference in New Issue
Block a user