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 #include #include @@ -25,6 +23,7 @@ #include #include +#include #include #include #include @@ -41,10 +40,10 @@ #include #include +#include #include #include #include -#include #include #include #include @@ -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 @@ - - - Bazaar::Internal::UnCommitDialog - - - - 0 - 0 - 412 - 124 - - - - Uncommit - - - - - - - - - Keep tags that point to removed revisions - - - - - - - Only remove the commits from the local branch when in a checkout - - - - - - - Revision: - - - - - - - If a revision is specified, uncommits revisions to leave the branch at the specified revision. -For example, "Revision: 15" will leave the branch at revision 15. - - - Last committed - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - buttonBox - revisionLabel - revisionLineEdit - keepTagsCheckBox - localCheckBox - - - - - buttonBox - accepted() - Bazaar::Internal::UnCommitDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Bazaar::Internal::UnCommitDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - -