Рефакт Администрирование БД 1

This commit is contained in:
2025-11-05 16:17:26 +03:00
parent 84ea6ca512
commit 99d9c6d1e3
8 changed files with 86 additions and 24 deletions

View File

@@ -39,4 +39,5 @@ add_subdirectory(TrayServerLMS)
add_dependencies(InstructorsAndTrainees DataBaseLMS) add_dependencies(InstructorsAndTrainees DataBaseLMS)
add_dependencies(GUIdataBaseLMS InstructorsAndTrainees) add_dependencies(GUIdataBaseLMS InstructorsAndTrainees)
add_dependencies(ServerLMS DataBaseLMS) add_dependencies(ServerLMS DataBaseLMS)
add_dependencies(ServerLMS InstructorsAndTrainees)
add_dependencies(TrayServerLMS ServerLMS) add_dependencies(TrayServerLMS ServerLMS)

View File

@@ -155,12 +155,23 @@ if(PROJECT_TYPE_DEBUG)
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees/libInstructorsAndTrainees.dll ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees/libInstructorsAndTrainees.dll
${REPO_PATH}/BUILDS/Debug64/GUIdataBaseLMS) ${REPO_PATH}/BUILDS/Debug64/GUIdataBaseLMS)
add_custom_command(TARGET InstructorsAndTrainees
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees/libInstructorsAndTrainees.dll
${REPO_PATH}/BUILDS/Debug64/TrayServerLMS)
else() else()
add_custom_command(TARGET InstructorsAndTrainees add_custom_command(TARGET InstructorsAndTrainees
POST_BUILD POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Release64/InstructorsAndTrainees/libInstructorsAndTrainees.dll ${REPO_PATH}/BUILDS/Release64/InstructorsAndTrainees/libInstructorsAndTrainees.dll
${REPO_PATH}/BUILDS/Release64/GUIdataBaseLMS) ${REPO_PATH}/BUILDS/Release64/GUIdataBaseLMS)
add_custom_command(TARGET InstructorsAndTrainees
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Release64/InstructorsAndTrainees/libInstructorsAndTrainees.dll
${REPO_PATH}/BUILDS/Release64/TrayServerLMS)
endif() endif()
#Только для TSMP! #Только для TSMP!

View File

