forked from qt-creator/qt-creator
Macros: inline savedialog.ui
Change-Id: If86a77536a19606af2a810a0bde622e71fd18783 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -14,6 +14,6 @@ add_qtc_plugin(Macros
|
||||
macrosconstants.h
|
||||
macrosplugin.cpp macrosplugin.h
|
||||
macrotextfind.cpp macrotextfind.h
|
||||
savedialog.cpp savedialog.h savedialog.ui
|
||||
savedialog.cpp savedialog.h
|
||||
texteditormacrohandler.cpp texteditormacrohandler.h
|
||||
)
|
||||
|
||||
@@ -39,7 +39,6 @@ QtcPlugin {
|
||||
"macrotextfind.h",
|
||||
"savedialog.cpp",
|
||||
"savedialog.h",
|
||||
"savedialog.ui",
|
||||
"texteditormacrohandler.cpp",
|
||||
"texteditormacrohandler.h",
|
||||
]
|
||||
|
||||
@@ -24,33 +24,54 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "savedialog.h"
|
||||
#include "ui_savedialog.h"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLineEdit>
|
||||
#include <QRegularExpressionValidator>
|
||||
|
||||
using namespace Macros::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Macros::Internal {
|
||||
|
||||
SaveDialog::SaveDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SaveDialog)
|
||||
QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->name->setValidator(new QRegularExpressionValidator(QRegularExpression(QLatin1String("\\w*")), this));
|
||||
resize(219, 91);
|
||||
setWindowTitle(tr("Save Macro"));
|
||||
|
||||
m_name = new QLineEdit;
|
||||
m_name->setValidator(new QRegularExpressionValidator(QRegularExpression(QLatin1String("\\w*")), this));
|
||||
|
||||
m_description = new QLineEdit;
|
||||
|
||||
auto buttonBox = new QDialogButtonBox;
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Save);
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
Form {
|
||||
tr("Name:"), m_name, Break(),
|
||||
tr("Description:"), m_description, Break(),
|
||||
buttonBox
|
||||
}.attachTo(this);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
SaveDialog::~SaveDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
SaveDialog::~SaveDialog() = default;
|
||||
|
||||
QString SaveDialog::name() const
|
||||
{
|
||||
return ui->name->text();
|
||||
return m_name->text();
|
||||
}
|
||||
|
||||
QString SaveDialog::description() const
|
||||
{
|
||||
return ui->description->text();
|
||||
return m_description->text();
|
||||
}
|
||||
|
||||
} // Macros::Internal
|
||||
|
||||
@@ -27,10 +27,11 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Macros {
|
||||
namespace Internal {
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ui { class SaveDialog; }
|
||||
namespace Macros::Internal {
|
||||
|
||||
class SaveDialog : public QDialog
|
||||
{
|
||||
@@ -44,9 +45,8 @@ public:
|
||||
QString description() const;
|
||||
|
||||
private:
|
||||
Ui::SaveDialog *ui;
|
||||
QLineEdit *m_name;
|
||||
QLineEdit *m_description;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Macros
|
||||
} // Macros::Internal
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Macros::Internal::SaveDialog</class>
|
||||
<widget class="QDialog" name="Macros::Internal::SaveDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>219</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Save Macro</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="name"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="description">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>name</tabstop>
|
||||
<tabstop>description</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Macros::Internal::SaveDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>264</x>
|
||||
<y>185</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>204</x>
|
||||
<y>172</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Macros::Internal::SaveDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>62</x>
|
||||
<y>185</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>47</x>
|
||||
<y>171</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user