feat:初步实现基本功能

develop
lichongyuan 3 months ago
parent 7f8a507546
commit 930c75b87b

17
.gitignore vendored

@ -1,4 +1,5 @@
bin/ bin/
.idea/
# ---> Qt # ---> Qt
# C++ objects and libs # C++ objects and libs
*.slo *.slo
@ -51,6 +52,20 @@ CMakeLists.txt.user*
compile_commands.json compile_commands.json
# QtCreator local machine specific files for imported projects # QtCreator local machine specific files for imported projects
*creator.user* *.user
*_qmlcache.qrc *_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/

@ -1,4 +1,4 @@
QT += core gui network QT += core gui network sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@ -31,7 +31,8 @@ HEADERS += \
third_party/nlohmann/json.hpp \ third_party/nlohmann/json.hpp \
third_party/nlohmann/json_fwd.hpp \ third_party/nlohmann/json_fwd.hpp \
ui/settingwgt.h \ ui/settingwgt.h \
ui/widget.h ui/widget.h \
utils/interface.h
FORMS += \ FORMS += \
ui/settingwgt.ui \ ui/settingwgt.ui \

@ -1,319 +0,0 @@
<?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>

@ -5,29 +5,9 @@
#include "utils/Singleton.h" #include "utils/Singleton.h"
#include <QString> #include <QString>
#include <QMap> #include <QMap>
#include "utils/interface.h"
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include "EasySpdLog.h" #include "EasySpdLog.h"
enum Mode
{
GLOBAL,
LOCAL,
};
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> class Common : public QObject, public Singleton<Common>
{ {

@ -1,8 +1,9 @@
#include "udpdatathread.h" #include "udpdatathread.h"
#include <QHostAddress> #include <QHostAddress>
#include "common.h" #include "common.h"
#include "EasySpdLog.h"
#include <QDebug> #include <QDebug>
#define MAXSIZES 1024
UdpDataThread::UdpDataThread(QObject *parent) UdpDataThread::UdpDataThread(QObject *parent)
: QObject(parent) : QObject(parent)
@ -31,7 +32,9 @@ UdpDataThread::~UdpDataThread()
void UdpDataThread::sendSnId(const QString &data) void UdpDataThread::sendSnId(const QString &data)
{ {
m_udpWorker->startSending("send_sn", data.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort()); QString snMsg = QString("5901%1%2").arg(data.length()).arg(data);
//m_udpWorker->sendData(snMsg.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
m_udpWorker->startSending("send_sn", snMsg.toLocal8Bit(), m_hostAddr, Common::GetInstance()->getDstPort());
} }
void UdpDataThread::sendStop() void UdpDataThread::sendStop()
@ -57,19 +60,42 @@ void UdpDataThread::recvData(const QByteArray &data)
QString dataStr(data); QString dataStr(data);
if (dataStr.mid(0, 2).toInt() != CONSTHEAD) if (dataStr.mid(0, 2).toInt() != CONSTHEAD)
return; return;
int msgType = dataStr.mid(2, 2).toInt(); int msgType = dataStr.mid(2, 2).toInt();
switch(msgType) switch(msgType)
{ {
case SIGNAL_BEATSRC: case SIGNAL_BEATSRC:
{ {
m_connectStatus = true; m_connectStatus = true;
int type = dataStr.mid(4, 2).toInt(); int type = dataStr.mid(6, 1).toInt();
Common::GetInstance()->setCurrentWorkMode(type); Common::GetInstance()->setCurrentWorkMode(type);
emit connectStatus(true); emit connectStatus(true);
break; break;
} }
case SIGNAL_SN:
{
int status = dataStr.mid(4, 3).toInt();
if (status == 11)
{
m_udpWorker->stopSending("send_sn");
}
else
{
qDebug()<<"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 registerRet(ret);
}
break;
}
default: default:
qDebug()<<"data:"<<data;
break; break;
} }
@ -88,6 +114,7 @@ void UdpDataThread::checkConnectSlot()
} }
if (times >= 3) if (times >= 3)
{ {
Common::GetInstance()->setCurrentWorkMode(-1);
emit connectStatus(false); emit connectStatus(false);
qDebug()<<"disconnect"; qDebug()<<"disconnect";
times = 0; times = 0;

@ -21,14 +21,13 @@ class UdpDataThread : public QObject
public: public:
UdpDataThread(QObject *parent = nullptr); UdpDataThread(QObject *parent = nullptr);
~UdpDataThread(); ~UdpDataThread();
void send_circle(const QString& data);
void sendSnId(const QString& data); void sendSnId(const QString& data);
void sendStop(); void sendStop();
void sendClose(); void sendClose();
void stopClose(); void stopClose();
signals: signals:
void connectStatus(bool); void connectStatus(bool);
void registerRet(bool);
private slots: private slots:
void recvData(const QByteArray &data); void recvData(const QByteArray &data);
void checkConnectSlot(); void checkConnectSlot();

@ -22,6 +22,7 @@ SettingWgt::SettingWgt(QWidget *parent) :
m_productsCfg = Common::GetInstance()->getProductConfigs(); m_productsCfg = Common::GetInstance()->getProductConfigs();
m_workmodesCfg = Common::GetInstance()->getWorkModeConfigs(); m_workmodesCfg = Common::GetInstance()->getWorkModeConfigs();
m_productNums = m_productsCfg.size(); m_productNums = m_productsCfg.size();
m_workModeNums = m_workmodesCfg.size();
initUI(); //一定放在前面 initUI(); //一定放在前面
loadConfig(); loadConfig();
} }
@ -106,8 +107,10 @@ void SettingWgt::initUI()
layout->addWidget(lineEdit, i + 1, 2); layout->addWidget(lineEdit, i + 1, 2);
// 工作模式下拉框创建 // 工作模式下拉框创建
QComboBox *comboBox = new QComboBox(ui->frame_setting); QComboBox *comboBox = new QComboBox(ui->frame_setting);
comboBox->addItem("GLOBAL", 0); for (const auto& productCfg : m_workmodesCfg)
comboBox->addItem("LOCAL", 1); {
comboBox->addItem(productCfg.name, productCfg.index);
}
m_modeComboBoxes.push_back(comboBox); m_modeComboBoxes.push_back(comboBox);
layout->addWidget(comboBox, i + 1, 3); layout->addWidget(comboBox, i + 1, 3);
} }
@ -125,7 +128,11 @@ void SettingWgt::loadConfig()
int mode = product.workMode; int mode = product.workMode;
m_snFormatLineEdits[index - 1]->setText(product.productFormat); m_snFormatLineEdits[index - 1]->setText(product.productFormat);
m_selectCheckBoxes[index - 1]->setCheckState(selected ? Qt::Checked : Qt::Unchecked); m_selectCheckBoxes[index - 1]->setCheckState(selected ? Qt::Checked : Qt::Unchecked);
m_modeComboBoxes[index - 1]->setCurrentIndex(mode); int pos = m_modeComboBoxes[index - 1]->findData(QVariant(mode));
if (pos != -1)
{
m_modeComboBoxes[index - 1]->setCurrentIndex(pos);
}
} }
} }
@ -169,7 +176,12 @@ void SettingWgt::on_pushButton_ok_clicked()
{ {
m_productsCfg[i + 1].selected = m_selectCheckBoxes[i]->isChecked(); m_productsCfg[i + 1].selected = m_selectCheckBoxes[i]->isChecked();
m_productsCfg[i + 1].productFormat = m_snFormatLineEdits[i]->text().trimmed(); m_productsCfg[i + 1].productFormat = m_snFormatLineEdits[i]->text().trimmed();
m_productsCfg[i + 1].workMode = static_cast<Mode>(m_modeComboBoxes[i]->currentIndex()); 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();
} }
Common::GetInstance()->saveConfig(m_productsCfg, m_workmodesCfg); Common::GetInstance()->saveConfig(m_productsCfg, m_workmodesCfg);
emit SettingFinishSig(); emit SettingFinishSig();

