diff options
author | hjk <hjk@theqtcompany.com> | 2016-01-07 09:02:46 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2016-01-12 12:32:49 +0000 |
commit | de0b070621072a22669d7bb8b6785c543a6d895f (patch) | |
tree | 0c3bbdad45fd4fd7de8da895d53cce61b435a1b0 /src/plugins/qtsupport | |
parent | 99b98f2834327779f97f8083f3c9ff9a51c2d1da (diff) | |
download | qt-creator-de0b070621072a22669d7bb8b6785c543a6d895f.tar.gz |
QmakeProjectManager: Code cosmetics
Qt 5 connects, remove no-op function, add a few 'overload', use a few 'auto',
put common code with ugly cast in function, ...
Change-Id: I242aea07356bf535ba9ae11235de4a2a2c1f1d04
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Diffstat (limited to 'src/plugins/qtsupport')
-rw-r--r-- | src/plugins/qtsupport/customexecutableconfigurationwidget.cpp | 67 | ||||
-rw-r--r-- | src/plugins/qtsupport/customexecutableconfigurationwidget.h | 20 |
2 files changed, 41 insertions, 46 deletions
diff --git a/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp b/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp index 7dc6d3f0aa..db471e4abf 100644 --- a/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp +++ b/src/plugins/qtsupport/customexecutableconfigurationwidget.cpp @@ -33,10 +33,9 @@ #include <coreplugin/variablechooser.h> #include <projectexplorer/environmentaspect.h> -#include <projectexplorer/runconfigurationaspects.h> -#include <projectexplorer/target.h> #include <projectexplorer/project.h> #include <projectexplorer/runconfigurationaspects.h> +#include <projectexplorer/target.h> #include <utils/detailswidget.h> #include <utils/pathchooser.h> @@ -48,26 +47,24 @@ #include <QLineEdit> using namespace ProjectExplorer; +using namespace Utils; namespace QtSupport { namespace Internal { CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc, ApplyMode mode) - : m_ignoreChange(false), - m_runConfiguration(rc), - m_temporaryArgumentsAspect(0), - m_temporaryTerminalAspect(0) + : m_runConfiguration(rc) { - QFormLayout *layout = new QFormLayout; + auto layout = new QFormLayout; layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); layout->setMargin(0); - m_executableChooser = new Utils::PathChooser(this); + m_executableChooser = new PathChooser(this); m_executableChooser->setHistoryCompleter(QLatin1String("Qt.CustomExecutable.History")); - m_executableChooser->setExpectedKind(Utils::PathChooser::Command); + m_executableChooser->setExpectedKind(PathChooser::Command); layout->addRow(tr("Executable:"), m_executableChooser); - ArgumentsAspect *argumentsAspect = rc->extraAspect<ArgumentsAspect>(); + auto argumentsAspect = rc->extraAspect<ArgumentsAspect>(); if (mode == InstantApply) { argumentsAspect->addToMainConfigurationWidget(this, layout); } else { @@ -77,14 +74,14 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE this, &CustomExecutableConfigurationWidget::validChanged); } - m_workingDirectory = new Utils::PathChooser(this); + m_workingDirectory = new PathChooser(this); m_workingDirectory->setHistoryCompleter(QLatin1String("Qt.WorkingDir.History")); - m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory); + m_workingDirectory->setExpectedKind(PathChooser::Directory); m_workingDirectory->setBaseFileName(rc->target()->project()->projectDirectory()); layout->addRow(tr("Working directory:"), m_workingDirectory); - TerminalAspect *terminalAspect = rc->extraAspect<TerminalAspect>(); + auto terminalAspect = rc->extraAspect<TerminalAspect>(); if (mode == InstantApply) { terminalAspect->addToMainConfigurationWidget(this, layout); } else { @@ -94,42 +91,43 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE this, &CustomExecutableConfigurationWidget::validChanged); } - QVBoxLayout *vbox = new QVBoxLayout(this); + auto vbox = new QVBoxLayout(this); vbox->setMargin(0); - m_detailsContainer = new Utils::DetailsWidget(this); - m_detailsContainer->setState(Utils::DetailsWidget::NoSummary); + m_detailsContainer = new DetailsWidget(this); + m_detailsContainer->setState(DetailsWidget::NoSummary); vbox->addWidget(m_detailsContainer); - QWidget *detailsWidget = new QWidget(m_detailsContainer); + auto detailsWidget = new QWidget(m_detailsContainer); m_detailsContainer->setWidget(detailsWidget); detailsWidget->setLayout(layout); changed(); if (mode == InstantApply) { - connect(m_executableChooser, SIGNAL(rawPathChanged(QString)), - this, SLOT(executableEdited())); - connect(m_workingDirectory, SIGNAL(rawPathChanged(QString)), - this, SLOT(workingDirectoryEdited())); + connect(m_executableChooser, &PathChooser::rawPathChanged, + this, &CustomExecutableConfigurationWidget::executableEdited); + connect(m_workingDirectory, &PathChooser::rawPathChanged, + this, &CustomExecutableConfigurationWidget::workingDirectoryEdited); } else { - connect(m_executableChooser, SIGNAL(rawPathChanged(QString)), - this, SIGNAL(validChanged())); - connect(m_workingDirectory, SIGNAL(rawPathChanged(QString)), - this, SIGNAL(validChanged())); + connect(m_executableChooser, &PathChooser::rawPathChanged, + this, &CustomExecutableConfigurationWidget::validChanged); + connect(m_workingDirectory, &PathChooser::rawPathChanged, + this, &CustomExecutableConfigurationWidget::validChanged); } - ProjectExplorer::EnvironmentAspect *aspect = rc->extraAspect<ProjectExplorer::EnvironmentAspect>(); - if (aspect) { - connect(aspect, SIGNAL(environmentChanged()), this, SLOT(environmentWasChanged())); - environmentWasChanged(); - } + auto enviromentAspect = rc->extraAspect<EnvironmentAspect>(); + connect(enviromentAspect, &EnvironmentAspect::environmentChanged, + this, &CustomExecutableConfigurationWidget::environmentWasChanged); + environmentWasChanged(); - // If we are in mode InstantApply, we keep us in sync with the rc + // If we are in InstantApply mode, we keep us in sync with the rc // otherwise we ignore changes to the rc and override them on apply, // or keep them on cancel - if (mode == InstantApply) - connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed())); + if (mode == InstantApply) { + connect(m_runConfiguration, &CustomExecutableRunConfiguration::changed, + this, &CustomExecutableConfigurationWidget::changed); + } Core::VariableChooser::addSupportForChildWidgets(this, m_runConfiguration->macroExpander()); } @@ -142,8 +140,7 @@ CustomExecutableConfigurationWidget::~CustomExecutableConfigurationWidget() void CustomExecutableConfigurationWidget::environmentWasChanged() { - ProjectExplorer::EnvironmentAspect *aspect - = m_runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>(); + auto aspect = m_runConfiguration->extraAspect<EnvironmentAspect>(); QTC_ASSERT(aspect, return); m_workingDirectory->setEnvironment(aspect->environment()); m_executableChooser->setEnvironment(aspect->environment()); diff --git a/src/plugins/qtsupport/customexecutableconfigurationwidget.h b/src/plugins/qtsupport/customexecutableconfigurationwidget.h index 3668c09ff7..6a75cc1422 100644 --- a/src/plugins/qtsupport/customexecutableconfigurationwidget.h +++ b/src/plugins/qtsupport/customexecutableconfigurationwidget.h @@ -66,26 +66,24 @@ public: ~CustomExecutableConfigurationWidget(); void apply(); // only used for DelayedApply - bool isValid() const; + signals: void validChanged(); -private slots: +private: void changed(); - void executableEdited(); void workingDirectoryEdited(); void environmentWasChanged(); -private: - bool m_ignoreChange; - CustomExecutableRunConfiguration *m_runConfiguration; - ProjectExplorer::ArgumentsAspect *m_temporaryArgumentsAspect; - ProjectExplorer::TerminalAspect *m_temporaryTerminalAspect; - Utils::PathChooser *m_executableChooser; - Utils::PathChooser *m_workingDirectory; - Utils::DetailsWidget *m_detailsContainer; + bool m_ignoreChange = false; + CustomExecutableRunConfiguration *m_runConfiguration = 0; + ProjectExplorer::ArgumentsAspect *m_temporaryArgumentsAspect = 0; + ProjectExplorer::TerminalAspect *m_temporaryTerminalAspect = 0; + Utils::PathChooser *m_executableChooser = 0; + Utils::PathChooser *m_workingDirectory = 0; + Utils::DetailsWidget *m_detailsContainer = 0; }; } // namespace Internal |