mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
parent
0b7bb806b7
commit
4c9ef606f3
2 changed files with 45 additions and 26 deletions
|
@ -432,6 +432,27 @@ void RowPainter::paint(
|
||||||
}
|
}
|
||||||
return cloudDraft ? ParseDateTime(cloudDraft->date) : QDateTime();
|
return cloudDraft ? ParseDateTime(cloudDraft->date) : QDateTime();
|
||||||
}();
|
}();
|
||||||
|
const auto displayMentionBadge = history
|
||||||
|
? history->hasUnreadMentions()
|
||||||
|
: false;
|
||||||
|
const auto displayUnreadCounter = [&] {
|
||||||
|
if (displayMentionBadge
|
||||||
|
&& unreadCount == 1
|
||||||
|
&& item
|
||||||
|
&& item->isMediaUnread()
|
||||||
|
&& item->mentionsMe()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (unreadCount > 0);
|
||||||
|
}();
|
||||||
|
const auto displayUnreadMark = !displayUnreadCounter
|
||||||
|
&& !displayMentionBadge
|
||||||
|
&& history
|
||||||
|
&& unreadMark;
|
||||||
|
const auto displayPinnedIcon = !displayUnreadCounter
|
||||||
|
&& !displayMentionBadge
|
||||||
|
&& !displayUnreadMark
|
||||||
|
&& entry->isPinnedDialog();
|
||||||
|
|
||||||
const auto from = history
|
const auto from = history
|
||||||
? (history->peer->migrateTo()
|
? (history->peer->migrateTo()
|
||||||
|
@ -446,27 +467,6 @@ void RowPainter::paint(
|
||||||
auto availableWidth = namewidth;
|
auto availableWidth = namewidth;
|
||||||
auto texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
|
auto texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
|
||||||
auto hadOneBadge = false;
|
auto hadOneBadge = false;
|
||||||
const auto displayMentionBadge = history
|
|
||||||
? history->hasUnreadMentions()
|
|
||||||
: false;
|
|
||||||
const auto displayUnreadCounter = [&] {
|
|
||||||
if (displayMentionBadge
|
|
||||||
&& unreadCount == 1
|
|
||||||
&& item
|
|
||||||
&& item->isMediaUnread()
|
|
||||||
&& item->mentionsMe()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (unreadCount > 0);
|
|
||||||
}();
|
|
||||||
const auto displayUnreadMark = !displayUnreadCounter
|
|
||||||
&& !displayMentionBadge
|
|
||||||
&& history
|
|
||||||
&& unreadMark;
|
|
||||||
const auto displayPinnedIcon = !displayUnreadCounter
|
|
||||||
&& !displayMentionBadge
|
|
||||||
&& !displayUnreadMark
|
|
||||||
&& entry->isPinnedDialog();
|
|
||||||
if (displayUnreadCounter || displayUnreadMark) {
|
if (displayUnreadCounter || displayUnreadMark) {
|
||||||
auto counter = (unreadCount > 0)
|
auto counter = (unreadCount > 0)
|
||||||
? QString::number(unreadCount)
|
? QString::number(unreadCount)
|
||||||
|
@ -533,10 +533,15 @@ void RowPainter::paint(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto paintCounterCallback = [&] {
|
const auto paintCounterCallback = [&] {
|
||||||
if (unreadCount) {
|
auto hadOneBadge = false;
|
||||||
auto counter = QString::number(unreadCount);
|
auto skipBeforeMention = 0;
|
||||||
if (counter.size() > 4) {
|
if (displayUnreadCounter || displayUnreadMark) {
|
||||||
counter = qsl("..") + counter.mid(counter.size() - 3);
|
auto counter = (unreadCount > 0)
|
||||||
|
? QString::number(unreadCount)
|
||||||
|
: QString();
|
||||||
|
const auto allowDigits = displayMentionBadge ? 1 : 3;
|
||||||
|
if (counter.size() > allowDigits + 1) {
|
||||||
|
counter = qsl("..") + counter.mid(counter.size() - allowDigits);
|
||||||
}
|
}
|
||||||
auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize;
|
auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize;
|
||||||
auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight;
|
auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight;
|
||||||
|
@ -546,6 +551,20 @@ void RowPainter::paint(
|
||||||
st.active = active;
|
st.active = active;
|
||||||
st.muted = unreadMuted;
|
st.muted = unreadMuted;
|
||||||
paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth);
|
paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth);
|
||||||
|
skipBeforeMention += unreadWidth + st.padding;
|
||||||
|
}
|
||||||
|
if (displayMentionBadge) {
|
||||||
|
auto counter = qsl("@");
|
||||||
|
auto unreadRight = st::dialogsPadding.x() + st::dialogsPhotoSize - skipBeforeMention;
|
||||||
|
auto unreadTop = st::dialogsPadding.y() + st::dialogsPhotoSize - st::dialogsUnreadHeight;
|
||||||
|
auto unreadWidth = 0;
|
||||||
|
|
||||||
|
UnreadBadgeStyle st;
|
||||||
|
st.active = active;
|
||||||
|
st.muted = false;
|
||||||
|
st.padding = 0;
|
||||||
|
st.textTop = 0;
|
||||||
|
paintUnreadCount(p, counter, unreadRight, unreadTop, st, &unreadWidth);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
paintRow(
|
paintRow(
|
||||||
|
|
|
@ -646,7 +646,7 @@ int32 MainWindow::screenNameChecksum(const QString &name) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::psRefreshTaskbarIcon() {
|
void MainWindow::psRefreshTaskbarIcon() {
|
||||||
auto refresher = std::make_unique<QWidget>(this);
|
const auto refresher = std::make_unique<QWidget>(this);
|
||||||
refresher->setWindowFlags(static_cast<Qt::WindowFlags>(Qt::Tool) | Qt::FramelessWindowHint);
|
refresher->setWindowFlags(static_cast<Qt::WindowFlags>(Qt::Tool) | Qt::FramelessWindowHint);
|
||||||
refresher->setGeometry(x() + 1, y() + 1, 1, 1);
|
refresher->setGeometry(x() + 1, y() + 1, 1, 1);
|
||||||
auto palette = refresher->palette();
|
auto palette = refresher->palette();
|
||||||
|
|
Loading…
Add table
Reference in a new issue