mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show forward original date in context menu.
This commit is contained in:
parent
e9a6bee046
commit
a2b8366477
11 changed files with 49 additions and 19 deletions
BIN
Telegram/Resources/icons/menu/forwarded_status.png
Normal file
BIN
Telegram/Resources/icons/menu/forwarded_status.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 691 B |
BIN
Telegram/Resources/icons/menu/forwarded_status@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/forwarded_status@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
Telegram/Resources/icons/menu/forwarded_status@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/forwarded_status@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -756,19 +756,32 @@ rpl::producer<Ui::WhoReadContent> WhoReacted(
|
||||||
const style::WhoRead &st) {
|
const style::WhoRead &st) {
|
||||||
return WhoReacted(item, reaction, context, st, nullptr);
|
return WhoReacted(item, reaction, context, st, nullptr);
|
||||||
}
|
}
|
||||||
rpl::producer<Ui::WhoReadContent> WhenEdited(
|
|
||||||
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenDate(
|
||||||
not_null<PeerData*> author,
|
not_null<PeerData*> author,
|
||||||
TimeId date) {
|
TimeId date,
|
||||||
|
Ui::WhoReadType type) {
|
||||||
return rpl::single(Ui::WhoReadContent{
|
return rpl::single(Ui::WhoReadContent{
|
||||||
.participants = { Ui::WhoReadParticipant{
|
.participants = { Ui::WhoReadParticipant{
|
||||||
.name = author->name(),
|
.name = author->name(),
|
||||||
.date = FormatReadDate(date, QDateTime::currentDateTime()),
|
.date = FormatReadDate(date, QDateTime::currentDateTime()),
|
||||||
.id = author->id.value,
|
.id = author->id.value,
|
||||||
} },
|
} },
|
||||||
.type = Ui::WhoReadType::Edited,
|
.type = type,
|
||||||
.fullReadCount = 1,
|
.fullReadCount = 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<Ui::WhoReadContent> WhenEdited(
|
||||||
|
not_null<PeerData*> author,
|
||||||
|
TimeId date) {
|
||||||
|
return WhenDate(author, date, Ui::WhoReadType::Edited);
|
||||||
|
}
|
||||||
|
|
||||||
|
rpl::producer<Ui::WhoReadContent> WhenOriginal(
|
||||||
|
not_null<PeerData*> author,
|
||||||
|
TimeId date) {
|
||||||
|
return WhenDate(author, date, Ui::WhoReadType::Original);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
|
|
@ -64,5 +64,8 @@ struct WhoReadList {
|
||||||
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenEdited(
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenEdited(
|
||||||
not_null<PeerData*> author,
|
not_null<PeerData*> author,
|
||||||
TimeId date);
|
TimeId date);
|
||||||
|
[[nodiscard]] rpl::producer<Ui::WhoReadContent> WhenOriginal(
|
||||||
|
not_null<PeerData*> author,
|
||||||
|
TimeId date);
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
|
|
@ -2918,7 +2918,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
leaderOrSelf,
|
leaderOrSelf,
|
||||||
_controller);
|
_controller);
|
||||||
} else if (leaderOrSelf) {
|
} else if (leaderOrSelf) {
|
||||||
HistoryView::MaybeAddWhenEditedAction(_menu, leaderOrSelf);
|
HistoryView::MaybeAddWhenEditedForwardedAction(_menu, leaderOrSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_menu->empty()) {
|
if (_menu->empty()) {
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
||||||
if (hasWhoReactedItem) {
|
if (hasWhoReactedItem) {
|
||||||
AddWhoReactedAction(result, list, item, list->controller());
|
AddWhoReactedAction(result, list, item, list->controller());
|
||||||
} else if (item) {
|
} else if (item) {
|
||||||
MaybeAddWhenEditedAction(result, item);
|
MaybeAddWhenEditedForwardedAction(result, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1457,20 +1457,28 @@ void AddSaveSoundForNotifications(
|
||||||
}, &st::menuIconSoundAdd);
|
}, &st::menuIconSoundAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddWhenEditedActionHelper(
|
void AddWhenEditedForwardedActionHelper(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
bool insertSeparator) {
|
bool insertSeparator) {
|
||||||
if (item->history()->peer->isUser()) {
|
if (const auto edited = item->Get<HistoryMessageEdited>()) {
|
||||||
if (const auto edited = item->Get<HistoryMessageEdited>()) {
|
if (!item->hideEditedBadge()) {
|
||||||
if (!item->hideEditedBadge()) {
|
if (insertSeparator && !menu->empty()) {
|
||||||
if (insertSeparator && !menu->empty()) {
|
menu->addSeparator(&st::expandedMenuSeparator);
|
||||||
menu->addSeparator(&st::expandedMenuSeparator);
|
|
||||||
}
|
|
||||||
menu->addAction(Ui::WhenReadContextAction(
|
|
||||||
menu.get(),
|
|
||||||
Api::WhenEdited(item->from(), edited->date)));
|
|
||||||
}
|
}
|
||||||
|
menu->addAction(Ui::WhenReadContextAction(
|
||||||
|
menu.get(),
|
||||||
|
Api::WhenEdited(item->from(), edited->date)));
|
||||||
|
}
|
||||||
|
} else if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
|
||||||
|
if (!forwarded->story && forwarded->psaType.isEmpty()) {
|
||||||
|
if (insertSeparator && !menu->empty()) {
|
||||||
|
menu->addSeparator(&st::expandedMenuSeparator);
|
||||||
|
}
|
||||||
|
menu->addAction(Ui::WhenReadContextAction(
|
||||||
|
menu.get(),
|
||||||
|
Api::WhenOriginal(item->from(), forwarded->originalDate)));
|
||||||
|
forwarded->originalDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1522,8 +1530,8 @@ void AddWhoReactedAction(
|
||||||
if (!menu->empty()) {
|
if (!menu->empty()) {
|
||||||
menu->addSeparator(&st::expandedMenuSeparator);
|
menu->addSeparator(&st::expandedMenuSeparator);
|
||||||
}
|
}
|
||||||
AddWhenEditedActionHelper(menu, item, false);
|
|
||||||
if (item->history()->peer->isUser()) {
|
if (item->history()->peer->isUser()) {
|
||||||
|
AddWhenEditedForwardedActionHelper(menu, item, false);
|
||||||
menu->addAction(Ui::WhenReadContextAction(
|
menu->addAction(Ui::WhenReadContextAction(
|
||||||
menu.get(),
|
menu.get(),
|
||||||
Api::WhoReacted(item, context, st::defaultWhoRead, whoReadIds),
|
Api::WhoReacted(item, context, st::defaultWhoRead, whoReadIds),
|
||||||
|
@ -1535,13 +1543,14 @@ void AddWhoReactedAction(
|
||||||
Data::ReactedMenuFactory(&controller->session()),
|
Data::ReactedMenuFactory(&controller->session()),
|
||||||
participantChosen,
|
participantChosen,
|
||||||
showAllChosen));
|
showAllChosen));
|
||||||
|
AddWhenEditedForwardedActionHelper(menu, item, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaybeAddWhenEditedAction(
|
void MaybeAddWhenEditedForwardedAction(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<HistoryItem*> item) {
|
not_null<HistoryItem*> item) {
|
||||||
AddWhenEditedActionHelper(menu, item, true);
|
AddWhenEditedForwardedActionHelper(menu, item, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddEditTagAction(
|
void AddEditTagAction(
|
||||||
|
|
|
@ -84,7 +84,7 @@ void AddWhoReactedAction(
|
||||||
not_null<QWidget*> context,
|
not_null<QWidget*> context,
|
||||||
not_null<HistoryItem*> item,
|
not_null<HistoryItem*> item,
|
||||||
not_null<Window::SessionController*> controller);
|
not_null<Window::SessionController*> controller);
|
||||||
void MaybeAddWhenEditedAction(
|
void MaybeAddWhenEditedForwardedAction(
|
||||||
not_null<Ui::PopupMenu*> menu,
|
not_null<Ui::PopupMenu*> menu,
|
||||||
not_null<HistoryItem*> item);
|
not_null<HistoryItem*> item);
|
||||||
void ShowWhoReactedMenu(
|
void ShowWhoReactedMenu(
|
||||||
|
|
|
@ -810,6 +810,8 @@ whoReadReactionsOver: icon{{ "menu/read_reactions", windowBoldFg }};
|
||||||
whoReadReactionsDisabled: icon{{ "menu/read_reactions", menuFgDisabled }};
|
whoReadReactionsDisabled: icon{{ "menu/read_reactions", menuFgDisabled }};
|
||||||
whenEdited: icon {{ "menu/edited_status", windowBoldFg }};
|
whenEdited: icon {{ "menu/edited_status", windowBoldFg }};
|
||||||
whenEditedOver: icon {{ "menu/edited_status", windowBoldFg }};
|
whenEditedOver: icon {{ "menu/edited_status", windowBoldFg }};
|
||||||
|
whenOriginal: icon {{ "menu/forwarded_status", windowBoldFg }};
|
||||||
|
whenOriginalOver: icon {{ "menu/forwarded_status", windowBoldFg }};
|
||||||
|
|
||||||
reactionsTabAll: icon {{ "menu/read_reactions", windowFg }};
|
reactionsTabAll: icon {{ "menu/read_reactions", windowFg }};
|
||||||
reactionsTabAllSelected: icon {{ "menu/read_reactions", activeButtonFg }};
|
reactionsTabAllSelected: icon {{ "menu/read_reactions", activeButtonFg }};
|
||||||
|
|
|
@ -602,6 +602,8 @@ void WhenAction::paint(Painter &p) {
|
||||||
p.fillRect(0, 0, width(), _height, _st.itemBg);
|
p.fillRect(0, 0, width(), _height, _st.itemBg);
|
||||||
const auto &icon = (_content.type == WhoReadType::Edited)
|
const auto &icon = (_content.type == WhoReadType::Edited)
|
||||||
? (selected ? st::whenEditedOver : st::whenEdited)
|
? (selected ? st::whenEditedOver : st::whenEdited)
|
||||||
|
: (_content.type == WhoReadType::Original)
|
||||||
|
? (selected ? st::whenOriginalOver : st::whenOriginal)
|
||||||
: loading
|
: loading
|
||||||
? st::whoReadChecksDisabled
|
? st::whoReadChecksDisabled
|
||||||
: selected
|
: selected
|
||||||
|
|
|
@ -37,6 +37,7 @@ enum class WhoReadType {
|
||||||
Watched,
|
Watched,
|
||||||
Reacted,
|
Reacted,
|
||||||
Edited,
|
Edited,
|
||||||
|
Original,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class WhoReadState : uchar {
|
enum class WhoReadState : uchar {
|
||||||
|
|
Loading…
Add table
Reference in a new issue