Добавил параметры БД в Сервер

This commit is contained in:
2025-10-07 17:41:49 +03:00
parent b1baafe6a1
commit fc42dc0723
5 changed files with 96 additions and 57 deletions

View File

@@ -12,7 +12,7 @@
#include "tasksAmmFim.h" #include "tasksAmmFim.h"
#include "timingoftrainee.h" #include "timingoftrainee.h"
class DataBaseSettings class DATABASELMS_EXPORT DataBaseSettings
{ {
public: public:
QString dbName = ""; QString dbName = "";
@@ -24,7 +24,7 @@ public:
int dbPort = 0; int dbPort = 0;
}; };
class DataBaseLMS : public QObject class DATABASELMS_EXPORT DataBaseLMS : public QObject
{ {
Q_OBJECT Q_OBJECT
@@ -105,8 +105,9 @@ protected:
//int insertReportFIMforTask(TaskAmmFim task); //int insertReportFIMforTask(TaskAmmFim task);
int updateReportFIMforTask(TaskAmmFim task); int updateReportFIMforTask(TaskAmmFim task);
private: public:
DataBaseSettings getDataBaseSettings(); DataBaseSettings getDataBaseSettings();
private:
int queryExecInt(QString queryStr); int queryExecInt(QString queryStr);
QString queryExecString(QString queryStr); QString queryExecString(QString queryStr);
bool queryExecBool(QString queryStr); bool queryExecBool(QString queryStr);

View File

@@ -41,6 +41,11 @@ void ProviderDBLMS::DisConnectionFromDB()
mtxAccess.unlock(); mtxAccess.unlock();
} }
DataBaseSettings ProviderDBLMS::getDBSettings()
{
return dbLMS->getDataBaseSettings();
}
QString ProviderDBLMS::getMainInstructorName() QString ProviderDBLMS::getMainInstructorName()
{ {
mtxAccess.lock(); mtxAccess.lock();

View File

@@ -77,6 +77,7 @@ Q_SIGNALS:
public: public:
void ConnectionToDB(); void ConnectionToDB();
void DisConnectionFromDB(); void DisConnectionFromDB();
DataBaseSettings getDBSettings();
private: private:
InterfaceDataBaseLMS* dbLMS; InterfaceDataBaseLMS* dbLMS;

View File

@@ -41,6 +41,14 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
providerDBLMS->ConnectionToDB(); providerDBLMS->ConnectionToDB();
providerDBLMS->deAuthorizationAll(); providerDBLMS->deAuthorizationAll();
//Настройки БД
DataBaseSettings dbSettings = providerDBLMS->getDBSettings();
QString strDBsettings = QString("%1 (%2) %3 : %4").arg(dbSettings.dbName,
dbSettings.dbType,
dbSettings.dbHostName,
QString::number(dbSettings.dbPort));
ui->lblDBsettings->setText(strDBsettings);
chatSystem = new ChatSystem(); chatSystem = new ChatSystem();
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization); connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>574</width> <width>800</width>
<height>817</height> <height>800</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
@@ -22,40 +22,14 @@
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>Server LMS</string> <string>Server LMS</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QGridLayout" name="gridLayout_7">
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox">
<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">
<item>
<widget class="QPlainTextEdit" name="loggerTextField">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="groupBox_3"> <widget class="QGroupBox" name="groupBox_Clients">
<property name="title"> <property name="title">
<string>List of clients</string> <string>List of clients</string>
</property> </property>
@@ -83,13 +57,32 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout_State">
<item>
<widget class="QLabel" name="lblOnOff">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/resources/icons/switchOff.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<widget class="QToolButton" name="btnStartServer"> <widget class="QToolButton" name="btnStartServer">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>50</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@@ -117,7 +110,7 @@
<widget class="QToolButton" name="btnStopServer"> <widget class="QToolButton" name="btnStopServer">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>50</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@@ -141,25 +134,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="lblOnOff">
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="resources.qrc">:/resources/icons/switchOff.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
@@ -174,7 +148,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_Block">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
@@ -217,6 +191,56 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0">
<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">
<item>
<widget class="QPlainTextEdit" name="loggerTextField">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_DBsettings">
<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="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>