mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Correct spoiler selections.
This commit is contained in:
parent
cd00d41cca
commit
4f948699c0
17 changed files with 63 additions and 12 deletions
|
@ -688,6 +688,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
|||
active,
|
||||
selected,
|
||||
ms,
|
||||
videoPaused,
|
||||
showUnreadInSearchResults);
|
||||
p.translate(0, st::dialogsRowHeight);
|
||||
}
|
||||
|
|
|
@ -259,7 +259,9 @@ void PaintListEntryText(
|
|||
QRect rect,
|
||||
bool active,
|
||||
bool selected,
|
||||
not_null<const Row*> row) {
|
||||
not_null<const Row*> row,
|
||||
crl::time now,
|
||||
bool paused) {
|
||||
if (rect.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -285,6 +287,8 @@ void PaintListEntryText(
|
|||
? st::dialogsTextPaletteOver
|
||||
: st::dialogsTextPalette)),
|
||||
.spoiler = Text::DefaultSpoilerCache(),
|
||||
.now = now,
|
||||
.paused = paused,
|
||||
.elisionLines = rect.height() / st::dialogsTextFont->height,
|
||||
});
|
||||
}
|
||||
|
@ -436,6 +440,8 @@ void paintRow(
|
|||
.position = { nameleft, texttop },
|
||||
.availableWidth = availableWidth,
|
||||
.spoiler = Text::DefaultSpoilerCache(),
|
||||
.now = ms,
|
||||
.paused = bool(flags & Flag::VideoPaused),
|
||||
.elisionLines = 1,
|
||||
});
|
||||
} else if (draft
|
||||
|
@ -503,6 +509,8 @@ void paintRow(
|
|||
? st::dialogsTextPaletteDraftOver
|
||||
: st::dialogsTextPaletteDraft)),
|
||||
.spoiler = Text::DefaultSpoilerCache(),
|
||||
.now = ms,
|
||||
.paused = bool(flags & Flag::VideoPaused),
|
||||
.elisionLines = 1,
|
||||
});
|
||||
}
|
||||
|
@ -953,7 +961,7 @@ void RowPainter::paint(
|
|||
ms)
|
||||
: false;
|
||||
if (const auto folder = row->folder()) {
|
||||
PaintListEntryText(p, rect, active, selected, row);
|
||||
PaintListEntryText(p, rect, active, selected, row, ms, paused);
|
||||
} else if (history && !actionWasPainted) {
|
||||
if (!history->lastItemDialogsView.prepared(item)) {
|
||||
history->lastItemDialogsView.prepare(
|
||||
|
@ -961,7 +969,13 @@ void RowPainter::paint(
|
|||
[=] { history->updateChatListEntry(); },
|
||||
{});
|
||||
}
|
||||
history->lastItemDialogsView.paint(p, rect, active, selected);
|
||||
history->lastItemDialogsView.paint(
|
||||
p,
|
||||
rect,
|
||||
active,
|
||||
selected,
|
||||
ms,
|
||||
paused);
|
||||
}
|
||||
};
|
||||
const auto paintCounterCallback = [&] {
|
||||
|
@ -1006,6 +1020,7 @@ void RowPainter::paint(
|
|||
bool active,
|
||||
bool selected,
|
||||
crl::time ms,
|
||||
bool paused,
|
||||
bool displayUnreadInfo) {
|
||||
auto item = row->item();
|
||||
auto history = item->history();
|
||||
|
@ -1088,7 +1103,7 @@ void RowPainter::paint(
|
|||
if (!view.prepared(item)) {
|
||||
view.prepare(item, row->repaint(), previewOptions);
|
||||
}
|
||||
row->itemView().paint(p, itemRect, active, selected);
|
||||
row->itemView().paint(p, itemRect, active, selected, ms, paused);
|
||||
};
|
||||
const auto paintCounterCallback = [&] {
|
||||
PaintNarrowCounter(
|
||||
|
@ -1111,7 +1126,8 @@ void RowPainter::paint(
|
|||
| (selected ? Flag::Selected : Flag(0))
|
||||
| Flag::SearchResult
|
||||
| (showSavedMessages ? Flag::SavedMessages : Flag(0))
|
||||
| (showRepliesMessages ? Flag::RepliesMessages : Flag(0));
|
||||
| (showRepliesMessages ? Flag::RepliesMessages : Flag(0))
|
||||
| (paused ? Flag::VideoPaused : Flag(0));
|
||||
paintRow(
|
||||
p,
|
||||
row,
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
bool active,
|
||||
bool selected,
|
||||
crl::time ms,
|
||||
bool paused,
|
||||
bool displayUnreadInfo);
|
||||
static QRect sendActionAnimationRect(
|
||||
int animationLeft,
|
||||
|
|
|
@ -176,7 +176,9 @@ void MessageView::paint(
|
|||
Painter &p,
|
||||
const QRect &geometry,
|
||||
bool active,
|
||||
bool selected) const {
|
||||
bool selected,
|
||||
crl::time now,
|
||||
bool paused) const {
|
||||
if (geometry.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -227,6 +229,8 @@ void MessageView::paint(
|
|||
.availableWidth = rect.width(),
|
||||
.palette = palette,
|
||||
.spoiler = Text::DefaultSpoilerCache(),
|
||||
.now = now,
|
||||
.paused = paused,
|
||||
.elisionLines = rect.height() / st::dialogsTextFont->height,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,7 +49,9 @@ public:
|
|||
Painter &p,
|
||||
const QRect &geometry,
|
||||
bool active,
|
||||
bool selected) const;
|
||||
bool selected,
|
||||
crl::time now,
|
||||
bool paused) const;
|
||||
|
||||
private:
|
||||
struct LoadingContext;
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/multi_select.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/painter.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
@ -40,7 +41,7 @@ using SearchRequest = Api::MessagesSearchMerged::Request;
|
|||
|
||||
class Row final : public PeerListRow {
|
||||
public:
|
||||
Row(std::unique_ptr<Dialogs::FakeRow> fakeRow);
|
||||
explicit Row(std::unique_ptr<Dialogs::FakeRow> fakeRow);
|
||||
|
||||
[[nodiscard]] FullMsgId fullId() const;
|
||||
|
||||
|
@ -99,7 +100,15 @@ void Row::elementsPaint(
|
|||
int selectedElement) {
|
||||
_outerWidth = outerWidth;
|
||||
using Row = Dialogs::Ui::RowPainter;
|
||||
Row::paint(p, _fakeRow.get(), outerWidth, false, selected, 0, false);
|
||||
Row::paint(
|
||||
p,
|
||||
_fakeRow.get(),
|
||||
outerWidth,
|
||||
false,
|
||||
selected,
|
||||
crl::now(),
|
||||
p.inactive(),
|
||||
false);
|
||||
}
|
||||
|
||||
class ListController final : public PeerListController {
|
||||
|
|
|
@ -1304,6 +1304,8 @@ void Message::paintText(
|
|||
.availableWidth = trect.width(),
|
||||
.palette = &stm->textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = context.selection,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -546,6 +546,8 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
|||
.align = style::al_top,
|
||||
.palette = &st->serviceTextPalette(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = context.selection,
|
||||
.fullWidthSelection = false,
|
||||
});
|
||||
|
|
|
@ -701,6 +701,8 @@ void Document::draw(
|
|||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = selection,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -238,6 +238,8 @@ void ExtendedPreview::draw(Painter &p, const PaintContext &context) const {
|
|||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = context.selection,
|
||||
});
|
||||
} else if (!inWebPage) {
|
||||
|
|
|
@ -612,6 +612,8 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
|
|||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = context.selection,
|
||||
});
|
||||
} else if (!inWebPage && !skipDrawingSurrounding) {
|
||||
|
|
|
@ -353,6 +353,8 @@ void GroupedMedia::draw(Painter &p, const PaintContext &context) const {
|
|||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = context.selection,
|
||||
});
|
||||
} else if (_parent->media() == this) {
|
||||
|
|
|
@ -305,6 +305,8 @@ void Photo::draw(Painter &p, const PaintContext &context) const {
|
|||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.paused = context.paused,
|
||||
.selection = context.selection,
|
||||
});
|
||||
} else if (!inWebPage) {
|
||||
|
|
|
@ -627,12 +627,13 @@ void ChatStyle::make(
|
|||
my.linkAlwaysActive = original.linkAlwaysActive;
|
||||
make(my.linkFg, original.linkFg);
|
||||
make(my.monoFg, original.monoFg);
|
||||
make(my.spoilerFg, original.spoilerFg);
|
||||
make(my.selectBg, original.selectBg);
|
||||
make(my.selectFg, original.selectFg);
|
||||
make(my.selectLinkFg, original.selectLinkFg);
|
||||
make(my.selectMonoFg, original.selectMonoFg);
|
||||
make(my.selectSpoilerFg, original.selectSpoilerFg);
|
||||
make(my.selectOverlay, original.selectOverlay);
|
||||
make(my.spoilerFg, original.spoilerFg);
|
||||
}
|
||||
|
||||
void ChatStyle::make(
|
||||
|
|
|
@ -409,6 +409,8 @@ void MessageBar::paint(Painter &p) {
|
|||
.availableWidth = body.width(),
|
||||
.palette = &_st.textPalette,
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = crl::now(),
|
||||
.paused = p.inactive(),
|
||||
.elisionLines = 1,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -982,12 +982,13 @@ void Generator::paintHistoryShadows() {
|
|||
void Generator::setTextPalette(const style::TextPalette &st) {
|
||||
_textPalette.linkFg = st.linkFg[_palette].clone();
|
||||
_textPalette.monoFg = st.monoFg[_palette].clone();
|
||||
_textPalette.spoilerFg = st.spoilerFg[_palette].clone();
|
||||
_textPalette.selectBg = st.selectBg[_palette].clone();
|
||||
_textPalette.selectFg = st.selectFg[_palette].clone();
|
||||
_textPalette.selectLinkFg = st.selectLinkFg[_palette].clone();
|
||||
_textPalette.selectMonoFg = st.selectMonoFg[_palette].clone();
|
||||
_textPalette.selectSpoilerFg = st.selectSpoilerFg[_palette].clone();
|
||||
_textPalette.selectOverlay = st.selectOverlay[_palette].clone();
|
||||
_textPalette.spoilerFg = st.spoilerFg[_palette].clone();
|
||||
_p->setTextPalette(_textPalette);
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 4ff5bc5773d95b07fd34485a564d1aacc3fb9d1a
|
||||
Subproject commit a60fe582ad9ab797ead0a18a9ed18e1892681c60
|
Loading…
Add table
Reference in a new issue