PSQL 01.11.2024

This commit is contained in:
krivoshein
2024-11-01 11:45:13 +03:00
parent 024cd38bd6
commit 9422c5e257
274 changed files with 3223 additions and 3102 deletions

View File

@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.5)
project(DataBaseLMS LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt5 COMPONENTS Sql REQUIRED)
add_library(DataBaseLMS SHARED
DataBaseLMS_global.h
databaselms.cpp
databaselms.h
instructor.cpp
instructor.h
trainee.h
trainee.cpp
group.cpp
group.h
)
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
target_link_libraries(DataBaseLMS PRIVATE Qt5::Sql)
target_compile_definitions(DataBaseLMS PRIVATE DATABASELMS_LIBRARY)

View File

@@ -0,0 +1,347 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-11-01T11:44:20. -->
<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">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">D:/LMS/DB_LMS/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:/LMS/DB_LMS/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:/LMS/DB/build-DataBaseLMS-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:/LMS/DB/build-DataBaseLMS-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,12 @@
#ifndef DATABASELMS_GLOBAL_H
#define DATABASELMS_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(DATABASELMS_LIBRARY)
# define DATABASELMS_EXPORT Q_DECL_EXPORT
#else
# define DATABASELMS_EXPORT Q_DECL_IMPORT
#endif
#endif // DATABASELMS_GLOBAL_H

View File

