mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Added captions to voice messages in overview layout.
This commit is contained in:
parent
41e414af37
commit
c1c49e8ddc
2 changed files with 29 additions and 1 deletions
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "overview/overview_layout.h"
|
#include "overview/overview_layout.h"
|
||||||
|
|
||||||
#include "overview/overview_layout_delegate.h"
|
#include "overview/overview_layout_delegate.h"
|
||||||
|
#include "core/ui_integration.h" // Core::MarkedTextContext.
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_document_resolver.h"
|
#include "data/data_document_resolver.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
@ -867,6 +868,7 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
|
||||||
p.drawTextLeft(nameleft, statustop, _width, _status.text(), statusw);
|
p.drawTextLeft(nameleft, statustop, _width, _status.text(), statusw);
|
||||||
unreadx += statusw;
|
unreadx += statusw;
|
||||||
}
|
}
|
||||||
|
auto captionLeft = unreadx + st::mediaUnreadSkip;
|
||||||
if (parent()->hasUnreadMediaFlag() && unreadx + st::mediaUnreadSkip + st::mediaUnreadSize <= _width) {
|
if (parent()->hasUnreadMediaFlag() && unreadx + st::mediaUnreadSkip + st::mediaUnreadSize <= _width) {
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(selected ? st::msgFileInBgSelected : st::msgFileInBg);
|
p.setBrush(selected ? st::msgFileInBgSelected : st::msgFileInBg);
|
||||||
|
@ -875,6 +877,22 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
|
||||||
PainterHighQualityEnabler hq(p);
|
PainterHighQualityEnabler hq(p);
|
||||||
p.drawEllipse(style::rtlrect(unreadx + st::mediaUnreadSkip, statustop + st::mediaUnreadTop, st::mediaUnreadSize, st::mediaUnreadSize, _width));
|
p.drawEllipse(style::rtlrect(unreadx + st::mediaUnreadSkip, statustop + st::mediaUnreadTop, st::mediaUnreadSize, st::mediaUnreadSize, _width));
|
||||||
}
|
}
|
||||||
|
captionLeft += st::mediaUnreadSkip + st::mediaUnreadSize;
|
||||||
|
}
|
||||||
|
if (!_caption.isEmpty()) {
|
||||||
|
p.setPen(st::historyFileNameInFg);
|
||||||
|
const auto w = _width - captionLeft - st::defaultScrollArea.width;
|
||||||
|
_caption.draw(p, Ui::Text::PaintContext{
|
||||||
|
.position = QPoint(captionLeft, statustop),
|
||||||
|
.availableWidth = w,
|
||||||
|
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||||
|
.paused = context
|
||||||
|
? context->paused
|
||||||
|
: On(PowerSaving::kEmojiChat),
|
||||||
|
.pausedEmoji = On(PowerSaving::kEmojiChat),
|
||||||
|
.pausedSpoiler = On(PowerSaving::kChatSpoiler),
|
||||||
|
.elisionLines = 1,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,6 +1023,14 @@ void Voice::updateName() {
|
||||||
Ui::NameTextOptions());
|
Ui::NameTextOptions());
|
||||||
}
|
}
|
||||||
_nameVersion = parent()->fromOriginal()->nameVersion();
|
_nameVersion = parent()->fromOriginal()->nameVersion();
|
||||||
|
_caption.setMarkedText(
|
||||||
|
st::defaultTextStyle,
|
||||||
|
parent()->originalText(),
|
||||||
|
Ui::DialogTextOptions(),
|
||||||
|
Core::MarkedTextContext{
|
||||||
|
.session = &parent()->history()->session(),
|
||||||
|
.customEmojiRepaint = [=] { delegate()->repaintItem(this); },
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Voice::updateStatusText() {
|
bool Voice::updateStatusText() {
|
||||||
|
|
|
@ -362,7 +362,9 @@ private:
|
||||||
|
|
||||||
const style::OverviewFileLayout &_st;
|
const style::OverviewFileLayout &_st;
|
||||||
|
|
||||||
Ui::Text::String _name, _details;
|
Ui::Text::String _name;
|
||||||
|
Ui::Text::String _details;
|
||||||
|
Ui::Text::String _caption;
|
||||||
int _nameVersion = 0;
|
int _nameVersion = 0;
|
||||||
|
|
||||||
void updateName();
|
void updateName();
|
||||||
|
|
Loading…
Add table
Reference in a new issue