mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
PSQL 01.11.2024
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user