PSQL 01.11.2024

This commit is contained in:
krivoshein
2024-11-01 11:45:13 +03:00
parent 024cd38bd6
commit 9422c5e257
274 changed files with 3223 additions and 3102 deletions

View File

@@ -0,0 +1,78 @@
#include <QMessageBox>
#include "editorinstructors.h"
#include "viewerinstructors.h"
#include "ui_viewerinstructors.h"
ViewerInstructors::ViewerInstructors(DataBaseInstructors* db, bool adminMode, QWidget *parent) :
//QWidget(parent),
InstructorsView(db, CommonView::TypeView::onlyView, parent),
ui(new Ui::ViewerInstructors)
{
ui->setupUi(this);
this->adminMode = adminMode;
// Сделаем первоначальную инициализацию перевода для окна виджета
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + QString(QStringLiteral("ru_RU")), QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
preparationTreeWidget(ui->treeWidget);
setNotLoggedInVisible(true);
loadInstructorsFromDB();
if(! this->adminMode)
ui->btnEditorInstructors->setEnabled(false);
}
ViewerInstructors::~ViewerInstructors()
{
delete ui;
}
void ViewerInstructors::setFilterInstructorLoggedIn(bool enabled)
{
setNotLoggedInVisible(!enabled);
loadInstructorsFromDB();
}
void ViewerInstructors::changeEvent(QEvent *event)
{
// В случае получения события изменения языка приложения
if (event->type() == QEvent::LanguageChange)
{
ui->retranslateUi(this); // переведём окно заново
reSetHeadTreeWidget();
loadInstructorsFromDB();
}
}
void ViewerInstructors::slot_LanguageChanged(QString language)
{
qtLanguageTranslator.load(QString(QStringLiteral("translations/InstructorsAndTrainees_")) + language, QStringLiteral("."));
qApp->installTranslator(&qtLanguageTranslator);
}
void ViewerInstructors::on_btnEditorInstructors_clicked()
{
if(! adminMode)
{
QMessageBox::warning(this, tr("Attention!"),
tr("Only the Administrator has the right to edit instructors."));
return;
}
EditorInstructors editorInstructors(dbInstructors, adminMode);
//dlg.setWindowTitle(tr("List instructors"));
//dlg.exec();
//dlg.show();
QDialog* dialog = new QDialog(this);
QHBoxLayout *layout = new QHBoxLayout(dialog);
layout->addWidget(&editorInstructors);
dialog->setWindowTitle(tr("List instructors"));
dialog->setMinimumSize(1400, 800);
dialog->exec();
dbInstructors->LoadInstructorsPSQL();
loadInstructorsFromDB();
}