diff options
author | Daniel Teske <daniel.teske@theqtcompany.com> | 2015-05-18 16:57:29 +0200 |
---|---|---|
committer | Daniel Teske <daniel.teske@theqtcompany.com> | 2015-07-28 10:34:12 +0000 |
commit | edad1ba516d7ccf94db17b80389eb34e06926c24 (patch) | |
tree | b6a2bd3fb702dccea611e4eaf954d10ca6a7ac30 /src/plugins/cmakeprojectmanager | |
parent | 2d12884f2ee9ca8db1ac174f370d88cb4136de9d (diff) | |
download | qt-creator-edad1ba516d7ccf94db17b80389eb34e06926c24.tar.gz |
Project: Improve fromMap() error reporting interface
Instead of just a bool, return a tristate of: Ok, Error and UserAbort.
Also add a out parameter errorMessgge.
Change-Id: Icb076de49998e9372839d0631c2776e905e4a0f6
Task-number: QTCREATORBUG-13223
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeproject.cpp | 19 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakeproject.h | 2 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index ef10812ffd..22894371d5 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -506,16 +506,17 @@ QStringList CMakeProject::files(FilesMode fileMode) const return m_files; } -bool CMakeProject::fromMap(const QVariantMap &map) +Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage) { - if (!Project::fromMap(map)) - return false; + RestoreResult result = Project::fromMap(map, errorMessage); + if (result != RestoreResult::Ok) + return result; bool hasUserFile = activeTarget(); if (!hasUserFile) { CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, projectDirectory().toString(), Environment::systemEnvironment()); if (copw.exec() != QDialog::Accepted) - return false; + return RestoreResult::UserAbort; Kit *k = copw.kit(); Target *t = new Target(this, k); CMakeBuildConfiguration *bc(new CMakeBuildConfiguration(t)); @@ -542,8 +543,10 @@ bool CMakeProject::fromMap(const QVariantMap &map) // We have a user file, but we could still be missing the cbp file // or simply run createXml with the saved settings CMakeBuildConfiguration *activeBC = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration()); - if (!activeBC) - return false; + if (!activeBC) { + *errorMessage = tr("Internal Error: No build configuration found in settings file."); + return RestoreResult::Error; + } QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory().toString())); QFileInfo cbpFileFi(cbpFile); @@ -557,7 +560,7 @@ bool CMakeProject::fromMap(const QVariantMap &map) CMakeBuildInfo info(activeBC); CMakeOpenProjectWizard copw(Core::ICore::mainWindow(), m_manager, mode, &info); if (copw.exec() != QDialog::Accepted) - return false; + return RestoreResult::UserAbort; else activeBC->setUseNinja(copw.useNinja()); } @@ -573,7 +576,7 @@ bool CMakeProject::fromMap(const QVariantMap &map) connect(this, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)), this, SLOT(activeTargetWasChanged(ProjectExplorer::Target*))); - return true; + return RestoreResult::Ok; } bool CMakeProject::setupTarget(Target *t) diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index db58567df9..27d88b1613 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -118,7 +118,7 @@ signals: void buildTargetsChanged(); protected: - bool fromMap(const QVariantMap &map); + RestoreResult fromMap(const QVariantMap &map, QString *errorMessage); bool setupTarget(ProjectExplorer::Target *t); // called by CMakeBuildSettingsWidget |