diff --git a/ClockCounter.sln b/ClockCounter.sln index 33b609c..154b5ae 100644 --- a/ClockCounter.sln +++ b/ClockCounter.sln @@ -8,13 +8,19 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Debug|x64.ActiveCfg = Debug|x64 {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Debug|x64.Build.0 = Debug|x64 + {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Debug|x86.ActiveCfg = Debug|Win32 + {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Debug|x86.Build.0 = Debug|Win32 {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Release|x64.ActiveCfg = Release|x64 {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Release|x64.Build.0 = Release|x64 + {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Release|x86.ActiveCfg = Release|Win32 + {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ClockCounter/ACIFullVersion.h b/ClockCounter/ACIFullVersion.h index 2cba4b0..7b2bcee 100644 --- a/ClockCounter/ACIFullVersion.h +++ b/ClockCounter/ACIFullVersion.h @@ -63,7 +63,7 @@ private: private: static size_t process_data(void* buffer, size_t size, size_t nmemb, void* user_p); public: - ACIClient(int server_port = 10000); + ACIClient(int server_port = 10000, std::string target_ip = "127.0.0.1"); ~ACIClient(); public: bool SendData(std::string item, std::string data, ClientCallback cb_func = nullptr); @@ -154,6 +154,7 @@ public: void Run(int worker_thread = 1, int loop_thread = 1); void ThreadRun(int worker_thread = 1, int loop_thread = 1); void Stop(); + bool IsRunning(); bool EnableCallback(ServerInputCallback cb_func = nullptr); bool SetCallbackFunction(ServerInputCallback cb_func); bool DisableCallback(); diff --git a/ClockCounter/ACIFullVersion.lib b/ClockCounter/ACIFullVersion.lib index 3cfa0e4..be2329f 100644 Binary files a/ClockCounter/ACIFullVersion.lib and b/ClockCounter/ACIFullVersion.lib differ diff --git a/ClockCounter/ACIFullVersiond.lib b/ClockCounter/ACIFullVersiond.lib index 5967413..90d990a 100644 Binary files a/ClockCounter/ACIFullVersiond.lib and b/ClockCounter/ACIFullVersiond.lib differ diff --git a/ClockCounter/ACIMode.cpp b/ClockCounter/ACIMode.cpp index 105fcf9..1b663f3 100644 --- a/ClockCounter/ACIMode.cpp +++ b/ClockCounter/ACIMode.cpp @@ -9,7 +9,8 @@ ACIMode::ACIMode(QWidget* parent) : QMainWindow(parent) ui.setupUi(this); ui.Workmode_Client->setChecked(true); ui.Workmode_Server->setChecked(false); - ui.PortNumber->setPlainText("23456"); + ui.IP->installEventFilter(this); + ui.PortNumber->installEventFilter(this); connect(ui.BtnStart, &QCommandLinkButton::clicked, this, &ACIMode::StartACISystem); } @@ -54,7 +55,7 @@ void ACIMode::StartACISystem() { CleanUp(); OperationMode = 0; - client = new ACIClient(ui.PortNumber->toPlainText().toInt()); + client = new ACIClient(ui.PortNumber->toPlainText().toInt(), ui.IP->toPlainText().toStdString()); this->hide(); break; } @@ -101,6 +102,21 @@ void ACIMode::closeEvent(QCloseEvent* event) event->ignore(); } +bool ACIMode::eventFilter(QObject* watched, QEvent* event) +{ + if (watched == ui.IP) + { + if (event->type() == QEvent::FocusIn) + ui.IP->grabKeyboard(); + } + else if (watched == ui.PortNumber) + { + if (event->type() == QEvent::FocusIn) + ui.PortNumber->grabKeyboard(); + } + return QWidget::eventFilter(watched, event); +} + std::string RequestedTimerStart(std::string json) { GlobalVari::ServerRequested = true; diff --git a/ClockCounter/ACIMode.h b/ClockCounter/ACIMode.h index 4637675..516a094 100644 --- a/ClockCounter/ACIMode.h +++ b/ClockCounter/ACIMode.h @@ -25,6 +25,7 @@ public: protected: void closeEvent(QCloseEvent* event) override; + bool eventFilter(QObject* watched, QEvent* event) override; private: int OperationMode; diff --git a/ClockCounter/ACIMode.ui b/ClockCounter/ACIMode.ui index b99fa94..9852d08 100644 --- a/ClockCounter/ACIMode.ui +++ b/ClockCounter/ACIMode.ui @@ -7,7 +7,7 @@ 0 0 262 - 241 + 261 @@ -20,7 +20,7 @@ 10 10 241 - 171 + 191 @@ -30,11 +30,17 @@ 70 - 30 + 60 161 31 + + false + + + 23456 + true @@ -43,7 +49,7 @@ 20 - 30 + 60 41 31 @@ -56,7 +62,7 @@ 10 - 80 + 100 221 71 @@ -91,12 +97,56 @@ + + + + 20 + 20 + 41 + 31 + + + + IP地址 + + + + + + 70 + 20 + 161 + 31 + + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + false + + + 127.0.0.1 + + + 1 + + + true + + 60 - 190 + 210 141 41 diff --git a/ClockCounter/ClockCounter.cpp b/ClockCounter/ClockCounter.cpp index f9be516..caf0c15 100644 --- a/ClockCounter/ClockCounter.cpp +++ b/ClockCounter/ClockCounter.cpp @@ -66,19 +66,27 @@ void ClockCounter::StartTimer() this->setWindowTitle("软件执行计时器: 正在计时"); } } + else + { + CountTimer.start(); + this->setWindowTitle("软件执行计时器: 正在计时"); + } } } void ClockCounter::StopTimer() { - CountTimer.stop(); - if (GlobalVari::ServerRequested && (aci_mode_window.GetOperationMode() == 1)) + if (CountTimer.isActive()) { - GlobalVari::ServerRequested = false; - ServerStatusChecker.start(); + CountTimer.stop(); + if (GlobalVari::ServerRequested && (aci_mode_window.GetOperationMode() == 1)) + { + GlobalVari::ServerRequested = false; + ServerStatusChecker.start(); + } + ui.BtnStartTimer->setText("重置计时器"); + this->setWindowTitle("软件执行计时器: 计时已停止"); } - ui.BtnStartTimer->setText("重置计时器"); - this->setWindowTitle("软件执行计时器: 计时已停止"); } void ClockCounter::ShowACIModeWindow() diff --git a/ClockCounter/ClockCounter.vcxproj b/ClockCounter/ClockCounter.vcxproj index ab48756..909f181 100644 --- a/ClockCounter/ClockCounter.vcxproj +++ b/ClockCounter/ClockCounter.vcxproj @@ -1,10 +1,18 @@  + + Debug + Win32 + Debug x64 + + Release + Win32 + Release x64 @@ -14,7 +22,9 @@ {D0E21A4E-4B89-4861-86DC-3C3C6D1E10C8} QtVS_v304 10.0.22621.0 + 10.0.22621.0 10.0.22621.0 + 10.0.22621.0 $(MSBuildProjectDirectory)\QtMsBuild @@ -22,10 +32,18 @@ Application v143 + + Application + v143 + Application v143 + + Application + v143 + @@ -35,11 +53,21 @@ core;gui;widgets debug + + 6.3.1_msvc2019_64 + core;gui;widgets + debug + 6.3.1_msvc2019_64 core;gui;widgets release + + 6.3.1_msvc2019_64 + core;gui;widgets + release + @@ -49,21 +77,62 @@ + + + + + + + + + F:\QtGUIlib\qucsdk\include;$(IncludePath) + F:\QtGUIlib\qucsdk\bin;$(LibraryPath) + + + F:\QtGUIlib\qucsdk\include;$(IncludePath) + F:\QtGUIlib\qucsdk\bin;$(LibraryPath) F:\QtGUIlib\qucsdk\include;$(IncludePath) F:\QtGUIlib\qucsdk\bin;$(LibraryPath) + true + + + F:\QtGUIlib\qucsdk\include;$(IncludePath) + F:\QtGUIlib\qucsdk\bin;$(LibraryPath) + true quc.lib;%(AdditionalDependencies) + + stdcpp17 + + + + + quc.lib;%(AdditionalDependencies) + + + stdcpp17 + + + + + qucd.lib;%(AdditionalDependencies) + + + + + qucd.lib;%(AdditionalDependencies) + @@ -78,6 +147,19 @@ true + + + true + true + ProgramDatabase + Disabled + MultiThreadedDebugDLL + + + Windows + true + + true @@ -91,6 +173,19 @@ false + + + true + true + None + MaxSpeed + MultiThreadedDLL + + + Windows + false + + diff --git a/ClockCounter/PreClick.cpp b/ClockCounter/PreClick.cpp index e2cfad3..ccf7b37 100644 --- a/ClockCounter/PreClick.cpp +++ b/ClockCounter/PreClick.cpp @@ -54,6 +54,7 @@ void PreClick::StartCursorTrack() else { CursorUpdate.start(); + this->grabKeyboard(); ui.BtnGetPos->setText("停止获取"); } }