forked from qt-creator/qt-creator
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:
@@ -35,10 +35,6 @@
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
@@ -47,21 +43,6 @@ namespace Internal {
|
||||
const char CMAKE_RC_PREFIX[] = "CMakeProjectManager.CMakeRunConfiguration.";
|
||||
const char TITLE_KEY[] = "CMakeProjectManager.CMakeRunConfiguation.Title";
|
||||
|
||||
// Configuration widget
|
||||
class CMakeRunConfigurationWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
CMakeRunConfigurationWidget(RunConfiguration *rc)
|
||||
{
|
||||
auto fl = new QFormLayout(this);
|
||||
|
||||
rc->extraAspect<ExecutableAspect>()->addToMainConfigurationWidget(this, fl);
|
||||
rc->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, fl);
|
||||
rc->extraAspect<WorkingDirectoryAspect>()->addToMainConfigurationWidget(this, fl);
|
||||
rc->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, fl);
|
||||
}
|
||||
};
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
||||
: RunConfiguration(target, CMAKE_RC_PREFIX)
|
||||
{
|
||||
@@ -88,17 +69,6 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
}
|
||||
|
||||
Runnable CMakeRunConfiguration::runnable() const
|
||||
{
|
||||
StandardRunnable r;
|
||||
r.executable = extraAspect<ExecutableAspect>()->executable().toString();
|
||||
r.commandLineArguments = extraAspect<ArgumentsAspect>()->arguments();
|
||||
r.workingDirectory = extraAspect<WorkingDirectoryAspect>()->workingDirectory().toString();
|
||||
r.environment = extraAspect<LocalEnvironmentAspect>()->environment();
|
||||
r.runMode = extraAspect<TerminalAspect>()->runMode();
|
||||
return r;
|
||||
}
|
||||
|
||||
QVariantMap CMakeRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map(RunConfiguration::toMap());
|
||||
@@ -134,11 +104,6 @@ void CMakeRunConfiguration::updateEnabledState()
|
||||
RunConfiguration::updateEnabledState();
|
||||
}
|
||||
|
||||
QWidget *CMakeRunConfiguration::createConfigurationWidget()
|
||||
{
|
||||
return wrapWidget(new CMakeRunConfigurationWidget(this));
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::disabledReason() const
|
||||
{
|
||||
if (!isBuildTargetValid())
|
||||
|
||||
Reference in New Issue
Block a user