Compare commits

..

No commits in common. 'develop' and 'master' have entirely different histories.

136
.gitignore vendored

@ -1,80 +1,56 @@
bin/
.idea/
# ---> Qt
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*.user
*_qmlcache.qrc
LaunchRegisterKey.vcxproj
LaunchRegisterKey.vcxproj.filters
.vs/LaunchRegisterKey/FileContentIndex/aaaaca74-5a29-4c9c-a0b2-4aafa2ded7c4.vsidx
.vs/LaunchRegisterKey/v17/.suo
.vs/LaunchRegisterKey/v17/Browse.VC.db
.vs/LaunchRegisterKey/v17/Browse.VC.db-shm
.vs/LaunchRegisterKey/v17/Browse.VC.db-wal
.vs/LaunchRegisterKey/v17/Browse.VC.opendb
.vs/LaunchRegisterKey/v17/ipch/AutoPCH/33033be55980b52b/WIDGET.ipch
.vs/LaunchRegisterKey/v17/ipch/AutoPCH/71f3d9e241800f09/SETTINGWGT.ipch
.vs/LaunchRegisterKey/v17/ipch/AutoPCH/b58d33b68fb99398/COMMON.ipch
.vs/LaunchRegisterKey/v17/ipch/AutoPCH/e407f47aecf49074/UDPDATATHREAD.ipch
debug/
release/
.vs/
LaunchRe.82F475D3.tlog/
qmake/
LaunchRegisterKey.log
LaunchRegisterKey.sln
qt_work.log
vc141.pdb
vcpkg.applocal.log
CMakeLists.txt
bin/
# ---> Qt
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib
# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl
# Qt unit tests
target_wrapper.*
# QtCreator
*.autosave
# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*
# QtCreator CMake
CMakeLists.txt.user*
# QtCreator 4.8< compilation database
compile_commands.json
# QtCreator local machine specific files for imported projects
*creator.user*
*_qmlcache.qrc

@ -1,12 +1,9 @@
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
QT += core gui network sql
QT += core gui network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
RC_ICONS = resources/icon.ico
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
@ -21,23 +18,20 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \
common.cpp \
main.cpp \
network/udpdatahandler.cpp \
network/udpdatathread.cpp \
network/udpsocketworker.cpp \
ui/countdownmessagebox.cpp \
ui/settingwgt.cpp \
ui/widget.cpp
HEADERS += \
common.h \
network/udpdatahandler.h \
network/udpdatathread.h \
network/udpsocketworker.h \
third_party/logger/EasySpdLog.h \
third_party/nlohmann/json.hpp \
third_party/nlohmann/json_fwd.hpp \
ui/countdownmessagebox.h \
ui/settingwgt.h \
ui/widget.h \
utils/interface.h
ui/widget.h
FORMS += \
ui/settingwgt.ui \

@ -0,0 +1,319 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.0, 2024-08-30T08:59:15. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{f213a5b1-fd80-4b82-9045-7920f30d1a64}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">0</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.1 MSVC2017 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.1 MSVC2017 32bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5141.win32_msvc2017_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Project/VMAX/VMAXWeb/LaunchRegisterKey/bin</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Project/VMAX/VMAXWeb/build-LaunchRegisterKey-Desktop_Qt_5_14_1_MSVC2017_32bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Project/VMAX/VMAXWeb/build-LaunchRegisterKey-Desktop_Qt_5_14_1_MSVC2017_32bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Project/VMAX/VMAXWeb/LaunchRegisterKey/LaunchRegisterKey.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Project/VMAX/VMAXWeb/LaunchRegisterKey/LaunchRegisterKey.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">D:/Project/VMAX/VMAXWeb/LaunchRegisterKey/bin</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

