aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/bazaar
diff options
context:
space:
mode:
authorhjk <[email protected]>2022-09-23 10:04:49 +0200
committerhjk <[email protected]>2022-09-23 11:28:27 +0000
commitffff3080e261a594e9ecba9cbb0a7b7cc576b43c (patch)
treeb3b4dc856e86243404c925f9e24f1bff4b571a21 /src/plugins/bazaar
parentd97b2fd6f49f71b23f7a590e920375e1c597a285 (diff)
Bazaar: Inline uncommitdialog.ui
Change-Id: I92eb7a1128394f680b473fc7cb8cb9e5e4f63f67 Reviewed-by: Alessandro Portale <[email protected]>
Diffstat (limited to 'src/plugins/bazaar')
-rw-r--r--src/plugins/bazaar/CMakeLists.txt1
-rw-r--r--src/plugins/bazaar/bazaar.qbs1
-rw-r--r--src/plugins/bazaar/bazaarplugin.cpp46
-rw-r--r--src/plugins/bazaar/uncommitdialog.ui104
4 files changed, 37 insertions, 115 deletions
diff --git a/src/plugins/bazaar/CMakeLists.txt b/src/plugins/bazaar/CMakeLists.txt
index 7afdc83c3a5..faf27eef25d 100644
--- a/src/plugins/bazaar/CMakeLists.txt
+++ b/src/plugins/bazaar/CMakeLists.txt
@@ -12,5 +12,4 @@ add_qtc_plugin(Bazaar
commiteditor.cpp commiteditor.h
constants.h
pullorpushdialog.cpp pullorpushdialog.h
- uncommitdialog.ui
)
diff --git a/src/plugins/bazaar/bazaar.qbs b/src/plugins/bazaar/bazaar.qbs
index 6d3523c754a..78eb4a326ae 100644
--- a/src/plugins/bazaar/bazaar.qbs
+++ b/src/plugins/bazaar/bazaar.qbs
@@ -31,7 +31,6 @@ QtcPlugin {
"constants.h",
"pullorpushdialog.cpp",
"pullorpushdialog.h",
- "uncommitdialog.ui",
]
}
diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp
index 52198b35ebc..60b43773789 100644
--- a/src/plugins/bazaar/bazaarplugin.cpp
+++ b/src/plugins/bazaar/bazaarplugin.cpp
@@ -11,8 +11,6 @@
#include "constants.h"
#include "pullorpushdialog.h"
-#include "ui_uncommitdialog.h"
-
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
@@ -25,6 +23,7 @@
#include <utils/commandline.h>
#include <utils/environment.h>
+#include <utils/layoutbuilder.h>
#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
@@ -41,10 +40,10 @@
#include <vcsbase/vcsoutputwindow.h>
#include <QAction>
+#include <QCheckBox>
#include <QDebug>
#include <QDialog>
#include <QDialogButtonBox>
-#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
@@ -276,36 +275,65 @@ public:
explicit UnCommitDialog(BazaarPluginPrivate *plugin)
: QDialog(ICore::dialogParent())
{
- m_ui.setupUi(this);
+ resize(412, 124);
+ setWindowTitle(tr("Uncommit"));
+
+ keepTagsCheckBox = new QCheckBox(tr("Keep tags that point to removed revisions"));
+
+ localCheckBox = new QCheckBox(tr("Only remove the commits from the local branch when in a checkout"));
+
+ revisionLineEdit = new QLineEdit(this);
+ revisionLineEdit->setToolTip(tr("If a revision is specified, uncommits revisions to leave "
+ "the branch at the specified revision.\n"
+ "For example, \"Revision: 15\" will leave the branch at revision 15."));
+ revisionLineEdit->setPlaceholderText(tr("Last committed"));
+
+ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
auto dryRunBtn = new QPushButton(tr("Dry Run"));
dryRunBtn->setToolTip(tr("Test the outcome of removing the last committed revision, without actually removing anything."));
- m_ui.buttonBox->addButton(dryRunBtn, QDialogButtonBox::ApplyRole);
+ buttonBox->addButton(dryRunBtn, QDialogButtonBox::ApplyRole);
+
+ using namespace Utils::Layouting;
+ Column {
+ Form {
+ keepTagsCheckBox, br,
+ localCheckBox, br,
+ tr("Revision:"), revisionLineEdit, br,
+ },
+ st,
+ buttonBox,
+ }.attachTo(this);
+
connect(dryRunBtn, &QPushButton::clicked, this, [this, plugin] {
QTC_ASSERT(plugin->currentState().hasTopLevel(), return);
plugin->m_client.synchronousUncommit(plugin->currentState().topLevel(),
revision(),
extraOptions() << "--dry-run");
});
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
QStringList extraOptions() const
{
QStringList opts;
- if (m_ui.keepTagsCheckBox->isChecked())
+ if (keepTagsCheckBox->isChecked())
opts += "--keep-tags";
- if (m_ui.localCheckBox->isChecked())
+ if (localCheckBox->isChecked())
opts += "--local";
return opts;
}
QString revision() const
{
- return m_ui.revisionLineEdit->text().trimmed();
+ return revisionLineEdit->text().trimmed();
}
private:
- Ui::UnCommitDialog m_ui;
+ QCheckBox *keepTagsCheckBox;
+ QCheckBox *localCheckBox;
+ QLineEdit *revisionLineEdit;
};
BazaarPlugin::~BazaarPlugin()
diff --git a/src/plugins/bazaar/uncommitdialog.ui b/src/plugins/bazaar/uncommitdialog.ui
deleted file mode 100644
index f08a8c8a7a6..00000000000
--- a/src/plugins/bazaar/uncommitdialog.ui
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>Bazaar::Internal::UnCommitDialog</class>
- <widget class="QDialog" name="Bazaar::Internal::UnCommitDialog">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>412</width>
- <height>124</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Uncommit</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QCheckBox" name="keepTagsCheckBox">
- <property name="toolTip">
- <string/>
- </property>
- <property name="text">
- <string>Keep tags that point to removed revisions</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QCheckBox" name="localCheckBox">
- <property name="text">
- <string>Only remove the commits from the local branch when in a checkout</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="revisionLabel">
- <property name="text">
- <string>Revision:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="revisionLineEdit">
- <property name="toolTip">
- <string>If a revision is specified, uncommits revisions to leave the branch at the specified revision.
-For example, &quot;Revision: 15&quot; will leave the branch at revision 15.</string>
- </property>
- <property name="placeholderText">
- <string>Last committed</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- <zorder>buttonBox</zorder>
- <zorder>revisionLabel</zorder>
- <zorder>revisionLineEdit</zorder>
- <zorder>keepTagsCheckBox</zorder>
- <zorder>localCheckBox</zorder>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>Bazaar::Internal::UnCommitDialog</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel">
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>Bazaar::Internal::UnCommitDialog</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel">
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>