This commit is contained in:
2025-12-05 12:20:47 +03:00
parent 57673d0ee4
commit 05fce073f1
450 changed files with 58 additions and 58 deletions

112
LibServer/CMakeLists.txt Normal file
View File

@@ -0,0 +1,112 @@
project(Server LANGUAGES CXX)
common_info_for_project(Server)
add_library(Server SHARED
ServerLMS_global.h
serverlmswidget.cpp
serverlmswidget.h
serverlmswidget.ui
metatypes.cpp
metatypes.h
settings/dialogsettingstray.cpp
settings/dialogsettingstray.h
settings/dialogsettingstray.ui
settings/dialogcheckdb.cpp
settings/dialogcheckdb.h
settings/dialogcheckdb.ui
clienthandler/clienthandler.cpp
clienthandler/clienthandler.h
multithreadserver/multithreadserver.cpp
multithreadserver/multithreadserver.h
Data/typesDataServerClient.h
Data/Client.h
Data/PacketType.h
Data/StreamingVersionData.h
Data/usertype.h
Systems/assetsmanager.cpp
Systems/assetsmanager.h
Systems/recognizesystem.cpp
Systems/recognizesystem.h
Systems/updatecontroller.cpp
Systems/updatecontroller.h
Systems/commonclienthandler.cpp
Systems/commonclienthandler.h
Systems/logger.cpp
Systems/logger.h
Systems/Parsers/dataparser.cpp
Systems/Parsers/dataparser.h
Systems/Parsers/clientanswerparser.cpp
Systems/Parsers/clientanswerparser.h
Systems/Parsers/dbanswerparser.cpp
Systems/Parsers/dbanswerparser.h
Systems/Parsers/processparser.cpp
Systems/Parsers/processparser.h
Systems/Parsers/docsanswerparser.cpp
Systems/Parsers/docsanswerparser.h
Systems/processingsystem.cpp
Systems/processingsystem.h
Systems/sendsystem.cpp
Systems/sendsystem.h
Systems/tools.cpp
Systems/tools.h
Systems/chatsystem.cpp
Systems/chatsystem.h
Systems/fasthashcalculator.cpp
Systems/fasthashcalculator.h
Systems/docsupdater.cpp
Systems/docsupdater.h
providerdblms/providerdblms.cpp
providerdblms/providerdblms.h
Server.qrc
)
target_link_libraries(Server PRIVATE Qt5::Widgets)
target_link_libraries(Server PRIVATE Qt5::Network)
target_link_libraries(Server PRIVATE Qt5::Concurrent)
target_link_libraries(Server PRIVATE Qt5::Sql)
target_link_libraries(Server PRIVATE Qt5::Xml)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/clienthandler)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/multithreadserver)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/providerdblms)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/settings)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Systems)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Systems/Parsers)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibDataBaseInterface)
if(PROJECT_TYPE_DEBUG)
target_link_directories(Server PUBLIC ${REPO_PATH}/BUILDS/Debug64/LibDataBaseInterface)
else()
target_link_directories(Server PUBLIC ${REPO_PATH}/BUILDS/Release64/LibDataBaseInterface)
endif()
target_link_libraries(Server PRIVATE libDataBaseInterface.dll)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/authorization)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/tasks)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/widgets)
target_include_directories(Server PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../LibInstructorsAndTrainees/specialmessagebox)
if(PROJECT_TYPE_DEBUG)
target_link_directories(Server PUBLIC ${REPO_PATH}/BUILDS/Debug64/LibInstructorsAndTrainees)
else()
target_link_directories(Server PUBLIC ${REPO_PATH}/BUILDS/Release64/LibInstructorsAndTrainees)
endif()
target_link_libraries(Server PRIVATE libInstructorsAndTrainees.dll)
target_compile_definitions(Server PRIVATE SERVERLMS_LIBRARY)
if(PROJECT_TYPE_DEBUG)
add_custom_command(TARGET Server
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Debug64/LibServer/libServer.dll
${REPO_PATH}/BUILDS/Debug64/ProgramServerMPS)
else()
add_custom_command(TARGET Server
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Release64/LibServer/libServer.dll
${REPO_PATH}/BUILDS/Release64/ProgramServerMPS)
endif()

View File

@@ -0,0 +1,348 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-08-16T16:09:12. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{00ce76f6-77cf-4587-a216-9a8e243377cb}</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">1</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.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</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">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_INSTALL_PREFIX:PATH=/MyServerLMS</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/VEYON/MyServer/Debug64</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Отладка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/VEYON/MyServer/Release64</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/VEYON/MyServer/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск с отладочной информацией</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/VEYON/MyServer/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск минимального размера</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">4</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">Развёртывание</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</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.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></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.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"></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>

View File

@@ -0,0 +1,347 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-10-04T17:32:05. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{02bbda2a-ba75-44de-8881-59c42e3619cd}</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">1</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.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_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">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Projects/QT/ALL/MyServer/Debug64</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Отладка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Projects/QT/ALL/MyServer/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Projects/QT/ALL/MyServer/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск с отладочной информацией</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Projects/QT/ALL/MyServer/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск минимального размера</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">4</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">Развёртывание</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</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.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></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.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"></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>

View File

@@ -0,0 +1,390 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2025-01-10T13:00:03. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{15ef2478-2444-4b00-88b8-fead51c6fef5}</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">1</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.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">4</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">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QT/Projects/RRJServer/RRJServer/ServerLMS/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Отладка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Release</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QT/Projects/RRJServer/RRJServer/ServerLMS/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=RelWithDebInfo</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QT/Projects/RRJServer/RRJServer/ServerLMS/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-RelWithDebInfo</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск с отладочной информацией</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.3">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=MinSizeRel</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QT/Projects/RRJServer/RRJServer/ServerLMS/build-ServerLMS-Desktop_Qt_5_14_2_MinGW_64_bit-MinSizeRel</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Выпуск минимального размера</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.4">
<valuelist type="QVariantList" key="CMake.Configuration">
<value type="QString">CMAKE_BUILD_TYPE:STRING=Debug</value>
<value type="QString">CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}</value>
<value type="QString">CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}</value>
<value type="QString">CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}</value>
<value type="QString">QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}</value>
</valuelist>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QT/Projects/RRJServer/RRJServer/BUILDS/ServerLMS/Debug64</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Сборка</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="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Очистка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Очистка</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">Debug2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">5</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">Развёртывание</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Развёртывание</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.CustomExecutableRunConfiguration.Executable"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></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.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"></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>

174
LibServer/Data/Client.h Normal file
View File

@@ -0,0 +1,174 @@
#ifndef CLIENT_H
#define CLIENT_H
#include <QString>
#include <QTcpSocket>
#include "typesDataServerClient.h"
class Client
{
public:
Client(QString name, QString address, QString port,QObject *parent = nullptr):
login(""),
ready(false),
typeClient(TypeClientAutorization::TYPE_QT_CLIENT)
{
this->name = name;
this->address = address;
this->port = port;
//this->fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login;
this->fullName = "IP: " + address + " port : " + port + " login: " + login;
};
~Client(){};
public:
QString getFullName()
{
return fullName;
};
void setLogin(QString login)
{
this->login = login;
isLoggedIn = true;
//fullName = "Name: " + name + " IP: " + address + " port : " + port + " login: " + login;
fullName = "IP: " + address + " port : " + port + " login: " + login;
}
QString getLogin()
{
return login;
}
QString getAddress()
{
return address;
}
QString getPort()
{
return port;
}
bool getReady()
{
return ready;
}
void setReady(bool ready)
{
this->ready = ready;
}
void setUnity(TypeClientAutorization type)
{
typeClient = type;
}
TypeClientAutorization getClientType()
{
return typeClient;
}
void setTypeClient(TypeClientAutorization TypeClient)
{
this->typeClient = TypeClient;
}
TypeClientAutorization getTypeClient()
{
return typeClient;
}
void changePackageResponse()
{
if (typeClient == TypeClientAutorization::TYPE_QT_CLIENT)
typeClient = TypeClientAutorization::TYPE_UNITY_CLIENT;
else if (typeClient == TypeClientAutorization::TYPE_UNITY_CLIENT)
typeClient = TypeClientAutorization::TYPE_QT_CLIENT;
}
bool operator == (Client* right)
{
return this->address == right->address;
}
bool getIsLoggedIn()
{
return isLoggedIn;
}
void setIsLoggedIn(bool value)
{
isLoggedIn = value;
}
void setAccessType(UserType type)
{
userType = type;
}
UserType getAccessType()
{
return userType;
}
QString getId()
{
return id;
}
void setId(QString value)
{
id = value;
}
QByteArray getClientHash()
{
return clientHash;
}
void setClientHash(const QByteArray &value)
{
clientHash = value;
}
QList<FileData> getFileSendList() const
{
return fileSendList;
}
void setFileSendList(const QList<FileData> &value)
{
fileSendList = value;
}
QList<FileData> getFileDeleteList() const
{
return fileDeleteList;
}
void setFileDeleteList(const QList<FileData> &value)
{
fileDeleteList = value;
}
private:
QString name;
QString address;
QString port;
QString fullName;
QString id;
QString login;
bool ready;
bool isLoggedIn;
TypeClientAutorization typeClient;
UserType userType;
QByteArray clientHash;
QList<FileData> fileSendList;
QList<FileData> fileDeleteList;
};
#endif // CLIENT_H

111
LibServer/Data/PacketType.h Normal file
View File

@@ -0,0 +1,111 @@
#ifndef PACKETTYPE_H
#define PACKETTYPE_H
#include <QString>
enum PacketType
{
TYPE_NONE = 0,
TYPE_UNITY = 1,
TYPE_FILE = 2,
TYPE_COMMAND =3,
TYPE_FOLDER = 4,
TYPE_DELETE = 5,
UPDATE_FILES_COMPLETE = 6,
TYPE_NEEDUPDATE = 7,
TYPE_XMLANSWER = 8,
TYPE_QT = 9,
TYPE_DISABLE = 11,
TYPE_UPDATE = 12,
TYPE_CHECK_VERSION = 13,
TYPE_FILESIZE = 20,
TYPE_BIGXML = 21,
UPDATE_DOCS_COMPLETE = 22,
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
//xml-ответы на запросы к БД
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS = 101,
TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES = 102,
TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS = 103,
TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS = 104,
TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE = 106,
TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE = 107,
//xml-ответы на запросы AdditionalFiles
TYPE_XMLANSWER_QUERY_TASKS_XML_FIM = 130,
TYPE_XMLANSWER_QUERY_TASKS_XML_AMM = 131,
//оповещение об изменении docs.xml
TYPE_XMLANSWER_DOCS_CHANGED = 132,
TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM = 133,
//ответы по обновлениям
GET_VERSION = 149,
HASH_READY = 150,
CHANGE_DATA_VERSION = 151,
COPY_VERSION = 152,
DELETE_DATA_VERSION = 153,
BUSY = 154,
FREE = 155,
RECALCULATE_HASH = 156,
RECALCULATE_DOCS = 157,
GET_DOCS = 158,
SEND_HASH = 159
};
template<typename T>
QString enumToString(T value);
template<>
inline QString enumToString(PacketType value) {
switch(value) {
case PacketType::TYPE_NONE: return "TYPE_NONE";
case PacketType::TYPE_UNITY: return "TYPE_UNITY";
case PacketType::TYPE_FILE: return "TYPE_FILE";
case PacketType::TYPE_COMMAND: return "TYPE_COMMAND";
case PacketType::TYPE_FOLDER: return "TYPE_FOLDER";
case PacketType::TYPE_DELETE: return "TYPE_DELETE";
case PacketType::UPDATE_FILES_COMPLETE: return "UPDATE_FILE_COMPLETE";
case PacketType::TYPE_NEEDUPDATE: return "TYPE_NEEDUPDATE";
case PacketType::TYPE_XMLANSWER: return "TYPE_XMLANSWER";
case PacketType::TYPE_QT: return "TYPE_QT";
case PacketType::TYPE_DISABLE: return "TYPE_DISABLE";
case PacketType::TYPE_UPDATE: return "TYPE_UPDATE";
case PacketType::TYPE_CHECK_VERSION: return "TYPE_CHECK_VERSION";
case PacketType::TYPE_FILESIZE: return "TYPE_FILESIZE";
case PacketType::TYPE_BIGXML: return "TYPE_BIGXML";
case PacketType::UPDATE_DOCS_COMPLETE: return "UPDATE_DOCS_COMPLETE";
case PacketType::TYPE_XMLANSWER_MESSAGE_FOR_GUI: return "TYPE_XMLANSWER_MESSAGE_FOR_GUI";
case PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS: return "TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS";
case PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS: return "TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS";
case PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES: return "TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES";
case PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS: return "TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS";
case PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS: return "TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS";
case PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE: return "TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE";
case PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE: return "TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE";
case PacketType::TYPE_XMLANSWER_QUERY_TASKS_XML_FIM: return "TYPE_XMLANSWER_QUERY_TASKS_XML_FIM";
case PacketType::TYPE_XMLANSWER_QUERY_TASKS_XML_AMM: return "TYPE_XMLANSWER_QUERY_TASKS_XML_AMM";
case PacketType::TYPE_XMLANSWER_DOCS_CHANGED: return "TYPE_XMLANSWER_DOCS_CHANGED";
case PacketType::TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM: return "TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM";
case PacketType::GET_VERSION: return "GET_VERSION";
case PacketType::HASH_READY: return "HASH_READY";
case PacketType::CHANGE_DATA_VERSION: return "CHANGE_DATA_VERSION";
case PacketType::COPY_VERSION: return "COPY_VERSION";
case PacketType::DELETE_DATA_VERSION: return "DELETE_DATA_VERSION";
case PacketType::BUSY: return "BUSY";
case PacketType::FREE: return "FREE";
case PacketType::RECALCULATE_HASH: return "HASH_CALCULATE_START";
case PacketType::RECALCULATE_DOCS: return "RECALCULATE_DOCS";
case PacketType::GET_DOCS: return "GET_DOCS";
case PacketType::SEND_HASH: return "SEND_HASH";
default: return "Unknown";
}
}
#endif // PACKETTYPE_H

View File

@@ -0,0 +1,102 @@
#ifndef STREAMINGVERSIONDATA_H
#define STREAMINGVERSIONDATA_H
#include <QTime>
#include <QString>
class StreamingVersionData
{
public:
StreamingVersionData(QString absoltePath,QString viewName,QDateTime data,qint32 size)
{
this->absolutePath = absoltePath;
this->viewName = viewName;
this->createData = data;
this->size = size;
this->isChangeable = false;
}
StreamingVersionData(){};
~StreamingVersionData();
void fill(StreamingVersionData* data)
{
this->absolutePath = data->getAbsolutPath();
this->viewName = data->getViewName();
this->createData = data->getCreateData();
this->size = data->getSize();
this->isChangeable = data->getIsChangeable();
this->author = data->getAuthor();
}
QString getAbsolutPath() const
{
return absolutePath;
}
QString getViewName() const
{
return viewName;
}
QDateTime getCreateData() const
{
return createData;
}
qint32 getSize() const
{
return size;
}
bool getIsChangeable() const
{
return isChangeable;
}
void setIsChangeable(bool value)
{
isChangeable = value;
}
QString getAuthor() const
{
return author;
}
void setAuthor(const QString &value)
{
author = value;
}
void setViewName(const QString &value)
{
viewName = value;
}
void setCreateData(const QDateTime &value)
{
createData = value;
}
void setAbsolutePath(const QString &value)
{
absolutePath = value;
}
private:
QString absolutePath;
QString viewName;
QString author;
QDateTime createData;
bool isChangeable;
qint32 size;
};
#endif // STREAMINGVERSIONDATA_H

View File

@@ -0,0 +1,155 @@
#ifndef TYPESDATASERVERCLIENT_H
#define TYPESDATASERVERCLIENT_H
#include <QList>
#include <QString>
#include "typeQueryToDB.h"
#define NOTIFY_ERROR_AUTH_DB "ERROR_AUTH_DB"
#define NOTIFY_ERROR_AUTH_LOGINORPASSWORD "ERROR_AUTH_LOGINORPASSWORD"
#define NOTIFY_ERROR_AUTH_ARCHIVED "ERROR_AUTH_ARCHIVED"
#define NOTIFY_ERROR_AUTH_ALREADYLOGIN "ERROR_AUTH_ALREADYLOGIN"
#define NOTIFY_SERVER_END "END"
#define NOTIFY_SERVER_BLOCKED "BLOCKED"
#define SERVER_HELLO "NewConnection. I am server LMS!"
enum EStateServer{started, stoped};
enum EStateBlockAutorization{blocked, unblocked};
struct FileData
{
QString path;
QString hash;
bool operator==(const FileData& other)const
{
if (this->path== other.path && this->hash == other.hash) return true;
return false;
}
bool operator<(const FileData& data2) const
{
return this->hash == "FOLDER" && data2.hash !="FOLDER";
}
};
struct SAttribute
{
QString name;
QString value;
};
struct SXmlAnswerTag
{
QString elementName;
QList<SAttribute> attr;
};
enum TypeClientAutorization{
TYPE_QT_CLIENT = 0,
TYPE_UNITY_CLIENT = 1,
TYPE_GUI = 10
};
enum UserType
{
INSTRUCTOR,
TRAINEE,
NONE = 100
};
class ClientAutorization
{
public:
QString Login;
QString Password;
int NumberOfScreen;
TypeClientAutorization TypeClient;
};
class ClientDeAutorization
{
public:
QString Login;
};
/*
enum TypeQueryToDB{
TYPE_QUERY_GET_ALL_LISTS,
TYPE_QUERY_NEW_INSTRUCTOR,
TYPE_QUERY_DEL_INSTRUCTOR,
TYPE_QUERY_EDIT_INSTRUCTOR,
TYPE_QUERY_NEW_GROUP,
TYPE_QUERY_DEL_GROUP,
TYPE_QUERY_EDIT_GROUP,
TYPE_QUERY_NEW_TRAINEE,
TYPE_QUERY_DEL_TRAINEE,
TYPE_QUERY_EDIT_TRAINEE,
TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE,
TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE
};
*/
class ClientQueryToDB{
public:
TypeQueryToDB typeQuery;
};
class ClientQueryTasksXML
{
public:
QString Type;
};
class ServerMessage
{
public:
QString Text;
};
class ClientMessage
{
public:
QString From;//формат"id-type"
QString To;//формат"id-type"
QString Text;
//id-0 инструктор
//id-1 обучаемый
ClientMessage(){}
ClientMessage(QString from,QString to,QString text)
{
From = from;
To = to;
Text = text;
}
};
class ServerTask
{
public:
QString Text;
};
class ServerNotify
{
public:
QString Code;
};
class ClientNotify
{
public:
QString Code;
};
class DataInfo{
public:
QString path;
quint64 size;
};
#endif // TYPESDATASERVERCLIENT_H

12
LibServer/Data/userType.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef USERTYPE_H
#define USERTYPE_H
#include <QString>
enum UserType{
INSTRUCTOR,
TRAINEES
};
#endif // USERTYPE_H

25
LibServer/Server.qrc Normal file
View File

@@ -0,0 +1,25 @@
<RCC>
<qresource prefix="/">
<file>resources/blankXML/ListGroups.xml</file>
<file>resources/blankXML/ListInstructors.xml</file>
<file>resources/blankXML/ListTrainees.xml</file>
<file>resources/icons/switchOff.png</file>
<file>resources/icons/switchOn.png</file>
<file>resources/blankXML/ListTasksAMM.xml</file>
<file>resources/blankXML/ListTasksFIM.xml</file>
<file>resources/icons/circleGreen.png</file>
<file>resources/icons/circleRed.png</file>
<file>resources/icons/lock.png</file>
<file>resources/icons/unlock.png</file>
<file>resources/icons/open.png</file>
<file>resources/icons/rocket.png</file>
<file>resources/icons/stop.png</file>
<file>resources/icons/settings.png</file>
<file>resources/icons/circleGray.png</file>
<file>resources/icons/checkDB.png</file>
<file>resources/icons/editorDB.png</file>
<file>resources/icons/procedure.png</file>
<file>resources/icons/exchange.png</file>
<file>resources/blankXML/ListSubProc.xml</file>
</qresource>
</RCC>

View File

@@ -0,0 +1,12 @@
#ifndef SERVERLMS_GLOBAL_H
#define SERVERLMS_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(SERVERLMS_LIBRARY)
# define SERVERLMS_EXPORT Q_DECL_EXPORT
#else
# define SERVERLMS_EXPORT Q_DECL_IMPORT
#endif
#endif // SERVERLMS_GLOBAL_H

View File

@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": "Нет конфигураций"
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
{
"ExpandedNodes": [
""
],
"SelectedNode": "\\processingsystem.cpp",
"PreviewInSolutionExplorer": false
}

Binary file not shown.

View File