@@ -0,0 +1,260 @@
#include "databaselms.h"
#include <QtSql>
#include <QSqlDatabase>
#include <QMessageBox>
DataBaseLMS::DataBaseLMS():
db(nullptr)
{
createConnection();
}
DataBaseLMS::~DataBaseLMS()
{
deleteConnection();
}
bool DataBaseLMS::createConnection()
{
db = new QSqlDatabase(QSqlDatabase::addDatabase(dbType));
db->setDatabaseName(dbName);
db->setUserName(dbUserName);
db->setPassword(dbPassword);
if(!db->open())
{
QMessageBox::critical(nullptr, dbName, "Connection error: " + db->lastError().text());
return false;
}
else
{
QMessageBox::information(nullptr, dbName, "Connection is successful!");
return true;
}
}
void DataBaseLMS::deleteConnection()
{
if(db != nullptr)
{
if(db->isOpen())
db->close();
delete db;
}
}
QList<Instructor> DataBaseLMS::selectAllInstructors()
{
QList<Instructor> listInstructors;
QString queryStr = QString("SELECT instructor_id, name, login, password, is_admin, archived "
"FROM public.instructors "
"ORDER BY instructor_id ASC");
QSqlQuery query(*db);
if(!query.exec(queryStr))
{
messageWarningErrorQuery(queryStr);
}
else
{
while (query.next())
{//Инструктор
Instructor instructor;
instructor.setID(query.value(0).toInt());
instructor.setName(query.value(1).toString());
instructor.setLogin(query.value(2).toString());
instructor.setPassword(query.value(3).toString());
instructor.setIsAdmin(query.value(4).toBool());
instructor.setArchived(query.value(5).toBool());
instructor.setLoggedIn(false);
listInstructors.append(instructor);
}
}
return listInstructors;
}
QList<Trainee> DataBaseLMS::selectAllTrainees()
{
QList<Trainee> listTrainees;
QString queryStr = QString("SELECT trainees.trainee_id, trainees.name, trainees.login, trainees.password, trainees.archived, "
"groups_of_trainees.name "
"FROM public.trainees JOIN public.groups_of_trainees ON groups_of_trainees.group_id = trainees.group_trainees "
"ORDER BY groups_of_trainees.name ASC");
QSqlQuery query(*db);
if(!query.exec(queryStr))
{
messageWarningErrorQuery(queryStr);
}
else
{
while (query.next())
{//Обучаемый
Trainee trainee;
trainee.setID(query.value(0).toInt());
trainee.setName(query.value(1).toString());
trainee.setLogin(query.value(2).toString());
trainee.setPassword(query.value(3).toString());
trainee.setArchived(query.value(4).toBool());
trainee.setGroup(query.value(5).toString());
trainee.setWhatItDoes(QStringLiteral(""));
trainee.setLoggedIn(false);
trainee.setLearnClass(QStringLiteral(""));
trainee.setComputer(QStringLiteral(""));
listTrainees.append(trainee);
}
}
return listTrainees;
}
QList<Group> DataBaseLMS::selectAllGroups()
{
QList<Group> listGroups;
QString queryStr = QString("SELECT group_id, name, color "
"FROM public.groups_of_trainees "
"ORDER BY group_id ASC");
QSqlQuery query(*db);
if(!query.exec(queryStr))
{
messageWarningErrorQuery(queryStr);
}
else
{
while (query.next())
{//Группа
Group group;
group.setID(query.value(0).toInt());
group.setName(query.value(1).toString());
group.setColor((Group::ColorGroup)query.value(2).toInt());
listGroups.append(group);
}
}
return listGroups;
}
bool DataBaseLMS::insertInstructor(Instructor instructor)
{
QString queryStr = QString("INSERT INTO public.instructors (name, login, password, is_admin, archived) "
"VALUES ('%1', '%2', '%3', %4, %5)").arg(
instructor.getName(),
instructor.getLogin(),
instructor.getPassword(),
instructor.getIsAdmin() ? "true" : "false",
instructor.getArchived() ? "true" : "false");
return queryExec(queryStr);
}
bool DataBaseLMS::deleteInstructor(int instructor_id)
{
QString queryStr = QString("DELETE FROM public.instructors WHERE instructor_id = %1").arg(QString::number(instructor_id));
return queryExec(queryStr);
}
bool DataBaseLMS::updateInstructor(Instructor instructor)
{
QString queryStr = QString("UPDATE public.instructors "
"SET name = '%1', login = '%2', password = '%3', is_admin = %4, archived = %5 "
"WHERE instructor_id = %6").arg(
instructor.getName(),
instructor.getLogin(),
instructor.getPassword(),
instructor.getIsAdmin() ? "true" : "false",
instructor.getArchived() ? "true" : "false",
QString::number(instructor.getID()) );
return queryExec(queryStr);
}
bool DataBaseLMS::insertGroup(Group group)
{
QString queryStr = QString("INSERT INTO public.groups_of_trainees (name, color) "
"VALUES ('%1', %2)").arg(
group.getName(),
QString::number((int)group.getColor()));
return queryExec(queryStr);
}
bool DataBaseLMS::deleteGroup(int group_id)
{
QString queryStr = QString("DELETE FROM public.groups_of_trainees WHERE group_id = %1").arg(QString::number(group_id));
return queryExec(queryStr);
}
bool DataBaseLMS::updateGroup(Group group)
{
QString queryStr = QString("UPDATE public.groups_of_trainees SET name = '%1', color = %2 WHERE group_id = %3").arg(
group.getName(),
QString::number((int)group.getColor()),
QString::number(group.getID()) );
return queryExec(queryStr);
}
bool DataBaseLMS::insertTrainee(Trainee trainee)
{
QString queryStr = QString("INSERT INTO public.trainees (name, login, password, archived, group_trainees) "
"VALUES ('%1', '%2', '%3', %4, "
"(SELECT group_id FROM public.groups_of_trainees WHERE name = '%5') "
")").arg(
trainee.getName(),
trainee.getLogin(),
trainee.getPassword(),
trainee.getArchived() ? "true" : "false",
trainee.getGroup());
return queryExec(queryStr);
}
bool DataBaseLMS::deleteTrainee(int trainee_id)
{
QString queryStr = QString("DELETE FROM public.trainees WHERE trainee_id = %1").arg(QString::number(trainee_id));
return queryExec(queryStr);
}
bool DataBaseLMS::updateTrainee(Trainee trainee)
{
QString queryStr = QString("UPDATE public.trainees "
"SET name = '%1', login = '%2', password = '%3', archived = %4, group_trainees = "
"(SELECT group_id FROM public.groups_of_trainees WHERE name = '%5') "
"WHERE trainee_id = %6").arg(
trainee.getName(),
trainee.getLogin(),
trainee.getPassword(),
trainee.getArchived() ? "true" : "false",
trainee.getGroup(),
QString::number(trainee.getID()) );
return queryExec(queryStr);
}
bool DataBaseLMS::queryExec(QString queryStr)
{
QSqlQuery query(*db);
if(!query.exec(queryStr))
{
messageWarningErrorQuery(queryStr);
return false;
}
else
return true;
}
void DataBaseLMS::messageWarningErrorQuery(QString queryStr)
{
QMessageBox::warning(nullptr, dbName, "Error query: " + queryStr + "\n" + db->lastError().text());
}

View File

