From e9fc1ad6d964931ef2ef695cb8d29360d74de920 Mon Sep 17 00:00:00 2001 From: wuuhii Date: Wed, 4 Dec 2019 20:06:54 +0800 Subject: [PATCH] add file --- src/udp/SAKUdpAdvanceSettingWidget.cc | 81 +++++++++++++++ src/udp/SAKUdpAdvanceSettingWidget.hh | 53 ++++++++++ src/udp/SAKUdpAdvanceSettingWidget.ui | 139 ++++++++++++++++++++++++++ 3 files changed, 273 insertions(+) create mode 100644 src/udp/SAKUdpAdvanceSettingWidget.cc create mode 100644 src/udp/SAKUdpAdvanceSettingWidget.hh create mode 100644 src/udp/SAKUdpAdvanceSettingWidget.ui diff --git a/src/udp/SAKUdpAdvanceSettingWidget.cc b/src/udp/SAKUdpAdvanceSettingWidget.cc new file mode 100644 index 00000000..63a7d058 --- /dev/null +++ b/src/udp/SAKUdpAdvanceSettingWidget.cc @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2018-2019 wuuhii. All rights reserved. + * + * The file is encoding with utf-8 (with BOM). It is a part of QtSwissArmyKnife + * project. The project is a open source project, you can get the source from: + * https://github.com/wuuhii/QtSwissArmyKnife + * https://gitee.com/wuuhii/QtSwissArmyKnife + * + * If you want to know more about the project, please join our QQ group(952218522). + * In addition, the email address of the project author is wuuhii@outlook.com. + */ +#include +#include +#include + +#include "SAKGlobal.hh" +#include "SAKUdpDeviceController.hh" +#include "ui_SAKUdpDeviceController.h" +SAKUdpDeviceController::SAKUdpDeviceController(QWidget *parent) + :QWidget (parent) + ,ui (new Ui::SAKUdpDeviceController) +{ + ui->setupUi(this); + + localhostComboBox = ui->localhostComboBox; + localPortlineEdit = ui->localPortlineEdit; + enableLocalSettingCheckBox = ui->enableLocalSettingCheckBox; + targetHostLineEdit = ui->targetHostLineEdit; + targetPortLineEdit = ui->targetPortLineEdit; + broadcastCheckBox = ui->broadcastCheckBox; + broadcastPortLineEdit = ui->broadcastPortLineEdit; + multicastCheckBox = ui->multicastCheckBox; + multicastAddressLineEdit = ui->multicastAddressLineEdit; + multicastPortLineEdit = ui->multicastPortLineEdit; + + refresh(); +} + +SAKUdpDeviceController::~SAKUdpDeviceController() +{ + delete ui; +} + +QString SAKUdpDeviceController::localHost() +{ + return localhostComboBox->currentText(); +} + +quint16 SAKUdpDeviceController::localPort() +{ + return static_cast(localPortlineEdit->text().toInt()); +} + +QString SAKUdpDeviceController::targetHost() +{ + return targetHostLineEdit->text(); +} + +quint16 SAKUdpDeviceController::targetPort() +{ + return static_cast(targetPortLineEdit->text().toInt()); +} + +bool SAKUdpDeviceController::enableCustomLocalSetting() +{ + return enableLocalSettingCheckBox->isChecked(); +} + +void SAKUdpDeviceController::refresh() +{ + SAKGlobal::initIpComboBox(localhostComboBox); +} + +void SAKUdpDeviceController::setUiEnable(bool enable) +{ + localhostComboBox->setEnabled(enable); + localPortlineEdit->setEnabled(enable); + enableLocalSettingCheckBox->setEnabled(enable); + targetHostLineEdit->setEnabled(enable); + targetPortLineEdit->setEnabled(enable); +} diff --git a/src/udp/SAKUdpAdvanceSettingWidget.hh b/src/udp/SAKUdpAdvanceSettingWidget.hh new file mode 100644 index 00000000..661d0d4d --- /dev/null +++ b/src/udp/SAKUdpAdvanceSettingWidget.hh @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2018-2019 wuuhii. All rights reserved. + * + * The file is encoding with utf-8 (with BOM). It is a part of QtSwissArmyKnife + * project. The project is a open source project, you can get the source from: + * https://github.com/wuuhii/QtSwissArmyKnife + * https://gitee.com/wuuhii/QtSwissArmyKnife + * + * If you want to know more about the project, please join our QQ group(952218522). + * In addition, the email address of the project author is wuuhii@outlook.com. + */ +#ifndef SAKUDPDEVICECONTROLLER_HH +#define SAKUDPDEVICECONTROLLER_HH + +#include +#include +#include + +namespace Ui { + class SAKUdpDeviceController; +} + +class SAKUdpDeviceController:public QWidget +{ + Q_OBJECT +public: + SAKUdpDeviceController(QWidget *parent = Q_NULLPTR); + ~SAKUdpDeviceController(); + + QString localHost(); + quint16 localPort(); + QString targetHost(); + quint16 targetPort(); + bool enableCustomLocalSetting(); + + void refresh(); + void setUiEnable(bool enable); +private: + Ui::SAKUdpDeviceController *ui; + + QComboBox *localhostComboBox; + QLineEdit *localPortlineEdit; + QCheckBox *enableLocalSettingCheckBox; + QLineEdit *targetHostLineEdit; + QLineEdit *targetPortLineEdit; + QCheckBox *broadcastCheckBox; + QLineEdit *broadcastPortLineEdit; + QCheckBox *multicastCheckBox; + QLineEdit *multicastAddressLineEdit; + QLineEdit *multicastPortLineEdit; +}; + +#endif diff --git a/src/udp/SAKUdpAdvanceSettingWidget.ui b/src/udp/SAKUdpAdvanceSettingWidget.ui new file mode 100644 index 00000000..ec047eed --- /dev/null +++ b/src/udp/SAKUdpAdvanceSettingWidget.ui @@ -0,0 +1,139 @@ + + + SAKUdpDeviceController + + + + 0 + 0 + 362 + 182 + + + + UDP高级设置 + + + + + + 55555 + + + + + + + 允许广播 + + + + + + + 广播端口 + + + + + + + QFrame{ +border:none +} + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 删除 + + + + + + + 添加 + + + + + + + 取消 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 禁止所有组播 + + + + + + + + + + + + + QLabel{ + color:green +} + + + 组播设置 + + + + + + + QLabel{ + color:green +} + + + 广播设置 + + + + + + + +