Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to Qt Creator 5.0 #433

Merged
merged 4 commits into from
Aug 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ros_qtc_plugin.pri
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/project_manager/ros_catkin_make_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions src/project_manager/ros_catkin_tools_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/project_manager/ros_colcon_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/project_manager/ros_package_wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();}

Expand Down Expand Up @@ -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();}
Expand Down Expand Up @@ -246,8 +246,8 @@ ROSPackageWizard::ROSPackageWizard()
}

Core::BaseFileWizard *ROSPackageWizard::create(QWidget *parent, const Core::WizardDialogParameters &parameters) const
{
QString defaultPath = parameters.defaultPath();
{
Utils::FilePath defaultPath = Utils::FilePath::fromString(parameters.defaultPath());

ROSProject *rosProject = qobject_cast<ROSProject *>(ProjectExplorer::ProjectTree::currentProject());

Expand All @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions src/project_manager/ros_package_wizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/project_manager/ros_project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,18 @@ 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());
ROSUtils::generateQtCreatorWorkspaceFile(workspaceXml, m_projectFileContent);
saver.setResult(&workspaceXml);
}
bool result = saver.finalize(ICore::mainWindow());
DocumentManager::unexpectFileChange(projectFilePath().toString());
DocumentManager::unexpectFileChange(projectFilePath());
return result;
}

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/project_manager/ros_run_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtoutputformatter.h>
#include <qtsupport/qtsupportconstants.h>

#include <utils/fileutils.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcprocess.h>
Expand Down