feat: Change PacsSettingsDialog from editing setting to view settings(storage points), add DICOM connection test(ECho) function to PacsSettingsDialog
This commit is contained in:
@@ -3,8 +3,16 @@
|
|||||||
#include "json/jsonobject.h"
|
#include "json/jsonobject.h"
|
||||||
#include "log/LogManager.h"
|
#include "log/LogManager.h"
|
||||||
#include "components/ErrorLabel.h"
|
#include "components/ErrorLabel.h"
|
||||||
|
#include "components/LoadingWidget.h"
|
||||||
|
#include "action/GetPACSSettingAction.h"
|
||||||
|
#include "recon/PACSSettingsDataModel.h"
|
||||||
|
#include "dicom/CEchoSetting.h"
|
||||||
|
#include "DialogManager.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QTableView>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@@ -13,9 +21,16 @@ namespace
|
|||||||
|
|
||||||
PacsSettingsDialog::PacsSettingsDialog(QWidget* aParent, Qt::WindowFlags aWindowFlag)
|
PacsSettingsDialog::PacsSettingsDialog(QWidget* aParent, Qt::WindowFlags aWindowFlag)
|
||||||
: GUIFormBaseDialog(aParent, aWindowFlag)
|
: GUIFormBaseDialog(aParent, aWindowFlag)
|
||||||
, mSettingsArea(new DicomSettingsArea(this))
|
|
||||||
, mErrorText(new ErrorLabel(this))
|
, mErrorText(new ErrorLabel(this))
|
||||||
|
, mLoadingWidget(new LoadingWidget(this))
|
||||||
|
, mTable(new QTableView(this))
|
||||||
|
, mModel(new PACSSettingsDataModel(this))
|
||||||
|
, mAction(new GetPACSSettingAction(this))
|
||||||
|
, mCEchoBtn(new QPushButton(this))
|
||||||
|
, mStarted(false)
|
||||||
{
|
{
|
||||||
|
setFixedWidth(635);
|
||||||
|
setButtonMode(OkOnly);
|
||||||
QVBoxLayout* layout = new QVBoxLayout(mFormWidget);
|
QVBoxLayout* layout = new QVBoxLayout(mFormWidget);
|
||||||
layout->setSpacing(10);
|
layout->setSpacing(10);
|
||||||
//Title
|
//Title
|
||||||
@@ -24,16 +39,44 @@ PacsSettingsDialog::PacsSettingsDialog(QWidget* aParent, Qt::WindowFlags aWindow
|
|||||||
title->setText(tr("PACS Settings"));
|
title->setText(tr("PACS Settings"));
|
||||||
title->setObjectName("title");
|
title->setObjectName("title");
|
||||||
layout->addWidget(title);
|
layout->addWidget(title);
|
||||||
layout->addWidget(mSettingsArea);
|
|
||||||
|
|
||||||
|
mLoadingWidget->setFixedHeight(200);
|
||||||
|
mTable->setFixedHeight(200);
|
||||||
|
mTable->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
|
mTable->setVisible(false);
|
||||||
|
mErrorText->setVisible(false);
|
||||||
QLabel* endline = new QLabel(this);
|
QLabel* endline = new QLabel(this);
|
||||||
endline->setFixedHeight(ENDLINE_SPACE);
|
endline->setFixedHeight(ENDLINE_SPACE);
|
||||||
endline->setObjectName("endline");
|
endline->setObjectName("endline");
|
||||||
layout->addWidget(endline);
|
|
||||||
layout->addWidget(mErrorText);
|
|
||||||
mErrorText->hide();
|
|
||||||
|
|
||||||
initConfig();
|
layout->addSpacerItem(new QSpacerItem(2,2,QSizePolicy::Minimum,QSizePolicy::Expanding));
|
||||||
|
layout->addWidget(mLoadingWidget);
|
||||||
|
layout->addWidget(mTable);
|
||||||
|
layout->addWidget(mErrorText);
|
||||||
|
layout->addSpacerItem(new QSpacerItem(2,2,QSizePolicy::Minimum,QSizePolicy::Expanding));
|
||||||
|
|
||||||
|
mCEchoBtn->setObjectName("cechoButton");
|
||||||
|
mCEchoBtn->setText(tr("Test Connection"));
|
||||||
|
mCEchoBtn->setVisible(false);
|
||||||
|
layout->addWidget(mCEchoBtn,Qt::AlignCenter);
|
||||||
|
layout->addWidget(endline);
|
||||||
|
mBtnOk->setEnabled(false);
|
||||||
|
connect(mAction,&AsyncAction::actionCompleted,this, &PacsSettingsDialog::handleActionFinish);
|
||||||
|
connect(mCEchoBtn, &QPushButton::clicked, [=](){
|
||||||
|
QList<CEchoSetting> list;
|
||||||
|
CEchoSetting setting;
|
||||||
|
auto data = mModel->getPACSSettings();
|
||||||
|
for(auto item : data)
|
||||||
|
{
|
||||||
|
setting.AETitle = item.AETitle;
|
||||||
|
setting.IP = item.ServerIP;
|
||||||
|
setting.Port = item.Port;
|
||||||
|
setting.ServerTitle = item.ServerAETitle;
|
||||||
|
setting.Type = 1;
|
||||||
|
list.append(setting);
|
||||||
|
}
|
||||||
|
DialogManager::Default()->requestCEchoTest(list);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
PacsSettingsDialog::~PacsSettingsDialog()
|
PacsSettingsDialog::~PacsSettingsDialog()
|
||||||
@@ -41,66 +84,39 @@ PacsSettingsDialog::~PacsSettingsDialog()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacsSettingsDialog::initConfig()
|
|
||||||
{
|
|
||||||
host serverInfo;
|
|
||||||
serverInfo = JsonObject::Instance()->getServer(JsonObject::PACS);
|
|
||||||
mSettingsArea->setServerAETitle(serverInfo.ae);
|
|
||||||
mSettingsArea->setServerIpAddress(serverInfo.ip);
|
|
||||||
mSettingsArea->setMyAETitle(serverInfo.localAE);
|
|
||||||
mSettingsArea->setServerPort(serverInfo.port);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PacsSettingsDialog::updateReferenceData()
|
bool PacsSettingsDialog::updateReferenceData()
|
||||||
{
|
{
|
||||||
QString myAETitle = mSettingsArea->getMyAETitle();
|
|
||||||
QString serverIp = mSettingsArea->getServerIpAddress();
|
|
||||||
QString serverPort = mSettingsArea->getServerPort();
|
|
||||||
QString serverAETitle = mSettingsArea->getServerAETitle();
|
|
||||||
mErrorText->show();
|
|
||||||
|
|
||||||
if(myAETitle.isEmpty())
|
|
||||||
{
|
|
||||||
mErrorText->setErrorText(tr("AE can't be empty"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(serverAETitle.isEmpty())
|
|
||||||
{
|
|
||||||
mErrorText->setErrorText(tr("Server AE can't be empty"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(serverIp.isEmpty())
|
|
||||||
{
|
|
||||||
mErrorText->setErrorText(tr("Server Ip can't be empty"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(serverPort.isEmpty())
|
|
||||||
{
|
|
||||||
mErrorText->setErrorText(tr("Server Port can't be empty"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mSettingsArea->isIpAddressValid())
|
|
||||||
{
|
|
||||||
mErrorText->setErrorText(tr("Ip Address is not valid"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mSettingsArea->isPortValid())
|
|
||||||
{
|
|
||||||
mErrorText->setErrorText(tr("Port is not valid"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
host serverInfo;
|
|
||||||
serverInfo.ip = serverIp;
|
|
||||||
serverInfo.ae = serverAETitle;
|
|
||||||
serverInfo.localAE = myAETitle;
|
|
||||||
serverInfo.port = serverPort;
|
|
||||||
JsonObject::Instance()->setServer(JsonObject::PACS, serverInfo);
|
|
||||||
LOG_USER_OPERATION("Set PACS Settings");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PacsSettingsDialog::handleActionFinish(const ActionResult& aResult)
|
||||||
|
{
|
||||||
|
if (aResult.Code == Failed){
|
||||||
|
mErrorText->setText(aResult.Data.toString());
|
||||||
|
mLoadingWidget->setVisible(false);
|
||||||
|
mErrorText->setVisible(true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
mModel->setPACSSettings(mAction->getStoragePoints());
|
||||||
|
mTable->setModel(mModel);
|
||||||
|
mTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||||
|
mTable->setColumnWidth(0,120);
|
||||||
|
mTable->setColumnWidth(1,160);
|
||||||
|
mTable->setColumnWidth(2,80);
|
||||||
|
mTable->setColumnWidth(3,150);
|
||||||
|
mTable->setColumnWidth(4,80);
|
||||||
|
mLoadingWidget->setVisible(false);
|
||||||
|
mTable->setVisible(true);
|
||||||
|
mCEchoBtn->setVisible(true);
|
||||||
|
}
|
||||||
|
mBtnOk->setEnabled(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void PacsSettingsDialog::showEvent(QShowEvent *aEvent)
|
||||||
|
{
|
||||||
|
QDialog::showEvent(aEvent);
|
||||||
|
if (mStarted) return;
|
||||||
|
mAction->execute();
|
||||||
|
mStarted = true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -3,9 +3,14 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "dialogs/GUIFormBaseDialog.h"
|
#include "dialogs/GUIFormBaseDialog.h"
|
||||||
|
#include "action/AsyncAction.h"
|
||||||
class DicomSettingsArea;
|
class DicomSettingsArea;
|
||||||
class ErrorLabel;
|
class ErrorLabel;
|
||||||
|
class GetPACSSettingAction;
|
||||||
|
class LoadingWidget;
|
||||||
|
class QTableView;
|
||||||
|
class PACSSettingsDataModel;
|
||||||
|
class QPushButton;
|
||||||
|
|
||||||
class PacsSettingsDialog : public GUIFormBaseDialog
|
class PacsSettingsDialog : public GUIFormBaseDialog
|
||||||
{
|
{
|
||||||
@@ -16,13 +21,20 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool updateReferenceData() override;
|
bool updateReferenceData() override;
|
||||||
|
void handleActionFinish(const ActionResult& aResult);
|
||||||
|
void showEvent(QShowEvent *aEvent) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initConfig();
|
void initConfig();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DicomSettingsArea* mSettingsArea;
|
|
||||||
ErrorLabel* mErrorText;
|
ErrorLabel* mErrorText;
|
||||||
|
LoadingWidget* mLoadingWidget;
|
||||||
|
QTableView* mTable;
|
||||||
|
PACSSettingsDataModel* mModel;
|
||||||
|
GetPACSSettingAction* mAction;
|
||||||
|
QPushButton * mCEchoBtn;
|
||||||
|
bool mStarted;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PACSSETTINGSDIALOG_H
|
#endif // PACSSETTINGSDIALOG_H
|
||||||
|
|||||||
Reference in New Issue
Block a user