mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Иконка Юзера в шапке чата
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#include "instructor.h"
|
#include "instructor.h"
|
||||||
|
|
||||||
Instructor::Instructor():
|
Instructor::Instructor():
|
||||||
User(),
|
User()//,
|
||||||
isAdmin()
|
//isAdmin()
|
||||||
{
|
{
|
||||||
TypeUserDB = User::TypeUserDBInstructor;
|
TypeUserDB = User::TypeUserDBInstructor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public:
|
|||||||
bool getIsAdmin(){return isAdmin;}
|
bool getIsAdmin(){return isAdmin;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isAdmin;
|
//bool isAdmin;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INSTRUCTOR_H
|
#endif // INSTRUCTOR_H
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ User::User():
|
|||||||
password(),
|
password(),
|
||||||
archived(),
|
archived(),
|
||||||
loggedIn(),
|
loggedIn(),
|
||||||
TypeUserDB()
|
TypeUserDB(),
|
||||||
|
isAdmin(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ private:
|
|||||||
bool loggedIn;
|
bool loggedIn;
|
||||||
protected:
|
protected:
|
||||||
QString TypeUserDB;
|
QString TypeUserDB;
|
||||||
|
|
||||||
|
bool isAdmin;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // USER_H
|
#endif // USER_H
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <QAbstractScrollArea>
|
#include <QAbstractScrollArea>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include "instructor.h"
|
||||||
#include "messangerwidget.h"
|
#include "messangerwidget.h"
|
||||||
#include "ui_messangerwidget.h"
|
#include "ui_messangerwidget.h"
|
||||||
|
|
||||||
@@ -74,14 +75,6 @@ void MessangerWidget::addTabDialogMessenger(User user)
|
|||||||
|
|
||||||
oneDialogMessenger = new OneDialogMessenger(QString::number(user.getID()), user.getTypeUserDB(), this);
|
oneDialogMessenger = new OneDialogMessenger(QString::number(user.getID()), user.getTypeUserDB(), this);
|
||||||
|
|
||||||
//Добавляем новую вкладку диалога
|
|
||||||
QString typeUserStr = "";
|
|
||||||
if(user.getTypeUserDB() == User::TypeUserDBTrainee)
|
|
||||||
typeUserStr = tr("Trainee");
|
|
||||||
else if(user.getTypeUserDB() == User::TypeUserDBInstructor)
|
|
||||||
typeUserStr = tr("Instructor");
|
|
||||||
//int index = ui->tabWidget->addTab(oneDialogMessenger, typeUserStr + ": " + user.getName() + " (" + user.getLogin() + ")");
|
|
||||||
|
|
||||||
ui->verticalLayout_ListMsg->addWidget(oneDialogMessenger);
|
ui->verticalLayout_ListMsg->addWidget(oneDialogMessenger);
|
||||||
|
|
||||||
//Обновляем заголовок
|
//Обновляем заголовок
|
||||||
@@ -103,25 +96,30 @@ void MessangerWidget::updateHeader(User user)
|
|||||||
{
|
{
|
||||||
//Обновляем статус залогинивания
|
//Обновляем статус залогинивания
|
||||||
if(user.getLoggedIn())
|
if(user.getLoggedIn())
|
||||||
{
|
|
||||||
//ui->tabWidget->setTabIcon(0, QIcon(":/resources/icons/circleGreen.png"));
|
|
||||||
|
|
||||||
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGreen.png")));
|
||||||
|
else
|
||||||
|
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
||||||
|
|
||||||
|
|
||||||
|
QString typeUserStr = "";
|
||||||
|
|
||||||
|
if(user.getTypeUserDB() == User::TypeUserDBTrainee)
|
||||||
|
{
|
||||||
|
ui->lblAvatar->setPixmap(QPixmap(QStringLiteral(":/resources/icons/trainee.png")));
|
||||||
|
|
||||||
|
typeUserStr = tr("Trainee");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//ui->tabWidget->setTabIcon(0, QIcon(":/resources/icons/circleGray.png"));
|
if(static_cast<Instructor*>(&user)->getIsAdmin())
|
||||||
|
ui->lblAvatar->setPixmap(QPixmap(QStringLiteral(":/resources/icons/admin.png")));
|
||||||
|
else
|
||||||
|
ui->lblAvatar->setPixmap(QPixmap(QStringLiteral(":/resources/icons/instructor.png")));
|
||||||
|
|
||||||
ui->lblLoggedIn->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png")));
|
typeUserStr = tr("Instructor");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString typeUserStr = "";
|
|
||||||
if(user.getTypeUserDB() == User::TypeUserDBTrainee)
|
|
||||||
typeUserStr = tr("Trainee");
|
|
||||||
else if(user.getTypeUserDB() == User::TypeUserDBInstructor)
|
|
||||||
typeUserStr = tr("Instructor");
|
|
||||||
QString fullName = typeUserStr + ": " + user.getName() + " (" + user.getLogin() + ")";
|
QString fullName = typeUserStr + ": " + user.getName() + " (" + user.getLogin() + ")";
|
||||||
|
|
||||||
ui->lblUser->setText(fullName);
|
ui->lblUser->setText(fullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,38 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_User">
|
<layout class="QHBoxLayout" name="horizontalLayout_User">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lblAvatar">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<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>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="lblUser">
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lblLoggedIn">
|
<widget class="QLabel" name="lblLoggedIn">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -57,13 +89,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblUser">
|
|
||||||
<property name="text">
|
|
||||||
<string>TextLabel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user