diff --git a/src/widgets/dialogs/autotests/serverinfodialogtest.cpp b/src/widgets/dialogs/autotests/serverinfodialogtest.cpp index 563e7ebb..0a44fa56 100644 --- a/src/widgets/dialogs/autotests/serverinfodialogtest.cpp +++ b/src/widgets/dialogs/autotests/serverinfodialogtest.cpp @@ -1,34 +1,46 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "serverinfodialogtest.h" #include "dialogs/serverinfodialog.h" +#include "dialogs/serverinfowidget.h" +#include #include +#include QTEST_MAIN(ServerInfoDialogTest) ServerInfoDialogTest::ServerInfoDialogTest(QObject *parent) : QObject(parent) { } void ServerInfoDialogTest::shouldHaveDefaultValues() { - //TODO + ServerInfoDialog w; + + QVBoxLayout *mainLayout = w.findChild(QStringLiteral("mainLayout")); + QVERIFY(mainLayout); + + ServerInfoWidget *mServerInfoWidget = w.findChild(QStringLiteral("mServerInfoWidget")); + QVERIFY(mServerInfoWidget); + + QDialogButtonBox *button = w.findChild(QStringLiteral("button")); + QVERIFY(button); } diff --git a/src/widgets/dialogs/serverinfodialog.cpp b/src/widgets/dialogs/serverinfodialog.cpp index 8385b6af..8b16ee98 100644 --- a/src/widgets/dialogs/serverinfodialog.cpp +++ b/src/widgets/dialogs/serverinfodialog.cpp @@ -1,35 +1,46 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "serverinfodialog.h" +#include "serverinfowidget.h" #include #include #include ServerInfoDialog::ServerInfoDialog(QWidget *parent) : QDialog(parent) { + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setObjectName(QStringLiteral("mainLayout")); + mServerInfoWidget = new ServerInfoWidget(this); + mServerInfoWidget->setObjectName(QStringLiteral("mServerInfoWidget")); + mainLayout->addWidget(mServerInfoWidget); + + QDialogButtonBox *button = new QDialogButtonBox(QDialogButtonBox::Close, this); + button->setObjectName(QStringLiteral("button")); + mainLayout->addWidget(button); + connect(button, &QDialogButtonBox::rejected, this, &ServerInfoDialog::close); } ServerInfoDialog::~ServerInfoDialog() { } diff --git a/src/widgets/dialogs/serverinfodialog.h b/src/widgets/dialogs/serverinfodialog.h index 5ea2492e..31d9b23b 100644 --- a/src/widgets/dialogs/serverinfodialog.h +++ b/src/widgets/dialogs/serverinfodialog.h @@ -1,35 +1,37 @@ /* Copyright (c) 2020 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SERVERINFODIALOG_H #define SERVERINFODIALOG_H #include #include "libruqolawidgets_private_export.h" - +class ServerInfoWidget; class LIBRUQOLAWIDGETS_EXPORT ServerInfoDialog : public QDialog { Q_OBJECT public: explicit ServerInfoDialog(QWidget *parent = nullptr); ~ServerInfoDialog(); +private: + ServerInfoWidget *mServerInfoWidget = nullptr; }; #endif // SERVERINFODIALOG_H