ProjectExplorer: Factor out some common code in runconfigurations

DesktopQmake, CMake, Qbs, Nim, RemoteLinux and Qnx now have a common
understanding what should be in a runnable and how their
configuration widget should be set up. So move them over to
using shared code, too.

Several others runconfigs only lack a one or two more aspects
to follow suit in later patches.

Change-Id: Ia862c95c97d63bd0a0f2dc303435775a2fc530d3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-04-20 13:40:15 +02:00
parent 6278212346
commit d269e9a492
16 changed files with 56 additions and 256 deletions

View File

@@ -29,8 +29,6 @@
#include "qbsprojectmanagerconstants.h"
#include "qbsproject.h"
#include <coreplugin/variablechooser.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/localenvironmentaspect.h>
#include <projectexplorer/project.h>
@@ -39,9 +37,7 @@
#include <qtsupport/qtoutputformatter.h>
#include <QCheckBox>
#include <QFileInfo>
#include <QFormLayout>
using namespace ProjectExplorer;
using namespace Utils;
@@ -51,27 +47,6 @@ namespace Internal {
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
// --------------------------------------------------------------------
// QbsRunConfigurationWidget:
// --------------------------------------------------------------------
class QbsRunConfigurationWidget : public QWidget
{
public:
explicit QbsRunConfigurationWidget(RunConfiguration *rc)
{
auto toplayout = new QFormLayout(this);
rc->extraAspect<ExecutableAspect>()->addToMainConfigurationWidget(this, toplayout);
rc->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, toplayout);
rc->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, toplayout);
rc->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, toplayout);
rc->extraAspect<UseLibraryPathsAspect>()->addToMainConfigurationWidget(this, toplayout);
Core::VariableChooser::addSupportForChildWidgets(this, rc->macroExpander());
}
};
// --------------------------------------------------------------------
// QbsRunConfiguration:
// --------------------------------------------------------------------
@@ -134,22 +109,6 @@ void QbsRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &
updateTargetInformation();
}
QWidget *QbsRunConfiguration::createConfigurationWidget()
{
return wrapWidget(new QbsRunConfigurationWidget(this));
}
Runnable QbsRunConfiguration::runnable() const
{
StandardRunnable r;
r.executable = extraAspect<ExecutableAspect>()->executable().toString();
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
r.runMode = extraAspect<TerminalAspect>()->runMode();
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
return r;
}
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
{
bool usingLibraryPaths = extraAspect<UseLibraryPathsAspect>()->value();

View File

@@ -27,12 +27,9 @@
#include <projectexplorer/runnables.h>
#include <QCheckBox>
#include <QHash>
#include <QLabel>
#include <QPair>
#include <QStringList>
#include <QWidget>
namespace QbsProjectManager {
namespace Internal {
@@ -41,15 +38,9 @@ class QbsRunConfiguration : public ProjectExplorer::RunConfiguration
{
Q_OBJECT
// to change the display name and arguments and set the userenvironmentchanges
friend class QbsRunConfigurationWidget;
public:
explicit QbsRunConfiguration(ProjectExplorer::Target *target);
QWidget *createConfigurationWidget() final;
ProjectExplorer::Runnable runnable() const final;
void addToBaseEnvironment(Utils::Environment &env) const;
private: