fix server bug
This commit is contained in:
@@ -5,6 +5,7 @@ ACIMode::ACIMode(QWidget* parent) : QMainWindow(parent)
|
||||
client = nullptr;
|
||||
server = nullptr;
|
||||
OperationMode = -3;
|
||||
ServerRunning = false;
|
||||
ui.setupUi(this);
|
||||
ui.Workmode_Client->setChecked(true);
|
||||
ui.Workmode_Server->setChecked(false);
|
||||
@@ -46,20 +47,33 @@ void ACIMode::CleanUp()
|
||||
|
||||
void ACIMode::StartACISystem()
|
||||
{
|
||||
CleanUp();
|
||||
OperationMode = ProcessRadio(ui.Workmode_Client->isChecked(), ui.Workmode_Server->isChecked());
|
||||
switch (OperationMode)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
CleanUp();
|
||||
OperationMode = 0;
|
||||
client = new ACIClient(ui.PortNumber->toPlainText().toInt());
|
||||
this->hide();
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (ServerRunning)
|
||||
{
|
||||
CleanUp();
|
||||
ServerRunning = false;
|
||||
ui.BtnStart->setText("启动通信系统");
|
||||
}
|
||||
else
|
||||
{
|
||||
server = new ACIServer(ui.PortNumber->toPlainText().toInt());
|
||||
ServerDataStorage::DDROutputAdd("start-timer", RequestedTimerStart);
|
||||
server->ThreadRun();
|
||||
ServerRunning = true;
|
||||
ui.BtnStart->setText("关闭通信系统");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -68,8 +82,6 @@ void ACIMode::StartACISystem()
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (OperationMode == 0)
|
||||
this->hide();
|
||||
}
|
||||
|
||||
int ACIMode::GetOperationMode()
|
||||
|
||||
@@ -30,6 +30,7 @@ private:
|
||||
int OperationMode;
|
||||
ACIClient* client;
|
||||
ACIServer* server;
|
||||
bool ServerRunning;
|
||||
Ui::ACIModeWindow ui;
|
||||
};
|
||||
|
||||
|
||||
@@ -56,7 +56,10 @@ void ClockCounter::StartTimer()
|
||||
{
|
||||
MouseClick(PreClickCount, PreClickPosition);
|
||||
if (aci_mode_window.GetOperationMode() == 0)
|
||||
{
|
||||
aci_mode_window.RequestRemoteTimer();
|
||||
this->setWindowTitle("软件执行计时器: 远程计时请求已发出");
|
||||
}
|
||||
else
|
||||
{
|
||||
CountTimer.start();
|
||||
@@ -69,6 +72,11 @@ void ClockCounter::StartTimer()
|
||||
void ClockCounter::StopTimer()
|
||||
{
|
||||
CountTimer.stop();
|
||||
if (GlobalVari::ServerRequested && (aci_mode_window.GetOperationMode() == 1))
|
||||
{
|
||||
GlobalVari::ServerRequested = false;
|
||||
ServerStatusChecker.start();
|
||||
}
|
||||
ui.BtnStartTimer->setText("重置计时器");
|
||||
this->setWindowTitle("软件执行计时器: 计时已停止");
|
||||
}
|
||||
@@ -81,8 +89,6 @@ void ClockCounter::ShowACIModeWindow()
|
||||
aci_mode_window.activateWindow();
|
||||
aci_mode_window.setWindowState((aci_mode_window.windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
|
||||
ServerStatusChecker.start();
|
||||
/*this->hide();
|
||||
WindowUpdater.start();*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,10 +152,7 @@ void ClockCounter::WindowUpdateCallback()
|
||||
void ClockCounter::ServerStatusCallback()
|
||||
{
|
||||
if (aci_mode_window.GetOperationMode() == 0)
|
||||
{
|
||||
ServerStatusChecker.stop();
|
||||
this->hide();
|
||||
}
|
||||
else if (aci_mode_window.GetOperationMode() == 1)
|
||||
{
|
||||
if (GlobalVari::ServerRequested)
|
||||
|
||||
Reference in New Issue
Block a user