2021-09-07 15:44:01 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "base/unique_qptr.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
namespace Menu {
|
|
|
|
class ItemBase;
|
|
|
|
} // namespace Menu
|
|
|
|
|
|
|
|
class PopupMenu;
|
|
|
|
|
|
|
|
struct WhoReadParticipant {
|
|
|
|
QString name;
|
2021-12-24 13:51:53 +00:00
|
|
|
QString reaction;
|
2021-09-08 21:10:49 +00:00
|
|
|
QImage userpicSmall;
|
|
|
|
QImage userpicLarge;
|
2021-09-07 15:44:01 +00:00
|
|
|
std::pair<uint64, uint64> userpicKey = {};
|
|
|
|
uint64 id = 0;
|
2021-09-08 21:10:49 +00:00
|
|
|
|
|
|
|
static constexpr auto kMaxSmallUserpics = 3;
|
2021-09-07 15:44:01 +00:00
|
|
|
};
|
|
|
|
|
2021-09-07 18:31:13 +00:00
|
|
|
bool operator==(const WhoReadParticipant &a, const WhoReadParticipant &b);
|
|
|
|
bool operator!=(const WhoReadParticipant &a, const WhoReadParticipant &b);
|
|
|
|
|
|
|
|
enum class WhoReadType {
|
|
|
|
Seen,
|
|
|
|
Listened,
|
|
|
|
Watched,
|
2021-12-29 14:54:01 +00:00
|
|
|
Reacted,
|
2021-09-07 18:31:13 +00:00
|
|
|
};
|
|
|
|
|
2021-09-07 15:44:01 +00:00
|
|
|
struct WhoReadContent {
|
|
|
|
std::vector<WhoReadParticipant> participants;
|
2021-09-07 18:31:13 +00:00
|
|
|
WhoReadType type = WhoReadType::Seen;
|
2021-12-30 13:07:52 +00:00
|
|
|
QString singleReaction;
|
2021-12-29 14:54:01 +00:00
|
|
|
int fullReactionsCount = 0;
|
2022-01-18 16:55:24 +00:00
|
|
|
int fullReadCount = 0;
|
2021-09-07 15:44:01 +00:00
|
|
|
bool unknown = false;
|
|
|
|
};
|
|
|
|
|
2021-12-24 13:51:53 +00:00
|
|
|
[[nodiscard]] base::unique_qptr<Menu::ItemBase> WhoReactedContextAction(
|
2021-09-07 15:44:01 +00:00
|
|
|
not_null<PopupMenu*> menu,
|
|
|
|
rpl::producer<WhoReadContent> content,
|
2021-12-29 14:54:01 +00:00
|
|
|
Fn<void(uint64)> participantChosen,
|
|
|
|
Fn<void()> showAllChosen);
|
2021-09-07 15:44:01 +00:00
|
|
|
|
2022-01-14 15:42:24 +00:00
|
|
|
class WhoReactedListMenu final {
|
|
|
|
public:
|
|
|
|
WhoReactedListMenu(
|
|
|
|
Fn<void(uint64)> participantChosen,
|
|
|
|
Fn<void()> showAllChosen);
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
void populate(
|
|
|
|
not_null<PopupMenu*> menu,
|
|
|
|
const WhoReadContent &content,
|
|
|
|
Fn<void()> refillTopActions = nullptr);
|
|
|
|
|
|
|
|
private:
|
|
|
|
class EntryAction;
|
|
|
|
|
|
|
|
const Fn<void(uint64)> _participantChosen;
|
|
|
|
const Fn<void()> _showAllChosen;
|
|
|
|
|
|
|
|
std::vector<not_null<EntryAction*>> _actions;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2021-09-07 15:44:01 +00:00
|
|
|
} // namespace Ui
|