204 lines
5.3 KiB
C++
204 lines
5.3 KiB
C++
#include "systemsettingform.h"
|
|
#include "ui_systemsettingform.h"
|
|
|
|
#include <QPushButton>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include <QDebug>
|
|
#include <QLabel>
|
|
#include <QLineEdit>
|
|
#include <QEvent>
|
|
#include <QToolButton>
|
|
#include "json/jsonobject.h"
|
|
#include "SelectDialog.h"
|
|
#include "components/imageswitch.h"
|
|
#include "network/networkcfgdialog.h"
|
|
#include "network/getadminpsw.h"
|
|
|
|
#include "event/EventCenter.h"
|
|
systemSettingForm::systemSettingForm(QWidget* parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::systemSettingForm)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
|
|
//style init
|
|
ui->btnCancel->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
ui->btnCancel->setIcon(QIcon(":/icons/close_circle.png"));
|
|
ui->btnCancel->setIconSize(QSize(50, 50));
|
|
ui->btnAccept->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
|
ui->btnAccept->setIcon(QIcon(":/icons/selected.png"));
|
|
ui->btnAccept->setIconSize(QSize(50, 50));
|
|
ui->swt_verify->setChecked(true);
|
|
//ui->swt_verify->setButtonStyle(ImageSwitch::ButtonStyle_1);
|
|
|
|
|
|
|
|
ui->btnFlt->setFixedWidth(200);
|
|
ui->btnPro->setFixedWidth(200);
|
|
ui->lbl_protocal->setFixedWidth(100);
|
|
//lbl_filter
|
|
ui->lbl_list->setFixedWidth(100);
|
|
ui->lbl_verify->setFixedWidth(100);
|
|
|
|
|
|
//data init
|
|
ui->btnPro->setText(JsonObject::Instance()->defaultProtocal());
|
|
ui->btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
|
loadServersInfo();
|
|
|
|
//connection
|
|
connect(ui->swt_verify, &ImageSwitch::clicked, [=]() {
|
|
if (ui->swt_verify->getChecked())
|
|
{
|
|
////
|
|
}
|
|
});
|
|
connect(ui->btn_network, &QToolButton::clicked, [=]() {
|
|
GetAdminPsw dialog(this);
|
|
if (dialog.exec() == QDialog::Accepted)
|
|
{
|
|
JsonObject::Instance()->setPassword(dialog.getPsw());
|
|
networkCfgDialog dia(this);
|
|
dia.setWindowModality(Qt::WindowModal);
|
|
dia.exec();
|
|
}
|
|
});
|
|
connect(ui->btnCancel, &QToolButton::clicked, [=]() {
|
|
loadServersInfo();
|
|
});
|
|
connect(ui->btnAccept, &QToolButton::clicked, [=]() {
|
|
saveServersInfo();
|
|
});
|
|
connect(ui->btnPro, &QPushButton::clicked, [=]() {
|
|
if (!sd_protocal) {
|
|
sd_protocal = new SelectDialog(this);
|
|
sd_protocal->setWindowModality(Qt::WindowModal);
|
|
}
|
|
sd_protocal->setAvailableDates(JsonObject::Instance()->protocals());
|
|
sd_protocal->setSelectedValue(JsonObject::Instance()->defaultProtocal());
|
|
if (sd_protocal->exec() == QDialog::Accepted)
|
|
{
|
|
QString pro = sd_protocal->getSelectedValue();
|
|
//take effect
|
|
JsonObject::Instance()->setDefaultProtocal(pro);
|
|
ui->btnPro->setText(JsonObject::Instance()->defaultProtocal());
|
|
}
|
|
});
|
|
|
|
connect(ui->btnFlt, &QPushButton::clicked, [=]() {
|
|
if (!sd_filter) {
|
|
sd_filter = new SelectDialog(this);
|
|
sd_filter->setWindowModality(Qt::WindowModal);
|
|
}
|
|
sd_filter->setAvailableDates(JsonObject::Instance()->worklistFilters());
|
|
sd_filter->setSelectedValue(JsonObject::Instance()->defaultFilter());
|
|
if (sd_filter->exec() == QDialog::Accepted)
|
|
{
|
|
QString flt = sd_filter->getSelectedValue();
|
|
//take effect
|
|
JsonObject::Instance()->setDefaultFilter(flt);
|
|
ui->btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
|
}
|
|
});
|
|
|
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
|
ui->retranslateUi(this);
|
|
|
|
ui->btnPro->setText(JsonObject::Instance()->defaultProtocal());
|
|
ui->btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
|
});
|
|
}
|
|
|
|
systemSettingForm::~systemSettingForm()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void systemSettingForm::loadServersInfo()
|
|
{
|
|
host h;
|
|
h = JsonObject::Instance()->getServer(JsonObject::RECON);
|
|
ui->recon_AE->setText(h.ae);
|
|
ui->recon_IP->setText(h.ip);
|
|
ui->recon_Name->setText(h.name);
|
|
ui->recon_Port->setText(h.port);
|
|
|
|
h = JsonObject::Instance()->getServer(JsonObject::PACS);
|
|
ui->pacs_AE->setText(h.ae);
|
|
ui->pacs_IP->setText(h.ip);
|
|
ui->pacs_Name->setText(h.name);
|
|
ui->pacs_Port->setText(h.port);
|
|
|
|
|
|
h = JsonObject::Instance()->getServer(JsonObject::DAQ);
|
|
ui->daq_AE->setText(h.ae);
|
|
ui->daq_IP->setText(h.ip);
|
|
ui->daq_Name->setText(h.name);
|
|
ui->daq_Port->setText(h.port);
|
|
|
|
h = JsonObject::Instance()->getServer(JsonObject::WORKLIST);
|
|
ui->wl_AE->setText(h.ae);
|
|
ui->wl_IP->setText(h.ip);
|
|
ui->wl_Name->setText(h.name);
|
|
ui->wl_Port->setText(h.port);
|
|
|
|
//localhost lhost = JsonObject::Instance()->getLocalHost();
|
|
//local_IP->setIP(lhost.ip);
|
|
//local_Mask->setIP(lhost.mask);
|
|
//local_Gate->setIP(lhost.gateway);
|
|
|
|
//qIfConfig(lhost);
|
|
|
|
|
|
}
|
|
|
|
|
|
void systemSettingForm::saveServersInfo()
|
|
{
|
|
|
|
host h;
|
|
h.ae = ui->recon_AE->text();
|
|
h.ip = ui->recon_IP->text();
|
|
h.name = ui->recon_Name->text();
|
|
h.port = ui->recon_Port->text();
|
|
JsonObject::Instance()->setServer(JsonObject::RECON, h);
|
|
|
|
h.ae = ui->pacs_AE->text();
|
|
h.ip = ui->pacs_IP->text();
|
|
h.name = ui->pacs_Name->text();
|
|
h.port = ui->pacs_Port->text();
|
|
JsonObject::Instance()->setServer(JsonObject::PACS, h);
|
|
|
|
h.ip = ui->wl_IP->text();
|
|
h.ae = ui->wl_AE->text();
|
|
h.name = ui->wl_Name->text();
|
|
h.port = ui->wl_Port->text();
|
|
JsonObject::Instance()->setServer(JsonObject::WORKLIST, h);
|
|
|
|
|
|
h.ip = ui->daq_IP->text();
|
|
h.ae = ui->daq_AE->text();
|
|
h.name = ui->daq_Name->text();
|
|
h.port = ui->daq_Port->text();
|
|
JsonObject::Instance()->setServer(JsonObject::DAQ, h);
|
|
|
|
|
|
//localhost lhost;
|
|
//lhost.ip = local_IP->getIP();
|
|
//lhost.mask = local_Mask->getIP();
|
|
//lhost.gateway = local_Gate->getIP();
|
|
//JsonObject::Instance()->setLocalHost(lhost);
|
|
|
|
//qIfConfig(lhost);
|
|
|
|
}
|
|
|
|
//void systemSettingForm::changeEvent(QEvent* event)
|
|
//{
|
|
// if (event->type() == QEvent::LanguageChange)
|
|
// {
|
|
// ui->retranslateUi(this);
|
|
// }
|
|
//}
|