From eaf5f0673a9f15369e342f36db43b5a7cdd927c3 Mon Sep 17 00:00:00 2001 From: krivoshein Date: Tue, 16 Sep 2025 12:50:58 +0300 Subject: [PATCH] bugFixing 2 --- .../connectorToServer/Core/notifycontroller.cpp | 2 +- InstructorsAndTrainees/dialogsettings.cpp | 4 ++++ .../instructors/editorinstructors.cpp | 2 +- InstructorsAndTrainees/instructors/instructorsview.cpp | 2 +- .../instructorsandtraineeswidget.cpp | 6 +++--- InstructorsAndTrainees/specialmessagebox.cpp | 10 +++++----- InstructorsAndTrainees/specialmessagebox.h | 4 ++-- InstructorsAndTrainees/tasks/ammtaskswidget.cpp | 4 ++-- InstructorsAndTrainees/tasks/dialogchecktask.cpp | 4 ++-- InstructorsAndTrainees/tasks/fimtaskswidget.cpp | 4 ++-- InstructorsAndTrainees/trainees/editortrainees.cpp | 4 ++-- InstructorsAndTrainees/trainees/traineesview.cpp | 6 +++--- 12 files changed, 28 insertions(+), 24 deletions(-) diff --git a/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp b/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp index d6a69a7..152e1cb 100644 --- a/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp +++ b/InstructorsAndTrainees/connectorToServer/Core/notifycontroller.cpp @@ -8,5 +8,5 @@ NotifyController::NotifyController(QObject *parent) : QObject(parent) void NotifyController::showWarning(QString text) { - SpecialMessageBox(nullptr, SpecialMessageBox::TypeSpecMsgBox::warningWithoutButtons, text).exec(); + SpecialMessageBox(nullptr, SpecialMessageBox::TypeSpecMsgBox::warningClose, text).exec(); } diff --git a/InstructorsAndTrainees/dialogsettings.cpp b/InstructorsAndTrainees/dialogsettings.cpp index cd87ae7..8a842bc 100644 --- a/InstructorsAndTrainees/dialogsettings.cpp +++ b/InstructorsAndTrainees/dialogsettings.cpp @@ -18,6 +18,10 @@ DialogSettings::DialogSettings(ConnectorToServer* connectorToServer, bool instru ui->btnSave->setObjectName("btnSave"); ui->checkAutoStart->setObjectName("checkAutoStart"); +#ifndef PROJECT_TYPE_DEBUG + ui->btnUpdateStyle->setVisible(false); +#endif + this->connectorToServer = connectorToServer; /* Создаем строку для регулярного выражения */ diff --git a/InstructorsAndTrainees/instructors/editorinstructors.cpp b/InstructorsAndTrainees/instructors/editorinstructors.cpp index 877782f..13b4da1 100644 --- a/InstructorsAndTrainees/instructors/editorinstructors.cpp +++ b/InstructorsAndTrainees/instructors/editorinstructors.cpp @@ -119,7 +119,7 @@ void EditorInstructors::on_btnDeleteInstructor_clicked() return; } - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) { waitAnimationWidget->showWithPlay(); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id); diff --git a/InstructorsAndTrainees/instructors/instructorsview.cpp b/InstructorsAndTrainees/instructors/instructorsview.cpp index b96e02e..8b41350 100644 --- a/InstructorsAndTrainees/instructors/instructorsview.cpp +++ b/InstructorsAndTrainees/instructors/instructorsview.cpp @@ -24,7 +24,7 @@ void InstructorsView::resizeEvent(QResizeEvent *event) if(typeView == TypeView::onlyView) {//onlyView - widthInstructor = width - (290 + 10); + widthInstructor = width - (220 + 10); } else {//control diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index cabfc07..c098e49 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -186,7 +186,7 @@ void InstructorsAndTraineesWidget::slot_checkLoginResult(ServerAuthorization *se else { ui->btnAuthorizationInstructor->setChecked(false); - SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor authorization") + "\n" + tr("Invalid login or password!")).exec(); + SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("Instructor authorization.") + "\n" + tr("Invalid login or password!")).exec(); } } @@ -251,7 +251,7 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, nameInstructorLoggedInLocal); updateLabelServer(); - SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::critical, tr("The server is not available!")).exec(); + SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("The server is not available!")).exec(); } } @@ -439,7 +439,7 @@ void InstructorsAndTraineesWidget::on_btnSettings_clicked() if(dlg.settingsServerIsChanged()) { - SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningWithoutButtons, tr("Server settings have been changed. Please reconnect to the server.")).exec(); + SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningClose, tr("Server settings have been changed. Please reconnect to the server.")).exec(); if(authorizationIsCompleted()) deAuthorizationInstructor(loginInstructorLoggedInLocal); diff --git a/InstructorsAndTrainees/specialmessagebox.cpp b/InstructorsAndTrainees/specialmessagebox.cpp index e716f1e..11ff87b 100644 --- a/InstructorsAndTrainees/specialmessagebox.cpp +++ b/InstructorsAndTrainees/specialmessagebox.cpp @@ -10,31 +10,31 @@ SpecialMessageBox::SpecialMessageBox(QWidget *parent, TypeSpecMsgBox type, const this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); - if(type == TypeSpecMsgBox::warning) + if(type == TypeSpecMsgBox::warningYesNo) { ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/warning.png"))); this->setWindowTitle(tr("Attention!")); } - else if(type == TypeSpecMsgBox::warningWithoutButtons) + else if(type == TypeSpecMsgBox::warningClose) { ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/warning.png"))); this->setWindowTitle(tr("Attention!")); - ui->btnYes->setVisible(false); ui->btnNo->setVisible(false); + ui->btnYes->setText(tr("Close")); } else if(type == TypeSpecMsgBox::critical) { ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/critical.png"))); this->setWindowTitle(tr("Error!")); - ui->btnYes->setVisible(false); ui->btnNo->setVisible(false); + ui->btnYes->setText(tr("Close")); } else if(type == TypeSpecMsgBox::info) { ui->lbl_icon->setPixmap(QPixmap(QStringLiteral(":/resources/icons/info.png"))); this->setWindowTitle(tr("Information")); - ui->btnYes->setVisible(false); ui->btnNo->setVisible(false); + ui->btnYes->setText(tr("Ok")); } ui->lblText->setText(text); diff --git a/InstructorsAndTrainees/specialmessagebox.h b/InstructorsAndTrainees/specialmessagebox.h index d73380d..4bbc082 100644 --- a/InstructorsAndTrainees/specialmessagebox.h +++ b/InstructorsAndTrainees/specialmessagebox.h @@ -13,8 +13,8 @@ class SpecialMessageBox : public QDialog public: enum TypeSpecMsgBox { - warning, - warningWithoutButtons, + warningYesNo, + warningClose, critical, info }; diff --git a/InstructorsAndTrainees/tasks/ammtaskswidget.cpp b/InstructorsAndTrainees/tasks/ammtaskswidget.cpp index 1705369..6a0b996 100644 --- a/InstructorsAndTrainees/tasks/ammtaskswidget.cpp +++ b/InstructorsAndTrainees/tasks/ammtaskswidget.cpp @@ -292,7 +292,7 @@ void AMMtasksWidget::on_btnDelete_clicked() int id = treeItemCurrent->text(ColumnsTreeAMM::clmnAMM_ID).toInt(); - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) { waitAnimationWidget->showWithPlay(); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TASK_AMM_TO_TRAINEE, id); @@ -335,7 +335,7 @@ void AMMtasksWidget::on_btnCheck_clicked() void AMMtasksWidget::on_btnAssignTask_clicked() { - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("Assign this task?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?")).exec() == QDialog::Accepted) assignTaskAMMtoTrainee(); } diff --git a/InstructorsAndTrainees/tasks/dialogchecktask.cpp b/InstructorsAndTrainees/tasks/dialogchecktask.cpp index e0a1ccd..f767ea6 100644 --- a/InstructorsAndTrainees/tasks/dialogchecktask.cpp +++ b/InstructorsAndTrainees/tasks/dialogchecktask.cpp @@ -139,7 +139,7 @@ void DialogCheckTask::on_btnWrong_clicked() msgString = tr("Change task status?\nThe status will be set:\n'new'"); } - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, msgString).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, msgString).exec() == QDialog::Accepted) { connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status); this->parentWidget()->close(); @@ -166,7 +166,7 @@ void DialogCheckTask::on_btnRight_clicked() msgString = tr("Change task status?\nThe status will be set:\n'completed'"); } - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, msgString).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, msgString).exec() == QDialog::Accepted) { connectorToServer->sendQueryToDB(typeQuery, id_task, (void*)&status); this->parentWidget()->close(); diff --git a/InstructorsAndTrainees/tasks/fimtaskswidget.cpp b/InstructorsAndTrainees/tasks/fimtaskswidget.cpp index 53c32b5..e24e209 100644 --- a/InstructorsAndTrainees/tasks/fimtaskswidget.cpp +++ b/InstructorsAndTrainees/tasks/fimtaskswidget.cpp @@ -339,7 +339,7 @@ void FIMtasksWidget::on_btnDelete_clicked() int id = treeItemCurrent->text(ColumnsTreeFIM::clmnFIM_ID).toInt(); - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) { waitAnimationWidget->showWithPlay(); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TASK_FIM_TO_TRAINEE, id); @@ -386,7 +386,7 @@ void FIMtasksWidget::on_btnCheck_clicked() void FIMtasksWidget::on_btnAssignTask_clicked() { - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("Assign this task?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("Assign this task?")).exec() == QDialog::Accepted) assignTaskFIMtoTrainee(); } diff --git a/InstructorsAndTrainees/trainees/editortrainees.cpp b/InstructorsAndTrainees/trainees/editortrainees.cpp index 1df87a2..610e83e 100644 --- a/InstructorsAndTrainees/trainees/editortrainees.cpp +++ b/InstructorsAndTrainees/trainees/editortrainees.cpp @@ -117,7 +117,7 @@ void EditorTrainees::on_btnDeleteGroup_clicked() } else {//Пустая группа - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) { waitAnimationWidget->showWithPlay(); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_GROUP, id_group); @@ -221,7 +221,7 @@ void EditorTrainees::on_btnDeleteTrainee_clicked() return; } - if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warning, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) + if(SpecialMessageBox(this, SpecialMessageBox::TypeSpecMsgBox::warningYesNo, tr("The deletion will be irrevocable.\nDelete it anyway?")).exec() == QDialog::Accepted) { waitAnimationWidget->showWithPlay(); connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE, id_trainee); diff --git a/InstructorsAndTrainees/trainees/traineesview.cpp b/InstructorsAndTrainees/trainees/traineesview.cpp index 4fef0f6..89f852f 100644 --- a/InstructorsAndTrainees/trainees/traineesview.cpp +++ b/InstructorsAndTrainees/trainees/traineesview.cpp @@ -25,14 +25,14 @@ void TraineesView::resizeEvent(QResizeEvent *event) if(typeView == TypeView::onlyView) {//onlyView - widthTrainee = width - (270 + 10); + widthTrainee = width - (220 + 10); } else {//control if(adminMode) - widthTrainee = width - (450 + 10); + widthTrainee = width - (470 + 10); else - widthTrainee = width - (320 + 10); + widthTrainee = width - (340 + 10); } if(widthTrainee < 250) widthTrainee = 250;