mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Из ГУИ чат с инструкторами
This commit is contained in:
@@ -9,9 +9,11 @@ ViewerInstructors::ViewerInstructors(ConnectorToServer* connectorToServer, QWidg
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
connect(treeWidget, &QTreeWidget::currentItemChanged, this, &ViewerInstructors::on_treeWidget_currentItemChanged);
|
||||||
|
|
||||||
ui->horizontalLayout_1->addWidget(treeWidget);
|
ui->horizontalLayout_1->addWidget(treeWidget);
|
||||||
|
|
||||||
treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
//treeWidget->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
|
|
||||||
preparationTreeWidget();
|
preparationTreeWidget();
|
||||||
setNotLoggedInVisible(true);
|
setNotLoggedInVisible(true);
|
||||||
@@ -69,6 +71,28 @@ void ViewerInstructors::on_btnEditorInstructors_clicked()
|
|||||||
Q_EMIT signal_BlockAutorization(false);
|
Q_EMIT signal_BlockAutorization(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewerInstructors::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||||
|
{
|
||||||
|
if(current == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//if(current->childCount() == 0)
|
||||||
|
{//Выбран обучаемый
|
||||||
|
QString login = current->text(ColumnsTreeInsructors::clmn_Login);
|
||||||
|
//if(login != "")
|
||||||
|
{
|
||||||
|
int newCurrentID = connectorToServer->getIdInstructorByLogin(login);
|
||||||
|
|
||||||
|
if(newCurrentID == lastCurrentID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lastCurrentID = newCurrentID;
|
||||||
|
|
||||||
|
Q_EMIT signal_instructorSelected(login);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ViewerInstructors::updateButtons()
|
void ViewerInstructors::updateButtons()
|
||||||
{
|
{
|
||||||
if(adminMode && authComplited)
|
if(adminMode && authComplited)
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ Q_SIGNALS:
|
|||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void on_btnEditorInstructors_clicked();
|
void on_btnEditorInstructors_clicked();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
//сигнал о выборе инструктора
|
||||||
|
void signal_instructorSelected(QString login);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateButtons() override;
|
void updateButtons() override;
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer);
|
connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer);
|
||||||
|
|
||||||
connect(viewerTrainees, &ViewerTrainees::signal_traineeSelected, this, &InstructorsAndTraineesWidget::slot_traineeSelected);
|
connect(viewerTrainees, &ViewerTrainees::signal_traineeSelected, this, &InstructorsAndTraineesWidget::slot_traineeSelected);
|
||||||
|
connect(viewerInstructors, &ViewerInstructors::signal_instructorSelected, this, &InstructorsAndTraineesWidget::slot_instructorSelected);
|
||||||
|
|
||||||
//Размещение
|
//Размещение
|
||||||
ui->verticalLayout_Trainees->addWidget(viewerTrainees);
|
ui->verticalLayout_Trainees->addWidget(viewerTrainees);
|
||||||
@@ -263,6 +264,18 @@ void InstructorsAndTraineesWidget::slot_traineeSelected(QString login)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InstructorsAndTraineesWidget::slot_instructorSelected(QString login)
|
||||||
|
{
|
||||||
|
/* Messanger*/
|
||||||
|
messangerController->deleteWidget(messangerWidget);
|
||||||
|
if(login != "")
|
||||||
|
{
|
||||||
|
Instructor instructor = connectorToServer->getInstructor(connectorToServer->getIdInstructorByLogin(login));
|
||||||
|
if(instructor.getID())
|
||||||
|
messangerWidget = messangerController->newWidget(this, &instructor, ui->verticalLayout_Messenger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
||||||
{
|
{
|
||||||
DialogAuthorizationInstructor dlg(parent);
|
DialogAuthorizationInstructor dlg(parent);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public Q_SLOTS:
|
|||||||
void slot_ConnectedToServer(bool state);
|
void slot_ConnectedToServer(bool state);
|
||||||
|
|
||||||
void slot_traineeSelected(QString login);
|
void slot_traineeSelected(QString login);
|
||||||
|
void slot_instructorSelected(QString login);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
//сигнал смены языка
|
//сигнал смены языка
|
||||||
|
|||||||
Reference in New Issue
Block a user