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"
|
||||
|
||||
Instructor::Instructor():
|
||||
User(),
|
||||
isAdmin()
|
||||
User()//,
|
||||
//isAdmin()
|
||||
{
|
||||
TypeUserDB = User::TypeUserDBInstructor;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public:
|
||||
bool getIsAdmin(){return isAdmin;}
|
||||
|
||||
private:
|
||||
bool isAdmin;
|
||||
//bool isAdmin;
|
||||
};
|
||||
|
||||
#endif // INSTRUCTOR_H
|
||||
|
||||
@@ -9,7 +9,8 @@ User::User():
|
||||
password(),
|
||||
archived(),
|
||||
loggedIn(),
|
||||
TypeUserDB()
|
||||
TypeUserDB(),
|
||||
isAdmin(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ private:
|
||||
bool loggedIn;
|
||||
protected:
|
||||
QString TypeUserDB;
|
||||
|
||||
bool isAdmin;
|
||||
};
|
||||
|
||||
#endif // USER_H
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QAbstractScrollArea>
|
||||
#include <QMessageBox>
|
||||
#include <QLabel>
|
||||
#include "instructor.h"
|
||||
#include "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);
|
||||
|
||||
//Добавляем новую вкладку диалога
|
||||
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);
|
||||
|
||||
//Обновляем заголовок
|
||||
@@ -103,25 +96,30 @@ void MessangerWidget::updateHeader(User user)
|
||||
{
|
||||
//Обновляем статус залогинивания
|
||||
if(user.getLoggedIn())
|
||||
{
|
||||
//ui->tabWidget->setTabIcon(0, QIcon(":/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
|
||||
{
|
||||
//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() + ")";
|
||||
|
||||
ui->lblUser->setText(fullName);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,38 @@
|
||||
</property>
|
||||
<item>
|
||||
<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>
|
||||
<widget class="QLabel" name="lblLoggedIn">
|
||||
<property name="sizePolicy">
|
||||
@@ -57,13 +89,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblUser">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
Reference in New Issue
Block a user