File indexing completed on 2024-12-01 04:37:05
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "testservererrorinfomessagehistorywidget.h" 0008 #include "servererrorinfohistorymanager.h" 0009 #include <QFormLayout> 0010 #include <QLineEdit> 0011 #include <QPushButton> 0012 0013 TestServerErrorInfoMessageHistoryWidget::TestServerErrorInfoMessageHistoryWidget(QWidget *parent) 0014 : QWidget{parent} 0015 { 0016 auto layout = new QFormLayout(this); 0017 auto accountName = new QLineEdit(this); 0018 layout->addRow(QStringLiteral("Account Name:"), accountName); 0019 0020 auto messageStr = new QLineEdit(this); 0021 layout->addRow(QStringLiteral("Message:"), messageStr); 0022 0023 auto pushButton = new QPushButton(QStringLiteral("Add Error"), this); 0024 layout->addWidget(pushButton); 0025 0026 connect(pushButton, &QPushButton::clicked, this, [accountName, messageStr]() { 0027 ServerErrorInfo info; 0028 info.setAccountName(accountName->text()); 0029 info.setMessage(messageStr->text()); 0030 ServerErrorInfoHistoryManager::self()->addServerErrorInfo(info); 0031 }); 0032 } 0033 0034 #include "moc_testservererrorinfomessagehistorywidget.cpp"