Mercurial: Inline revertdialog.ui

Change-Id: I1da46c20c1c504d482ef580520f239c789f05dcc
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-10-04 11:32:15 +02:00
parent d843e96be8
commit bad664163f
5 changed files with 46 additions and 121 deletions

View File

@@ -10,6 +10,6 @@ add_qtc_plugin(Mercurial
mercurialeditor.cpp mercurialeditor.h mercurialeditor.cpp mercurialeditor.h
mercurialplugin.cpp mercurialplugin.h mercurialplugin.cpp mercurialplugin.h
mercurialsettings.cpp mercurialsettings.h mercurialsettings.cpp mercurialsettings.h
revertdialog.cpp revertdialog.h revertdialog.ui revertdialog.cpp revertdialog.h
srcdestdialog.cpp srcdestdialog.h srcdestdialog.ui srcdestdialog.cpp srcdestdialog.h srcdestdialog.ui
) )

View File

@@ -31,7 +31,6 @@ QtcPlugin {
"mercurialsettings.h", "mercurialsettings.h",
"revertdialog.cpp", "revertdialog.cpp",
"revertdialog.h", "revertdialog.h",
"revertdialog.ui",
"srcdestdialog.cpp", "srcdestdialog.cpp",
"srcdestdialog.h", "srcdestdialog.h",
"srcdestdialog.ui", "srcdestdialog.ui",

View File

@@ -3,25 +3,50 @@
#include "revertdialog.h" #include "revertdialog.h"
namespace Mercurial { #include <utils/layoutbuilder.h>
namespace Internal {
RevertDialog::RevertDialog(QWidget *parent) : #include <QDialogButtonBox>
QDialog(parent), #include <QGroupBox>
m_ui(new Ui::RevertDialog) #include <QLineEdit>
using namespace Utils;
namespace Mercurial::Internal {
RevertDialog::RevertDialog(QWidget *parent)
: QDialog(parent)
{ {
m_ui->setupUi(this); resize(400, 162);
setWindowTitle(tr("Revert"));
auto groupBox = new QGroupBox(tr("Specify a revision other than the default?"));
groupBox->setCheckable(true);
groupBox->setChecked(false);
m_revisionLineEdit = new QLineEdit;
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
using namespace Layouting;
Form {
tr("Revision:"), m_revisionLineEdit,
}.attachTo(groupBox, WithMargins);
Column {
groupBox,
buttonBox
}.attachTo(this);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
} }
RevertDialog::~RevertDialog() RevertDialog::~RevertDialog() = default;
{
delete m_ui;
}
QString RevertDialog::revision() const QString RevertDialog::revision() const
{ {
return m_ui->revisionLineEdit->text(); return m_revisionLineEdit->text();
} }
} // namespace Internal } // Mercurial::Internal
} // namespace Mercurial

View File

@@ -3,12 +3,13 @@
#pragma once #pragma once
#include "ui_revertdialog.h"
#include <QDialog> #include <QDialog>
namespace Mercurial { QT_BEGIN_NAMESPACE
namespace Internal { class QLineEdit;
QT_END_NAMESPACE
namespace Mercurial::Internal {
class RevertDialog : public QDialog class RevertDialog : public QDialog
{ {
@@ -21,8 +22,7 @@ public:
QString revision() const; QString revision() const;
private: private:
Ui::RevertDialog *m_ui; QLineEdit *m_revisionLineEdit;
}; };
} // namespace Internal } // Mercurial::Internal
} // namespace Mercurial

View File

@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Mercurial::Internal::RevertDialog</class>
<widget class="QDialog" name="Mercurial::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>Mercurial::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>Mercurial::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>