2022-06-08 09:53:33 +08:00
|
|
|
#include "DicomCfgDialog.h"
|
|
|
|
|
|
|
|
|
|
#include <QDialogButtonBox>
|
|
|
|
|
#include <QPushButton>
|
2023-08-21 14:22:41 +08:00
|
|
|
#include <QRegularExpressionValidator>
|
2022-06-08 09:53:33 +08:00
|
|
|
|
|
|
|
|
#include "json/jsonobject.h"
|
|
|
|
|
#include "ui_DicomCfgDialog.h"
|
|
|
|
|
|
|
|
|
|
DicomCfgDialog::DicomCfgDialog(QWidget* parent)
|
|
|
|
|
: QDialog(parent)
|
|
|
|
|
, mUi(new Ui::DicomCfgDialog)
|
|
|
|
|
{
|
|
|
|
|
mUi->setupUi(this);
|
|
|
|
|
this->setObjectName("formDialog");
|
|
|
|
|
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
2022-07-20 17:05:50 +08:00
|
|
|
setFocusPolicy(Qt::ClickFocus);
|
2022-06-08 09:53:33 +08:00
|
|
|
|
|
|
|
|
mUi->mButtonGroup->button(QDialogButtonBox::Apply)->setText(tr("Apply"));
|
|
|
|
|
mUi->mButtonGroup->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
|
|
|
|
|
|
|
|
|
|
loadServersInfo();
|
|
|
|
|
|
|
|
|
|
connect(mUi->mButtonGroup->button(QDialogButtonBox::Apply), &QPushButton::clicked, [=]()
|
|
|
|
|
{
|
|
|
|
|
saveServersInfo();
|
|
|
|
|
accept();
|
|
|
|
|
});
|
|
|
|
|
connect(mUi->mButtonGroup->button(QDialogButtonBox::Cancel), &QPushButton::clicked, [=]()
|
|
|
|
|
{
|
|
|
|
|
reject();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DicomCfgDialog::~DicomCfgDialog()
|
|
|
|
|
{
|
|
|
|
|
delete mUi;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DicomCfgDialog::loadServersInfo()
|
|
|
|
|
{
|
2023-08-21 14:22:41 +08:00
|
|
|
QRegularExpression regex("^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)$");
|
|
|
|
|
QRegularExpressionValidator* validator = new QRegularExpressionValidator(regex, this);
|
|
|
|
|
|
2022-06-08 09:53:33 +08:00
|
|
|
host serverInfo;
|
|
|
|
|
serverInfo = JsonObject::Instance()->getServer(JsonObject::RECON);
|
|
|
|
|
mUi->recon_AE->setText(serverInfo.ae);
|
|
|
|
|
mUi->recon_IP->setText(serverInfo.ip);
|
2023-08-21 14:22:41 +08:00
|
|
|
mUi->recon_IP->setValidator(validator);
|
2022-06-08 09:53:33 +08:00
|
|
|
mUi->recon_Name->setText(serverInfo.name);
|
|
|
|
|
mUi->recon_Port->setText(serverInfo.port);
|
|
|
|
|
|
|
|
|
|
serverInfo = JsonObject::Instance()->getServer(JsonObject::PACS);
|
|
|
|
|
mUi->pacs_AE->setText(serverInfo.ae);
|
|
|
|
|
mUi->pacs_IP->setText(serverInfo.ip);
|
2023-08-21 14:22:41 +08:00
|
|
|
mUi->pacs_IP->setValidator(validator);
|
2022-06-08 09:53:33 +08:00
|
|
|
mUi->pacs_Name->setText(serverInfo.name);
|
|
|
|
|
mUi->pacs_Port->setText(serverInfo.port);
|
|
|
|
|
|
|
|
|
|
serverInfo = JsonObject::Instance()->getServer(JsonObject::WORKLIST);
|
|
|
|
|
mUi->wl_AE->setText(serverInfo.ae);
|
|
|
|
|
mUi->wl_IP->setText(serverInfo.ip);
|
2023-08-21 14:22:41 +08:00
|
|
|
mUi->wl_IP->setValidator(validator);
|
2022-06-08 09:53:33 +08:00
|
|
|
mUi->wl_Name->setText(serverInfo.name);
|
|
|
|
|
mUi->wl_Port->setText(serverInfo.port);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DicomCfgDialog::saveServersInfo()
|
|
|
|
|
{
|
|
|
|
|
host serverInfo;
|
|
|
|
|
serverInfo.ae = mUi->recon_AE->text();
|
|
|
|
|
serverInfo.ip = mUi->recon_IP->text();
|
|
|
|
|
serverInfo.name = mUi->recon_Name->text();
|
|
|
|
|
serverInfo.port = mUi->recon_Port->text();
|
|
|
|
|
JsonObject::Instance()->setServer(JsonObject::RECON, serverInfo);
|
|
|
|
|
|
|
|
|
|
serverInfo.ae = mUi->pacs_AE->text();
|
|
|
|
|
serverInfo.ip = mUi->pacs_IP->text();
|
|
|
|
|
serverInfo.name = mUi->pacs_Name->text();
|
|
|
|
|
serverInfo.port = mUi->pacs_Port->text();
|
|
|
|
|
JsonObject::Instance()->setServer(JsonObject::PACS, serverInfo);
|
|
|
|
|
|
|
|
|
|
serverInfo.ip = mUi->wl_IP->text();
|
|
|
|
|
serverInfo.ae = mUi->wl_AE->text();
|
|
|
|
|
serverInfo.name = mUi->wl_Name->text();
|
|
|
|
|
serverInfo.port = mUi->wl_Port->text();
|
|
|
|
|
JsonObject::Instance()->setServer(JsonObject::WORKLIST, serverInfo);
|
|
|
|
|
}
|