forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -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:
|
|||||||
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)
|
|||||||
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)
|
|||||||
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)
|
|||||||
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)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user