forked from qt-creator/qt-creator
Bazaar: Inline uncommitdialog.ui
Change-Id: I92eb7a1128394f680b473fc7cb8cb9e5e4f63f67 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -12,5 +12,4 @@ add_qtc_plugin(Bazaar
|
|||||||
commiteditor.cpp commiteditor.h
|
commiteditor.cpp commiteditor.h
|
||||||
constants.h
|
constants.h
|
||||||
pullorpushdialog.cpp pullorpushdialog.h
|
pullorpushdialog.cpp pullorpushdialog.h
|
||||||
uncommitdialog.ui
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ QtcPlugin {
|
|||||||
"constants.h",
|
"constants.h",
|
||||||
"pullorpushdialog.cpp",
|
"pullorpushdialog.cpp",
|
||||||
"pullorpushdialog.h",
|
"pullorpushdialog.h",
|
||||||
"uncommitdialog.ui",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "pullorpushdialog.h"
|
#include "pullorpushdialog.h"
|
||||||
|
|
||||||
#include "ui_uncommitdialog.h"
|
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
@@ -25,6 +23,7 @@
|
|||||||
|
|
||||||
#include <utils/commandline.h>
|
#include <utils/commandline.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
@@ -41,10 +40,10 @@
|
|||||||
#include <vcsbase/vcsoutputwindow.h>
|
#include <vcsbase/vcsoutputwindow.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QFormLayout>
|
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
@@ -276,36 +275,65 @@ public:
|
|||||||
explicit UnCommitDialog(BazaarPluginPrivate *plugin)
|
explicit UnCommitDialog(BazaarPluginPrivate *plugin)
|
||||||
: QDialog(ICore::dialogParent())
|
: 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"));
|
auto dryRunBtn = new QPushButton(tr("Dry Run"));
|
||||||
dryRunBtn->setToolTip(tr("Test the outcome of removing the last committed revision, without actually removing anything."));
|
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] {
|
connect(dryRunBtn, &QPushButton::clicked, this, [this, plugin] {
|
||||||
QTC_ASSERT(plugin->currentState().hasTopLevel(), return);
|
QTC_ASSERT(plugin->currentState().hasTopLevel(), return);
|
||||||
plugin->m_client.synchronousUncommit(plugin->currentState().topLevel(),
|
plugin->m_client.synchronousUncommit(plugin->currentState().topLevel(),
|
||||||
revision(),
|
revision(),
|
||||||
extraOptions() << "--dry-run");
|
extraOptions() << "--dry-run");
|
||||||
});
|
});
|
||||||
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList extraOptions() const
|
QStringList extraOptions() const
|
||||||
{
|
{
|
||||||
QStringList opts;
|
QStringList opts;
|
||||||
if (m_ui.keepTagsCheckBox->isChecked())
|
if (keepTagsCheckBox->isChecked())
|
||||||
opts += "--keep-tags";
|
opts += "--keep-tags";
|
||||||
if (m_ui.localCheckBox->isChecked())
|
if (localCheckBox->isChecked())
|
||||||
opts += "--local";
|
opts += "--local";
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString revision() const
|
QString revision() const
|
||||||
{
|
{
|
||||||
return m_ui.revisionLineEdit->text().trimmed();
|
return revisionLineEdit->text().trimmed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::UnCommitDialog m_ui;
|
QCheckBox *keepTagsCheckBox;
|
||||||
|
QCheckBox *localCheckBox;
|
||||||
|
QLineEdit *revisionLineEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
BazaarPlugin::~BazaarPlugin()
|
BazaarPlugin::~BazaarPlugin()
|
||||||
|
|||||||
@@ -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, "Revision: 15" 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>
|
|
||||||
Reference in New Issue
Block a user