From dfb476a08a3edc767d1ee6479c0ec6dddf2fd219 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Mon, 16 Aug 2021 12:09:17 +0100 Subject: [PATCH 1/4] replace args by list of strings --- src/project_manager/ros_catkin_make_step.cpp | 20 +++++++------- src/project_manager/ros_catkin_tools_step.cpp | 26 +++++++++---------- src/project_manager/ros_colcon_step.cpp | 18 ++++++------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/project_manager/ros_catkin_make_step.cpp b/src/project_manager/ros_catkin_make_step.cpp index ab5462a1..810c1ada 100644 --- a/src/project_manager/ros_catkin_make_step.cpp +++ b/src/project_manager/ros_catkin_make_step.cpp @@ -160,34 +160,34 @@ bool ROSCatkinMakeStep::fromMap(const QVariantMap &map) QString ROSCatkinMakeStep::allArguments(ROSUtils::BuildType buildType, bool includeDefault) const { - QString args; + QStringList args; switch(m_target) { case BUILD: - Utils::QtcProcess::addArgs(&args, m_catkinMakeArguments); + args << m_catkinMakeArguments; if (includeDefault) if (buildType == ROSUtils::BuildTypeUserDefined) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1").arg(m_cmakeArguments)); + args << QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1").arg(m_cmakeArguments); else - Utils::QtcProcess::addArgs(&args, QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1 %2").arg(ROSUtils::getCMakeBuildTypeArgument(buildType), m_cmakeArguments)); + args << QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1 %2").arg(ROSUtils::getCMakeBuildTypeArgument(buildType), m_cmakeArguments); else if (!m_cmakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args %1").arg(m_cmakeArguments)); + args << QString("--cmake-args %1").arg(m_cmakeArguments); break; case CLEAN: - Utils::QtcProcess::addArgs(&args, QLatin1String("clean")); - Utils::QtcProcess::addArgs(&args, m_catkinMakeArguments); + args << QLatin1String("clean"); + args << m_catkinMakeArguments; if (!m_cmakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args %1").arg(m_cmakeArguments)); + args << QString("--cmake-args %1").arg(m_cmakeArguments); break; } if (!m_makeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--make-args %1").arg(m_makeArguments)); + args << QString("--make-args %1").arg(m_makeArguments); - return args; + return args.join(" "); } Utils::CommandLine ROSCatkinMakeStep::makeCommand(const QString &args) const diff --git a/src/project_manager/ros_catkin_tools_step.cpp b/src/project_manager/ros_catkin_tools_step.cpp index 5a868a7c..d58e7e16 100644 --- a/src/project_manager/ros_catkin_tools_step.cpp +++ b/src/project_manager/ros_catkin_tools_step.cpp @@ -182,40 +182,40 @@ bool ROSCatkinToolsStep::fromMap(const QVariantMap &map) QString ROSCatkinToolsStep::allArguments(ROSUtils::BuildType buildType, bool includeDefault) const { - QString args; + QStringList args; switch(m_target) { case BUILD: - Utils::QtcProcess::addArgs(&args, QLatin1String("build")); - Utils::QtcProcess::addArgs(&args, m_catkinToolsArguments); + args << QLatin1String("build"); + args << m_catkinToolsArguments; if (!m_catkinMakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--catkin-make-args %1").arg(m_catkinMakeArguments)); + args << QString("--catkin-make-args %1").arg(m_catkinMakeArguments); if (includeDefault) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1 %2").arg(ROSUtils::getCMakeBuildTypeArgument(buildType), m_cmakeArguments)); + args << QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1 %2").arg(ROSUtils::getCMakeBuildTypeArgument(buildType), m_cmakeArguments); else if (!m_cmakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args %1").arg(m_cmakeArguments)); + args << QString("--cmake-args %1").arg(m_cmakeArguments); break; case CLEAN: - Utils::QtcProcess::addArgs(&args, QLatin1String("clean")); - Utils::QtcProcess::addArgs(&args, QLatin1String("-y")); - Utils::QtcProcess::addArgs(&args, m_catkinToolsArguments); + args << QLatin1String("clean"); + args << QLatin1String("-y"); + args << m_catkinToolsArguments; if (!m_catkinMakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--catkin-make-args %1").arg(m_catkinMakeArguments)); + args << QString("--catkin-make-args %1").arg(m_catkinMakeArguments); if (!m_cmakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args %1").arg(m_cmakeArguments)); + args << QString("--cmake-args %1").arg(m_cmakeArguments); break; } if (!m_makeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--make-args %1").arg(m_makeArguments)); + args << QString("--make-args %1").arg(m_makeArguments); - return args; + return args.join(" "); } Utils::CommandLine ROSCatkinToolsStep::makeCommand(const QString &args) const diff --git a/src/project_manager/ros_colcon_step.cpp b/src/project_manager/ros_colcon_step.cpp index 95180107..59f5a00e 100644 --- a/src/project_manager/ros_colcon_step.cpp +++ b/src/project_manager/ros_colcon_step.cpp @@ -160,32 +160,32 @@ bool ROSColconStep::fromMap(const QVariantMap &map) QString ROSColconStep::allArguments(ROSUtils::BuildType buildType, bool includeDefault) const { - QString args; + QStringList args; switch(m_target) { case BUILD: - Utils::QtcProcess::addArgs(&args, QLatin1String("build")); - Utils::QtcProcess::addArgs(&args, m_colconArguments); + args << QLatin1String("build"); + args << m_colconArguments; if (includeDefault) if (buildType == ROSUtils::BuildTypeUserDefined) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1").arg(m_cmakeArguments)); + args << QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1").arg(m_cmakeArguments); else - Utils::QtcProcess::addArgs(&args, QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1 %2").arg(ROSUtils::getCMakeBuildTypeArgument(buildType), m_cmakeArguments)); + args << QString("--cmake-args -G \"CodeBlocks - Unix Makefiles\" %1 %2").arg(ROSUtils::getCMakeBuildTypeArgument(buildType), m_cmakeArguments); else if (!m_cmakeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--cmake-args %1").arg(m_cmakeArguments)); + args << QString("--cmake-args %1").arg(m_cmakeArguments); break; case CLEAN: - Utils::QtcProcess::addArgs(&args, QLatin1String("-r build/ install/ log/")); + args << QLatin1String("-r build/ install/ log/"); break; } if (!m_makeArguments.isEmpty()) - Utils::QtcProcess::addArgs(&args, QString("--make-args %1").arg(m_makeArguments)); + args << QString("--make-args %1").arg(m_makeArguments); - return args; + return args.join(" "); } Utils::CommandLine ROSColconStep::makeCommand(const QString &args) const From 48d0f31bf6140a459ef429baa9e1c2ba6057754b Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Mon, 16 Aug 2021 12:27:06 +0100 Subject: [PATCH 2/4] replace QString paths with Utils::FilePath --- src/project_manager/ros_package_wizard.cpp | 20 ++++++++++---------- src/project_manager/ros_package_wizard.h | 8 ++++---- src/project_manager/ros_project.cpp | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/project_manager/ros_package_wizard.cpp b/src/project_manager/ros_package_wizard.cpp index 046f36aa..8ee4a4f6 100644 --- a/src/project_manager/ros_package_wizard.cpp +++ b/src/project_manager/ros_package_wizard.cpp @@ -75,9 +75,9 @@ ROSPackageWizardDialog::ROSPackageWizardDialog(const Core::BaseFileWizardFactory addPage(m_detailsPage); } -void ROSPackageWizardDialog::setPath(const QString &path) {m_detailsPage->setPath(path);} +void ROSPackageWizardDialog::setPath(const Utils::FilePath &path) {m_detailsPage->setPath(path);} -void ROSPackageWizardDialog::setProjectDirectory(const QString &path) {m_detailsPage->setProjectDirectory(path);} +void ROSPackageWizardDialog::setProjectDirectory(const Utils::FilePath &path) {m_detailsPage->setProjectDirectory(path);} QString ROSPackageWizardDialog::packageName() const {return m_detailsPage->packageName();} @@ -146,12 +146,12 @@ ROSPackageWizardDetailsPage::ROSPackageWizardDetailsPage(QWidget *parent) : ROSPackageWizardDetailsPage::~ROSPackageWizardDetailsPage() {delete d;} -void ROSPackageWizardDetailsPage::setPath(const QString &path) {d->m_ui.pathChooser->setPath(path);} +void ROSPackageWizardDetailsPage::setPath(const Utils::FilePath &path) {d->m_ui.pathChooser->setPath(path.toString());} -void ROSPackageWizardDetailsPage::setProjectDirectory(const QString &path) +void ROSPackageWizardDetailsPage::setProjectDirectory(const Utils::FilePath &path) { d->m_ui.pathChooser->setInitialBrowsePathBackup(path); - d->m_ui.pathChooser->lineEdit()->setPlaceholderText(path); + d->m_ui.pathChooser->lineEdit()->setPlaceholderText(path.toString()); } QString ROSPackageWizardDetailsPage::packageName() const {return d->m_ui.packageNameLineEdit->text();} @@ -246,8 +246,8 @@ ROSPackageWizard::ROSPackageWizard() } Core::BaseFileWizard *ROSPackageWizard::create(QWidget *parent, const Core::WizardDialogParameters ¶meters) const -{ - QString defaultPath = parameters.defaultPath(); +{ + Utils::FilePath defaultPath = Utils::FilePath::fromString(parameters.defaultPath()); ROSProject *rosProject = qobject_cast(ProjectExplorer::ProjectTree::currentProject()); @@ -262,13 +262,13 @@ Core::BaseFileWizard *ROSPackageWizard::create(QWidget *parent, const Core::Wiza bc->rosBuildSystem(), bc->project()->distribution()); - if( defaultPath == workspaceInfo.path.toString() ) - defaultPath = workspaceInfo.sourcePath.toString(); + if( defaultPath == workspaceInfo.path ) + defaultPath = workspaceInfo.sourcePath; } m_wizard = new ROSPackageWizardDialog(this, parent); - m_wizard->setProjectDirectory(rosProject->projectDirectory().toString() + QDir::separator()); + m_wizard->setProjectDirectory(rosProject->projectDirectory()); m_wizard->setPath(defaultPath); for (QWizardPage *p : m_wizard->extensionPages()) diff --git a/src/project_manager/ros_package_wizard.h b/src/project_manager/ros_package_wizard.h index 9da1252d..b315e531 100644 --- a/src/project_manager/ros_package_wizard.h +++ b/src/project_manager/ros_package_wizard.h @@ -45,8 +45,8 @@ class ROSPackageWizardDialog : public Core::BaseFileWizard public: explicit ROSPackageWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0); - void setPath(const QString &path); - void setProjectDirectory(const QString &path); + void setPath(const Utils::FilePath &path); + void setProjectDirectory(const Utils::FilePath &path); QString packageName() const; QString packagePath() const; @@ -73,8 +73,8 @@ class ROSPackageWizardDetailsPage : public Utils::WizardPage bool isComplete() const override; - void setPath(const QString &path); - void setProjectDirectory(const QString &path); + void setPath(const Utils::FilePath &path); + void setProjectDirectory(const Utils::FilePath &path); QString packageName() const; QString packagePath() const; diff --git a/src/project_manager/ros_project.cpp b/src/project_manager/ros_project.cpp index 9721105c..8ed2d743 100644 --- a/src/project_manager/ros_project.cpp +++ b/src/project_manager/ros_project.cpp @@ -180,10 +180,10 @@ ROSProject::~ROSProject() bool ROSProject::saveProjectFile() { - DocumentManager::expectFileChange(projectFilePath().toString()); + DocumentManager::expectFileChange(projectFilePath()); // Make sure we can open the file for writing - Utils::FileSaver saver(projectFilePath().toString(), QIODevice::Text); + Utils::FileSaver saver(projectFilePath(), QIODevice::Text); if (!saver.hasError()) { QXmlStreamWriter workspaceXml(saver.file()); @@ -191,7 +191,7 @@ bool ROSProject::saveProjectFile() saver.setResult(&workspaceXml); } bool result = saver.finalize(ICore::mainWindow()); - DocumentManager::unexpectFileChange(projectFilePath().toString()); + DocumentManager::unexpectFileChange(projectFilePath()); return result; } From 7fda4e311b98e68efe21dd4858af6558fba83200 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Mon, 16 Aug 2021 12:59:17 +0100 Subject: [PATCH 3/4] remove trailing spaces --- src/project_manager/ros_project.cpp | 2 +- src/project_manager/ros_run_configuration.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/project_manager/ros_project.cpp b/src/project_manager/ros_project.cpp index 8ed2d743..5bd0ad58 100644 --- a/src/project_manager/ros_project.cpp +++ b/src/project_manager/ros_project.cpp @@ -358,7 +358,7 @@ void ROSProject::fileSystemChanged(const QString &path) // This is to check if untracked dirs or files were added. If so do not start timer. if (files_added.empty() && dirs_added.empty() && files_removed.empty() && dirs_removed.empty()) - return; + return; m_asyncUpdateTimer.setInterval(UPDATE_INTERVAL); m_asyncUpdateTimer.start(); diff --git a/src/project_manager/ros_run_configuration.cpp b/src/project_manager/ros_run_configuration.cpp index 584d3cb1..9cde0d24 100644 --- a/src/project_manager/ros_run_configuration.cpp +++ b/src/project_manager/ros_run_configuration.cpp @@ -39,7 +39,7 @@ #include #include #include - + #include #include #include From 7c64ea5444821f90c048af91280ef91a1059f8ce Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Mon, 16 Aug 2021 19:03:24 +0100 Subject: [PATCH 4/4] fix typo --- ros_qtc_plugin.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ros_qtc_plugin.pri b/ros_qtc_plugin.pri index f60991fe..9ee88cdc 100644 --- a/ros_qtc_plugin.pri +++ b/ros_qtc_plugin.pri @@ -1,5 +1,5 @@ ## set the QTC_SOURCE environment variable to override the setting here -## Following variables are exporeted in setup.sh. +## Following variables are exported in setup.sh. ## If running qmake manually, please export QTC_SOURCE, QTC_BUILD ## else QTCREATOR_SOURCES will default to $$PWD/../qt-creator and ## IDE_BUILD_TREE will default $$PWD/../qt-creator-build