@@ -0,0 +1,127 @@
#include "clientanswerparser.h"
ClientAnswerParser::ClientAnswerParser(QObject *parent) : QObject(parent)
{
}
void ClientAnswerParser::initialize(DataParser *dataParser)
{
this->dataParser = dataParser;
}
QByteArray ClientAnswerParser::authorization(bool result, QString instructorName,QString clientName, QString accessType, QString login, int id)
{
QList<SXmlAnswerTag> listTag;
SAttribute attribute1 = {"Result", result? "true" : "false"};
SAttribute attribute2 = {"InstructorName", instructorName};
SAttribute attribute3 = {"ClientName", clientName};
SAttribute attribute4 = {"AccessType", accessType};
SAttribute attribute5 = {"Login", login};
SAttribute attribute6 = {"id_client", QString::number(id)};
QList<SAttribute> listAttr = {attribute1, attribute2, attribute3, attribute4, attribute5, attribute6};
SXmlAnswerTag tag = {"ServerAuthorization", listAttr};
listTag.append(tag);
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::deAuthorization(bool result, QString login)
{
QList<SXmlAnswerTag> listTag;
SAttribute attribute1 = {"Result", result? "true" : "false"};
SAttribute attribute2 = {"Login", login};
QList<SAttribute> listAttr = {attribute1, attribute2};
SXmlAnswerTag tag = {"ServerDeAuthorization", listAttr};
listTag.append(tag);
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::message(QString loginFrom,QString loginTo,QString text)
{
QList<SXmlAnswerTag> listTag;
QList<SAttribute> listAttr;
SAttribute attribute1;
attribute1 = {"From",loginFrom};
listAttr.append(attribute1);
attribute1 = {"To",loginTo};
listAttr.append(attribute1);
attribute1 = {"Text",text};
listAttr.append(attribute1);
SXmlAnswerTag tag = {"ClientMessage", listAttr};
listTag.append(tag);
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::task(QString text)
{
QList<SXmlAnswerTag> listTag;
SAttribute attribute1 = {"Text", text};
QList<SAttribute> listAttr = {attribute1};
SXmlAnswerTag tag = {"ServerTask", listAttr};
listTag.append(tag);
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::notify(QString code)
{
QList<SXmlAnswerTag> listTag;
SAttribute attribute1 = {"Code", code};
QList<SAttribute> listAttr = {attribute1};
SXmlAnswerTag tag = {"ServerNotify", listAttr};
listTag.append(tag);
return dataParser->xmlAnswer(listTag);
}
QByteArray ClientAnswerParser::tasks(QStringList listTasks)
{
QList<SXmlAnswerTag> listTag;
foreach(QString task, listTasks)
{
QList<SAttribute> listAttr;
SAttribute attribute1 = {"Head", task};
SAttribute attribute2 = {"IsComplete", "false"};
listAttr.append(attribute1);
listAttr.append(attribute2);
SXmlAnswerTag tag = {"ServerTask", listAttr};
listTag.append(tag);
}
return dataParser->xmlAnswer(listTag, "TaskArray", "Tasks");
}
QByteArray ClientAnswerParser::currentVersion()
{
QByteArray array;
QFile fileR(version);
if (!fileR.open(QFile::ReadOnly | QFile::Text))
{
QString str = "Не удалось открыть файл";
qDebug() << "xmlAnswer: " << str;
}
else
{
array = fileR.readAll();
fileR.close(); // Закрываем файл
}
return array;
}

View File

@@ -0,0 +1,30 @@
#ifndef CLIENTANSWERPARSER_H
#define CLIENTANSWERPARSER_H
#include <QObject>
#include <Systems/Parsers/dataparser.h>
#include <Data/typesDataServerClient.h>
class ClientAnswerParser : public QObject
{
Q_OBJECT
public:
explicit ClientAnswerParser(QObject *parent = nullptr);
void initialize(DataParser *dataParser);
QByteArray authorization(bool result, QString instructorName, QString clientName, QString accessType, QString login, int id);
QByteArray deAuthorization(bool result, QString login);
QByteArray message(QString loginFrom,QString loginTo,QString text);
QByteArray task(QString text);
QByteArray notify(QString code);
QByteArray tasks(QStringList listTasks);
QByteArray currentVersion();
signals:
private:
DataParser *dataParser;
};
#endif // CLIENTANSWERPARSER_H

View File

@@ -0,0 +1,139 @@
#include "dataparser.h"
#include <QFile>
#include <QDomDocument>
DataParser::DataParser(AssetsManager *assetManager,ProcessingSystem *processingSystem,QObject *parent) :
QObject(parent)
{
this->processingSystem = processingSystem;
this->assetsManager = assetManager;
clientAnswer = new ClientAnswerParser;
clientAnswer->initialize(this);
dbAnswer = new DBAnswerParser;
dbAnswer->initialize(this);
docsAnswer = new DocsAnswerParser;
processParser = new ProcessParser;
processParser->initialize(processingSystem);
mutex = new QMutex;
qDebug() << "ParserThread: " << QThread::currentThreadId();
}
QByteArray DataParser::xmlAnswer(QList<SXmlAnswerTag> listTag, QString elemUp1, QString elemUp2)
{
try {
mutex->lock();
/* Открываем файл для Записи*/
QFile file(tempFile);
file.open(QIODevice::WriteOnly);
/* Создаем объект, с помощью которого осуществляется запись в файл */
QXmlStreamWriter xmlWriter(&file);
xmlWriter.setAutoFormatting(true); // Устанавливаем автоформатирование текста
xmlWriter.writeStartDocument(); // Запускаем запись в документ
if(elemUp1 != "")
xmlWriter.writeStartElement(elemUp1); // Записываем тег
if(elemUp2 != "")
xmlWriter.writeStartElement(elemUp2); // Записываем тег
//Записываем все элементы
foreach(SXmlAnswerTag tag, listTag)
{
xmlWriter.writeStartElement(tag.elementName); // Записываем тег
// Записываем атрибуты
foreach(SAttribute attr, tag.attr)
xmlWriter.writeAttribute(attr.name, attr.value);
xmlWriter.writeEndElement(); // Закрываем тег
}
if(elemUp1 != "")
xmlWriter.writeEndElement(); // Закрываем тег
if(elemUp1 != "")
xmlWriter.writeEndElement(); // Закрываем тег
/* Завершаем запись в документ*/
xmlWriter.writeEndDocument();
file.close(); // Закрываем файл
QByteArray array;
array = readTempFile();
mutex->unlock();
return array;
}
catch(const std::exception& e)
{
qDebug() << e.what();
return nullptr;
}
}
QByteArray DataParser::readTempFile()
{
QByteArray array;
QFile fileR(tempFile);
if (!fileR.open(QFile::ReadOnly | QFile::Text))
{
QString str = "Не удалось открыть файл";
qDebug() << "xmlAnswer: " << str;
}
else
{
array = fileR.readAll();
fileR.close();
}
return array;
}
ClientAnswerParser *DataParser::ClientAnswer() const
{
return clientAnswer;
}
DBAnswerParser *DataParser::DbAnswer() const
{
return dbAnswer;
}
ProcessParser *DataParser::getProcessParser() const
{
return processParser;
}
DocsAnswerParser *DataParser::getDocsAnswerParser() const
{
return docsAnswer;
}
DataParser::~DataParser()
{
delete clientAnswer;
delete dbAnswer;
delete docsAnswer;
delete processParser;
delete mutex;
}

View File

@@ -0,0 +1,64 @@
#ifndef DATAPARSER_H
#define DATAPARSER_H
#include "Systems/processingsystem.h"
#include "Systems/tools.h"
#include "Systems/assetsmanager.h"
#include "Systems/logger.h"
#include "Systems/Parsers/clientanswerparser.h"
#include "dbanswerparser.h"
#include "docsanswerparser.h"
#include "processparser.h"
#include "serverlmswidget.h"
#include <QByteArray>
#include <QXmlStreamReader>
#include <QDebug>
#include <QDomDocument>
#include <Data/typesDataServerClient.h>
#include <Data/StreamingVersionData.h>
class ProcessingSystem;
class ClientHandler;
class AssetsManager;
class ClientAnswerParser;
class DBAnswerParser;
class DocsAnswerParser;
class ProcessParser;
class DataParser : public QObject
{
Q_OBJECT
public:
DataParser(AssetsManager *assetManager,ProcessingSystem *processingSystem,QObject* parent = nullptr);
void xmlParser(ClientHandler *client, QByteArray array);
void xmlFileDataParse(QByteArray array);
QByteArray xmlAnswer(QList<SXmlAnswerTag> listTag,QString elemUp1 = "", QString elemUp2 = "");
~DataParser();
ClientAnswerParser *ClientAnswer() const;
DBAnswerParser *DbAnswer() const;
ProcessParser *getProcessParser() const;
DocsAnswerParser *getDocsAnswerParser() const;
signals:
void sigLogMessage(QString log);
private:
QMutex *mutex;
ProcessingSystem *processingSystem;
AssetsManager *assetsManager;
ClientAnswerParser *clientAnswer;
DBAnswerParser *dbAnswer;
DocsAnswerParser* docsAnswer;
ProcessParser *processParser;
QByteArray readTempFile();
};
#endif // DATAPARSER_H

View File

@@ -0,0 +1,249 @@
#include "dbanswerparser.h"
DBAnswerParser::DBAnswerParser(QObject *parent) : QObject(parent)
{
}
void DBAnswerParser::initialize(DataParser *dataParser)
{
this->dataParser = dataParser;
}
QByteArray DBAnswerParser::listInstructors(bool result, QList<Instructor> *listInstructors)
{
QDomDocument commonDOM;
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListInstructors.xml", &commonDOM))
return QByteArray();
QDomNode listNode = commonDOM.namedItem("ListInstructors");
for(Instructor instructor : *listInstructors)
{
//Инструктор
QDomNode instructorNode = commonDOM.createElement("Instructor");
listNode.appendChild(instructorNode);
instructorNode.toElement().setAttribute("instructor_id", QString::number(instructor.getID()));
instructorNode.toElement().setAttribute("name", instructor.getName());
instructorNode.toElement().setAttribute("login", instructor.getLogin());
instructorNode.toElement().setAttribute("password", instructor.getPassword());
instructorNode.toElement().setAttribute("is_admin", instructor.getIsAdmin());
instructorNode.toElement().setAttribute("archived", instructor.getArchived());
instructorNode.toElement().setAttribute("logged_in", instructor.getLoggedIn());
}
Tools::saveDOMtoXML("ListInstructors.xml", &commonDOM);
return commonDOM.toByteArray();
}
QByteArray DBAnswerParser::listGroups(bool result, QList<Group> *listGroups)
{
QDomDocument commonDOM;
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListGroups.xml", &commonDOM))
return QByteArray();
QDomNode listNode = commonDOM.namedItem("ListGroups");
for(Group group : *listGroups)
{
//Группа
QDomNode groupNode = commonDOM.createElement("Group");
listNode.appendChild(groupNode);
groupNode.toElement().setAttribute("group_id", QString::number(group.getID()));
groupNode.toElement().setAttribute("name", group.getName());
}
Tools::saveDOMtoXML("ListGroups.xml", &commonDOM);
return commonDOM.toByteArray();
}
QByteArray DBAnswerParser::listTrainees(bool result, QList<Trainee> *listTrainees)
{
QDomDocument commonDOM;
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListTrainees.xml", &commonDOM))
return QByteArray();
QDomNode listNode = commonDOM.namedItem("ListTrainees");
for(Trainee trainee : *listTrainees)
{
//Обучаемый
QDomNode traineeNode = commonDOM.createElement("Trainee");
listNode.appendChild(traineeNode);
traineeNode.toElement().setAttribute("trainee_id", trainee.getID());
traineeNode.toElement().setAttribute("name", trainee.getName());
traineeNode.toElement().setAttribute("login", trainee.getLogin());
traineeNode.toElement().setAttribute("password", trainee.getPassword());
traineeNode.toElement().setAttribute("archived", trainee.getArchived());
traineeNode.toElement().setAttribute("logged_in", trainee.getLoggedIn());
traineeNode.toElement().setAttribute("group_trainee", trainee.getGroup().getID());
traineeNode.toElement().setAttribute("computer_trainee", trainee.getComputer().getID());
//trainee.setTasks()
//Тайминг
QDomNode timingNode = commonDOM.createElement("timing");
traineeNode.appendChild(timingNode);
TimingOfTrainee timing = trainee.getTiming();
timingNode.toElement().setAttribute("entryTime", timing.getEntryTimeS());
timingNode.toElement().setAttribute("exitTime", timing.getExitTimeS());
timingNode.toElement().setAttribute("operatingTime", timing.getOperatingTimeS());
}
Tools::saveDOMtoXML("ListTrainees.xml", &commonDOM);
return commonDOM.toByteArray();
}
QByteArray DBAnswerParser::listComputers(bool result, QList<Computer> *listComputers)
{
//TODO
return QByteArray();
}
QByteArray DBAnswerParser::listClassrooms(bool result, QList<Classroom> *listClassrooms)
{
//TODO
return QByteArray();
}
QByteArray DBAnswerParser::listContacts(bool result, QList<ContactModel> *listContacts)
{
QDomDocument doc;
QDomProcessingInstruction xmlDecl = doc.createProcessingInstruction("xml", "version='1.0' encoding='utf-8'");
doc.insertBefore(xmlDecl,doc.firstChild());
QDomElement root = doc.createElement("ContactArray");
for(ContactModel entity : *listContacts)
{
QDomElement contact = doc.createElement("ContactData");
contact.toElement().setAttribute("name",entity.getName());
contact.toElement().setAttribute("id",entity.getID());
QString isLogged = entity.getLoggedIn() ? "1" : "0";
contact.toElement().setAttribute("isOnline",isLogged);
contact.toElement().setAttribute("UserType",entity.getType());
contact.toElement().setAttribute("Login",entity.getLogin());
root.appendChild(contact);
}
doc.appendChild(root);
qDebug() << doc.toString();
return doc.toByteArray();
}
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
{
QDomDocument commonDOM;
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListTasksAMM.xml", &commonDOM))
return QByteArray();
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
listNode.toElement().setAttribute("trainee_id", QString::number(trainee_id));
if(full_list)
listNode.toElement().setAttribute("full_list", "true");
else
listNode.toElement().setAttribute("full_list", "false");
for(TaskAmmFim task : *listTasks)
{
//Задача
QDomNode taskNode = commonDOM.createElement("taskAMM");
listNode.appendChild(taskNode);
taskNode.toElement().setAttribute("task_id", QString::number(task.getID()));
taskNode.toElement().setAttribute("title", task.ammProcedure.title);
taskNode.toElement().setAttribute("dmCode", task.ammProcedure.dmCode);
taskNode.toElement().setAttribute("status", task.status);
for(SubProc subProc : task.listSubProc)
{//Подпроцедура
QDomNode subProcNode = commonDOM.createElement("SubProc");
taskNode.appendChild(subProcNode);
subProcNode.toElement().setAttribute("dmCode", subProc.getDmCode());
subProcNode.toElement().setAttribute("title", subProc.getTitle());
subProcNode.toElement().setAttribute("canplay", subProc.getModeListStr());
}
}
Tools::saveDOMtoXML("ListTasksAMM.xml", &commonDOM);
return commonDOM.toByteArray();
}
QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
{
QDomDocument commonDOM;
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListTasksFIM.xml", &commonDOM))
return QByteArray();
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
listNode.toElement().setAttribute("trainee_id", QString::number(trainee_id));
if(full_list)
listNode.toElement().setAttribute("full_list", "true");
else
listNode.toElement().setAttribute("full_list", "false");
for(TaskAmmFim task : *listTasks)
{
//Задача
QDomNode taskNode = commonDOM.createElement("taskFIM");
listNode.appendChild(taskNode);
taskNode.toElement().setAttribute("task_id", QString::number(task.getID()));
taskNode.toElement().setAttribute("title", task.title);
taskNode.toElement().setAttribute("status", task.status);
for(Malfunction malfunction : task.malfunctionList)
{//Неисправность
QDomNode malfunctionNode = commonDOM.createElement("malfunction");
taskNode.appendChild(malfunctionNode);
malfunctionNode.toElement().setAttribute("dmCode", malfunction.dmCode);
malfunctionNode.toElement().setAttribute("num", malfunction.num);
malfunctionNode.toElement().setAttribute("description", malfunction.description);
for(MalfunctionSign sign : malfunction.malfunctionSigns)
{//Сигналы
QDomNode signNode = commonDOM.createElement("malfunctionSign");
malfunctionNode.appendChild(signNode);
signNode.toElement().setAttribute("type", sign.type);
signNode.toElement().setAttribute("description", sign.description);
}
}
{//FIMReport
FIMReport report = task.report;
QDomNode reportNode = commonDOM.createElement("report");
taskNode.appendChild(reportNode);
reportNode.toElement().setAttribute("report_id", report.id);
for(FIMReportItem reportItem : task.report.itemList)
{//FIMReportItem
QDomNode reportItemNode = commonDOM.createElement("reportItem");
reportNode.appendChild(reportItemNode);
reportItemNode.toElement().setAttribute("item_id", reportItem.id);
reportItemNode.toElement().setAttribute("text", reportItem.text);
//ProcedureID
QDomNode procedureIDNode = commonDOM.createElement("procedureID");
reportItemNode.appendChild(procedureIDNode);
procedureIDNode.toElement().setAttribute("doc", reportItem.procedure.doc);
procedureIDNode.toElement().setAttribute("title", reportItem.procedure.title);
procedureIDNode.toElement().setAttribute("dmCode", reportItem.procedure.dmCode);
procedureIDNode.toElement().setAttribute("result", reportItem.procedure.result);
}
}
}
Tools::saveDOMtoXML("ListTasksFIM.xml", &commonDOM);
return commonDOM.toByteArray();
}

View File

@@ -0,0 +1,33 @@
#ifndef DBANSWERPARSER_H
#define DBANSWERPARSER_H
#include "dataparser.h"
#include "serverlmswidget.h"
#include <QObject>
#include <QDomDocument>
#include <contactModel.h>
class DBAnswerParser : public QObject
{
Q_OBJECT
public:
explicit DBAnswerParser(QObject *parent = nullptr);
void initialize(DataParser *dataParser);
QByteArray listInstructors(bool result, QList<Instructor> *listInstructors);
QByteArray listGroups(bool result, QList<Group> *listGroups);
QByteArray listTrainees(bool result, QList<Trainee> *listTrainees);
QByteArray listComputers(bool result, QList<Computer> *listComputers);
QByteArray listClassrooms(bool result, QList<Classroom> *listClassrooms);
QByteArray listContacts(bool result, QList<ContactModel> *listContacts);
QByteArray listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
QByteArray listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
signals:
private:
DataParser *dataParser;
};
#endif // DBANSWERPARSER_H

View File

@@ -0,0 +1,30 @@
#include "docsanswerparser.h"
#include "docsupdater.h"
DocsAnswerParser::DocsAnswerParser(QObject *parent) : QObject(parent)
{
}
QByteArray DocsAnswerParser::listSubProc(QList<SubProc> list, QString dmCode)
{
QDomDocument commonDOM;
if(! Tools::loadXMLtoDOM(":/resources/blankXML/ListSubProc.xml", &commonDOM))
return QByteArray();
QDomNode listNode = commonDOM.namedItem("ListSubProc");
listNode.toElement().setAttribute("dmCode", dmCode);
for(SubProc subProc : list)
{
QDomNode subProcNode = commonDOM.createElement("SubProc");
listNode.appendChild(subProcNode);
subProcNode.toElement().setAttribute("dmCode", subProc.getDmCode());
subProcNode.toElement().setAttribute("title", subProc.getTitle());
subProcNode.toElement().setAttribute("canplay", subProc.getModeListStr());
}
Tools::saveDOMtoXML("ListSubProc.xml", &commonDOM);
return commonDOM.toByteArray();
}

View File

@@ -0,0 +1,23 @@
#ifndef DOCSANSWERPARSER_H
#define DOCSANSWERPARSER_H
#include <QObject>
#include <QList>
#include "docsupdater.h"
struct SubProc;
class DocsAnswerParser : public QObject
{
Q_OBJECT
public:
explicit DocsAnswerParser(QObject *parent = nullptr);
public:
QByteArray listSubProc(QList<SubProc> list, QString dmCode);
signals:
};
#endif // DOCSANSWERPARSER_H

View File

@@ -0,0 +1,606 @@
#include "processparser.h"
#include "tasksAmmFim.h"
ProcessParser::ProcessParser(QObject *parent) : QObject(parent) //TODO: переименовать в XMLProcessParser?
{
}
void ProcessParser::initialize(ProcessingSystem *processingSystem)
{
this->processingSystem = processingSystem;
}
void ProcessParser::slot_read(ClientHandler *client, QByteArray array)
{
QXmlStreamReader xmlReader(array);
xmlReader.readNext(); // Переходим к первому элементу в файле
//Крутимся в цикле до тех пор, пока не достигнем конца документа
while(!xmlReader.atEnd())
{
//Проверяем, является ли элемент началом тега
if(xmlReader.isStartElement())
{
//Анализируем теги
if(xmlReader.name() == "ClientAutorization")
{//Запрос авторизации от клиента
clientAuth(xmlReader,client);
}
else if(xmlReader.name() == "ClientDeAutorization")
{//Запрос ДеАвторизации от клиента
clientDeAuth(xmlReader,client);
}
else if(xmlReader.name() == "QueryToDB")
{//Запрос к базе данных от клиента
queryToDb(xmlReader,client, array);
}
else if(xmlReader.name() == "QueryTasksXML")
{//Запрос файла XML с задачами
queryTasksXML(xmlReader,client);
}
else if(xmlReader.name() == "QueryListSubProc")
{//Запрос списка подпроцедур
queryListSubProc(xmlReader,client);
}
else if(xmlReader.name() == "ClientMessage")
{//Сообщение от клиента
clientMessage(xmlReader,client);
}
else if(xmlReader.name() == "ClientNotify")
{//Уведомление от клиента
clientNotify(xmlReader,client);
}
else if(xmlReader.name() == "DataInfo")
{
clientDataInfo(xmlReader,client);
}
else if(xmlReader.name() == "ListTasksAMM")
{
if(client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{//Отчет по задаче АММ от Юнити-клиента
clientUnityTaskAMMreport(xmlReader,client, array);
}
}
else if(xmlReader.name() == "ListTasksFIM")
{
if(client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{//Отчет по задаче FIM от Юнити-клиента
clientUnityTaskFIMreport(xmlReader,client, array);
}
}
else if(xmlReader.name() == "BlockAuth")
{//Запрос Блокировки Авторизации от клиента ГУИ
clientBlockAuth(xmlReader,client);
}
else
{
emit sigLogMessage("XmlParser: unrecognized tag");
}
}
xmlReader.readNext(); // Переходим к следующему элементу файла
}//while(!xmlReader.atEnd())
}
void ProcessParser::clientDataInfo(QXmlStreamReader &xmlReader,ClientHandler *client)
{
DataInfo *dataInfo = new DataInfo;
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "path")
dataInfo->path= value.toUtf8();
if(name == "size")
dataInfo->size = value.toLong();
}
processingSystem->setCurrentDataInfo(dataInfo);
}
void ProcessParser::clientUnityTaskAMMreport(QXmlStreamReader &xmlReader, ClientHandler *client, QByteArray array)
{
QDomDocument commonDOM;
commonDOM.setContent(array);
QList<TaskAmmFim> listTasks;
int trainee_id = 0;
QDomNode listNode = commonDOM.namedItem("ListTasksAMM");
trainee_id = listNode.toElement().attribute("trainee_id").toInt();
for(int i = 0; i < listNode.childNodes().count(); i++)
{
QDomNode taskNode = listNode.childNodes().at(i);
if(taskNode.nodeName() == "taskAMM")
{//Задача
TaskAmmFim task;
task.setID(taskNode.toElement().attribute("task_id").toInt());
task.ammProcedure.title = taskNode.toElement().attribute("title");
task.ammProcedure.dmCode = taskNode.toElement().attribute("dmCode");
task.status = taskNode.toElement().attribute("status");
listTasks.append(task);
//Изменение задачи
void* data = nullptr;
data = &task;
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_SET_REPORT_TASK_AMM_TO_TRAINEE;
processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data);
}
}
emit processingSystem->sigStatusTasksAMMofTraineeChanged(trainee_id);
}
void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, ClientHandler *client, QByteArray array)
{
QDomDocument commonDOM;
commonDOM.setContent(array);
QList<TaskAmmFim> listTasks;
int trainee_id = 0;
QDomNode listNode = commonDOM.namedItem("ListTasksFIM");
trainee_id = listNode.toElement().attribute("trainee_id").toInt();
for(int i = 0; i < listNode.childNodes().count(); i++)
{//Задачи
QDomNode taskNode = listNode.childNodes().at(i);
if(taskNode.nodeName() == "taskFIM")
{
TaskAmmFim task;
task.setID(taskNode.toElement().attribute("task_id").toInt());
task.title = taskNode.toElement().attribute("title");
task.status = taskNode.toElement().attribute("status");
for(int j = 0; j < taskNode.childNodes().count(); j++)
{//Неисправности
QDomNode malfOrReportNode = taskNode.childNodes().at(j);
if(malfOrReportNode.nodeName() == "malfunction")
{
/*
Malfunction malfunction;
malfunction.num = malfunctionNode.toElement().attribute("num");
malfunction.dmCode = malfunctionNode.toElement().attribute("dmCode");
malfunction.description = malfunctionNode.toElement().attribute("description");
task.malfunctionList.append(malfunction);
*/
}
else
if(malfOrReportNode.nodeName() == "report")
{//Отчет
FIMReport report;
report.id = 0; //malfOrReportNode.toElement().attribute("report_id").toInt();
for(int k = 0; k < malfOrReportNode.childNodes().count(); k++)
{
QDomNode reportItemNode = malfOrReportNode.childNodes().at(k);
if(reportItemNode.nodeName() == "item")
{
FIMReportItem reportItem;
reportItem.id = 0; //reportItemNode.toElement().attribute("item_id").toInt();
reportItem.text = reportItemNode.toElement().attribute("title");
if(reportItemNode.childNodes().count())
{
QDomNode procedureIDNode = reportItemNode.childNodes().at(0);
reportItem.procedure.doc = procedureIDNode.toElement().attribute("doc");
reportItem.procedure.title = procedureIDNode.toElement().attribute("title");
reportItem.procedure.dmCode = procedureIDNode.toElement().attribute("dmCode");
reportItem.procedure.result = procedureIDNode.toElement().attribute("result");
}
report.itemList.append(reportItem);
}
}
task.report = report;
}
}
/*
//TODO -------------- (!Заглушка!) Отчет о выполнении
FIMReport report;
FIMReportItem reportItem;
QString text; // текст, вводимый обучаемым
ProcedureID procedure; // ссылка на процедуру, при необходимости
text = "1. Выполнил такую процедуру";
procedure.doc = "fim";
procedure.title = "Процедура №1";
procedure.dmCode = "RRJ-N-27-92-00-51D01-420A-A";
procedure.result = "viewed";
reportItem.text = text;
reportItem.procedure = procedure;
report.itemList.append(reportItem);
text = "2. Выполнил такую процедуру";
procedure.doc = "fim";
procedure.title = "Процедура №2";
procedure.dmCode = "RRJ-N-28-22-00-01A01-420A-A";
procedure.result = "viewed";
reportItem.text = text;
reportItem.procedure = procedure;
report.itemList.append(reportItem);
task.report = report;
//-----------------
*/
listTasks.append(task);
//Изменение задачи
void* data = nullptr;
data = &task;
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_SET_REPORT_TASK_FIM_TO_TRAINEE;
processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data);
}
}
emit processingSystem->sigStatusTasksFIMofTraineeChanged(trainee_id);
}
TaskAmmFim ProcessParser::xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array)
{
TaskAmmFim task;
QDomDocument commonDOM;
commonDOM.setContent(array);
QDomNode mainNode = commonDOM.namedItem("QueryToDB");
task.title = mainNode.toElement().attribute("title");
for(int i = 0; i < mainNode.childNodes().count(); i++)
{
QDomNode malfunctionNode = mainNode.childNodes().at(i);
if(malfunctionNode.nodeName() == "malfunction")
{//Неисправность
Malfunction malfunction;
malfunction.num = malfunctionNode.toElement().attribute("num");
malfunction.dmCode = malfunctionNode.toElement().attribute("dmCode");
malfunction.description = malfunctionNode.toElement().attribute("description");
//Сигналы
for(int j = 0; j < malfunctionNode.childNodes().count(); j++)
{
QDomNode signNode = malfunctionNode.childNodes().at(j);
if(signNode.nodeName() == "malfunctionSign")
{
MalfunctionSign sign;
sign.type = signNode.toElement().attribute("type").toInt();
sign.description = signNode.toElement().attribute("description");
malfunction.malfunctionSigns.append(sign);
}
}
task.malfunctionList.append(malfunction);
}
}
return task;
}
TaskAmmFim ProcessParser::xmlParserQueryToDB_ASSIGN_TASK_AMM_TO_TRAINEE(QByteArray array)
{
TaskAmmFim task;
QDomDocument commonDOM;
commonDOM.setContent(array);
QDomNode mainNode = commonDOM.namedItem("QueryToDB");
task.ammProcedure.title = mainNode.toElement().attribute("title");
task.ammProcedure.dmCode = mainNode.toElement().attribute("dmCode");
for(int i = 0; i < mainNode.childNodes().count(); i++)
{
QDomNode subProcNode = mainNode.childNodes().at(i);
if(subProcNode.nodeName() == "SubProc")
{//Подпроцедура
SubProc subProc;
subProc.setTitle(subProcNode.toElement().attribute("title"));
subProc.setDmCode(subProcNode.toElement().attribute("dmCode"));
subProc.setModeListStr(subProcNode.toElement().attribute("canplay"));
task.listSubProc.append(subProc);
}
}
return task;
}
void ProcessParser::clientAuth(QXmlStreamReader &xmlReader,ClientHandler *client)
{
ClientAutorization clientAutorization;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if(name == "Login")
clientAutorization.Login = value;
else if(name == "Password")
clientAutorization.Password = value;
else if(name == "NumberOfScreen")
clientAutorization.NumberOfScreen = value.toInt();
else if(name == "TypeClient")
clientAutorization.TypeClient = (TypeClientAutorization)value.toInt();
}
processingSystem->processingClientAutorization(client, clientAutorization);
}
void ProcessParser::clientDeAuth(QXmlStreamReader &xmlReader,ClientHandler *client)
{
ClientDeAutorization clientDeAutorization;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if(name == "Login")
clientDeAutorization.Login = value;
}
processingSystem->processingClientDeAutorization(client, clientDeAutorization);
}
void ProcessParser::clientBlockAuth(QXmlStreamReader &xmlReader, ClientHandler *client)
{
bool block = false;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if(name == "Block")
block = (value == "1") ? true : false;
}
processingSystem->processingClientBlockAuth(client, block);
}
void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array)
{
ClientQueryToDB queryToDB;
int id = 0;
Instructor instructor;
Trainee trainee;
Group group;
TaskAmmFim task;
QString status = "";
void* data = nullptr;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if(name == "TypeQuery")
{
queryToDB.typeQuery = (TypeQueryToDB)value.toInt();
if(queryToDB.typeQuery == TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE)
{
task = xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(array);
}
else if(queryToDB.typeQuery == TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE)
{
task = xmlParserQueryToDB_ASSIGN_TASK_AMM_TO_TRAINEE(array);
}
}
else if(name == "id")
id = value.toInt();
else
{
switch (queryToDB.typeQuery)
{
case TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR:
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
if(name == "instructor_id")
instructor.setID(value.toInt());
else if(name == "name")
instructor.setName(value);
else if(name == "login")
instructor.setLogin(value);
else if(name == "password")
instructor.setPassword(value);
else if(name == "is_admin")
instructor.setIsAdmin(value.toInt());
else if(name == "archived")
instructor.setArchived(value.toInt());
else if(name == "logged_in")
instructor.setLoggedIn(value.toInt());
break;
case TypeQueryToDB::TYPE_QUERY_NEW_TRAINEE:
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
if(name == "trainee_id")
trainee.setID(value.toInt());
else if(name == "name")
trainee.setName(value);
else if(name == "login")
trainee.setLogin(value);
else if(name == "password")
trainee.setPassword(value);
else if(name == "archived")
trainee.setArchived(value.toInt());
else if(name == "logged_in")
trainee.setLoggedIn(value.toInt());
else if(name == "group_trainee")
{
Group group(value.toInt(), "");
trainee.setGroup(group);
}
else if(name == "computer_trainee")
{
Computer computer(value.toInt(), "", "", Classroom());
trainee.setComputer(computer);
}
break;
case TypeQueryToDB::TYPE_QUERY_NEW_GROUP:
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
if(name == "group_id")
group.setID(value.toInt());
else if(name == "name")
group.setName(value);
break;
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
/*
if(name == "title")
task.ammProcedure.title = value;
else if(name == "dmCode")
task.ammProcedure.dmCode = value;
*/
break;
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
//if(name == "title")
//task.title = value;
break;
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE:
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE:
if(name == "status")
status = value;
break;
};
}
}
switch (queryToDB.typeQuery)
{
case TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR:
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
data = &instructor;
break;
case TypeQueryToDB::TYPE_QUERY_NEW_TRAINEE:
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
data = &trainee;
break;
case TypeQueryToDB::TYPE_QUERY_NEW_GROUP:
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
data = &group;
break;
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
data = &task;
break;
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE:
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE:
data = &status;
break;
};
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
}
void ProcessParser::queryTasksXML(QXmlStreamReader &xmlReader, ClientHandler *client)
{
ClientQueryTasksXML clientQueryTasksXML;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if(name == "Type")
clientQueryTasksXML.Type = value;
}
processingSystem->processingClientQueryTasksXML(client, clientQueryTasksXML);
}
void ProcessParser::queryListSubProc(QXmlStreamReader &xmlReader, ClientHandler *client)
{
QString dmCode = "";
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if(name == "dmCode")
dmCode = value;
}
processingSystem->processingClientQueryListSubProc(client, dmCode);
}
void ProcessParser::clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client)
{
ClientMessage clientMessage;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
//addTextToLogger(name + ": " + value);
if (name == "Text")
clientMessage.Text = value;
if (name == "From")
clientMessage.From = value;
if (name == "To")
clientMessage.To = value;
}
processingSystem->processingSendMessage(clientMessage);
}
void ProcessParser::clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client)
{
ClientNotify clientNotify;
/*Перебираем все атрибуты тега*/
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "Code")
clientNotify.Code = value;
}
processingSystem->processingClientNotify(client, clientNotify);
}

View File

@@ -0,0 +1,43 @@
#ifndef PROCESSPARSER_H
#define PROCESSPARSER_H
#include <QObject>
#include <qxmlstream.h>
#include <clienthandler.h>
#include "Data/typesDataServerClient.h"
class ProcessParser : public QObject
{
Q_OBJECT
public:
explicit ProcessParser(QObject *parent = nullptr);
void initialize(ProcessingSystem *processingSystem);
public slots:
void slot_read(ClientHandler *client, QByteArray array);
signals:
void sigLogMessage(QString text);
//void sigStatusTasksAMMofTraineeChanged(int trainee_id);
//void sigStatusTasksFIMofTraineeChanged(int trainee_id);
private:
ProcessingSystem *processingSystem;
void clientAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
void clientDeAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
void clientBlockAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
void toClientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
void queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
void queryTasksXML(QXmlStreamReader &xmlReader,ClientHandler *client);
void queryListSubProc(QXmlStreamReader &xmlReader,ClientHandler *client);
void clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
void clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client);
void clientDataInfo(QXmlStreamReader &xmlReader, ClientHandler *client);
void clientUnityTaskAMMreport(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
void clientUnityTaskFIMreport(QXmlStreamReader &xmlReader,ClientHandler *client, QByteArray array = QByteArray());
TaskAmmFim xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array);
TaskAmmFim xmlParserQueryToDB_ASSIGN_TASK_AMM_TO_TRAINEE(QByteArray array);
};
#endif // PROCESSPARSER_H

View File