@ -1,9 +1,6 @@
#pragma execution_character_set("utf-8")
#include "common.h"
#include "common.h"
#include <fstream>
#include <QDir>
#include <QSettings>
#include <QDebug>
using namespace nlohmann;
@ -15,47 +12,37 @@ Common::Common()
bool Common::loadConfig(const QString &filePath)
{
try
m_configFilePath = filePath;
std::ifstream jsonStream(filePath.toLocal8Bit());
m_configJson = json::parse(jsonStream);
jsonStream.close();
// 提取网络配置
auto netCfg = m_configJson.at("network");
m_ipAddr = QString::fromStdString(netCfg["ip"]);
m_srcPort = netCfg["src_port"];
m_dstPort = netCfg["dst_port"];
// 提取工作模式
auto workmodes = m_configJson.at("workmode");
for (const auto& workmode : workmodes)
{
// 提取网络配置
QString iniFilePath = filePath + "/network.ini";
QSettings* configIni = new QSettings(iniFilePath, QSettings::IniFormat);
m_ipAddr = configIni->value("network/ip").toString();
m_srcPort = configIni->value("network/src_port").toInt();
m_dstPort = configIni->value("network/dst_port").toInt();
m_configFilePath = filePath + "/Config.json";
std::ifstream jsonStream(m_configFilePath.toLocal8Bit());
m_configJson = json::parse(jsonStream);
jsonStream.close();
// 提取工作模式
auto workmodes = m_configJson.at("workmode");
for (const auto& workmode : workmodes)
{
QString name = QString::fromStdString(workmode["name"]);
int index = workmode["index"];
QString path = QString::fromStdString(workmode["exe_path"]);
QString reworkPath = QString::fromStdString(workmode["rework_exe_path"]);
m_modeConfigs[index] = ModeConfig{ index, name, path, reworkPath };
}
// 提取产品配置
auto products = m_configJson.at("products");
for (const auto& product : products)
{
int index = product["index"];
bool selected = product["selected"];
int mode = product["mode"];
QString formatStr = QString::fromStdString(product["format"]);
m_productConfigs[index] = ProductConfig{ index, static_cast<Mode>(mode), selected, formatStr };
}
FilterSelectedProducts();
return true;
QString name = QString::fromStdString(workmode["name"]);
int index = workmode["index"];
QString path = QString::fromStdString(workmode["exe_path"]);
QString reworkPath = QString::fromStdString(workmode["rework_exe_path"]);
m_modeConfigs[index] = ModeConfig{index, name, path, reworkPath};
}
catch(const std::exception& e)
{
LError(QString("Load config file error: %1").arg(e.what()));
return false;
// 提取产品配置
auto products = m_configJson.at("products");
for (const auto& product : products)
{
int index = product["index"];
bool selected = product["selected"];
int mode = product["mode"];
QString formatStr = QString::fromStdString(product["format"]);
m_productConfigs[index] = ProductConfig{index, static_cast<Mode>(mode), selected, formatStr};
}
FilterSelectedProducts();
return true;
}
bool Common::saveConfig(const QMap<int, ProductConfig> &productsCfg, const QMap<int, ModeConfig> &workmodeCfg)
@ -66,14 +53,7 @@ bool Common::saveConfig(const QMap<int, ProductConfig> &productsCfg, const QMap<
return true;
}
bool Common::updateProductsConfig(const QMap<int, ProductConfig> &productsCfg)
{
setProductConfig(productsCfg);
saveConfig();
return true;
}
QString Common::getIPAddr() const
QString Common::getHostAddress() const
{
return m_ipAddr;
}
@ -88,24 +68,12 @@ int Common::getDstPort() const
return m_dstPort;
}
const QString Common::getCurrWorkModeStr() const
{
if (m_currentMode.load() == -1)
{
return getWorkModeStr(-1);
}
QString reStr = m_isRepair.load() == 1 ? "反修" : "正常";
QString logStr = QString("%1-%2").arg(getWorkModeStr(m_currentMode.load())).arg(reStr);
return logStr;
}
bool Common::saveConfig()
{
std::ofstream outFile(m_configFilePath.toLocal8Bit());
if (!outFile)
{
LError("Write config json file error!");
qDebug() << "无法打开文件进行写入!";
return false;
}
outFile << m_configJson.dump(4);
@ -177,23 +145,3 @@ void Common::setCurrentWorkMode(const int workMode)
{
m_currentMode.store(workMode);
}
bool Common::getRepairFlag() const
{
return m_isRepair.load();
}
void Common::setRepairFlag(const bool isRepair)
{
m_isRepair.store(isRepair);
}
QString Common::getWorkModeStr(int mode)
{
static QMap<int, QString> modeMap = { {-1, "未连接"}, {2, "GLOBAL_M2M"}, {3, "LOCAL_M2M"}};
if (!modeMap.contains(mode))
{
return "unknown mode";
}
return modeMap[mode];
}

@ -5,49 +5,52 @@
#include "utils/Singleton.h"
#include <QString>
#include <QMap>
#include "utils/interface.h"
#include "nlohmann/json.hpp"
#include "EasySpdLog.h"
enum Mode
{
GLOBAL,
LOCAL,
};
#define TEST_MODE
struct ModeConfig
{
int index;
QString name;
QString workPath;
QString reworkPath;
};
struct ProductConfig
{
int productId;
Mode workMode;
bool selected;
QString productFormat;
};
class Common : public QObject, public Singleton<Common>
{
Q_OBJECT
friend class Singleton<Common>;
public:
// 加载Config文件
bool loadConfig(const QString& filePath);
// 保存到Config文件
bool saveConfig(const QMap<int, ProductConfig> &productsCfg, const QMap<int, ModeConfig> &workmodeCfg);
// 更新产品配置文件
bool updateProductsConfig(const QMap<int, ProductConfig> &productsCfg);
// 获取IP地址
QString getIPAddr() const;
// 获取端口号
bool saveConfig(const QMap<int, ProductConfig>& productsCfg, const QMap<int, ModeConfig>& workmodeCfg);
QString getHostAddress() const;
int getSrcPort() const;
int getDstPort() const;
const QString getCurrWorkModeStr() const;
// 获取产品配置
QMap<int, ProductConfig> getProductConfigs();
// 设置产品配置
void setProductConfig(const QMap<int, ProductConfig>& productsCfg);
// 获取工作模式
QMap<int, ModeConfig> getWorkModeConfigs();
// 设置工作模式
void setWorkModeConfigs(const QMap<int, ModeConfig>& workmodeCfg);
// 获取已选择的工作模式
const QMap<QString, Mode>& getSelectedProducts() const;
// 获取当前工作模式
int getCurrentWorkMode() const;
// 设置当前工作模式
void setCurrentWorkMode(const int workMode);
bool getRepairFlag() const;
void setRepairFlag(const bool isRepair);
static QString getWorkModeStr(int mode);
signals:
private:
@ -56,18 +59,16 @@ private:
void FilterSelectedProducts();
private:
QString m_configFilePath{}; // 配置文件路径
QString m_configFilePath{};
nlohmann::json m_configJson{};
QString m_currentWorkPath{}; // 当前工作路径
std::atomic<int> m_currentMode{ -1 }; // 当前正在进行的工作模式
std::atomic<bool> m_isRepair{ false };
std::atomic<int> m_currentMode{ -1 }; // 当前正在进行的工作模式
QString m_ipAddr{};
int m_dstPort{};
int m_srcPort{};
QMap<int, ModeConfig> m_modeConfigs{}; // 模式配置
QMap<int, ProductConfig> m_productConfigs{}; // 产品配置
QMap<QString, Mode> m_selectedProduct{}; // 选择的产品
std::atomic<bool> m_isLockSNLineEdit{false};
};
#endif // COMMON_H

@ -1,9 +1,7 @@
#pragma execution_character_set("utf-8")
#include "widget.h"
#include "widget.h"
#include <QApplication>
#include <QMessageBox>
#include "common.h"
#include "EasySpdLog.h"
int main(int argc, char *argv[])
@ -12,13 +10,6 @@ int main(int argc, char *argv[])
// 初始化日志类
auto loggerPath = QString(QApplication::applicationDirPath() + "/logs/log.log").toLocal8Bit();
SetLogger(loggerPath.data());
// 加载配置文件
QString filePath = QApplication::applicationDirPath() + "/config";
if (!Common::GetInstance()->loadConfig(filePath))
{
QMessageBox::warning(nullptr, "错误", "配置文件加载失败!\n 请检查配置文件是否存在或格式是否正确!");
return 0;
}
//
Widget w;
w.move(0, 0);

@ -1,124 +0,0 @@
#pragma execution_character_set("utf-8")
#include "udpdatahandler.h"
#include <QHostAddress>
#include "common.h"
#include "EasySpdLog.h"
#include <QDebug>
UdpDataHandler::UdpDataHandler(QObject *parent)
: QObject(parent)
, m_workerThread(new QThread())
, m_udpWorker(nullptr)
, m_checkConnectTimer(new QTimer(this))
, m_connectStatus(false)
, m_isSending(false)
{
auto ipAddr = Common::GetInstance()->getIPAddr();
auto recvPort = Common::GetInstance()->getSrcPort();
m_hostAddr.setAddress(ipAddr);
m_udpWorker = new UdpSocketWorker(m_hostAddr, recvPort);
m_udpWorker->moveToThread(m_workerThread);
m_workerThread->start();
connect(m_udpWorker, &UdpSocketWorker::dataReceived, this, &UdpDataHandler::recvData);
connect(m_checkConnectTimer, &QTimer::timeout, this, &UdpDataHandler::checkConnectSlot);
m_checkConnectTimer->start(1000);
}
UdpDataHandler::~UdpDataHandler()
{
}
void UdpDataHandler::sendSnId(const QString &data)
{
QString snMsg = QString("5901%1%2").arg(data.length()).arg(data);
m_udpWorker->startSending("send_sn", snMsg.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
}
void UdpDataHandler::sendStop()
{
m_isSending = false;
}
void UdpDataHandler::sendClose()
{
QString msg = QString("%1%2").arg(CONSTHEAD).arg("0301");
m_udpWorker->startSending("iecs_close", msg.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
}
void UdpDataHandler::stopClose()
{
m_udpWorker->stopSending("iecs_close");
}
void UdpDataHandler::recvData(const QByteArray &data)
{
if (data.size() == 0)
return;
QString dataStr(data);
if (dataStr.mid(0, 2).toInt() != CONSTHEAD)
return;
int msgType = dataStr.mid(2, 2).toInt();
switch(msgType)
{
case SIGNAL_BEATSRC:
{
m_connectStatus = true;
int type = dataStr.mid(6, 1).toInt();
Common::GetInstance()->setCurrentWorkMode(type);
emit GetConnStatusSig(true);
break;
}
case SIGNAL_SN:
{
int status = dataStr.mid(4, 3).toInt();
if (status == 11)
{
m_udpWorker->stopSending("send_sn");
}
else
{
LWarn("Unknown SIGNAL_SN:{}", data);
}
break;
}
case SIGNAL_DONE:
{
int status = dataStr.mid(4, 2).toInt();
bool ret = dataStr.mid(6, 1).toInt();
if (status == 1)
{
emit GetDoneSig(ret);
}
QString snMsg = QString("590200");
m_udpWorker->sendData(snMsg.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
break;
}
default:
LWarn("Unknow message:{}", data);
break;
}
}
void UdpDataHandler::checkConnectSlot()
{
static int times = 0;
if (!m_connectStatus)
{
times++;
}
else
{
times = 0;
}
if (times >= 3)
{
Common::GetInstance()->setCurrentWorkMode(-1);
emit GetConnStatusSig(false);
times = 0;
}
m_connectStatus = false;
}

@ -0,0 +1,96 @@
#include "udpdatathread.h"
#include <QHostAddress>
#include "common.h"
#include <QDebug>
#define MAXSIZES 1024
UdpDataThread::UdpDataThread(QObject *parent)
: QObject(parent)
, m_workerThread(new QThread())
, m_udpWorker(nullptr)
, m_checkConnectTimer(new QTimer(this))
, m_connectStatus(false)
, m_isSending(false)
{
auto ipAddr = Common::GetInstance()->getHostAddress();
auto recvPort = Common::GetInstance()->getSrcPort();
m_hostAddr.setAddress(ipAddr);
m_udpWorker = new UdpSocketWorker(m_hostAddr, recvPort);
m_udpWorker->moveToThread(m_workerThread);
m_workerThread->start();
connect(m_udpWorker, &UdpSocketWorker::dataReceived, this, &UdpDataThread::recvData);
connect(m_checkConnectTimer, &QTimer::timeout, this, &UdpDataThread::checkConnectSlot);
m_checkConnectTimer->start(1000);
}
UdpDataThread::~UdpDataThread()
{
}
void UdpDataThread::sendSnId(const QString &data)
{
m_udpWorker->startSending("send_sn", data.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
}
void UdpDataThread::sendStop()
{
m_isSending = false;
}
void UdpDataThread::sendClose()
{
QString msg = QString("%1%2").arg(CONSTHEAD).arg("0301");
m_udpWorker->startSending("iecs_close", msg.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
}
void UdpDataThread::stopClose()
{
m_udpWorker->stopSending("iecs_close");
}
void UdpDataThread::recvData(const QByteArray &data)
{
if (data.size() == 0)
return;
QString dataStr(data);
if (dataStr.mid(0, 2).toInt() != CONSTHEAD)
return;
int msgType = dataStr.mid(2, 2).toInt();
switch(msgType)
{
case SIGNAL_BEATSRC:
{
m_connectStatus = true;
int type = dataStr.mid(4, 2).toInt();
Common::GetInstance()->setCurrentWorkMode(type);
emit connectStatus(true);
break;
}
default:
break;
}
}
void UdpDataThread::checkConnectSlot()
{
static int times = 0;
if (!m_connectStatus)
{
times++;
}
else
{
times = 0;
}
if (times >= 3)
{
emit connectStatus(false);
qDebug()<<"disconnect";
times = 0;
}
m_connectStatus = false;
}

@ -13,27 +13,22 @@ typedef enum {
SIGNAL_BEATDST //外挂软件状态
}SIGNALTYPE;
#define CONSTHEAD 59 //数据头
#define CONSTHEAD 59
class UdpDataHandler : public QObject
class UdpDataThread : public QObject
{
Q_OBJECT
public:
UdpDataHandler(QObject *parent = nullptr);
~UdpDataHandler();
// 循环发送产品SN号
void sendSnId(const QString &data);
// 停止发送产品SN号
UdpDataThread(QObject *parent = nullptr);
~UdpDataThread();
void send_circle(const QString& data);
void sendSnId(const QString& data);
void sendStop();
// 发送关闭信号
void sendClose();
// 停止发送关闭信号
void stopClose();
signals:
// 连接状态信号
void GetConnStatusSig(bool);
// 注KEY是否完成信号
void GetDoneSig(bool);
void connectStatus(bool);
private slots:
void recvData(const QByteArray &data);
void checkConnectSlot();
@ -44,7 +39,7 @@ private:
QHostAddress m_hostAddr;
QTimer *m_checkConnectTimer;
// 判断注KEY软件状态
std::atomic<bool> m_connectStatus;
volatile bool m_connectStatus;
volatile bool m_isSending;
QString m_currSn;
};

@ -2,7 +2,5 @@
<qresource prefix="/">
<file>resources/folding.png</file>
<file>resources/unfolding.png</file>
<file>resources/icon.ico</file>
<file>resources/icon.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

@ -1,37 +0,0 @@
#pragma execution_character_set("utf-8")
#include "countdownmessagebox.h"
CountdownMessageBox::CountdownMessageBox(int timeoutSeconds, QWidget *parent)
: QMessageBox(parent)
, m_timeoutSeconds(timeoutSeconds)
{
// 初始显示时间
setText(tr("还有%1秒关闭...").arg(m_timeoutSeconds));
// 创建定时器
m_timer = new QTimer(this);
connect(m_timer, &QTimer::timeout, this, &CountdownMessageBox::updateCountdown);
m_timer->start(1000); // 每秒触发一次
}
void CountdownMessageBox::showCountdownMessageBox(QWidget *parent, int timeoutSeconds, const QString &title)
{
CountdownMessageBox msgBox(timeoutSeconds, parent);
msgBox.setWindowTitle(title);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}
void CountdownMessageBox::updateCountdown()
{
if (m_timeoutSeconds > 0)
{
--m_timeoutSeconds;
setText(tr("还有%1秒关闭...").arg(m_timeoutSeconds));
}
else
{
m_timer->stop();
accept(); // 关闭对话框
}
}

@ -1,19 +0,0 @@
#ifndef COUNTDOWNMESSAGEBOX_H
#define COUNTDOWNMESSAGEBOX_H
#include <QMessageBox>
#include <QTimer>
class CountdownMessageBox : public QMessageBox
{
public:
explicit CountdownMessageBox(int timeoutSeconds, QWidget *parent = nullptr);
static void showCountdownMessageBox(QWidget *parent, int timeoutSeconds, const QString &title);
private slots:
void updateCountdown();
private:
int m_timeoutSeconds;
QTimer *m_timer;
};
#endif // COUNTDOWNMESSAGEBOX_H

@ -17,12 +17,13 @@ SettingWgt::SettingWgt(QWidget *parent) :
ui(new Ui::SettingDlg)
{
ui->setupUi(this);
QString filePath = QApplication::applicationDirPath() + "/config/Config.json";
Common::GetInstance()->loadConfig(filePath);
m_productsCfg = Common::GetInstance()->getProductConfigs();
m_workmodesCfg = Common::GetInstance()->getWorkModeConfigs();
m_productNums = m_productsCfg.size();
m_workModeNums = m_workmodesCfg.size();
initUI(); //一定放在前面
loadConfig();
}
SettingWgt::~SettingWgt()
@ -41,30 +42,25 @@ void SettingWgt::initUI()
{
QGroupBox *groupBox = new QGroupBox(workmodeCfg.name, ui->frame_set_mode);
QGridLayout *groupLayout = new QGridLayout(groupBox);
QLabel *nameLab = new QLabel("正常", groupBox);
groupLayout->addWidget(nameLab, 0, 0);
QLineEdit *workPathEdit = new QLineEdit(workmodeCfg.workPath, groupBox);
workPathEdit->setEnabled(false);
groupLayout->addWidget(workPathEdit, 0, 1);
QPushButton *selectworkPathBtn = new QPushButton("<", groupBox);
selectworkPathBtn->setMaximumWidth(30);
groupLayout->addWidget(selectworkPathBtn, 0, 2);
connect(selectworkPathBtn, &QPushButton::clicked, selectWorkPathMapper, qOverload<>(&QSignalMapper::map));
selectWorkPathMapper->setMapping(selectworkPathBtn, workmodeCfg.index);
selectworkPathBtn->hide();
QLabel *reworknameLab = new QLabel("返工", groupBox);
groupLayout->addWidget(reworknameLab, 1, 0);
QLineEdit *reworkPathEdit = new QLineEdit(workmodeCfg.reworkPath, groupBox);
groupLayout->addWidget(reworkPathEdit, 1, 1);
reworkPathEdit->setEnabled(false);
QPushButton *selectReworkPathBtn = new QPushButton("<", groupBox);
selectReworkPathBtn->setMaximumWidth(30);
groupLayout->addWidget(selectReworkPathBtn, 1, 2);
connect(selectReworkPathBtn, &QPushButton::clicked, selectReworkPathMapper, qOverload<>(&QSignalMapper::map));
selectReworkPathMapper->setMapping(selectReworkPathBtn, workmodeCfg.index);
selectReworkPathBtn->hide();
m_workPathLineEdits.insert(workmodeCfg.index, qMakePair(workPathEdit, reworkPathEdit));
@ -105,65 +101,50 @@ void SettingWgt::initUI()
layout->addWidget(checkbox, i + 1, 1);
// 产品SN适配设置输入框创建
QLineEdit *lineEdit = new QLineEdit(ui->frame_setting);
lineEdit->setEnabled(false);
//lineEdit->setEnabled(false);
m_snFormatLineEdits.push_back(lineEdit);
layout->addWidget(lineEdit, i + 1, 2);
// 工作模式下拉框创建
QComboBox *comboBox = new QComboBox(ui->frame_setting);
for (const auto& productCfg : m_workmodesCfg)
{
comboBox->addItem(productCfg.name, productCfg.index);
}
comboBox->addItem("GLOBAL", 0);
comboBox->addItem("LOCAL", 1);
m_modeComboBoxes.push_back(comboBox);
layout->addWidget(comboBox, i + 1, 3);
comboBox->setEnabled(false);
}
// 将 QSignalMapper 的信号连接到槽函数
connect(checkBoxMapper, static_cast<void(QSignalMapper::*)(int)>(&QSignalMapper::mapped), this, &SettingWgt::onCheckBoxStateChanged);
loadConfig();
}
void SettingWgt::loadConfig()
{
// 显示产品配置
for (const auto product : m_productsCfg)
for (const auto& product : m_productsCfg)
{
int index = product.productId;
bool selected = product.selected;
int mode = product.workMode;
m_snFormatLineEdits[index - 1]->setText(product.productFormat);
m_selectCheckBoxes[index - 1]->setCheckState(selected ? Qt::Checked : Qt::Unchecked);
int pos = m_modeComboBoxes[index - 1]->findData(QVariant(mode));
if (pos != -1)
{
m_modeComboBoxes[index - 1]->setCurrentIndex(pos);
}
m_modeComboBoxes[index - 1]->setCurrentIndex(mode);
}
}
void SettingWgt::onCheckBoxStateChanged(int index)
{
QCheckBox *checkBox = m_selectCheckBoxes[index];
if (checkBox)
if (checkBox && checkBox->isChecked())
{
if (checkBox->isChecked())
QString formatStr = m_snFormatLineEdits[index]->text();
if (formatStr.isEmpty())
{
QString formatStr = m_snFormatLineEdits[index]->text();
if (formatStr.isEmpty())
{
checkBox->setCheckState(Qt::Unchecked);
QMessageBox::warning(this, "启用失败", "产品SN适配为空请先进行设置再进行启用");
return;
}
checkBox->setCheckState(Qt::Unchecked);
QMessageBox::warning(this, "启用失败", "产品SN适配为空请先进行设置再进行启用");
}
m_productsCfg[index + 1].selected = checkBox->isChecked();
Common::GetInstance()->updateProductsConfig(m_productsCfg);
}
}
void SettingWgt::SelectPathButton_clicked(int index, bool isRework)
{
LTrace("Function enter");
// 定义选择的路径和是否是 reworkPath 的标志
QString exe_path = QFileDialog::getOpenFileName(this, tr("选择可执行程序"),
QCoreApplication::applicationDirPath(),
@ -184,17 +165,11 @@ void SettingWgt::SelectPathButton_clicked(int index, bool isRework)
void SettingWgt::on_pushButton_ok_clicked()
{
LTrace("Function enter");
for (int i = 0 ; i < m_productNums; ++i)
{
m_productsCfg[i + 1].selected = m_selectCheckBoxes[i]->isChecked();
m_productsCfg[i + 1].productFormat = m_snFormatLineEdits[i]->text().trimmed();
m_productsCfg[i + 1].workMode = static_cast<Mode>(m_modeComboBoxes[i]->currentData().toInt());
}
for (auto& workmodeCfg : m_workmodesCfg)
{
workmodeCfg.workPath = m_workPathLineEdits[workmodeCfg.index].first->text().trimmed();
workmodeCfg.reworkPath = m_workPathLineEdits[workmodeCfg.index].second->text().trimmed();
m_productsCfg[i + 1].workMode = static_cast<Mode>(m_modeComboBoxes[i]->currentIndex());
}
Common::GetInstance()->saveConfig(m_productsCfg, m_workmodesCfg);
emit SettingFinishSig();

@ -7,7 +7,6 @@
#include <QLineEdit>
#include <QComboBox>
#include <QGroupBox>
#include <QPushButton>
#include "common.h"
#include "nlohmann/json.hpp"
@ -45,7 +44,6 @@ private:
QMap<int, ProductConfig> m_productsCfg;
QMap<int, ModeConfig> m_workmodesCfg;
uint m_productNums;
uint m_workModeNums;
};
#endif // SETTINGDLG_H

@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,7">
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,7,1">
<item>
<widget class="QFrame" name="frame_set_mode">
<property name="frameShape">
@ -34,6 +34,30 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_ok">
<property name="text">
<string>确认</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>

@ -2,21 +2,9 @@
#include "widget.h"
#include "ui_widget.h"
#include <windows.h>
#include <tlhelp32.h>
#include <QDateTime>
#include <QHBoxLayout>
#include <QMessageBox>
#include <QEventLoop>
#include <QSqlQuery>
#include <QSqlError>
#include <QProcess>
#include <QDir>
#include <QRegularExpression>
#include "countdownmessagebox.h"
#include "common.h"
#include <QDebug>
@ -27,36 +15,29 @@ Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
, m_settingDlg(new SettingWgt(this))
, m_udpDataThread(new UdpDataHandler(this))
, m_udpDataThread(new UdpDataThread(this))
, m_showSetting(false)
{
QString filePath = QApplication::applicationDirPath() + "/config/Config.json";
Common::GetInstance()->loadConfig(filePath);
ui->setupUi(this);
initUI();
connect(m_settingDlg, &SettingWgt::SettingFinishSig, this, &Widget::on_pushButton_setting_clicked);
connect(m_udpDataThread, &UdpDataHandler::GetDoneSig, this, &Widget::RegisterDoneSlot);
connect(m_udpDataThread, &UdpDataHandler::GetConnStatusSig, this, &Widget::GetConnStatusSlot);
addLogItem("程序初始化成功!");
ProcessJudgment();
connect(m_settingDlg, &SettingWgt::SettingFinishSig, [this](){
on_pushButton_setting_clicked();
});
}
Widget::~Widget()
{
delete ui;
if (m_db.isOpen())
{
m_db.close();
QSqlDatabase::removeDatabase(QSqlDatabase::defaultConnection);
}
}
void Widget::initUI()
{
this->setWindowTitle("LaunchRegisterKey");
this->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint);
//this->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
this->setWindowIcon(QIcon(":/resources/icon.ico"));
this->setWindowTitle("");
//this->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint);
this->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::CustomizeWindowHint);
ui->list_log->setEditTriggers(QAbstractItemView::NoEditTriggers);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(m_settingDlg);
@ -68,9 +49,8 @@ void Widget::initUI()
void Widget::setSNLineEditFocus()
{
// 全选LineEdit并且焦点放在LineEdit上
ui->lineEdit_snId->clear();
ui->lineEdit_snId->selectAll();
ui->lineEdit_snId->setFocus();
this->activateWindow();
}
int Widget::checkSNId(const QString &snId)
@ -78,308 +58,31 @@ int Widget::checkSNId(const QString &snId)
if (snId.isEmpty())
{
QMessageBox::warning(this, "产品SN错误", "产品SN为空! 请重新扫码!");
addLogItem("产品SN为空! 请重新扫码!");
LWarn("Product SN id is empty!");
return SNEmptyError;
return -1;
}
QRegExp reg("[a-z]");
if (reg.indexIn(snId) != -1)
{
QMessageBox::information(this,"提示",QString("产品SN(%1)包含小写! 请重新扫码!").arg(snId));
addLogItem(QString("产品SN(%1)包含小写! 请重新扫码!").arg(snId));
LWarn("Product SN contains lowercase!");
ui->lineEdit_snId->setText("");
return SNLowerCaseError;
return -1;
}
if (snId.contains(" "))
{
QMessageBox::information(this,"提示",QString("产品SN(%1)包含空格! 请重新扫码!").arg(snId));
addLogItem(QString("产品SN(%1)包含空格! 请重新扫码!").arg(snId));
LWarn("Product SN contains Spaces!");
ui->lineEdit_snId->setText("");
return SNSpaceError;
}
return NoError;
}
int Widget::startIECSProgram(const QString& workPath, const QString& snId)
{
LInfo("Function enter");
QProcess *process = new QProcess(this);
connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
process, &QProcess::deleteLater);
// 使用 cmd.exe 来启动进程并使用 start 命令使其脱离父进程
QString command = QString("cmd.exe /C start \"\" \"%1\"").arg(workPath);
process->start(command);
if (!process->waitForStarted())
{
LError("Failed to start the program with arguments: {}", process->errorString());
process->deleteLater();
addLogItem(QString("%1启动失败").arg(workPath));
return ExecIECSError;
}
LInfo("Process started: {}", workPath);
return NoError;
}
int Widget::checkForRepairProgram(const int mode, const QString& sn, bool& isFind)
{
auto workModeCfg = Common::GetInstance()->getWorkModeConfigs();
QDir workDir(workModeCfg[mode].workPath);
if (!workDir.cdUp())
{
LError("Workdir cd up failed!");
return -1;
}
QString dbPath = workDir.absolutePath() + "/config.db";
return databaseQuery(dbPath, sn, isFind);
}
int Widget::databaseQuery(const QString& databasePath, const QString& deviceSn, bool& isFind)
{
// 静态变量来保存上一次使用的数据库路径
static QString previousDatabasePath;
// 如果数据库路径发生变动,关闭之前的连接并移除数据库
if (m_db.isOpen() && previousDatabasePath != databasePath) {
m_db.close();
QSqlDatabase::removeDatabase(QSqlDatabase::defaultConnection);
}
// 如果数据库尚未打开或路径已变动,重新打开数据库
if (!m_db.isOpen() || previousDatabasePath != databasePath) {
m_db = QSqlDatabase::addDatabase("QSQLITE");
m_db.setDatabaseName(databasePath); // 使用传入的数据库路径
if (!m_db.open()) {
LError("Failed to open database:{}", m_db.lastError().text());
isFind = false;
return DatabaseOpenError;
}
// 更新路径
previousDatabasePath = databasePath;
}
// 创建查询对象
QSqlQuery query(m_db);
// 准备 SQL 查询
query.prepare("SELECT COUNT(1) FROM history WHERE device_sn = :device_sn;");
query.bindValue(":device_sn", deviceSn);
// 执行查询
if (!query.exec()) {
LError("Failed to execute query:{}", query.lastError().text());
isFind = false;
return DatabaseSelectError;
}
// 处理查询结果
if (query.next()) {
int count = query.value(0).toInt();
isFind = (count > 0);
return NoError;
}
isFind = false;
return DatabaseUnknownError;
}
// 判断是否为单板 SN
static bool isSingleBoardSN(const QString& sn) {
// 单板 SN 格式9位前缀-固定12位尾数
QRegularExpression regex("^\\d{9}-[A-Z0-9]{12}$");
return regex.match(sn).hasMatch();
}
// 判断是否为整机 SN
static bool isCompleteMachineSN(const QString& sn) {
// 整机 SN 格式前25位前缀-固定8位尾数
QRegularExpression regex("^.{25}[A-Z0-9]{10,}$");
return sn.contains('#') && regex.match(sn).hasMatch();
}
bool Widget::identifyProduct(const QString &sn, int &mode)
{
const auto selectedProducts = Common::GetInstance()->getSelectedProducts();
if (isSingleBoardSN(sn))
{
QString productKey = sn.mid(9); // 提取单板 SN 的尾数部分
if (selectedProducts.contains(productKey))
{
mode = selectedProducts[productKey];
return true; // 返回匹配的产品名称
}
}
else if (isCompleteMachineSN(sn))
{
QString productKey = sn.mid(25); // 提取整机 SN 的尾数部分
if (selectedProducts.contains(productKey))
{
mode = selectedProducts[productKey];
return true; // 返回匹配的产品名称
}
}
return false;
}
void Widget::RegisterDoneSlot(bool ret)
{
if (ret)
{
addLogItem("注KEY成功");
}
else
{
addLogItem("注KEY失败请检查对应程序注KEY详情");
}
ui->lineEdit_snId->setEnabled(true);
ui->pushButton_sendSnId->setEnabled(true);
setSNLineEditFocus();
}
void Widget::GetConnStatusSlot(bool ret)
{
if (ret)
{
//Common::GetInstance()->
setWindowTitle(QString("LaunchRegisterKey-已连接"));
}
else
{
setWindowTitle("LaunchRegisterKey-未连接");
}
}
// 辅助函数:比较进程路径和目标路径
static bool isMatchingProcess(const QString& processPath, const QString& targetPath) {
return processPath.compare(targetPath, Qt::CaseInsensitive) == 0;
}
bool Widget::ProcessJudgment()
{
// 创建一个快照来获取当前系统的所有进程
HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE)
{
qWarning() << "Failed to create process snapshot.";
return false;
}
PROCESSENTRY32 pe32{};
pe32.dwSize = sizeof(PROCESSENTRY32);
if (!Process32First(hProcessSnap, &pe32))
{
qWarning() << "Failed to retrieve process information.";
CloseHandle(hProcessSnap);
return false;
}
const auto& workModeCfgs = Common::GetInstance()->getWorkModeConfigs();
do {
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pe32.th32ProcessID);
if (!hProcess)
{
continue; // 无法打开进程,继续下一个进程
}
WCHAR exePath[MAX_PATH];
DWORD size = MAX_PATH;
if (QueryFullProcessImageName(hProcess, 0, exePath, &size))
{
QString processPath = QDir::fromNativeSeparators(QString::fromWCharArray(exePath));
for (const auto& workmodeCfg : workModeCfgs)
{
int matchedType = -1; // 用于保存匹配的路径类型
if (isMatchingProcess(processPath, workmodeCfg.workPath))
{
matchedType = 0; // workPath 匹配
}
else if (isMatchingProcess(processPath, workmodeCfg.reworkPath))
{
matchedType = 1; // reworkPath 匹配
}
if (matchedType != -1)
{
Common::GetInstance()->setCurrentWorkMode(workmodeCfg.index);
Common::GetInstance()->setRepairFlag(matchedType == 1); // 如果是 reworkPath设置为 true
QString logStr = QString("正在使用%1").arg(Common::GetInstance()->getCurrWorkModeStr());
addLogItem(logStr);
qDebug() << "Matching process found:"
<< QString::fromWCharArray(pe32.szExeFile)
<< "PID:" << pe32.th32ProcessID
<< "Path:" << processPath
<< "Matched Type:" << (matchedType == 0 ? "workPath" : "reworkPath");
CloseHandle(hProcess);
CloseHandle(hProcessSnap);
return true;
}
}
}
CloseHandle(hProcess); // 确保句柄被关闭
} while (Process32Next(hProcessSnap, &pe32));
CloseHandle(hProcessSnap);
qDebug() << "No matching process found.";
return false;
}
bool Widget::isProcessRunningWithName(const QString& processNamePart)
{
// 创建一个快照来获取当前系统的所有进程
HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE) {
qWarning() << "Failed to create process snapshot.";
return false;
}
// 初始化进程信息结构体
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(PROCESSENTRY32);
// 获取第一个进程信息
if (!Process32First(hProcessSnap, &pe32)) {
qWarning() << "Failed to retrieve process information.";
CloseHandle(hProcessSnap);
return false;
}
// 遍历所有进程
do {
// 将进程名称转换为QString
QString processName = QString::fromWCharArray(pe32.szExeFile);
// 判断进程名称是否包含指定字符串
if (processName.contains(processNamePart, Qt::CaseInsensitive)) {
qDebug() << "Found matching process:" << processName;
CloseHandle(hProcessSnap);
return true; // 找到匹配的进程,返回 true
}
} while (Process32Next(hProcessSnap, &pe32));
// 关闭快照句柄
CloseHandle(hProcessSnap);
return false;
return 0;
}
void Widget::on_pushButton_setting_clicked()
{
static auto initSize = this->size();
if (ui->widget_setting->isHidden())
{
ui->pushButton_setting->setIcon(QIcon(":/resources/folding.png"));
ui->widget_setting->show();
m_settingDlg->loadConfig();
ui->widget_setting->show();
int currentWidth = this->width();
this->adjustSize();
this->resize(currentWidth, this->height()); // 只保持高度变化
@ -390,7 +93,7 @@ void Widget::on_pushButton_setting_clicked()
ui->widget_setting->hide();
int currentWidth = this->width();
this->adjustSize();
this->resize(initSize); // 只保持高度变化
this->resize(currentWidth, this->height()); // 只保持高度变化
setSNLineEditFocus();
}
}
@ -401,71 +104,11 @@ void Widget::addLogItem(const QString &text)
{
delete ui->list_log->takeItem(0);
}
QString dateTimeStr = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
ui->list_log->addItem(dateTimeStr + " " + text); // 添加新条目
ui->list_log->scrollToBottom(); // 滚动到底部
}
int Widget::switchProgram(const QString snId, const int mode, const bool isRepair)
{
LTrace("Function enter");
static bool isFirstRepair = true;
if (isRepair && isFirstRepair)
{
isFirstRepair = false;
CountdownMessageBox::showCountdownMessageBox(this, 3, "启用返修程序包!");
}
else if (!isRepair)
{
isFirstRepair = true;
}
auto workModeCfgs = Common::GetInstance()->getWorkModeConfigs();
auto workModeCfg = workModeCfgs[mode];
QString workPath = isRepair ? workModeCfg.reworkPath : workModeCfg.workPath;
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [this, timer, snId, workPath]() {
static int times = 0;
if (Common::GetInstance()->getCurrentWorkMode() == -1)
{
m_udpDataThread->stopClose();
if (!isProcessRunningWithName("IECS"))
{
timer->stop(); // 停止定时器
times = 0;
// 启动 IECS 程序
if (startIECSProgram(workPath, snId) != NoError)
{
ui->lineEdit_snId->setEnabled(true);
ui->pushButton_sendSnId->setEnabled(true);
QMessageBox::warning(this, "程序启动失败!", QString("启动%1失败请检查程序路径").arg(workPath));
return;
}
// 发送 SN ID 和记录日志
m_udpDataThread->sendSnId(snId);
addLogItem(QString("已发送产品SN%1").arg(snId));
}
else
{
times++;
if (times >= 10)
{
times = 0;
timer->stop();
ui->lineEdit_snId->setEnabled(true);
ui->pushButton_sendSnId->setEnabled(true);
QMessageBox::warning(this, "程序启动失败!", QString("启动%1失败进程已存在").arg(workPath));
}
}
}
});
timer->start(1000);
return 0;
ui->list_log->addItem(text); // 添加新条目
}
void Widget::on_lineEdit_snId_returnPressed()
{
LTrace("Function enter");
QString snId = ui->lineEdit_snId->text();
int ret = 0;
ret = checkSNId(snId);
@ -474,44 +117,31 @@ void Widget::on_lineEdit_snId_returnPressed()
LError("checkSNId error!code:{}", ret);
return;
}
int snMode = -1;
if (!identifyProduct(snId, snMode))
const auto selectedProducts = Common::GetInstance()->getSelectedProducts();
QString productFormat{};
for (auto& products : selectedProducts.keys())
{
QMessageBox::information(this, "警告", "当前SN与启用设值SN不匹配请检查设置或重新扫码");
return;
if (snId.contains(products))
{
productFormat = products;
break;
}
}
ui->lineEdit_snId->setEnabled(false);
ui->pushButton_sendSnId->setEnabled(false);
LInfo("SN ID:{}, Mode:{}", snId, snMode);
auto currWorkMode = Common::GetInstance()->getCurrentWorkMode();
bool repairFlag = Common::GetInstance()->getRepairFlag();
bool isRepair = false;
// 查找数据库,判断是否需要返修程序
ret = checkForRepairProgram(snMode, snId, isRepair);
if (ret != NoError)
if (productFormat.isEmpty())
{
LError("checkForRepairProgram error!{}", ret);
QMessageBox::information(this, "警告", "当前SN与启用设值SN不匹配请检查或重新扫码");
return;
}
if (snMode != currWorkMode || isRepair != repairFlag)
auto currWorkMode = Common::GetInstance()->getCurrentWorkMode();
if (selectedProducts[productFormat] != currWorkMode)
{
Common::GetInstance()->setRepairFlag(isRepair);
QString reStr = isRepair ? "反修" : "正常";
QString logStr = QString("启动%1-%2").arg(Common::getWorkModeStr(snMode)).arg(reStr);
addLogItem(logStr);
// 切换工作模式
if (currWorkMode != -1)
{
m_udpDataThread->sendClose();
}
//TODO:不相等时m_udpDataThread发送关闭信号等待Common单例类中的标志位变成-1后m_udpDataThread停止发送关闭信号并启动IECS程序
//同时需要去IECS程序路径中查找数据库判断是否使用返修程序
switchProgram(snId, snMode, isRepair);
qDebug()<<"not match!!!";
m_udpDataThread->sendClose();
return;
//TODO:不相等时需要结束当前的IECS程序如果为-1则代表没有IECS程序执行直接启动IECS程序即可
//同时需要去IECS程序路径中查找数据库判断是否使用返修程序
}
m_udpDataThread->sendSnId(snId);
addLogItem(QString("已发送产品SN%1").arg(snId));
}
void Widget::on_pushButton_sendSnId_clicked()