@@ -16,11 +16,6 @@ DialogAuthorizationInstructor::DialogAuthorizationInstructor(QWidget *parent) :
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password); ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this)); ui->editLogin->setValidator(new QRegExpValidator(QRegExp("[A-Za-z\\d]+"), this));
#ifdef PROJECT_TYPE_DEBUG
ui->editLogin->setText("admin");
ui->editPassword->setText("admin");
#endif
} }
DialogAuthorizationInstructor::~DialogAuthorizationInstructor() DialogAuthorizationInstructor::~DialogAuthorizationInstructor()
@@ -28,6 +23,26 @@ DialogAuthorizationInstructor::~DialogAuthorizationInstructor()
delete ui; delete ui;
} }
QString DialogAuthorizationInstructor::getLogin()
{
return ui->editLogin->text();
}
void DialogAuthorizationInstructor::setLogin(QString login)
{
ui->editLogin->setText(login);
}
QString DialogAuthorizationInstructor::getPassword()
{
return ui->editPassword->text();
}
void DialogAuthorizationInstructor::setPassword(QString password)
{
ui->editPassword->setText(password);
}
void DialogAuthorizationInstructor::on_btnLogIn_clicked() void DialogAuthorizationInstructor::on_btnLogIn_clicked()
{ {
this->accept(); this->accept();

View File

@@ -2,13 +2,14 @@
#define DIALOGAUTHORIZATIONINSTRUCTOR_H #define DIALOGAUTHORIZATIONINSTRUCTOR_H
#include <QDialog> #include <QDialog>
#include "ui_dialogauthorizationinstructor.h" #include "instructorsAndTrainees_global.h"
//#include "ui_dialogauthorizationinstructor.h"
namespace Ui { namespace Ui {
class DialogAuthorizationInstructor; class DialogAuthorizationInstructor;
} }
class DialogAuthorizationInstructor : public QDialog class INSTRUCTORSANDTRAINEES_EXPORT DialogAuthorizationInstructor : public QDialog
{ {
Q_OBJECT Q_OBJECT
@@ -17,15 +18,11 @@ public:
~DialogAuthorizationInstructor(); ~DialogAuthorizationInstructor();
public: public:
QString getLogin() QString getLogin();
{ void setLogin(QString login);
return ui->editLogin->text();
}
QString getPassword() QString getPassword();
{ void setPassword(QString password);
return ui->editPassword->text();
}
private slots: private slots:
void on_btnLogIn_clicked(); void on_btnLogIn_clicked();

View File

@@ -25,13 +25,13 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout_Main">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout_LP">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_Labels">
<item> <item>
<widget class="QLabel" name="label_1"> <widget class="QLabel" name="label_Login">
<property name="font"> <property name="font">
<font> <font>
<pointsize>10</pointsize> <pointsize>10</pointsize>
@@ -43,7 +43,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_Password">
<property name="font"> <property name="font">
<font> <font>
<pointsize>10</pointsize> <pointsize>10</pointsize>
@@ -57,7 +57,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_Edites">
<item> <item>
<widget class="QLineEdit" name="editLogin"> <widget class="QLineEdit" name="editLogin">
<property name="font"> <property name="font">
@@ -115,7 +115,7 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_Btn">
<item> <item>
<widget class="QPushButton" name="btnLogIn"> <widget class="QPushButton" name="btnLogIn">
<property name="sizePolicy"> <property name="sizePolicy">

View File

@@ -303,6 +303,10 @@ bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent
dlg.setWindowTitle(tr("Instructor authorization")); dlg.setWindowTitle(tr("Instructor authorization"));
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint); dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setStyleSheet(this->styleSheet()); dlg.setStyleSheet(this->styleSheet());
#ifdef PROJECT_TYPE_DEBUG
dlg.setLogin("admin");
dlg.setPassword("admin");
#endif
do do
{ {

View File

@@ -71,6 +71,15 @@ else()
endif() endif()
target_link_libraries(ServerLMS PRIVATE libDataBaseLMS.dll) target_link_libraries(ServerLMS PRIVATE libDataBaseLMS.dll)
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees)
target_include_directories(ServerLMS PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../InstructorsAndTrainees/instructors)
if(PROJECT_TYPE_DEBUG)
target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees)
else()
target_link_directories(ServerLMS PUBLIC ${REPO_PATH}/BUILDS/Release64/InstructorsAndTrainees)
endif()
target_link_libraries(ServerLMS PRIVATE libInstructorsAndTrainees.dll)
target_compile_definitions(ServerLMS PRIVATE SERVERLMS_LIBRARY) target_compile_definitions(ServerLMS PRIVATE SERVERLMS_LIBRARY)
if(PROJECT_TYPE_DEBUG) if(PROJECT_TYPE_DEBUG)

View File

@@ -4,6 +4,7 @@
#include "Systems/tools.h" #include "Systems/tools.h"
#include "ui_dialogsettingstray.h" #include "ui_dialogsettingstray.h"
#include "dialogcheckdb.h" #include "dialogcheckdb.h"
#include "dialogauthorizationinstructor.h"
DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *parent) : DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *parent) :
QDialog(parent), QDialog(parent),
@@ -252,9 +253,33 @@ void DialogSettingsTray::on_btnCheckDB_clicked()
QString UserNamePostgres; QString UserNamePostgres;
QString PasswordPostgres; QString PasswordPostgres;
DialogAuthorizationInstructor dlg(this);
dlg.setWindowTitle(tr("Superuser PostgreSQL authorization"));
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
dlg.setStyleSheet(this->styleSheet());
#ifdef PROJECT_TYPE_DEBUG
dlg.setLogin("postgres");
dlg.setPassword("");
#endif
switch( dlg.exec() )
{
case QDialog::Accepted:
{
UserNamePostgres = dlg.getLogin();
PasswordPostgres = dlg.getPassword();
break;
}
case QDialog::Rejected:
return;
default:
return;
}
//Имитация //Имитация
UserNamePostgres = "postgres"; //UserNamePostgres = "postgres";
PasswordPostgres = "12345678"; //PasswordPostgres = "12345678";
if(providerDBLMS->setUserPasswordPostgres(UserNamePostgres, PasswordPostgres)) if(providerDBLMS->setUserPasswordPostgres(UserNamePostgres, PasswordPostgres))
{ {