@@ -0,0 +1,431 @@
#include "assetsmanager.h"
AssetsManager::AssetsManager(QObject *parent) : QObject(parent)
{
}
void AssetsManager::initialize(UpdateController* updateContoller,DataParser *dataParser)
{
this->updateController = updateContoller;
//connect(this,&AssetsManager::sigSaveVersion,updateContoller,&UpdateController::saveVersionToFile);
datas = new QList<StreamingVersionData*>;
}
void AssetsManager::fillDatas()
{
QByteArray array;
QFile file(versionListFile);
if(!file.exists())
{
return;
}
datas->clear();
file.open(QIODevice::ReadOnly);
array = file.readAll();
file.close();
QXmlStreamReader xmlReader(array);
xmlReader.readNext();
QString name = xmlReader.name().toString();
while(!xmlReader.atEnd())
{
name = xmlReader.name().toString();
if(!xmlReader.isStartElement()) {
xmlReader.readNext();
continue;
}
if(xmlReader.name() == "VersionList")
{
xmlReader.readNext();
while (!xmlReader.atEnd())
{
if(xmlReader.isStartElement())
{
if(xmlReader.name() == "VersionData")
{
StreamingVersionData *data = new StreamingVersionData();
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "Version")
data->setViewName(value);
else if(name == "Created")
data->setCreateData(QDateTime::fromString(value));
else if(name == "isChangeable")
data->setIsChangeable(value.toInt());
else if(name == "author")
data->setAuthor(value);
}
datas->append(data);
}
}
xmlReader.readNext();
}
}
}
}
void AssetsManager::setVersionList(QList<StreamingVersionData*> *streamingVersion)
{
datas->clear();
datas = streamingVersion;
}
bool AssetsManager::findDuplicate(QString name)
{
QListIterator<StreamingVersionData*> iterator(*datas);
while (iterator.hasNext())
{
if (iterator.next()->getViewName() == name) return true;
}
return false;
}
QString AssetsManager::setVersion(QString versionName)
{
QListIterator<StreamingVersionData*> iterator(*datas);
while (iterator.hasNext())
{
StreamingVersionData *version = iterator.next();
if (version->getViewName() == versionName)
{
currentVersionData = version;
saveVersionToFile(currentVersionData);
emit signal_setVersion(versionName);
return version->getAbsolutPath();
}
}
return "none";
}
QList<FileData> *AssetsManager::prepareLocalPathList(QList<FileData> *fileData)
{
QList<FileData> *completeList = fileData;
for(int i = 0; i < completeList->count();i++)
{
FileData fileData = completeList->at(i);
int index = fileData.path.indexOf(currentVersionData->getViewName());
if(index != -1)
{
fileData.path = Tools::createRealPath(fileData.path,currentVersionData); //делаем в полный путь
completeList->replace(i,fileData);
}
else
{
fileData.path = Tools::createRootPath(fileData.path);
}
}
return completeList;
}
QList<FileData> *AssetsManager::prepareRealPathList(QList<FileData> *fileData)
{
QList<FileData> *completeList = fileData;
for(int i = 0; i < completeList->count();i++)
{
FileData fileData = completeList->at(i);
if(fileData.path.contains(streamingAssetsFolderName))
{
fileData.path = Tools::createStreamingToRealPath(fileData.path,currentVersionData);
}
else
{
fileData.path = Tools::createRealPath(fileData.path,currentVersionData); //делаем в полный путь
}
completeList->replace(i,fileData);
}
return completeList;
}
void AssetsManager::addVersion(StreamingVersionData *data)
{
datas->push_back(data);
}
void AssetsManager::createCopyVersion(QString versionName,QString newVersionName,QString author)
{
qDebug() << "assetManager thread ID " << QThread::currentThreadId();
StreamingVersionData* data = new StreamingVersionData;
data->setAbsolutePath(Tools::createSharedPath("/" + newVersionName));
data->setAuthor(author);
data->setIsChangeable(true);
data->setViewName(newVersionName);
data->setCreateData(QDateTime::currentDateTime());
datas->append(data);
qDebug() << "Version for copy " << versionName;
qDebug() << "New version name " << newVersionName;
//берем путь до копии
//преобразуем в реальный путь
QString sourcePath = QDir::currentPath() + "/" + sharedDataFolderName + "/" + versionName;
QString destinationPath = QDir::currentPath() + "/" + sharedDataFolderName + "/" + newVersionName;
QDir sourceDir(sourcePath);
if(!sourceDir.exists())
{
qDebug() << "Версии нет в SharedData";
return;
}
QDir destinationDir(destinationPath);
if(destinationDir.exists())
{
qDebug() << "Папка уже существует";
return;
}
//Создаем папку в Shared с новым именем
QDir().mkdir(destinationPath);
copyAllRecurse(sourcePath,destinationPath);
//добавляем в список текущих ассетов
updateController->calculateFullHash();
updateController->changeAssetVersion(newVersionName);
updateController->sendNewVersionList();
//повторно отправляем список версий из папки shared
}
void AssetsManager::deleteVersion(QString versionName)
{
QMutableListIterator<StreamingVersionData*> iterator(*datas);
//если версия равна текущей - игнор
if (currentVersionData->getViewName() == versionName)
return;
while (iterator.hasNext())
{
StreamingVersionData *version = iterator.next();
//проверка на наличие указанной версии
if (version->getViewName() == versionName)
{
//удаление папки
QString verFolderPath = QDir::currentPath() + "/" + sharedDataFolderName + "/" + versionName;
QDir dir(verFolderPath);
dir.removeRecursively();
//удаление хэша
QString hashPath = QDir::currentPath() + "/" + staticDataFolderName + "/" + versionName + "Hash.xml";
QFile file(hashPath);
if(file.exists()){
file.remove();
}
//удаление
datas->removeOne(version);
break;
}
}
updateController->calculateSharedHash();
updateController->sendNewVersionList();
}
void AssetsManager::copyAllRecurse(QString source,QString destination)
{
//Копируем все объекты туда
QDir sourceDir(source);
foreach(QString folder,sourceDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{
QString destPath = destination + QDir::separator() + folder;
sourceDir.mkpath(destPath);
copyAllRecurse(source + QDir::separator() + folder,destPath);
}
foreach(QString file,sourceDir.entryList(QDir::Files))
{
QFile::copy(source + QDir::separator() + file,destination + QDir::separator() + file);
}
}
void AssetsManager::writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst)
{
QList<SXmlAnswerTag> listTag;
datas->clear();
QFile file(versionListFile);
foreach(StreamingVersionData* ver,version)
{
SAttribute attribute1 = {"Version", ver->getViewName()};
SAttribute attribute2 = {"Created", ver->getCreateData().toString()};
SAttribute attribute3;
SAttribute attribute4;
if(isFirst)
{
attribute3 = {"isChangeable",QString::number(false)};
QString author = tr("LLC Constanta-Design");
attribute4 = {"author",author};
ver->setAuthor(author);
}else
{
attribute3 ={"isChangeable",QString::number(ver->getIsChangeable())};
attribute4 = {"author",ver->getAuthor()};
}
QList<SAttribute> listAttr = {attribute1, attribute2,attribute3,attribute4};
SXmlAnswerTag tag = {"VersionData", listAttr};
listTag.append(tag);
datas->append(ver);
}
file.open(QIODevice::WriteOnly);
QXmlStreamWriter xmlWriter(&file);
xmlWriter.setAutoFormatting(true);
xmlWriter.writeStartDocument();
xmlWriter.writeStartElement("VersionList");
foreach(SXmlAnswerTag tag,listTag)
{
xmlWriter.writeStartElement(tag.elementName);
foreach(SAttribute attribute,tag.attr)
{
xmlWriter.writeAttribute(attribute.name,attribute.value);
}
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
file.close();
}
void AssetsManager::createFirstVersionListXML(QList<StreamingVersionData*> version)
{
QFile file(versionListFile);
QList<StreamingVersionData*> *temp = new QList<StreamingVersionData*>();
if(!file.exists())
{
writeVersionsToFile(version,true);
}
else
{
if(datas->count() == 0) fillDatas();
foreach(StreamingVersionData* ver,version)
{
foreach(StreamingVersionData* data,*datas)
{
if(ver->getViewName() == data->getViewName())
{
StreamingVersionData *tempData = new StreamingVersionData;
tempData->fill(data);
tempData->setAbsolutePath(ver->getAbsolutPath());
temp->append(tempData);
break;
}
}
}
writeVersionsToFile(*temp,false);
}
}
QString AssetsManager::getLastVersion()
{
QString result;
QFile file(version);
if (!file.exists()) return setVersion("base");
if (file.open(QIODevice::ReadOnly))
{
QXmlStreamReader reader(file.readAll());
while (!reader.atEnd())
{
reader.readNext();
foreach(const QXmlStreamAttribute &attr,reader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "Version")
{
result = value;
qDebug() << value;
break;
}
}
}
}
return setVersion(result);
}
void AssetsManager::saveVersionToFile(StreamingVersionData *streamingVersion) //TODO: переименовать и перебросить в AssetManager
{
QFile file(version);
file.open(QFile::WriteOnly);
QXmlStreamWriter xmlWriter(&file);
xmlWriter.setAutoFormatting(true);
xmlWriter.writeStartDocument();
xmlWriter.writeStartElement("VersionData");
xmlWriter.writeAttribute("Version",streamingVersion->getViewName());
xmlWriter.writeAttribute("Created",streamingVersion->getCreateData().toString());
xmlWriter.writeAttribute("isChangeable",QString::number(streamingVersion->getIsChangeable()));
xmlWriter.writeAttribute("author",streamingVersion->getAuthor());
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
file.close();
}
AssetsManager::~AssetsManager()
{
}
StreamingVersionData *AssetsManager::getCurrentVersionData() const
{
return currentVersionData;
}

View File

@@ -0,0 +1,48 @@
#ifndef ASSETSMANAGER_H
#define ASSETSMANAGER_H
#include <QObject>
#include <Systems/updatecontroller.h>
#include <Data/StreamingVersionData.h>
class AssetsManager : public QObject
{
Q_OBJECT
public:
explicit AssetsManager(QObject *parent = nullptr);
void initialize(UpdateController* updateContoller,DataParser *dataParser);
void addVersion(StreamingVersionData *data);
void createCopyVersion(QString versionName,QString newName,QString author);
void deleteVersion(QString version);
void setVersionList(QList<StreamingVersionData *> *streamingVersion);
bool findDuplicate(QString name);
void createFirstVersionListXML(QList<StreamingVersionData*> assets);
QString getLastVersion();
QString setVersion(QString versionName);
QList<FileData> *prepareLocalPathList(QList<FileData>*fileData);
QList<FileData> *prepareRealPathList(QList<FileData> *fileData);
QList<FileData> *getRealPathList();
~AssetsManager();
StreamingVersionData *getCurrentVersionData() const;
void saveVersionToFile(StreamingVersionData *streamingVersion);
void writeVersionsToFile(QList<StreamingVersionData*> version,bool isFirst);
signals:
void sigSaveVersion(StreamingVersionData *versionData);
void signal_setVersion(QString versionStr);
private:
UpdateController *updateController;
QList<StreamingVersionData*> *datas;
StreamingVersionData* currentVersionData;
void copyAllRecurse(QString source, QString destination);
void fillDatas();
};
#endif // ASSETSMANAGER_H

View File

@@ -0,0 +1,81 @@
#include "chatsystem.h"
ChatSystem::ChatSystem()
{
}
void ChatSystem::initialize(CommonClientHandler *commonClientHandler, DataParser *dataParser, QMap<int, ClientHandler*> *clientsMap)
{
this->commonClientHandler = commonClientHandler;
this->dataParser = dataParser;
this->clientsMap = clientsMap;
clientNotSendedMessage = new QMap<QString,QQueue<ClientMessage>*>;
}
bool ChatSystem::sendTo(ClientMessage message)
{
QByteArray byteArrayMsg = dataParser->ClientAnswer()->message(message.From,message.To,message.Text);
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
if(handler->getClient()->getId() == message.To &&
handler->getClient()->getTypeClient() != TypeClientAutorization::TYPE_QT_CLIENT &&
handler->getClient()->getIsLoggedIn())
{
handler->sendXmlAnswer(byteArrayMsg, PacketType::TYPE_XMLANSWER);
QString str = "Msg From Client [" + message.From + " to " + message.To + "] : " + message.Text;
return true;
}
}
return false;
}
bool ChatSystem::sendMessage(ClientMessage message)
{
bool isSended = false;
isSended = sendTo(message);
if (!isSended)
{
if (clientNotSendedMessage->contains(message.To))
{
clientNotSendedMessage->find(message.To).value()->append(message);
}
else
{
auto stack = new QQueue<ClientMessage>;
stack->enqueue(message);
clientNotSendedMessage->insert(message.To, stack);
}
qDebug() << "Message stack count: " + QString::number(clientNotSendedMessage->count());
}
return true;
}
void ChatSystem::sendOldMessages(QString id)
{
qDebug() << id;
if (clientNotSendedMessage->contains(id))
{
auto queue = clientNotSendedMessage->find(id).value();
Logger::instance().log("Send old Messages " + QString::number(queue->length()));
while (!queue->isEmpty())
{
auto message = queue->dequeue();
sendTo(message);
}
}
else
{
qDebug() << "client empty";
}
}

View File

@@ -0,0 +1,27 @@
#ifndef CHATSYSTEM_H
#define CHATSYSTEM_H
#include "commonclienthandler.h"
#include <QObject>
#include <Data/typesDataServerClient.h>
class ChatSystem : public QObject
{
Q_OBJECT
public:
ChatSystem();
void initialize(CommonClientHandler *commonClientHandler, DataParser *dataParser, QMap<int, ClientHandler*> *clientsMap);
bool sendMessage(ClientMessage message);
//логика хранения отложенных сообщений
//хендлеры для отправки и приема
void sendOldMessages(QString id);
private:
CommonClientHandler *commonClientHandler;
DataParser *dataParser;
QMap<int, ClientHandler*> *clientsMap;
QMap<QString,QQueue<ClientMessage>*> *clientNotSendedMessage;
bool sendTo(ClientMessage message);
};
#endif // CHATSYSTEM_H

View File

@@ -0,0 +1,168 @@
#include "commonclienthandler.h"
CommonClientHandler::CommonClientHandler(QObject *parent) : QObject(parent)
{
}
void CommonClientHandler::initialize(QMap<int, ClientHandler *> *clientsMap, ProcessingSystem *processingSystem, DataParser *dataParser)
{
this->clientsMap = clientsMap;
this->processingSystem = processingSystem;
this->dataParser = dataParser;
}
void CommonClientHandler::sendNewVersionListToAllClient()
{
foreach(int idSocket,clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
if (!handler->getClient()->getIsLoggedIn()) continue;
handler->sendVersionList();
}
}
void CommonClientHandler::sendCurrentVersionToAllClient()
{
foreach(int idSocket,clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
if (!handler->getClient()->getIsLoggedIn()) continue;
handler->sendVersion();
}
}
void CommonClientHandler::slot_ListsInstructorsTraineesChanged()
{
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
//Проверяем, есть ли клиенты TYPE_GUI
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
{//Отправляем этому клиенту обновление списков
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS;
processingSystem->processingClientQueryToDB(handler, queryToDB);
}
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST;
processingSystem->processingClientQueryToDB(handler, queryToDB);
}
}
}
void CommonClientHandler::slot_StatusTasksAMMofTraineeChanged(int trainee_id)
{
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
//Проверяем, есть ли клиенты TYPE_GUI
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
{//Отправляем этому клиенту задачи AMM для Обучаемого (с измененным статусом)
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_TASKS_AMM_FOR_TRAINEE;
processingSystem->processingClientQueryToDB(handler, queryToDB, trainee_id);
}
}
/*
//Отправка списка задач AMM клиенту Юнити
if(ClientHandler* clientUnity = processingSystem->getUnityClientById(trainee_id))
{//Есть такой
//processingSystem->sendListTasksAMMofTraineetoClient(clientUnity, trainee_id);
}*/
}
void CommonClientHandler::slot_StatusTasksFIMofTraineeChanged(int trainee_id)
{
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
//Проверяем, есть ли клиенты TYPE_GUI
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
{//Отправляем этому клиенту задачи FIM для Обучаемого (с измененным статусом)
ClientQueryToDB queryToDB;
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE;
processingSystem->processingClientQueryToDB(handler, queryToDB, trainee_id);
}
}
/*
//Отправка списка задач FIM клиенту Юнити
if(ClientHandler* clientUnity = processingSystem->getUnityClientById(trainee_id))
{//Есть такой
//processingSystem->sendListTasksFIMofTraineetoClient(clientUnity, trainee_id);
}*/
}
void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType)
{
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
if (!handler->getClient()->getIsLoggedIn()) continue;
handler->sendPacketType(packetType);
Logger::instance().log("AllSending " + handler->getClient()->getLogin() + " " + enumToString(packetType));
}
emit sigSetServerState(packetType);
}
void CommonClientHandler::slot_sendTaskToClient(QString fullNameClient,QString textTask)
{
QByteArray byteArrayTask = dataParser->ClientAnswer()->task(textTask);
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
if(handler->getClient()->getFullName() == fullNameClient)
{//Отправляем ему
handler->getSocket()->write(byteArrayTask);
QString peerAddress = handler->getSocket()->peerAddress().toString();
QString peerPort = QString::number(handler->getSocket()->peerPort());
}
}
}
void CommonClientHandler::slot_DocsChanged()
{
//Проходим все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *handler = clientsMap->value(idSocket);
TypeClientAutorization type = handler->getClient()->getTypeClient();
//Отправляем всем заинтересованным клиентам оповещение об изменении docs.xml
if(type == TypeClientAutorization::TYPE_GUI)
{
handler->sendPacketType(PacketType::TYPE_XMLANSWER_DOCS_CHANGED);
}
else if(type == TypeClientAutorization::TYPE_QT_CLIENT)
{
handler->sendPacketType(PacketType::TYPE_XMLANSWER_DOCS_CHANGED);
}
else if(type == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
//handler->sendPacketType(PacketType::TYPE_XMLANSWER_DOCS_CHANGED); //Unity не обязательно!
}
}
}

View File

@@ -0,0 +1,38 @@
#ifndef COMMONCLIENTHANDLER_H
#define COMMONCLIENTHANDLER_H
#include <QObject>
#include "clienthandler.h"
class ProcessingSystem;
class DataParser;
class Logger;
class CommonClientHandler : public QObject
{
Q_OBJECT
public:
explicit CommonClientHandler(QObject *parent = nullptr);
void initialize(QMap<int, ClientHandler*> *clientsMap,
ProcessingSystem *processingSystem,
DataParser *dataParser);
void sendNewVersionListToAllClient();
void sendCurrentVersionToAllClient();
void slot_ListsInstructorsTraineesChanged();
void slot_StatusTasksAMMofTraineeChanged(int trainee_id);
void slot_StatusTasksFIMofTraineeChanged(int trainee_id);
void slot_sendPacketToAllClients(PacketType packetType);
bool slotSendMessage(QString loginFrom, QString loginTo, QString text);
void slot_sendTaskToClient(QString fullNameClient, QString textTask);
void slot_DocsChanged();
signals:
void sigSetServerState(PacketType packetType);
private:
QMap<int, ClientHandler*> *clientsMap;
ProcessingSystem *processingSystem;
DataParser *dataParser;
};
#endif // COMMONCLIENTHANDLER_H

View File

@@ -0,0 +1,372 @@
#include <QString>
#include "docsupdater.h"
#include "tools.h"
DocsUpdater::DocsUpdater(UpdateController* updateController, QObject *parent):
QObject(parent),
updateController(updateController),
flagStop(false)
{
}
DocsUpdater::~DocsUpdater()
{
}
//PUBLIC
void DocsUpdater::lockAccessToDocsXML()
{
mtxAccess.lock();
}
void DocsUpdater::unLockAccessToDocsXML()
{
mtxAccess.unlock();
}
QList<SubProc> DocsUpdater::getListSubProcForDMcode(QString dmCode)
{
QMutexLocker locker(&mtxAccess);
if(!listSubProcMap.contains(dmCode))
return QList<SubProc>();
return listSubProcMap.value(dmCode);
}
bool DocsUpdater::updateDocsXML()
{
QMutexLocker locker(&mtxAccess);
QString nameDocsFile = tasksAMMfileName; //кручу верчу запутать хочу!
QString pathDocsFile = updateController->getPathAdditionalFile(nameDocsFile);
QDomDocument docTasksDOM;
if(! Tools::loadXMLtoDOM(pathDocsFile, &docTasksDOM))
return false;
QDomElement manifestElement = docTasksDOM.firstChildElement("manifest");
if(manifestElement.isNull())
return false;
deleteAllModulsAMM();
listTasksAMM.clear();
listSubProcMap.clear();
DMmodulesMap.clear();
domElementParserAMM(manifestElement, nullptr);
if(! Tools::saveDOMtoXML(pathDocsFile, &docTasksDOM))
{
deleteAllModulsAMM();
listTasksAMM.clear();
listSubProcMap.clear();
DMmodulesMap.clear();
return false;
}
//Проставляем canplay
for (auto it = listSubProcMap.begin(); it != listSubProcMap.end(); ++it)
{
QList<SubProc> listSP = it.value();
QString keyToReplace = it.key();
if(listSP.count())
{
for(int i = 0; i < listSP.count(); i++)
{
QString dmCode = listSP.at(i).getDmCode();
DM* module = getDMmoduleByDMcode(dmCode);
if(module)
{
SubProc sp = listSP.at(i);
sp.setModeList(module->getModeList());
listSP.replace(i, sp);
}
}
if (!keyToReplace.isEmpty())
{
listSubProcMap[keyToReplace] = listSP;
}
}
}
return true;
}
//PRIVATE
void DocsUpdater::domElementParserAMM(QDomElement element, Module* moduleParent)
{
QString name;
if(flagStop)
return;
QDomElement childElement = element.firstChildElement();
if(childElement.isNull())
return;
Module* module = nullptr;
do
{
name = childElement.nodeName();
QDomNamedNodeMap nodeMap = childElement.attributes();
if(name == "doc")
{
module = new PM();
}
else if(name == "pm")
{
module = new PM();
PM* PMmodul = static_cast<PM*>(module);
PMmodul->initialize(nodeMap.namedItem("modelIdentCode").nodeValue(),
nodeMap.namedItem("pmIssuer").nodeValue(),
nodeMap.namedItem("pmNumber").nodeValue(),
nodeMap.namedItem("pmVolume").nodeValue());
if(moduleParent)
{
PMmodul->setParentModule(moduleParent);
PM* PMmodulParent = static_cast<PM*>(moduleParent);
PMmodulParent->addChildModule(module);
}
}
else if(name == "dm")
{
module = new DM();
DM* DMmodul = static_cast<DM*>(module);
DMmodul->initialize(nodeMap.namedItem("modelIdentCode").nodeValue(),
nodeMap.namedItem("systemDiffCode").nodeValue(),
nodeMap.namedItem("systemCode").nodeValue(),
nodeMap.namedItem("subSystemCode").nodeValue(),
nodeMap.namedItem("subSubSystemCode").nodeValue(),
nodeMap.namedItem("assyCode").nodeValue(),
nodeMap.namedItem("disassyCode").nodeValue(),
nodeMap.namedItem("disassyCodeVariant").nodeValue(),
nodeMap.namedItem("infoCode").nodeValue(),
nodeMap.namedItem("infoCodeVariant").nodeValue(),
nodeMap.namedItem("itemLocationCode").nodeValue());
if(moduleParent)
{
DMmodul->setParentModule(moduleParent);
PM* PMmodulParent = static_cast<PM*>(moduleParent);
PMmodulParent->addChildModule(module);
}
DMmodulesMap.insert(DMmodul->dmCode(), DMmodul);
}
else if(name == "rus" || name == "eng")
{
if(moduleParent)
{
if(moduleParent->getType() == ModuleType::TYPE_PM)
{//PM
PM* PMmodulParent = static_cast<PM*>(moduleParent);
if(name == "rus")
PMmodulParent->setLangStructRus(nodeMap.namedItem("title").nodeValue());
else
PMmodulParent->setLangStructEng(nodeMap.namedItem("title").nodeValue());
}
else
{//DM
DM* DMmodulParent = static_cast<DM*>(moduleParent);
if(name == "rus")
{
DMmodulParent->setLangStructRus(nodeMap.namedItem("techName").nodeValue(),
nodeMap.namedItem("infoName").nodeValue(),
nodeMap.namedItem("pdf").nodeValue(),
nodeMap.namedItem("bookmark").nodeValue(),
nodeMap.namedItem("xml").nodeValue());
QString dmCode = DMmodulParent->dmCode();
QString canplay = "";
QList<SubProc> listSubProc;
if(processingScenXML(dmCode, canplay, listSubProc))
{
DMmodulParent->setModeList(SubProc::parseCanplay(canplay));
nodeMap.namedItem("canplay").setNodeValue(canplay);
listSubProcMap.insert(dmCode, listSubProc);
}
else
{
DMmodulParent->setModeList(SubProc::parseCanplay(canplay));
nodeMap.namedItem("canplay").setNodeValue(canplay);
}
}
else
DMmodulParent->setLangStructEng(nodeMap.namedItem("techName").nodeValue(),
nodeMap.namedItem("infoName").nodeValue(),
nodeMap.namedItem("pdf").nodeValue(),
nodeMap.namedItem("bookmark").nodeValue(),
nodeMap.namedItem("xml").nodeValue());
}
}
}
domElementParserAMM(childElement, module);
if(moduleParent == nullptr)
listAllModulesAMM.append(module);
if(module)
if(module->getType() == ModuleType::TYPE_DM)
{
TaskAmmFim* task = nullptr;
task = new TaskAmmFim();
task->setID(module->getID());
task->ammProcedure.title = static_cast<DM*>(module)->getLangStructRus().techName;
task->ammProcedure.dmCode = static_cast<DM*>(module)->dmCode();
listTasksAMM.append(*task);
delete task;
}
}while (! (childElement = childElement.nextSiblingElement()).isNull());
}
void DocsUpdater::deleteAllModulsAMM()
{
for(Module* module: listAllModulesAMM)
{
if(module->getType() == ModuleType::TYPE_PM)
delete static_cast<PM*>(module);
else
delete static_cast<DM*>(module);
}
listAllModulesAMM.clear();
}
bool DocsUpdater::processingScenXML(const QString dmCode, QString &canplay, QList<SubProc> &listSubProc)
{
listSubProc.clear();
ModeList modeList;
canplay = "";
QString signDemo = "-";
QString signTrain = "-";
QString signExam = "-";
QString signAuto = "-";
QString nameScenXMLFile = "/" + dmCode + ".xml";
QString pathScenXMLFile = updateController->getPathScensFile(nameScenXMLFile);
QDomDocument docScenDOM;
if(! Tools::loadXMLtoDOM(pathScenXMLFile, &docScenDOM))
return false;
QDomElement scenarioElement = docScenDOM.firstChildElement("scenario");
if(scenarioElement.isNull())
return false;
QDomElement demoElement = scenarioElement.firstChildElement("demo");
if(!demoElement.isNull())
{
//canplay
if(demoElement.toElement().attribute("canplay") == "True")
{
signDemo = "+";
modeList.demo = true;
}
//subProc
selectSubProc(demoElement, listSubProc);
}
QDomElement trainElement = scenarioElement.firstChildElement("train");
if(!trainElement.isNull())
{
//canplay
if(trainElement.toElement().attribute("canplay") == "True")
{
signTrain = "+";
modeList.train = true;
}
//subProc
selectSubProc(trainElement, listSubProc);
}
QDomElement examElement = scenarioElement.firstChildElement("exam");
if(!examElement.isNull())
{
//canplay
if(examElement.toElement().attribute("canplay") == "True")
{
signExam = "+";
modeList.exam = true;
}
//subProc
selectSubProc(examElement, listSubProc);
}
QDomElement autoElement = scenarioElement.firstChildElement("auto");
if(!autoElement.isNull())
{
//canplay
if(autoElement.toElement().attribute("canplay") == "True")
{
signAuto = "+";
modeList.autoM = true;
}
//subProc
//Из этого режима не берем!
}
canplay = QString("%1/%2/%3/%4").arg(signDemo, signTrain, signExam, signAuto);
return true;
}
void DocsUpdater::selectSubProc(QDomElement &modeElement, QList<SubProc> &listSubProc)
{
QDomNodeList nodeList = modeElement.elementsByTagName("node");
for(int i = 0; i < nodeList.count(); i++)
{
QDomNode node = nodeList.at(i);
if(node.toElement().attribute("type") == "Subproc")
{
QDomElement subProcElement = node.firstChildElement("subproc");
if(!subProcElement.isNull())
{
SubProc subProc;
subProc.setDmCode(subProcElement.toElement().attribute("dmCode"));
subProc.setTitle(subProcElement.toElement().attribute("title"));
if(! listSubProc.contains(subProc))
listSubProc.append(subProc);
}
}
}
}
DM *DocsUpdater::getDMmoduleByDMcode(QString dmCode)
{
if(!DMmodulesMap.contains(dmCode))
return nullptr;
return DMmodulesMap.value(dmCode);
}

View File

@@ -0,0 +1,44 @@
#ifndef DOCSUPDATER_H
#define DOCSUPDATER_H
#include <QObject>
#include "updatecontroller.h"
#include "module.h"
class DocsUpdater : public QObject
{
Q_OBJECT
public:
DocsUpdater(UpdateController* updateController, QObject *parent = nullptr);
~DocsUpdater();
public:
void lockAccessToDocsXML();
void unLockAccessToDocsXML();
QList<SubProc> getListSubProcForDMcode(QString dmCode);
bool updateDocsXML();
private:
void domElementParserAMM(QDomElement element, Module* moduleParent);
void deleteAllModulsAMM();
bool processingScenXML(const QString dmCode, QString& canplay, QList<SubProc>& listSubProc);
void selectSubProc(QDomElement& modeElement, QList<SubProc>& listSubProc);
DM* getDMmoduleByDMcode(QString dmCode);
private:
UpdateController* updateController;
QMutex mtxAccess;
bool flagStop;
QList<Module*> listAllModulesAMM; //?
QList<TaskAmmFim> listTasksAMM; //?
QMap<QString, DM*> DMmodulesMap; //общий (линейный) словарь всех DM-модулей
QMap<QString, QList<SubProc>> listSubProcMap; //словарь подпроцедур для всех DM-модулей
};
#endif // DOCSUPDATER_H

View File

@@ -0,0 +1,98 @@
#include "fasthashcalculator.h"
#include <QtConcurrent>
FastHashCalculator::FastHashCalculator(QObject *parent) : QObject(parent)
{
hashList = new QList<FileData>();
}
void FastHashCalculator::calculateHashes(QString path)
{
hashList->clear();
if(!QDir(path).exists()){
QDir().mkdir(path);
}
QString hashString;
QStringList filter;
filter << "*";
QList<FileData> *folders = new QList<FileData>;
QDirIterator dirIterator(path,filter, QDir::AllEntries, QDirIterator::Subdirectories);
while (dirIterator.hasNext())
{
QFileInfo fileInfo(dirIterator.next());
FileData currentFolder;
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != projectFolderName)
{
currentFolder.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
currentFolder.hash = "FOLDER";
if(!folders->contains(currentFolder))
{
folders->push_back(currentFolder);
}
}
}
hashList->append(*folders);
QDirIterator fileIterator(path,filter,QDir::Files | QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
QList<QString> files;
files.clear();
while(fileIterator.hasNext())
{
fileIterator.next();
QFileInfo fileInfo = fileIterator.fileInfo();
QString path = fileInfo.absoluteFilePath();
//фильтры
if (fileInfo.isHidden()) continue;
if (!fileInfo.isFile()) continue;
if (fileInfo.fileName().contains(".meta")) continue;
if (fileInfo.fileName() == "docs.xml") continue;
files.append(path);
}
QtConcurrent::map(files, [this](const QString &filePath)
{
QByteArray hash = calculateFileHashOptimized(filePath);
QMutexLocker locker(&_mutex);
FileData currentFile;
QString hashName;
currentFile.path = Tools::createLocalPath(filePath);
currentFile.hash = hash.toHex();
hashList->append(currentFile);
}).waitForFinished();
emit finished();
}
QByteArray FastHashCalculator::calculateFileHashOptimized(const QString &filePath)
{
QFile file(filePath);
if (!file.open(QIODevice::ReadOnly)) return QByteArray();
QCryptographicHash hash(QCryptographicHash::Md5);
const qint64 bufferSize = 2 * 1024; // 2MB
QByteArray buffer;
buffer.resize(bufferSize);
while (!file.atEnd()) {
qint64 bytesRead = file.read(buffer.data(), bufferSize);
hash.addData(buffer.constData(), bytesRead);
}
return hash.result();
}
QList<FileData> *FastHashCalculator::getHashList() const
{
return hashList;
}

