From cee160225378acbc7d29665bd69f6f793ef78fb9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 8 Jul 2013 16:26:29 +0200 Subject: [PATCH] Fix wrong progress when loading session. The code was trying to show one tick for each editor that is opened, but editors are actually only opened for a file, if it is visible in a view. So editorOpened is only sent for one editor per open split. The new code just shows one tick for restoring editors, to keep things simple. Change-Id: I6a24061858f532c3ccfded9677b8928ae62a1448 Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/session.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index 8e0dcdea17a..53cb53dd79b 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -339,15 +339,6 @@ bool SessionManager::save() ++i; } data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap)); - - int editorCount = 0; - QList editors = ICore::editorManager()->openedEditors(); - foreach (Core::IEditor *editor, editors) { - Q_ASSERT(editor); - if (!editor->isTemporary()) - ++editorCount; - } - data.insert(QLatin1String("OpenEditors"), editorCount); data.insert(QLatin1String("EditorSettings"), ICore::editorManager()->saveState().toBase64()); QMap::const_iterator it, end; @@ -783,12 +774,9 @@ void SessionManager::restoreEditors(const Utils::PersistentSettingsReader &reade { const QVariant &editorsettings = reader.restoreValue(QLatin1String("EditorSettings")); if (editorsettings.isValid()) { - connect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)), - this, SLOT(sessionLoadingProgress())); ICore::editorManager()->restoreState( QByteArray::fromBase64(editorsettings.toByteArray())); - disconnect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)), - this, SLOT(sessionLoadingProgress())); + sessionLoadingProgress(); } } @@ -866,6 +854,9 @@ bool SessionManager::loadSession(const QString &session) ICore::progressManager()->addTask(m_future.future(), tr("Session"), QLatin1String("ProjectExplorer.SessionFile.Load")); + m_future.setProgressRange(0, 1); + m_future.setProgressValue(0); + restoreValues(reader); emit aboutToLoadSession(session); @@ -875,9 +866,8 @@ bool SessionManager::loadSession(const QString &session) QStringList fileList = reader.restoreValue(QLatin1String("ProjectList")).toStringList(); - int openEditorsCount = reader.restoreValue(QLatin1String("OpenEditors")).toInt(); - m_future.setProgressRange(0, fileList.count() + openEditorsCount + 2); + m_future.setProgressRange(0, fileList.count() + 1/*initialization above*/ + 1/*editors*/); m_future.setProgressValue(1); // if one processEvents doesn't get the job done