@@ -0,0 +1,50 @@
#ifndef DATABASELMS_H
#define DATABASELMS_H
#include <QSqlDatabase>
#include "instructor.h"
#include "trainee.h"
#include "group.h"
#include "DataBaseLMS_global.h"
class DATABASELMS_EXPORT DataBaseLMS
{
public:
DataBaseLMS();
~DataBaseLMS();
public:
bool createConnection();
void deleteConnection();
QList<Instructor> selectAllInstructors();
QList<Trainee> selectAllTrainees();
QList<Group> selectAllGroups();
bool insertInstructor(Instructor instructor);
bool deleteInstructor(int instructor_id);
bool updateInstructor(Instructor instructor);
bool insertGroup(Group group);
bool deleteGroup(int group_id);
bool updateGroup(Group group);
bool insertTrainee(Trainee trainee);
bool deleteTrainee(int trainee_id);
bool updateTrainee(Trainee trainee);
private:
bool queryExec(QString queryStr);
void messageWarningErrorQuery(QString queryStr);
private:
QSqlDatabase* db;
const QString dbName = "DataBaseLMS";
const QString dbUserName = "postgres";
const QString dbPassword = "12345678";
const QString dbType = "QPSQL";
};
#endif // DATABASELMS_H

View File

@@ -0,0 +1,9 @@
#include "group.h"
Group::Group():
group_id(),
name(),
color()
{
}

View File

@@ -0,0 +1,45 @@
#ifndef GROUP_H
#define GROUP_H
#include <QString>
#include <QColor>
#include "DataBaseLMS_global.h"
class DATABASELMS_EXPORT Group
{
public:
enum ColorGroup
{
color0,
color1,
color2,
color3,
color4,
color5,
color6,
color7,
color8,
color9,
colorAther,
countColor
};
public:
Group();
void setID(int group_id){this->group_id = group_id;}
int getID(){return group_id;}
void setName(QString name){this->name = name;}
QString getName(){return name;}
void setColor(ColorGroup color){this->color = color;}
ColorGroup getColor(){return color;}
private:
int group_id;
QString name;
ColorGroup color;
};
#endif // GROUP_H

View File

@@ -0,0 +1,13 @@
#include "instructor.h"
Instructor::Instructor():
instructor_id(),
name(),
login(),
password(),
isAdmin(false),
archived(false),
loggedIn(false)
{
}

View File

@@ -0,0 +1,43 @@
#ifndef INSTRUCTOR_H
#define INSTRUCTOR_H
#include <QString>
#include "DataBaseLMS_global.h"
class DATABASELMS_EXPORT Instructor
{
public:
Instructor();
void setID(int instructor_id){this->instructor_id = instructor_id;}
int getID(){return instructor_id;}
void setName(QString name){this->name = name;}
QString getName(){return name;}
void setLogin(QString login){this->login = login;}
QString getLogin(){return login;}
void setPassword(QString password){this->password = password;}
QString getPassword(){return password;}
void setIsAdmin(bool isAdmin){this->isAdmin = isAdmin;}
bool getIsAdmin(){return isAdmin;}
void setArchived(bool archived){this->archived = archived;}
bool getArchived(){return archived;}
void setLoggedIn(bool loggedIn){this->loggedIn = loggedIn;}
bool getLoggedIn(){return loggedIn;}
private:
int instructor_id;
QString name;
QString login;
QString password;
bool isAdmin;
bool archived;
bool loggedIn;
};
#endif // INSTRUCTOR_H

View File

@@ -0,0 +1,16 @@
#include "trainee.h"
Trainee::Trainee():
trainee_id(),
name(),
login(),
password(),
learnClass(),
computer(),
group(),
archived(false),
whatItDoes(),
loggedIn(false)
{
}

View File

@@ -0,0 +1,57 @@
#ifndef TRAINEE_H
#define TRAINEE_H
#include <QString>
#include "DataBaseLMS_global.h"
class DATABASELMS_EXPORT Trainee
{
public:
Trainee();
void setID(int trainee_id){this->trainee_id = trainee_id;}
int getID(){return trainee_id;}
void setName(QString name){this->name = name;}
QString getName(){return name;}
void setLogin(QString login){this->login = login;}
QString getLogin(){return login;}
void setPassword(QString password){this->password = password;}
QString getPassword(){return password;}
void setLearnClass(QString learnClass){this->learnClass = learnClass;}
QString getLearnClass(){return learnClass;}
void setComputer(QString computer){this->computer = computer;}
QString getComputer(){return computer;}
void setGroup(QString group){this->group = group;}
QString getGroup(){return group;}
void setArchived(bool archived){this->archived = archived;}
bool getArchived(){return archived;}
void setLoggedIn(bool loggedIn){this->loggedIn = loggedIn;}
bool getLoggedIn(){return loggedIn;}
void setWhatItDoes(QString whatItDoes){this->whatItDoes = whatItDoes;}
QString getWhatItDoes(){return whatItDoes;}
private:
int trainee_id;
QString name;
QString login;
QString password;
QString learnClass;
QString computer;
QString group;
bool archived;
QString whatItDoes;
bool loggedIn;
};
#endif // TRAINEE_H