View File

@@ -0,0 +1,31 @@
#ifndef FASTHASHCALCULATOR_H
#define FASTHASHCALCULATOR_H
#include <QHash>
#include <QMutex>
#include <QObject>
#include <QFile>
#include <QDirIterator>
#include <Data/typesDataServerClient.h>
#include "tools.h"
class FastHashCalculator : public QObject
{
Q_OBJECT
public:
explicit FastHashCalculator(QObject *parent = nullptr);
void calculateHashes(QString path);
QList<FileData> *getHashList() const;
signals:
void finished();
private:
QByteArray calculateFileHashOptimized(const QString &filePath);
void calculateSingleHash(const QString &filePath);
QList<FileData>* hashList;
QMutex _mutex;
};
#endif // FASTHASHCALCULATOR_H

View File

@@ -0,0 +1,138 @@
#include "logger.h"
#include <QThread>
Logger::Logger()
{
connect(this,&Logger::sigAddToLogger, this, &Logger::handleLog,Qt::AutoConnection);
createDirectory();
}
Logger &Logger::instance()
{
static Logger logger;
return logger;
}
Logger::~Logger()
{
}
void Logger::setLoggingType(LoggingType type)
{
this->loggingType = type;
}
void Logger::log(QString message, LogLevel level)
{
emit sigAddToLogger(message,level);
}
void Logger::setLogFile(QString filePath)
{
QMutexLocker locker(&mutex);
if (logFile.isOpen())
{
logFile.close();
}
logFile.setFileName(filePath);
logFile.open(QIODevice::WriteOnly | QIODevice::Append);
}
void Logger::setLogToFile(bool flag)
{
isLogToFile = flag;
if (flag)
{
QString filePath = logFolderPath + "/" + "log " + QDateTime::currentDateTime().toString("dd-MM-yyyy")+".txt";
setLogFile(filePath);
}
}
void Logger::handleLog(QString msg, LogLevel logLevel)
{
/*
color: red; * Красный *
color: green; * Зелёный *
color: blue; * Синий *
color: yellow; * Жёлтый *
color: black; * Чёрный *
color: white; * Белый *
color: purple; * Фиолетовый *
color: orange; * Оранжевый *
color: pink; * Розовый *
color: brown; * Коричневый *
color: gray; * Серый *
*/
QString level;
QString colorLevel = "pink";
#ifndef PROJECT_TYPE_DEBUG
if(logLevel == DEBUG)
return;
#endif
switch (logLevel)
{
case INFO:
level = "INFO";
colorLevel = "green";
break;
case WARNING:
level = "WARNING";
colorLevel = "yellow";
break;
case ERROR:
level = "ERROR";
colorLevel = "red";
break;
case CRITICAL:
level = "CRITICAL";
colorLevel = "purple";
break;
case DEBUG:
level = "DEBUG";
colorLevel = "brown";
break;
}
QString timeStamp = QDateTime::currentDateTime().toString("hh:mm:ss");
QString message = timeStamp + " " + level + " " + msg;
QString messageHTML = QString("<p><span style=\"color: blue;\">%1</span> <span style=\"color: %2;\">%3</span> <span style=\"color: black;\">%4</span></p>").
arg(timeStamp, colorLevel, level, msg);
if (loggingType == LoggingType::WIDGET)
{
emit sigLogToWidget(messageHTML);
}
else if(loggingType == LoggingType::CONSOLE)
{
qDebug() << messageHTML;
}
if(isLogToFile)
{
QMutexLocker locker(&mutex);
if (logFile.isOpen())
{
QTextStream stream(&logFile);
stream << message << "\n";
}
}
}
void Logger::createDirectory()
{
QString directoryPath = logFolderPath;
QDir dir(directoryPath);
if(!dir.exists()) dir.mkdir(".");
}

View File

@@ -0,0 +1,59 @@
#ifndef LOGGER_H
#define LOGGER_H
#include <QPlainTextEdit>
#include <QDateTime>
#include <QMutex>
#include <QObject>
#include <QDebug>
#include <QDir>
#include "Systems/tools.h"
enum LogLevel
{
INFO,
WARNING,
ERROR,
CRITICAL,
DEBUG
};
enum LoggingType
{
WIDGET,
CONSOLE,
TOFILE
};
class Logger : public QObject
{
Q_OBJECT
public:
Logger();
static Logger& instance();
~Logger();
void setWidget(QPlainTextEdit * widget);
void setLoggingType(LoggingType type);
void log(QString message,LogLevel level = INFO);
void setLogFile(QString filePath);
void setLogToFile(bool flag);
public slots:
void handleLog(QString msg,LogLevel logLevel = INFO);
signals:
void sigAddToLogger(QString msg, LogLevel logLevel = INFO);
void sigLogToWidget(QString message);
private:
QString msg;
QFile logFile;
LoggingType loggingType;
QMutex mutex;
bool isLogToFile;
void createDirectory();
};
#endif // LOGGER_H

View File

@@ -0,0 +1,762 @@
#include "processingsystem.h"
#include "providerdblms.h"
#include <clienthandler.h>
ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, QObject *parent):
QObject(parent),
updateController(nullptr),
docsUpdater(nullptr),
providerDBLMS(nullptr)
{
this->providerDBLMS = providerDBLMS;
this->updateController = updateController;
this->docsUpdater = docsUpdater;
}
void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataParser,
CommonClientHandler *commonClientHandler,
UpdateController *updateController,
ChatSystem *chatSystem)
{
this->commonClientServer = commonClientHandler;
this->dataParser = dataParser;
this->server = server;
this->updateController = updateController;
this->chatSystem = chatSystem;
connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigStatusTasksAMMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksAMMofTraineeChanged,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigStatusTasksFIMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksFIMofTraineeChanged,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigUpdateListClients,server,&MultiThreadServer::updateClientList,Qt::AutoConnection);
connect(this,&ProcessingSystem::sigSetData,updateController,&UpdateController::setDataInfo,Qt::AutoConnection);
}
void ProcessingSystem::processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization)
{
if(server->getStateBlockAutorization() == blocked)
{
QByteArray arrayAnswer = dataParser->ClientAnswer()->notify(NOTIFY_SERVER_BLOCKED);
client->sendXmlAnswer(arrayAnswer);
return;
}
//Попытка авторизации клиента (проверка по БД)
QString instructorName;
QString traineeName;
QByteArray arrayAnswer;
int clientID = 0;
InterfaceDataBaseLMS::ErrorAuth errorAuth = InterfaceDataBaseLMS::ErrorAuth::errNo;
if(providerDBLMS->authorizationInstructor(clientAutorization.Login, clientAutorization.Password, errorAuth))
{//Авторизуется инструктор
client->getClient()->setLogin(clientAutorization.Login);
client->getClient()->setAccessType(UserType::INSTRUCTOR);
client->getClient()->setTypeClient(clientAutorization.TypeClient);
emit sigUpdateListClients();
instructorName = providerDBLMS->getNameInstructorByLogin(clientAutorization.Login);
clientID = providerDBLMS->getIdInstructorByLogin(clientAutorization.Login);
client->getClient()->setId(QString::number(clientID));
arrayAnswer = dataParser->ClientAnswer()->authorization(true, instructorName, instructorName, "instructor", clientAutorization.Login, clientID);
}
else if(clientAutorization.TypeClient != TypeClientAutorization::TYPE_GUI)
{
if(providerDBLMS->authorizationTrainee(clientAutorization.Login, clientAutorization.Password, errorAuth, "", ""))
{//Авторизуется обучаемый
client->getClient()->setLogin(clientAutorization.Login);
client->getClient()->setAccessType(UserType::TRAINEE);
emit sigUpdateListClients();
//KAV redact
instructorName = providerDBLMS->getMainInstructorName();
traineeName = providerDBLMS->getNameTraineeByLogin(clientAutorization.Login);
clientID = providerDBLMS->getIdTraineeByLogin(clientAutorization.Login);
client->getClient()->setId(QString::number(clientID));
arrayAnswer = dataParser->ClientAnswer()->authorization(true, instructorName, traineeName, "trainee", clientAutorization.Login, clientID);
}
else
{//Никто не авторизовался
arrayAnswer = dataParser->ClientAnswer()->authorization(false, "", "", "", "", 0);
}
}
else
{//Никто не авторизовался
arrayAnswer = dataParser->ClientAnswer()->authorization(false, "", "", "", "", 0);
}
client->sendXmlAnswer(arrayAnswer);
if(errorAuth == InterfaceDataBaseLMS::ErrorAuth::errNo)
{
client->sendVersion();
//client->sendPacketType(PacketType::BUSY);
//client->sendPacketType(PacketType::FREE);
//Извещаем об изменениях в авторизации
emit sigListsInstructorsTraineesChanged();
}
else
{
QString notifyText = "";
switch (errorAuth)
{
case InterfaceDataBaseLMS::ErrorAuth::errDB:
notifyText = NOTIFY_ERROR_AUTH_DB;
break;
case InterfaceDataBaseLMS::ErrorAuth::errArchived:
notifyText = NOTIFY_ERROR_AUTH_ARCHIVED;
break;
case InterfaceDataBaseLMS::ErrorAuth::errAlreadyLogIn:
notifyText = NOTIFY_ERROR_AUTH_ALREADYLOGIN;
break;
case InterfaceDataBaseLMS::ErrorAuth::errLoginOrPassword:
notifyText = NOTIFY_ERROR_AUTH_LOGINORPASSWORD;
break;
default:
break;
}
QByteArray arrayAnswer = dataParser->ClientAnswer()->notify(notifyText);
client->sendXmlAnswer(arrayAnswer);
}
}
void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization)
{
/*
if(server->getStateBlockAutorization() == blocked)
{
QByteArray arrayAnswer = dataParser->ClientAnswer()->notify(NOTIFY_SERVER_BLOCKED);
client->sendXmlAnswer(arrayAnswer);
QString str = QString(arrayAnswer);
Logger::instance().log("To Client: " + str);
return;
}
*/
//Попытка ДеАвторизации клиента (проверка по БД)
QByteArray arrayAnswer;
if(providerDBLMS->deAuthorizationTrainee(clientDeAutorization.Login))
{//ДеАвторизуется обучаемый
client->getClient()->setLogin("");
client->getClient()->setAccessType(UserType::NONE);
client->getClient()->setIsLoggedIn(false);
emit sigUpdateListClients();
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
client->sendXmlAnswer(arrayAnswer);
//Извещаем об изменениях в авторизации
emit sigListsInstructorsTraineesChanged();
}
else if(providerDBLMS->deAuthorizationInstructor(clientDeAutorization.Login))
{//ДеАвторизуется инструктор
client->getClient()->setLogin("");
client->getClient()->setAccessType(UserType::NONE);
client->getClient()->setIsLoggedIn(false);
emit sigUpdateListClients();
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(true, clientDeAutorization.Login);
client->sendXmlAnswer(arrayAnswer);
//Извещаем об изменениях в авторизации
emit sigListsInstructorsTraineesChanged();
}
else
{//Никто не ДеАвторизовался
arrayAnswer = dataParser->ClientAnswer()->deAuthorization(false, "");
client->sendXmlAnswer(arrayAnswer);
}
}
void ProcessingSystem::processingClientBlockAuth(ClientHandler *client, bool block)
{
emit providerDBLMS->signal_BlockAutorization(block);
}
//упращенная деавторизация при выключении сервера
void ProcessingSystem::processingClientDeAutorization(QString login)
{
//Отмена авторизации в БД
if(providerDBLMS->deAuthorizationTrainee(login))
{//Деавторизовался обучаемый
}
else if(providerDBLMS->deAuthorizationInstructor(login))
{//Деавторизовался инструктор
}
}
void ProcessingSystem::processingEntryUnityClient(ClientHandler *client)
{
QString login = client->getClient()->getLogin();
UserType userType = client->getClient()->getAccessType();
if(userType == UserType::TRAINEE)
{
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
providerDBLMS->entryTraineeOnSimulator(id_trainee);
}
else if(userType == UserType::INSTRUCTOR)
{
//Здесь пока ничего не происходит
}
}
void ProcessingSystem::processingExitUnityClient(ClientHandler *client)
{
QString login = client->getClient()->getLogin();
UserType userType = client->getClient()->getAccessType();
if(userType == UserType::TRAINEE)
{
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
providerDBLMS->exitTraineeFromSimulator(id_trainee);
}
else if(userType == UserType::INSTRUCTOR)
{
//Здесь пока ничего не происходит
}
}
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id, void* data)
{
qDebug() << "ProcessingQueryThread " << QThread::currentThreadId();
switch (clientQueryToDB.typeQuery)
{
case TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS:
{
QList<Instructor> listInstructors = providerDBLMS->GetListAllInstructors();
QList<Trainee> listTrainees = providerDBLMS->GetListAllTrainees();
QList<Group> listGroups = providerDBLMS->GetListAllGroups();
QByteArray arrayAnswer;
arrayAnswer = dataParser->DbAnswer()->listInstructors(true, &listInstructors);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS);
arrayAnswer = dataParser->DbAnswer()->listGroups(true, &listGroups);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS);
arrayAnswer = dataParser->DbAnswer()->listTrainees(true, &listTrainees);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES);
break;
}
case TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR:
{
int id_new;
id_new = providerDBLMS->newInstructor();
if(id_new)
{
(*(Instructor*)data).setID(id_new);
providerDBLMS->editInstructor(*(Instructor*)data);
}
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR:
{
providerDBLMS->delInstructor(id);
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
{
providerDBLMS->editInstructor(*(Instructor*)data);
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_NEW_TRAINEE:
{
int id_new;
id_new = providerDBLMS->newTrainee(id);
if(id_new)
{
(*(Trainee*)data).setID(id_new);
providerDBLMS->editTrainee(*(Trainee*)data);
}
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE:
{
providerDBLMS->delTrainee(id);
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
{
providerDBLMS->editTrainee(*(Trainee*)data);
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_NEW_GROUP:
{
int id_new;
id_new = providerDBLMS->newGroup();
if(id_new)
{
(*(Group*)data).setID(id_new);
providerDBLMS->editGroup(*(Group*)data);
}
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_DEL_GROUP:
{
providerDBLMS->delGroup(id);
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
{
providerDBLMS->editGroup(*(Group*)data);
emit sigListsInstructorsTraineesChanged();
break;
}
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_AMM_TO_TRAINEE:
{
int id_trainee = id;
if(int id_new = providerDBLMS->newTaskAMM(*(TaskAmmFim*)data, id_trainee))
{
//Отправка списка задач AMM всем клиентам GUI
//sendListTasksAMMofTraineetoClient(client, id_trainee);
emit sigStatusTasksAMMofTraineeChanged(id_trainee);
//Отправка списка задач AMM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
//sendListTasksAMMofTraineetoClient(clientUnity, id_trainee);
QList<int> listID;
listID.append(id_new);
sendListTasksAMMofTraineeByIDtoClient(clientUnity, id_trainee, listID);
}
}
break;
}
case TypeQueryToDB::TYPE_QUERY_ASSIGN_TASK_FIM_TO_TRAINEE:
{
int id_trainee = id;
if(int id_new = providerDBLMS->newTaskFIM(*(TaskAmmFim*)data, id_trainee))
{
//Отправка списка задач FIM всем клиентам GUI
//sendListTasksFIMofTraineetoClient(client, id_trainee);
emit sigStatusTasksFIMofTraineeChanged(id_trainee);
//Отправка списка задач FIM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
//sendListTasksFIMofTraineetoClient(clientUnity, id_trainee);
QList<int> listID;
listID.append(id_new);
sendListTasksFIMofTraineeByIDtoClient(clientUnity, id_trainee, listID);
}
}
break;
}
case TypeQueryToDB::TYPE_QUERY_GET_TASKS_AMM_FOR_TRAINEE:
{
int id_trainee = id;
//Отправка списка задач AMM клиенту GUI
sendListTasksAMMofTraineetoClient(client, id_trainee);
break;
}
case TypeQueryToDB::TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE:
{
int id_trainee = id;
//Отправка списка задач FIM клиенту GUI
sendListTasksFIMofTraineetoClient(client, id_trainee);
break;
}
case TypeQueryToDB::TYPE_QUERY_DEL_TASK_AMM_TO_TRAINEE:
{
int id_task = id;
TaskAmmFim task = providerDBLMS->getTaskAMMbyID(id_task);
if(int id_trainee = providerDBLMS->delTaskAMM(id_task))
{
task.status = "deleted";
//Отправка списка задач AMM всем клиентам GUI
//sendListTasksAMMofTraineetoClient(client, id_trainee);
emit sigStatusTasksAMMofTraineeChanged(id_trainee);
//Отправка списка задач AMM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
//sendListTasksAMMofTraineetoClient(clientUnity, id_trainee);
sendTaskAMMToClient(clientUnity, id_trainee, task);
}
}
break;
}
case TypeQueryToDB::TYPE_QUERY_DEL_TASK_FIM_TO_TRAINEE:
{
int id_task = id;
TaskAmmFim task = providerDBLMS->getTaskFIMbyID(id_task);
if(int id_trainee = providerDBLMS->delTaskFIM(id))
{
task.status = "deleted";
//Отправка списка задач FIM клиенту GUI
//sendListTasksFIMofTraineetoClient(client, id_trainee);
emit sigStatusTasksFIMofTraineeChanged(id_trainee);
//Отправка списка задач FIM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
//sendListTasksFIMofTraineetoClient(clientUnity, id_trainee);
sendTaskFIMToClient(clientUnity, id_trainee, task);
}
}
break;
}
case TypeQueryToDB::TYPE_QUERY_SET_REPORT_TASK_AMM_TO_TRAINEE:
{
TaskAmmFim* task = (TaskAmmFim*)data;
if(task->status == "completed")
if( int id_trainee = providerDBLMS->changeStatusTaskAMM(task->getID(), "completed") )
{
}
break;
}
case TypeQueryToDB::TYPE_QUERY_SET_REPORT_TASK_FIM_TO_TRAINEE:
{
TaskAmmFim* task = (TaskAmmFim*)data;
if(task->status == "checkup")
if(int id_report = providerDBLMS->replaceReportFIM(*task))
{
}
break;
}
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE:
{
QString* status = (QString*)data;
if(int id_trainee = providerDBLMS->changeStatusTaskAMM(id, *status))
{
//Отправка списка задач AMM всем клиентам GUI
//sendListTasksAMMofTraineetoClient(client, id_trainee);
emit sigStatusTasksAMMofTraineeChanged(id_trainee);
//Отправка списка задач AMM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
//sendListTasksAMMofTraineetoClient(clientUnity, id_trainee);
QList<int> listID;
listID.append(id);
sendListTasksAMMofTraineeByIDtoClient(clientUnity, id_trainee, listID);
}
}
break;
}
case TypeQueryToDB::TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE:
{
QString* status = (QString*)data;
if(int id_trainee = providerDBLMS->changeStatusTaskFIM(id, *status))
{
//Отправка списка задач FIM всем клиентам GUI
//sendListTasksFIMofTraineetoClient(client, id_trainee);
emit sigStatusTasksFIMofTraineeChanged(id_trainee);
//Отправка списка задач FIM клиенту Юнити
if(ClientHandler* clientUnity = getUnityClientById(id_trainee))
{//Есть такой
//sendListTasksFIMofTraineetoClient(clientUnity, id_trainee);
QList<int> listID;
listID.append(id);
sendListTasksFIMofTraineeByIDtoClient(clientUnity, id_trainee, listID);
}
}
break;
}
case TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST:
{
QList<ContactModel> entitylist;
QList<Instructor> listInstructor = providerDBLMS->GetListAllInstructors();
QList<Trainee> listTrainees = providerDBLMS->GetListAllTrainees();
for (Instructor instructor : listInstructor)
{
ContactModel model = ContactModel(instructor);
entitylist.append(model);
}
for (Trainee trainee : listTrainees)
{
ContactModel model = ContactModel(trainee);
entitylist.append(model);
}
QByteArray arrayAnswer;
arrayAnswer = dataParser->DbAnswer()->listContacts(true, &entitylist);
client->sendFileBlockByteArray(arrayAnswer,PacketType::TYPE_BIGXML);
}
}
}
void ProcessingSystem::processingClientQueryTasksXML(ClientHandler *client, ClientQueryTasksXML clientQueryTasksXML)
{
QByteArray arrayAnswer;
QString nameFile = "";
QString pathFile = "";
if(clientQueryTasksXML.Type == "fim")
{
nameFile = tasksFIMfileName;
pathFile = updateController->getPathAdditionalFile(nameFile);
Logger::instance().log(pathFile);
client->sendFileBlock(pathFile);
client->sendPacketType(PacketType::TYPE_XMLANSWER_QUERY_TASKS_XML_FIM);
}
else if(clientQueryTasksXML.Type == "amm")
{
nameFile = tasksAMMfileName;
pathFile = updateController->getPathAdditionalFile(nameFile);
docsUpdater->lockAccessToDocsXML();
client->sendFileBlock(pathFile);
client->sendPacketType(PacketType::TYPE_XMLANSWER_QUERY_TASKS_XML_AMM);
docsUpdater->unLockAccessToDocsXML();
}
}
void ProcessingSystem::processingClientQueryListSubProc(ClientHandler *client, QString dmCode)
{
QList<SubProc> list = docsUpdater->getListSubProcForDMcode(dmCode);
QByteArray arrayAnswer = dataParser->getDocsAnswerParser()->listSubProc(list, dmCode);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_LIST_SUB_PROC_AMM);
}
void ProcessingSystem::processingSendMessage(ClientMessage clientMessage)
{
chatSystem->sendMessage(clientMessage);
}
void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotify clientNotify)
{
Client *clientData = client->getClient();
if(clientNotify.Code == commandReadyClient)
{//Клиент готов принять задания
client->setReady(true);
sendTaskListToUnity(client);
//client->getSocket()->flush();
}
else if(clientNotify.Code == commandStartTimerClient)
{
//Фиксируем время входа Юнити-клиента
if (clientData->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
processingEntryUnityClient(client);
}
}
else if(clientNotify.Code == commandDisableClient)
{
qDebug() << "processing thread: " << QThread::currentThreadId();
//Фиксируем время выхода Юнити-клиента
if (clientData->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
processingExitUnityClient(client);
}
client->sendDisable();
}
else if(clientNotify.Code == commandGetServerDataList)
{
client->sendHash();
}
else if(clientNotify.Code == commandCheckVersionList)
{
client->sendVersionList();
}
else if(clientNotify.Code == commandCanChangeVersion)
{
if (updateController->getCurrentVersion()->getIsChangeable())
{
client->sigSendNotify(commandChangable);
}
else
{
client->sigSendNotify(commandUnchangable);
}
}else if(clientNotify.Code == commandGetTasks)
{
sendTaskListToUnity(client);
}
else if (clientNotify.Code == commandeGetOfflineMessages)
{
chatSystem->sendOldMessages(clientData->getId());
}
}
void ProcessingSystem::setCurrentDataInfo(DataInfo *dataInfo)
{
emit sigSetData(dataInfo);
}
void ProcessingSystem::sendListTasksAMMofTraineetoClient(ClientHandler *client, int id_trainee)
{
QList<TaskAmmFim> listTasks = providerDBLMS->GetListTasksAMMofTrainee(id_trainee);
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasks, id_trainee, true);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
}
void ProcessingSystem::sendListTasksFIMofTraineetoClient(ClientHandler *client, int id_trainee)
{
QList<TaskAmmFim> listTasks = providerDBLMS->GetListTasksFIMofTrainee(id_trainee);
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasks, id_trainee, true);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
}
void ProcessingSystem::sendListTasksAMMofTraineeByIDtoClient(ClientHandler *client, int id_trainee, QList<int> listID)
{
QList<TaskAmmFim> listTasksNeed;
QList<TaskAmmFim> listTasks = providerDBLMS->GetListTasksAMMofTrainee(id_trainee);
for(int i = 0; i < listTasks.count(); i++)
{
TaskAmmFim task = listTasks.at(i);
bool flNeed = false;
for(int id : listID)
{
if(id == task.getID())
{
flNeed = true;
break;
}
}
if(flNeed)
listTasksNeed.append(listTasks.at(i));
}
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasksNeed, id_trainee, false);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
}
void ProcessingSystem::sendListTasksFIMofTraineeByIDtoClient(ClientHandler *client, int id_trainee, QList<int> listID)
{
QList<TaskAmmFim> listTasksNeed;
QList<TaskAmmFim> listTasks = providerDBLMS->GetListTasksFIMofTrainee(id_trainee);
for(int i = 0; i < listTasks.count(); i++)
{
TaskAmmFim task = listTasks.at(i);
bool flNeed = false;
for(int id : listID)
{
if(id == task.getID())
{
flNeed = true;
break;
}
}
if(flNeed)
listTasksNeed.append(listTasks.at(i));
}
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasksNeed, id_trainee, false);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
}
void ProcessingSystem::sendTaskAMMToClient(ClientHandler *client, int id_trainee, TaskAmmFim task)
{
QList<TaskAmmFim> listTasks;
listTasks.append(task);
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasks, id_trainee, false);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
}
void ProcessingSystem::sendTaskFIMToClient(ClientHandler *client, int id_trainee, TaskAmmFim task)
{
QList<TaskAmmFim> listTasks;
listTasks.append(task);
QByteArray arrayAnswer = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasks, id_trainee, false);
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
}
void ProcessingSystem::sendTaskListToUnity(ClientHandler *client)
{
//Отправка списков задач клиенту Юнити
if(client->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
QString login = client->getClient()->getLogin();
int id_trainee = providerDBLMS->getIdTraineeByLogin(login);
//AMM
QList<TaskAmmFim> listTasksAMM = providerDBLMS->GetListTasksAMMofTrainee(id_trainee);
QByteArray arrayAnswerTasksAMM = dataParser->DbAnswer()->listTasksAMMofTrainee(true, &listTasksAMM, id_trainee, true);
client->sendFileBlockByteArray(arrayAnswerTasksAMM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_TRAINEE);
//FIM
QList<TaskAmmFim> listTasksFIM = providerDBLMS->GetListTasksFIMofTrainee(id_trainee);
QByteArray arrayAnswerFIM = dataParser->DbAnswer()->listTasksFIMofTrainee(true, &listTasksFIM, id_trainee, true);
client->sendFileBlockByteArray(arrayAnswerFIM, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
}
}
ClientHandler *ProcessingSystem::getUnityClientById(int id)
{
QString login = providerDBLMS->getLoginTraineeById(id);
//Проходим все открытые сокеты, ищем нужный
foreach(int idSocket, server->getClientsMap()->keys())
{
ClientHandler *handler = server->getClientsMap()->value(idSocket);
if(handler->getClient()->getLogin() == login)
{
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
return handler;
}
}
}
return nullptr;
}

View File

@@ -0,0 +1,81 @@
#ifndef PROCESSINGSYSTEM_H
#define PROCESSINGSYSTEM_H
#include <Systems/sendsystem.h>
#include <Data/typesDataServerClient.h>
#include <clienthandler.h>
#include <serverlmswidget.h>
#include "multithreadserver.h"
//#include "instructorsandtraineeswidget.h"
#include "chatsystem.h"
#include "providerdblms.h"
#include "docsupdater.h"
class SendSystem;
class ServerLMSWidget;
class InstructorsAndTrainees;
class Logger;
class DataParser;
class ClientHandler;
class CommonClientHandler;
class MultiThreadServer;
class ProcessingSystem : public QObject
{
Q_OBJECT
public:
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, QObject *parent = nullptr);
void initialize(MultiThreadServer *server,
DataParser* dataParser,
CommonClientHandler *commonClientServer,
UpdateController *updateComtroller,
ChatSystem *chatSystem);
void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization);
void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization);
void processingClientBlockAuth(ClientHandler *client, bool block);
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr);
void processingClientQueryTasksXML(ClientHandler *client, ClientQueryTasksXML clientQueryTasksXML);
void processingClientQueryListSubProc(ClientHandler *client, QString dmCode);
void processingSendMessage(ClientMessage clientMessage);
void processingClientNotify(ClientHandler *client, ClientNotify clientNotify);
void setCurrentDataInfo(DataInfo *dataInfo);
void sendListTasksAMMofTraineetoClient(ClientHandler* client, int id_trainee);
void sendListTasksFIMofTraineetoClient(ClientHandler* client, int id_trainee);
void sendListTasksAMMofTraineeByIDtoClient(ClientHandler* client, int id_trainee, QList<int> listID);
void sendListTasksFIMofTraineeByIDtoClient(ClientHandler* client, int id_trainee, QList<int> listID);
void sendTaskAMMToClient(ClientHandler* client, int id_trainee, TaskAmmFim task);
void sendTaskFIMToClient(ClientHandler* client, int id_trainee, TaskAmmFim task);
ClientHandler* getUnityClientById(int id);
void processingClientDeAutorization(QString login);
void processingEntryUnityClient(ClientHandler *client);
void processingExitUnityClient(ClientHandler *client);
signals:
void sigUpdateListClients();
void sigListsInstructorsTraineesChanged();
void sigStatusTasksAMMofTraineeChanged(int trainee_id);
void sigStatusTasksFIMofTraineeChanged(int trainee_id);
void sigAddToMessanger(QString login,QString text);
void sigSetData(DataInfo *dataInfo);
private:
CommonClientHandler *commonClientServer;
MultiThreadServer *server;
DataParser *dataParser;
UpdateController *updateController;
DocsUpdater* docsUpdater;
ProviderDBLMS* providerDBLMS;
ChatSystem *chatSystem;
void sendTaskListToUnity(ClientHandler *client);
};
#endif // PROCESSINGSYSTEM_H

