aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjk <[email protected]>2019-04-29 17:57:04 +0200
committerhjk <[email protected]>2019-05-03 14:12:21 +0000
commit6eedff273bed331898962b887f68aef49319e420 (patch)
tree92c24a31444f7b2eaa1283498b7ec5694dd78801
parentf6312282f7cd83d00c49cc2de3dd0dfe42c728e7 (diff)
QmakeProjectManager: Inline QmakeProjectConfigWidget ui
First mechanical baby-step towards using aspects in QmakeBuildConfiguration. Change-Id: I6e6ec2dbeb02d9a49fe87e1ef19d126ff9b8a60c Reviewed-by: Christian Kandeler <[email protected]>
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp148
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.h16
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.ui105
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro1
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs2
5 files changed, 106 insertions, 166 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp
index 9657d6edc73..c497103e82a 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.cpp
@@ -29,8 +29,8 @@
#include "qmakebuildconfiguration.h"
#include "qmakenodes.h"
#include "qmakesettings.h"
-#include "ui_qmakeprojectconfigwidget.h"
+#include <QBoxLayout>
#include <coreplugin/coreicons.h>
#include <coreplugin/variablechooser.h>
#include <projectexplorer/target.h>
@@ -48,57 +48,96 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
: NamedWidget(),
m_buildConfiguration(bc)
{
+ const bool isShadowBuild = bc->isShadowBuild();
+ Project *project = bc->target()->project();
+
m_defaultShadowBuildDir
- = QmakeBuildConfiguration::shadowBuildDirectory(bc->target()->project()->projectFilePath().toString(),
+ = QmakeBuildConfiguration::shadowBuildDirectory(project->projectFilePath().toString(),
bc->target()->kit(),
Utils::FileUtils::qmakeFriendlyName(bc->displayName()),
bc->buildType());
- auto *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
+
+ auto vbox = new QVBoxLayout(this);
+ vbox->setMargin(0);
vbox->addWidget(m_detailsContainer);
- QWidget *details = new QWidget(m_detailsContainer);
+
+ auto details = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(details);
- m_ui = new Ui::QmakeProjectConfigWidget();
- m_ui->setupUi(details);
-
- m_browseButton = m_ui->shadowBuildDirEdit->buttonAtIndex(0);
-
- m_ui->warningLabel->setPixmap(Utils::Icons::WARNING.pixmap());
- m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
- m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
- m_ui->shadowBuildDirEdit->setHistoryCompleter(QLatin1String("Qmake.BuildDir.History"));
- m_ui->shadowBuildDirEdit->setEnvironment(bc->environment());
- m_ui->shadowBuildDirEdit->setBaseFileName(bc->target()->project()->projectDirectory());
- bool isShadowBuild = bc->isShadowBuild();
+
+ shadowBuildLabel = new QLabel(details);
+ shadowBuildLabel->setText(tr("Shadow build:"));
+
+ shadowBuildCheckBox = new QCheckBox(details);
+ shadowBuildCheckBox->setChecked(isShadowBuild);
+
+ buildDirLabel = new QLabel(details);
+ buildDirLabel->setText(tr("Build directory:"));
+
+ shadowBuildDirEdit = new Utils::PathChooser(details);
+
+ inSourceBuildDirEdit = new Utils::PathChooser(details);
+
+ warningLabel = new QLabel(details);
+ warningLabel->setPixmap(Utils::Icons::WARNING.pixmap());
+
+ problemLabel = new QLabel(details);
+ QSizePolicy sizePolicy2(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ sizePolicy2.setHorizontalStretch(10);
+ sizePolicy2.setVerticalStretch(0);
+ problemLabel->setSizePolicy(sizePolicy2);
+ problemLabel->setWordWrap(true);
+
+ auto horizontalLayout_2 = new QHBoxLayout();
+ horizontalLayout_2->addWidget(warningLabel);
+ horizontalLayout_2->addWidget(problemLabel);
+
+ auto horizontalLayout = new QHBoxLayout();
+ horizontalLayout->addWidget(shadowBuildDirEdit);
+ horizontalLayout->addWidget(inSourceBuildDirEdit);
+
+ auto layout = new QGridLayout(details);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(shadowBuildLabel, 0, 0, 1, 1);
+ layout->addWidget(shadowBuildCheckBox, 0, 1, 1, 1);
+ layout->addWidget(buildDirLabel, 1, 0, 1, 1);
+ layout->addLayout(horizontalLayout, 1, 1, 1, 1);
+ layout->addLayout(horizontalLayout_2, 2, 1, 1, 1);
+
+ problemLabel->setText(tr("problemLabel"));
+
+ m_browseButton = shadowBuildDirEdit->buttonAtIndex(0);
+
+ shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
+ shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::ExistingDirectory);
+ shadowBuildDirEdit->setHistoryCompleter(QLatin1String("Qmake.BuildDir.History"));
+ shadowBuildDirEdit->setEnvironment(bc->environment());
+ shadowBuildDirEdit->setBaseFileName(project->projectDirectory());
if (isShadowBuild) {
- m_ui->shadowBuildDirEdit->setPath(bc->rawBuildDirectory().toString());
- m_ui->inSourceBuildDirEdit->setVisible(false);
+ shadowBuildDirEdit->setPath(bc->rawBuildDirectory().toString());
+ inSourceBuildDirEdit->setVisible(false);
} else {
- m_ui->shadowBuildDirEdit->setPath(m_defaultShadowBuildDir);
- m_ui->shadowBuildDirEdit->setVisible(false);
+ shadowBuildDirEdit->setPath(m_defaultShadowBuildDir);
+ shadowBuildDirEdit->setVisible(false);
}
- m_ui->inSourceBuildDirEdit->setFileName(bc->target()->project()->projectDirectory());
- m_ui->inSourceBuildDirEdit->setReadOnly(true);
- m_ui->inSourceBuildDirEdit->setEnabled(false);
+ inSourceBuildDirEdit->setFileName(project->projectDirectory());
+ inSourceBuildDirEdit->setReadOnly(true);
+ inSourceBuildDirEdit->setEnabled(false);
auto chooser = new Core::VariableChooser(this);
- chooser->addSupportedWidget(m_ui->shadowBuildDirEdit->lineEdit());
+ chooser->addSupportedWidget(shadowBuildDirEdit->lineEdit());
- m_ui->shadowBuildCheckBox->setChecked(isShadowBuild);
-
- connect(m_ui->shadowBuildCheckBox, &QAbstractButton::clicked,
+ connect(shadowBuildCheckBox, &QAbstractButton::clicked,
this, &QmakeProjectConfigWidget::shadowBuildClicked);
- connect(m_ui->shadowBuildDirEdit, &Utils::PathChooser::beforeBrowsing,
+ connect(shadowBuildDirEdit, &Utils::PathChooser::beforeBrowsing,
this, &QmakeProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed);
- connect(m_ui->shadowBuildDirEdit, &Utils::PathChooser::rawPathChanged,
+ connect(shadowBuildDirEdit, &Utils::PathChooser::rawPathChanged,
this, &QmakeProjectConfigWidget::shadowBuildEdited);
- auto *project = static_cast<QmakeProject *>(bc->target()->project());
project->subscribeSignal(&BuildConfiguration::environmentChanged, this, [this]() {
if (static_cast<BuildConfiguration *>(sender())->isActive())
environmentChanged();
@@ -108,9 +147,11 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
if (pc && pc->isActive())
environmentChanged();
});
- connect(project, &QmakeProject::buildDirectoryInitialized,
+
+ auto qmakeProject = static_cast<QmakeProject *>(bc->target()->project());
+ connect(qmakeProject, &QmakeProject::buildDirectoryInitialized,
this, &QmakeProjectConfigWidget::updateProblemLabel);
- connect(project, &Project::parsingFinished,
+ connect(qmakeProject, &Project::parsingFinished,
this, &QmakeProjectConfigWidget::updateProblemLabel);
connect(&QmakeSettings::instance(), &QmakeSettings::settingsChanged,
this, &QmakeProjectConfigWidget::updateProblemLabel);
@@ -128,11 +169,6 @@ QmakeProjectConfigWidget::QmakeProjectConfigWidget(QmakeBuildConfiguration *bc)
updateProblemLabel();
}
-QmakeProjectConfigWidget::~QmakeProjectConfigWidget()
-{
- delete m_ui;
-}
-
void QmakeProjectConfigWidget::updateDetails()
{
m_detailsContainer->setSummaryText(
@@ -142,14 +178,14 @@ void QmakeProjectConfigWidget::updateDetails()
void QmakeProjectConfigWidget::setProblemLabel(const QString &text)
{
- m_ui->warningLabel->setVisible(!text.isEmpty());
- m_ui->problemLabel->setVisible(!text.isEmpty());
- m_ui->problemLabel->setText(text);
+ warningLabel->setVisible(!text.isEmpty());
+ problemLabel->setVisible(!text.isEmpty());
+ problemLabel->setText(text);
}
void QmakeProjectConfigWidget::environmentChanged()
{
- m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
+ shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
}
void QmakeProjectConfigWidget::buildDirectoryChanged()
@@ -157,14 +193,14 @@ void QmakeProjectConfigWidget::buildDirectoryChanged()
if (m_ignoreChange)
return;
- bool shadowBuild = m_ui->shadowBuildCheckBox->isChecked();
- m_ui->inSourceBuildDirEdit->setVisible(!shadowBuild);
+ bool shadowBuild = shadowBuildCheckBox->isChecked();
+ inSourceBuildDirEdit->setVisible(!shadowBuild);
- m_ui->shadowBuildDirEdit->setVisible(shadowBuild);
- m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
+ shadowBuildDirEdit->setVisible(shadowBuild);
+ shadowBuildDirEdit->setEnabled(shadowBuild);
m_browseButton->setEnabled(shadowBuild);
- m_ui->shadowBuildDirEdit->setPath(m_buildConfiguration->rawBuildDirectory().toString());
+ shadowBuildDirEdit->setPath(m_buildConfiguration->rawBuildDirectory().toString());
updateDetails();
updateProblemLabel();
@@ -174,22 +210,22 @@ void QmakeProjectConfigWidget::onBeforeBeforeShadowBuildDirBrowsed()
{
Utils::FileName initialDirectory = m_buildConfiguration->target()->project()->projectDirectory();
if (!initialDirectory.isEmpty())
- m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory.toString());
+ shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory.toString());
}
void QmakeProjectConfigWidget::shadowBuildClicked(bool checked)
{
- m_ui->shadowBuildDirEdit->setEnabled(checked);
+ shadowBuildDirEdit->setEnabled(checked);
m_browseButton->setEnabled(checked);
- m_ui->shadowBuildDirEdit->setVisible(checked);
- m_ui->inSourceBuildDirEdit->setVisible(!checked);
+ shadowBuildDirEdit->setVisible(checked);
+ inSourceBuildDirEdit->setVisible(!checked);
m_ignoreChange = true;
if (checked)
- m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(m_ui->shadowBuildDirEdit->rawPath()));
+ m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(shadowBuildDirEdit->rawPath()));
else
- m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(m_ui->inSourceBuildDirEdit->rawPath()));
+ m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(inSourceBuildDirEdit->rawPath()));
m_ignoreChange = false;
updateDetails();
@@ -198,17 +234,17 @@ void QmakeProjectConfigWidget::shadowBuildClicked(bool checked)
void QmakeProjectConfigWidget::shadowBuildEdited()
{
- if (m_buildConfiguration->rawBuildDirectory().toString() == m_ui->shadowBuildDirEdit->rawPath())
+ if (m_buildConfiguration->rawBuildDirectory().toString() == shadowBuildDirEdit->rawPath())
return;
m_ignoreChange = true;
- m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(m_ui->shadowBuildDirEdit->rawPath()));
+ m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(shadowBuildDirEdit->rawPath()));
m_ignoreChange = false;
}
void QmakeProjectConfigWidget::updateProblemLabel()
{
- m_ui->shadowBuildDirEdit->triggerChanged();
+ shadowBuildDirEdit->triggerChanged();
ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit();
const QString proFileName = m_buildConfiguration->target()->project()->projectFilePath().toString();
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.h b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.h
index 0c5c0ef6fd3..c0dc7653b62 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.h
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.h
@@ -27,6 +27,11 @@
#include <projectexplorer/namedwidget.h>
+#include <utils/pathchooser.h>
+
+#include <QCheckBox>
+#include <QLabel>
+
QT_BEGIN_NAMESPACE
class QAbstractButton;
QT_END_NAMESPACE
@@ -37,14 +42,12 @@ namespace QmakeProjectManager {
class QmakeBuildConfiguration;
namespace Internal {
-namespace Ui { class QmakeProjectConfigWidget; }
class QmakeProjectConfigWidget : public ProjectExplorer::NamedWidget
{
Q_OBJECT
public:
QmakeProjectConfigWidget(QmakeBuildConfiguration *bc);
- ~QmakeProjectConfigWidget() override;
private:
// User changes in our widgets
@@ -60,12 +63,19 @@ private:
void updateDetails();
void setProblemLabel(const QString &text);
- Ui::QmakeProjectConfigWidget *m_ui;
QAbstractButton *m_browseButton;
QmakeBuildConfiguration *m_buildConfiguration;
Utils::DetailsWidget *m_detailsContainer;
QString m_defaultShadowBuildDir;
bool m_ignoreChange = false;
+
+ QLabel *shadowBuildLabel;
+ QCheckBox *shadowBuildCheckBox;
+ QLabel *buildDirLabel;
+ Utils::PathChooser *shadowBuildDirEdit;
+ Utils::PathChooser *inSourceBuildDirEdit;
+ QLabel *warningLabel;
+ QLabel *problemLabel;
};
} // namespace Internal
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.ui b/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.ui
deleted file mode 100644
index db15315897b..00000000000
--- a/src/plugins/qmakeprojectmanager/qmakeprojectconfigwidget.ui
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QmakeProjectManager::Internal::QmakeProjectConfigWidget</class>
- <widget class="QWidget" name="QmakeProjectManager::Internal::QmakeProjectConfigWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>408</width>
- <height>62</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
- <number>0</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="shadowBuildLabel">
- <property name="text">
- <string>Shadow build:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="shadowBuildCheckBox">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="buildDirLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Build directory:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="Utils::PathChooser" name="shadowBuildDirEdit" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Utils::PathChooser" name="inSourceBuildDirEdit" native="true"/>
- </item>
- </layout>
- </item>
- <item row="2" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="warningLabel"/>
- </item>
- <item>
- <widget class="QLabel" name="problemLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>10</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>problemLabel</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>Utils::PathChooser</class>
- <extends>QWidget</extends>
- <header location="global">utils/pathchooser.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
index a56131074e1..ccc64eda006 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro
@@ -75,7 +75,6 @@ SOURCES += \
FORMS += \
qmakestep.ui \
- qmakeprojectconfigwidget.ui \
librarydetailswidget.ui
RESOURCES += qmakeprojectmanager.qrc \
diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
index b510c403481..e045f60663e 100644
--- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
+++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs
@@ -47,7 +47,7 @@ Project {
"qmakenodes.cpp", "qmakenodes.h",
"qmakenodetreebuilder.cpp", "qmakenodetreebuilder.h",
"qmakeproject.cpp", "qmakeproject.h",
- "qmakeprojectconfigwidget.cpp", "qmakeprojectconfigwidget.h", "qmakeprojectconfigwidget.ui",
+ "qmakeprojectconfigwidget.cpp", "qmakeprojectconfigwidget.h",
"qmakeprojectmanager.cpp", "qmakeprojectmanager.h",
"qmakeprojectmanager.qrc",
"qmakeprojectmanager_global.h",