mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Fixed emoji display in filenames from document views.
This commit is contained in:
parent
3f34c0ce37
commit
a37f512949
2 changed files with 15 additions and 17 deletions
|
@ -746,8 +746,7 @@ struct HistoryDocumentCaptioned : public RuntimeComponent<HistoryDocumentCaption
|
|||
};
|
||||
|
||||
struct HistoryDocumentNamed : public RuntimeComponent<HistoryDocumentNamed, HistoryView::Document> {
|
||||
QString name;
|
||||
int namew = 0;
|
||||
Ui::Text::String name;
|
||||
};
|
||||
|
||||
struct HistoryDocumentVoicePlayback {
|
||||
|
|
|
@ -303,7 +303,7 @@ Document::Document(
|
|||
createComponents();
|
||||
if (const auto named = Get<HistoryDocumentNamed>()) {
|
||||
fillNamedFromData(named);
|
||||
_tooltipFilename.setTooltipText(named->name);
|
||||
_tooltipFilename.setTooltipText(named->name.toString());
|
||||
}
|
||||
|
||||
if ((_data->isVoiceMessage() || isRound)
|
||||
|
@ -406,9 +406,9 @@ void Document::createComponents() {
|
|||
}
|
||||
|
||||
void Document::fillNamedFromData(not_null<HistoryDocumentNamed*> named) {
|
||||
const auto nameString = named->name = CleanTagSymbols(
|
||||
Ui::Text::FormatSongNameFor(_data).string());
|
||||
named->namew = st::semiboldFont->width(nameString);
|
||||
named->name.setText(
|
||||
st::semiboldTextStyle,
|
||||
CleanTagSymbols(Ui::Text::FormatSongNameFor(_data).string()));
|
||||
}
|
||||
|
||||
QSize Document::countOptimalSize() {
|
||||
|
@ -497,8 +497,8 @@ QSize Document::countOptimalSize() {
|
|||
accumulate_max(maxWidth, tleft + MaxStatusWidth(_data) + unread + _parent->skipBlockWidth() + st::msgPadding.right());
|
||||
}
|
||||
|
||||
if (auto named = Get<HistoryDocumentNamed>()) {
|
||||
accumulate_max(maxWidth, tleft + named->namew + tright);
|
||||
if (const auto named = Get<HistoryDocumentNamed>()) {
|
||||
accumulate_max(maxWidth, tleft + named->name.maxWidth() + tright);
|
||||
accumulate_min(maxWidth, st::msgMaxWidth);
|
||||
}
|
||||
if (voice && voice->transcribe) {
|
||||
|
@ -876,16 +876,15 @@ void Document::draw(
|
|||
progress,
|
||||
inTTLViewer);
|
||||
p.restore();
|
||||
} else if (auto named = Get<HistoryDocumentNamed>()) {
|
||||
p.setFont(st::semiboldFont);
|
||||
} else if (const auto named = Get<HistoryDocumentNamed>()) {
|
||||
p.setPen(stm->historyFileNameFg);
|
||||
const auto elided = (namewidth < named->namew);
|
||||
if (elided) {
|
||||
p.drawTextLeft(nameleft, nametop, width, st::semiboldFont->elided(named->name, namewidth, Qt::ElideMiddle));
|
||||
} else {
|
||||
p.drawTextLeft(nameleft, nametop, width, named->name, named->namew);
|
||||
}
|
||||
_tooltipFilename.setElided(elided);
|
||||
named->name.draw(p, {
|
||||
.position = QPoint(nameleft, nametop),
|
||||
.outerWidth = width,
|
||||
.availableWidth = namewidth,
|
||||
.elisionLines = 1,
|
||||
});
|
||||
_tooltipFilename.setElided(namewidth < named->name.maxWidth());
|
||||
}
|
||||
|
||||
auto statusText = voiceStatusOverride.isEmpty() ? _statusText : voiceStatusOverride;
|
||||
|
|
Loading…
Add table
Reference in a new issue