View File

@@ -0,0 +1,527 @@
#include "recognizesystem.h"
RecognizeSystem::RecognizeSystem(QObject *parent):
QObject(parent)
{
packetType = PacketType::TYPE_NONE;
filePath.clear();
fileSize = 0;
sizeReceiveData = 0;
tmpBlock.clear();
countSend = 0;
mutex = new QMutex;
}
void RecognizeSystem::initialize(UpdateController *updateController,DataParser* dataParser,
ServerLMSWidget *server,SendSystem *sendSystem, ClientHandler *handler)
{
this->updateController = updateController;
this->dataParser = dataParser;
this->server = server;
this->clientHandler = handler;
this->sendSystem = sendSystem;
socket = handler->getSocket();
connect(this,&RecognizeSystem::sigCalculateHash,updateController,&UpdateController::calculateFullHashWithSetup,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigChangeVersion,updateController,&UpdateController::changeAssetVersion,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigDeleteVersion,updateController,&UpdateController::deleteAssetVersion,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigCopyVersion,updateController,&UpdateController::createCopyVersion,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigXmlParser,dataParser->getProcessParser(),&ProcessParser::slot_read,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigRecalculateDocs,server,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection);
connect(this,&RecognizeSystem::sigSendDocs,sendSystem,&SendSystem::sendDocs,Qt::AutoConnection);
qDebug() << "Recognize init thread ID " << QThread::currentThreadId();
}
void RecognizeSystem::recognize()
{
QMutexLocker locker(mutex);
qDebug() << "Recognize thread ID " << QThread::currentThreadId();
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
QByteArray data;
Client *client = clientHandler->getClient();
while (socket->bytesAvailable() > 0)
{
if (packetType == PacketType::TYPE_NONE)
{
stream.startTransaction();
if(client->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
char *read = new char[4];
stream.readRawData(read,4);
int numPackage = *((int*)read);
packetType = static_cast<PacketType>(numPackage);
socket->peek(read,4);
if(!stream.commitTransaction()) continue;
continue;
}
else
{
stream >> packetType;
if(!stream.commitTransaction()) continue;
}
}
if (packetType != PacketType::TYPE_NONE)
{
QString result = enumToString(packetType);
Logger::instance().log("RECEIVE FROM: " + client->getLogin() + " " +
result ,LogLevel::DEBUG);
//секция на случай прихода неизвестного пакета
if(result == "Unknown")
{
qDebug() << " State:" << socket->state();
qDebug() << " Error:" << socket->error();
qDebug() << " Bytes to write:" << socket->bytesToWrite();
qDebug() << " Bytes available:" << socket->bytesAvailable();
if(client->getTypeClient() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
data = socket->readAll();
}
else
{
stream.startTransaction();
stream >> data;
}
QString dataText = QString::fromUtf8(data);
Logger::instance().log(QString::number(packetType) + " Unknown text " + dataText);
Logger::instance().log("Client error: " + client->getLogin(),LogLevel::ERROR);
clientHandler->sendDisable();
//mutex->unlock();
}
}
if (packetType == PacketType::TYPE_COMMAND) //TODO: надо переделать под какой то нормальный тип, который уже существует
{
stream.startTransaction();
stream >> command;
if (!stream.commitTransaction()) continue;
}
if (packetType == PacketType::TYPE_UPDATE)
{
QList<FileData> sendList = updateController->prepareRealPathList(client->getFileSendList());
sendSystem->updateFiles(sendList,
client->getFileDeleteList());
qDebug()<< "Call update no docs";
packetType = PacketType::TYPE_NONE;
}
if(packetType == PacketType::TYPE_CHECK_VERSION)
{
updateController->compareFiles(clientHandler,client->getClientHash());
}
if (packetType == PacketType::TYPE_XMLANSWER)
{
if(clientHandler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
data = socket->readAll();
}
else
{
stream.startTransaction();
stream >> data;
if(!stream.commitTransaction()) continue;
}
qDebug() << data;
emit sigXmlParser(clientHandler,data);
Logger::instance().log(" Text " + QString(data), LogLevel::DEBUG);
packetType = PacketType::TYPE_NONE;
continue;
}
if(packetType == PacketType::TYPE_BIGXML)
{
if (clientHandler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
char *readBuffer = new char[4];
socket->read(readBuffer,4);
fileSize = *((int*)readBuffer);
//if(!stream.commitTransaction()) continue;
//ПОЛУЧЕНИЕ САМОГО ФАЙЛА
Logger::instance().log("AfterRead size and path BytesAvailable: " + QString::number(socket->bytesAvailable()));
qint64 readSize = readFileBlockSize;
forever
{
if(fileSize < readSize)
{
readSize = fileSize;
Logger::instance().log("LastPackage: " + QString::number(readSize));
}
socket->waitForReadyRead(20);
tmpBlock = socket->read(readSize);
data.append(tmpBlock);
fileSize -= readSize;
sizeReceiveData += readSize;
countSend++;
tmpBlock.clear();
if(fileSize == 0) break;
}
Logger::instance().log("File loaded");
emit sigXmlParser(clientHandler,data);
//ОЧИСТКА ПОСЛЕ ПЕРЕДАЧИ
fileSize = 0;
tmpBlock.clear();
sizeReceiveData = 0;
countSend = 0;
packetType = PacketType::TYPE_NONE;
data.clear();
continue;
}
}
if(packetType == PacketType::TYPE_FOLDER) //создание папок
{
if(client->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
filePath = socket->readAll();
filePath = Tools::createSharedPath(filePath);
}
else
{
stream.startTransaction();
stream >> filePath;
if(!stream.commitTransaction()){
continue;
}
filePath = Tools::createFullPath(filePath);
}
QDir dir(filePath);
if(!dir.exists()){
if(dir.mkpath(filePath)){
qDebug() << "Dir Created";
}
}
packetType = PacketType::TYPE_NONE;
continue;
}
if (packetType == PacketType::TYPE_FILE) //выгрузка одного файла
{
if(client->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
DataInfo *currentFileData = updateController->getCurrentDataInfo();
filePath = currentFileData->path;
filePath = Tools::createSharedPath(filePath);
QFile file(filePath);
if (file.exists())
{
file.remove(); //удаление файла, если он уже есть, но необходимо обновить
Logger::instance().log("Delete exist file: " + filePath);
}
if (!file.open(QFile::Append))
{
QString folderPath = Tools::createFolderPath(filePath);
qDebug() << "FULL PATH: " << folderPath;
QDir dir(folderPath);
if (!dir.exists()){
dir.mkpath(".");
}
file.open(QFile::Append);
}
//socket->waitForReadyRead(1000);
fileSize = currentFileData->size;
qint64 readSize = 65535;
forever
{
if(fileSize < readSize)
{
readSize = fileSize;
qDebug() << "LastPackage: " << readSize;
}
socket->waitForReadyRead(20);
tmpBlock = socket->read(readSize);
quint64 toFile = file.write(tmpBlock);
fileSize -= toFile;
sizeReceiveData += toFile;
countSend++;
tmpBlock.clear();
qDebug() << "Loading progress: " << fileSize << "/" << currentFileData->size;
if(fileSize == 0) break;
}
file.close();
filePath.clear();
updateController->clearCurrentDataInfo();
socket->waitForReadyRead(100);
packetType = PacketType::TYPE_NONE;
}
else
{
forever
{
stream.startTransaction();
stream >> filePath;
stream >> fileSize;
if(!stream.commitTransaction()) continue;
filePath = Tools::createFullPath(filePath);
socket->waitForReadyRead(100);
break;
}
QFile file(filePath);
QFileInfo fileInfo(file);
if(file.exists())
{
file.remove();
}
file.open(QFile::Append);
forever
{
stream.startTransaction();
stream >> tmpBlock;
if(!stream.commitTransaction()){
if(socket->state() == QAbstractSocket::UnconnectedState){
qDebug() << "UNCONNECT";
//mutex->unlock();
file.close();
return;
}
if(socket->waitForReadyRead(100)){
continue;
}
continue;
}
quint64 toFile = file.write(tmpBlock);
sizeReceiveData += toFile;
countSend++;
tmpBlock.clear();
if(sizeReceiveData == fileSize) break;
}
QString logMessage = "Load from " + client->getLogin() + " ";
logMessage.append(fileInfo.fileName());
Logger::instance().log(logMessage);
file.close();
filePath.clear();
fileSize = 0;
tmpBlock.clear();
sizeReceiveData = 0;
countSend = 0;
packetType = PacketType::TYPE_NONE;
}
}
if (packetType == PacketType::TYPE_FILESIZE)
{
fileSize = socket->readAll().toULong();
qDebug() << fileSize;
packetType = PacketType::TYPE_NONE;
continue;
}
if(packetType == PacketType::GET_VERSION)
{
clientHandler->sendVersion();
}
if(packetType == PacketType::CHANGE_DATA_VERSION)
{
stream.startTransaction();
QString versionName;
stream >> versionName;
if(!stream.commitTransaction()) continue;
qDebug() << "For change " + versionName;
emit sigChangeVersion(versionName);
}
if(packetType == PacketType::COPY_VERSION)
{
QString source;
QStringList result;
stream.startTransaction();
stream >> source;
if(!stream.commitTransaction()) continue;
result = source.split(";");
if (updateController->checkDuplicate(result[1]))
{
sendSystem->sendNotify(commandDuplicateVerName);
packetType = PacketType::TYPE_NONE;
break;
}
emit sigCopyVersion(result[0],result[1],result[2]);
sendSystem->sendPacketType(PacketType::BUSY);
}
if(packetType == PacketType::DELETE_DATA_VERSION)
{
stream.startTransaction();
QString versionName;
stream >> versionName;
if(!stream.commitTransaction()) continue;
qDebug() << "For delete " + versionName;
if (versionName == baseNameVersion)
{
sendSystem->sendNotify(commandTryBaseDelete);
}
else if (versionName == updateController->getCurrentVersionName())
{
sendSystem->sendNotify(commandTryActiveDelete);
}
else
{
emit sigDeleteVersion(versionName);
}
}
if(packetType == PacketType::TYPE_DISABLE)
{
clientHandler->sendDisable();
}
if(packetType == PacketType::RECALCULATE_DOCS)
{
emit sigCalculateHash();
emit sigRecalculateDocs();
}
if(packetType == PacketType::GET_DOCS)
{
emit sigSendDocs(updateController->getPathAdditionalFile(tasksAMMfileName));
}
if (packetType == PacketType::SEND_HASH)
{
QByteArray hash;
forever
{
stream.startTransaction();
stream >> fileSize;
if(!stream.commitTransaction()) continue;
socket->waitForReadyRead(100);
break;
}
forever
{
stream.startTransaction();
stream >> tmpBlock;
if(!stream.commitTransaction()){
if(socket->state() == QAbstractSocket::UnconnectedState){
qDebug() << "UNCONNECT";
//mutex->unlock();
return;
}
if(socket->waitForReadyRead(100)){
continue;
}
continue;
}
hash += tmpBlock;
sizeReceiveData += tmpBlock.length();
countSend++;
tmpBlock.clear();
if(sizeReceiveData == fileSize) break;
}
QString logMessage = "Load from " + client->getLogin() + " ";
filePath.clear();
fileSize = 0;
tmpBlock.clear();
sizeReceiveData = 0;
countSend = 0;
packetType = PacketType::TYPE_NONE;
client->setClientHash(hash);
}
packetType = PacketType::TYPE_NONE;
}
//mutex->unlock();
}
bool RecognizeSystem::checkIsChangeable()
{
return updateController->getCurrentVersion()->getIsChangeable();
}
RecognizeSystem::~RecognizeSystem()
{
}

View File

@@ -0,0 +1,65 @@
#ifndef RECOGNIZESYSTEM_H
#define RECOGNIZESYSTEM_H
#include <QDataStream>
#include <QTcpSocket>
#include <QMutex>
#include <Systems/updatecontroller.h>
#include <Systems/tools.h>
#include <Systems/Parsers/dataparser.h>
#include <Data/Client.h>
#include <Data/PacketType.h>
#include "serverlmswidget.h"
class UpdateController;
class ServerLMSWidget;
class ClientHandler;
class RecognizeSystem : public QObject
{
Q_OBJECT
public:
RecognizeSystem(QObject *parent = nullptr);
void initialize(UpdateController *updateController,DataParser *dataParser,
ServerLMSWidget *server,SendSystem *sendSystem, ClientHandler *handler);
void recognize();
~RecognizeSystem();
signals:
void sigCalculateHash();
void sigSendToLogger(QString string);
void sigXmlParser(ClientHandler *clientHandler,QByteArray data);
void sigChangeVersion(QString versionName);
void sigDeleteVersion(QString versionName);
void sigCopyVersion(QString versionName,QString newVersionName,QString author);
void sigRecalculateDocs();
void sigSendDocs(QString docsPath);
private:
UpdateController *updateController;
SendSystem *sendSystem;
DataParser *dataParser;
ServerLMSWidget *server;
QString command;
PacketType packetType;
QString filePath;
ClientHandler *clientHandler;
QMutex *mutex;
QTcpSocket *socket;
QByteArray tmpBlock;
qint64 sizeReceiveData;
qint64 fileSize;
int countSend;
void packetTypeInit(PacketType packet,Client *client);
bool checkIsChangeable();
};
#endif // RECOGNIZESYSTEM_H

View File

@@ -0,0 +1,347 @@
#include "sendsystem.h"
SendSystem::SendSystem(QObject *parent) : QObject(parent)
{
isSendStopped = false;
}
void SendSystem::initialize(DataParser *dataParser,QMutex *globalMutex)
{
this->dataParser = dataParser;
connect(this,&SendSystem::sigSendXMLmessage,dataParser->ClientAnswer(),&ClientAnswerParser::message,Qt::AutoConnection);
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
connect(this,&SendSystem::sigSendVersion,dataParser->ClientAnswer(),&ClientAnswerParser::currentVersion,Qt::AutoConnection);
qDebug() << "SendSystem thread: " << QThread::currentThreadId();
mutex = globalMutex;
}
void SendSystem::setClient(Client *client,QTcpSocket *socket)
{
this->socket = socket;
this->type = client->getClientType();
this->client = client;
isSendStopped = false;
}
void SendSystem::sendNotify(QString notify)
{
qDebug() << "SendNotify thread: " << QThread::currentThreadId();
auto answer = emit sigSendNotify(notify);
sendXmlAnswer(answer);
}
void SendSystem::sendFileBlock(QString path)
{
QFile file(path);
QFileInfo fileInfo(file);
if(isSendStopped)
{ //Поведение на случай отключения клиента
file.close();
Logger::instance().log("UNLOCK STOP MUTEX : " + client->getLogin(),LogLevel::ERROR);
return;
}
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
fileSize = file.size();
if (fileSize == 0)
{
Logger::instance().log("Client: " + client->getLogin() + " WARNING! Zero size " + fileInfo.fileName(),LogLevel::ERROR);
Logger::instance().log(path,LogLevel::ERROR);
return;
}
stream << PacketType::TYPE_FILE; //Отправляем тип блока
stream << path << fileSize;
if(file.open(QFile::ReadOnly))
{
while(!file.atEnd())
{
QByteArray data = file.read(sendFileBlockSize);
stream << data;
//socket->waitForBytesWritten(10);
if(socket->state() == QAbstractSocket::UnconnectedState) break;
countSend++;
}
//emit sigSendToLogger(Tools::getTime() + " send file " + fileInfo.fileName());
}
file.close();
countSend = 0;
}
void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType)
{
if(client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
quint64 size = array.size();
qint64 bytesSended = 0;
if (size == 0)
{
Logger::instance().log(" WARNING! Zero size ",LogLevel::ERROR);
return;
}
stream << packetType; //Отправляем тип блока
stream << size;
while (size > 0)
{
QByteArray chunk = array.mid(bytesSended,sendFileBlockSize);
stream << chunk;
bytesSended += chunk.length();
size -= bytesSended;
}
}
else
{
sendPacketType(packetType);
quint64 size = array.size();
qint64 bytesSended = 0;
if (size == 0)
{
Logger::instance().log(" WARNING! Zero size ",LogLevel::ERROR);
return;
}
QByteArray message;
message.append(reinterpret_cast<char*>(&size), sizeof(int));
socket->write(message);
while (size > 0)
{
QByteArray chunk = array.mid(bytesSended,sendFileBlockSize);
quint64 bytesSended = socket->write(chunk);
size -= bytesSended;
}
}
}
void SendSystem::sendVersion()
{
QByteArray data = dataParser->ClientAnswer()->currentVersion();
sendXmlAnswer(data);
}
void SendSystem::sendFileBlockWithRename(QString path, QString newName)
{
qDebug() << "sendFileBlockWithRename thread: " << QThread::currentThreadId();
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
QFile file(Tools::createRootPath(path));
QFileInfo fileInfo(file);
fileSize = fileInfo.size();
if(fileSize == 0){
Logger::instance().log("Client: " + client->getLogin() + " WARNING! Zero size " + fileInfo.fileName(),LogLevel::ERROR);
return;
}
QString pathForSend = Tools::createFolderPath(path) + "/" + staticDataFolderName + newName;
stream << PacketType::TYPE_FILE; //Отправляем тип блока
stream << pathForSend << fileSize;
if(isSendStopped) { //Поведение на случай отключения клиента
file.close();
return;
}
socket->waitForBytesWritten();
if(file.open(QFile::ReadOnly)){
while(!file.atEnd()){
QByteArray data = file.read(sendFileBlockSize);
stream << data;
socket->waitForBytesWritten();
countSend++;
}
Logger::instance().log("Send file " + fileInfo.fileName());
}
file.close();
countSend = 0;
socket->waitForBytesWritten();
socket->waitForReadyRead(100);
sendNotify(commandHashCompleteClient);
}
void SendSystem::sendFolderBlock(QString path)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
stream << PacketType::TYPE_FOLDER;
stream << path;
}
void SendSystem::sendDeleteBlock(QString path)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
stream << PacketType::TYPE_DELETE;
stream << path;
qDebug() << "DELETE: " + path;
socket->waitForReadyRead(10);
}
void SendSystem::sendPacketType(PacketType packetType)
{
Logger::instance().log(" SEND TO: " + client->getLogin() + " " + enumToString(packetType), LogLevel::DEBUG);
if (client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
stream << packetType;
socket->waitForReadyRead(100);
}
else
{
QByteArray message;
int type = (int)packetType;
message.append(reinterpret_cast<char*>(&type), sizeof(int));
socket->write(message);
}
}
void SendSystem::sendHello()
{
socket->write(SERVER_HELLO);
}
void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
{
qDebug() << "SendSystemThread: " << QThread::currentThreadId();
Logger::instance().log("SEND TO: "+ client->getLogin() + " " + enumToString(packetType) + "\n Text: " +
QString(array),LogLevel::DEBUG);
if (client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
stream << packetType;
stream << array;
socket->waitForBytesWritten();
}
else
{
sendPacketType(packetType);
QByteArray message;
int size = array.length();
message.append(reinterpret_cast<char*>(&size), sizeof(int));
socket->write(message);
socket->write(array);
}
}
void SendSystem::sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount)
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
stream << PacketType::TYPE_NEEDUPDATE;
stream << flag;
stream << size;
stream << fileCount;
stream << deleteCount;
}
void SendSystem::updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList){
QMutexLocker locker(mutex);
QListIterator<FileData> clientIterator(deleteList);
while(clientIterator.hasNext())
{
FileData data = clientIterator.next();
sendDeleteBlock(data.path);
if(getIsSendStopped())
{
return;
}
}
QListIterator<FileData> serverIterator(fileSendList);
while(serverIterator.hasNext())
{
FileData data = serverIterator.next();
if (data.hash == "FOLDER")
{
sendFolderBlock(data.path);
socket->waitForBytesWritten();
}
else
{
sendFileBlock(data.path);
socket->waitForBytesWritten();
}
if(isSendStopped)
{
return;
}
}
sendPacketType(PacketType::UPDATE_FILES_COMPLETE);
}
void SendSystem::socketClose()
{
socket->close();
}
bool SendSystem::socketFlush() //TODO: проверить использование
{
return socket->flush();
}
void SendSystem::sendStop()
{
isSendStopped = true;
}
void SendSystem::sendDocs(QString docsPath)
{
sendFileBlock(docsPath);
}
bool SendSystem::getIsSendStopped() const
{
return isSendStopped;
}
SendSystem::~SendSystem()
{
}

View File

@@ -0,0 +1,69 @@
#ifndef SENDSYSTEM_H
#define SENDSYSTEM_H
#include <QObject>
#include <QString>
#include <QtNetwork>
#include <QMutex>
#include <Systems/Parsers/dataparser.h>
#include <Systems/tools.h>
#include <Data/Client.h>
#include <Data/PacketType.h>
class DataParser;
class FileData;
class SendSystem : public QObject
{
Q_OBJECT
public:
explicit SendSystem(QObject* parent = nullptr);
void initialize(DataParser* dataParser,QMutex *globalMutex);
void setClient(Client* client,QTcpSocket *socket);
void sendMessageBlock(QString message);
void sendFileBlock(QString path);
void sendFileBlockByteArray(QByteArray array, PacketType packetType);
void sendFileBlockWithRename(QString path,QString newName);
void sendFolderBlock(QString path);
void sendDeleteBlock(QString path);
void sendPacketType(PacketType packet);
void sendHello();
void sendNotify(QString notify);
void sendStop();
void sendDocs(QString docPath);
void sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER);
void sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount);
void updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList);
bool socketFlush();
bool getIsSendStopped() const;
~SendSystem();
void updateFilesFULL(QList<FileData> fileSendList, QList<FileData> deleteList);
public slots:
void socketClose();
void sendVersion();
signals:
void sigLoadHash();
QByteArray sigSendXMLmessage(QString loginFrom, QString loginTo, QString text, QString userType);
QByteArray sigSendNotify(QString message);
QByteArray sigSendVersion();
private:
Client *client;
QTcpSocket* socket;
DataParser* dataParser;
quint64 fileSize;
QMutex *mutex;
QWaitCondition *waitCondition;
int countSend;
bool isSendStopped;
TypeClientAutorization type;
};
#endif // SENDSYSTEM_H

140
LibServer/Systems/tools.cpp Normal file
View File

@@ -0,0 +1,140 @@
#include "tools.h"
#include <QDir>
void Tools::printTime()
{
qDebug() << QTime::currentTime().toString("hh:mm:ss.zzz");
}
QString Tools::createLocalPath(QString path)
{
qint8 pos = path.indexOf(applicationFolderName);
QString localPath = path.remove(0,--pos);
//qDebug() << "Local path: " << localPath;
return localPath;
}
QString Tools::createRootPath(QString path)
{
return QDir::currentPath() + path;
}
QString Tools::createSharedPath(QString path){
return QDir::currentPath()+ "/" + sharedDataFolderName + path;
}
QString Tools::createRealPath(QString path,StreamingVersionData* currentVersionData)
{
QString resultPath;
int index = path.indexOf(currentVersionData->getViewName());
if(index != -1)
{
resultPath = path.remove(0,index + currentVersionData->getViewName().length());
resultPath.prepend(buildDataPath + streamingAssetsFolderName);
}
else
{
resultPath = Tools::createRootPath(path);
}
return resultPath;
}
QString Tools::createStreamingToRealPath(QString path,StreamingVersionData* streamingVersionData)
{
QString resultPath = path;
int index = path.indexOf(streamingAssetsFolderName);
if(index != -1)
{
resultPath = path.remove(0,index + streamingAssetsFolderName.length());
resultPath.prepend(QDir::currentPath() + "/" + sharedDataFolderName + "/" + streamingVersionData->getViewName());
}
return resultPath;
}
QString Tools::createVersionHashFilepath(QString fileName)
{
return staticDataFolderName + "/" + fileName + "Hash.xml";
}
QString Tools::createUpdateFilePath(QString path)
{
//qDebug() << "Full path: " << path;
qint8 pos = path.indexOf(streamingAssetsFolderName);
QString localPath = path.remove(0,--pos);
//qDebug() << "Local path: " << localPath;
return localPath;
}
QString Tools::createFolderPath(QString path)
{
quint8 pos = path.lastIndexOf("\\");
QString folderPath = path.remove(pos,path.length() - pos);
return folderPath;
}
QString Tools::createFullPath(QString path)
{
QString fullPath;
qint8 pos = path.indexOf("Application");
QString localPath = path.remove(0,--pos);
//qDebug() << "CLIENT: localPath" << localPath;
fullPath = QDir::currentPath() + localPath;
return fullPath;
}
bool Tools::checkNonStaticData(QString path)
{
if(path.contains(sharedDataFolderName)) return true;
return false;
}
bool Tools::loadXMLtoDOM(QString pathNameFile, QDomDocument *commonDOM)
{
QFile xmlInFile(pathNameFile);
if (! xmlInFile.open(QFile::ReadOnly | QFile::Text)) {
qDebug() << "loadXMLtoDOM: Couldn't read the file: " + pathNameFile;
return false;
}
commonDOM->setContent(xmlInFile.readAll());
xmlInFile.close();
return true;
}
bool Tools::saveDOMtoXML(QString pathNameFile, QDomDocument *commonDOM)
{
QFile xmlOutFile(pathNameFile);
if (!xmlOutFile.open(QFile::WriteOnly | QFile::Text))
{
qDebug() << "saveDOMtoXML: Failed to write a file: " + pathNameFile;
return false;
}
else
{
QTextStream outFile(&xmlOutFile);
commonDOM->save(outFile, 4);
xmlOutFile.close();
}
return true;
}

83
LibServer/Systems/tools.h Normal file
View File

@@ -0,0 +1,83 @@
#ifndef TOOLS_H
#define TOOLS_H
#include "logger.h"
#include <QString>
#include <QDebug>
#include <QTime>
#include <QDir>
#include <QDomDocument>
#include <Data/StreamingVersionData.h>
#define TCP_READ_TIMEOUT 5000
static const QString staticDataFolderName = "StaticData";
static const QString applicationFolderName = "Application";
static const QString sharedDataFolderName = "SharedData";
static const QString projectFolderName = "RRJLoader";
static const QString additionalFilesFolderName = "RRJ-95NEW-100";
static const QString rusScensFolderName = "RUS/Scens";
static const QString streamingAssetsFolderName = "StreamingAssets";
static const QString versionFolderName = "StreamingVersion";
static const QString tempFile = staticDataFolderName + "/save.xml";
static const QString version = staticDataFolderName + "/version.xml";
static const QString versionListFile = staticDataFolderName + "/versionList.xml";
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
static const QString buildDataPath = "/Application/" + projectFolderName + "/RRJ_Data/";
static const QString tasksAMMfileName = "/docs.xml"; //"/tasksAmm.xml";
static const QString tasksFIMfileName = "/tasksFIM.xml";
//static const QString clientHash = staticDataFolderName + "/clientHash.xml";
static const QString logFolderPath = "log";
static const QString configFolderName = "config";
static const QString settingsName = configFolderName + "/settings.xml";
static const QString baseNameVersion = "base";//может вынести комманды куда нибудь?
static const QString commandTryBaseDelete = "BASEDELETETRY";
static const QString commandTryBaseChange = "TRYBASECHANGE";
static const QString commandTryActiveDelete = "TRYACTIVEDELETE";
static const QString commandTryCopyWithSameNames = "SAMENAMES";
static const QString commandGetServerDataList = "GETSERVERDATALIST";
static const QString commandCheckVersionList = "CHECKVERSIONLIST";
static const QString commandReadyClient = "READY";
static const QString commandDisableClient = "DISABLE";
static const QString commandStartTimerClient = "UNITYSTARTTIMER";
static const QString commandDuplicateVerName = "DUPLICATEVERNAME";
static const QString commandHashCompleteClient = "HASHSENDCOMPLETE";
static const QString commandCanChangeVersion = "CANCHANGE";
static const QString commandChangable = "CHANGEABLE";
static const QString commandUnchangable = "UNCHANGEABLE";
static const QString commandUpdateFilesClient = "update";
static const QString commandGetTasks = "GETTASKS";
static const QString commandeGetOfflineMessages = "GETOFFLINEMESSAGE";
//static quint64 fileBlockSize = 1460;
static quint64 sendFileBlockSize = 256000;
static quint64 readFileBlockSize = 65535;
//1025*250
class Tools {
public:
static void printTime();
static QString getTime();
static QString createLocalPath(QString path);
static QString createRootPath(QString path);
static QString createUpdateFilePath(QString path);
static QString createFolderPath(QString path);
static QString createSharedPath(QString path);
static QString createRealPath(QString path,StreamingVersionData* currentVersionData);
static QString createStreamingToRealPath(QString path, StreamingVersionData *streamingVersionData);
static QString createVersionHashFilepath(QString fileName);
static QString createFullPath(QString path);
static bool checkNonStaticData(QString path);
static bool loadXMLtoDOM(QString pathNameFile, QDomDocument* commonDOM);
static bool saveDOMtoXML(QString pathNameFile, QDomDocument* commonDOM);
};
#endif // TOOLS_H

View File

