forked from qt-creator/qt-creator
Move SessionFile::m_failedProjects to SessionManager
Change-Id: Ic030e6ac521728431ee17b2e69e7d5aaa30b1fc3 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -87,7 +87,6 @@ public:
|
|||||||
SessionFile();
|
SessionFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList m_failedProjects;
|
|
||||||
QMap<QString, QStringList> m_depMap;
|
QMap<QString, QStringList> m_depMap;
|
||||||
|
|
||||||
QMap<QString, QVariant> m_values;
|
QMap<QString, QVariant> m_values;
|
||||||
@@ -352,6 +351,7 @@ bool SessionManager::createImpl(const QString &fileName)
|
|||||||
delete m_file;
|
delete m_file;
|
||||||
m_file = new SessionFile;
|
m_file = new SessionFile;
|
||||||
m_startupProject = 0;
|
m_startupProject = 0;
|
||||||
|
m_failedProjects.clear();
|
||||||
const QString &sessionName = sessionNameFromFileName(fileName);
|
const QString &sessionName = sessionNameFromFileName(fileName);
|
||||||
emit aboutToLoadSession(sessionName);
|
emit aboutToLoadSession(sessionName);
|
||||||
m_sessionName = sessionName;
|
m_sessionName = sessionName;
|
||||||
@@ -396,6 +396,7 @@ bool SessionManager::loadImpl(const QString &fileName)
|
|||||||
delete m_file;
|
delete m_file;
|
||||||
m_file = new SessionFile;
|
m_file = new SessionFile;
|
||||||
m_startupProject = 0;
|
m_startupProject = 0;
|
||||||
|
m_failedProjects.clear();
|
||||||
const QString &sessionName = sessionNameFromFileName(fileName);
|
const QString &sessionName = sessionNameFromFileName(fileName);
|
||||||
emit aboutToLoadSession(sessionName);
|
emit aboutToLoadSession(sessionName);
|
||||||
m_sessionName = sessionName;
|
m_sessionName = sessionName;
|
||||||
@@ -429,14 +430,14 @@ bool SessionManager::loadImpl(const QString &fileName)
|
|||||||
|
|
||||||
// indirectly adds projects to session
|
// indirectly adds projects to session
|
||||||
// Keep projects that failed to load in the session!
|
// Keep projects that failed to load in the session!
|
||||||
m_file->m_failedProjects = fileList;
|
m_failedProjects = fileList;
|
||||||
if (!fileList.isEmpty()) {
|
if (!fileList.isEmpty()) {
|
||||||
QString errors;
|
QString errors;
|
||||||
QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList, &errors);
|
QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList, &errors);
|
||||||
if (!errors.isEmpty())
|
if (!errors.isEmpty())
|
||||||
QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errors);
|
QMessageBox::critical(Core::ICore::mainWindow(), tr("Failed to open project"), errors);
|
||||||
foreach (Project *p, projects)
|
foreach (Project *p, projects)
|
||||||
m_file->m_failedProjects.removeAll(p->file()->fileName());
|
m_failedProjects.removeAll(p->file()->fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionLoadingProgress();
|
sessionLoadingProgress();
|
||||||
@@ -446,11 +447,11 @@ bool SessionManager::loadImpl(const QString &fileName)
|
|||||||
QMap<QString, QVariant>::const_iterator i = depMap.constBegin();
|
QMap<QString, QVariant>::const_iterator i = depMap.constBegin();
|
||||||
while (i != depMap.constEnd()) {
|
while (i != depMap.constEnd()) {
|
||||||
const QString &key = i.key();
|
const QString &key = i.key();
|
||||||
if (m_file->m_failedProjects.contains(key))
|
if (m_failedProjects.contains(key))
|
||||||
continue;
|
continue;
|
||||||
QStringList values;
|
QStringList values;
|
||||||
foreach (const QString &value, i.value().toStringList()) {
|
foreach (const QString &value, i.value().toStringList()) {
|
||||||
if (!m_file->m_failedProjects.contains(value))
|
if (!m_failedProjects.contains(value))
|
||||||
values << value;
|
values << value;
|
||||||
}
|
}
|
||||||
m_file->m_depMap.insert(key, values);
|
m_file->m_depMap.insert(key, values);
|
||||||
@@ -487,7 +488,7 @@ bool SessionManager::loadImpl(const QString &fileName)
|
|||||||
// but doesn't emit this signal, so we do it here
|
// but doesn't emit this signal, so we do it here
|
||||||
emit startupProjectChanged(m_startupProject);
|
emit startupProjectChanged(m_startupProject);
|
||||||
|
|
||||||
QStringList failedProjects = m_file->m_failedProjects;
|
QStringList failedProjects = m_failedProjects;
|
||||||
if (!failedProjects.isEmpty()) {
|
if (!failedProjects.isEmpty()) {
|
||||||
QString fileList =
|
QString fileList =
|
||||||
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
|
QDir::toNativeSeparators(failedProjects.join(QLatin1String("<br>")));
|
||||||
@@ -503,7 +504,7 @@ bool SessionManager::loadImpl(const QString &fileName)
|
|||||||
box->exec();
|
box->exec();
|
||||||
|
|
||||||
if (box->clickedButton() == removeButton)
|
if (box->clickedButton() == removeButton)
|
||||||
m_file->m_failedProjects.clear();
|
m_failedProjects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore the active mode
|
// restore the active mode
|
||||||
@@ -541,7 +542,7 @@ bool SessionManager::save()
|
|||||||
projectFiles << pro->file()->fileName();
|
projectFiles << pro->file()->fileName();
|
||||||
|
|
||||||
// Restore infromation on projects that failed to load:
|
// Restore infromation on projects that failed to load:
|
||||||
projectFiles.append(m_file->m_failedProjects);
|
projectFiles.append(m_failedProjects);
|
||||||
|
|
||||||
writer.saveValue(QLatin1String("ProjectList"), projectFiles);
|
writer.saveValue(QLatin1String("ProjectList"), projectFiles);
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ private:
|
|||||||
|
|
||||||
Project *m_startupProject;
|
Project *m_startupProject;
|
||||||
QList<Project *> m_projects;
|
QList<Project *> m_projects;
|
||||||
|
QStringList m_failedProjects;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
Reference in New Issue
Block a user