@ -44,6 +44,7 @@ private:
QMap<int, ProductConfig> m_productsCfg; QMap<int, ProductConfig> m_productsCfg;
QMap<int, ModeConfig> m_workmodesCfg; QMap<int, ModeConfig> m_workmodesCfg;
uint m_productNums; uint m_productNums;
uint m_workModeNums;
}; };
#endif // SETTINGDLG_H #endif // SETTINGDLG_H

@ -4,7 +4,12 @@
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QMessageBox> #include <QMessageBox>
#include <QEventLoop>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QProcess>
#include <QDir>
#include "common.h" #include "common.h"
#include <QDebug> #include <QDebug>
@ -26,6 +31,8 @@ Widget::Widget(QWidget *parent)
connect(m_settingDlg, &SettingWgt::SettingFinishSig, [this](){ connect(m_settingDlg, &SettingWgt::SettingFinishSig, [this](){
on_pushButton_setting_clicked(); on_pushButton_setting_clicked();
}); });
connect(m_udpDataThread, &UdpDataThread::registerRet, this, &Widget::RegisterRetSlot);
connect(m_udpDataThread, &UdpDataThread::connectStatus, this, &Widget::ConnectStatusSlot);
} }
Widget::~Widget() Widget::~Widget()
@ -58,22 +65,98 @@ int Widget::checkSNId(const QString &snId)
if (snId.isEmpty()) if (snId.isEmpty())
{ {
QMessageBox::warning(this, "产品SN错误", "产品SN为空! 请重新扫码!"); QMessageBox::warning(this, "产品SN错误", "产品SN为空! 请重新扫码!");
return -1; LWarn("Product SN id is empty!");
return SNEmptyError;
} }
QRegExp reg("[a-z]"); QRegExp reg("[a-z]");
if (reg.indexIn(snId) != -1) if (reg.indexIn(snId) != -1)
{ {
QMessageBox::information(this,"提示",QString("产品SN(%1)包含小写! 请重新扫码!").arg(snId)); QMessageBox::information(this,"提示",QString("产品SN(%1)包含小写! 请重新扫码!").arg(snId));
LWarn("Product SN contains lowercase!");
ui->lineEdit_snId->setText(""); ui->lineEdit_snId->setText("");
return -1; return SNLowerCaseError;
} }
if (snId.contains(" ")) if (snId.contains(" "))
{ {
QMessageBox::information(this,"提示",QString("产品SN(%1)包含空格! 请重新扫码!").arg(snId)); QMessageBox::information(this,"提示",QString("产品SN(%1)包含空格! 请重新扫码!").arg(snId));
LWarn("Product SN contains Spaces!");
ui->lineEdit_snId->setText(""); ui->lineEdit_snId->setText("");
return -1; return SNSpaceError;
}
return NoError;
}
int Widget::startIECSProgram(const QString& workPath, const QString& snId)
{
QProcess *process = new QProcess(this);
process->start(workPath);
qDebug()<<"startIECSProgram:"<<snId;
if (!process->waitForStarted())
{
LError("Failed to start the program with arguments:{}", process->errorString());
return ExecIECSError;
}
m_udpDataThread->sendSnId(snId);
return NoError;
}
int Widget::checkForRepairProgram(const int mode, const QString& sn, bool& isFind)
{
auto workModeCfg = Common::GetInstance()->getWorkModeConfigs();
QDir workDir(workModeCfg[mode].workPath);
workDir.cdUp();
QString dbPath = workDir.absolutePath() + "/config.db";
return databaseQuery(dbPath, sn, isFind);
}
int Widget::databaseQuery(const QString& databasePath, const QString& deviceSn, bool& isFind)
{
// 创建和打开 SQLite 数据库
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(databasePath); // 使用传入的数据库路径
if (!db.open())
{
LError("Failed to open database:{}", db.lastError().text());
isFind = false;
return DatabaseOpenError;
}
// 创建查询对象
QSqlQuery query(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;
db.close();
return DatabaseSelectError;
}
// 处理查询结果
if (query.next())
{
int count = query.value(0).toInt();
isFind = (count > 0);
db.close();
return NoError;
}
isFind = false;
db.close();
return DatabaseUnknownError;
}
void Widget::RegisterRetSlot(bool ret)
{
ui->lineEdit_snId->setEnabled(true);
}
void Widget::ConnectStatusSlot(bool ret)
{
if (!ret)
{
ui->lineEdit_snId->setEnabled(true);
} }
return 0;
} }
void Widget::on_pushButton_setting_clicked() void Widget::on_pushButton_setting_clicked()
@ -107,6 +190,12 @@ void Widget::addLogItem(const QString &text)
ui->list_log->addItem(text); // 添加新条目 ui->list_log->addItem(text); // 添加新条目
} }
int Widget::switchProgram()
{
return 0;
}
void Widget::on_lineEdit_snId_returnPressed() void Widget::on_lineEdit_snId_returnPressed()
{ {
QString snId = ui->lineEdit_snId->text(); QString snId = ui->lineEdit_snId->text();
@ -132,14 +221,42 @@ void Widget::on_lineEdit_snId_returnPressed()
QMessageBox::information(this, "警告", "当前SN与启用设值SN不匹配请检查或重新扫码"); QMessageBox::information(this, "警告", "当前SN与启用设值SN不匹配请检查或重新扫码");
return; return;
} }
ui->lineEdit_snId->setEnabled(false);
auto currWorkMode = Common::GetInstance()->getCurrentWorkMode(); auto currWorkMode = Common::GetInstance()->getCurrentWorkMode();
if (selectedProducts[productFormat] != currWorkMode) bool isRepair = false;
// 查找数据库,判断是否需要返修程序
ret = checkForRepairProgram(selectedProducts[productFormat], snId, isRepair);
if (ret != NoError)
{ {
qDebug()<<"not match!!!"; LError("checkForRepairProgram error!{}", ret);
m_udpDataThread->sendClose();
return; return;
//TODO:不相等时需要结束当前的IECS程序如果为-1则代表没有IECS程序执行直接启动IECS程序即可 }
auto selectMode = selectedProducts[productFormat];
auto workModeCfgs = Common::GetInstance()->getWorkModeConfigs();
if (selectMode != currWorkMode)
{
// 切换工作模式
if (currWorkMode != -1)
{
m_udpDataThread->sendClose();
}
//TODO:不相等时m_udpDataThread发送关闭信号等待Common单例类中的标志位变成-1后m_udpDataThread停止发送关闭信号并启动IECS程序
//同时需要去IECS程序路径中查找数据库判断是否使用返修程序 //同时需要去IECS程序路径中查找数据库判断是否使用返修程序
auto workModeCfg = workModeCfgs[selectMode];
QString workPath = isRepair ? workModeCfg.reworkPath : workModeCfg.workPath;
qDebug()<<"workPath:"<<workPath;
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [this, timer, snId, workPath]() {
if (Common::GetInstance()->getCurrentWorkMode() == -1)
{
m_udpDataThread->stopClose();
timer->stop(); // 停止定时器
// 启动 IECS 程序
startIECSProgram(workPath, snId);
}
});
timer->start(1000);
return;
} }
m_udpDataThread->sendSnId(snId); m_udpDataThread->sendSnId(snId);
} }

@ -19,11 +19,17 @@ private:
void initUI(); void initUI();
void setSNLineEditFocus(); void setSNLineEditFocus();
int checkSNId(const QString& snId); 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);
private slots: private slots:
void RegisterRetSlot(bool ret);
void ConnectStatusSlot(bool ret);
void addLogItem(const QString& text); void addLogItem(const QString& text);
int switchProgram();
void on_pushButton_setting_clicked(); void on_pushButton_setting_clicked();
void on_lineEdit_snId_returnPressed(); void on_lineEdit_snId_returnPressed();
void on_pushButton_sendSnId_clicked(); void on_pushButton_sendSnId_clicked();
private: private:

@ -0,0 +1,46 @@
#ifndef INTERFACE_H
#define INTERFACE_H
#include <QString>
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