@@ -0,0 +1,601 @@
#include "updatecontroller.h"
UpdateController::UpdateController(QObject *parent) :
QObject(parent),
commonClientHandler(nullptr)
{
buildPath = QDir::currentPath() + "/" + applicationFolderName;
sharedDataPath = QDir::currentPath() + "/" + sharedDataFolderName;
Logger::instance().log(buildPath);
qDebug() << hashFileName;
}
void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataParser *dataParser,AssetsManager *assetManager)
{
this->commonClientHandler = commonClientHandler;
this->dataParser = dataParser;
this->assetManager = assetManager;
hashCalculator = new FastHashCalculator;
if (!QDir(staticDataFolderName).exists())
{
QDir().mkdir(staticDataFolderName);
}
sizeToSend = 0;
assetManager->initialize(this,dataParser);
if (!checkRequiredFolder())
{
emit sigErrorRequired(100);
return;
}
calculateFullHash();
currentStreamingPath = assetManager->getLastVersion(); //TODO: сохрнаять предыдущую версию и загружать ее при включении
setUpCurrentServerHash();
mutex = new QMutex;
qDebug() << "UpdateController init thread ID " << QThread::currentThreadId();
emit sigInitializeFinished();
}
void UpdateController::changeAssetVersion(QString versionName)
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
qDebug() << "UpdateController thread ID " << QThread::currentThreadId();
currentStreamingPath = assetManager->setVersion(versionName);
setUpCurrentServerHash();
emit sigUpdateDocs();
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
commonClientHandler->sendCurrentVersionToAllClient();
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::createCopyVersion(QString versionName,QString newVersionName,QString author)
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
assetManager->createCopyVersion(versionName,newVersionName,author);
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::deleteAssetVersion(QString versionName)
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
assetManager->deleteVersion(versionName);
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::compareFiles(ClientHandler* handler, QByteArray array)
{
mutex->lock();
serverDataList.clear();
serverDataList = *loadHash(hashFileName);
clientDataList.clear();
xmlFileDataParse(array);
checkNeedUpdate(handler);
mutex->unlock();
}
void UpdateController::showHash()
{
for(FileData& str : serverDataList){
Logger::instance().log(str.hash);
}
}
void UpdateController::calculateFullHash()
{
Logger::instance().log("Calculate hash...");
QElapsedTimer timer;
timer.start();
qDebug() << "Start calculate... ";
commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
//auto *list = calculateHash(buildPath);
hashCalculator->calculateHashes(buildPath);
auto* list = hashCalculator->getHashList();
qDebug() << "Hash count: " << list->count();
saveHash(buildHashName,list);
calculateSharedHash();
Logger::instance().log("Calculate hash complete");
qDebug() << "Calculate time " << timer.elapsed();
commonClientHandler->slot_sendPacketToAllClients(PacketType::FREE);
}
void UpdateController::calculateFullHashWithSetup()
{
commonClientHandler->slot_sendPacketToAllClients(PacketType::RECALCULATE_HASH);
calculateCurrentSharedHash();
setUpCurrentServerHash();
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY);
}
void UpdateController::saveHash(QString fileName,QList<FileData> *fileList)
{
QFile hashFile(fileName);
hashFile.open(QIODevice::WriteOnly | QIODevice::Truncate);
QXmlStreamWriter xmlWriter(&hashFile);
QListIterator<FileData> fileDataIterator(*fileList);
xmlWriter.setAutoFormatting(true);
xmlWriter.writeStartDocument();
xmlWriter.writeStartElement("FileDataList");
while (fileDataIterator.hasNext())
{
FileData data = fileDataIterator.next();
xmlWriter.writeStartElement("FileData");
xmlWriter.writeAttribute("Path",data.path);
xmlWriter.writeAttribute("Hash",data.hash);
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
hashFile.close();
}
QList<FileData>* UpdateController::loadHash(QString filename)
{
QList<FileData> *files = new QList<FileData>();
QFile hashFile(filename);
QByteArray array;
if(hashFile.open(QIODevice::ReadOnly)){
array = hashFile.readAll();
hashFile.close();
}
QXmlStreamReader xmlReader(array);
while (!xmlReader.atEnd())
{
if(xmlReader.isStartElement())
{
if(xmlReader.name().toUtf8() == "FileData")
{
FileData data;
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "Path")
data.path = value;
else if(name == "Hash")
data.hash = value;
}
files->append(data);
}
}
xmlReader.readNextStartElement();
}
Logger::instance().log("Hash load from file ");
return files;
}
void UpdateController::calculateSize()
{
QDirIterator iterator(buildPath);
quint64 total = 0;
while(iterator.hasNext()){
if(iterator.fileInfo().isFile()){
total += iterator.fileInfo().size();
}
iterator.next();
}
Logger::instance().log("Full size: ");
Logger::instance().log(QString::number(total));
}
QString UpdateController::getCommands()
{
QString commandsText;
commandsText += "check - check version ";
commandsText += "update - update files ";
return commandsText;
}
void UpdateController::setUpCurrentServerHash()
{
QList<FileData> *fileList = new QList<FileData>;
fileList->append(*loadHash(buildHashName));
FileData *streamingFolder = new FileData;
streamingFolder->hash = "FOLDER";
streamingFolder->path = buildDataPath + streamingAssetsFolderName;
fileList->append(*streamingFolder);
QString streamingHashFileName = Tools::createVersionHashFilepath(assetManager->getCurrentVersionData()->getViewName());
fileList->append(*loadHash(streamingHashFileName));
assetManager->prepareLocalPathList(fileList);
saveHash(hashFileName,fileList);
}
void UpdateController::setDataInfo(DataInfo *value)
{
dataInfo = value;
}
QString UpdateController::getCurrentStreamingPath() const
{
return currentStreamingPath;
}
QList<FileData> UpdateController::prepareRealPathList(QList<FileData> fileData)
{
return *assetManager->prepareRealPathList(&fileData);
}
void UpdateController::setLocalFileData(QList<FileData> dataList)
{
serverDataList.append(dataList);
}
bool UpdateController::checkNeedUpdate(ClientHandler *handler)
{
QList<FileData> *forSend = new QList<FileData>;
QList<FileData> *forDelete = new QList<FileData>;
Client *client = handler->getClient();
sizeToSend = 0;
bool needUpdate = false;
for (auto &item:clientDataList) //проверка на недостающие файлы по адресам
{
if(item.path.contains("Temp")) continue;
if(item.path.contains("docs.xml")) continue;
if (!serverDataList.contains(item))
{
forDelete->append(item);
}
}
for (auto &item:serverDataList)
{
if(item.path.contains("Temp")) continue;
if(item.path.contains("docs.xml")) continue;
if (!clientDataList.contains(item))
{
forSend->append(item);
}
}
if(forSend->length() > 0) //формирование сообщения об обновлении
{
QString log;
log.append(" Client: " + client->getLogin());
log.append(" Need updates: ");
log.append(QString::number(forSend->length()));
log.append(" objects");
client->setFileSendList(*forSend);
Logger::instance().log(log);
needUpdate = true;
}
else
{
QString log;
log.append(" Client: " + client->getLogin());
log.append(" no update required");
Logger::instance().log(log);
}
if(forDelete->length() > 0){
QString log;
log.append(" Client: " + client->getLogin());
log.append(" Need delete: ");
log.append(QString::number(forDelete->length()));
log.append(" objects");
client->setFileDeleteList(*forDelete);
Logger::instance().log(log);
needUpdate = true;
}
else
{
QString log;
log.append(" Client: " + client->getLogin());
log.append(" no delete required");
Logger::instance().log(log);
//handler->sendMessageBlock(log);
}
CalculateSizeToSend(*forSend);
handler->sendNeedUpdate(needUpdate,sizeToSend,forSend->length(),forDelete->length());
return needUpdate;
}
QList<FileData>* UpdateController::calculateHash(QString path)
{
serverDataList.clear();
if(!QDir(path).exists()){
QDir().mkdir(path);
}
QString hashString;
QStringList filter;
filter << "*";
QList<FileData> *files = new QList<FileData>;
QDirIterator dirIterator(path,filter, QDir::AllEntries, QDirIterator::Subdirectories);
while (dirIterator.hasNext())
{
QFileInfo fileInfo(dirIterator.next());
FileData currentFile;
if(fileInfo.isDir() && !fileInfo.fileName().startsWith(".") && fileInfo.fileName() != projectFolderName)
{
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
currentFile.hash = "FOLDER";
if(!files->contains(currentFile))
{
files->push_back(currentFile);
}
}
}
QDirIterator fileIterator(path,filter,QDir::Files | QDir::NoDotAndDotDot,QDirIterator::Subdirectories);
while (fileIterator.hasNext())
{
fileIterator.next();
QFileInfo fileInfo = fileIterator.fileInfo();
FileData currentFile;
QFile file(fileInfo.absoluteFilePath());
quint64 fileSize = file.size(); //буффер для хэширования крупных файлов
const quint64 bufferSize = 1024;
if(fileInfo.isHidden()) continue;
if(fileInfo.isFile() && file.open(QIODevice::ReadOnly) && !fileInfo.fileName().contains(".meta"))
{
char buffer[bufferSize];
int bytesRead;
int readSize = qMin(fileSize,bufferSize);
QCryptographicHash hash(QCryptographicHash::Md5);
while(readSize > 0 && (bytesRead = file.read(buffer,readSize)) > 0)
{
fileSize -= bytesRead;
hash.addData(buffer,bytesRead);
readSize = qMin(fileSize,bufferSize);
}
hashString = QString(hash.result().toHex());
currentFile.path = Tools::createLocalPath(fileInfo.absoluteFilePath());
currentFile.hash = hashString;
files->push_back(currentFile);
file.close();
}
}
serverDataList.append(*files);
return files;
}
QString UpdateController::getPathAdditionalFile(QString name)
{
QString path = Tools::createSharedPath("/" + assetManager->getCurrentVersionData()->getViewName() + "/" + additionalFilesFolderName + name);
return path;
}
QString UpdateController::getPathScensFile(QString name)
{
QString path = Tools::createSharedPath("/" + assetManager->getCurrentVersionData()->getViewName() + "/" + rusScensFolderName + name);
return path;
}
QByteArray UpdateController::getLocalHash()
{
QFile hashFile(hashFileName);
QByteArray array;
if(hashFile.open(QIODevice::ReadOnly)){
array = hashFile.readAll();
hashFile.close();
}
return array;
}
QString UpdateController::getCurrentVersionName()
{
return assetManager->getCurrentVersionData()->getViewName();
}
void UpdateController::CalculateSizeToSend(QList<FileData> diffList)
{
QListIterator<FileData> serverDiffIterator(diffList);
while (serverDiffIterator.hasNext())
{
QString path;
FileData pathForUpdate = serverDiffIterator.next();
if(pathForUpdate.path.contains(streamingAssetsFolderName))
{
path = Tools::createStreamingToRealPath(pathForUpdate.path,assetManager->getCurrentVersionData());
}
else
{
path = Tools::createRootPath(pathForUpdate.path);
}
QFile file(path);
sizeToSend += file.size();
}
}
void UpdateController::calculateSharedHash()
{
QDir sharedDir(sharedDataPath);
if(!QDir(sharedDataPath).exists())
{
QDir().mkdir(sharedDataPath);
}
QDirIterator dirIterator(sharedDir);
QList<FileData> *fileList = new QList<FileData>;
QList<StreamingVersionData*> *versionList = new QList<StreamingVersionData*>;
while (dirIterator.hasNext())
{
fileList->clear();
dirIterator.next();
QFileInfo fileInfo = dirIterator.fileInfo();
if (fileInfo.fileName() == "." || fileInfo.fileName() == "..")
continue;
QString fileName = Tools::createVersionHashFilepath(fileInfo.fileName());
hashCalculator->calculateHashes(fileInfo.filePath());
fileList = hashCalculator->getHashList();
//fileList = calculateHash(fileInfo.absoluteFilePath());
qDebug() << "Hash count: " << fileList->count();
saveHash(fileName,fileList);
StreamingVersionData *version = new StreamingVersionData(
fileInfo.absoluteFilePath(),fileInfo.fileName(),
fileInfo.birthTime(),fileInfo.size());
versionList->append(version);
}
assetManager->createFirstVersionListXML(*versionList);
}
void UpdateController::calculateCurrentSharedHash()
{
QList<FileData> *fileList = new QList<FileData>;
QString fileName = Tools::createVersionHashFilepath(assetManager->getCurrentVersionData()->getViewName());
hashCalculator->calculateHashes(currentStreamingPath);
fileList = hashCalculator->getHashList();
//fileList = calculateHash(currentStreamingPath);
qDebug() << "Hash count: " << fileList->count();
saveHash(fileName,fileList);
}
void UpdateController::sendNewVersionList()
{
commonClientHandler->sendNewVersionListToAllClient();
}
bool UpdateController::checkDuplicate(QString versionName)
{
return assetManager->findDuplicate(versionName);
}
void UpdateController::xmlFileDataParse(QByteArray array)
{
QXmlStreamReader xmlReader(array);
xmlReader.readNext();
//Крутимся в цикле до тех пор, пока не достигнем конца документа
while(!xmlReader.atEnd())
{
//Проверяем, является ли элемент началом тега
if(xmlReader.isStartElement())
{
if(xmlReader.name() == "FileData")
{
FileData data;
foreach(const QXmlStreamAttribute &attr,xmlReader.attributes())
{
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "Path")
data.path = value;
else if(name == "Hash")
data.hash = value;
}
clientDataList.append(data);
}
}
xmlReader.readNext();
}
}
StreamingVersionData* UpdateController::getCurrentVersion()
{
return assetManager->getCurrentVersionData();
}
void UpdateController::printFileList(QList<FileData> fileData)
{
QListIterator<FileData> iterator(fileData);
while (iterator.hasNext())
{
auto next = iterator.next();
Logger::instance().log(next.path);
}
}
QList<FileData> UpdateController::getClientDataList() const
{
return clientDataList;
}
DataInfo *UpdateController::getCurrentDataInfo()
{
return dataInfo;
}
void UpdateController::clearCurrentDataInfo()
{
delete dataInfo;
}
bool UpdateController::checkRequiredFolder()
{
bool required = true;
QDir buildDir(buildPath + "/" + projectFolderName);
if (!buildDir.exists()) required = false;
QDir baseSharedDir(sharedDataPath + "/" + baseNameVersion);
if (!baseSharedDir.exists()) required = false;
return required;
}
UpdateController::~UpdateController()
{
}

View File

@@ -0,0 +1,103 @@
#ifndef UPDATECONTROLLER_H
#define UPDATECONTROLLER_H
#include <QString>
#include <QObject>
#include <QCryptographicHash>
#include <QDirIterator>
#include <QDebug>
#include <QDataStream>
#include <QMutex>
#include <QApplication>
#include <QMessageBox>
#include <Systems/Parsers/dataparser.h>
#include <Data/typesDataServerClient.h>
#include <Data/StreamingVersionData.h>
#include "fasthashcalculator.h"
class TCPServer;
class SendSystem;
class DataParser;
class ClientHandler;
class AssetsManager;
class ServerLMSWidget;
class CommonClientHandler;
class Logger;
class UpdateController : public QObject
{
Q_OBJECT
public:
explicit UpdateController(QObject *parent = 0);
void initialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
void compareFiles(ClientHandler* handler, QByteArray array);
void showHash();
void calculateFullHash();
void calculateFullHashWithSetup();
void calculateSharedHash();
void sendNewVersionList();
void setCurrentStreamingPath(QString path);
bool checkDuplicate(QString versionName);
QList<FileData>* calculateHash(QString path);
QByteArray getLocalHash();
QString getCurrentVersionName();
QList<FileData> getClientDataList() const;
QString getCurrentStreamingPath() const;
QList<FileData> prepareRealPathList(QList<FileData> fileData);
~UpdateController();
DataInfo *getCurrentDataInfo();
void clearCurrentDataInfo();
void xmlFileDataParse(QByteArray array);
QString getPathAdditionalFile(QString name);
QString getPathScensFile(QString name);
StreamingVersionData *getCurrentVersion();
void setDataInfo(DataInfo *value);
public slots:
void changeAssetVersion(QString versionName);
void createCopyVersion(QString versionName,QString newVersionName,QString author);
void deleteAssetVersion(QString versionName);
void setUpCurrentServerHash();
signals:
void sigErrorRequired(int code);
void sigUpdateDocs();
void sigInitializeFinished();
private:
QList<FileData> clientDataList;
QList<FileData> serverDataList;
DataInfo *dataInfo;
QString buildPath;
QString currentStreamingPath;
QString sharedDataPath;
CommonClientHandler *commonClientHandler;
FastHashCalculator *hashCalculator;
DataParser *dataParser;
AssetsManager *assetManager;
quint64 sizeToSend;
QMutex *mutex;
QString getCommands();
void printFileList(QList<FileData> fileData);
bool checkNeedUpdate(ClientHandler* handler);
void setLocalFileData(QList<FileData> dataList);
void calculateSize();
void saveHash(QString fileName,QList<FileData> *fileList);
QList<FileData>* loadHash(QString fileName);
void CalculateSizeToSend(QList<FileData> diffList);
bool checkRequiredFolder();
void calculateCurrentSharedHash();
};
#endif // UPDATECONTROLLER_H

View File

@@ -0,0 +1,208 @@
#include "clienthandler.h"
#include <QThread>
#include <Systems/sendsystem.h>
ClientHandler::ClientHandler( QObject *parent):
QObject(parent)
{
}
void ClientHandler::initialize(int descriptor,ServerLMSWidget *serverWidget,
UpdateController *updateController,DataParser *dataParser)
{
this->socket = new QTcpSocket;
this->thread = new QThread;
socket->setParent(nullptr);
socket->setSocketDescriptor(descriptor);
qDebug() << "Client thread: " << QThread::currentThreadId();
sendSystem = new SendSystem;
recognizeSystem = new RecognizeSystem;
thread->start();
socket->moveToThread(thread);
sendSystem->moveToThread(thread);
recognizeSystem->moveToThread(thread);
this->updateController = updateController;
this->server = serverWidget;
QString peerName = socket->peerName();
QString peerAddress = socket->peerAddress().toString();
QString peerPort = QString::number(socket->peerPort());
client = new Client(peerName,peerAddress,peerPort,socket);
connect(this,&ClientHandler::sigSendXmlAnswer,sendSystem,&SendSystem::sendXmlAnswer,Qt::AutoConnection);
connect(this,&ClientHandler::sigInitSender,sendSystem,&SendSystem::initialize,Qt::AutoConnection);
connect(this,&ClientHandler::sigFileBlock,sendSystem,&SendSystem::sendFileBlock,Qt::AutoConnection);
connect(this,&ClientHandler::sigFileBlockByteArray,sendSystem,&SendSystem::sendFileBlockByteArray,Qt::AutoConnection);
connect(this,&ClientHandler::sigFolderBlock,sendSystem,&SendSystem::sendFolderBlock,Qt::AutoConnection);
connect(this,&ClientHandler::sigGetIsSendStopped,sendSystem,&SendSystem::getIsSendStopped,Qt::AutoConnection);
connect(this,&ClientHandler::sigSendDeleteBlock,sendSystem,&SendSystem::sendDeleteBlock,Qt::AutoConnection);
connect(this,&ClientHandler::sigNeedUpdate,sendSystem,&SendSystem::sendNeedUpdate,Qt::AutoConnection);
connect(this,&ClientHandler::sigSendNotify,sendSystem,&SendSystem::sendNotify,Qt::AutoConnection);
connect(this,&ClientHandler::sigSendFileBlockWithRename,sendSystem,&SendSystem::sendFileBlockWithRename,Qt::AutoConnection);
connect(this,&ClientHandler::sigSendVersion,sendSystem,&SendSystem::sendVersion,Qt::AutoConnection);
connect(this,&ClientHandler::sigSocketClose,sendSystem,&SendSystem::socketClose,Qt::AutoConnection);
connect(this,&ClientHandler::sigSocketFlush,sendSystem,&SendSystem::socketFlush,Qt::AutoConnection);
connect(this,&ClientHandler::sigSendPacketType,sendSystem,&SendSystem::sendPacketType,Qt::AutoConnection);
connect(this,&ClientHandler::sigSendStop,sendSystem,&SendSystem::sendStop,Qt::DirectConnection);
connect(socket,&QTcpSocket::readyRead,this,&ClientHandler::initClientType,Qt::AutoConnection);
initClientType();
recognizeSystem->initialize(updateController,dataParser,serverWidget,sendSystem, this);
sendSystem->setClient(client,socket);
emit sigInitSender(dataParser,serverWidget->getMutex());
}
void ClientHandler::setClient(Client *value)
{
client = value;
}
void ClientHandler::initClientType()
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
while (socket->bytesAvailable() > 0)
{
stream.startTransaction();
char *read = new char[4];
stream.readRawData(read,4);
int numPackage = *((int*)read);
PacketType packetType = static_cast<PacketType>(numPackage);
if(!stream.commitTransaction()) continue;
packetTypeInit(packetType,client);
disconnect(socket,&QTcpSocket::readyRead,this,&ClientHandler::initClientType);
connect(socket,&QTcpSocket::readyRead,recognizeSystem,&RecognizeSystem::recognize,Qt::AutoConnection);
connect(socket, &QTcpSocket::disconnected, this, &ClientHandler::sendDisable,Qt::AutoConnection);
}
}
void ClientHandler::sendHash()
{
QString path = "\\" + hashFileName;
emit sigSendFileBlockWithRename(path,"/serverHash.xml");
//emit sigSendNotify("HASHSENDCOMPLETE");
}
void ClientHandler::sendVersion()
{
emit sigSendVersion();
}
void ClientHandler::setReady(bool flag)
{
getClient()->setReady(flag);
}
void ClientHandler::sendVersionList()
{
QFile file(versionListFile);
file.open(QFile::ReadOnly);
QByteArray array = file.readAll();
file.close();
sendXmlAnswer(array);
}
void ClientHandler::sendPacketType(PacketType packetType)
{
emit sigSendPacketType(packetType);
}
void ClientHandler::sendXmlAnswer(QByteArray array, PacketType packetType)
{
emit sigSendXmlAnswer(array, packetType);
}
void ClientHandler::sendFileBlock(QString path)
{
emit sigFileBlock(path);
}
void ClientHandler::sendFileBlockByteArray(QByteArray array, PacketType packetType)
{
emit sigFileBlockByteArray(array, packetType);
}
bool ClientHandler::getIsSendStopped()
{
return emit sigGetIsSendStopped();
}
void ClientHandler::sendDeleteBlock(QString path)
{
emit sigSendDeleteBlock(path);
}
void ClientHandler::sendNotify(QString text)
{
emit sigSendNotify(text);
Logger::instance().log(client->getLogin() + " send notify");
}
void ClientHandler::sendNeedUpdate(bool flag, quint64 size, quint64 fileCount,quint64 deleteCount)
{
emit sigNeedUpdate(flag,size,fileCount,deleteCount);
Logger::instance().
log(client->getLogin() + " send need update");
}
void ClientHandler::sendDisable()
{
// thread->exit();
// thread->wait();
thread->quit();
emit sigSendStop();
emit sigClientDisconnected(client->getAddress(),client->getPort());
}
void ClientHandler::packetTypeInit(PacketType packet,Client *client)
{
if(packet == PacketType::TYPE_QT)
{
client->setUnity(TypeClientAutorization::TYPE_QT_CLIENT);
}
else if (packet == PacketType::TYPE_UNITY)
{
client->setUnity(TypeClientAutorization::TYPE_UNITY_CLIENT);
}
Logger::instance().log("INIT PACK " + enumToString(packet));
}
Client *ClientHandler::getClient() const
{
return client;
}
SendSystem *ClientHandler::getSendSystem() const
{
return sendSystem;
}
QTcpSocket *ClientHandler::getSocket() const
{
return socket;
}
ClientHandler::~ClientHandler()
{
thread->quit();
thread->wait();
}

View File

@@ -0,0 +1,91 @@
#ifndef CLIENTHANDLER_H
#define CLIENTHANDLER_H
#include <QObject>
#include <QTcpSocket>
#include <QThread>
#include <Systems/sendsystem.h>
#include <Systems/tools.h>
#include <Data/Client.h>
#include <Data/PacketType.h>
class SendSystem;
class DataParser;
class Logger;
class ServerLMSWidget;
class UpdateController;
class RecognizeSystem;
class ClientAnswerParser;
class ClientHandler : public QObject
{
Q_OBJECT
public:
ClientHandler(QObject* parent = nullptr);
void initSender(DataParser *dataParser);
void sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER);
void sendFolderBlock(QString path);
void sendFileBlock(QString path);
void sendFileBlockByteArray(QByteArray array, PacketType packetType);
bool getIsSendStopped();
void sendDeleteBlock(QString path);
void sendFinish();
void sendNotify(QString text);
void sendNeedUpdate(bool flag, quint64 size,quint64 fileCount,quint64 deleteCount);
void sendDisable();
void recognize();
void sendHash();
void sendVersionList();
void sendPacketType(PacketType packetType);
void sendVersion();
void setReady(bool flag);
~ClientHandler();
Client *getClient() const;
SendSystem *getSendSystem() const;
QTcpSocket *getSocket() const;
signals:
void sigSendXmlAnswer(QByteArray array, PacketType packetType);
void sigInitSender (DataParser *dataParse, QMutex *mutex);
void sigFolderBlock(QString path);
void sigFileBlock(QString path);
void sigFileBlockByteArray(QByteArray array, PacketType packetType);
bool sigGetIsSendStopped();
void sigSendDeleteBlock(QString path);
void sigNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount);
void sigClientDisconnected(QString address,QString port);
void sigSendHash();
void sigRecognize(ClientHandler *handler);
void sigSendNotify(QString notify);
void sigSendFileBlockWithRename (QString path,QString newName);
void sigSocketClose();
bool sigSocketFlush();
void sigSendVersion();
void sigSendPacketType(PacketType packetType);
void sigSendStop();
public :
QThread *thread;
QTcpSocket *socket;
void initialize(int descriptor, ServerLMSWidget *serverWidget,
UpdateController *updateController, DataParser *dataParser);
void setClient(Client *value);
private:
UpdateController *updateController;
RecognizeSystem *recognizeSystem;
Client *client;
SendSystem *sendSystem;
ServerLMSWidget *server;
void initClientType();
void packetTypeInit(PacketType packet, Client *client);
};
#endif // CLIENTHANDLER_H

9
LibServer/metatypes.cpp Normal file
View File

@@ -0,0 +1,9 @@
#include<QMetaType>
#include "metatypes.h"
void registerMetaType()
{
qRegisterMetaType<PacketType>("PacketType");
qRegisterMetaType<UserType>("UserType");
qRegisterMetaType<LogLevel>("LogLevel");
}

14
LibServer/metatypes.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef METATYPES_H
#define METATYPES_H
#include "Data/PacketType.h"
#include "Data/typesDataServerClient.h"
#include "Systems/logger.h"
void registerMetaType();
Q_DECLARE_METATYPE(PacketType)
Q_DECLARE_METATYPE(UserType)
Q_DECLARE_METATYPE(LogLevel)
#endif // METATYPES_H

View File

@@ -0,0 +1,149 @@
#include "multithreadserver.h"
MultiThreadServer::MultiThreadServer(ServerLMSWidget *widget,UpdateController *updateController,ProcessingSystem *processingSystem,
DataParser *dataParser,qint16 hostPort, QObject *parent ):
QTcpServer(parent),
serverLmsWidget(widget),
hostPort(hostPort),
processingSystem(processingSystem),
updateController(updateController),
dataParser(dataParser),
stateServer(stoped),
stateBlockAutorization(blocked)
{
clientsMap = new QMap<int,ClientHandler*>;
}
void MultiThreadServer::incomingConnection(qintptr socketDesriptor)
{
ClientHandler* newClient = new ClientHandler;
connect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize,Qt::AutoConnection);
connect(newClient,&ClientHandler::sigClientDisconnected,this,&MultiThreadServer::slotDisconnectClient,Qt::AutoConnection);
emit sigInitClient(socketDesriptor,serverLmsWidget,updateController,dataParser);
disconnect(this,&MultiThreadServer::sigInitClient,newClient,&ClientHandler::initialize);
addClient(socketDesriptor,newClient);
Logger::instance().log("To Client: " + QString(SERVER_HELLO));
}
bool MultiThreadServer::startServer()
{
if(stateServer == stoped)
{
//connect(tcpServer, &QTcpServer::newConnection, this, &ServerLMSWidget::slotNewConnection,Qt::AutoConnection);
if(!listen(QHostAddress::Any, hostPort))
{
Logger::instance().log("SERVER: start ERROR");
stateServer = stoped;
return false;
}
else
{
Logger::instance().log("SERVER: start OK");
stateServer = started;
return true;
}
}
else
return false;
}
bool MultiThreadServer::stopServer()
{
if(stateServer == started)
{
disableClients();
//Закрываем сервер
close();
stateServer = stoped;
Logger::instance().log("SERVER: stop OK");
return true;
}
else
return false;
}
QMap<int, ClientHandler *> *MultiThreadServer::getClientsMap() const
{
return clientsMap;
}
void MultiThreadServer::updateClientList()
{
serverLmsWidget->slot_UpdateListClients();
}
void MultiThreadServer::disableClients()
{
QByteArray arrayAnswer = dataParser->ClientAnswer()->notify(NOTIFY_SERVER_END);
//Закрываем все открытые сокеты
foreach(int idSocket, clientsMap->keys())
{
ClientHandler* handler = (*clientsMap)[idSocket];
//Фиксируем время выхода Юнити-клиента
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
{
processingSystem->processingExitUnityClient(handler);
}
handler->sigSendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER);
QString str = QString(arrayAnswer);
processingSystem->processingClientDeAutorization(handler->getClient()->getLogin());
handler->sigSocketClose();
//clientsMap.remove(idSocket);
removeClient(idSocket);
}
}
void MultiThreadServer::slotDisconnectClient(QString peerAddress, QString peerPort)
{
QString login = "";
qDebug() << peerAddress << " " << peerPort << " " << "disconnect";
//Проходим все открытые сокеты, ищем нужный
foreach(int idSocket, clientsMap->keys())
{
ClientHandler *client = (*clientsMap)[idSocket];
if(client->getClient()->getAddress() == peerAddress && client->getClient()->getPort() == peerPort)
{
login = client->getClient()->getLogin();
ClientDeAutorization clientDeAutorization;
clientDeAutorization.Login = login;
processingSystem->processingClientDeAutorization(client, clientDeAutorization);
removeClient(idSocket);
delete client;
continue;
}
}
emit signalStopSendFile();
Logger::instance().log("SERVER: Client " + login + " disconnected");
serverLmsWidget->slot_UpdateListClients();
serverLmsWidget->getProcessingSystem()->processingClientDeAutorization(login);
}
void MultiThreadServer::removeClient(int idSocket)
{
clientsMap->remove(idSocket);
serverLmsWidget->slot_UpdateListClients();
}
void MultiThreadServer::addClient(qintptr descriptor, ClientHandler *client)
{
(*clientsMap)[descriptor] = client;
serverLmsWidget->slot_UpdateListClients();
}

