2017-04-06 02:06:42 +03:00
|
|
|
/*
|
|
|
|
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
#include <QDebug>
|
2017-04-09 03:54:39 +03:00
|
|
|
#include <QMouseEvent>
|
2017-05-19 03:28:15 +03:00
|
|
|
#include <QPainter>
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
#include <variant.hpp>
|
|
|
|
|
2017-07-15 17:11:46 +03:00
|
|
|
#include "Config.h"
|
2017-10-28 15:46:39 +03:00
|
|
|
#include "Menu.h"
|
2017-04-06 02:06:42 +03:00
|
|
|
#include "Ripple.h"
|
2017-10-28 15:46:39 +03:00
|
|
|
#include "RippleOverlay.h"
|
2017-04-06 02:06:42 +03:00
|
|
|
#include "RoomInfoListItem.h"
|
2017-10-28 15:46:39 +03:00
|
|
|
#include "RoomSettings.h"
|
2017-05-19 19:55:38 +03:00
|
|
|
#include "Theme.h"
|
2018-01-12 11:21:53 +03:00
|
|
|
#include "Utils.h"
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
constexpr int Padding = 7;
|
|
|
|
constexpr int IconSize = 48;
|
|
|
|
constexpr int MaxHeight = IconSize + 2 * Padding;
|
|
|
|
|
|
|
|
constexpr int InviteBtnX = IconSize + 2 * Padding;
|
|
|
|
constexpr int InviteBtnY = IconSize / 2 + Padding;
|
|
|
|
|
|
|
|
void
|
|
|
|
RoomInfoListItem::init(QWidget *parent)
|
2017-04-06 02:06:42 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
|
|
|
setMouseTracking(true);
|
|
|
|
setAttribute(Qt::WA_Hover);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
setFixedHeight(MaxHeight);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
QPainterPath path;
|
|
|
|
path.addRect(0, 0, parent->width(), height());
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
ripple_overlay_ = new RippleOverlay(this);
|
|
|
|
ripple_overlay_->setClipPath(path);
|
|
|
|
ripple_overlay_->setClipping(true);
|
2017-12-19 23:36:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
RoomInfoListItem::RoomInfoListItem(QString room_id,
|
|
|
|
mtx::responses::InvitedRoom room,
|
|
|
|
QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
, roomType_{RoomType::Invited}
|
|
|
|
, invitedRoom_{std::move(room)}
|
|
|
|
, roomId_{std::move(room_id)}
|
|
|
|
{
|
|
|
|
init(parent);
|
|
|
|
|
|
|
|
roomAvatar_ = QString::fromStdString(invitedRoom_.avatar());
|
|
|
|
roomName_ = QString::fromStdString(invitedRoom_.name());
|
|
|
|
}
|
|
|
|
|
|
|
|
RoomInfoListItem::RoomInfoListItem(QSharedPointer<RoomSettings> settings,
|
|
|
|
RoomState state,
|
|
|
|
QString room_id,
|
|
|
|
QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
, state_(state)
|
|
|
|
, roomId_(room_id)
|
|
|
|
, roomSettings_{settings}
|
|
|
|
, isPressed_(false)
|
|
|
|
, unreadMsgCount_(0)
|
|
|
|
{
|
|
|
|
init(parent);
|
2017-05-31 19:42:07 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
menu_ = new Menu(this);
|
2017-05-31 19:42:07 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
toggleNotifications_ = new QAction(notificationText(), this);
|
|
|
|
connect(toggleNotifications_, &QAction::triggered, this, [=]() {
|
|
|
|
roomSettings_->toggleNotifications();
|
|
|
|
});
|
2017-05-31 19:42:07 +03:00
|
|
|
|
2017-10-01 19:49:36 +03:00
|
|
|
leaveRoom_ = new QAction(tr("Leave room"), this);
|
|
|
|
connect(leaveRoom_, &QAction::triggered, this, [=]() { emit leaveRoom(room_id); });
|
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
menu_->addAction(toggleNotifications_);
|
2017-10-01 19:49:36 +03:00
|
|
|
menu_->addAction(leaveRoom_);
|
2017-05-31 19:42:07 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
QString
|
|
|
|
RoomInfoListItem::notificationText()
|
2017-05-31 19:42:07 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
if (roomSettings_.isNull() || roomSettings_->isNotificationsEnabled())
|
|
|
|
return QString(tr("Disable notifications"));
|
2017-05-31 19:42:07 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
return tr("Enable notifications");
|
2017-05-19 03:28:15 +03:00
|
|
|
}
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::resizeEvent(QResizeEvent *)
|
2017-08-05 15:59:24 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
// Update ripple's clipping path.
|
|
|
|
QPainterPath path;
|
|
|
|
path.addRect(0, 0, width(), height());
|
2017-08-05 15:59:24 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
ripple_overlay_->setClipPath(path);
|
|
|
|
ripple_overlay_->setClipping(true);
|
2017-08-05 15:59:24 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::paintEvent(QPaintEvent *event)
|
2017-05-19 03:28:15 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
Q_UNUSED(event);
|
|
|
|
|
|
|
|
QPainter p(this);
|
|
|
|
p.setRenderHint(QPainter::TextAntialiasing);
|
|
|
|
p.setRenderHint(QPainter::SmoothPixmapTransform);
|
|
|
|
p.setRenderHint(QPainter::Antialiasing);
|
|
|
|
|
|
|
|
QFont font;
|
|
|
|
font.setPixelSize(conf::fontSize);
|
|
|
|
QFontMetrics metrics(font);
|
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
QPen titlePen(titleColor_);
|
|
|
|
QPen subtitlePen(subtitleColor_);
|
|
|
|
|
2017-11-16 17:33:52 +03:00
|
|
|
if (isPressed_) {
|
|
|
|
p.fillRect(rect(), highlightedBackgroundColor_);
|
2017-12-19 23:36:12 +03:00
|
|
|
titlePen.setColor(highlightedTitleColor_);
|
|
|
|
subtitlePen.setColor(highlightedSubtitleColor_);
|
2017-11-16 17:33:52 +03:00
|
|
|
} else if (underMouse()) {
|
|
|
|
p.fillRect(rect(), hoverBackgroundColor_);
|
|
|
|
} else {
|
|
|
|
p.fillRect(rect(), backgroundColor_);
|
|
|
|
}
|
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
QRect avatarRegion(Padding, Padding, IconSize, IconSize);
|
|
|
|
|
|
|
|
// Description line with the default font.
|
2017-12-19 23:36:12 +03:00
|
|
|
int bottom_y = MaxHeight - Padding - Padding / 3 - metrics.ascent() / 2;
|
2017-09-10 12:59:21 +03:00
|
|
|
|
|
|
|
if (width() > ui::sidebar::SmallSize) {
|
|
|
|
font.setPixelSize(conf::roomlist::fonts::heading);
|
2017-12-21 15:36:05 +03:00
|
|
|
font.setWeight(60);
|
2017-09-10 12:59:21 +03:00
|
|
|
p.setFont(font);
|
2017-12-19 23:36:12 +03:00
|
|
|
p.setPen(titlePen);
|
2017-09-10 12:59:21 +03:00
|
|
|
|
|
|
|
// Name line.
|
|
|
|
QFontMetrics fontNameMetrics(font);
|
|
|
|
int top_y = 2 * Padding + fontNameMetrics.ascent() / 2;
|
|
|
|
|
|
|
|
auto name = metrics.elidedText(
|
2017-12-19 23:36:12 +03:00
|
|
|
roomName(), Qt::ElideRight, (width() - IconSize - 2 * Padding) * 0.8);
|
2017-09-10 12:59:21 +03:00
|
|
|
p.drawText(QPoint(2 * Padding + IconSize, top_y), name);
|
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
if (roomType_ == RoomType::Joined) {
|
|
|
|
font.setPixelSize(conf::fontSize);
|
|
|
|
p.setFont(font);
|
|
|
|
p.setPen(subtitlePen);
|
2017-05-07 17:15:38 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
auto msgStampWidth = QFontMetrics(font).width(lastMsgInfo_.timestamp) + 5;
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
// The limit is the space between the end of the avatar and the start of the
|
|
|
|
// timestamp.
|
|
|
|
int usernameLimit =
|
|
|
|
std::max(0, width() - 3 * Padding - msgStampWidth - IconSize - 20);
|
|
|
|
auto userName =
|
|
|
|
metrics.elidedText(lastMsgInfo_.username, Qt::ElideRight, usernameLimit);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-12-21 14:41:05 +03:00
|
|
|
font.setWeight(60);
|
2017-12-19 23:36:12 +03:00
|
|
|
p.setFont(font);
|
|
|
|
p.drawText(QPoint(2 * Padding + IconSize, bottom_y), userName);
|
|
|
|
|
|
|
|
int nameWidth = QFontMetrics(font).width(userName);
|
|
|
|
|
|
|
|
font.setBold(false);
|
|
|
|
p.setFont(font);
|
|
|
|
|
|
|
|
// The limit is the space between the end of the username and the start of
|
|
|
|
// the timestamp.
|
|
|
|
int descriptionLimit = std::max(
|
|
|
|
0, width() - 3 * Padding - msgStampWidth - IconSize - nameWidth - 5);
|
|
|
|
auto description =
|
|
|
|
metrics.elidedText(lastMsgInfo_.body, Qt::ElideRight, descriptionLimit);
|
|
|
|
p.drawText(QPoint(2 * Padding + IconSize + nameWidth, bottom_y),
|
|
|
|
description);
|
|
|
|
|
|
|
|
// We either show the bubble or the last message timestamp.
|
|
|
|
if (unreadMsgCount_ == 0) {
|
|
|
|
font.setBold(true);
|
|
|
|
p.drawText(QPoint(width() - Padding - msgStampWidth, bottom_y),
|
|
|
|
lastMsgInfo_.timestamp);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int btnWidth = (width() - IconSize - 6 * Padding) / 2;
|
2017-07-01 12:46:58 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
acceptBtnRegion_ = QRectF(InviteBtnX, InviteBtnY, btnWidth, 20);
|
|
|
|
declineBtnRegion_ =
|
|
|
|
QRectF(InviteBtnX + btnWidth + 2 * Padding, InviteBtnY, btnWidth, 20);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
QPainterPath acceptPath;
|
|
|
|
acceptPath.addRoundedRect(acceptBtnRegion_, 10, 10);
|
2017-04-15 02:56:04 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
p.setPen(Qt::NoPen);
|
|
|
|
p.fillPath(acceptPath, btnColor_);
|
|
|
|
p.drawPath(acceptPath);
|
2017-04-15 02:56:04 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
QPainterPath declinePath;
|
|
|
|
declinePath.addRoundedRect(declineBtnRegion_, 10, 10);
|
2017-04-15 02:56:04 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
p.setPen(Qt::NoPen);
|
|
|
|
p.fillPath(declinePath, btnColor_);
|
|
|
|
p.drawPath(declinePath);
|
|
|
|
|
|
|
|
p.setPen(QPen(btnTextColor_));
|
|
|
|
p.setFont(font);
|
|
|
|
p.drawText(acceptBtnRegion_, Qt::AlignCenter, tr("Accept"));
|
|
|
|
p.drawText(declineBtnRegion_, Qt::AlignCenter, tr("Decline"));
|
2017-09-10 12:59:21 +03:00
|
|
|
}
|
|
|
|
}
|
2017-07-01 12:46:58 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
font.setBold(false);
|
|
|
|
p.setPen(Qt::NoPen);
|
2017-07-15 17:11:46 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
// We using the first letter of room's name.
|
|
|
|
if (roomAvatar_.isNull()) {
|
|
|
|
QBrush brush;
|
|
|
|
brush.setStyle(Qt::SolidPattern);
|
|
|
|
brush.setColor("#eee");
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
p.setPen(Qt::NoPen);
|
|
|
|
p.setBrush(brush);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
p.drawEllipse(avatarRegion.center(), IconSize / 2, IconSize / 2);
|
2017-07-01 12:46:58 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
font.setPixelSize(conf::roomlist::fonts::bubble);
|
|
|
|
p.setFont(font);
|
|
|
|
p.setPen(QColor("#333"));
|
|
|
|
p.setBrush(Qt::NoBrush);
|
2018-01-12 11:21:53 +03:00
|
|
|
p.drawText(
|
|
|
|
avatarRegion.translated(0, -1), Qt::AlignCenter, utils::firstChar(roomName()));
|
2017-09-10 12:59:21 +03:00
|
|
|
} else {
|
|
|
|
p.save();
|
2017-08-06 18:53:31 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
QPainterPath path;
|
|
|
|
path.addEllipse(Padding, Padding, IconSize, IconSize);
|
|
|
|
p.setClipPath(path);
|
2017-08-06 18:53:31 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
p.drawPixmap(avatarRegion, roomAvatar_);
|
|
|
|
p.restore();
|
|
|
|
}
|
2017-08-06 18:53:31 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
if (unreadMsgCount_ > 0) {
|
|
|
|
QColor textColor("white");
|
|
|
|
QColor backgroundColor("#38A3D8");
|
2017-08-06 18:53:31 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
QBrush brush;
|
|
|
|
brush.setStyle(Qt::SolidPattern);
|
|
|
|
brush.setColor(backgroundColor);
|
|
|
|
|
|
|
|
if (isPressed_)
|
|
|
|
brush.setColor(textColor);
|
|
|
|
|
|
|
|
QFont unreadCountFont;
|
|
|
|
unreadCountFont.setPixelSize(conf::roomlist::fonts::badge);
|
|
|
|
unreadCountFont.setBold(true);
|
2017-08-06 18:53:31 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
p.setBrush(brush);
|
|
|
|
p.setPen(Qt::NoPen);
|
|
|
|
p.setFont(unreadCountFont);
|
2017-08-06 18:53:31 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
int diameter = 20;
|
|
|
|
|
|
|
|
QRectF r(
|
|
|
|
width() - diameter - Padding, bottom_y - diameter / 2 - 5, diameter, diameter);
|
|
|
|
|
|
|
|
if (width() == ui::sidebar::SmallSize)
|
|
|
|
r = QRectF(
|
|
|
|
width() - diameter - 5, height() - diameter - 5, diameter, diameter);
|
|
|
|
|
|
|
|
p.setPen(Qt::NoPen);
|
|
|
|
p.drawEllipse(r);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
p.setPen(QPen(textColor));
|
|
|
|
|
|
|
|
if (isPressed_)
|
|
|
|
p.setPen(QPen(backgroundColor));
|
|
|
|
|
|
|
|
p.setBrush(Qt::NoBrush);
|
|
|
|
p.drawText(
|
|
|
|
r.translated(0, -0.5), Qt::AlignCenter, QString::number(unreadMsgCount_));
|
|
|
|
}
|
2017-04-06 02:06:42 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::updateUnreadMessageCount(int count)
|
2017-04-15 02:56:04 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
unreadMsgCount_ += count;
|
|
|
|
update();
|
2017-04-15 02:56:04 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::clearUnreadMessageCount()
|
2017-04-15 02:56:04 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
unreadMsgCount_ = 0;
|
|
|
|
update();
|
2017-04-15 02:56:04 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::setPressedState(bool state)
|
2017-04-06 02:06:42 +03:00
|
|
|
{
|
2018-01-09 16:07:32 +03:00
|
|
|
if (isPressed_ != state) {
|
2017-09-10 12:59:21 +03:00
|
|
|
isPressed_ = state;
|
|
|
|
update();
|
|
|
|
}
|
2017-04-06 02:06:42 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::setState(const RoomState &new_state)
|
2017-05-07 17:15:38 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
state_ = new_state;
|
|
|
|
update();
|
2017-05-07 17:15:38 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::contextMenuEvent(QContextMenuEvent *event)
|
2017-05-31 19:42:07 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
Q_UNUSED(event);
|
2017-05-31 19:42:07 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
if (roomType_ == RoomType::Invited)
|
|
|
|
return;
|
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
toggleNotifications_->setText(notificationText());
|
|
|
|
menu_->popup(event->globalPos());
|
2017-05-31 19:42:07 +03:00
|
|
|
}
|
|
|
|
|
2017-08-20 13:47:22 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::mousePressEvent(QMouseEvent *event)
|
2017-04-06 02:06:42 +03:00
|
|
|
{
|
2017-09-10 12:59:21 +03:00
|
|
|
if (event->buttons() == Qt::RightButton) {
|
|
|
|
QWidget::mousePressEvent(event);
|
|
|
|
return;
|
|
|
|
}
|
2017-05-31 19:42:07 +03:00
|
|
|
|
2017-12-19 23:36:12 +03:00
|
|
|
if (roomType_ == RoomType::Invited) {
|
|
|
|
const auto point = event->pos();
|
|
|
|
|
|
|
|
if (acceptBtnRegion_.contains(point))
|
|
|
|
emit acceptInvite(roomId_);
|
|
|
|
|
|
|
|
if (declineBtnRegion_.contains(point))
|
|
|
|
emit declineInvite(roomId_);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
emit clicked(roomId_);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
setPressedState(true);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
// Ripple on mouse position by default.
|
|
|
|
QPoint pos = event->pos();
|
|
|
|
qreal radiusEndValue = static_cast<qreal>(width()) / 3;
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
Ripple *ripple = new Ripple(pos);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
ripple->setRadiusEndValue(radiusEndValue);
|
|
|
|
ripple->setOpacityStartValue(0.15);
|
|
|
|
ripple->setColor(QColor("white"));
|
|
|
|
ripple->radiusAnimation()->setDuration(200);
|
|
|
|
ripple->opacityAnimation()->setDuration(400);
|
2017-04-06 02:06:42 +03:00
|
|
|
|
2017-09-10 12:59:21 +03:00
|
|
|
ripple_overlay_->addRipple(ripple);
|
2017-04-06 02:06:42 +03:00
|
|
|
}
|
|
|
|
|
2017-10-22 19:03:55 +03:00
|
|
|
void
|
|
|
|
RoomInfoListItem::setAvatar(const QImage &img)
|
|
|
|
{
|
|
|
|
roomAvatar_ = QPixmap::fromImage(
|
|
|
|
img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RoomInfoListItem::setDescriptionMessage(const DescInfo &info)
|
|
|
|
{
|
|
|
|
lastMsgInfo_ = info;
|
|
|
|
update();
|
|
|
|
}
|
|
|
|
|
2017-10-01 12:11:33 +03:00
|
|
|
RoomInfoListItem::~RoomInfoListItem() {}
|