mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Version 3.4: Show mini-profiles from reactions overview.
This commit is contained in:
parent
0cf85be86b
commit
f86e2d98cc
1 changed files with 65 additions and 63 deletions
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "history/view/reactions/message_reactions_selector.h"
|
#include "history/view/reactions/message_reactions_selector.h"
|
||||||
#include "boxes/peer_list_box.h"
|
#include "boxes/peer_list_box.h"
|
||||||
|
#include "boxes/peers/prepare_short_info_box.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
|
@ -23,6 +24,26 @@ namespace {
|
||||||
constexpr auto kPerPageFirst = 20;
|
constexpr auto kPerPageFirst = 20;
|
||||||
constexpr auto kPerPage = 200;
|
constexpr auto kPerPage = 200;
|
||||||
|
|
||||||
|
class Row final : public PeerListRow {
|
||||||
|
public:
|
||||||
|
Row(not_null<PeerData*> peer, const QString &reaction);
|
||||||
|
|
||||||
|
QSize rightActionSize() const override;
|
||||||
|
QMargins rightActionMargins() const override;
|
||||||
|
bool rightActionDisabled() const override;
|
||||||
|
void rightActionPaint(
|
||||||
|
Painter &p,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int outerWidth,
|
||||||
|
bool selected,
|
||||||
|
bool actionSelected) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
EmojiPtr _emoji = nullptr;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class Controller final : public PeerListController {
|
class Controller final : public PeerListController {
|
||||||
public:
|
public:
|
||||||
Controller(
|
Controller(
|
||||||
|
@ -62,6 +83,46 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Row::Row(not_null<PeerData*> peer, const QString &reaction)
|
||||||
|
: PeerListRow(peer)
|
||||||
|
, _emoji(Ui::Emoji::Find(reaction)) {
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize Row::rightActionSize() const {
|
||||||
|
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
|
||||||
|
return _emoji ? QSize(size, size) : QSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
QMargins Row::rightActionMargins() const {
|
||||||
|
if (!_emoji) {
|
||||||
|
return QMargins();
|
||||||
|
}
|
||||||
|
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
|
||||||
|
return QMargins(
|
||||||
|
size / 2,
|
||||||
|
(st::defaultPeerList.item.height - size) / 2,
|
||||||
|
(size * 3) / 2,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Row::rightActionDisabled() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Row::rightActionPaint(
|
||||||
|
Painter &p,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int outerWidth,
|
||||||
|
bool selected,
|
||||||
|
bool actionSelected) {
|
||||||
|
if (!_emoji) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// #TODO reactions
|
||||||
|
Ui::Emoji::Draw(p, _emoji, Ui::Emoji::GetSizeNormal(), x, y);
|
||||||
|
}
|
||||||
|
|
||||||
Controller::Controller(
|
Controller::Controller(
|
||||||
not_null<Window::SessionController*> window,
|
not_null<Window::SessionController*> window,
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
|
@ -177,9 +238,10 @@ void Controller::loadMore(const QString &offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::rowClicked(not_null<PeerListRow*> row) {
|
void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||||
const auto peerId = row->peer()->id;
|
const auto window = _window;
|
||||||
crl::on_main(&session(), [=] {
|
const auto peer = row->peer();
|
||||||
_window->showPeerHistory(peerId);
|
crl::on_main(window, [=] {
|
||||||
|
window->show(PrepareShortInfoBox(peer, window));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,66 +253,6 @@ bool Controller::appendRow(not_null<UserData*> user, QString reaction) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Row final : public PeerListRow {
|
|
||||||
public:
|
|
||||||
Row(not_null<PeerData*> peer, const QString &reaction);
|
|
||||||
|
|
||||||
QSize rightActionSize() const override;
|
|
||||||
QMargins rightActionMargins() const override;
|
|
||||||
bool rightActionDisabled() const override;
|
|
||||||
void rightActionPaint(
|
|
||||||
Painter &p,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int outerWidth,
|
|
||||||
bool selected,
|
|
||||||
bool actionSelected) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
EmojiPtr _emoji = nullptr;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
Row::Row(not_null<PeerData*> peer, const QString &reaction)
|
|
||||||
: PeerListRow(peer)
|
|
||||||
, _emoji(Ui::Emoji::Find(reaction)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize Row::rightActionSize() const {
|
|
||||||
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
|
|
||||||
return _emoji ? QSize(size, size) : QSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
QMargins Row::rightActionMargins() const {
|
|
||||||
if (!_emoji) {
|
|
||||||
return QMargins();
|
|
||||||
}
|
|
||||||
const auto size = Ui::Emoji::GetSizeNormal() / style::DevicePixelRatio();
|
|
||||||
return QMargins(
|
|
||||||
size / 2,
|
|
||||||
(st::defaultPeerList.item.height - size) / 2,
|
|
||||||
(size * 3) / 2,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Row::rightActionDisabled() const {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Row::rightActionPaint(
|
|
||||||
Painter &p,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
int outerWidth,
|
|
||||||
bool selected,
|
|
||||||
bool actionSelected) {
|
|
||||||
if (!_emoji) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// #TODO reactions
|
|
||||||
Ui::Emoji::Draw(p, _emoji, Ui::Emoji::GetSizeNormal(), x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> Controller::createRow(
|
std::unique_ptr<PeerListRow> Controller::createRow(
|
||||||
not_null<UserData*> user,
|
not_null<UserData*> user,
|
||||||
QString reaction) const {
|
QString reaction) const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue