diff --git a/CMakeLists.txt b/CMakeLists.txt index c27a0aa..33b160b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/InstructorsAndTrainees/CMakeLists.txt b/InstructorsAndTrainees/CMakeLists.txt index 4621017..78d06a7 100644 --- a/InstructorsAndTrainees/CMakeLists.txt +++ b/InstructorsAndTrainees/CMakeLists.txt @@ -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! diff --git a/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.cpp b/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.cpp index 680b819..8aa33ee 100644 --- a/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.cpp +++ b/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.cpp @@ -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(); diff --git a/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.h b/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.h index 5d98e4e..271d926 100644 --- a/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.h +++ b/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.h @@ -2,13 +2,14 @@ #define DIALOGAUTHORIZATIONINSTRUCTOR_H #include -#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(); diff --git a/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.ui b/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.ui index 76264a9..44063b0 100644 --- a/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.ui +++ b/InstructorsAndTrainees/instructors/dialogauthorizationinstructor.ui @@ -25,13 +25,13 @@ - + - + - + - + 10 @@ -43,7 +43,7 @@ - + 10 @@ -57,7 +57,7 @@ - + @@ -115,7 +115,7 @@ - + diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index 192d76c..3eb210d 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -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 { diff --git a/ServerLMS/CMakeLists.txt b/ServerLMS/CMakeLists.txt index 9390473..64fe27a 100644 --- a/ServerLMS/CMakeLists.txt +++ b/ServerLMS/CMakeLists.txt @@ -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) diff --git a/ServerLMS/dialogsettingstray.cpp b/ServerLMS/dialogsettingstray.cpp index 4892ae9..c35242b 100644 --- a/ServerLMS/dialogsettingstray.cpp +++ b/ServerLMS/dialogsettingstray.cpp @@ -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)) {