summaryrefslogtreecommitdiff
path: root/src/plugins/qbsprojectmanager
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-06-25 18:37:49 +0200
committerhjk <hjk@qt.io>2019-06-26 12:19:21 +0000
commit7ebfa87dc2cb719900902ee8284e339816d2de8c (patch)
tree0e9e140a78b5b00d2c136b7865ce44890ed4ce44 /src/plugins/qbsprojectmanager
parent32bbf2a3b381977d95de1159a085b31b62a7e2c8 (diff)
downloadqt-creator-7ebfa87dc2cb719900902ee8284e339816d2de8c.tar.gz
Qbs: Inline qbsinstallstepconfigwidget.ui
Prelimimary step towards aspectification. Change-Id: I3ce6e3ca3ecd3fbb858525a533202af2fd0e6ff5 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qbsprojectmanager')
-rw-r--r--src/plugins/qbsprojectmanager/CMakeLists.txt1
-rw-r--r--src/plugins/qbsprojectmanager/qbsinstallstep.cpp128
-rw-r--r--src/plugins/qbsprojectmanager/qbsinstallstep.h25
-rw-r--r--src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui118
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanager.pro1
-rw-r--r--src/plugins/qbsprojectmanager/qbsprojectmanager.qbs1
6 files changed, 92 insertions, 182 deletions
diff --git a/src/plugins/qbsprojectmanager/CMakeLists.txt b/src/plugins/qbsprojectmanager/CMakeLists.txt
index e02a516f1a..767d74da1a 100644
--- a/src/plugins/qbsprojectmanager/CMakeLists.txt
+++ b/src/plugins/qbsprojectmanager/CMakeLists.txt
@@ -17,7 +17,6 @@ add_qtc_plugin(QbsProjectManager
qbscleanstep.cpp qbscleanstep.h
qbscleanstepconfigwidget.ui
qbsinstallstep.cpp qbsinstallstep.h
- qbsinstallstepconfigwidget.ui
qbskitinformation.cpp qbskitinformation.h
qbslogsink.cpp qbslogsink.h
qbsnodes.cpp qbsnodes.h
diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
index ddfaadf8df..d0ea258853 100644
--- a/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
+++ b/src/plugins/qbsprojectmanager/qbsinstallstep.cpp
@@ -30,8 +30,6 @@
#include "qbsproject.h"
#include "qbsprojectmanagerconstants.h"
-#include "ui_qbsinstallstepconfigwidget.h"
-
#include <coreplugin/icore.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
@@ -40,7 +38,14 @@
#include <projectexplorer/target.h>
#include <utils/qtcassert.h>
+#include <QCheckBox>
#include <QFileInfo>
+#include <QFormLayout>
+#include <QLabel>
+#include <QPlainTextEdit>
+#include <QSpacerItem>
+
+using namespace ProjectExplorer;
// --------------------------------------------------------------------
// Constants:
@@ -53,6 +58,29 @@ static const char QBS_KEEP_GOING[] = "Qbs.DryKeepGoing";
namespace QbsProjectManager {
namespace Internal {
+class QbsInstallStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
+{
+public:
+ QbsInstallStepConfigWidget(QbsInstallStep *step);
+
+private:
+ void updateState();
+
+ void changeRemoveFirst(bool rf) { m_step->setRemoveFirst(rf); }
+ void changeDryRun(bool dr) { m_step->setDryRun(dr); }
+ void changeKeepGoing(bool kg) { m_step->setKeepGoing(kg); }
+
+private:
+ QbsInstallStep *m_step;
+ bool m_ignoreChange;
+
+ QCheckBox *m_dryRunCheckBox;
+ QCheckBox *m_keepGoingCheckBox;
+ QCheckBox *m_removeFirstCheckBox;
+ QPlainTextEdit *m_commandLineTextEdit;
+ QLabel *m_installRootValueLabel;
+};
+
// --------------------------------------------------------------------
// QbsInstallStep:
// --------------------------------------------------------------------
@@ -248,60 +276,88 @@ QbsInstallStepConfigWidget::QbsInstallStepConfigWidget(QbsInstallStep *step) :
setContentsMargins(0, 0, 0, 0);
- auto project = static_cast<QbsProject *>(m_step->project());
-
- m_ui = new Ui::QbsInstallStepConfigWidget;
- m_ui->setupUi(this);
-
- connect(m_ui->removeFirstCheckBox, &QAbstractButton::toggled,
+ auto installRootLabel = new QLabel(this);
+
+ auto flagsLabel = new QLabel(this);
+
+ m_dryRunCheckBox = new QCheckBox(this);
+ m_keepGoingCheckBox = new QCheckBox(this);
+ m_removeFirstCheckBox = new QCheckBox(this);
+
+ auto horizontalLayout = new QHBoxLayout();
+ horizontalLayout->addWidget(m_dryRunCheckBox);
+ horizontalLayout->addWidget(m_keepGoingCheckBox);
+ horizontalLayout->addWidget(m_removeFirstCheckBox);
+ horizontalLayout->addStretch(1);
+
+ auto commandLineKeyLabel = new QLabel(this);
+ QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
+ sizePolicy.setHorizontalStretch(0);
+ sizePolicy.setVerticalStretch(0);
+ sizePolicy.setHeightForWidth(commandLineKeyLabel->sizePolicy().hasHeightForWidth());
+ commandLineKeyLabel->setSizePolicy(sizePolicy);
+ commandLineKeyLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
+
+ m_commandLineTextEdit = new QPlainTextEdit(this);
+ QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ sizePolicy1.setHorizontalStretch(0);
+ sizePolicy1.setVerticalStretch(0);
+ sizePolicy1.setHeightForWidth(m_commandLineTextEdit->sizePolicy().hasHeightForWidth());
+ m_commandLineTextEdit->setSizePolicy(sizePolicy1);
+ m_commandLineTextEdit->setReadOnly(true);
+ m_commandLineTextEdit->setTextInteractionFlags(Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
+
+ m_installRootValueLabel = new QLabel(this);
+
+ auto formLayout = new QFormLayout(this);
+ formLayout->setWidget(0, QFormLayout::LabelRole, installRootLabel);
+ formLayout->setWidget(0, QFormLayout::FieldRole, m_installRootValueLabel);
+ formLayout->setWidget(1, QFormLayout::LabelRole, flagsLabel);
+ formLayout->setLayout(1, QFormLayout::FieldRole, horizontalLayout);
+ formLayout->setWidget(2, QFormLayout::LabelRole, commandLineKeyLabel);
+ formLayout->setWidget(2, QFormLayout::FieldRole, m_commandLineTextEdit);
+
+ QWidget::setTabOrder(m_dryRunCheckBox, m_keepGoingCheckBox);
+ QWidget::setTabOrder(m_keepGoingCheckBox, m_removeFirstCheckBox);
+ QWidget::setTabOrder(m_removeFirstCheckBox, m_commandLineTextEdit);
+
+ installRootLabel->setText(QbsInstallStep::tr("Install root:"));
+ flagsLabel->setText(QbsInstallStep::tr("Flags:"));
+ m_dryRunCheckBox->setText(QbsInstallStep::tr("Dry run"));
+ m_keepGoingCheckBox->setText(QbsInstallStep::tr("Keep going"));
+ m_removeFirstCheckBox->setText(QbsInstallStep::tr("Remove first"));
+ commandLineKeyLabel->setText(QbsInstallStep::tr("Equivalent command line:"));
+ m_installRootValueLabel->setText(QString());
+
+ connect(m_removeFirstCheckBox, &QAbstractButton::toggled,
this, &QbsInstallStepConfigWidget::changeRemoveFirst);
- connect(m_ui->dryRunCheckBox, &QAbstractButton::toggled,
+ connect(m_dryRunCheckBox, &QAbstractButton::toggled,
this, &QbsInstallStepConfigWidget::changeDryRun);
- connect(m_ui->keepGoingCheckBox, &QAbstractButton::toggled,
+ connect(m_keepGoingCheckBox, &QAbstractButton::toggled,
this, &QbsInstallStepConfigWidget::changeKeepGoing);
- connect(project, &ProjectExplorer::Project::parsingFinished,
+ connect(m_step->project(), &Project::parsingFinished,
this, &QbsInstallStepConfigWidget::updateState);
updateState();
}
-QbsInstallStepConfigWidget::~QbsInstallStepConfigWidget()
-{
- delete m_ui;
-}
-
void QbsInstallStepConfigWidget::updateState()
{
if (!m_ignoreChange) {
- m_ui->installRootValueLabel->setText(m_step->installRoot());
- m_ui->removeFirstCheckBox->setChecked(m_step->removeFirst());
- m_ui->dryRunCheckBox->setChecked(m_step->dryRun());
- m_ui->keepGoingCheckBox->setChecked(m_step->keepGoing());
+ m_installRootValueLabel->setText(m_step->installRoot());
+ m_removeFirstCheckBox->setChecked(m_step->removeFirst());
+ m_dryRunCheckBox->setChecked(m_step->dryRun());
+ m_keepGoingCheckBox->setChecked(m_step->keepGoing());
}
QString command = m_step->buildConfig()->equivalentCommandLine(m_step);
- m_ui->commandLineTextEdit->setPlainText(command);
+ m_commandLineTextEdit->setPlainText(command);
setSummaryText(tr("<b>Qbs:</b> %1").arg(command));
}
-void QbsInstallStepConfigWidget::changeRemoveFirst(bool rf)
-{
- m_step->setRemoveFirst(rf);
-}
-
-void QbsInstallStepConfigWidget::changeDryRun(bool dr)
-{
- m_step->setDryRun(dr);
-}
-
-void QbsInstallStepConfigWidget::changeKeepGoing(bool kg)
-{
- m_step->setKeepGoing(kg);
-}
-
// --------------------------------------------------------------------
// QbsInstallStepFactory:
// --------------------------------------------------------------------
diff --git a/src/plugins/qbsprojectmanager/qbsinstallstep.h b/src/plugins/qbsprojectmanager/qbsinstallstep.h
index 6b5c62eb73..5f58d006a3 100644
--- a/src/plugins/qbsprojectmanager/qbsinstallstep.h
+++ b/src/plugins/qbsprojectmanager/qbsinstallstep.h
@@ -35,8 +35,6 @@
namespace QbsProjectManager {
namespace Internal {
-class QbsInstallStepConfigWidget;
-
class QbsInstallStep : public ProjectExplorer::BuildStep
{
Q_OBJECT
@@ -86,29 +84,6 @@ private:
friend class QbsInstallStepConfigWidget;
};
-namespace Ui { class QbsInstallStepConfigWidget; }
-
-class QbsInstallStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
-{
- Q_OBJECT
-public:
- QbsInstallStepConfigWidget(QbsInstallStep *step);
- ~QbsInstallStepConfigWidget() override;
-
-private:
- void updateState();
-
- void changeRemoveFirst(bool rf);
- void changeDryRun(bool dr);
- void changeKeepGoing(bool kg);
-
-private:
- Ui::QbsInstallStepConfigWidget *m_ui;
-
- QbsInstallStep *m_step;
- bool m_ignoreChange;
-};
-
class QbsInstallStepFactory : public ProjectExplorer::BuildStepFactory
{
public:
diff --git a/src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui b/src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui
deleted file mode 100644
index 69c5102203..0000000000
--- a/src/plugins/qbsprojectmanager/qbsinstallstepconfigwidget.ui
+++ /dev/null
@@ -1,118 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>QbsProjectManager::Internal::QbsInstallStepConfigWidget</class>
- <widget class="QWidget" name="QbsProjectManager::Internal::QbsInstallStepConfigWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>474</width>
- <height>146</height>
- </rect>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="installRootLabel">
- <property name="text">
- <string>Install root:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="flagsLabel">
- <property name="text">
- <string>Flags:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="dryRunCheckBox">
- <property name="text">
- <string>Dry run</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="keepGoingCheckBox">
- <property name="text">
- <string>Keep going</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="removeFirstCheckBox">
- <property name="text">
- <string>Remove first</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="commandLineKeyLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Equivalent command line:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QPlainTextEdit" name="commandLineTextEdit">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="plainText">
- <string notr="true"/>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="installRootValueLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>dryRunCheckBox</tabstop>
- <tabstop>keepGoingCheckBox</tabstop>
- <tabstop>removeFirstCheckBox</tabstop>
- <tabstop>commandLineTextEdit</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
index 831422f262..811fd94a86 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro
@@ -66,7 +66,6 @@ FORMS = \
customqbspropertiesdialog.ui \
qbsbuildstepconfigwidget.ui \
qbscleanstepconfigwidget.ui \
- qbsinstallstepconfigwidget.ui \
qbsprofilessettingswidget.ui
RESOURCES += \
diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
index 1ef3f1b63b..f2226cf572 100644
--- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
+++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs
@@ -74,7 +74,6 @@ QtcPlugin {
"qbscleanstepconfigwidget.ui",
"qbsinstallstep.cpp",
"qbsinstallstep.h",
- "qbsinstallstepconfigwidget.ui",
"qbskitinformation.cpp",
"qbskitinformation.h",
"qbslogsink.cpp",