Skip to content
Snippets Groups Projects
Commit 3b007ef9 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Keep projects that failed to load in a session

Do not throw projects that failed to load out of the session.
Remember the project file names and append them to the session
again when saving.

Reviewed-by: dt
parent f8f40732
Branches
Tags
No related merge requests found
...@@ -82,6 +82,8 @@ public: ...@@ -82,6 +82,8 @@ public:
QString fileName() const; QString fileName() const;
void setFileName(const QString &fileName); void setFileName(const QString &fileName);
QStringList failedProjectFileNames() const;
public slots: public slots:
void sessionLoadingProgress(); void sessionLoadingProgress();
...@@ -91,6 +93,7 @@ private: ...@@ -91,6 +93,7 @@ private:
QString m_fileName; QString m_fileName;
QList<Project *> m_projects; QList<Project *> m_projects;
Project *m_startupProject; Project *m_startupProject;
QStringList m_failedProjects;
QMap<QString, QStringList> m_depMap; QMap<QString, QStringList> m_depMap;
QMap<QString, QVariant> m_values; QMap<QString, QVariant> m_values;
...@@ -167,8 +170,13 @@ bool SessionFile::load(const QString &fileName) ...@@ -167,8 +170,13 @@ bool SessionFile::load(const QString &fileName)
future.setProgressValue(1); future.setProgressValue(1);
// indirectly adds projects to session // indirectly adds projects to session
if (!fileList.isEmpty()) // Keep projects that failed to load in the session!
ProjectExplorerPlugin::instance()->openProjects(fileList); m_failedProjects = fileList;
if (!fileList.isEmpty()) {
QList<Project *> projects = ProjectExplorerPlugin::instance()->openProjects(fileList);
foreach (Project *p, projects)
m_failedProjects.removeAll(p->file()->fileName());
}
sessionLoadingProgress(); sessionLoadingProgress();
...@@ -239,6 +247,8 @@ bool SessionFile::save(const QString &fileName) ...@@ -239,6 +247,8 @@ bool SessionFile::save(const QString &fileName)
foreach (Project *pro, m_projects) { foreach (Project *pro, m_projects) {
projectFiles << pro->file()->fileName(); projectFiles << pro->file()->fileName();
} }
// Restore infromation on projects that failed to load:
projectFiles.append(m_failedProjects);
writer.saveValue(QLatin1String("ProjectList"), projectFiles); writer.saveValue(QLatin1String("ProjectList"), projectFiles);
...@@ -288,6 +298,11 @@ void SessionFile::setFileName(const QString &fileName) ...@@ -288,6 +298,11 @@ void SessionFile::setFileName(const QString &fileName)
m_fileName = fileName; m_fileName = fileName;
} }
QStringList SessionFile::failedProjectFileNames() const
{
return m_failedProjects;
}
Internal::SessionNodeImpl::SessionNodeImpl(SessionManager *manager) Internal::SessionNodeImpl::SessionNodeImpl(SessionManager *manager)
: ProjectExplorer::SessionNode(manager->currentSession(), manager) : ProjectExplorer::SessionNode(manager->currentSession(), manager)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment