提交 58d54d80 编写于 作者: L Levi Armstrong

Initial Doxygen Comments

上级 52f09804
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the 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. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file 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 and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "ros_build_configuration.h"
#include "ros_make_step.h"
......
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the 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. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file 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 and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef ROSBUILDCONFIGURATION_H
#define ROSBUILDCONFIGURATION_H
......@@ -43,11 +13,6 @@
#include <QCheckBox>
#include <QProcess>
namespace Utils {
class FileName;
class PathChooser;
} // namespace Utils
namespace ROSProjectManager {
namespace Internal {
......@@ -64,33 +29,53 @@ class ROSBuildConfiguration : public ProjectExplorer::BuildConfiguration
public:
explicit ROSBuildConfiguration(ProjectExplorer::Target *parent);
ProjectExplorer::NamedWidget *createConfigWidget();
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets();
BuildType buildType() const;
QVariantMap toMap() const;
ProjectExplorer::NamedWidget *createConfigWidget() override;
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override;
BuildType buildType() const override;
QVariantMap toMap() const override;
/**
* @brief Set the initial build arguments for catkin_make.
* @param arguments a QString of arguments.
*/
void setInitialArguments(const QString &arguments);
/**
* @brief Get the initial build arguments for catkin_make.
* @return a QString
*/
QString initialArguments() const;
/**
* @brief Set the ros distribution for the build configuration.
* @param distribution a QString representing the ros distribution.
*/
void setROSDistribution(const QString &distribution);
/**
* @brief Get the ros distribution of the build configuration.
* @return a QString.
*/
QString rosDistribution() const;
/**
* @brief Source the workspace to setup the build configuration
* environment variables.
*/
void sourceWorkspace();
protected:
ROSBuildConfiguration(ProjectExplorer::Target *parent, ROSBuildConfiguration *source);
ROSBuildConfiguration(ProjectExplorer::Target *parent, Core::Id id);
bool fromMap(const QVariantMap &map);
bool fromMap(const QVariantMap &map) override;
friend class ROSBuildSettingsWidget;
private:
QString m_initialArguments;
QString m_rosDistribution;
ProjectExplorer::NamedWidget *m_buildEnvironmentWidget;
QString m_initialArguments; /**< Initial catkin_make arguments. */
QString m_rosDistribution; /**< ROS Distribution */
ProjectExplorer::NamedWidget *m_buildEnvironmentWidget; /**< Build configuration environment widget */
};
......@@ -102,21 +87,27 @@ public:
explicit ROSBuildConfigurationFactory(QObject *parent = 0);
~ROSBuildConfigurationFactory();
int priority(const ProjectExplorer::Target *parent) const;
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const;
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const;
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k,
const QString &projectPath) const;
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent,
const ProjectExplorer::BuildInfo *info) const;
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const;
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source);
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const;
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map);
int priority(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
ProjectExplorer::BuildConfiguration *create(ProjectExplorer::Target *parent, const ProjectExplorer::BuildInfo *info) const override;
bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) const override;
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *source) override;
bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
ProjectExplorer::BuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
private:
/**
* @brief Check whether target is supported.
* @param t a ProjectExplorer::Target
* @return True if valid, otherwise false.
*/
bool canHandle(const ProjectExplorer::Target *t) const;
/**
* @brief Represents all available catkin_make build types.
*/
enum BuildType { BuildTypeNone = 0,
BuildTypeDebug = 1,
BuildTypeRelease = 2,
......@@ -124,9 +115,20 @@ private:
BuildTypeMinSizeRel = 4,
BuildTypeLast = 5 };
/**
* @brief Creates a ROSBuildInfo
* @param k a ProjectExplorer::Kit
* @param projectPath a path to the project.
* @param type BuildType
* @return a ROSBuildInfo
*/
ROSBuildInfo *createBuildInfo(const ProjectExplorer::Kit *k, const QString &projectPath, BuildType type) const;
};
/**
* @brief The ROS settings widget. This provides a UI for changing ROS
* build setting.
*/
class ROSBuildSettingsWidget : public ProjectExplorer::NamedWidget
{
Q_OBJECT
......@@ -136,16 +138,29 @@ public:
~ROSBuildSettingsWidget();
private slots:
/**
* @brief A slot that is called anytime the source button is clicked.
*
* It will source the workspace and setup environment variables.
*/
void on_source_pushButton_clicked();
/**
* @brief A slot that is called anytime the ros distribution is changed.
* @param arg1 a QString representing the ros distribution.
*/
void on_ros_distribution_comboBox_currentIndexChanged(const QString &arg1);
private:
Ui::ROSBuildConfiguration *m_ui;
ROSBuildConfiguration *m_buildConfiguration;
QMap<QString, QString> m_rosDistributions;
Ui::ROSBuildConfiguration *m_ui; /**< ROS Build configuration UI object. */
ROSBuildConfiguration *m_buildConfiguration; /**< Pointer to the ROSBuildConfiguration. */
QMap<QString, QString> m_rosDistributions; /**< Map of available ros distributions. */
};
/**
* @brief The ROS build environment widget. This provides a UI for changing
* environment variables unique to the project.
*/
class ROSBuildEnvironmentWidget : public ProjectExplorer::NamedWidget
{
Q_OBJECT
......@@ -154,16 +169,37 @@ public:
ROSBuildEnvironmentWidget(ProjectExplorer::BuildConfiguration *bc);
private slots:
/**
* @brief A slot that is called anytime a environment variable is changed
* and passes the changes to the ROSBuildConfiguration.
*/
void environmentModelUserChangesChanged();
/**
* @brief A slot that is called anytime the clear system environment is
* checked.
*
* It will set the ROSBuildConfiguration environment back to the base
* environment.
* @param checked a bool.
*/
void clearSystemEnvironmentCheckBoxClicked(bool checked);
/** @brief A slot that is called anytime a environment variable is changed within
* the ROSBuildConfiguration and updates the change with the Widget.
*/
void environmentChanged();
protected:
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
QCheckBox *m_clearSystemEnvironmentCheckBox;
ProjectExplorer::BuildConfiguration *m_buildConfiguration;
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget; /**< The environment widget. */
QCheckBox *m_clearSystemEnvironmentCheckBox; /**< The clear system evironment checkbox object. */
ProjectExplorer::BuildConfiguration *m_buildConfiguration; /** The build configuration associated to this widget. */
};
/**
* @brief This class represents all information required for building
* a ROS project.
*/
class ROSBuildInfo : public ProjectExplorer::BuildInfo
{
public:
......@@ -180,8 +216,8 @@ public:
arguments = bc->initialArguments();
}
Utils::Environment environment;
QString arguments;
Utils::Environment environment; /**< ROS build environment. */
QString arguments; /**< ROS catkin_make arguments. */
};
} // namespace Internal
......
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the 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. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file 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 and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "ros_make_step.h"
#include "ros_project_constants.h"
#include "ros_project.h"
......@@ -282,7 +252,7 @@ ROSMakeStepConfigWidget::~ROSMakeStepConfigWidget()
QString ROSMakeStepConfigWidget::displayName() const
{
return tr("Make", "GenericMakestep display name.");
return tr("Make", "ROS Make display name.");
}
void ROSMakeStepConfigWidget::updateMakeOverrrideLabel()
......
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the 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. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file 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 and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. 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.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef ROSMAKESTEP_H
#define ROSMAKESTEP_H
......@@ -56,36 +26,79 @@ public:
ROSMakeStep(ProjectExplorer::BuildStepList *parent);
~ROSMakeStep();
bool init(QList<const BuildStep *> &earlierSteps);
void run(QFutureInterface<bool> &fi);
ROSBuildConfiguration *rosBuildConfiguration() const;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
bool immutable() const;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
QVariantMap toMap() const override;
/**
* @brief Check if target is an active build target.
* @param target a QString name of target to check.
* @return True if an active build target, otherwise returns false.
*/
bool buildsTarget(const QString &target) const;
/**
* @brief Set a build target active status.
* @param target a QString name of target.
* @param on a bool representing the status of the build target.
*/
void setBuildTarget(const QString &target, bool on);
/**
* @brief Get all catkin_make arguments.
* @param initial_arguments a QString of initial arguments to be prepended.
* @return a QString of all arguments.
*/
QString allArguments(QString initial_arguments) const;
/**
* @brief Get the make command for the ROS project.
* @return a QString.
*/
QString makeCommand() const;
/**
* @brief Set the make status to clean.
* @param clean a bool representing the clean status.
*/
void setClean(bool clean);
/**
* @brief Check if make status is clean.
* @return a bool.
*/
bool isClean() const;
QVariantMap toMap() const;
/**
* @brief Get the ROS build configuration.
* @return a ROSBuildConfiguration.
*/
ROSBuildConfiguration *rosBuildConfiguration() const;
protected:
ROSMakeStep(ProjectExplorer::BuildStepList *parent, ROSMakeStep *bs);
ROSMakeStep(ProjectExplorer::BuildStepList *parent, Core::Id id);
QStringList automaticallyAddedArguments() const;
bool fromMap(const QVariantMap &map);
bool fromMap(const QVariantMap &map) override;
private:
/**
* @brief Constructor routine.
*/
void ctor();
/**
* @brief Get active build configuration.
* @return a ROSBuildConfiguration
*/
ROSBuildConfiguration *targetsActiveBuildConfiguration() const;
QStringList m_buildTargets;
QString m_makeArguments;
QString m_makeCommand;
bool m_clean;
QStringList m_buildTargets; /**< A QStringList of active build configurations. */
QString m_makeArguments; /**< A QString of catkin_make arguments. */
QString m_makeCommand; /**< A QString of ROS make command catkin_make. */
bool m_clean; /**< A bool representing the clean status of the make. */
};
class ROSMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
......@@ -95,20 +108,41 @@ class ROSMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
public:
ROSMakeStepConfigWidget(ROSMakeStep *makeStep);
~ROSMakeStepConfigWidget();
QString displayName() const;
QString summaryText() const;
QString displayName() const override;
QString summaryText() const override;
private slots:
/**
* @brief A slot that is called anytime a target option are change.
* @param item a QListWidgetItem that was changed.
*/
void itemChanged(QListWidgetItem *item);
/**
* @brief A slot that is called anytime the make command are edited.
*/
void makeLineEditTextEdited();
/**
* @brief A slot that is called anytime the make arguments are edited.
*/
void makeArgumentsLineEditTextEdited();
/**
* @brief A slot that is called to update the override label.
*/
void updateMakeOverrrideLabel();
/**
* @brief A slot that is called anytime any component of the make
* configuration widget is chaned to update all necessary information.
*/
void updateDetails();
private:
Ui::ROSMakeStep *m_ui;
ROSMakeStep *m_makeStep;
QString m_summaryText;
Ui::ROSMakeStep *m_ui; /**< A UI of the ros make step */
ROSMakeStep *m_makeStep; /**< The ROSMakeStep object */
QString m_summaryText; /**< The summary text showing the actual command that is executed. */
};
class ROSMakeStepFactory : public ProjectExplorer::IBuildStepFactory
......@@ -118,18 +152,15 @@ class ROSMakeStepFactory : public ProjectExplorer::IBuildStepFactory
public:
explicit ROSMakeStepFactory(QObject *parent = 0);
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id);
bool canClone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *source) const;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
ProjectExplorer::BuildStep *source);
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
const QVariantMap &map);
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *bc) const;
QString displayNameForId(Core::Id id) const;
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *bc) const override;
QString displayNameForId(Core::Id id) const override;
bool canCreate(ProjectExplorer::BuildStepList *parent, Core::Id id) const override;
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, Core::Id id) override;
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) const override;
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *source) override;
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const override;
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) override;
};
} // namespace Internal
......
......@@ -82,7 +82,7 @@ ROSPackageWizardDialog::ROSPackageWizardDialog(const Core::BaseFileWizardFactory
addPage(m_detailsPage);
}
void ROSPackageWizardDialog::setPath(const QString &path) {m_detailsPage->setPath(path);}
void ROSPackageWizardDialog::setPackagePath(const QString &path) {m_detailsPage->setPackagePath(path);}
QString ROSPackageWizardDialog::packageName() const {return m_detailsPage->packageName();}
......@@ -138,20 +138,11 @@ ROSPackageWizardDetailsPage::ROSPackageWizardDetailsPage(QWidget *parent) :
this, &ROSPackageWizardDetailsPage::slotPackagePathValidChanged);
connect(d->m_ui.packageNameLineEdit, &Utils::FancyLineEdit::validChanged,
this, &ROSPackageWizardDetailsPage::slotPackageNameValidChanged);
connect(d->m_ui.pathChooser, &Utils::PathChooser::pathChanged,
this, &ROSPackageWizardDetailsPage::slotPackagePathChanged);
connect(d->m_ui.pathChooser, &Utils::PathChooser::returnPressed,
this, &ROSPackageWizardDetailsPage::slotActivated);
connect(d->m_ui.packageNameLineEdit, &Utils::FancyLineEdit::validReturnPressed,
this, &ROSPackageWizardDetailsPage::slotActivated);
}
ROSPackageWizardDetailsPage::~ROSPackageWizardDetailsPage() {delete d;}
void ROSPackageWizardDetailsPage::setPath(const QString &path) {d->m_ui.pathChooser->setPath(path);}
void ROSPackageWizardDetailsPage::setPackagePath(const QString &path) {d->m_ui.pathChooser->setPath(path);}
QString ROSPackageWizardDetailsPage::packageName() const {return d->m_ui.packageNameLineEdit->text();}
......@@ -179,18 +170,6 @@ void ROSPackageWizardDetailsPage::slotPackageNameValidChanged() {validChangedHel
void ROSPackageWizardDetailsPage::slotPackagePathValidChanged() {validChangedHelper();}
void ROSPackageWizardDetailsPage::slotPackagePathChanged(const QString &path)
{
Q_UNUSED(path)
if (!d->m_ui.pathChooser->isValid())
{
d->m_ui.pathChooser->setPath(QLatin1String(""));
}
validChangedHelper();
}
void ROSPackageWizardDetailsPage::validChangedHelper()
{
const bool newComplete = d->m_ui.pathChooser->isValid() && d->m_ui.packageNameLineEdit->isValid();
......@@ -198,12 +177,9 @@ void ROSPackageWizardDetailsPage::validChangedHelper()
d->m_complete = newComplete;
emit completeChanged();
}
}
void ROSPackageWizardDetailsPage::slotActivated()
{
if (d->m_complete)
emit activated();
if (!d->m_ui.pathChooser->isValid())
d->m_ui.pathChooser->setPath(QLatin1String(""));
}
QStringList ROSPackageWizardDetailsPage::processList(const QString &text) const
......@@ -239,7 +215,7 @@ Core::BaseFileWizard *ROSPackageWizard::create(QWidget *parent,
{
Q_UNUSED(parameters)
m_wizard = new ROSPackageWizardDialog(this, parent);
m_wizard->setPath(parameters.defaultPath());
m_wizard->setPackagePath(parameters.defaultPath());
foreach (QWizardPage *p, m_wizard->extensionPages())
m_wizard->addPage(p);
......
......@@ -8,10 +8,6 @@
#include <utils/fileutils.h>
#include <QProcess>
namespace Utils {
class FileName;
} // namespace Utils
namespace ROSProjectManager {
namespace Internal {
......@@ -27,21 +23,74 @@ class ROSPackageWizardDialog : public Core::BaseFileWizard
public:
explicit ROSPackageWizardDialog(const Core::BaseFileWizardFactory *factory, QWidget *parent = 0);
void setPath(const QString &path);
/**
* @brief Set the default path for the wizard path chooser.
* @param path a QString representing the default path.
*/
void setPackagePath(const QString &path);
/**
* @brief Gets the package name from the wizard.
* @return a QString.
*/
QString packageName() const;
/**
* @brief Get the path to where the package will be created from the wizard.
* @return a QString.
*/