Commit cee16022 authored by Eike Ziller's avatar Eike Ziller
Browse files

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: default avatarDaniel Teske <daniel.teske@digia.com>
parent 65c2930c
...@@ -339,15 +339,6 @@ bool SessionManager::save() ...@@ -339,15 +339,6 @@ bool SessionManager::save()
++i; ++i;
} }
data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap)); data.insert(QLatin1String("ProjectDependencies"), QVariant(depMap));
int editorCount = 0;
QList<Core::IEditor *> 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()); data.insert(QLatin1String("EditorSettings"), ICore::editorManager()->saveState().toBase64());
QMap<QString, QVariant>::const_iterator it, end; QMap<QString, QVariant>::const_iterator it, end;
...@@ -783,12 +774,9 @@ void SessionManager::restoreEditors(const Utils::PersistentSettingsReader &reade ...@@ -783,12 +774,9 @@ void SessionManager::restoreEditors(const Utils::PersistentSettingsReader &reade
{ {
const QVariant &editorsettings = reader.restoreValue(QLatin1String("EditorSettings")); const QVariant &editorsettings = reader.restoreValue(QLatin1String("EditorSettings"));
if (editorsettings.isValid()) { if (editorsettings.isValid()) {
connect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)),
this, SLOT(sessionLoadingProgress()));
ICore::editorManager()->restoreState( ICore::editorManager()->restoreState(
QByteArray::fromBase64(editorsettings.toByteArray())); QByteArray::fromBase64(editorsettings.toByteArray()));
disconnect(ICore::editorManager(), SIGNAL(editorOpened(Core::IEditor*)), sessionLoadingProgress();
this, SLOT(sessionLoadingProgress()));
} }
} }
...@@ -866,6 +854,9 @@ bool SessionManager::loadSession(const QString &session) ...@@ -866,6 +854,9 @@ bool SessionManager::loadSession(const QString &session)
ICore::progressManager()->addTask(m_future.future(), tr("Session"), ICore::progressManager()->addTask(m_future.future(), tr("Session"),
QLatin1String("ProjectExplorer.SessionFile.Load")); QLatin1String("ProjectExplorer.SessionFile.Load"));
m_future.setProgressRange(0, 1);
m_future.setProgressValue(0);
restoreValues(reader); restoreValues(reader);
emit aboutToLoadSession(session); emit aboutToLoadSession(session);
...@@ -875,9 +866,8 @@ bool SessionManager::loadSession(const QString &session) ...@@ -875,9 +866,8 @@ bool SessionManager::loadSession(const QString &session)
QStringList fileList = QStringList fileList =
reader.restoreValue(QLatin1String("ProjectList")).toStringList(); 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); m_future.setProgressValue(1);
// if one processEvents doesn't get the job done // if one processEvents doesn't get the job done
......
Supports Markdown
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