mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Translate pinned message as well.
This commit is contained in:
parent
719466fcac
commit
dc464b2718
3 changed files with 20 additions and 0 deletions
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "history/view/history_view_context_menu.h"
|
#include "history/view/history_view_context_menu.h"
|
||||||
#include "history/view/history_view_quick_action.h"
|
#include "history/view/history_view_quick_action.h"
|
||||||
#include "history/view/history_view_emoji_interactions.h"
|
#include "history/view/history_view_emoji_interactions.h"
|
||||||
|
#include "history/view/history_view_pinned_bar.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/history_item_text.h"
|
#include "history/history_item_text.h"
|
||||||
#include "ui/chat/chat_style.h"
|
#include "ui/chat/chat_style.h"
|
||||||
|
@ -967,6 +968,9 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
||||||
auto readTill = (HistoryItem*)nullptr;
|
auto readTill = (HistoryItem*)nullptr;
|
||||||
auto readContents = base::flat_set<not_null<HistoryItem*>>();
|
auto readContents = base::flat_set<not_null<HistoryItem*>>();
|
||||||
const auto guard = gsl::finally([&] {
|
const auto guard = gsl::finally([&] {
|
||||||
|
if (const auto item = _pinnedItem.current()) {
|
||||||
|
_translateTracker->add(item, translatedTo);
|
||||||
|
}
|
||||||
_translateTracker->finishBunch();
|
_translateTracker->finishBunch();
|
||||||
if (readTill && _widget->markingMessagesRead()) {
|
if (readTill && _widget->markingMessagesRead()) {
|
||||||
session().data().histories().readInboxTill(readTill);
|
session().data().histories().readInboxTill(readTill);
|
||||||
|
@ -3164,6 +3168,17 @@ void HistoryInner::updateSize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryInner::setShownPinnedId(
|
||||||
|
rpl::producer<HistoryView::PinnedId> id) {
|
||||||
|
_pinnedItem = std::move(
|
||||||
|
id
|
||||||
|
) | rpl::map([=](const HistoryView::PinnedId &id) {
|
||||||
|
return id.message
|
||||||
|
? session().data().message(id.message)
|
||||||
|
: nullptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryInner::enterEventHook(QEnterEvent *e) {
|
void HistoryInner::enterEventHook(QEnterEvent *e) {
|
||||||
mouseActionUpdate(QCursor::pos());
|
mouseActionUpdate(QCursor::pos());
|
||||||
return TWidget::enterEventHook(e);
|
return TWidget::enterEventHook(e);
|
||||||
|
|
|
@ -32,6 +32,7 @@ enum class PointState : char;
|
||||||
class EmptyPainter;
|
class EmptyPainter;
|
||||||
class Element;
|
class Element;
|
||||||
class TranslateTracker;
|
class TranslateTracker;
|
||||||
|
struct PinnedId;
|
||||||
} // namespace HistoryView
|
} // namespace HistoryView
|
||||||
|
|
||||||
namespace HistoryView::Reactions {
|
namespace HistoryView::Reactions {
|
||||||
|
@ -116,6 +117,7 @@ public:
|
||||||
void checkActivation();
|
void checkActivation();
|
||||||
void recountHistoryGeometry();
|
void recountHistoryGeometry();
|
||||||
void updateSize();
|
void updateSize();
|
||||||
|
void setShownPinnedId(rpl::producer<HistoryView::PinnedId> id);
|
||||||
|
|
||||||
void repaintItem(const HistoryItem *item);
|
void repaintItem(const HistoryItem *item);
|
||||||
void repaintItem(const Element *view);
|
void repaintItem(const Element *view);
|
||||||
|
@ -469,6 +471,7 @@ private:
|
||||||
|
|
||||||
std::unique_ptr<HistoryView::Reactions::Manager> _reactionsManager;
|
std::unique_ptr<HistoryView::Reactions::Manager> _reactionsManager;
|
||||||
rpl::variable<HistoryItem*> _reactionsItem;
|
rpl::variable<HistoryItem*> _reactionsItem;
|
||||||
|
rpl::variable<HistoryItem*> _pinnedItem;
|
||||||
|
|
||||||
MouseAction _mouseAction = MouseAction::None;
|
MouseAction _mouseAction = MouseAction::None;
|
||||||
TextSelectType _mouseSelectType = TextSelectType::Letters;
|
TextSelectType _mouseSelectType = TextSelectType::Letters;
|
||||||
|
|
|
@ -6287,6 +6287,8 @@ void HistoryWidget::setupPinnedTracker() {
|
||||||
Expects(_history != nullptr);
|
Expects(_history != nullptr);
|
||||||
|
|
||||||
_pinnedTracker = std::make_unique<HistoryView::PinnedTracker>(_history);
|
_pinnedTracker = std::make_unique<HistoryView::PinnedTracker>(_history);
|
||||||
|
_list->setShownPinnedId(_pinnedTracker->shownMessageId());
|
||||||
|
|
||||||
_pinnedBar = nullptr;
|
_pinnedBar = nullptr;
|
||||||
checkPinnedBarState();
|
checkPinnedBarState();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue