Рефакт Администрирование БД 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(GUIdataBaseLMS InstructorsAndTrainees)
add_dependencies(ServerLMS DataBaseLMS)
add_dependencies(ServerLMS InstructorsAndTrainees)
add_dependencies(TrayServerLMS ServerLMS)

View File

@@ -155,12 +155,23 @@ if(PROJECT_TYPE_DEBUG)
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${REPO_PATH}/BUILDS/Debug64/InstructorsAndTrainees/libInstructorsAndTrainees.dll
${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()
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/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()
#Только для TSMP!

View File

@@ -16,11 +16,6 @@ DialogAuthorizationInstructor::DialogAuthorizationInstructor(QWidget *parent) :
ui->editPassword->setEchoMode(QLineEdit::EchoMode::Password);
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()
@@ -28,6 +23,26 @@ DialogAuthorizationInstructor::~DialogAuthorizationInstructor()
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()
{
this->accept();

View File

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

View File

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

View File

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

View File

@@ -71,6 +71,15 @@ else()
endif()
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)
if(PROJECT_TYPE_DEBUG)

View File

@@ -4,6 +4,7 @@
#include "Systems/tools.h"
#include "ui_dialogsettingstray.h"
#include "dialogcheckdb.h"
#include "dialogauthorizationinstructor.h"
DialogSettingsTray::DialogSettingsTray(ProviderDBLMS* providerDBLMS, QWidget *parent) :
QDialog(parent),
@@ -252,9 +253,33 @@ void DialogSettingsTray::on_btnCheckDB_clicked()
QString UserNamePostgres;
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";
PasswordPostgres = "12345678";
//UserNamePostgres = "postgres";
//PasswordPostgres = "12345678";
if(providerDBLMS->setUserPasswordPostgres(UserNamePostgres, PasswordPostgres))
{