View File

@@ -0,0 +1,65 @@
#ifndef MULTITHREADSERVER_H
#define MULTITHREADSERVER_H
#include "serverlmswidget.h"
#include "Systems/processingsystem.h"
#include <QObject>
class ProcessingSystem;
class MultiThreadServer : public QTcpServer
{
Q_OBJECT
public:
MultiThreadServer(ServerLMSWidget *widget,UpdateController *updateController,ProcessingSystem *processingSystem,
DataParser *dataParser, qint16 hostPort, QObject *parent = nullptr);
QMap<int, ClientHandler *> *getClientsMap() const;
void updateClientList();
void disableClients();
bool startServer();
bool stopServer();
void blockAutorization()
{
stateBlockAutorization = blocked;
}
void unBlockAutorization()
{
stateBlockAutorization = unblocked;
}
EStateBlockAutorization getStateBlockAutorization() const
{
return stateBlockAutorization;
}
EStateServer getStateServer()
{
return stateServer;
}
signals:
void sigInitClient(int descriptor, ServerLMSWidget *serverWidget,
UpdateController *updateController, DataParser *dataParser);
void signalStopSendFile();
public slots:
void slotDisconnectClient(QString peerAddress, QString peerPort);
protected:
void incomingConnection(qintptr handle) override;
private:
ServerLMSWidget *serverLmsWidget;
QMap<int, ClientHandler*> *clientsMap;
qint16 hostPort;
ProcessingSystem *processingSystem;
UpdateController *updateController;
DataParser *dataParser;
EStateServer stateServer;
EStateBlockAutorization stateBlockAutorization;
void removeClient(int idSocket);
void addClient(qintptr descriptor, ClientHandler *client);
};
#endif // MULTITHREADSERVER_H

View File

@@ -0,0 +1,718 @@
#include "providerdblms.h"
#include <QThread>
#include <QMessageBox>
ProviderDBLMS::ProviderDBLMS(QWidget *parentWidget, QObject *parent) :
QObject(parent),
dbLMS(nullptr),
parentWidget(parentWidget)
{
dbLMS = new InterfaceDataBaseLMS(parentWidget);
connect(dbLMS, &InterfaceDataBaseLMS::signal_ErrorPostgreSQL, this, &ProviderDBLMS::signal_ErrorPostgreSQL);
}
ProviderDBLMS::~ProviderDBLMS()
{
DisConnectionFromDB();
}
bool ProviderDBLMS::ConnectionToDB()
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
if(dbLMS->connectionToDB())
{
Q_EMIT signal_BlockAutorization(false);
mtxAccess.unlock();
return true;
}
else
{
mtxAccess.unlock();
return false;
}
}
mtxAccess.unlock();
return true;
}
void ProviderDBLMS::DisConnectionFromDB()
{
mtxAccess.lock();
if(dbLMS->DBisConnected())
{
Q_EMIT signal_BlockAutorization(true);
dbLMS->disConnectionFromDB();
}
mtxAccess.unlock();
}
bool ProviderDBLMS::DBisConnected()
{
bool res = false;
mtxAccess.lock();
res = dbLMS->DBisConnected();
mtxAccess.unlock();
return res;
}
DataBaseSettings ProviderDBLMS::getDBSettings()
{
return dbLMS->getDataBaseSettings();
}
bool ProviderDBLMS::setUserPasswordPostgres(QString userName, QString password)
{
return dbLMS->setUserPasswordPostgres(userName, password);
}
bool ProviderDBLMS::checkDriverQPSQLavailable()
{
return dbLMS->checkDriverQPSQLavailable();
}
bool ProviderDBLMS::checkUserLMSexist()
{
return dbLMS->checkUserLMSexist();
}
bool ProviderDBLMS::checkDataBaseLMSexist()
{
return dbLMS->checkDataBaseLMSexist();
}
bool ProviderDBLMS::createUser()
{
return dbLMS->createUser();
}
bool ProviderDBLMS::createDB()
{
return dbLMS->createDB();
}
QString ProviderDBLMS::getMainInstructorName()
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return QStringLiteral("");
}
mtxAccess.unlock();
return QStringLiteral("");
}
bool ProviderDBLMS::authorizationTrainee(QString login, QString password, InterfaceDataBaseLMS::ErrorAuth& error, QString classroom_name, QString computer_name)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
//Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->authorizationTrainee(login, password, error, classroom_name, computer_name);
//Q_EMIT signal_BlockAutorization(false);
mtxAccess.unlock();
return res;
}
bool ProviderDBLMS::deAuthorizationTrainee(QString login)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
//Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->deAuthorizationTrainee(login);
//Q_EMIT signal_BlockAutorization(false);
mtxAccess.unlock();
return res;
}
QString ProviderDBLMS::getNameTraineeByLogin(QString login)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return QStringLiteral("");
}
QString res = dbLMS->getNameTraineeByLogin(login);
mtxAccess.unlock();
return res;
}
bool ProviderDBLMS::authorizationInstructor(QString login, QString password, InterfaceDataBaseLMS::ErrorAuth& error)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
//Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->authorizationInstructor(login, password, error);
//Q_EMIT signal_BlockAutorization(false);
mtxAccess.unlock();
return res;
}
bool ProviderDBLMS::deAuthorizationInstructor(QString login)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
//Q_EMIT signal_BlockAutorization(true);
bool res = dbLMS->deAuthorizationInstructor(login);
//Q_EMIT signal_BlockAutorization(false);
mtxAccess.unlock();
return res;
}
QString ProviderDBLMS::getNameInstructorByLogin(QString login)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return QStringLiteral("");
}
QString res = dbLMS->getNameInstructorByLogin(login);
mtxAccess.unlock();
return res;
}
bool ProviderDBLMS::deAuthorizationAll()
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
Q_EMIT signal_BlockAutorization(true);
bool res1 = dbLMS->deAuthorizationAllTrainees();
bool res2 = dbLMS->deAuthorizationAllInstructors();
Q_EMIT signal_BlockAutorization(false);
mtxAccess.unlock();
return res1 && res2;
}
bool ProviderDBLMS::entryTraineeOnSimulator(int id_trainee)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
if(dbLMS->entryTraineeOnSimulator(id_trainee))
{
mtxAccess.unlock();
return true;
}
else
{
mtxAccess.unlock();
return false;
}
}
bool ProviderDBLMS::exitTraineeFromSimulator(int id_trainee)
{
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return false;
}
if(dbLMS->exitTraineeFromSimulator(id_trainee))
{
mtxAccess.unlock();
return true;
}
else
{
mtxAccess.unlock();
return false;
}
}
int ProviderDBLMS::getIdTraineeByLogin(QString login)
{
int id_trainee = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return id_trainee;
}
id_trainee = dbLMS->getIdTraineeByLogin(login);
mtxAccess.unlock();
return id_trainee;
}
int ProviderDBLMS::getIdInstructorByLogin(QString login)
{
int id_instructor = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return id_instructor;
}
id_instructor = dbLMS->getIdInstructorByLogin(login);
mtxAccess.unlock();
return id_instructor;
}
QString ProviderDBLMS::getLoginTraineeById(int id_trainee)
{
QString login = "";
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return login;
}
login = dbLMS->getTrainee(id_trainee).getLogin();
mtxAccess.unlock();
return login;
}
QList<Instructor> ProviderDBLMS::GetListAllInstructors()
{
QList<Instructor> listInstructors;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return listInstructors;
}
listInstructors = dbLMS->getListInstructors();
mtxAccess.unlock();
return listInstructors;
}
QList<Trainee> ProviderDBLMS::GetListAllTrainees()
{
QList<Trainee> listTrainees;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return listTrainees;
}
listTrainees = dbLMS->getListTrainees();
mtxAccess.unlock();
return listTrainees;
}
QList<Group> ProviderDBLMS::GetListAllGroups()
{
QList<Group> listGroups;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return listGroups;
}
listGroups = dbLMS->getListGroups();
mtxAccess.unlock();
return listGroups;
}
int ProviderDBLMS::newInstructor()
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->newInstructor();
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::delInstructor(int id)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->delInstructor(id);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::editInstructor(Instructor instructor)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->editInstructor(instructor);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::newTrainee(int id_group)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->newTrainee(id_group);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::delTrainee(int id)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->delTrainee(id);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::editTrainee(Trainee trainee)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->editTrainee(trainee);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::newGroup()
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->newGroup();
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::delGroup(int id)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->delGroup(id);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::editGroup(Group group)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->editGroup(group);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::newTaskAMM(TaskAmmFim task, int id_trainee)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->newTaskAMM(task, id_trainee);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::delTaskAMM(int id)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->delTaskAMM(id);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::editTaskAMM(TaskAmmFim task)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->editTaskAMM(task);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::newTaskFIM(TaskAmmFim task, int id_trainee)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->newTaskFIM(task, id_trainee);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::delTaskFIM(int id)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->delTaskFIM(id);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::editTaskFIM(TaskAmmFim task)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->editTaskFIM(task);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::replaceReportFIM(TaskAmmFim task)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->replaceReportFIM(task);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::changeStatusTaskFIM(int id_task, QString status)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->changeStatusTaskFIM(id_task, status);
mtxAccess.unlock();
return res;
}
int ProviderDBLMS::changeStatusTaskAMM(int id_task, QString status)
{
int res = 0;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return res;
}
res = dbLMS->changeStatusTaskAMM(id_task, status);
mtxAccess.unlock();
return res;
}
QList<TaskAmmFim> ProviderDBLMS::GetListTasksAMMofTrainee(int id_trainee)
{
QList<TaskAmmFim> listTasks;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return listTasks;
}
listTasks = dbLMS->getListTasksAMMofTrainee(id_trainee);
mtxAccess.unlock();
return listTasks;
}
QList<TaskAmmFim> ProviderDBLMS::GetListTasksFIMofTrainee(int id_trainee)
{
QList<TaskAmmFim> listTasks;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return listTasks;
}
listTasks = dbLMS->getListTasksFIMofTrainee(id_trainee);
mtxAccess.unlock();
return listTasks;
}
TaskAmmFim ProviderDBLMS::getTaskAMMbyID(int id_task)
{
TaskAmmFim task;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return task;
}
task = dbLMS->getTaskAMMbyID(id_task);
mtxAccess.unlock();
return task;
}
TaskAmmFim ProviderDBLMS::getTaskFIMbyID(int id_task)
{
TaskAmmFim task;
mtxAccess.lock();
if(! dbLMS->DBisConnected())
{
mtxAccess.unlock();
return task;
}
task = dbLMS->getTaskFIMbyID(id_task);
mtxAccess.unlock();
return task;
}

View File

@@ -0,0 +1,100 @@
#ifndef PROVIDERDBLMS_H
#define PROVIDERDBLMS_H
#include <QObject>
#include <QDebug>
#include "interfacedatabaselms.h"
#include "tasksAmmFim.h"
class ProviderDBLMS : public QObject
{
Q_OBJECT
public:
explicit ProviderDBLMS(QWidget *parentWidget, QObject *parent = nullptr);
~ProviderDBLMS();
public:
QString getMainInstructorName();
//Авторизация обучаемого на клиенте
bool authorizationTrainee(QString login, QString password, InterfaceDataBaseLMS::ErrorAuth& error, QString classroom_name = QStringLiteral(""), QString computer_name = QStringLiteral(""));
bool deAuthorizationTrainee(QString login);
QString getNameTraineeByLogin(QString login);
//Авторизация инструктора на клиенте
bool authorizationInstructor(QString login, QString password, InterfaceDataBaseLMS::ErrorAuth& error);
bool deAuthorizationInstructor(QString login);
QString getNameInstructorByLogin(QString login);
//Общая деавторизация
bool deAuthorizationAll();
//Регистрация тайминга Обучаемого
bool entryTraineeOnSimulator(int id_trainee);
bool exitTraineeFromSimulator(int id_trainee);
//
int getIdTraineeByLogin(QString login);
int getIdInstructorByLogin(QString login);
QString getLoginTraineeById(int id_trainee);
QList<Instructor> GetListAllInstructors();
QList<Trainee> GetListAllTrainees();
QList<Group> GetListAllGroups();
int newInstructor();
int delInstructor(int id);
int editInstructor(Instructor instructor);
int newTrainee(int id_group);
int delTrainee(int id);
int editTrainee(Trainee trainee);
int newGroup();
int delGroup(int id);
int editGroup(Group group);
int newTaskAMM(TaskAmmFim task, int id_trainee);
int delTaskAMM(int id);
int editTaskAMM(TaskAmmFim task);
int newTaskFIM(TaskAmmFim task, int id_trainee);
int delTaskFIM(int id);
int editTaskFIM(TaskAmmFim task);
int replaceReportFIM(TaskAmmFim task);
int changeStatusTaskFIM(int id_task, QString status);
int changeStatusTaskAMM(int id_task, QString status);
QList<TaskAmmFim> GetListTasksAMMofTrainee(int id_trainee);
QList<TaskAmmFim> GetListTasksFIMofTrainee(int id_trainee);
TaskAmmFim getTaskAMMbyID(int id_task);
TaskAmmFim getTaskFIMbyID(int id_task);
Q_SIGNALS:
//сигнал о блокировке авторизации
void signal_BlockAutorization(bool block);
signals:
void signal_ErrorPostgreSQL(QString text);
public:
bool ConnectionToDB();
void DisConnectionFromDB();
bool DBisConnected();
DataBaseSettings getDBSettings();
//PostgreSQL
bool setUserPasswordPostgres(QString userName, QString password);
bool checkDriverQPSQLavailable();
bool checkUserLMSexist();
bool checkDataBaseLMSexist();
bool createUser();
bool createDB();
private:
InterfaceDataBaseLMS* dbLMS;
QMutex mtxAccess;
QWidget *parentWidget;
};
#endif // PROVIDERDBLMS_H

View File

@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='utf-8'?>
<ListGroups>
</ListGroups>

View File

@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='utf-8'?>
<ListInstructors>
</ListInstructors>

View File

@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='utf-8'?>
<ListSubProc>
</ListSubProc>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ListTasksAMM>
</ListTasksAMM>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<ListTasksFIM>
</ListTasksFIM>

View File

