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