forked from qt-creator/qt-creator
Bazaar: Inline revertdialog.ui
Change-Id: I6cff0f874076b498f07d11ede5d4e099ba179be7 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -12,6 +12,5 @@ add_qtc_plugin(Bazaar
|
|||||||
commiteditor.cpp commiteditor.h
|
commiteditor.cpp commiteditor.h
|
||||||
constants.h
|
constants.h
|
||||||
pullorpushdialog.cpp pullorpushdialog.h
|
pullorpushdialog.cpp pullorpushdialog.h
|
||||||
revertdialog.ui
|
|
||||||
uncommitdialog.ui
|
uncommitdialog.ui
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ QtcPlugin {
|
|||||||
"constants.h",
|
"constants.h",
|
||||||
"pullorpushdialog.cpp",
|
"pullorpushdialog.cpp",
|
||||||
"pullorpushdialog.h",
|
"pullorpushdialog.h",
|
||||||
"revertdialog.ui",
|
|
||||||
"uncommitdialog.ui",
|
"uncommitdialog.ui",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "pullorpushdialog.h"
|
#include "pullorpushdialog.h"
|
||||||
|
|
||||||
#include "ui_revertdialog.h"
|
|
||||||
#include "ui_uncommitdialog.h"
|
#include "ui_uncommitdialog.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanager.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
@@ -29,6 +28,7 @@
|
|||||||
#include <utils/parameteraction.h>
|
#include <utils/parameteraction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
|
|
||||||
#include <vcsbase/basevcseditorfactory.h>
|
#include <vcsbase/basevcseditorfactory.h>
|
||||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||||
@@ -43,7 +43,11 @@
|
|||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QDir>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
@@ -116,6 +120,41 @@ const VcsBaseSubmitEditorParameters submitEditorParameters {
|
|||||||
VcsBaseSubmitEditorParameters::DiffFiles
|
VcsBaseSubmitEditorParameters::DiffFiles
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RevertDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_DECLARE_TR_FUNCTIONS(Bazaar::Internal::RevertDialog)
|
||||||
|
|
||||||
|
public:
|
||||||
|
RevertDialog() : QDialog(ICore::dialogParent())
|
||||||
|
{
|
||||||
|
resize(400, 162);
|
||||||
|
setWindowTitle(tr("Revert"));
|
||||||
|
|
||||||
|
auto groupBox = new QGroupBox(tr("Specify a revision other than the default?"));
|
||||||
|
groupBox->setCheckable(true);
|
||||||
|
groupBox->setChecked(false);
|
||||||
|
|
||||||
|
revisionLineEdit = new QLineEdit;
|
||||||
|
|
||||||
|
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||||
|
|
||||||
|
using namespace Layouting;
|
||||||
|
Form {
|
||||||
|
tr("Revision:"), revisionLineEdit
|
||||||
|
}.attachTo(groupBox);
|
||||||
|
|
||||||
|
Column {
|
||||||
|
groupBox,
|
||||||
|
buttonBox,
|
||||||
|
}.attachTo(this);
|
||||||
|
|
||||||
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineEdit *revisionLineEdit;
|
||||||
|
};
|
||||||
|
|
||||||
class BazaarPluginPrivate final : public VcsBasePluginPrivate
|
class BazaarPluginPrivate final : public VcsBasePluginPrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(Bazaar::Internal::BazaarPlugin)
|
Q_DECLARE_TR_FUNCTIONS(Bazaar::Internal::BazaarPlugin)
|
||||||
@@ -410,14 +449,12 @@ void BazaarPluginPrivate::revertCurrentFile()
|
|||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasFile(), return);
|
QTC_ASSERT(state.hasFile(), return);
|
||||||
|
|
||||||
QDialog dialog(ICore::dialogParent());
|
RevertDialog dialog;
|
||||||
Ui::RevertDialog revertUi;
|
|
||||||
revertUi.setupUi(&dialog);
|
|
||||||
if (dialog.exec() != QDialog::Accepted)
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
m_client.revertFile(state.currentFileTopLevel(),
|
m_client.revertFile(state.currentFileTopLevel(),
|
||||||
state.relativeCurrentFile(),
|
state.relativeCurrentFile(),
|
||||||
revertUi.revisionLineEdit->text());
|
dialog.revisionLineEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BazaarPluginPrivate::statusCurrentFile()
|
void BazaarPluginPrivate::statusCurrentFile()
|
||||||
@@ -479,12 +516,10 @@ void BazaarPluginPrivate::revertAll()
|
|||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return);
|
QTC_ASSERT(state.hasTopLevel(), return);
|
||||||
|
|
||||||
QDialog dialog(ICore::dialogParent());
|
RevertDialog dialog;
|
||||||
Ui::RevertDialog revertUi;
|
|
||||||
revertUi.setupUi(&dialog);
|
|
||||||
if (dialog.exec() != QDialog::Accepted)
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
m_client.revertAll(state.topLevel(), revertUi.revisionLineEdit->text());
|
m_client.revertAll(state.topLevel(), dialog.revisionLineEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BazaarPluginPrivate::statusMulti()
|
void BazaarPluginPrivate::statusMulti()
|
||||||
@@ -585,13 +620,11 @@ void BazaarPluginPrivate::update()
|
|||||||
const VcsBasePluginState state = currentState();
|
const VcsBasePluginState state = currentState();
|
||||||
QTC_ASSERT(state.hasTopLevel(), return);
|
QTC_ASSERT(state.hasTopLevel(), return);
|
||||||
|
|
||||||
QDialog dialog(ICore::dialogParent());
|
RevertDialog dialog;
|
||||||
Ui::RevertDialog revertUi;
|
|
||||||
revertUi.setupUi(&dialog);
|
|
||||||
dialog.setWindowTitle(tr("Update"));
|
dialog.setWindowTitle(tr("Update"));
|
||||||
if (dialog.exec() != QDialog::Accepted)
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
m_client.update(state.topLevel(), revertUi.revisionLineEdit->text());
|
m_client.update(state.topLevel(), dialog.revisionLineEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BazaarPluginPrivate::commit()
|
void BazaarPluginPrivate::commit()
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Bazaar::Internal::RevertDialog</class>
|
|
||||||
<widget class="QDialog" name="Bazaar::Internal::RevertDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>400</width>
|
|
||||||
<height>162</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Revert</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Specify a revision other than the default?</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="formLayoutWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>361</width>
|
|
||||||
<height>51</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="revisionLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Revision:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="revisionLineEdit"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<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>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>Bazaar::Internal::RevertDialog</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::RevertDialog</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