summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Molkentin <daniel.molkentin@nokia.com>2009-06-12 18:06:34 +0200
committerDaniel Molkentin <daniel.molkentin@nokia.com>2009-06-12 18:06:34 +0200
commitcb784459c3c6dc6214b0ddc4604ab9ebb1a0596b (patch)
tree42c1d7ee57fba8eeaac139b07e28e9c81f77dc72
parent992a178be33538ec256861d3bd54d9adc40027ea (diff)
downloadqt-creator-cb784459c3c6dc6214b0ddc4604ab9ebb1a0596b.tar.gz
Do not temporary show the welcome mode when passing a session as argument
Reviewed-by: con
-rw-r--r--src/plugins/coreplugin/icore.h1
-rw-r--r--src/plugins/coreplugin/mainwindow.cpp3
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp43
-rw-r--r--src/plugins/projectexplorer/projectexplorer.h2
4 files changed, 28 insertions, 21 deletions
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index 973f2b97b3..cb2f2042c1 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -109,6 +109,7 @@ public:
virtual void openFiles(const QStringList &fileNames) = 0;
signals:
+ void coreAboutToOpen();
void coreOpened();
void saveSettingsRequested();
void optionsDialogRequested();
diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp
index c806e2c1f6..8a30d04a58 100644
--- a/src/plugins/coreplugin/mainwindow.cpp
+++ b/src/plugins/coreplugin/mainwindow.cpp
@@ -348,8 +348,9 @@ void MainWindow::extensionsInitialized()
m_actionManager->initialize();
readSettings();
updateContext();
- show();
+ emit m_coreImpl->coreAboutToOpen();
+ show();
emit m_coreImpl->coreOpened();
}
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index b53700b28c..c42acb95cc 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -703,6 +703,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
updateActions();
+ connect(Core::ICore::instance(), SIGNAL(coreAboutToOpen()),
+ this, SLOT(determineSessionToRestoreAtStartup()));
connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
return true;
@@ -1041,6 +1043,24 @@ void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode)
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()
@@ -1049,37 +1069,20 @@ void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode)
default session and puts the list of recent projects and sessions
onto the welcome page.
*/
-
void ProjectExplorerPlugin::restoreSession()
{
if (debug)
qDebug() << "ProjectExplorerPlugin::restoreSession";
- 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
- 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;
- }
- }
- }
+ arguments.removeOne(m_sessionToRestoreAtStartup);
// Restore latest session or what was passed on the command line
- if (sessionToLoad == QString::null) {
+ if (m_sessionToRestoreAtStartup == QString::null) {
m_session->createAndLoadNewDefaultSession();
} else {
- m_session->loadSession(sessionToLoad);
+ m_session->loadSession(m_sessionToRestoreAtStartup);
}
// update welcome page
diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h
index 985ff10d8e..e6a00847b4 100644
--- a/src/plugins/projectexplorer/projectexplorer.h
+++ b/src/plugins/projectexplorer/projectexplorer.h
@@ -161,6 +161,7 @@ private slots:
void updateSessionMenu();
void setSession(QAction *action);
+ void determineSessionToRestoreAtStartup();
void restoreSession();
void loadSession(const QString &session);
void runProject();
@@ -260,6 +261,7 @@ private:
Internal::ProjectWindow *m_proWindow;
SessionManager *m_session;
+ QString m_sessionToRestoreAtStartup;
Project *m_currentProject;
Node *m_currentNode;