diff --git a/src/plugins/macros/CMakeLists.txt b/src/plugins/macros/CMakeLists.txt index 87d9c4db79f..a5dee70052c 100644 --- a/src/plugins/macros/CMakeLists.txt +++ b/src/plugins/macros/CMakeLists.txt @@ -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 ) diff --git a/src/plugins/macros/macros.qbs b/src/plugins/macros/macros.qbs index 5abbd74e76f..47d5e3fda24 100644 --- a/src/plugins/macros/macros.qbs +++ b/src/plugins/macros/macros.qbs @@ -39,7 +39,6 @@ QtcPlugin { "macrotextfind.h", "savedialog.cpp", "savedialog.h", - "savedialog.ui", "texteditormacrohandler.cpp", "texteditormacrohandler.h", ] diff --git a/src/plugins/macros/savedialog.cpp b/src/plugins/macros/savedialog.cpp index d85e5446700..f5968bf9d41 100644 --- a/src/plugins/macros/savedialog.cpp +++ b/src/plugins/macros/savedialog.cpp @@ -24,33 +24,54 @@ ****************************************************************************/ #include "savedialog.h" -#include "ui_savedialog.h" -#include +#include + #include +#include +#include #include -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 diff --git a/src/plugins/macros/savedialog.h b/src/plugins/macros/savedialog.h index b5ed2336f27..61477b6e1ff 100644 --- a/src/plugins/macros/savedialog.h +++ b/src/plugins/macros/savedialog.h @@ -27,10 +27,11 @@ #include -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 diff --git a/src/plugins/macros/savedialog.ui b/src/plugins/macros/savedialog.ui deleted file mode 100644 index 4954b1c98ac..00000000000 --- a/src/plugins/macros/savedialog.ui +++ /dev/null @@ -1,92 +0,0 @@ - - - Macros::Internal::SaveDialog - - - - 0 - 0 - 219 - 91 - - - - Save Macro - - - - QFormLayout::ExpandingFieldsGrow - - - - - Name: - - - - - - - - - - Description: - - - - - - - true - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Save - - - - - - - name - description - - - - - buttonBox - accepted() - Macros::Internal::SaveDialog - accept() - - - 264 - 185 - - - 204 - 172 - - - - - buttonBox - rejected() - Macros::Internal::SaveDialog - reject() - - - 62 - 185 - - - 47 - 171 - - - - -