mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-29 20:05:38 +03:00
Сделал залогинивание, разлогинивание полностью рабочее
This commit is contained in:
@@ -70,6 +70,25 @@ void DataParser::createAuthMessage(ClientAutorization *auth)
|
||||
file.close();
|
||||
}
|
||||
|
||||
void DataParser::createDeAuthMessage(ClientDeAutorization *deAuth)
|
||||
{
|
||||
QFile file(tempName);
|
||||
file.open(QIODevice::WriteOnly);
|
||||
QXmlStreamWriter xmlWriter(&file);
|
||||
|
||||
xmlWriter.setAutoFormatting(true);
|
||||
xmlWriter.writeStartDocument();
|
||||
xmlWriter.writeStartElement("ClientDeAutorization");
|
||||
|
||||
xmlWriter.writeAttribute("Login",deAuth->Login);
|
||||
|
||||
xmlWriter.writeEndElement();
|
||||
xmlWriter.writeEndElement();
|
||||
xmlWriter.writeEndDocument();
|
||||
|
||||
file.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DataParser::createServerSettings(QString address, QString port)
|
||||
|
||||
@@ -21,6 +21,7 @@ public:
|
||||
void saveClientSettrings(QString language,bool isAutoStart);
|
||||
void createFileDataList(QList<FileData> fileDataList,QString filename);
|
||||
void createAuthMessage(ClientAutorization *auth);
|
||||
void createDeAuthMessage(ClientDeAutorization *deAuth);
|
||||
void createAuthData(ServerAuthorization *serverAuth);
|
||||
void createAuthDataOffline(QString username,QString pass);
|
||||
void addRunData(QList<int> displays);
|
||||
|
||||
@@ -319,11 +319,36 @@ void RecognizeSystem::xmlParser(QByteArray array)
|
||||
serverAuth->AccessType = value;
|
||||
checkAccessType(value);
|
||||
}
|
||||
|
||||
if (name == "Login"){
|
||||
serverAuth->Login = value;
|
||||
}
|
||||
}
|
||||
|
||||
emit sigSaveLoginData(serverAuth);
|
||||
}
|
||||
|
||||
if(xmlReader.name() == "ServerDeAuthorization"){
|
||||
|
||||
ServerDeAuthorization *serverDeAuth = new ServerDeAuthorization;
|
||||
|
||||
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
|
||||
{
|
||||
QString name = attr.name().toString();
|
||||
QString value = attr.value().toString();
|
||||
|
||||
if (name == "Result"){
|
||||
serverDeAuth->Result = value == "true" ? true : false;
|
||||
}
|
||||
|
||||
if (name == "Login"){
|
||||
serverDeAuth->Login = value;
|
||||
}
|
||||
}
|
||||
|
||||
emit sigDeAuth(serverDeAuth);
|
||||
}
|
||||
|
||||
xmlReader.readNext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ signals:
|
||||
void sigSocketDisabled();
|
||||
void sigServerBlocked();
|
||||
void sigSaveLoginData(ServerAuthorization *serverAuth);
|
||||
void sigDeAuth(ServerDeAuthorization *serverDeAuth);
|
||||
void sigSocketWaitForReadyRead(int waitTime);
|
||||
void sigStartCompare();
|
||||
|
||||
|
||||
@@ -17,6 +17,12 @@ public:
|
||||
QString ClientName;
|
||||
bool Result;
|
||||
QString AccessType;
|
||||
QString Login;
|
||||
};
|
||||
class ServerDeAuthorization{
|
||||
public:
|
||||
bool Result;
|
||||
QString Login;
|
||||
};
|
||||
|
||||
class ClientAutorization{
|
||||
@@ -25,6 +31,11 @@ public:
|
||||
QString Password;
|
||||
};
|
||||
|
||||
class ClientDeAutorization{
|
||||
public:
|
||||
QString Login;
|
||||
};
|
||||
|
||||
class ServerMessage
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -29,6 +29,22 @@ bool ConnectorToServer::authorizationInstructorLocal(QString login, QString pass
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConnectorToServer::deAuthorizationInstructorLocal(QString login)
|
||||
{
|
||||
if (!client->getIsConnected())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ClientDeAutorization *deAutorization = new ClientDeAutorization;
|
||||
deAutorization->Login = login;
|
||||
|
||||
dataParser->createDeAuthMessage(deAutorization);
|
||||
emit sigSendDeAutorization();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConnectorToServer::initialize()
|
||||
{
|
||||
createObjects();
|
||||
@@ -45,8 +61,10 @@ void ConnectorToServer::bindConnection()
|
||||
connect(this,&ConnectorToServer::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
||||
connect(this,&ConnectorToServer::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
||||
connect(this,&ConnectorToServer::sigSendAutorization,sendSystem,&SendSystem::sendClientAutorization);
|
||||
connect(this,&ConnectorToServer::sigSendDeAutorization,sendSystem,&SendSystem::sendClientAutorization);
|
||||
|
||||
connect(recognizeSystem,&RecognizeSystem::sigSaveLoginData,this,&ConnectorToServer::sigLoginResult);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigDeAuth,this,&ConnectorToServer::sigDeLoginResult);
|
||||
}
|
||||
|
||||
void ConnectorToServer::createObjects()
|
||||
|
||||
@@ -14,6 +14,7 @@ public:
|
||||
explicit ConnectorToServer(QObject *parent = nullptr);
|
||||
|
||||
bool authorizationInstructorLocal(QString login, QString password);
|
||||
bool deAuthorizationInstructorLocal(QString login);
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -23,7 +24,9 @@ signals:
|
||||
SendSystem *sendSystem,
|
||||
QThread *thread);
|
||||
void sigSendAutorization();
|
||||
void sigSendDeAutorization();
|
||||
void sigLoginResult(ServerAuthorization * serverAuth);
|
||||
void sigDeLoginResult(ServerDeAuthorization * serverDeAuth);
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
|
||||
BIN
DB_IaT/InstructorsAndTrainees/icons/sendMsg.png
Normal file
BIN
DB_IaT/InstructorsAndTrainees/icons/sendMsg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -11,6 +11,8 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
dbLMS(nullptr),
|
||||
viewerTrainees(nullptr),
|
||||
viewerInstructors(nullptr),
|
||||
messangerWidget(nullptr),
|
||||
docTasksWidget(nullptr),
|
||||
adminMode(false),
|
||||
loginInstructorLoggedInLocal(QStringLiteral(""))
|
||||
{
|
||||
@@ -18,35 +20,31 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
||||
|
||||
connectorToServer = new ConnectorToServer(this);
|
||||
connect(connectorToServer,&ConnectorToServer::sigLoginResult,this,&InstructorsAndTraineesWidget::checkLoginResult);
|
||||
connect(connectorToServer,&ConnectorToServer::sigDeLoginResult,this,&InstructorsAndTraineesWidget::checkDeLoginResult);
|
||||
|
||||
dbLMS = new InterfaceDataBaseLMS(this);
|
||||
|
||||
connect(this, &InstructorsAndTraineesWidget::signal_LanguageChanged, dbLMS, &InterfaceDataBaseLMS::slot_LanguageChanged);
|
||||
|
||||
viewerTrainees = new ViewerTrainees(dbLMS);
|
||||
viewerInstructors = new ViewerInstructors(dbLMS);
|
||||
|
||||
messangerWidget = new MessangerWidget(this);
|
||||
|
||||
connect(this, &InstructorsAndTraineesWidget::signal_NeedUpdateUI, viewerTrainees, &ViewerTrainees::slot_NeedUpdateUI);
|
||||
connect(this, &InstructorsAndTraineesWidget::signal_NeedUpdateUI, viewerInstructors, &ViewerInstructors::slot_NeedUpdateUI);
|
||||
|
||||
connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
|
||||
connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization);
|
||||
|
||||
connect(viewerTrainees, &ViewerTrainees::signal_traineeSelected, this, &InstructorsAndTraineesWidget::signal_traineeSelected);
|
||||
connect(this, &InstructorsAndTraineesWidget::signal_tabMessengerChanged, viewerTrainees, &ViewerTrainees::slot_tabMessengerChanged);
|
||||
|
||||
ui->verticalLayout->addWidget(viewerTrainees);
|
||||
ui->verticalLayout->addWidget(viewerInstructors);
|
||||
ui->verticalLayout->addWidget(messangerWidget);
|
||||
messangerWidget = new MessangerWidget(this);
|
||||
|
||||
docTasksWidget = new DocTasksWidget(this);
|
||||
|
||||
ui->verticalLayout_1->addWidget(viewerTrainees);
|
||||
ui->verticalLayout_1->addWidget(viewerInstructors);
|
||||
ui->verticalLayout_1->addWidget(messangerWidget);
|
||||
ui->verticalLayout_2->addWidget(docTasksWidget);
|
||||
|
||||
viewerTrainees->setMinimumSize(1600, 600);
|
||||
viewerInstructors->setMinimumSize(1600, 300);
|
||||
|
||||
//ui->btnAuthorizationInstructor->setEnabled(false);
|
||||
|
||||
//ui->btnConnectionToDB->click();
|
||||
}
|
||||
|
||||
InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget()
|
||||
@@ -62,6 +60,8 @@ InstructorsAndTraineesWidget::~InstructorsAndTraineesWidget()
|
||||
dbLMS->DisConnectionFromDB();
|
||||
}
|
||||
|
||||
delete docTasksWidget;
|
||||
delete messangerWidget;
|
||||
delete viewerInstructors;
|
||||
delete viewerTrainees;
|
||||
delete dbLMS;
|
||||
@@ -86,7 +86,7 @@ void InstructorsAndTraineesWidget::changeEvent(QEvent *event)
|
||||
else
|
||||
ui->btnConnectionToDB->setText(tr("Connection DB"));
|
||||
|
||||
updateLabelLoggedInInstructor();
|
||||
updateLabelLoggedInInstructor(loginInstructorLoggedInLocal, "???");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA
|
||||
{
|
||||
if (serverAuth->Result)
|
||||
{
|
||||
loginInstructorLoggedInLocal = serverAuth->ClientName;
|
||||
loginInstructorLoggedInLocal = serverAuth->Login;
|
||||
|
||||
if(loginInstructorLoggedInLocal == QStringLiteral("admin"))
|
||||
adminMode = true;
|
||||
@@ -114,11 +114,11 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA
|
||||
viewerInstructors->setAuthComplited(true);
|
||||
viewerTrainees->setAuthComplited(true);
|
||||
|
||||
//Q_EMIT signal_NeedUpdateUI(true, true);
|
||||
Q_EMIT signal_NeedUpdateUI(true, true);
|
||||
|
||||
ui->btnAuthorizationInstructor->setText(tr("Deauthorization Instructor"));
|
||||
|
||||
//updateLabelLoggedInInstructor();
|
||||
updateLabelLoggedInInstructor(serverAuth->Login, serverAuth->ClientName);
|
||||
|
||||
//Q_EMIT signal_NeedUpdateUI(true, true);
|
||||
|
||||
@@ -130,7 +130,33 @@ void InstructorsAndTraineesWidget::checkLoginResult(ServerAuthorization *serverA
|
||||
}
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationInstructorLocal(QWidget* parent)
|
||||
void InstructorsAndTraineesWidget::checkDeLoginResult(ServerDeAuthorization *serverDeAuth)
|
||||
{
|
||||
if (serverDeAuth->Result)
|
||||
{
|
||||
loginInstructorLoggedInLocal = QStringLiteral("");
|
||||
adminMode = false;
|
||||
|
||||
viewerInstructors->setAdminMode(adminMode);
|
||||
viewerTrainees->setAdminMode(adminMode);
|
||||
viewerInstructors->setAuthComplited(false);
|
||||
viewerTrainees->setAuthComplited(false);
|
||||
|
||||
Q_EMIT signal_NeedUpdateUI(true, false);
|
||||
|
||||
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
|
||||
|
||||
updateLabelLoggedInInstructor("","");
|
||||
|
||||
QMessageBox::information(this, tr("Instructor deauthorization"), tr("Successfully!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(this, tr("Instructor deauthorization"), tr("Error!"));
|
||||
}
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationInstructorDialog(QWidget* parent)
|
||||
{
|
||||
DialogAuthorizationInstructor dlg(parent);
|
||||
dlg.setWindowTitle(tr("Instructor authorization"));
|
||||
@@ -160,115 +186,25 @@ bool InstructorsAndTraineesWidget::authorizationInstructorLocal(QWidget* parent)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationIsCompleted()
|
||||
{
|
||||
if(loginInstructorLoggedInLocal == QStringLiteral(""))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_EMIT signal_BlockAutorization(true);
|
||||
|
||||
bool res = dbLMS->AuthorizationTrainee(login, password, classroom_name, computer_name);
|
||||
|
||||
Q_EMIT signal_BlockAutorization(false);
|
||||
|
||||
if(res)
|
||||
Q_EMIT signal_NeedUpdateUI(false, true);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::deAuthorizationTrainee(QString login)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_EMIT signal_BlockAutorization(true);
|
||||
|
||||
bool res = dbLMS->deAuthorizationTrainee(login);
|
||||
|
||||
Q_EMIT signal_BlockAutorization(false);
|
||||
|
||||
if(res)
|
||||
Q_EMIT signal_NeedUpdateUI(false, true);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
}
|
||||
|
||||
QString InstructorsAndTraineesWidget::getNameTraineeByLogin(QString login)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return QStringLiteral("");
|
||||
}
|
||||
|
||||
QString res = dbLMS->getNameTraineeByLogin(login);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::authorizationInstructor(QString login, QString password)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_EMIT signal_BlockAutorization(true);
|
||||
|
||||
bool res = dbLMS->AuthorizationInstructor(login, password);
|
||||
|
||||
Q_EMIT signal_BlockAutorization(false);
|
||||
|
||||
if(res)
|
||||
Q_EMIT signal_NeedUpdateUI(true, false);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool InstructorsAndTraineesWidget::deAuthorizationInstructor(QString login)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
/*
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
Q_EMIT signal_BlockAutorization(true);
|
||||
//Q_EMIT signal_BlockAutorization(true);
|
||||
|
||||
bool res = dbLMS->deAuthorizationInstructor(login);
|
||||
//bool res = dbLMS->deAuthorizationInstructor(login);
|
||||
connectorToServer->deAuthorizationInstructorLocal(login);
|
||||
|
||||
Q_EMIT signal_BlockAutorization(false);
|
||||
//Q_EMIT signal_BlockAutorization(false);
|
||||
|
||||
/*
|
||||
if(res)
|
||||
{
|
||||
if(loginInstructorLoggedInLocal == login)
|
||||
@@ -285,50 +221,21 @@ bool InstructorsAndTraineesWidget::deAuthorizationInstructor(QString login)
|
||||
}
|
||||
else
|
||||
Q_EMIT signal_NeedUpdateUI(true, false);
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
return /*res*/true;
|
||||
}
|
||||
|
||||
QString InstructorsAndTraineesWidget::getNameInstructorByLogin(QString login)
|
||||
bool InstructorsAndTraineesWidget::authorizationIsCompleted()
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return QStringLiteral("");
|
||||
}
|
||||
|
||||
QString res = dbLMS->getNameInstructorByLogin(login);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
if(loginInstructorLoggedInLocal == QStringLiteral(""))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
QString InstructorsAndTraineesWidget::getMainInstructorName()
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return QStringLiteral("");
|
||||
}
|
||||
|
||||
QString res = dbLMS->getNameInstructorByLogin(loginInstructorLoggedInLocal);
|
||||
|
||||
mtxAccess.unlock();
|
||||
return res;
|
||||
}
|
||||
/*
|
||||
QList<Trainee> InstructorsAndTraineesWidget::getListTrainees()
|
||||
{
|
||||
return dbLMS->getListTrainees();
|
||||
}
|
||||
*/
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnConnectionToDB_clicked()
|
||||
{
|
||||
bool stateIsChecked = ui->btnConnectionToDB->isChecked();
|
||||
@@ -384,7 +291,7 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
|
||||
|
||||
if(stateIsChecked)
|
||||
{//Авторизация Инструктора локальная (Администратора)
|
||||
if(authorizationInstructorLocal(this))
|
||||
if(authorizationInstructorDialog(this))
|
||||
{
|
||||
|
||||
}
|
||||
@@ -397,30 +304,30 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked()
|
||||
{
|
||||
if(deAuthorizationInstructor(loginInstructorLoggedInLocal))
|
||||
{
|
||||
ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
|
||||
//ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor"));
|
||||
|
||||
//updateLabelLoggedInInstructor();
|
||||
|
||||
Q_EMIT signal_NeedUpdateUI(true, true);
|
||||
//Q_EMIT signal_NeedUpdateUI(true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor()
|
||||
void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor(QString login, QString name)
|
||||
{
|
||||
mtxAccess.lock();
|
||||
|
||||
/*
|
||||
if(! dbLMS->DBisConnected())
|
||||
{
|
||||
mtxAccess.unlock();
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
if(authorizationIsCompleted())
|
||||
{
|
||||
QString nameLoggedInInstructor = QString("%1 (%2)").arg(
|
||||
dbLMS->getNameInstructorByLogin(loginInstructorLoggedInLocal), loginInstructorLoggedInLocal);
|
||||
QString nameLoggedInInstructor = QString("%1 (%2)").arg(name, login);
|
||||
ui->lblLoggedInInstructor->setText(nameLoggedInInstructor);
|
||||
if(loginInstructorLoggedInLocal == QStringLiteral("admin"))
|
||||
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/icons/admin.png")));
|
||||
@@ -436,18 +343,7 @@ void InstructorsAndTraineesWidget::updateLabelLoggedInInstructor()
|
||||
mtxAccess.unlock();
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_btnDocTasks_clicked()
|
||||
{
|
||||
DocTasksWidget docTasks(this);
|
||||
QDialog* dialog = new QDialog(this);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(&docTasks);
|
||||
dialog->setWindowTitle(tr("Doc tasks"));
|
||||
dialog->setMinimumSize(1200, 800);
|
||||
dialog->exec();
|
||||
}
|
||||
|
||||
void InstructorsAndTraineesWidget::on_toolButton_clicked()
|
||||
void InstructorsAndTraineesWidget::on_btnUpdateStyleSheet_clicked()
|
||||
{
|
||||
viewerTrainees->updateMyStyleSheet();
|
||||
viewerInstructors->updateMyStyleSheet();
|
||||
|
||||
@@ -29,7 +29,10 @@ private:
|
||||
public Q_SLOTS:
|
||||
//Слот обработки смены языка
|
||||
void slot_LanguageChanged(QString language);
|
||||
//Слот обработки результата авторизации
|
||||
void checkLoginResult(ServerAuthorization * serverAuth);
|
||||
//Слот обработки результата авторизации
|
||||
void checkDeLoginResult(ServerDeAuthorization * serverDeAuth);
|
||||
|
||||
Q_SIGNALS:
|
||||
//сигнал об изменении языка интерфейса
|
||||
@@ -50,33 +53,17 @@ Q_SIGNALS:
|
||||
//сигнал об инициализации мессенджера
|
||||
void signal_InitMessanger(QList<Trainee> listTrainees);
|
||||
|
||||
public:
|
||||
QString getMainInstructorName();
|
||||
//QList<Trainee> getListTrainees();
|
||||
|
||||
//Авторизация обучаемого на клиенте
|
||||
bool authorizationTrainee(QString login, QString password, QString classroom_name = QStringLiteral(""), QString computer_name = QStringLiteral(""));
|
||||
bool deAuthorizationTrainee(QString login);
|
||||
QString getNameTraineeByLogin(QString login);
|
||||
|
||||
//Авторизация инструктора на клиенте
|
||||
bool authorizationInstructor(QString login, QString password);
|
||||
bool deAuthorizationInstructor(QString login);
|
||||
QString getNameInstructorByLogin(QString login);
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_btnConnectionToDB_clicked();
|
||||
void on_btnAuthorizationInstructor_clicked();
|
||||
|
||||
void on_btnDocTasks_clicked();
|
||||
|
||||
void on_toolButton_clicked();
|
||||
void on_btnUpdateStyleSheet_clicked();
|
||||
|
||||
private:
|
||||
void updateLabelLoggedInInstructor();
|
||||
void updateLabelLoggedInInstructor(QString login, QString name);
|
||||
|
||||
//Авторизация инструктора локальная
|
||||
bool authorizationInstructorLocal(QWidget* parent = nullptr);
|
||||
bool authorizationInstructorDialog(QWidget* parent = nullptr);
|
||||
bool deAuthorizationInstructor(QString login);
|
||||
bool authorizationIsCompleted();
|
||||
|
||||
private:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_0">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="font">
|
||||
@@ -35,208 +35,182 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_1"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnConnectionToDB">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connection to DB</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/connectDB.png</normaloff>:/icons/connectDB.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDBisConnected">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAuthorizationInstructor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authorization Instructor</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/login-user.png</normaloff>:/icons/login-user.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLoggedIn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLoggedInPrefix">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Logged in Instructor: </string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLoggedInInstructor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>none</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnDocTasks">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Doc tasks</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/docTasks.png</normaloff>:/icons/docTasks.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update StyleSheet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QToolButton" name="btnConnectionToDB">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>130</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connection to DB</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/connectDB.png</normaloff>:/icons/connectDB.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDBisConnected">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnAuthorizationInstructor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Authorization Instructor</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/login-user.png</normaloff>:/icons/login-user.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLoggedIn">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/icons/circleGray.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLoggedInPrefix">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Logged in Instructor: </string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblLoggedInInstructor">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>none</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnUpdateStyleSheet">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update StyleSheet</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
@@ -65,6 +65,19 @@
|
||||
<property name="text">
|
||||
<string>Send</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<normaloff>:/icons/sendMsg.png</normaloff>:/icons/sendMsg.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -76,6 +89,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
<file>icons/connectDB.png</file>
|
||||
<file>icons/login-user.png</file>
|
||||
<file>icons/docTasks.png</file>
|
||||
<file>icons/sendMsg.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user