@@ -0,0 +1,3 @@
<?xml version='1.0' encoding='utf-8'?>
<ListTrainees>
</ListTrainees>

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,490 @@
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include <QXmlStreamAttribute>
#include <QFile>
#include <QMessageBox>
#include <QThread>
#include <QErrorMessage>
#include "serverlmswidget.h"
#include "dialogsettingstray.h"
#include "ui_serverlmswidget.h"
#include "metatypes.h"
const QString ServerLMSWidget::languageENG = "en_EN";
const QString ServerLMSWidget::languageRUS = "ru_RU";
ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ServerLMSWidget),
waitAnimationWidget(nullptr),
server(nullptr),
updateThread(nullptr),
loggerThread(nullptr),
mutex(nullptr),
dataParser(nullptr),
processingSystem(nullptr),
updateController(nullptr),
assetsManager(nullptr),
commonClientHandler(nullptr),
chatSystem(nullptr),
docsUpdater(nullptr),
providerDBLMS(nullptr),
first (true),
language(languageENG),
errorCode(0),
versionStr("..."),
flStartInitialization(false)
{
ui->setupUi(this);
qDebug() << "ServerLMSWidget init thread ID " << QThread::currentThreadId();
ui->widget_Control->setObjectName("widgetControl");
ui->btnStopServer->setObjectName("btnStopServer");
ui->btnStartServer->setObjectName("btnStartServer");
ui->btnSettings->setObjectName("btnSettings");
registerMetaType();
updateMyStyleSheet();
setLanguageInterfase();
waitAnimationWidget = new WaitAnimationWidget;
QMovie *movie = new QMovie(":/resources/icons/762.gif");
waitAnimationWidget->setParent(this);
waitAnimationWidget->initialize(movie,this);
waitAnimationWidget->showWithPlay();
}
ServerLMSWidget::~ServerLMSWidget()
{
if(flStartInitialization)
{
server->stopServer();
updateThread->quit();
updateThread->wait();
delete updateThread;
delete server;
delete commonClientHandler;
delete dataParser;
delete processingSystem;
delete updateController;
delete docsUpdater;
delete assetsManager;
delete chatSystem;
delete mutex;
loggerThread->quit();
loggerThread->wait();
delete loggerThread;
delete providerDBLMS;
}
waitAnimationWidget->hideWithStop();
delete waitAnimationWidget;
delete ui;
}
void ServerLMSWidget::changeEvent(QEvent *event)
{
// В случае получения события изменения языка приложения
if (event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this); // переведём окно заново
updateStateServer();
}
}
void ServerLMSWidget::resizeEvent(QResizeEvent *event)
{
QSize size = event->size();
waitAnimationWidget->resize(size);
}
void ServerLMSWidget::slot_UpdateListClients()
{
//Очищаем список
ui->listWidget_Clients->clear();
for (const ClientHandler *handler : server->getClientsMap()->values())
{
QString strClient = handler->getClient()->getFullName();
ui->listWidget_Clients->addItem(strClient);
ui->listWidget_Clients->scrollToBottom();
ui->listWidget_Clients->setCurrentRow(ui->listWidget_Clients->count() - 1);
}
int countClients = (*server->getClientsMap()).count();
Logger::instance().log("SERVER: countClients = " + QString::number(countClients));
}
void ServerLMSWidget::slot_AddMessageToLog(QString message)
{
//ui->loggerTextField->appendPlainText(message);
ui->loggerTextField->appendHtml(message);
}
void ServerLMSWidget::slot_ErrorPostgreSQL(QString text)
{
emit signal_Menu_ShowWindow();
QMessageBox::critical(this, tr("Error PostgreSQL!"),text);
}
void ServerLMSWidget::slot_UpdateDocs()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
if(docsUpdater->updateDocsXML())
emit signal_DocsChanged();
QApplication::restoreOverrideCursor();
}
void ServerLMSWidget::slot_startInitialization_step1()
{
Logger::instance().log("Update docs.xml...");
slot_UpdateDocs();
Logger::instance().log("Update docs.xml completed!");
ui->btnStopServer->setEnabled(false);
ui->btnStartServer->setEnabled(true);
flStartInitialization = true;
updateStateServer();
QApplication::restoreOverrideCursor();
if(hasError() == 100)
return;
Logger::instance().log("Try connection to DB...");
tryConnectionToDB();
waitAnimationWidget->hideWithStop();
}
void ServerLMSWidget::slot_setVersion(QString versionStr)
{
this->versionStr = versionStr;
ui->lblVersionText->setText(versionStr);
}
void ServerLMSWidget::start()
{
startInitialization_step0();
}
void ServerLMSWidget::slot_BlockAutorization(bool block)
{
if(block)
{
server->blockAutorization();
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
//emit signal_Tray_ShowMessage(tr("Authorization blocked!"));
}
else
{
server->unBlockAutorization();
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
//emit signal_Tray_ShowMessage(tr("Authorization unblocked!"));
}
}
void ServerLMSWidget::slot_LanguageChanged(QString language)
{
qtLanguageTranslator.load(QString("translations/ServerLMS_") + language, ".");
qApp->installTranslator(&qtLanguageTranslator);
emit signal_LanguageChanged(language);
}
void ServerLMSWidget::on_btnStartServer_clicked()
{
if(server->startServer())
{
QApplication::setOverrideCursor(Qt::WaitCursor);
QApplication::restoreOverrideCursor();
ui->btnStartServer->setEnabled(false);
ui->btnStopServer->setEnabled(true);
slot_BlockAutorization(false);
emit signal_Tray_ShowMessage(tr("Server is started!"));
}
updateStateServer();
}
void ServerLMSWidget::on_btnStopServer_clicked()
{
if(server->stopServer())
{
ui->btnStopServer->setEnabled(false);
ui->btnStartServer->setEnabled(true);
slot_BlockAutorization(true);
emit signal_Tray_ShowMessage(tr("Server is stoped!"));
}
updateStateServer();
}
void ServerLMSWidget::on_btnSettings_clicked()
{
ServerDBSettings settingsTemp;
if(!DialogSettingsTray::loadSettings(&settingsTemp))
{
QMessageBox::critical(this, tr("Error!"), tr("Settings file could not be opened:") + "'config/settings.xml'");
return;
}
DialogSettingsTray dlg(providerDBLMS, this);
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
connect(&dlg, &DialogSettingsTray::signal_LanguageChanged, this, &ServerLMSWidget::slot_LanguageChanged);
//connect(&dlg, &DialogSettingsTray::signal_UpdateStyleSheet, this, &ServerLMSWidget::slot_UpdateStyleSheet);
connect(&dlg, &DialogSettingsTray::signal_UpdateDocs, this, &ServerLMSWidget::slot_UpdateDocs);
switch( dlg.exec() )
{
case QDialog::Accepted:
{
language = dlg.getSettings().Language;
if(dlg.settingsDBisChanged())
{
on_btnStopServer_clicked();
providerDBLMS->deAuthorizationAll();
providerDBLMS->DisConnectionFromDB();
updateStateServer();
QMessageBox::warning(this, tr("Warning!"), tr("Database settings have been changed.\nThe server will be restarted."));
tryConnectionToDB();
}
break;
}
case QDialog::Rejected:
break;
default:
break;
}
}
void ServerLMSWidget::slot_trySetServerState(PacketType packetType)
{
if (packetType == PacketType::BUSY)
{
server->blockAutorization();
updateStateServer();
}
else if (packetType == PacketType::FREE)
{
server->unBlockAutorization();
updateStateServer();
}
}
void ServerLMSWidget::setLanguageInterfase()
{
ServerDBSettings settings;
DialogSettingsTray::loadSettings(&settings);
if(settings.Language == "ENG")
{
qtLanguageTranslator.load(QString("translations/ServerLMS_") + languageENG, ".");
language = languageENG;
}
else
{
qtLanguageTranslator.load(QString("translations/ServerLMS_") + languageRUS, ".");
language = languageRUS;
}
qApp->installTranslator(&qtLanguageTranslator);
emit signal_LanguageChanged(language);
}
void ServerLMSWidget::updateMyStyleSheet()
{
QString styleSheet = loadStyleSheet();
styleSheet = styleSheet.replace("\n", "");
this->setStyleSheet(styleSheet);
}
QString ServerLMSWidget::loadStyleSheet()
{
QString fileName = "./resources/css/styleSheetMain.css";
QFile styleSheetFile(fileName);
if (!styleSheetFile.open(QFile::ReadOnly | QFile::Text))
{
QMessageBox::warning(this, tr("Warning!"), tr("The file could not be opened ") + fileName);
return QStringLiteral("");
}
else
{
QByteArray byteArray = styleSheetFile.readAll();
styleSheetFile.close();
QString style = byteArray;
return style;
}
}
void ServerLMSWidget::startInitialization_step0()
{
QApplication::setOverrideCursor(Qt::WaitCursor);
providerDBLMS = new ProviderDBLMS(this);
connect(providerDBLMS, &ProviderDBLMS::signal_ErrorPostgreSQL, this, &ServerLMSWidget::slot_ErrorPostgreSQL);
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
mutex = new QMutex;
updateThread = new QThread;
loggerThread = new QThread;
chatSystem = new ChatSystem();
assetsManager = new AssetsManager;
assetsManager->moveToThread(updateThread);
updateController = new UpdateController;
updateController->moveToThread(updateThread);
docsUpdater = new DocsUpdater(updateController/*, this*/);
docsUpdater->moveToThread(updateThread);
processingSystem = new ProcessingSystem(providerDBLMS, updateController, docsUpdater);
dataParser = new DataParser(assetsManager,processingSystem);
commonClientHandler = new CommonClientHandler;
connect(this,&ServerLMSWidget::signal_DocsChanged,commonClientHandler, &CommonClientHandler::slot_DocsChanged);
connect(commonClientHandler,&CommonClientHandler::sigSetServerState,this,&ServerLMSWidget::slot_trySetServerState);
server = new MultiThreadServer(this,updateController,processingSystem,dataParser,6000);
loggerThread->start();
updateThread->start();
commonClientHandler->initialize(server->getClientsMap(),processingSystem,dataParser);
processingSystem->initialize(server,dataParser,commonClientHandler,updateController,chatSystem);
chatSystem->initialize(commonClientHandler,dataParser,server->getClientsMap());
Logger::instance().moveToThread(loggerThread);
Logger::instance().setLoggingType(LoggingType::WIDGET);
Logger::instance().setLogToFile(true);
connect(this,&ServerLMSWidget::sigUpdateControllerInitialize,updateController,&UpdateController::initialize/*,Qt::DirectConnection*/);
connect(updateController,&UpdateController::sigInitializeFinished, this,&ServerLMSWidget::slot_startInitialization_step1/*,Qt::DirectConnection*/);
connect(this,&ServerLMSWidget::sigCalculateFullHash,updateController,&UpdateController::calculateFullHash,Qt::AutoConnection);
connect(updateController,&UpdateController::sigErrorRequired,this,&ServerLMSWidget::setError);
connect(updateController,&UpdateController::sigUpdateDocs,this,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection);
connect(&Logger::instance(),&Logger::sigLogToWidget,this, &ServerLMSWidget::slot_AddMessageToLog,Qt::QueuedConnection);
connect(assetsManager,&AssetsManager::signal_setVersion, this, &ServerLMSWidget::slot_setVersion);
emit sigUpdateControllerInitialize(commonClientHandler,dataParser,assetsManager);
}
void ServerLMSWidget::tryConnectionToDB()
{
if(! providerDBLMS->ConnectionToDB())
{
emit signal_Tray_ShowMessage(tr("Database connection error!"), QSystemTrayIcon::Critical);
emit signal_Menu_ShowWindow();
QMessageBox::critical(this, tr("Error!"), tr("Database connection error!"));
on_btnSettings_clicked();
}
else
{
providerDBLMS->deAuthorizationAll();
//Настройки БД
DataBaseSettings dbSettings = providerDBLMS->getDBSettings();
QString strDBsettings = QString("%1 (%2) %3 : %4").arg(dbSettings.dbName,
dbSettings.dbType,
dbSettings.dbHostName,
QString::number(dbSettings.dbPort));
Logger::instance().log("Connection to DB completed!");
emit signal_Tray_ShowMessage(tr("Database connection OK!") + "\n" + strDBsettings);
on_btnStartServer_clicked();
}
updateStateServer();
}
void ServerLMSWidget::updateStateServer()
{
if(server)
{
if(server->getStateServer() == EStateServer::started)
{
ui->lblOnOffText->setText(tr("started"));
ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else
{
ui->lblOnOffText->setText(tr("stoped"));
ui->lblOnOff->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
}
if(server->getStateBlockAutorization() == EStateBlockAutorization::unblocked)
{
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/open.png")));
}
else
{
ui->lblBlockAuth->setPixmap(QPixmap(QStringLiteral(":/resources/icons/lock.png")));
}
}
if(providerDBLMS)
{
if(providerDBLMS->DBisConnected())
{
//Настройки БД
DataBaseSettings dbSettings = providerDBLMS->getDBSettings();
QString strDBsettings = tr("connected") + QString(" [%1 (%2) %3 : %4]").arg(dbSettings.dbName,
dbSettings.dbType,
dbSettings.dbHostName,
QString::number(dbSettings.dbPort));
ui->lblDBsettings->setText(strDBsettings);
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else
{
ui->lblDBsettings->setText(tr("not connected"));
ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
ui->btnStopServer->setEnabled(false);
ui->btnStartServer->setEnabled(false);
}
}
ui->lblVersionText->setText(versionStr);
}

190
LibServer/serverlmswidget.h Normal file
View File

@@ -0,0 +1,190 @@
#ifndef SERVERLMSWIDGET_H
#define SERVERLMSWIDGET_H
#include "ServerLMS_global.h"
#include <QWidget>
#include <QTcpServer>
#include <QTcpSocket>
#include <QXmlStreamWriter>
#include <QMap>
#include <QTranslator>
#include <QMutex>
#include <QSystemTrayIcon>
#include <Systems/Parsers/dataparser.h>
#include <Systems/sendsystem.h>
#include <Systems/processingsystem.h>
#include <Systems/updatecontroller.h>
#include <Systems/assetsmanager.h>
#include <Systems/recognizesystem.h>
#include <Systems/logger.h>
#include <Systems/commonclienthandler.h>
#include <Systems/assetsmanager.h>
#include <Data/typesDataServerClient.h>
#include <Data/Client.h>
#include "multithreadserver.h"
#include "providerdblms.h"
#include "docsupdater.h"
#include "waitanimationwidget.h"
#include "specialmessagebox.h"
namespace Ui {
class ServerLMSWidget;
}
class DataParser;
class SendSystem;
class ProcessingSystem;
class Logger;
class UpdateController;
class RecognizeSystem;
class ClientHandler;
class MultiThreadServer;
class AssetsManager;
class ChatSystem;
class DocsUpdater;
class SERVERLMS_EXPORT ServerLMSWidget : public QWidget
{
Q_OBJECT
public:
explicit ServerLMSWidget(QWidget *parent = nullptr);
~ServerLMSWidget();
void start();
public:
static const QString languageENG;
static const QString languageRUS;
protected:
// Метод получения событий
// В нём будет производиться проверка события смены перевода приложения
void changeEvent(QEvent * event) override;
void resizeEvent(QResizeEvent *event) override;
signals:
//сигнал смены языка
void signal_LanguageChanged(QString language);
//сигнал вывода сообщения из трея
void signal_Tray_ShowMessage(QString textMsg, QSystemTrayIcon::MessageIcon iconMsg = QSystemTrayIcon::Information);
void signal_Menu_ShowWindow();
void signal_Menu_HideWindow();
void sigRecognize();
void sigCalculateFullHash();
void sigUpdateControllerInitialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
QTcpSocket* sigGetSocket();
void signal_DocsChanged();
void signal_hasError(int code);
public slots:
void slot_LanguageChanged(QString language);
void slot_UpdateListClients();
void slot_BlockAutorization(bool block);
void slot_AddMessageToLog(QString message);
void slot_ErrorPostgreSQL(QString text);
void slot_UpdateDocs();
void slot_startInitialization_step1();
void slot_setVersion(QString versionStr);
public:
QString getLanguage()
{
return language;
}
void setError(int code)
{
if(code == 100)
{
QString textError = tr("No Client files found!") + "\n\n" +
tr("* check Application for the presence of a folder with a build \n"
"* check SharedData for a folder with the base version and the name base");
SpecMsgBox::CriticalClose(this, textError);
}
errorCode = code;
emit signal_hasError(code);
}
int hasError() const
{
return errorCode;
}
ProcessingSystem* getProcessingSystem()
{
return processingSystem;
}
QMutex *getMutex() const
{
return mutex;
}
void removeClient(int socketId);
private slots:
void on_btnStartServer_clicked();
void on_btnStopServer_clicked();
void on_btnSettings_clicked();
void slot_trySetServerState(PacketType packetType);
private:
void setLanguageInterfase();
void updateMyStyleSheet();
QString loadStyleSheet();
void startInitialization_step0();
void tryConnectionToDB();
void updateStateServer();
private:
Ui::ServerLMSWidget *ui;
private:
WaitAnimationWidget *waitAnimationWidget;
MultiThreadServer *server;
QThread *updateThread;
QThread *loggerThread;
QMutex *mutex;
DataParser *dataParser;
ProcessingSystem *processingSystem;
UpdateController *updateController;
AssetsManager *assetsManager;
CommonClientHandler *commonClientHandler;
ChatSystem *chatSystem;
DocsUpdater* docsUpdater;
ProviderDBLMS* providerDBLMS;
bool first = true; // для тестов Unity
QTranslator qtLanguageTranslator;
QString language;
int errorCode;
QString versionStr;
bool flStartInitialization;
};
#endif // SERVERLMSWIDGET_H

View File

@@ -0,0 +1,443 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ServerLMSWidget</class>
<widget class="QWidget" name="ServerLMSWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1200</width>
<height>600</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>1200</width>
<height>600</height>
</size>
</property>
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Main">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Main">
<item>
<widget class="QWidget" name="widget_Control" native="true">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Control">
<item>
<widget class="QToolButton" name="btnStartServer">
<property name="minimumSize">
<size>
<width>130</width>
<height>58</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Start</string>
</property>
<property name="icon">
<iconset resource="ServerLMS.qrc">
<normaloff>:/resources/icons/rocket.png</normaloff>:/resources/icons/rocket.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnStopServer">
<property name="minimumSize">
<size>
<width>130</width>
<height>58</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Stop</string>
</property>
<property name="icon">
<iconset resource="ServerLMS.qrc">
<normaloff>:/resources/icons/stop.png</normaloff>:/resources/icons/stop.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="btnSettings">
<property name="minimumSize">
<size>
<width>130</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Settings</string>
</property>
<property name="icon">
<iconset resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/settings.png</normaloff>:/resources/icons/settings.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_Work">
<item>
<widget class="QGroupBox" name="groupBox_Clients">
<property name="title">
<string>Clients</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Clients">
<item>
<widget class="QListWidget" name="listWidget_Clients">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_Logger">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logger</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Logger">
<item>
<widget class="QPlainTextEdit" name="loggerTextField">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_FootNote">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_OnOff">
<item>
<widget class="QLabel" name="lblOnOff">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Server">
<property name="text">
<string>Server: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblOnOffText">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_DBsettings">
<item>
<widget class="QLabel" name="lblDBisConnected">
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_DataBase">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data base: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDBsettings">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_Version">
<item>
<widget class="QLabel" name="label_Version">
<property name="text">
<string>Version of materials: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblVersionText">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_Block">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Authorization</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblBlockAuth">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="ServerLMS.qrc">:/resources/icons/lock.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../InstructorsAndTrainees/InstructorsAndTrainees.qrc"/>
<include location="ServerLMS.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,117 @@
#include <QMessageBox>
#include <QProcess>
#include <QFile>
#include "dialogcheckdb.h"
#include "ui_dialogcheckdb.h"
DialogCheckDB::DialogCheckDB(ProviderDBLMS* providerDBLMS, QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogCheckDB),
providerDBLMS(providerDBLMS),
resDriver(false),
resUser(false),
resDB(false)
{
ui->setupUi(this);
ui->btnRepare->setObjectName("btnRepare");
ui->btnRepare->setEnabled(false);
check();
}
DialogCheckDB::~DialogCheckDB()
{
delete ui;
}
void DialogCheckDB::check()
{
resDriver = false;
resUser = false;
resDB = false;
resDriver = providerDBLMS->checkDriverQPSQLavailable();
if(resDriver)
{
ui->lblDriverRes->setText(tr("Installed"));
ui->lblDriverResIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else
{
ui->lblDriverRes->setText(tr("Not installed"));
ui->lblDriverResIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleRed.png")));
}
resUser = providerDBLMS->checkUserLMSexist();
if(resUser)
{
ui->lblUserRes->setText(tr("Exist"));
ui->lblUserResIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else
{
ui->lblUserRes->setText(tr("Not exist"));
ui->lblUserResIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleRed.png")));
}
resDB = providerDBLMS->checkDataBaseLMSexist();
if(resDB)
{
ui->lblDBRes->setText(tr("Exist"));
ui->lblDBResIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
}
else
{
ui->lblDBRes->setText(tr("Not exist"));
ui->lblDBResIco->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleRed.png")));
}
if(!resDriver || !resUser || !resDB)
{
ui->btnRepare->setEnabled(true);
}
else
ui->btnRepare->setEnabled(false);
}
void DialogCheckDB::on_btnRepare_clicked()
{
if(!resDriver)
{
QMessageBox::critical(this, tr("Error!"), tr("Install PostgreSQL."));
this->reject();
return;
}
if(!resUser)
{
if(!providerDBLMS->createUser())
{
check();
QMessageBox::critical(this, tr("Error!"), tr("Failed to create user!"));
this->reject();
return;
}
}
if(!resDB)
{
if(!providerDBLMS->createDB())
{
check();
QMessageBox::critical(this, tr("Error!"), tr("Failed to create Database!"));
this->reject();
return;
}
}
check();
if(resDriver && resUser && resDB)
{
QMessageBox::information(this, tr("Completed!"), tr("The database has been successfully restored!"));
this->accept();
}
}

View File

@@ -0,0 +1,36 @@
#ifndef DIALOGCHECKDB_H
#define DIALOGCHECKDB_H
#include <QDialog>
#include "providerdblms.h"
namespace Ui {
class DialogCheckDB;
}
class DialogCheckDB : public QDialog
{
Q_OBJECT
public:
explicit DialogCheckDB(ProviderDBLMS* providerDBLMS, QWidget *parent = nullptr);
~DialogCheckDB();
private slots:
void on_btnRepare_clicked();
private:
void check();
void prepareRestoreDBscript();
private:
Ui::DialogCheckDB *ui;
ProviderDBLMS* providerDBLMS;
bool resDriver;
bool resUser;
bool resDB;
};
#endif // DIALOGCHECKDB_H

View File

@@ -0,0 +1,286 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogCheckDB</class>
<widget class="QDialog" name="DialogCheckDB">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>250</height>
</rect>
</property>
<property name="windowTitle">
<string>Database</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Main">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Driver">
<item>
<widget class="QLabel" name="label_Driver">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Driver PostgreSQL</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDriverRes">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_1">
<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="QLabel" name="lblDriverResIco">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_User">
<item>
<widget class="QLabel" name="label_User">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>User</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblUserRes">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<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="QLabel" name="lblUserResIco">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_DB">
<item>
<widget class="QLabel" name="label_DB">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>170</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Database</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDBRes">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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="QLabel" name="lblDBResIco">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">:/resources/icons/circleGray.png</pixmap>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Result"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Ctrl">
<item>
<widget class="QToolButton" name="btnRepare">
<property name="minimumSize">
<size>
<width>58</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Repare</string>
</property>
<property name="icon">
<iconset resource="../InstructorsAndTrainees/InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/procedure.png</normaloff>:/resources/icons/procedure.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../InstructorsAndTrainees/InstructorsAndTrainees.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,360 @@
#include <QXmlStreamReader>
#include <QMessageBox>
#include "dialogsettingstray.h"
#include "Systems/tools.h"
#include "ui_dialogsettingstray.h"
#include "dialogcheckdb.h"
#include "dialogauthorization.h"
DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogSettingsTray),
settings(nullptr),
providerDBLMS(providerDBLMS),
flSettingsServerChanged(false)
{
ui->setupUi(this);
ui->btnSave->setObjectName("btnSave");
ui->btnCheckDB->setObjectName("btnCheckDB");
ui->btnUpdateDocs->setObjectName("btnUpdateDocs");
ui->checkLocalhost->setObjectName("checkLocalhost");
#ifndef PROJECT_TYPE_DEBUG
ui->checkLocalhost->setEnabled(false);
#endif
/* Создаем строку для регулярного выражения */
QString ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])";
/* Создаем регулярное выражение с применением строки, как
* повторяющегося элемента
*/
QRegExp ipRegex ("^" + ipRange
+ "\\." + ipRange
+ "\\." + ipRange
+ "\\." + ipRange + "$");
/* Создаем Валидатор регулярного выражения с применением
* созданного регулярного выражения
*/
QRegExpValidator *ipValidator = new QRegExpValidator(ipRegex, this);
/* Устанавливаем Валидатор на QLineEdit */
ui->editHostName->setValidator(ipValidator);
settings = new ServerDBSettings();
//Задаём два пункта с текстом локалей в комбобоксе
ui->cmbLanguage->addItems(QStringList() << "English" << "Русский");
//Скрываем пароль
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
if(loadSettings(settings))
{
if(settings->Language == "ENG")
ui->cmbLanguage->setCurrentText("English");
else
ui->cmbLanguage->setCurrentText("Русский");
ui->editNameDB->setText(settings->NameDB);
if(settings->HostName == "localhost")
{
ui->checkLocalhost->setChecked(true);
}
else
{
ui->checkLocalhost->setChecked(false);
}
ui->editHostName->setText(settings->HostName);
ui->editPort->setText(settings->Port);
ui->editUserName->setText(settings->UserName);
ui->editPassword->setText(settings->Password);
ui->btnSave->setEnabled(false);
ui->btnCheckDB->setEnabled(true);
flSettingsServerChanged = false;
}
else
{
ui->checkLocalhost->setChecked(true);
//ui->editHostName->setEnabled(true);
ui->editPort->setEnabled(true);
ui->editNameDB->setEnabled(true);
ui->editUserName->setEnabled(true);
ui->editPassword->setEnabled(true);
ui->btnSave->setEnabled(false);
ui->btnSave->setEnabled(false);
ui->btnCheckDB->setEnabled(false);
flSettingsServerChanged = false;
}
}
DialogSettingsTray::~DialogSettingsTray()
{
delete ui;
delete settings;
}
ServerDBSettings DialogSettingsTray::getSettings()
{
return *settings;
}
bool DialogSettingsTray::loadSettings(ServerDBSettings *settings)
{
QFile file(settingsName);
if(! file.open(QIODevice::ReadOnly))
return false;
QXmlStreamReader xmlReader(&file);
while (!xmlReader.atEnd()){
if(xmlReader.isStartElement()){
if(xmlReader.name() == "DataBaseSettings")
{
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes()){
QString name = attr.name().toString();
QString value = attr.value().toString();
if(name == "Type"){
settings->Type = value;
}
if(name == "Name"){
settings->NameDB = value;
}
if(name == "UserName"){
settings->UserName = value;
}
if(name == "Password"){
settings->Password = value;
}
if(name == "HostName"){
settings->HostName = value;
}
if(name == "Port"){
settings->Port = value;
}
if(name == "Language"){
settings->Language = value;
}
}
}
}
xmlReader.readNext();
}
file.close();
return true;
}
bool DialogSettingsTray::saveSettings()
{
QFile file(settingsName);
if(! file.open(QIODevice::WriteOnly))
return false;
QXmlStreamWriter xmlWriter(&file);
xmlWriter.setAutoFormatting(true);
xmlWriter.writeStartDocument();
xmlWriter.writeStartElement("ServerSettingsContainer");
xmlWriter.writeStartElement("DataBaseSettings");
xmlWriter.writeAttribute("Type", settings->Type);
xmlWriter.writeAttribute("Name", settings->NameDB);
xmlWriter.writeAttribute("UserName", settings->UserName);
xmlWriter.writeAttribute("Password", settings->Password);
xmlWriter.writeAttribute("HostName", settings->HostName);
xmlWriter.writeAttribute("Port", settings->Port);
xmlWriter.writeAttribute("Language", settings->Language);
xmlWriter.writeEndElement();
xmlWriter.writeEndElement();
xmlWriter.writeEndDocument();
file.close();
return true;
}
void DialogSettingsTray::on_btnSave_clicked()
{
if(ui->cmbLanguage->currentText() == QStringLiteral("English"))
{
settings->Language = "ENG";
}
else
{
settings->Language = "RUS";
}
settings->NameDB = ui->editNameDB->text();
settings->HostName = ui->editHostName->text();
settings->Port = ui->editPort->text();
settings->UserName = ui->editUserName->text();
settings->Password = ui->editPassword->text();
saveSettings();
ui->btnCheckDB->setEnabled(true);
this->accept();
}
void DialogSettingsTray::on_cmbLanguage_currentIndexChanged(int index)
{
ui->btnSave->setEnabled(true);
}
void DialogSettingsTray::on_DialogSettingsTray_accepted()
{
QString language;
if(settings->Language == "ENG")
language = QString("en_EN");
else
language = QString("ru_RU");
emit signal_LanguageChanged(language);
}
void DialogSettingsTray::on_editNameDB_textChanged(const QString &arg1)
{
ui->btnSave->setEnabled(true);
ui->btnCheckDB->setEnabled(false);
flSettingsServerChanged = true;
}
void DialogSettingsTray::on_editHostName_textChanged(const QString &arg1)
{
ui->btnSave->setEnabled(true);
ui->btnCheckDB->setEnabled(false);
flSettingsServerChanged = true;
}
void DialogSettingsTray::on_editPort_textChanged(const QString &arg1)
{
ui->btnSave->setEnabled(true);
ui->btnCheckDB->setEnabled(false);
flSettingsServerChanged = true;
}
void DialogSettingsTray::on_editUserName_textChanged(const QString &arg1)
{
ui->btnSave->setEnabled(true);
ui->btnCheckDB->setEnabled(false);
flSettingsServerChanged = true;
}
void DialogSettingsTray::on_editPassword_textChanged(const QString &arg1)
{
ui->btnSave->setEnabled(true);
ui->btnCheckDB->setEnabled(false);
flSettingsServerChanged = true;
}
void DialogSettingsTray::on_checkLocalhost_stateChanged(int arg1)
{
if(arg1)
{
ui->editHostName->setText("localhost");
ui->editHostName->setEnabled(false);
}
else
{
ui->editHostName->setText("0.0.0.0");
ui->editHostName->setEnabled(true);
}
}
void DialogSettingsTray::on_btnCheckDB_clicked()
{
//Проверяем, установлен ли PostgreSQL
if(!providerDBLMS->checkDriverQPSQLavailable())
{
QMessageBox::critical(this, tr("Error!"), tr("Driver PostgreSQL is not installed!"));
return;
}
//Запрос Логина и Пароля Суперюзера PostgreSQL (postgres)
QString UserNamePostgres;
QString PasswordPostgres;
DialogAuthorization dlg(this);
dlg.setWindowTitle(tr("Superuser PostgreSQL authorization"));
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setStyleSheet(this->styleSheet());
dlg.setLogin("postgres");
dlg.setPassword("");
switch( dlg.exec() )
{
case QDialog::Accepted:
{
UserNamePostgres = dlg.getLogin();
PasswordPostgres = dlg.getPassword();
break;
}
case QDialog::Rejected:
return;
default:
return;
}
if(providerDBLMS->setUserPasswordPostgres(UserNamePostgres, PasswordPostgres))
{
DialogCheckDB dlgCheckDB(providerDBLMS, this);
dlgCheckDB.setWindowFlags(dlgCheckDB.windowFlags() & ~Qt::WindowContextHelpButtonHint);
switch( dlgCheckDB.exec() )
{
case QDialog::Accepted:
ui->btnSave->setEnabled(true);
flSettingsServerChanged = true;
break;
case QDialog::Rejected:
break;
default:
break;
}
}
else
{
if(settings->HostName == "localhost")
QMessageBox::critical(this, tr("Error!"), tr("Error connecting to PostgreSQL!") + "\n\n" +
tr("Possible reasons:") + "\n" +
tr("*superuser PostgreSQL login or password is incorrect;") + "\n" +
tr("*Port is incorrect."));
else
QMessageBox::critical(this, tr("Error!"), tr("Error connecting to PostgreSQL!") + "\n\n" +
tr("Possible reasons:") + "\n" +
tr("*superuser PostgreSQL login or password is incorrect;") + "\n" +
tr("*Port is incorrect;") + "\n" +
tr("*file 'pg_hba.conf' does not contain an entry for the IP address:") + settings->HostName + ".");
return;
}
}
void DialogSettingsTray::on_btnUpdateDocs_clicked()
{
emit signal_UpdateDocs();
}

View File

@@ -0,0 +1,79 @@
#ifndef DIALOGSETTINGSTRAY_H
#define DIALOGSETTINGSTRAY_H
#include <QDialog>
#include <QTranslator>
#include <QEvent>
#include "providerdblms.h"
class ServerDBSettings{
public:
QString Type;
QString NameDB;
QString UserName;
QString Password;
QString HostName;
QString Port;
QString Language;
};
namespace Ui {
class DialogSettingsTray;
}
class DialogSettingsTray : public QDialog
{
Q_OBJECT
public:
explicit DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *parent = nullptr);
~DialogSettingsTray();
ServerDBSettings getSettings();
bool settingsDBisChanged(){ return flSettingsServerChanged;}
static bool loadSettings(ServerDBSettings *settings);
signals:
//сигнал об изменении языка интерфейса
void signal_LanguageChanged(QString language);
void signal_UpdateDocs();
private slots:
void on_btnSave_clicked();
void on_cmbLanguage_currentIndexChanged(int index);
void on_DialogSettingsTray_accepted();
void on_editNameDB_textChanged(const QString &arg1);
void on_editHostName_textChanged(const QString &arg1);
void on_editPort_textChanged(const QString &arg1);
void on_editUserName_textChanged(const QString &arg1);
void on_editPassword_textChanged(const QString &arg1);
void on_btnCheckDB_clicked();
void on_checkLocalhost_stateChanged(int arg1);
void on_btnUpdateDocs_clicked();
private:
bool saveSettings();
private:
Ui::DialogSettingsTray *ui;
ServerDBSettings *settings;
ProviderDBLMS* providerDBLMS;
bool flSettingsServerChanged;
};
#endif // DIALOGSETTINGSTRAY_H

View File

@@ -0,0 +1,365 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogSettingsTray</class>
<widget class="QDialog" name="DialogSettingsTray">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<height>400</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_Main">
<item>
<widget class="QGroupBox" name="groupBox_Main">
<property name="title">
<string>Main</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Main">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Language">
<item>
<widget class="QLabel" name="label_Language">
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<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="QComboBox" name="cmbLanguage"/>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="lineWidth">
<number>2</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_DB">
<property name="title">
<string>Database</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_DB">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Local">
<item>
<widget class="QLabel" name="label_Local">
<property name="text">
<string>Local</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<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="QCheckBox" name="checkLocalhost">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_HostName">
<item>
<widget class="QLabel" name="label_IP">
<property name="text">
<string>IP address</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editHostName">
<property name="maximumSize">
<size>
<width>170</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Port">
<item>
<widget class="QLabel" name="label_Port">
<property name="text">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editPort">
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_NameDB">
<item>
<widget class="QLabel" name="label_NameDB">
<property name="text">
<string>Database name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editNameDB">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>170</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_UserName">
<item>
<widget class="QLabel" name="label_UserName">
<property name="text">
<string>User name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editUserName">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>170</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Password">
<item>
<widget class="QLabel" name="label_Password">
<property name="text">
<string>User password</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="editPassword">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>170</width>
<height>16777215</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_Save">
<item>
<widget class="QToolButton" name="btnSave">
<property name="minimumSize">
<size>
<width>58</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Save</string>
</property>
<property name="icon">
<iconset resource="../../InstructorsAndTrainees/InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/circleGreen.png</normaloff>:/resources/icons/circleGreen.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_Additional">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Additional</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_Additional">
<item>
<widget class="QToolButton" name="btnCheckDB">
<property name="minimumSize">
<size>
<width>58</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Check DB</string>
</property>
<property name="icon">
<iconset resource="../ServerLMS.qrc">
<normaloff>:/resources/icons/checkDB.png</normaloff>:/resources/icons/checkDB.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="btnUpdateDocs">
<property name="minimumSize">
<size>
<width>80</width>
<height>58</height>
</size>
</property>
<property name="text">
<string>Update Docs</string>
</property>
<property name="icon">
<iconset resource="../../InstructorsAndTrainees/InstructorsAndTrainees.qrc">
<normaloff>:/resources/icons/exchange.png</normaloff>:/resources/icons/exchange.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../InstructorsAndTrainees/InstructorsAndTrainees.qrc"/>
<include location="../ServerLMS.qrc"/>
</resources>
<connections/>
</ui>

Binary file not shown.

View File

@@ -0,0 +1,367 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>AssetsManager</name>
<message>
<location filename="../Systems/assetsmanager.cpp" line="292"/>
<source>LLC Constanta-Design</source>
<translation>ООО Константа-Дизайн</translation>
</message>
</context>
<context>
<name>DialogCheckDB</name>
<message>
<location filename="../settings/dialogcheckdb.ui" line="14"/>
<location filename="../settings/dialogcheckdb.ui" line="178"/>
<source>Database</source>
<translation>База данных</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.ui" line="36"/>
<source>Driver PostgreSQL</source>
<translation>Драйвер PostgreSQL</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.ui" line="43"/>
<location filename="../settings/dialogcheckdb.ui" line="114"/>
<location filename="../settings/dialogcheckdb.ui" line="185"/>
<source>...</source>
<translation></translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.ui" line="107"/>
<source>User</source>
<translation>Пользователь</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.ui" line="259"/>
<source>Repare</source>
<translation>Восстановить</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="38"/>
<source>Installed</source>
<translation>Установлен</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="43"/>
<source>Not installed</source>
<translation>Не установлен</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="50"/>
<location filename="../settings/dialogcheckdb.cpp" line="62"/>
<source>Exist</source>
<translation>Существует</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="55"/>
<location filename="../settings/dialogcheckdb.cpp" line="67"/>
<source>Not exist</source>
<translation>Не существует</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="114"/>
<source>Completed!</source>
<translation>Завершено!</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="114"/>
<source>The database has been successfully restored!</source>
<translation>База данных успешно восстановлена!</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="83"/>
<source>Install PostgreSQL.</source>
<translation>Установите PostgreSQL.</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="83"/>
<location filename="../settings/dialogcheckdb.cpp" line="93"/>
<location filename="../settings/dialogcheckdb.cpp" line="104"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="93"/>
<source>Failed to create user!</source>
<translation>Ошибка создания пользователя!</translation>
</message>
<message>
<location filename="../settings/dialogcheckdb.cpp" line="104"/>
<source>Failed to create Database!</source>
<translation>Ошибка создания Базы данных!</translation>
</message>
</context>
<context>
<name>DialogSettingsTray</name>
<message>
<location filename="../settings/dialogsettingstray.ui" line="14"/>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="22"/>
<source>Main</source>
<translation>Основные</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="32"/>
<source>Language</source>
<translation>Язык</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="67"/>
<source>Database</source>
<translation>База данных</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="77"/>
<source>Local</source>
<translation>Локальная</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="108"/>
<source>IP address</source>
<translation>IP адрес</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="132"/>
<source>Port</source>
<translation>Порт</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="156"/>
<source>Database name</source>
<translation>Имя базы данных</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="183"/>
<source>User name</source>
<translation>Имя пользователя</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="210"/>
<source>User password</source>
<translation>Пароль пользователя</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="248"/>
<source>Save</source>
<translation>Сохранить</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="281"/>
<source>Additional</source>
<translation>Расширенные</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="295"/>
<source>Check DB</source>
<translation>Проверить БД</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.ui" line="334"/>
<source>Update Docs</source>
<translation>Обновить Docs</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="293"/>
<location filename="../settings/dialogsettingstray.cpp" line="343"/>
<location filename="../settings/dialogsettingstray.cpp" line="348"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="293"/>
<source>Driver PostgreSQL is not installed!</source>
<translation>Драйвер PostgreSQL не установлен!</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="302"/>
<source>Superuser PostgreSQL authorization</source>
<translation>Авторизация суперпользователя PostgreSQL</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="343"/>
<location filename="../settings/dialogsettingstray.cpp" line="348"/>
<source>Error connecting to PostgreSQL!</source>
<translation>Ошибка соединения с PostgreSQL!</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="344"/>
<location filename="../settings/dialogsettingstray.cpp" line="349"/>
<source>Possible reasons:</source>
<translation>Возможные причины:</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="345"/>
<location filename="../settings/dialogsettingstray.cpp" line="350"/>
<source>*superuser PostgreSQL login or password is incorrect;</source>
<translation>*логин или пароль суперпользователя PostgreSQL некорректен;</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="346"/>
<source>*Port is incorrect.</source>
<translation>*Порт некорректен.</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="351"/>
<source>*Port is incorrect;</source>
<translation>*Порт некорректен;</translation>
</message>
<message>
<location filename="../settings/dialogsettingstray.cpp" line="352"/>
<source>*file &apos;pg_hba.conf&apos; does not contain an entry for the IP address:</source>
<translation>*файл &apos;pg_hba.conf не содержит записи доступа для IP адреса:</translation>
</message>
</context>
<context>
<name>ServerLMSWidget</name>
<message>
<location filename="../serverlmswidget.ui" line="26"/>
<source>Form</source>
<translation>Форма</translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="210"/>
<source>Logger</source>
<translation>Логгер</translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="175"/>
<source>Clients</source>
<translation>Клиенты</translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="148"/>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="263"/>
<source>Server: </source>
<translation>Сервер: </translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="321"/>
<source>Data base: </source>
<translation>База данных: </translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="282"/>
<location filename="../serverlmswidget.ui" line="334"/>
<location filename="../serverlmswidget.ui" line="371"/>
<source>...</source>
<translation></translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="358"/>
<source>Version of materials: </source>
<translation>Версия материалов: </translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="395"/>
<source>Authorization</source>
<translation>Авторизация</translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="68"/>
<source>Start</source>
<translation>Запустить</translation>
</message>
<message>
<location filename="../serverlmswidget.ui" line="109"/>
<source>Stop</source>
<translation>Остановить</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="223"/>
<source>Server is started!</source>
<translation>Сервер запущен!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="236"/>
<source>Server is stoped!</source>
<translation>Сервер остановлен!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="275"/>
<location filename="../serverlmswidget.cpp" line="338"/>
<source>Warning!</source>
<translation>Внимание!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="275"/>
<source>Database settings have been changed.
The server will be restarted.</source>
<translation>Настройки Базы Данных были изменены.
Сервер будет перезапущен.</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="338"/>
<source>The file could not be opened </source>
<translation>Файл не может быть открыт </translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="412"/>
<location filename="../serverlmswidget.cpp" line="416"/>
<source>Database connection error!</source>
<translation>Ошибка подключения Базы данных!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="246"/>
<location filename="../serverlmswidget.cpp" line="416"/>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="139"/>
<source>Error PostgreSQL!</source>
<translation>Ошибка PostgreSQL!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="246"/>
<source>Settings file could not be opened:</source>
<translation>Файл настроек не открыт:</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="433"/>
<source>Database connection OK!</source>
<translation>База данных подключена!</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="447"/>
<source>started</source>
<translation>запущен</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="452"/>
<source>stoped</source>
<translation>остановлен</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="472"/>
<source>connected</source>
<translation>подключена</translation>
</message>
<message>
<location filename="../serverlmswidget.cpp" line="481"/>
<source>not connected</source>
<translation>не подключена</translation>
</message>
<message>
<location filename="../serverlmswidget.h" line="114"/>
<source>No Client files found!</source>
<translation>Файлы клиента не найдены!</translation>
</message>
<message>
<location filename="../serverlmswidget.h" line="115"/>
<source>* check Application for the presence of a folder with a build
* check SharedData for a folder with the base version and the name base</source>
<translation>* проверьте Application на наличие папки со сборкой
* проверьте SharedData на наличие папки с базовой версией и именем base</translation>
</message>
</context>
</TS>