diff --git a/src/src/PACS/Widget/pacsconfiguration.cpp b/src/src/PACS/Widget/pacsconfiguration.cpp index d05f6ea..309b925 100644 --- a/src/src/PACS/Widget/pacsconfiguration.cpp +++ b/src/src/PACS/Widget/pacsconfiguration.cpp @@ -74,17 +74,30 @@ void ConfigurationDialog::initUi() m_pTitleBar->setFixedHeight(30); m_pMainLayout->addWidget(m_pTitleBar); + //validators for line editor + QRegularExpression portRegex("^(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[1-5][0-9]{4}|[1-9][0-9]{0,3}|0)$"); + QRegularExpressionValidator * portValidator = new QRegularExpressionValidator(this); + portValidator->setRegularExpression(portRegex); + QRegularExpression ipRegex("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"); + QRegularExpressionValidator * ipValidator = new QRegularExpressionValidator(this); + ipValidator->setRegularExpression(ipRegex); + QRegularExpression aeTitleRegex("^[0-9a-zA-Z_-]{1,16}$"); + QRegularExpressionValidator * aeTitleValidator = new QRegularExpressionValidator(this); + aeTitleValidator->setRegularExpression(aeTitleRegex); + m_pOurInfoWidget = new QWidget(this); m_pOurInfoLayout = new QHBoxLayout(this); m_pOurPortLabel = new QLabel(m_pOurInfoWidget); m_pOurPortLabel->setText(tr("Listening port:")); m_pOurInfoLayout->addWidget(m_pOurPortLabel); m_pOurPortEdit = new QLineEdit(m_pOurInfoWidget); + m_pOurPortEdit->setValidator(portValidator); m_pOurInfoLayout->addWidget(m_pOurPortEdit); m_pOurTitleLabel = new QLabel(m_pOurInfoWidget); m_pOurTitleLabel->setText(tr("Local AE title:")); m_pOurInfoLayout->addWidget(m_pOurTitleLabel); m_pOurTitleEdit = new QLineEdit(m_pOurInfoWidget); + m_pOurTitleEdit->setValidator(aeTitleValidator); m_pOurInfoLayout->addWidget(m_pOurTitleEdit); m_AdvancedSettingsButton = new QPushButton(m_pOurInfoWidget); m_AdvancedSettingsButton->setText(tr("Advanced settings")); @@ -162,10 +175,13 @@ void ConfigurationDialog::initUi() m_pEditLayout->addWidget(m_pPeerDescritopnLabel, 0, 6, 1, 5); m_pPeerIpAddressEdit = new QLineEdit(m_pEditWidget); + m_pPeerIpAddressEdit->setValidator(ipValidator); m_pEditLayout->addWidget(m_pPeerIpAddressEdit, 1, 0, 1, 3); m_pPeerPortEdit = new QLineEdit(m_pEditWidget); + m_pPeerPortEdit->setValidator(portValidator); m_pEditLayout->addWidget(m_pPeerPortEdit, 1, 3, 1, 1); m_pPeerTitleEdit = new QLineEdit(m_pEditWidget); + m_pPeerTitleEdit->setValidator(aeTitleValidator); m_pEditLayout->addWidget(m_pPeerTitleEdit, 1, 4, 1, 2); m_pPeerDescriptionEdit = new QLineEdit(m_pEditWidget); m_pEditLayout->addWidget(m_pPeerDescriptionEdit, 1, 6, 1, 3); @@ -603,18 +619,6 @@ void ConfigurationDialog::changeHostProtocol() void ConfigurationDialog::pacsMenuRequest(QPoint pos) { auto index = m_pPacsInfo->indexAt(pos); - auto actions = m_pRetriveProtocolMenu->actions(); - for(int i = 0; i < actions.count(); ++i) - { - if (actions.at(i)->text() == m_pPacsModel->item(index.row(),4)->text()) - { - actions.at(i)->setChecked(true); - } - else - { - actions.at(i)->setChecked(false); - } - } m_pPacsMenu->exec(QCursor::pos()); }