|
- /******************************xnetconnect.cpp文件说明**********************************
- * Descript :源文件,包含通信配置窗口的函数实现
- * Author :caitiancheng
- * Date :2021_12_19
- *******************************************************************************/
-
-
- /***********************************头文件****************************************/
- #include "xnetconnect.h"
- #include "ui_xnetconnect.h"
- #include "Base.h"
- #include <QCloseEvent>
-
-
- /***********************************类的声明和继承****************************************/
- XnetConnect::XnetConnect(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::XnetConnect)
- {
- ui->setupUi(this);
- //禁止修改窗体大小
- setFixedSize(this->width(), this->height());
- ServiceFlag=false;
- //设置窗口标题
- setWindowTitle("通信连接");
- }
-
-
- /****************************closeEvent函数*********************************
- Function :窗口关闭事件函数
- Output :
- *********************************************************************/
- void XnetConnect::closeEvent(QCloseEvent *event)
- {
- emit CloseWin();
- event->accept();
- }
-
-
- /****************************启动服务槽函数函数*********************************
- Function :点击启动服务会触发该槽函数
- Output :
- *********************************************************************/
- void XnetConnect::on_CtrlServiceBtn_clicked()
- {
- Base TempBase;
- if(!ServiceFlag)
- {
- QString NeetSetIp=ui->NeedIPEdit->text();
- SetXNetClient(NeetSetIp.toLatin1().data());
- if(TempBase.ConStatus())
- {
- ServiceFlag=true;
- ui->CtrlServiceBtn->setText(QStringLiteral("关闭服务"));
- QMessageBox::information(this,QStringLiteral("启动提示"),QStringLiteral("通信成功"));
-
- }else
- {
- QMessageBox::information(this,QStringLiteral("启动提示"),QStringLiteral("通信失败"));
- }
-
- }else
- {
- CloseXNetClient();
- ServiceFlag=false;
- ui->CtrlServiceBtn->setText(QStringLiteral("开启服务"));
- QMessageBox::information(this,QStringLiteral("关闭提示"),QStringLiteral("关闭成功"));
- }
- }
-
-
-
- /******************************************************析构函数*****************************************************/
- XnetConnect::~XnetConnect()
- {
- delete ui;
- }
|