diff --git a/GUIdataBaseLMS/mainwindow.ui b/GUIdataBaseLMS/mainwindow.ui index 16aacea..31e0896 100644 --- a/GUIdataBaseLMS/mainwindow.ui +++ b/GUIdataBaseLMS/mainwindow.ui @@ -13,6 +13,10 @@ Learning management system (LMS) + + + :/resources/lms.png:/resources/lms.png + @@ -36,6 +40,8 @@ - + + + diff --git a/GUIdataBaseLMS/resources/lms.png b/GUIdataBaseLMS/resources/lms.png new file mode 100644 index 0000000..c3c244e Binary files /dev/null and b/GUIdataBaseLMS/resources/lms.png differ diff --git a/GUIdataBaseLMS/testDBpgSQL.qrc b/GUIdataBaseLMS/testDBpgSQL.qrc index 4d8ed66..9b4a837 100644 --- a/GUIdataBaseLMS/testDBpgSQL.qrc +++ b/GUIdataBaseLMS/testDBpgSQL.qrc @@ -1,3 +1,5 @@ - + + resources/lms.png + diff --git a/InstructorsAndTrainees/dialogsettings.cpp b/InstructorsAndTrainees/dialogsettings.cpp index 138e56a..3590858 100644 --- a/InstructorsAndTrainees/dialogsettings.cpp +++ b/InstructorsAndTrainees/dialogsettings.cpp @@ -5,15 +5,17 @@ #include #include -DialogSettings::DialogSettings(bool serverIsConnected, QWidget *parent) : +DialogSettings::DialogSettings(ConnectorToServer* connectorToServer, bool instructorIsLogged, QWidget *parent) : QDialog(parent), ui(new Ui::DialogSettings), - settings(nullptr) + settings(nullptr), + connectorToServer(nullptr) { ui->setupUi(this); ui->btnUpdateStyle->setObjectName("btnUpdateStyle"); ui->btnSave->setObjectName("btnSave"); + this->connectorToServer = connectorToServer; /* Создаем строку для регулярного выражения */ QString ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"; @@ -49,12 +51,17 @@ DialogSettings::DialogSettings(bool serverIsConnected, QWidget *parent) : ui->checkAutoStart->setChecked(settings->isAutoStart); } - if(serverIsConnected) - { - ui->editAddress->setEnabled(false); - ui->editPort->setEnabled(false); - ui->checkAutoStart->setEnabled(false); - } + ui->btnSetVersion->setEnabled(false); + if(connectorToServer) + if(connectorToServer->getIsConnected()) + { + ui->editAddress->setEnabled(false); + ui->editPort->setEnabled(false); + ui->checkAutoStart->setEnabled(false); + + if(instructorIsLogged) + ui->btnSetVersion->setEnabled(true); + } } DialogSettings::~DialogSettings() @@ -199,3 +206,10 @@ void DialogSettings::on_DialogSettings_rejected() emit signal_LanguageChanged(language); } + +void DialogSettings::on_btnSetVersion_clicked() +{ + if(connectorToServer) + if(connectorToServer->getIsConnected()) + connectorToServer->showVersionSelect(); +} diff --git a/InstructorsAndTrainees/dialogsettings.h b/InstructorsAndTrainees/dialogsettings.h index 874fd7e..0a80512 100644 --- a/InstructorsAndTrainees/dialogsettings.h +++ b/InstructorsAndTrainees/dialogsettings.h @@ -5,6 +5,7 @@ #include #include #include "Datas.h" +#include "connectortoserver.h" namespace Ui { class DialogSettings; @@ -15,7 +16,7 @@ class DialogSettings : public QDialog Q_OBJECT public: - explicit DialogSettings(bool serverIsConnected, QWidget *parent = nullptr); + explicit DialogSettings(ConnectorToServer* connectorToServer, bool instructorIsLogged, QWidget *parent = nullptr); ~DialogSettings(); protected: @@ -35,6 +36,8 @@ private slots: void on_DialogSettings_rejected(); + void on_btnSetVersion_clicked(); + private: bool loadSettings(); bool saveSettings(); @@ -44,6 +47,7 @@ private: QTranslator qtLanguageTranslator; ServerSettings *settings; + ConnectorToServer* connectorToServer; }; #endif // DIALOGSETTINGS_H diff --git a/InstructorsAndTrainees/dialogsettings.ui b/InstructorsAndTrainees/dialogsettings.ui index 8788199..c451f9f 100644 --- a/InstructorsAndTrainees/dialogsettings.ui +++ b/InstructorsAndTrainees/dialogsettings.ui @@ -225,6 +225,32 @@ + + + + + 58 + 58 + + + + Update version + + + + :/resources/icons/updateVersion.png:/resources/icons/updateVersion.png + + + + 32 + 32 + + + + Qt::ToolButtonTextUnderIcon + + + diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index b0c4309..91d5574 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -212,7 +212,7 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA viewerTrainees->setAuthComplited(true); Q_EMIT signal_NeedUpdateUI(true, true); - ui->btnSetVersion->show(); + //ui->btnSetVersion->show(); ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor")); updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName); @@ -275,7 +275,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) ui->btnAuthorizationInstructor->setEnabled(false); ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor")); ui->btnAuthorizationInstructor->setChecked(false); - ui->btnSetVersion->hide(); + //ui->btnSetVersion->hide(); ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png"))); ui->lblServer->setText(tr("none")); @@ -470,11 +470,7 @@ void InstructorsAndTraineesWidget::on_tabWidget_currentChanged(int index) void InstructorsAndTraineesWidget::on_btnSettings_clicked() { - bool serverIsConnected = false; - if(connectorToServer) - serverIsConnected = connectorToServer->getIsConnected(); - - DialogSettings dlg(serverIsConnected, this); + DialogSettings dlg(connectorToServer, (loginInstructorLoggedInLocal != ""), this); connect(&dlg, &DialogSettings::signal_LanguageChanged, this, &InstructorsAndTraineesWidget::slot_LanguageChanged); connect(&dlg, &DialogSettings::signal_UpdateStyleSheet, this, &InstructorsAndTraineesWidget::slot_UpdateStyleSheet); diff --git a/InstructorsAndTrainees/resources.qrc b/InstructorsAndTrainees/resources.qrc index af43fd8..9f49790 100644 --- a/InstructorsAndTrainees/resources.qrc +++ b/InstructorsAndTrainees/resources.qrc @@ -49,5 +49,6 @@ resources/icons/circleYellow.png resources/icons/settings.png resources/icons/style.png + resources/icons/updateVersion.png diff --git a/InstructorsAndTrainees/resources/icons/updateVersion.png b/InstructorsAndTrainees/resources/icons/updateVersion.png new file mode 100644 index 0000000..f6c46fb Binary files /dev/null and b/InstructorsAndTrainees/resources/icons/updateVersion.png differ