From 67443c9e5ea740ebf5caea74acbb53cb860e84b4 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 15:40:41 +0200 Subject: [PATCH 01/10] Qt Creator 12 --- CMakeLists.txt | 2 +- versions.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3f6a46b..130bb49b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10) -project(ROSProjectManager VERSION 11.0) +project(ROSProjectManager VERSION 12.0) if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") add_link_options("-Wl,-z,relro,-z,now,-z,defs") diff --git a/versions.yaml b/versions.yaml index 20204c2b..a59ba9ec 100644 --- a/versions.yaml +++ b/versions.yaml @@ -3,8 +3,8 @@ # - https://download.qt.io/official_releases/qtcreator/ # for valid versions # the version schema is: {major}[.{minor}][.{patch}][-{devel}] -qtc_version: "11" +qtc_version: "12" qtc_modules: ["qtcreator", "qtcreator_dev"] -qt_version: "6.4" +qt_version: "6.6" qt_modules: ['qtbase', 'qtdeclarative', 'icu', 'qttools', 'qt5compat'] From 22cc5395504953e30de75f4271dffa77828dd977 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 16:01:56 +0200 Subject: [PATCH 02/10] update plugin metadata --- src/project_manager/ROSProjectManager.json.in | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/project_manager/ROSProjectManager.json.in b/src/project_manager/ROSProjectManager.json.in index 6ed2a538..23efe4ed 100644 --- a/src/project_manager/ROSProjectManager.json.in +++ b/src/project_manager/ROSProjectManager.json.in @@ -1,19 +1,19 @@ { - \"Name\" : \"ROSProjectManager\", - \"Version\" : \"$$QTCREATOR_VERSION\", - \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", - \"Vendor\" : \"ROS Industrial\", - \"Copyright\" : \"(C) 2015 ROS Industrial\", - \"License\" : [ \"Commercial Usage\", - \"\", - \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\", - \"\", - \"GNU Lesser General Public License Usage\", - \"\", - \"Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\" + "Name" : "ROSProjectManager", + "Version" : "${IDE_VERSION}", + "CompatVersion" : "${IDE_VERSION_COMPAT}", + "Vendor" : "ROS Industrial", + "Copyright" : "(C) 2015 ROS Industrial", + "License" : [ "Commercial Usage", + "", + "Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.", + "", + "GNU Lesser General Public License Usage", + "", + "Alternatively, this plugin may be used under the terms of the GNU Lesser General Public License version 2.1 or version 3 as published by the Free Software Foundation. Please review the following information to ensure the GNU Lesser General Public License requirements will be met: https://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html." ], - \"Category\" : \"Build Systems\", - \"Description\" : \"ROS Support.\", - \"Url\" : \"http://www.qt.io\", - $$dependencyList + "Category" : "Build Systems", + "Description" : "ROS Support.", + "Url" : "http://www.qt.io", + ${IDE_PLUGIN_DEPENDENCIES} } From a5e29f675b4aec8b468decbf6ce5a449a448a362 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 16:45:14 +0200 Subject: [PATCH 03/10] replace deprecated header --- src/project_manager/ros_build_configuration.cpp | 1 - src/project_manager/ros_catkin_make_step.cpp | 3 +-- src/project_manager/ros_catkin_tools_step.cpp | 3 +-- src/project_manager/ros_colcon_step.cpp | 3 +-- src/project_manager/ros_project.cpp | 5 ++--- src/project_manager/ros_run_configuration.cpp | 1 - src/project_manager/ros_run_configuration.h | 2 +- src/project_manager/ros_run_step.cpp | 2 +- src/project_manager/ros_settings_page.cpp | 2 ++ 9 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/project_manager/ros_build_configuration.cpp b/src/project_manager/ros_build_configuration.cpp index 8ab15956..4b01fb10 100644 --- a/src/project_manager/ros_build_configuration.cpp +++ b/src/project_manager/ros_build_configuration.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/src/project_manager/ros_catkin_make_step.cpp b/src/project_manager/ros_catkin_make_step.cpp index 305b7d4c..fd913694 100644 --- a/src/project_manager/ros_catkin_make_step.cpp +++ b/src/project_manager/ros_catkin_make_step.cpp @@ -26,12 +26,11 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include #include diff --git a/src/project_manager/ros_catkin_tools_step.cpp b/src/project_manager/ros_catkin_tools_step.cpp index 1eac650a..e5581720 100644 --- a/src/project_manager/ros_catkin_tools_step.cpp +++ b/src/project_manager/ros_catkin_tools_step.cpp @@ -28,12 +28,11 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include #include diff --git a/src/project_manager/ros_colcon_step.cpp b/src/project_manager/ros_colcon_step.cpp index 64e5e9e6..a2666514 100644 --- a/src/project_manager/ros_colcon_step.cpp +++ b/src/project_manager/ros_colcon_step.cpp @@ -26,12 +26,11 @@ #include #include #include -#include +#include #include #include #include #include -#include #include #include #include diff --git a/src/project_manager/ros_project.cpp b/src/project_manager/ros_project.cpp index d96b5ab2..5656a3a3 100644 --- a/src/project_manager/ros_project.cpp +++ b/src/project_manager/ros_project.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,11 +46,10 @@ #include #include #include -#include +#include #include #include #include -#include #include #include diff --git a/src/project_manager/ros_run_configuration.cpp b/src/project_manager/ros_run_configuration.cpp index cb3e771e..b0681dde 100644 --- a/src/project_manager/ros_run_configuration.cpp +++ b/src/project_manager/ros_run_configuration.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include diff --git a/src/project_manager/ros_run_configuration.h b/src/project_manager/ros_run_configuration.h index aee72afb..11c47f5a 100644 --- a/src/project_manager/ros_run_configuration.h +++ b/src/project_manager/ros_run_configuration.h @@ -25,7 +25,7 @@ #include "ros_project_constants.h" #include #include -#include +#include #include #include diff --git a/src/project_manager/ros_run_step.cpp b/src/project_manager/ros_run_step.cpp index 165ca54f..55d906e8 100644 --- a/src/project_manager/ros_run_step.cpp +++ b/src/project_manager/ros_run_step.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/project_manager/ros_settings_page.cpp b/src/project_manager/ros_settings_page.cpp index cf6c7d47..28c4c5e5 100644 --- a/src/project_manager/ros_settings_page.cpp +++ b/src/project_manager/ros_settings_page.cpp @@ -31,6 +31,8 @@ #include #include +#include + #include #include From 6ca7e199f624273fab2905ce228b1217804c8ccb Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 17:18:37 +0200 Subject: [PATCH 04/10] replace QSettings with Utils::QtcSettings --- src/project_manager/ros_settings_page.cpp | 4 ++-- src/project_manager/ros_settings_page.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/project_manager/ros_settings_page.cpp b/src/project_manager/ros_settings_page.cpp index 28c4c5e5..6801d05a 100644 --- a/src/project_manager/ros_settings_page.cpp +++ b/src/project_manager/ros_settings_page.cpp @@ -63,7 +63,7 @@ ROSSettings::ROSSettings() } } -void ROSSettings::toSettings(QSettings *s) const +void ROSSettings::toSettings(Utils::QtcSettings *s) const { s->beginGroup(QLatin1String(Constants::ROS_SETTINGS_GROUP_ID)); s->setValue(DEFAULT_DISTRIBUTION_ID, default_distribution); @@ -80,7 +80,7 @@ void ROSSettings::toSettings(QSettings *s) const s->endGroup(); } -void ROSSettings::fromSettings(QSettings *s) +void ROSSettings::fromSettings(Utils::QtcSettings *s) { s->beginGroup(QLatin1String(Constants::ROS_SETTINGS_GROUP_ID)); diff --git a/src/project_manager/ros_settings_page.h b/src/project_manager/ros_settings_page.h index 044f56a0..a22aabd2 100644 --- a/src/project_manager/ros_settings_page.h +++ b/src/project_manager/ros_settings_page.h @@ -50,8 +50,8 @@ struct ROSSettings QString custom_dist_path; - void toSettings(QSettings *) const; - void fromSettings(QSettings *); + void toSettings(Utils::QtcSettings *) const; + void fromSettings(Utils::QtcSettings *); bool equals(const ROSSettings &rhs) const; bool operator==(const ROSSettings &s) const { return equals(s); } From 298c0f826d5aa0d1b80f16b1553cc259f763d89a Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 17:19:01 +0200 Subject: [PATCH 05/10] adapt fromSettings API --- src/project_manager/ros_project_plugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/project_manager/ros_project_plugin.cpp b/src/project_manager/ros_project_plugin.cpp index 7d736110..b715ad28 100644 --- a/src/project_manager/ros_project_plugin.cpp +++ b/src/project_manager/ros_project_plugin.cpp @@ -253,9 +253,8 @@ void ROSProjectPlugin::createCppCodeStyle() // Since the ROS Cpp code style can not be added until after the CppToolsSettings instance is create // the Cpp code style must be reloaded from settings to capture if it is set ROS Cpp code style. - QSettings *s = Core::ICore::settings(); CppEditor::CppCodeStylePreferences *originalCppCodeStylePreferences = CppEditor::CppToolsSettings::instance()->cppCodeStyle(); - originalCppCodeStylePreferences->fromSettings(QLatin1String(CppEditor::Constants::CPP_SETTINGS_ID), s); + originalCppCodeStylePreferences->fromSettings(CppEditor::Constants::CPP_SETTINGS_ID); } void ROSProjectPlugin::reloadProjectBuildInfo() From 8c8a5fef7c90f0d370cce04613513a938409d08b Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 17:56:32 +0200 Subject: [PATCH 06/10] replace setCategoryIcon with setCategoryIconPath --- src/project_manager/ros_settings_page.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project_manager/ros_settings_page.cpp b/src/project_manager/ros_settings_page.cpp index 6801d05a..3f6f2d85 100644 --- a/src/project_manager/ros_settings_page.cpp +++ b/src/project_manager/ros_settings_page.cpp @@ -201,7 +201,7 @@ ROSSettingsPage::ROSSettingsPage(QSharedPointer &settings, setDisplayName(QCoreApplication::translate(Constants::ROS_SETTINGS_MAIN_PAGE_NAME_ID, "ROS Main Settings")); setCategory(Constants::ROS_SETTINGS_CATEGORY_ID); setDisplayCategory(QCoreApplication::translate(Constants::ROS_SETTINGS_CATEGORY_NAME_ID, "ROS")); - setCategoryIcon(Utils::Icon({{":rosproject/ros_icon.png", Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint)); + setCategoryIconPath(":rosproject/ros_icon.png"); } QWidget *ROSSettingsPage::widget() From 703698660210e38ab13f7c9374329d00aa047745 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 17:57:38 +0200 Subject: [PATCH 07/10] replace foreach --- src/project_manager/ros_project.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project_manager/ros_project.cpp b/src/project_manager/ros_project.cpp index 5656a3a3..0604cd13 100644 --- a/src/project_manager/ros_project.cpp +++ b/src/project_manager/ros_project.cpp @@ -101,7 +101,7 @@ static FolderNode *recursiveFindOrCreateFolderNode(FolderNode *folder, parts[0].prepend('/'); ProjectExplorer::FolderNode *parent = folder; - foreach (const QString &part, parts) { + for (const QString &part : parts) { path = path.pathAppended(part); // Find folder in subFolders FolderNode *next = folderNode(parent, path); From eab60982a70a76a01be6940b78e6e525c3d5b16e Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 18:12:31 +0200 Subject: [PATCH 08/10] replace runAsync with asyncRun --- src/project_manager/ros_project.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/project_manager/ros_project.cpp b/src/project_manager/ros_project.cpp index 0604cd13..e6060bd9 100644 --- a/src/project_manager/ros_project.cpp +++ b/src/project_manager/ros_project.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -390,7 +391,7 @@ void ROSProject::asyncUpdate() m_futureWatcher.setFuture(m_asyncUpdateFutureInterface->future()); - Utils::runAsync(ProjectExplorer::ProjectExplorerPlugin::sharedThreadPool(), QThread::LowestPriority, + Utils::asyncRun(ProjectExplorer::ProjectExplorerPlugin::sharedThreadPool(), QThread::LowestPriority, [this, bc]() { Utils::FilePath sourcePath = ROSUtils::getWorkspaceInfo(projectDirectory(), bc->rosBuildSystem(), distribution()).sourcePath; ROSProject::buildProjectTree(projectFilePath(), sourcePath, *m_asyncUpdateFutureInterface); @@ -432,7 +433,7 @@ void ROSProject::asyncUpdateCppCodeModel(bool success) // TODO: Figure out why running this async causes segfaults if (async) { - Utils::runAsync(ProjectExplorer::ProjectExplorerPlugin::sharedThreadPool(), QThread::LowestPriority, [this, workspaceInfo, k, current_environment]() { ROSProject::buildCppCodeModel(workspaceInfo, projectFilePath(), m_workspaceFiles, k, current_environment, m_wsPackageInfo, m_wsPackageBuildInfo, *m_asyncBuildCodeModelFutureInterface); }); + Utils::asyncRun(ProjectExplorer::ProjectExplorerPlugin::sharedThreadPool(), QThread::LowestPriority, [this, workspaceInfo, k, current_environment]() { ROSProject::buildCppCodeModel(workspaceInfo, projectFilePath(), m_workspaceFiles, k, current_environment, m_wsPackageInfo, m_wsPackageBuildInfo, *m_asyncBuildCodeModelFutureInterface); }); } else { From 18f36c8a507ec2b3449b3973e55cbcdbdb94e927 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 18:42:49 +0200 Subject: [PATCH 09/10] provide Target instead of generic QObject --- src/project_manager/ros_run_configuration.cpp | 6 +++--- src/project_manager/ros_run_configuration.h | 2 +- src/project_manager/ros_run_step.cpp | 8 ++++---- src/project_manager/ros_run_step.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/project_manager/ros_run_configuration.cpp b/src/project_manager/ros_run_configuration.cpp index b0681dde..c66c8b29 100644 --- a/src/project_manager/ros_run_configuration.cpp +++ b/src/project_manager/ros_run_configuration.cpp @@ -60,9 +60,9 @@ namespace Internal { const char ROS_RC_ID[] = "ROSProjectManager.ROSRunConfiguration"; -ROSRunConfiguration::ROSRunConfiguration(Target *parent, Utils::Id id) : - RunConfiguration(parent, id), - m_stepList(new RunStepList(this, Constants::ROS_RUN_STEP_LIST_ID)) +ROSRunConfiguration::ROSRunConfiguration(Target *target, Utils::Id id) : + RunConfiguration(target, id), + m_stepList(new RunStepList(target, Constants::ROS_RUN_STEP_LIST_ID)) { } diff --git a/src/project_manager/ros_run_configuration.h b/src/project_manager/ros_run_configuration.h index 11c47f5a..b506e59e 100644 --- a/src/project_manager/ros_run_configuration.h +++ b/src/project_manager/ros_run_configuration.h @@ -50,7 +50,7 @@ class ROSRunConfiguration : public ProjectExplorer::RunConfiguration friend class ROSRunConfigurationFactory; public: - ROSRunConfiguration(ProjectExplorer::Target *parent, Utils::Id id); + ROSRunConfiguration(ProjectExplorer::Target *target, Utils::Id id); // RunConfiguration QString disabledReason() const override; diff --git a/src/project_manager/ros_run_step.cpp b/src/project_manager/ros_run_step.cpp index 55d906e8..9f2126b6 100644 --- a/src/project_manager/ros_run_step.cpp +++ b/src/project_manager/ros_run_step.cpp @@ -167,7 +167,7 @@ const char STEPS_PREFIX[] = "ProjectExplorer.RunStepList.Step."; RunStep::RunStep(RunStepList *rsl, Utils::Id id) : - ProjectConfiguration(rsl, id) + ProjectConfiguration(rsl->target(), id) { // } @@ -249,10 +249,10 @@ bool RunStep::enabled() const return m_enabled; } -RunStepList::RunStepList(QObject *parent, Utils::Id id) : - ProjectConfiguration(parent, id) +RunStepList::RunStepList(ProjectExplorer::Target *target, Utils::Id id) : + ProjectConfiguration(target, id) { - Q_ASSERT(parent); + Q_ASSERT(target); setDefaultDisplayName(tr("Run")); } diff --git a/src/project_manager/ros_run_step.h b/src/project_manager/ros_run_step.h index 8f4a0f5d..1c558a95 100644 --- a/src/project_manager/ros_run_step.h +++ b/src/project_manager/ros_run_step.h @@ -143,7 +143,7 @@ class RunStepList : public ProjectExplorer::ProjectConfiguration Q_OBJECT public: - RunStepList(QObject *parent, Utils::Id id); + RunStepList(ProjectExplorer::Target *target, Utils::Id id); ~RunStepList() override; void clear(); From 5b1066a0f577efb1949a595e4a8d154bfd0ed334 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Sat, 14 Oct 2023 16:56:35 +0200 Subject: [PATCH 10/10] replace QVariantMap by Utils::Store in to/from mappings --- .../ros_build_configuration.cpp | 17 ++++---- src/project_manager/ros_build_configuration.h | 4 +- src/project_manager/ros_catkin_make_step.cpp | 25 ++++++----- src/project_manager/ros_catkin_make_step.h | 4 +- src/project_manager/ros_catkin_tools_step.cpp | 39 ++++++++--------- src/project_manager/ros_catkin_tools_step.h | 4 +- src/project_manager/ros_colcon_step.cpp | 25 ++++++----- src/project_manager/ros_colcon_step.h | 4 +- src/project_manager/ros_generic_run_step.cpp | 9 ++-- src/project_manager/ros_generic_run_step.h | 4 +- src/project_manager/ros_project.cpp | 2 +- src/project_manager/ros_project.h | 2 +- src/project_manager/ros_run_step.cpp | 43 +++++++++---------- src/project_manager/ros_run_step.h | 10 ++--- src/project_manager/ros_settings_page.cpp | 4 +- 15 files changed, 94 insertions(+), 102 deletions(-) diff --git a/src/project_manager/ros_build_configuration.cpp b/src/project_manager/ros_build_configuration.cpp index 4b01fb10..625cb60b 100644 --- a/src/project_manager/ros_build_configuration.cpp +++ b/src/project_manager/ros_build_configuration.cpp @@ -128,20 +128,19 @@ void ROSBuildConfiguration::initialize(const ProjectExplorer::BuildInfo &info) } } -QVariantMap ROSBuildConfiguration::toMap() const +void ROSBuildConfiguration::toMap(Utils::Store &map) const { - QVariantMap map(BuildConfiguration::toMap()); + BuildConfiguration::toMap(map); - map.insert(QLatin1String(ROS_BC_BUILD_SYSTEM), (int)m_buildSystem); - map.insert(QLatin1String(ROS_BC_CMAKE_BUILD_TYPE), (int)m_cmakeBuildType); - return map; + map.insert(ROS_BC_BUILD_SYSTEM, (int)m_buildSystem); + map.insert(ROS_BC_CMAKE_BUILD_TYPE, (int)m_cmakeBuildType); } -bool ROSBuildConfiguration::fromMap(const QVariantMap &map) +void ROSBuildConfiguration::fromMap(const Utils::Store &map) { - m_buildSystem = (ROSUtils::BuildSystem)map.value(QLatin1String(ROS_BC_BUILD_SYSTEM)).toInt(); - m_cmakeBuildType = (ROSUtils::BuildType)map.value(QLatin1String(ROS_BC_CMAKE_BUILD_TYPE)).toInt(); - return BuildConfiguration::fromMap(map); + m_buildSystem = (ROSUtils::BuildSystem)map.value(ROS_BC_BUILD_SYSTEM).toInt(); + m_cmakeBuildType = (ROSUtils::BuildType)map.value(ROS_BC_CMAKE_BUILD_TYPE).toInt(); + BuildConfiguration::fromMap(map); } ROSUtils::BuildSystem ROSBuildConfiguration::rosBuildSystem() const diff --git a/src/project_manager/ros_build_configuration.h b/src/project_manager/ros_build_configuration.h index 69d1eecc..8c2a95a4 100644 --- a/src/project_manager/ros_build_configuration.h +++ b/src/project_manager/ros_build_configuration.h @@ -68,7 +68,7 @@ class ROSBuildConfiguration : public ProjectExplorer::BuildConfiguration BuildType buildType() const override; - QVariantMap toMap() const override; + void toMap(Utils::Store &map) const override; ROSUtils::BuildSystem rosBuildSystem() const; void setBuildSystem(const ROSUtils::BuildSystem &buildSystem); @@ -87,7 +87,7 @@ class ROSBuildConfiguration : public ProjectExplorer::BuildConfiguration void cmakeBuildTypeChanged(const ROSUtils::BuildType &buildType); protected: - bool fromMap(const QVariantMap &map) override; + void fromMap(const Utils::Store &map) override; friend class ROSBuildSettingsWidget; diff --git a/src/project_manager/ros_catkin_make_step.cpp b/src/project_manager/ros_catkin_make_step.cpp index fd913694..04004fa6 100644 --- a/src/project_manager/ros_catkin_make_step.cpp +++ b/src/project_manager/ros_catkin_make_step.cpp @@ -140,25 +140,24 @@ void ROSCatkinMakeStep::setupOutputFormatter(Utils::OutputFormatter *formatter) AbstractProcessStep::setupOutputFormatter(formatter); } -QVariantMap ROSCatkinMakeStep::toMap() const +void ROSCatkinMakeStep::toMap(Utils::Store &map) const { - QVariantMap map(AbstractProcessStep::toMap()); + AbstractProcessStep::toMap(map); - map.insert(QLatin1String(ROS_CMS_TARGET_KEY), m_target); - map.insert(QLatin1String(ROS_CMS_CATKIN_MAKE_ARGUMENTS_KEY), m_catkinMakeArguments); - map.insert(QLatin1String(ROS_CMS_CMAKE_ARGUMENTS_KEY), m_cmakeArguments); - map.insert(QLatin1String(ROS_CMS_MAKE_ARGUMENTS_KEY), m_makeArguments); - return map; + map.insert(ROS_CMS_TARGET_KEY, m_target); + map.insert(ROS_CMS_CATKIN_MAKE_ARGUMENTS_KEY, m_catkinMakeArguments); + map.insert(ROS_CMS_CMAKE_ARGUMENTS_KEY, m_cmakeArguments); + map.insert(ROS_CMS_MAKE_ARGUMENTS_KEY, m_makeArguments); } -bool ROSCatkinMakeStep::fromMap(const QVariantMap &map) +void ROSCatkinMakeStep::fromMap(const Utils::Store &map) { - m_target = (BuildTargets)map.value(QLatin1String(ROS_CMS_TARGET_KEY)).toInt(); - m_catkinMakeArguments = map.value(QLatin1String(ROS_CMS_CATKIN_MAKE_ARGUMENTS_KEY)).toString(); - m_cmakeArguments = map.value(QLatin1String(ROS_CMS_CMAKE_ARGUMENTS_KEY)).toString(); - m_makeArguments = map.value(QLatin1String(ROS_CMS_MAKE_ARGUMENTS_KEY)).toString(); + m_target = (BuildTargets)map.value(ROS_CMS_TARGET_KEY).toInt(); + m_catkinMakeArguments = map.value(ROS_CMS_CATKIN_MAKE_ARGUMENTS_KEY).toString(); + m_cmakeArguments = map.value(ROS_CMS_CMAKE_ARGUMENTS_KEY).toString(); + m_makeArguments = map.value(ROS_CMS_MAKE_ARGUMENTS_KEY).toString(); - return BuildStep::fromMap(map); + BuildStep::fromMap(map); } QWidget *ROSCatkinMakeStep::createConfigWidget() diff --git a/src/project_manager/ros_catkin_make_step.h b/src/project_manager/ros_catkin_make_step.h index 0eb749a1..1b1fce9c 100644 --- a/src/project_manager/ros_catkin_make_step.h +++ b/src/project_manager/ros_catkin_make_step.h @@ -59,11 +59,11 @@ class ROSCatkinMakeStep : public ProjectExplorer::AbstractProcessStep QString allArguments(ROSUtils::BuildType buildType, bool includeDefault = true) const; Utils::CommandLine makeCommand(const QString &args) const; - QVariantMap toMap() const override; + void toMap(Utils::Store &map) const override; protected: QStringList automaticallyAddedArguments() const; - bool fromMap(const QVariantMap &map) override; + void fromMap(const Utils::Store &map) override; QWidget *createConfigWidget() override; private: diff --git a/src/project_manager/ros_catkin_tools_step.cpp b/src/project_manager/ros_catkin_tools_step.cpp index e5581720..9a63d128 100644 --- a/src/project_manager/ros_catkin_tools_step.cpp +++ b/src/project_manager/ros_catkin_tools_step.cpp @@ -152,34 +152,33 @@ void ROSCatkinToolsStep::setupOutputFormatter(Utils::OutputFormatter *formatter) AbstractProcessStep::setupOutputFormatter(formatter); } -QVariantMap ROSCatkinToolsStep::toMap() const +void ROSCatkinToolsStep::toMap(Utils::Store &map) const { - QVariantMap map(AbstractProcessStep::toMap()); + AbstractProcessStep::toMap(map); - map.insert(QLatin1String(ROS_CTS_TARGET_KEY), m_target); - map.insert(QLatin1String(ROS_CTS_ACTIVE_PROFILE_KEY), m_activeProfile); - map.insert(QLatin1String(ROS_CTS_CATKIN_TOOLS_ARGUMENTS_KEY), m_catkinToolsArguments); - map.insert(QLatin1String(ROS_CTS_CATKIN_MAKE_ARGUMENTS_KEY), m_catkinMakeArguments); - map.insert(QLatin1String(ROS_CTS_CMAKE_ARGUMENTS_KEY), m_cmakeArguments); - map.insert(QLatin1String(ROS_CTS_MAKE_ARGUMENTS_KEY), m_makeArguments); - map.insert(QLatin1String(ROS_CTS_CATKIN_TOOLS_WORKING_DIR_KEY), m_catkinToolsWorkingDir); - return map; + map.insert(ROS_CTS_TARGET_KEY, m_target); + map.insert(ROS_CTS_ACTIVE_PROFILE_KEY, m_activeProfile); + map.insert(ROS_CTS_CATKIN_TOOLS_ARGUMENTS_KEY, m_catkinToolsArguments); + map.insert(ROS_CTS_CATKIN_MAKE_ARGUMENTS_KEY, m_catkinMakeArguments); + map.insert(ROS_CTS_CMAKE_ARGUMENTS_KEY, m_cmakeArguments); + map.insert(ROS_CTS_MAKE_ARGUMENTS_KEY, m_makeArguments); + map.insert(ROS_CTS_CATKIN_TOOLS_WORKING_DIR_KEY, m_catkinToolsWorkingDir); } -bool ROSCatkinToolsStep::fromMap(const QVariantMap &map) +void ROSCatkinToolsStep::fromMap(const Utils::Store &map) { - m_target = (BuildTargets)map.value(QLatin1String(ROS_CTS_TARGET_KEY)).toInt(); - m_activeProfile = map.value(QLatin1String(ROS_CTS_ACTIVE_PROFILE_KEY)).toString(); - m_catkinToolsArguments = map.value(QLatin1String(ROS_CTS_CATKIN_TOOLS_ARGUMENTS_KEY)).toString(); - m_catkinMakeArguments = map.value(QLatin1String(ROS_CTS_CATKIN_MAKE_ARGUMENTS_KEY)).toString(); - m_cmakeArguments = map.value(QLatin1String(ROS_CTS_CMAKE_ARGUMENTS_KEY)).toString(); - m_makeArguments = map.value(QLatin1String(ROS_CTS_MAKE_ARGUMENTS_KEY)).toString(); - m_catkinToolsWorkingDir = map.value(QLatin1String(ROS_CTS_CATKIN_TOOLS_WORKING_DIR_KEY)).toString(); + m_target = (BuildTargets)map.value(ROS_CTS_TARGET_KEY).toInt(); + m_activeProfile = map.value(ROS_CTS_ACTIVE_PROFILE_KEY).toString(); + m_catkinToolsArguments = map.value(ROS_CTS_CATKIN_TOOLS_ARGUMENTS_KEY).toString(); + m_catkinMakeArguments = map.value(ROS_CTS_CATKIN_MAKE_ARGUMENTS_KEY).toString(); + m_cmakeArguments = map.value(ROS_CTS_CMAKE_ARGUMENTS_KEY).toString(); + m_makeArguments = map.value(ROS_CTS_MAKE_ARGUMENTS_KEY).toString(); + m_catkinToolsWorkingDir = map.value(ROS_CTS_CATKIN_TOOLS_WORKING_DIR_KEY).toString(); if (m_catkinToolsWorkingDir.isEmpty()) m_catkinToolsWorkingDir = Constants::ROS_DEFAULT_WORKING_DIR; - return BuildStep::fromMap(map); + BuildStep::fromMap(map); } QWidget *ROSCatkinToolsStep::createConfigWidget() @@ -280,7 +279,7 @@ ROSCatkinToolsStepWidget::ROSCatkinToolsStepWidget(ROSCatkinToolsStep *makeStep) m_ui->makeArgumentsLineEdit->setText(m_makeStep->m_makeArguments); m_ui->catkinToolsWorkingDirWidget->setPath(m_makeStep->m_catkinToolsWorkingDir); - m_ui->catkinToolsWorkingDirWidget->setHistoryCompleter(QLatin1String("Qt.WorkingDir.History")); + m_ui->catkinToolsWorkingDirWidget->setHistoryCompleter("Qt.WorkingDir.History"); m_ui->catkinToolsWorkingDirWidget->setExpectedKind(Utils::PathChooser::Directory); m_ui->catkinToolsWorkingDirWidget->setFilePath(makeStep->rosBuildConfiguration()->project()->projectDirectory()); diff --git a/src/project_manager/ros_catkin_tools_step.h b/src/project_manager/ros_catkin_tools_step.h index 844414fe..4ead08aa 100644 --- a/src/project_manager/ros_catkin_tools_step.h +++ b/src/project_manager/ros_catkin_tools_step.h @@ -71,11 +71,11 @@ class ROSCatkinToolsStep : public ProjectExplorer::AbstractProcessStep QString allArguments(ROSUtils::BuildType buildType, bool includeDefault = true) const; Utils::CommandLine makeCommand(const QString &args) const; - QVariantMap toMap() const override; + void toMap(Utils::Store &map) const override; protected: QStringList automaticallyAddedArguments() const; - bool fromMap(const QVariantMap &map) override; + void fromMap(const Utils::Store &map) override; QWidget *createConfigWidget() override; private: diff --git a/src/project_manager/ros_colcon_step.cpp b/src/project_manager/ros_colcon_step.cpp index a2666514..caf797ce 100644 --- a/src/project_manager/ros_colcon_step.cpp +++ b/src/project_manager/ros_colcon_step.cpp @@ -140,25 +140,24 @@ void ROSColconStep::setupOutputFormatter(Utils::OutputFormatter *formatter) AbstractProcessStep::setupOutputFormatter(formatter); } -QVariantMap ROSColconStep::toMap() const +void ROSColconStep::toMap(Utils::Store &map) const { - QVariantMap map(AbstractProcessStep::toMap()); + AbstractProcessStep::toMap(map); - map.insert(QLatin1String(ROS_COLCON_STEP), m_target); - map.insert(QLatin1String(ROS_COLCON_STEP_ARGUMENTS_KEY), m_colconArguments); - map.insert(QLatin1String(ROS_COLCON_STEP_CMAKE_ARGUMENTS_KEY), m_cmakeArguments); - map.insert(QLatin1String(ROS_COLCON_STEP_MAKE_ARGUMENTS_KEY), m_makeArguments); - return map; + map.insert(ROS_COLCON_STEP, m_target); + map.insert(ROS_COLCON_STEP_ARGUMENTS_KEY, m_colconArguments); + map.insert(ROS_COLCON_STEP_CMAKE_ARGUMENTS_KEY, m_cmakeArguments); + map.insert(ROS_COLCON_STEP_MAKE_ARGUMENTS_KEY, m_makeArguments); } -bool ROSColconStep::fromMap(const QVariantMap &map) +void ROSColconStep::fromMap(const Utils::Store &map) { - m_target = (BuildTargets)map.value(QLatin1String(ROS_COLCON_STEP)).toInt(); - m_colconArguments = map.value(QLatin1String(ROS_COLCON_STEP_ARGUMENTS_KEY)).toString(); - m_cmakeArguments = map.value(QLatin1String(ROS_COLCON_STEP_CMAKE_ARGUMENTS_KEY)).toString(); - m_makeArguments = map.value(QLatin1String(ROS_COLCON_STEP_MAKE_ARGUMENTS_KEY)).toString(); + m_target = (BuildTargets)map.value(ROS_COLCON_STEP).toInt(); + m_colconArguments = map.value(ROS_COLCON_STEP_ARGUMENTS_KEY).toString(); + m_cmakeArguments = map.value(ROS_COLCON_STEP_CMAKE_ARGUMENTS_KEY).toString(); + m_makeArguments = map.value(ROS_COLCON_STEP_MAKE_ARGUMENTS_KEY).toString(); - return BuildStep::fromMap(map); + BuildStep::fromMap(map); } QWidget *ROSColconStep::createConfigWidget() diff --git a/src/project_manager/ros_colcon_step.h b/src/project_manager/ros_colcon_step.h index 5478a81b..cc02c336 100644 --- a/src/project_manager/ros_colcon_step.h +++ b/src/project_manager/ros_colcon_step.h @@ -60,11 +60,11 @@ class ROSColconStep : public ProjectExplorer::AbstractProcessStep QString allArguments(ROSUtils::BuildType buildType, bool includeDefault = true) const; Utils::CommandLine makeCommand(const QString &args) const; - QVariantMap toMap() const override; + void toMap(Utils::Store &map) const override; protected: QStringList automaticallyAddedArguments() const; - bool fromMap(const QVariantMap &map) override; + void fromMap(const Utils::Store &map) override; QWidget *createConfigWidget() override; private: diff --git a/src/project_manager/ros_generic_run_step.cpp b/src/project_manager/ros_generic_run_step.cpp index 66161660..e56810e4 100644 --- a/src/project_manager/ros_generic_run_step.cpp +++ b/src/project_manager/ros_generic_run_step.cpp @@ -128,9 +128,9 @@ void ROSGenericRunStep::run() #endif } -QVariantMap ROSGenericRunStep::toMap() const +void ROSGenericRunStep::toMap(Utils::Store &map) const { - QVariantMap map(RunStep::toMap()); + RunStep::toMap(map); map.insert(ROS_GENERIC_COMMAND_KEY, m_command); map.insert(ROS_GENERIC_PACKAGE_KEY, m_package); @@ -139,10 +139,9 @@ QVariantMap ROSGenericRunStep::toMap() const map.insert(ROS_GENERIC_TARGET_PATH_KEY, m_targetPath); map.insert(ROS_GENERIC_ARGUMENTS_KEY, m_arguments); map.insert(ROS_GENERIC_DEBUG_CONTINUE_ON_ATTACH_KEY, m_debugContinueOnAttach); - return map; } -bool ROSGenericRunStep::fromMap(const QVariantMap &map) +void ROSGenericRunStep::fromMap(const Utils::Store &map) { m_command = map.value(ROS_GENERIC_COMMAND_KEY).toString(); m_package = map.value(ROS_GENERIC_PACKAGE_KEY).toString(); @@ -152,7 +151,7 @@ bool ROSGenericRunStep::fromMap(const QVariantMap &map) m_arguments = map.value(ROS_GENERIC_ARGUMENTS_KEY).toString(); m_debugContinueOnAttach = map.value(ROS_GENERIC_DEBUG_CONTINUE_ON_ATTACH_KEY).toBool(); - return RunStep::fromMap(map); + RunStep::fromMap(map); } ROSRunConfiguration *ROSGenericRunStep::rosRunConfiguration() const diff --git a/src/project_manager/ros_generic_run_step.h b/src/project_manager/ros_generic_run_step.h index f3911d73..6c6cfadc 100644 --- a/src/project_manager/ros_generic_run_step.h +++ b/src/project_manager/ros_generic_run_step.h @@ -45,7 +45,7 @@ class ROSGenericRunStep : public RunStep RunStepConfigWidget *createConfigWidget() override; - QVariantMap toMap() const override; + void toMap(Utils::Store &map) const override; ROSRunConfiguration *rosRunConfiguration() const; ROSRunConfiguration *targetsActiveRunConfiguration() const; @@ -67,7 +67,7 @@ class ROSGenericRunStep : public RunStep virtual void setDebugContinueOnAttach(const bool &contOnAttach); protected: - bool fromMap(const QVariantMap &map) override; + void fromMap(const Utils::Store &map) override; virtual QMap getAvailableTargets() { return QMap(); } diff --git a/src/project_manager/ros_project.cpp b/src/project_manager/ros_project.cpp index e6060bd9..f26f2cc0 100644 --- a/src/project_manager/ros_project.cpp +++ b/src/project_manager/ros_project.cpp @@ -562,7 +562,7 @@ void ROSProject::updateCppCodeModel() } -Project::RestoreResult ROSProject::fromMap(const QVariantMap &map, QString *errorMessage) +Project::RestoreResult ROSProject::fromMap(const Utils::Store &map, QString *errorMessage) { RestoreResult result = Project::fromMap(map, errorMessage); if (result != RestoreResult::Ok) diff --git a/src/project_manager/ros_project.h b/src/project_manager/ros_project.h index af72df8e..84bacd27 100644 --- a/src/project_manager/ros_project.h +++ b/src/project_manager/ros_project.h @@ -76,7 +76,7 @@ private slots: void updateCppCodeModel(); protected: - Project::RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override; + Project::RestoreResult fromMap(const Utils::Store &map, QString *errorMessage) override; private: void asyncUpdate(); diff --git a/src/project_manager/ros_run_step.cpp b/src/project_manager/ros_run_step.cpp index 9f2126b6..146990e2 100644 --- a/src/project_manager/ros_run_step.cpp +++ b/src/project_manager/ros_run_step.cpp @@ -147,16 +147,12 @@ RunStep *RunStepFactory::create(RunStepList *parent, Utils::Id id) return rs; } -RunStep *RunStepFactory::restore(RunStepList *parent, const QVariantMap &map) +RunStep *RunStepFactory::restore(RunStepList *parent, const Utils::Store &map) { RunStep *rs = m_info.creator(parent); if (!rs) return nullptr; - if (!rs->fromMap(map)) { - QTC_CHECK(false); - delete rs; - return nullptr; - } + rs->fromMap(map); return rs; } @@ -172,17 +168,16 @@ RunStep::RunStep(RunStepList *rsl, Utils::Id id) : // } -bool RunStep::fromMap(const QVariantMap &map) +void RunStep::fromMap(const Utils::Store &map) { m_enabled = map.value(runStepEnabledKey, true).toBool(); - return ProjectConfiguration::fromMap(map); + ProjectConfiguration::fromMap(map); } -QVariantMap RunStep::toMap() const +void RunStep::toMap(Utils::Store &map) const { - QVariantMap map = ProjectConfiguration::toMap(); + ProjectConfiguration::toMap(map); map.insert(runStepEnabledKey, m_enabled); - return map; } ProjectExplorer::RunConfiguration *RunStep::runConfiguration() const @@ -268,15 +263,18 @@ void RunStepList::clear() m_steps.clear(); } -QVariantMap RunStepList::toMap() const +void RunStepList::toMap(Utils::Store &map) const { - QVariantMap map(ProjectConfiguration::toMap()); + ProjectConfiguration::toMap(map); // Save run steps - map.insert(QString::fromLatin1(STEPS_COUNT_KEY), m_steps.count()); - for (int i = 0; i < m_steps.count(); ++i) - map.insert(QString::fromLatin1(STEPS_PREFIX) + QString::number(i), m_steps.at(i)->toMap()); + map.insert(STEPS_COUNT_KEY, m_steps.count()); + for (int i = 0; i < m_steps.count(); ++i) { + const Utils::Key key_step = (QString(STEPS_PREFIX) + QString::number(i)).toUtf8(); + Utils::Store map_step; + m_steps.at(i)->toMap(map_step); + map.insert(key_step, Utils::variantFromStore(map_step)); + } - return map; } int RunStepList::count() const @@ -305,18 +303,18 @@ bool RunStepList::enabled() const return false; } -bool RunStepList::fromMap(const QVariantMap &map) +void RunStepList::fromMap(const Utils::Store &map) { clear(); // We need the ID set before trying to restore the steps! - if (!ProjectConfiguration::fromMap(map)) - return false; + ProjectConfiguration::fromMap(map); const QList factories = RunStepFactory::allRunStepFactories(); - int maxSteps = map.value(QString::fromLatin1(STEPS_COUNT_KEY), 0).toInt(); + int maxSteps = map.value(STEPS_COUNT_KEY, 0).toInt(); for (int i = 0; i < maxSteps; ++i) { - QVariantMap rsData(map.value(QString::fromLatin1(STEPS_PREFIX) + QString::number(i)).toMap()); + const Utils::Key key_step = (QString(STEPS_PREFIX) + QString::number(i)).toUtf8(); + Utils::Store rsData = Utils::storeFromVariant(map.value(key_step).toMap()); if (rsData.isEmpty()) { Core::MessageManager::writeSilently(tr("[ROS Warning] No step data found for step %1 (continuing).").arg(i)); continue; @@ -337,7 +335,6 @@ bool RunStepList::fromMap(const QVariantMap &map) } QTC_ASSERT(handled, qDebug() << "No factory for run step" << stepId.toString() << "found."); } - return true; } void RunStepList::runStep_enabledChanged(RunStep *step) diff --git a/src/project_manager/ros_run_step.h b/src/project_manager/ros_run_step.h index 1c558a95..ea1bc10a 100644 --- a/src/project_manager/ros_run_step.h +++ b/src/project_manager/ros_run_step.h @@ -56,8 +56,8 @@ class RunStep : public ProjectExplorer::ProjectConfiguration virtual bool runInGuiThread() const; virtual void cancel(); - bool fromMap(const QVariantMap &map) override; - QVariantMap toMap() const override; + void fromMap(const Utils::Store &map) override; + void toMap(Utils::Store &map) const override; bool enabled() const; void setEnabled(bool b); @@ -102,7 +102,7 @@ class RunStepFactory RunStepInfo stepInfo() const; Utils::Id stepId() const; RunStep *create(RunStepList *parent, Utils::Id id); - RunStep *restore(RunStepList *parent, const QVariantMap &map); + RunStep *restore(RunStepList *parent, const Utils::Store &map); bool canHandle(RunStepList *rsl) const; @@ -182,8 +182,8 @@ class RunStepList : public ProjectExplorer::ProjectConfiguration ProjectExplorer::Target *target() const; - virtual QVariantMap toMap() const override; - bool fromMap(const QVariantMap &map) override; + virtual void toMap(Utils::Store &map) const override; + void fromMap(const Utils::Store &map) override; signals: void stepInserted(int position); diff --git a/src/project_manager/ros_settings_page.cpp b/src/project_manager/ros_settings_page.cpp index 3f6f2d85..4fc9a197 100644 --- a/src/project_manager/ros_settings_page.cpp +++ b/src/project_manager/ros_settings_page.cpp @@ -65,7 +65,7 @@ ROSSettings::ROSSettings() void ROSSettings::toSettings(Utils::QtcSettings *s) const { - s->beginGroup(QLatin1String(Constants::ROS_SETTINGS_GROUP_ID)); + s->beginGroup(Constants::ROS_SETTINGS_GROUP_ID); s->setValue(DEFAULT_DISTRIBUTION_ID, default_distribution); s->setValue(DEFAULT_BUILD_SYSTEM_ID, static_cast(default_build_system)); s->setValue(DEFAULT_CODE_STYLE_ID, default_code_style); @@ -82,7 +82,7 @@ void ROSSettings::toSettings(Utils::QtcSettings *s) const void ROSSettings::fromSettings(Utils::QtcSettings *s) { - s->beginGroup(QLatin1String(Constants::ROS_SETTINGS_GROUP_ID)); + s->beginGroup(Constants::ROS_SETTINGS_GROUP_ID); default_distribution = s->value(DEFAULT_DISTRIBUTION_ID, "").toString();