@ -2,10 +2,8 @@
#define WIDGET_H
#include <QWidget>
#include <QSqlDatabase>
#include "settingwgt.h"
#include "udpdatahandler.h"
#include "udpdatathread.h"
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
@ -21,31 +19,17 @@ private:
void initUI();
void setSNLineEditFocus();
int checkSNId(const QString& snId);
int startIECSProgram(const QString& workPath, const QString& snId);
int checkForRepairProgram(const int mode, const QString& sn, bool& isFind);
int databaseQuery(const QString& databasePath, const QString& deviceSn, bool& isFind);
bool identifyProduct(const QString& sn, int& mode);
private slots:
void RegisterDoneSlot(bool ret);
void GetConnStatusSlot(bool ret);
bool ProcessJudgment();
bool isProcessRunningWithName(const QString& processNamePart);
void addLogItem(const QString& text);
int switchProgram(const QString snId, const int mode, const bool isRepair);
void on_pushButton_setting_clicked();
void on_lineEdit_snId_returnPressed();
void on_pushButton_sendSnId_clicked();
private:
Ui::Widget *ui;
SettingWgt *m_settingDlg;
UdpDataHandler *m_udpDataThread;
UdpDataThread *m_udpDataThread;
bool m_showSetting;
QSqlDatabase m_db;
};
#endif // WIDGET_H

@ -1,47 +0,0 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include <QString>
#include <QMap>
enum ErrorCode
{
NoError = 0,
// SN相关错误
SNEmptyError = 1, // 产品SN为空
SNLowerCaseError, // 产品SN小写字母
SNSpaceError, // 产品SN包含空格
SNFormatError, // 产品SN格式错误
// 数据库相关错误
DatabaseOpenError, // 打开数据库失败
DatabaseReadError, // 读取数据库失败
DatabaseWriteError, // 写入数据库失败
DatabaseSelectError, // 选择数据库失败
DatabaseUnknownError, // 未知数据库错误
// 执行程序相关错误
ExecIECSError, // 执行IECS失败
};
enum Mode
{
GLOBAL,
LOCAL,
GLOBALM2M,
LOCALM2M,
};
struct ModeConfig
{
int index;
QString name;
QString workPath;
QString reworkPath;
};
struct ProductConfig
{
int productId;
Mode workMode;
bool selected;
QString productFormat;
};
#endif // INTERFACE_H
Loading…
Cancel
Save