diff --git a/.idea/editor.xml b/.idea/editor.xml
index c5f3572..b2c2d23 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -2,13 +2,9 @@
-
-
-
-
@@ -252,244 +248,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/ObjectVariable/Configuration.h b/ObjectVariable/Configuration.h
index 6cfa141..658c688 100644
--- a/ObjectVariable/Configuration.h
+++ b/ObjectVariable/Configuration.h
@@ -94,44 +94,49 @@ public:
UDP.Socket(IPVX::IPV4,TORU::UDP,TYPE::DGRAM);
bool A = UDP.SetSockOpt(CCOpt::BROADCAST);
const CCString IP = Sub_IP;
- bool F = UDP.Bind(IP.c_str(),0);
- const char str[] = {0x55,static_cast(0xAA),0x48,0x00,0x00,0x00,0x00,0x00};
- sockaddr_in serverAddr{};
- serverAddr.sin_family = AF_INET;
- serverAddr.sin_port = htons(10060);
- serverAddr.sin_addr.s_addr = INADDR_BROADCAST;
- UDP.SendData(str,serverAddr);
- int AS = 0;
- while (true){
- char buf[1024] = {0};
- CCHostInfo info;
- if(UDP.isDataAvailable()){
- CCVar length = UDP.UDPRecvData(buf, 1024,&info);
- if(length > 0){
- if(buf[2] == 0x48){
- int P = GetInt(buf[4],buf[5]);
- CSIPList.emplace_back(info.IPAddress);
- CSPortList.emplace_back(P);
+ if(bool F = UDP.Bind(IP.c_str(),0)){
+ constexpr char str[] = {0x55,static_cast(0xAA),0x48,0x00,0x00,0x00,0x00,0x00};
+ sockaddr_in serverAddr{};
+ serverAddr.sin_family = AF_INET;
+ serverAddr.sin_port = htons(10060);
+ serverAddr.sin_addr.s_addr = INADDR_BROADCAST;
+ UDP.SendData(str,serverAddr);
+ int AS = 0;
+ while (true){
+ char buf[1024] = {0};
+ CCHostInfo info;
+ if(UDP.isDataAvailable()){
+ CCVar length = UDP.UDPRecvData(buf, 1024,&info);
+ if(length > 0){
+ if(buf[2] == 0x48){
+ int P = GetInt(buf[4],buf[5]);
+ CSIPList.emplace_back(info.IPAddress);
+ CSPortList.emplace_back(P);
+ }
+ }
+ else{
+ if(length == -1)
+ {
+ break;
+ }
}
}
else{
- if(length == -1)
- {
+ AS++;
+ CCThread::Sleep(1000 * 10);
+ if(AS == 10){
break;
}
}
}
- else{
- AS++;
- CCThread::Sleep(1000 * 10);
- if(AS == 10){
- break;
- }
+ UDP.Close();
+ if(fun){
+ fun();
}
}
- UDP.Close();
- if(fun){
- fun();
+ else{
+ const CCString IPA = "网络初始化失败 -> " + Sub_IP;
+ QMessageBox::information(nullptr,"错误",IPA.c_str());
}
}
static void ReadSub_IP(){
@@ -197,23 +202,42 @@ public:
Web_IP = Sub_IP;
Sub_Org = "['http://" + Sub_IP + ":" + Sub_Port + "']";
}
- static bool isPortAvailable(int port)
+ static bool isPortAvailable(int port,TORU ipvx = TCP)
{
- CCSocket sock;
- sock.Socket(IPV4,TCP,TYPE::STREAM);
- const bool F = sock.Bind("127.0.0.1", port);
- try{
- sock.Close();
+ bool F = false;
+ if(ipvx == TCP){
+ CCSocket sock;
+ sock.Socket(IPV4,TCP,TYPE::STREAM);
+ F = sock.Bind(Sub_IP.c_str(), port);
+ try{
+ sock.Close();
+ }
+ catch (CCException& e){}
+ }
+ else{
+ CCSocket sock;
+ sock.Socket(IPV4,UDP,TYPE::DGRAM);
+ F = sock.Bind(Sub_IP.c_str(), port);
+ try{
+ sock.Close();
+ }
+ catch (CCException& e){}
}
- catch (CCException& e){}
return F;
}
static std::vector getAvailablePorts(int count, int startPort = 1024, int endPort = 65535)
{
std::vector availablePorts;
for (int port = startPort; port <= endPort && availablePorts.size() < count; ++port) {
- if (isPortAvailable(port)) {
- availablePorts.push_back(port);
+ if(availablePorts.size() < count - 1){
+ if (isPortAvailable(port)) {
+ availablePorts.push_back(port);
+ }
+ }
+ else{
+ if(isPortAvailable(port)){
+ availablePorts.push_back(port);
+ }
}
}
return availablePorts;
diff --git a/UI/W1/widget.cpp b/UI/W1/widget.cpp
index 7587d20..3b9b33e 100644
--- a/UI/W1/widget.cpp
+++ b/UI/W1/widget.cpp
@@ -1,5 +1,8 @@
#include
#include "widget.h"
+
+#include
+
#include "./ui_widget.h"
Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
@@ -37,7 +40,10 @@ Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
connect(ui->ReadCSInfoBtn, &QPushButton::clicked, this, &Widget::ReadCSInfoFun);
connect(ui->Web_Port, &QLineEdit::textChanged,this, &Widget::onTextChanged);
connect(ui->OpenPCStart, &QCheckBox::stateChanged,this, &Widget::slotCheckedChanged);
- connect(ui->RapidDeployment, &QPushButton::clicked, this, &Widget::Deploy);
+ connect(ui->RapidDeployment, &QPushButton::clicked, this, [this]()
+ {
+ CCThread(&Widget::Deploy,this).detach();
+ });
if(Configuration::CORSEn == "true"){
ui->CORSEn->setChecked(true);
}
@@ -136,19 +142,6 @@ Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
PrintMessage("检测到首次运行,正在部署IP-Web分控服务,请耐心等待...");
CCThread::Sleep(1000 * 1000 * 5);
Deploy();
- // try{
- // QMetaObject::invokeMethod(this, [this]()
- // {
- // QMessageBox::StandardButton reply = QMessageBox::question(nullptr, "提示",
- // "是否现在开始快速部署IP-Web分控?",QMessageBox::Yes | QMessageBox::No);
- // if (reply == QMessageBox::Yes) {
- // Deploy();
- // } else {
- //
- // }
- // });
- // }
- // catch (...){}
}).detach();
}
ui->OpenPCStart->setCheckState(checkAutoStartEntry("IPBS_Station(Web)") ? Qt::Checked:Qt::Unchecked);
@@ -728,12 +721,24 @@ void Widget::Deploy(){
if(Configuration::SubIPList.size() > 1){
PrintMessage("检测到多个IP地址,请选择要使用的IP地址!");
CCVar* sub = new Sub_IPUI(this);
- int w = this->width() / 2 - (sub->width() / 2);
- int h = this->height() / 2 - (sub->height() / 2);
+ int top = this->geometry().top();
+ int left = this->geometry().left();
+ int screenWidth = this->width();
+ int screenHeight = this->height();
+ int w = screenWidth / 2 - (sub->width() / 2) + left;
+ int h = screenHeight / 2 - (sub->height() / 2) + top;
sub->move(w,h);
sub->IPEdit = ui->Sub_IP;
- sub->exec();
- PrintMessage("Web分控IP地址配置完成!");
+ const int ret = sub->exec();
+ if(ret == QDialog::Accepted){
+ PrintMessage("Web分控IP地址配置完成!");
+ }
+ else if (ret == QDialog::Rejected){
+ Configuration::Sub_IP = "";
+ F2 = false;
+ PrintMessage("Web分控IP地址配置跳过!");
+ break;
+ }
}
else{
Configuration::Sub_IP = Configuration::SubIPList[0];
@@ -774,13 +779,26 @@ void Widget::Deploy(){
if(Configuration::CSIPList.size() > 1){
PrintMessage("在局域网检测到多个C/S服务器,请选择需要使用的C/S服务器!");
CCVar* cs4 = new CSInfoW4(this);
- int w = this->width() / 2 - (cs4->width() / 2);
- int h = this->height() / 2 - (cs4->height() / 2);
+ int top = this->geometry().top();
+ int left = this->geometry().left();
+ int screenWidth = this->width();
+ int screenHeight = this->height();
+ int w = screenWidth / 2 - (cs4->width() / 2) + left;
+ int h = screenHeight / 2 - (cs4->height() / 2) + top;
cs4->move(w,h);
cs4->IPEdit1 = ui->CS_IP;
cs4->IPEdit2 = ui->CS_Port;
- cs4->exec();
- PrintMessage("C/S服务器信息配置完成");
+ const int ret = cs4->exec();
+ if(ret == QDialog::Accepted){
+ PrintMessage("C/S服务器信息配置完成");
+ }
+ else if (ret == QDialog::Rejected){
+ Configuration::CS_IP = "";
+ Configuration::CS_Port = "";
+ F1 = false;
+ PrintMessage("C/S服务器信息配置跳过!");
+ break;
+ }
}
else{
Configuration::CS_IP = Configuration::CSIPList[0];
diff --git a/UI/W1/widget.ui b/UI/W1/widget.ui
index ed2823f..4a73993 100644
--- a/UI/W1/widget.ui
+++ b/UI/W1/widget.ui
@@ -652,7 +652,7 @@ color: rgb(0, 0, 0);
-
- 分控音频采集端口:
+ 分控音频采集端口(UDP):
diff --git a/UI/W4/csinfow4.ui b/UI/W4/csinfow4.ui
index 9e7fecd..d04886f 100644
--- a/UI/W4/csinfow4.ui
+++ b/UI/W4/csinfow4.ui
@@ -14,7 +14,7 @@
选择局域网CS服务器
- background-color: rgba(10, 23, 53, 200);
+ background-color: rgba(10, 23, 53, 235);
border:none;
border-radius:20px;
@@ -37,41 +37,7 @@ border-radius:20px;
-
-
-
-
-
-
- 13
-
-
-
- QListView {
- background-color: rgba(255, 255, 255,0);
- border-radius:10px;
-}
-
-QListView::item{
- border-radius:10px;
- color: rgb(255, 255, 255);
- padding:10px;
- margin-top:8px;
-}
-
-QListView::item:hover{
- border-radius:10px;
- background-color: rgba(255, 255, 255,50);
- color: rgb(0, 0, 0);
- font-size:18px;
-}
-QListView::item:selected {
- border-left: 4px solid #009688;
- background-color: rgba(182, 210, 255,100);
-}
-
-
-
-
- -
+
-
-
@@ -160,6 +126,110 @@ QPushButton:hover{
+ -
+
+
+
+ 13
+
+
+
+ QListView {
+ background-color: rgba(255, 255, 255,0);
+ border-radius:10px;
+}
+
+QListView::item{
+ border-radius:10px;
+ color: rgb(255, 255, 255);
+ padding:10px;
+ margin-top:8px;
+}
+
+QListView::item:hover{
+ border-radius:10px;
+ background-color: rgba(255, 255, 255,50);
+ color: rgb(0, 0, 0);
+ font-size:18px;
+}
+QListView::item:selected {
+ border-left: 4px solid #009688;
+ background-color: rgba(182, 210, 255,100);
+}
+QScrollBar:vertical{
+ width:15px;
+ background:rgba(0,0,0,0);
+ padding-bottom:9px;
+ background-position: right;
+ }
+ QScrollBar::add-line:vertical
+ {
+ height:0px;width:0px;
+ subcontrol-position:bottom;
+ }
+ QScrollBar::sub-line:vertical
+ {
+ height:0px;width:0px;
+ subcontrol-position:top;
+ }
+
+
+
+ -
+
+
+
+ 0
+ 30
+
+
+
+ background-color: rgba(255, 255, 255, 0);
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 25
+
+
+
+
+ 13
+
+
+
+ color: rgb(255, 255, 255);
+background-color: rgba(255, 255, 255, 0);
+
+
+ 选择局域网CS服务器
+
+
+ Qt::AlignCenter
+
+
+
+
+
+