V0.2
This commit is contained in:
parent
e2d0cd08a3
commit
d3bb791fb6
@ -7,8 +7,8 @@ class en_us{
|
||||
public:
|
||||
inline static JSON En_Us = {
|
||||
{"label_12", "IP broadcast Web sub-control launcher"},
|
||||
{"OpenServerBtn", "Start service"},
|
||||
{"RapidDeployment", "Quick configuration"},
|
||||
{"OpenServerBtn", "Start"},
|
||||
{"RapidDeployment", "Quick config"},
|
||||
{"groupBox", "Web sub-control backend Settings"},
|
||||
{"label", "C/S server IP:"},
|
||||
{"label_2", "C/S server port:"},
|
||||
@ -17,13 +17,13 @@ public:
|
||||
{"label_5", "Separate control audio acquisition port(UDP):"},
|
||||
{"label_6", "Sub-control Backend IP Address Whitelist -[Cross-Domain]:"},
|
||||
{"CORSEn", "Enable"},
|
||||
{"label_7", "Language[语言]:"},
|
||||
{"label_7", "Language:"},
|
||||
{"groupBox_2", "Web sub-control front-end Settings"},
|
||||
{"label_9", "Sub-control the front-end IP:"},
|
||||
{"label_8", "Sub-control the front-end port:"},
|
||||
{"label_10", "Sub-control the front-end website address:"},
|
||||
{"RestBtn", "Initialization Settings"},
|
||||
{"GJSZBtn", "Advanced Settings"},
|
||||
{"RestBtn", "Init Setting"},
|
||||
{"GJSZBtn", "Settings"},
|
||||
{"OpenPCStart", "Set it to start automatically upon startup"},
|
||||
{"SetSaveBtn", "Save"},
|
||||
{"HomeBtn", "Home"},
|
||||
@ -31,6 +31,63 @@ public:
|
||||
{"WebLabel", "Front-end: Offline"},
|
||||
{"SubLabel", "Back-end: Offline"},
|
||||
{"label_13", "Seconds/Self-start delay (0 is none)"},
|
||||
{"Note1", "The first operation has been detected. The IP-Web sub-control service is being deployed. Please wait patiently..."},
|
||||
{"Note2", "The service will be automatically started in seconds"},
|
||||
{"ExitProgram", "Exit"},
|
||||
{"AreYouSureYouWantToQuit", "Are you sure you want to quit?"},
|
||||
{"EndProgram", "End"},
|
||||
{"ToPallet", "Pallet"},
|
||||
{"Hint", "Hint"},
|
||||
{"IncorrectStartupParameters", "The startup parameters are incorrect. Please configure the server parameters first!"},
|
||||
{"OpenService", "Open the service"},
|
||||
{"ShutDownService", "Shut down the service"},
|
||||
{"ErrorNote1", "C/S_IP cannot be empty"},
|
||||
{"ErrorNote2", "C/S_Port cannot be empty"},
|
||||
{"ErrorNote3", "Sub_IP cannot be empty"},
|
||||
{"ErrorNote4", "Sub_Port cannot be empty"},
|
||||
{"ErrorNote5", "Web_Port cannot be empty"},
|
||||
{"ErrorNote6", "Web_IP cannot be empty"},
|
||||
{"ErrorNote7", "Sub_Audio_Port cannot be empty"},
|
||||
{"ErrorNote8", "Sub_Origins cannot be empty"},
|
||||
{"ErrorNote9", "Whether to start now after successful saving?"},
|
||||
{"ErrorNote10", "Initialization has been completed. Do you want to save?"},
|
||||
{"ErrorNote11", "Whether to stop first when the service has been detected to have started?"},
|
||||
{"ErrorNote12", "Quick configuration has been cancelled!"},
|
||||
{"ErrorNote13", "The IP-Web sub-control IP address is being configured..."},
|
||||
{"ErrorNote14", "Multiple IP addresses have been detected. Please select the IP address to be used!"},
|
||||
{"ErrorNote15", "The configuration of the Web sub-control IP address has been completed"},
|
||||
{"ErrorNote16", "Skip the configuration of the Web sub-control IP address"},
|
||||
{"ErrorNote17", "The configuration of the Web sub-control IP address has been completed"},
|
||||
{"ErrorNote18", "No legal IPV4 address was detected. Please check your network to see if you continue the detection?"},
|
||||
{"ErrorNote19", "The C/S server parameters are being configured..."},
|
||||
{"ErrorNote20", "Try to search in the C/S server..."},
|
||||
{"ErrorNote21", "Multiple C/S servers are detected in the local area network. Please select the C/S server you need to use!"},
|
||||
{"ErrorNote22", "The C/S server information configuration has been completed"},
|
||||
{"ErrorNote23", "Skip the C/S server information configuration!"},
|
||||
{"ErrorNote24", "The IP-Web sub-control service port is being allocated..."},
|
||||
{"ErrorNote25", "The port allocation for the IP-Web sub-control service has been completed"},
|
||||
{"ErrorNote26", "The IP-Web sub-control service is being set up across domains..."},
|
||||
{"ErrorNote27", "The cross-domain setup of the IP-Web sub-control service has been completed!"},
|
||||
{"ErrorNote28", "The deployment and setup of the IP-Web sub-control service have been completed!"},
|
||||
{"ErrorNote29", "The IP-Web sub-control service Settings are being saved..."},
|
||||
{"ErrorNote30", "The IP-Web sub-control service Settings have been saved successfully"},
|
||||
{"ErrorNote31", "The IP-Web sub-control service is being launched..."},
|
||||
{"ErrorNote32", "The C/S server was not detected in the local area network. Please check the C/S server"},
|
||||
{"ErrorNote33", "No legal IPV4 address was detected. Please check your network"},
|
||||
{"ErrorNote34", "Deployment not completed"},
|
||||
{"ErrorNote35", "No available C/S server was detected in the local area network. Please start the C/S server first and then decide whether to continue the detection?"},
|
||||
{"label_tyz", "Administrator password"},
|
||||
{"YZMMInput_tyz", "Password"},
|
||||
{"YZQRBtn", "Confirm"},
|
||||
{"YZQXBtn", "Cancel"},
|
||||
{"IncorrectPassword", "Incorrect password"},
|
||||
{"LogoBtn", "Change logo image"},
|
||||
{"localUpdate", "Local update"},
|
||||
{"label_11", "Picture must be 100x40 in size"},
|
||||
{"W3Title", "Advanced Settings"},
|
||||
{"Choose", "Choose"},
|
||||
{"W4Title", "Select a local area network CS server"},
|
||||
{"W5Title", "Select the sub-control backend IP"},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -33,6 +33,63 @@ public:
|
||||
{"SubLabel_1", "后端:在线"},
|
||||
{"SubLabel_0", "后端:离线"},
|
||||
{"label_13", "秒/自启延时(0为无)"},
|
||||
{"Note1", "检测到首次运行,正在部署IP-Web分控服务,请耐心等待..."},
|
||||
{"Note2", "秒后自动启动服务"},
|
||||
{"ExitProgram", "退出程序"},
|
||||
{"AreYouSureYouWantToQuit", "你确定要退出吗?"},
|
||||
{"EndProgram", "结束程序"},
|
||||
{"ToPallet", "到托盘"},
|
||||
{"Hint", "提示"},
|
||||
{"IncorrectStartupParameters", "启动参数错误,请先配置服务器参数!"},
|
||||
{"OpenService", "打开服务"},
|
||||
{"ShutDownService", "关闭服务"},
|
||||
{"ErrorNote1", "C/S_IP不能为空"},
|
||||
{"ErrorNote2", "C/S_Port不能为空"},
|
||||
{"ErrorNote3", "Sub_IP不能为空"},
|
||||
{"ErrorNote4", "Sub_Port不能为空"},
|
||||
{"ErrorNote5", "Web_Port不能为空"},
|
||||
{"ErrorNote6", "Web_IP不能为空"},
|
||||
{"ErrorNote7", "Sub_Audio_Port不能为空"},
|
||||
{"ErrorNote8", "Sub_Origins不能为空"},
|
||||
{"ErrorNote9", "保存成功是否现在启动?"},
|
||||
{"ErrorNote10", "初始化已完成,是否保存?"},
|
||||
{"ErrorNote11", "检测到服务已经启动是否先停止?"},
|
||||
{"ErrorNote12", "已取消快速配置!"},
|
||||
{"ErrorNote13", "正在配置IP-Web分控IP地址..."},
|
||||
{"ErrorNote14", "检测到多个IP地址,请选择要使用的IP地址!"},
|
||||
{"ErrorNote15", "Web分控IP地址配置完成"},
|
||||
{"ErrorNote16", "Web分控IP地址配置跳过"},
|
||||
{"ErrorNote17", "Web分控IP地址配置完成"},
|
||||
{"ErrorNote18", "未检测到合法IPV4地址,请检查网络,是否继续检测?"},
|
||||
{"ErrorNote19", "正在配置C/S服务器参数..."},
|
||||
{"ErrorNote20", "尝试搜索C/S服务器中..."},
|
||||
{"ErrorNote21", "在局域网检测到多个C/S服务器,请选择需要使用的C/S服务器!"},
|
||||
{"ErrorNote22", "C/S服务器信息配置完成"},
|
||||
{"ErrorNote23", "C/S服务器信息配置跳过!"},
|
||||
{"ErrorNote24", "正在分配IP-Web分控服务端口..."},
|
||||
{"ErrorNote25", "IP-Web分控服务端口分配完成"},
|
||||
{"ErrorNote26", "IP-Web分控服务正在设置跨域..."},
|
||||
{"ErrorNote27", "IP-Web分控服务跨域设置完成!"},
|
||||
{"ErrorNote28", "IP-Web分控服务部署设置已完成!"},
|
||||
{"ErrorNote29", "正在保存IP-Web分控服务设置..."},
|
||||
{"ErrorNote30", "IP-Web分控服务设置保存完成"},
|
||||
{"ErrorNote31", "正在启动IP-Web分控服务..."},
|
||||
{"ErrorNote32", "在局域网未检测到C/S服务器,请检查C/S服务器"},
|
||||
{"ErrorNote33", "未检测到合法IPV4地址,请检查网络"},
|
||||
{"ErrorNote34", "部署未完成"},
|
||||
{"ErrorNote35", "在局域网未检测到可用的C/S服务器,请先启动C/S服务器,是否继续检测?"},
|
||||
{"label_tyz", "管理员密码"},
|
||||
{"YZMMInput_tyz", "密码"},
|
||||
{"YZQRBtn", "确定"},
|
||||
{"YZQXBtn", "取消"},
|
||||
{"IncorrectPassword", "密码错误"},
|
||||
{"LogoBtn", "更改logo图片"},
|
||||
{"localUpdate", "本地更新"},
|
||||
{"label_11", "图片必须是100x40的大小"},
|
||||
{"W3Title", "高级设置"},
|
||||
{"Choose", "选择"},
|
||||
{"W4Title", "选择局域网CS服务器"},
|
||||
{"W5Title", "选择分控后端IP"},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
239
UI/W1/widget.cpp
239
UI/W1/widget.cpp
@ -89,7 +89,7 @@ Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
|
||||
Threading::Sleep(1000 * 1000);
|
||||
QMetaObject::invokeMethod(this, [this]() {
|
||||
ui->ServerConsele->append(
|
||||
CCString(std::to_string(OpenSleepValue) + "秒后自动启动服务").c_str()
|
||||
CCString(std::to_string(OpenSleepValue) + Index::Lang("Note2")).c_str()
|
||||
);
|
||||
});
|
||||
OpenSleepValue--;
|
||||
@ -143,11 +143,14 @@ Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget){
|
||||
}
|
||||
}).detach();
|
||||
if(Configuration::FirstRun == 1){
|
||||
PrintMessage("检测到首次运行,正在部署IP-Web分控服务,请耐心等待...");
|
||||
CCThread::Sleep(1000 * 1000 * 5);
|
||||
QMetaObject::invokeMethod(this, [this]() {
|
||||
Deploy(this);
|
||||
}, Qt::QueuedConnection);
|
||||
PrintMessage(Index::Lang("Note1"));
|
||||
auto th = std::thread([this](){
|
||||
CCThread::Sleep(1000 * 1000 * 5);
|
||||
QMetaObject::invokeMethod(this, [this]() {
|
||||
Deploy(this);
|
||||
}, Qt::QueuedConnection);
|
||||
});
|
||||
th.detach();
|
||||
}
|
||||
ui->OpenPCStart->setCheckState(checkAutoStartEntry("IPBS_Station(Web)") ? Qt::Checked:Qt::Unchecked);
|
||||
ServerThread.SetThread(&Widget::ServerListening,this);
|
||||
@ -195,10 +198,10 @@ void Widget::WebThreadRun() {
|
||||
|
||||
void Widget::closeEvent(QCloseEvent *event) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("退出程序"));
|
||||
msgBox.setText(tr("你确定要退出吗?"));
|
||||
QPushButton *yesButton = msgBox.addButton(tr("结束程序"), QMessageBox::YesRole);
|
||||
msgBox.addButton(tr("到托盘"), QMessageBox::NoRole);
|
||||
msgBox.setWindowTitle(tr(Index::Lang("ExitProgram").c_str()));
|
||||
msgBox.setText(tr(Index::Lang("AreYouSureYouWantToQuit").c_str()));
|
||||
QPushButton *yesButton = msgBox.addButton(tr(Index::Lang("EndProgram").c_str()), QMessageBox::YesRole);
|
||||
msgBox.addButton(tr(Index::Lang("ToPallet").c_str()), QMessageBox::NoRole);
|
||||
msgBox.exec();
|
||||
if (msgBox.clickedButton() == yesButton)
|
||||
{
|
||||
@ -224,7 +227,9 @@ bool Widget::WebRunFun() {
|
||||
if(!WebThread.Sign()){
|
||||
ServerFlag = true;
|
||||
SetState(ServerFlag);
|
||||
CCThread(WebThreadRun,this).detach();
|
||||
CCThread([this](){
|
||||
WebThreadRun();
|
||||
}).detach();
|
||||
CCThread([this]()
|
||||
{
|
||||
Configuration::OpenSub_Web();
|
||||
@ -238,7 +243,7 @@ bool Widget::WebRunFun() {
|
||||
}
|
||||
CCThread::Sleep(1000 * 1000);
|
||||
}
|
||||
PrintMessage("网址: " + Configuration::Web_URL);
|
||||
PrintMessage("Link: " + Configuration::Web_URL);
|
||||
}).detach();
|
||||
QMetaObject::invokeMethod(this,[this]()
|
||||
{
|
||||
@ -297,7 +302,8 @@ void Widget::OpenServerClick() {
|
||||
}
|
||||
}
|
||||
else{
|
||||
QMessageBox::information(this,"提示","启动参数错误,请先配置服务器参数!");
|
||||
QMessageBox::information(this,Index::Lang("Hint").c_str(),
|
||||
Index::Lang("IncorrectStartupParameters").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,7 +320,7 @@ void Widget::OpenFlagBtn(bool F) {
|
||||
"\tcolor: rgb(255, 255, 255);\n"
|
||||
"\tbackground-color: rgba(255,100,150, 255);\n"
|
||||
"}");
|
||||
ui->OpenServerBtn->setText("打开服务");
|
||||
ui->OpenServerBtn->setText(Index::Lang("OpenService").c_str());
|
||||
}
|
||||
else{
|
||||
ui->OpenServerBtn->setStyleSheet("QPushButton{\n"
|
||||
@ -328,7 +334,7 @@ void Widget::OpenFlagBtn(bool F) {
|
||||
"\tcolor: rgb(255, 255, 255);\n"
|
||||
"\tbackground-color: rgba(255,100,150, 255);\n"
|
||||
"}");
|
||||
ui->OpenServerBtn->setText("关闭服务");
|
||||
ui->OpenServerBtn->setText(Index::Lang("ShutDownService").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,7 +364,7 @@ void Widget::ServerListening() {
|
||||
if(!S){
|
||||
Configuration::OpenSub_Web();
|
||||
PrintMessage("Web Res Start OK!");
|
||||
PrintMessage("网址: " + Configuration::Web_URL);
|
||||
PrintMessage("Link: " + Configuration::Web_URL);
|
||||
}
|
||||
Threading::Sleep(1000 * 1000 * 5);
|
||||
}
|
||||
@ -479,40 +485,40 @@ void Widget::onTextChanged(const QString &text) {
|
||||
|
||||
void Widget::SetSaveBtn() {
|
||||
if(ui->CS_IP->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "C/S_IP不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote1").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->CS_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "C/S_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote2").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_IP->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_IP不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote3").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote4").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Web_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Web_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote5").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Web_IP->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Web_IP不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote6").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_Audio_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_Audio_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote7").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_Origins->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_Origins不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote8").c_str());
|
||||
return;
|
||||
}
|
||||
SetServerConfig();
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(this, "提示", "保存成功是否现在启动?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(this,
|
||||
Index::Lang("Hint").c_str(), Index::Lang("ErrorNote9").c_str(),QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
if(ServerFlag){
|
||||
try {
|
||||
@ -542,12 +548,13 @@ void Widget::SetSaveBtn() {
|
||||
void Widget::ServerConfigInit() {
|
||||
Configuration::CfgInit();
|
||||
SetPage(1);
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(this, "提示",
|
||||
"初始化已完成,是否保存?",
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(this, Index::Lang("Hint").c_str(),
|
||||
Index::Lang("ErrorNote10").c_str(),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
SetSaveBtn();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
@ -563,68 +570,6 @@ void Widget::Initlogo() {
|
||||
}
|
||||
|
||||
void Widget::SetServerConfig() {
|
||||
// FILE *fp = fopen(Configuration::CfgPath.c_str(), "w");
|
||||
// if (fp == nullptr) {
|
||||
// QMessageBox::information(this, "Error", "Failed to open ServerSttings file");
|
||||
// return;
|
||||
// }
|
||||
// // 写入配置数据
|
||||
// fprintf(fp, "C/S_IP:%s\n",ui->CS_IP->text().toStdString().c_str());
|
||||
// fprintf(fp, "C/S_PORT:%s\n",ui->CS_Port->text().toStdString().c_str());
|
||||
// fprintf(fp, "Sub_Control_IP:%s\n",ui->Sub_IP->text().toStdString().c_str());
|
||||
// fprintf(fp, "Sub_Control_PORT:%s\n",ui->Sub_Port->text().toStdString().c_str());
|
||||
// fprintf(fp, "Sub_Control_Audio_PORT:%s\n",ui->Sub_Audio_Port->text().toStdString().c_str());
|
||||
// fprintf(fp, "Sub_Web_PORT:%s\n",ui->Web_Port->text().toStdString().c_str());
|
||||
// fprintf(fp, "Origins:%s\n",ui->Sub_Origins->text().toStdString().c_str());
|
||||
// fprintf(fp, "#中文简体,English\n");
|
||||
// fprintf(fp, "Language:%s\n",ui->LabguageBox->currentText().toStdString().c_str());
|
||||
// fprintf(fp, "OpenSleep:%d\n",ui->OpenSleep->value());
|
||||
// fprintf(fp, "State:%s\n",Configuration::State.c_str());
|
||||
// fprintf(fp, "CORSEn:%s\n",Configuration::CORSEn.c_str());
|
||||
// fprintf(fp, "FirstRun:%d\n",0);
|
||||
// fclose(fp);
|
||||
// fp = fopen(Configuration::WebCfgPath.c_str(), "w");
|
||||
// if (fp == nullptr) {
|
||||
// QMessageBox::information(this, "Error", "Failed to open NginxSttings file");
|
||||
// return;
|
||||
// }
|
||||
// // 写入配置数据
|
||||
// fprintf(fp, "worker_processes 1;\n"
|
||||
// "events {\n"
|
||||
// " worker_connections 1024;\n"
|
||||
// "}\n"
|
||||
// "http {\n"
|
||||
// " include mime.types;\n"
|
||||
// " default_type application/octet-stream;\n"
|
||||
// " sendfile on;\n"
|
||||
// " keepalive_timeout 65;\n"
|
||||
// " client_max_body_size 500m;\n"
|
||||
// " server {\n"
|
||||
// " listen %s;\n"
|
||||
// " server_name %s;\n"
|
||||
// " location / {\n"
|
||||
// " root html;\n"
|
||||
// " index index.html index.htm;\n"
|
||||
// " try_files $uri $uri/ /index.html;\n"
|
||||
// " # try_files $uri $uri/ @router;\n"
|
||||
// " }\n"
|
||||
// " location /api/ {\n"
|
||||
// " #rewrite ^.+api/?(.*)$ /$1 break; \n"
|
||||
// " rewrite ^/api/(.*)$ /$1 break; \n"
|
||||
// " proxy_pass http://%s:%s/;\n"
|
||||
// " proxy_redirect off;\n"
|
||||
// " proxy_set_header Host $host;\n"
|
||||
// " proxy_set_header X-Real-IP $remote_addr;\n"
|
||||
// " proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n"
|
||||
// " }\n"
|
||||
// " error_page 500 502 503 504 /50x.html;\n"
|
||||
// " location = /50x.html {\n"
|
||||
// " root html;\n"
|
||||
// " }\n"
|
||||
// " }\n"
|
||||
// "}",ui->Web_Port->text().toStdString().c_str(),ui->Web_IP->text().toStdString().c_str(),
|
||||
// ui->Sub_IP->text().toStdString().c_str(),ui->Sub_Port->text().toStdString().c_str());
|
||||
// fclose(fp);
|
||||
Configuration::CS_IP = ui->CS_IP->text().toStdString();
|
||||
Configuration::CS_Port = ui->CS_Port->text().toStdString();
|
||||
Configuration::Sub_IP = ui->Sub_IP->text().toStdString();
|
||||
@ -650,7 +595,8 @@ void Widget::SetAutoStart(const QString &path, bool enable) {
|
||||
QSettings startupSettings("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows", QSettings::NativeFormat);
|
||||
if (enable) {
|
||||
startupSettings.setValue("IPBS_Station(Web)", path);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
startupSettings.remove("IPBS_Station(Web)");
|
||||
}
|
||||
}
|
||||
@ -667,7 +613,8 @@ void Widget::slotCheckedChanged(int i) {
|
||||
CCString str = "IPBS_Start";
|
||||
if(ui->OpenPCStart->isChecked()){
|
||||
SetAutoStart(str.c_str(),true);
|
||||
} else{
|
||||
}
|
||||
else{
|
||||
SetAutoStart(str.c_str(),false);
|
||||
}
|
||||
str = Configuration::ExePath + QApplication::applicationName().toStdString() + ".exe.lnk";
|
||||
@ -718,23 +665,25 @@ void Widget::Deploy(QWidget* PR){
|
||||
Configuration::CloseSub_Server();
|
||||
Configuration::CloseSub_Web();
|
||||
if(ServerFlag){
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(PR, "提示",
|
||||
"检测到服务已经启动是否先停止?",
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(PR, Index::Lang("Hint").c_str(),
|
||||
Index::Lang("ErrorNote11").c_str(),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
ServerReRun();
|
||||
} else {
|
||||
QMessageBox::information(PR, "提示", "已取消快速配置!");
|
||||
}
|
||||
else {
|
||||
QMessageBox::information(PR, Index::Lang("Hint").c_str(),
|
||||
Index::Lang("ErrorNote12").c_str());
|
||||
}
|
||||
}
|
||||
boolean F1 = false,F2 = false;
|
||||
PrintMessage("正在配置IP-Web分控IP地址...");
|
||||
PrintMessage(Index::Lang("ErrorNote13"));
|
||||
while (true){
|
||||
CCThread::Sleep(1000 * 500);
|
||||
Configuration::ReadSub_IP();
|
||||
if(!Configuration::SubIPList.empty()){
|
||||
if(Configuration::SubIPList.size() > 1){
|
||||
PrintMessage("检测到多个IP地址,请选择要使用的IP地址!");
|
||||
PrintMessage(Index::Lang("ErrorNote14").c_str());
|
||||
CCVar* sub = new Sub_IPUI(nullptr);
|
||||
int top = this->geometry().top();
|
||||
int left = this->geometry().left();
|
||||
@ -746,37 +695,37 @@ void Widget::Deploy(QWidget* PR){
|
||||
sub->IPEdit = ui->Sub_IP;
|
||||
const int ret = sub->exec();
|
||||
if(ret == QDialog::Accepted){
|
||||
PrintMessage("Web分控IP地址配置完成!");
|
||||
PrintMessage(Index::Lang("ErrorNote15").c_str());
|
||||
}
|
||||
else if (ret == QDialog::Rejected){
|
||||
Configuration::Sub_IP = "";
|
||||
F2 = false;
|
||||
PrintMessage("Web分控IP地址配置跳过!");
|
||||
PrintMessage(Index::Lang("ErrorNote16").c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
Configuration::Sub_IP = Configuration::SubIPList[0];
|
||||
PrintMessage("Web分控IP地址配置完成!");
|
||||
PrintMessage(Index::Lang("ErrorNote17").c_str());
|
||||
}
|
||||
F2 = true;
|
||||
break;
|
||||
}
|
||||
else{
|
||||
bool A1 = false,A2 = false;
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(PR, "提示",
|
||||
"未检测到合法IPV4地址,请检查网络,是否继续检测?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(PR,
|
||||
Index::Lang("Hint").c_str(),Index::Lang("ErrorNote18").c_str(),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
A2 = true;
|
||||
A1 = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Configuration::Sub_IP = "";
|
||||
A2 = true;
|
||||
F2 = false;
|
||||
PrintMessage("Web分控IP地址配置跳过!");
|
||||
PrintMessage(Index::Lang("ErrorNote16").c_str());
|
||||
}
|
||||
// while (A2);
|
||||
if(A1){
|
||||
continue;
|
||||
}
|
||||
@ -785,40 +734,40 @@ void Widget::Deploy(QWidget* PR){
|
||||
}
|
||||
}
|
||||
}
|
||||
PrintMessage("正在配置C/S服务器参数...");
|
||||
PrintMessage(Index::Lang("ErrorNote19"));
|
||||
while (true){
|
||||
PrintMessage("尝试搜索C/S服务器中...");
|
||||
PrintMessage(Index::Lang("ErrorNote20"));
|
||||
CCThread::Sleep(1000 * 500);
|
||||
Configuration::ReadCSInfo();
|
||||
if(!Configuration::CSIPList.empty()){
|
||||
if(Configuration::CSIPList.size() > 1){
|
||||
PrintMessage("在局域网检测到多个C/S服务器,请选择需要使用的C/S服务器!");
|
||||
PrintMessage(Index::Lang("ErrorNote21"));
|
||||
CCVar* cs4 = new CSInfoW4(nullptr);
|
||||
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;
|
||||
const int h = screenHeight / 2 - (cs4->height() / 2) + top;
|
||||
cs4->move(w,h);
|
||||
cs4->IPEdit1 = ui->CS_IP;
|
||||
cs4->IPEdit2 = ui->CS_Port;
|
||||
const int ret = cs4->exec();
|
||||
if(ret == QDialog::Accepted){
|
||||
PrintMessage("C/S服务器信息配置完成");
|
||||
PrintMessage(Index::Lang("ErrorNote22"));
|
||||
}
|
||||
else if (ret == QDialog::Rejected){
|
||||
Configuration::CS_IP = "";
|
||||
Configuration::CS_Port = "";
|
||||
F1 = false;
|
||||
PrintMessage("C/S服务器信息配置跳过!");
|
||||
PrintMessage(Index::Lang("ErrorNote23"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
Configuration::CS_IP = Configuration::CSIPList[0];
|
||||
Configuration::CS_Port = Configuration::CSPortList[0].to_String();
|
||||
PrintMessage("C/S服务器信息配置完成");
|
||||
PrintMessage(Index::Lang("ErrorNote22"));
|
||||
}
|
||||
F1 = true;
|
||||
break;
|
||||
@ -827,9 +776,8 @@ void Widget::Deploy(QWidget* PR){
|
||||
bool A1 = false;
|
||||
Configuration::CS_IP = "";
|
||||
Configuration::CS_Port = "";
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(PR, "提示",
|
||||
"在局域网未检测到可用的C/S服务器,请先启动C/S服务器,是否继续检测?",
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
QMessageBox::StandardButton reply = QMessageBox::question(PR, Index::Lang("Hint").c_str(),
|
||||
Index::Lang("ErrorNote35").c_str(),QMessageBox::Yes | QMessageBox::No);
|
||||
if (reply == QMessageBox::Yes) {
|
||||
A1 = true;
|
||||
}
|
||||
@ -837,7 +785,7 @@ void Widget::Deploy(QWidget* PR){
|
||||
Configuration::CS_IP = "";
|
||||
Configuration::CS_Port = "";
|
||||
F1 = false;
|
||||
PrintMessage("C/S服务器信息配置跳过!");
|
||||
PrintMessage(Index::Lang("ErrorNote23"));
|
||||
A1 = false;
|
||||
}
|
||||
if(A1){
|
||||
@ -848,7 +796,7 @@ void Widget::Deploy(QWidget* PR){
|
||||
}
|
||||
}
|
||||
}
|
||||
PrintMessage("正在分配IP-Web分控服务端口...");
|
||||
PrintMessage(Index::Lang("ErrorNote24"));
|
||||
CCVar Ports = Configuration::getAvailablePorts(3,5417);
|
||||
if(Ports.size() == 3){
|
||||
Configuration::Sub_Port = Ports[0].to_String();
|
||||
@ -862,10 +810,10 @@ void Widget::Deploy(QWidget* PR){
|
||||
Configuration::Web_Port = "";
|
||||
Configuration::Web_IP = Configuration::Sub_IP = "";
|
||||
}
|
||||
PrintMessage("IP-Web分控服务端口分配完成!");
|
||||
PrintMessage("IP-Web分控服务正在设置跨域...");
|
||||
PrintMessage(Index::Lang("ErrorNote25"));
|
||||
PrintMessage(Index::Lang("ErrorNote26"));
|
||||
Configuration::Sub_Org = "['http://" + Configuration::Web_IP + ":" + Configuration::Web_Port + "']";
|
||||
PrintMessage("IP-Web分控服务跨域设置完成!");
|
||||
PrintMessage(Index::Lang("ErrorNote27"));
|
||||
ui->CS_IP->setText(Configuration::CS_IP.c_str());
|
||||
ui->CS_Port->setText(Configuration::CS_Port.c_str());
|
||||
ui->Sub_IP->setText(Configuration::Sub_IP.c_str());
|
||||
@ -881,10 +829,10 @@ void Widget::Deploy(QWidget* PR){
|
||||
ui->Web_Port->setText(Configuration::Web_Port.c_str());
|
||||
ui->Web_IP->setText(ui->Sub_IP->text());
|
||||
ui->OpenSleep->setValue(Configuration::OpenSleep);
|
||||
PrintMessage("IP-Web分控服务部署设置已完成!");
|
||||
PrintMessage("正在保存IP-Web分控服务设置...");
|
||||
PrintMessage(Index::Lang("ErrorNote28"));
|
||||
PrintMessage(Index::Lang("ErrorNote29"));
|
||||
SetServerConfig();
|
||||
PrintMessage("IP-Web分控服务设置保存完成");
|
||||
PrintMessage(Index::Lang("ErrorNote30"));
|
||||
if(F1 && F2){
|
||||
try {
|
||||
Configuration::terminateProcessByName("java");
|
||||
@ -903,51 +851,48 @@ void Widget::Deploy(QWidget* PR){
|
||||
std::cerr << "Error: " << e.what() << std::endl;
|
||||
}
|
||||
if(ui->CS_IP->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "C/S_IP不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote1").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->CS_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "C/S_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote2").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_IP->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_IP不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote3").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote4").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Web_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Web_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote5").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Web_IP->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Web_IP不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote6").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_Audio_Port->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_Audio_Port不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote7").c_str());
|
||||
return;
|
||||
}
|
||||
if(ui->Sub_Origins->text().isEmpty()){
|
||||
QMessageBox::information(this, "Error", "Sub_Origins不能为空");
|
||||
QMessageBox::information(this, "Error", Index::Lang("ErrorNote8").c_str());
|
||||
return;
|
||||
}
|
||||
PrintMessage("正在启动IP-Web分控服务...");
|
||||
PrintMessage(Index::Lang("ErrorNote31"));
|
||||
OpenServerClick();
|
||||
}
|
||||
else{
|
||||
QMetaObject::invokeMethod(this,[this,F1,F2]()
|
||||
{
|
||||
if(!F1){
|
||||
PrintMessage("在局域网未检测到C/S服务器,请检查C/S服务器!");
|
||||
}
|
||||
if(!F2){
|
||||
PrintMessage("未检测到合法IPV4地址,请检查网络!");
|
||||
}
|
||||
PrintMessage("部署未完成!");
|
||||
});
|
||||
if(!F1){
|
||||
PrintMessage(Index::Lang("ErrorNote32"));
|
||||
}
|
||||
if(!F2){
|
||||
PrintMessage(Index::Lang("ErrorNote33"));
|
||||
}
|
||||
PrintMessage(Index::Lang("ErrorNote34"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -975,7 +920,6 @@ bool Widget::checkAutoStartEntry(const QString &appName) {
|
||||
}
|
||||
|
||||
void Widget::LanguageSwitching() {
|
||||
Configuration::Language = ui->LabguageBox->currentText().toStdString();
|
||||
if(Configuration::Language == "English"){
|
||||
Index::Language = 1;
|
||||
}
|
||||
@ -1005,9 +949,12 @@ void Widget::LanguageSwitching() {
|
||||
ui->HomeBtn->setText(Index::Lang("HomeBtn").c_str());
|
||||
ui->SettingsBtn->setText(Index::Lang("SettingsBtn").c_str());
|
||||
ui->label_13->setText(Index::Lang("label_13").c_str());
|
||||
ui->ReadCSInfoBtn->setText(Index::Lang("Choose").c_str());
|
||||
ui->SelectSub_IPBtn->setText(Index::Lang("Choose").c_str());
|
||||
}
|
||||
|
||||
void Widget::onCurrentIndexChanged_t(int index) {
|
||||
Configuration::Language = ui->LabguageBox->currentText().toStdString();
|
||||
LanguageSwitching();
|
||||
}
|
||||
|
||||
|
||||
@ -1,26 +1,24 @@
|
||||
#include "widgetyz.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ui_widgetYZ.h"
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
#include "UI/Language/Index.h"
|
||||
|
||||
widgetYZ::widgetYZ(QWidget *parent) :QWidget(parent), ui(new Ui::widgetYZ) {
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(this->windowFlags() &~ Qt::WindowMaximizeButtonHint);
|
||||
connect(ui->YZQRBtn, &QPushButton::clicked,this, &widgetYZ::QRBtnFun);
|
||||
connect(ui->YZQXBtn, &QPushButton::clicked,this, &widgetYZ::QXBtnFun);
|
||||
LanguageSwitching();
|
||||
}
|
||||
|
||||
widgetYZ::~widgetYZ() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void widgetYZ::QRBtnFun()
|
||||
{
|
||||
if(ui->YZMMInput->text() == "123456")
|
||||
{
|
||||
void widgetYZ::QRBtnFun(){
|
||||
if(ui->YZMMInput->text() == "123456"){
|
||||
auto* win = new widget3();
|
||||
// 获取屏幕的几何尺寸
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
@ -32,13 +30,19 @@ void widgetYZ::QRBtnFun()
|
||||
win->show();
|
||||
this->close();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, "提示", "密码错误!");
|
||||
else{
|
||||
QMessageBox::warning(nullptr, Index::Lang("Hint").c_str(),
|
||||
Index::Lang("IncorrectPassword").c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void widgetYZ::QXBtnFun()
|
||||
{
|
||||
void widgetYZ::QXBtnFun(){
|
||||
this->close();
|
||||
}
|
||||
|
||||
void widgetYZ::LanguageSwitching() {
|
||||
ui->label->setText(Index::Lang("label_tyz").c_str());
|
||||
ui->YZMMInput->setPlaceholderText(Index::Lang("YZMMInput_tyz").c_str());
|
||||
ui->YZQRBtn->setText(Index::Lang("YZQRBtn").c_str());
|
||||
ui->YZQXBtn->setText(Index::Lang("YZQXBtn").c_str());
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ public:
|
||||
~widgetYZ() override;
|
||||
void QRBtnFun();
|
||||
void QXBtnFun();
|
||||
void LanguageSwitching();
|
||||
|
||||
private:
|
||||
Ui::widgetYZ *ui;
|
||||
|
||||
@ -5,12 +5,13 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ui_widget3.h"
|
||||
|
||||
#include "UI/Language/Index.h"
|
||||
|
||||
widget3::widget3(QWidget *parent) :QWidget(parent), ui(new Ui::widget3) {
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(this->windowFlags() &~ Qt::WindowMaximizeButtonHint);
|
||||
connect(ui->LogoBtn, &QPushButton::clicked,this, &widget3::SelectFile);
|
||||
LanguageSwitching();
|
||||
}
|
||||
|
||||
widget3::~widget3() {
|
||||
@ -66,4 +67,11 @@ void widget3::SelectFile() {
|
||||
catch (const std::exception& e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void widget3::LanguageSwitching(){
|
||||
this->setWindowTitle(Index::Lang("W3Title").c_str());
|
||||
ui->LogoBtn->setText(Index::Lang("LogoBtn").c_str());
|
||||
ui->localUpdate->setText(Index::Lang("localUpdate").c_str());
|
||||
ui->label_11->setText(Index::Lang("label_11").c_str());
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ public:
|
||||
explicit widget3(QWidget *parent = nullptr);
|
||||
~widget3() override;
|
||||
void SelectFile();
|
||||
void LanguageSwitching();
|
||||
|
||||
private:
|
||||
Ui::widget3 *ui;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "ui_CSInfoW4.h"
|
||||
|
||||
#include "UI/Language/Index.h"
|
||||
|
||||
CSInfoW4::CSInfoW4(QWidget *parent) :QDialog(parent), ui(new Ui::CSInfoW4) {
|
||||
ui->setupUi(this);
|
||||
@ -22,11 +22,13 @@ CSInfoW4::CSInfoW4(QWidget *parent) :QDialog(parent), ui(new Ui::CSInfoW4) {
|
||||
ui->listViewCS_IP->setModel(model);
|
||||
ui->listViewCS_IP->setFocusPolicy(Qt::NoFocus);
|
||||
},this);
|
||||
|
||||
LanguageSwitching();
|
||||
}
|
||||
|
||||
CSInfoW4::~CSInfoW4() {
|
||||
delete model;
|
||||
if(model){
|
||||
delete model;
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -46,3 +48,9 @@ void CSInfoW4::QueRBtn1(){
|
||||
void CSInfoW4::QuXiaoBtn1(){
|
||||
reject(); // 关闭对话框并返回 Rejected
|
||||
}
|
||||
|
||||
void CSInfoW4::LanguageSwitching() {
|
||||
ui->label->setText(Index::Lang("W4Title").c_str());
|
||||
ui->QuXiaoBtn1->setText(Index::Lang("YZQXBtn").c_str());
|
||||
ui->QueRBtn1->setText(Index::Lang("YZQRBtn").c_str());
|
||||
}
|
||||
|
||||
@ -21,10 +21,11 @@ public:
|
||||
void QuXiaoBtn1();
|
||||
QLineEdit *IPEdit1 = nullptr;
|
||||
QLineEdit *IPEdit2 = nullptr;
|
||||
void LanguageSwitching();
|
||||
|
||||
private:
|
||||
Ui::CSInfoW4 *ui;
|
||||
QStringListModel *model;
|
||||
QStringListModel *model = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "sub_ipui.h"
|
||||
#include "ui_Sub_IPUI.h"
|
||||
|
||||
#include "UI/Language/Index.h"
|
||||
|
||||
Sub_IPUI::Sub_IPUI(QWidget *parent) :QDialog(parent), ui(new Ui::Sub_IPUI) {
|
||||
ui->setupUi(this);
|
||||
@ -17,10 +17,13 @@ Sub_IPUI::Sub_IPUI(QWidget *parent) :QDialog(parent), ui(new Ui::Sub_IPUI) {
|
||||
model->setStringList(data);
|
||||
ui->listViewCS_IP->setModel(model);
|
||||
ui->listViewCS_IP->setFocusPolicy(Qt::NoFocus);
|
||||
LanguageSwitching();
|
||||
}
|
||||
|
||||
Sub_IPUI::~Sub_IPUI() {
|
||||
delete model;
|
||||
if(model){
|
||||
delete model;
|
||||
}
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -34,3 +37,9 @@ void Sub_IPUI::QueRBtn1(){
|
||||
void Sub_IPUI::QuXiaoBtn1(){
|
||||
this->reject();
|
||||
}
|
||||
|
||||
void Sub_IPUI::LanguageSwitching() {
|
||||
ui->label->setText(Index::Lang("W5Title").c_str());
|
||||
ui->QuXiaoBtn1->setText(Index::Lang("YZQXBtn").c_str());
|
||||
ui->QueRBtn1->setText(Index::Lang("YZQRBtn").c_str());
|
||||
}
|
||||
|
||||
@ -19,10 +19,11 @@ public:
|
||||
void QueRBtn1();
|
||||
void QuXiaoBtn1();
|
||||
QLineEdit *IPEdit = nullptr;
|
||||
void LanguageSwitching();
|
||||
|
||||
private:
|
||||
Ui::Sub_IPUI *ui;
|
||||
QStringListModel *model;
|
||||
QStringListModel *model = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user