Commit fac9b818 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve create rule dialog

parent 03af80b3
Pipeline #125899 passed with stage
in 10 minutes and 55 seconds
......@@ -6,7 +6,9 @@
#include "openurlwithconfigurecreatewidgettest.h"
#include "openurlwithconfigurecreatewidget.h"
#include <QLineEdit>
#include <QTest>
#include <QVBoxLayout>
QTEST_MAIN(OpenUrlWithConfigureCreateWidgetTest)
OpenUrlWithConfigureCreateWidgetTest::OpenUrlWithConfigureCreateWidgetTest(QObject *parent)
: QObject{parent}
......@@ -16,4 +18,16 @@ OpenUrlWithConfigureCreateWidgetTest::OpenUrlWithConfigureCreateWidgetTest(QObje
void OpenUrlWithConfigureCreateWidgetTest::shouldHaveDefaultValues()
{
OpenUrlWithConfigureCreateWidget w;
auto mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
QVERIFY(mainLayout);
QCOMPARE(mainLayout->contentsMargins(), QMargins{});
auto mServerName = w.findChild<QLineEdit *>(QStringLiteral("mServerName"));
QVERIFY(mServerName);
QVERIFY(mServerName->text().isEmpty());
auto mCommand = w.findChild<QLineEdit *>(QStringLiteral("mCommand"));
QVERIFY(mCommand);
QVERIFY(mCommand->text().isEmpty());
}
......@@ -12,6 +12,7 @@
OpenUrlWithConfigureCreateWidget::OpenUrlWithConfigureCreateWidget(QWidget *parent)
: QWidget{parent}
, mServerName(new QLineEdit(this))
, mCommand(new QLineEdit(this))
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainlayout"));
......@@ -22,6 +23,9 @@ OpenUrlWithConfigureCreateWidget::OpenUrlWithConfigureCreateWidget(QWidget *pare
mServerName->setObjectName(QStringLiteral("mServerName"));
mainLayout->addWidget(mServerName);
mCommand->setObjectName(QStringLiteral("mCommand"));
mainLayout->addWidget(mCommand);
}
OpenUrlWithConfigureCreateWidget::~OpenUrlWithConfigureCreateWidget()
......@@ -31,12 +35,13 @@ OpenUrlWithConfigureCreateWidget::~OpenUrlWithConfigureCreateWidget()
OpenUrlWithConfigureCreateWidget::OpenUrlWithInfo OpenUrlWithConfigureCreateWidget::info() const
{
OpenUrlWithConfigureCreateWidget::OpenUrlWithInfo info;
info.url = mServerName->text().trimmed();
info.command = mCommand->text().trimmed();
return info;
}
void OpenUrlWithConfigureCreateWidget::setInfo(const OpenUrlWithInfo &i)
{
// TODO
mServerName->setText(i.url);
mCommand->setText(i.command);
}
......@@ -25,4 +25,5 @@ public:
private:
QLineEdit *const mServerName;
QLineEdit *const mCommand;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment