mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Always show edit timer
This commit is contained in:
@@ -6706,14 +6706,18 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int
|
|||||||
|
|
||||||
if (!_replyEditMsg || _replyEditMsg->history()->peer->isSelf()) return;
|
if (!_replyEditMsg || _replyEditMsg->history()->peer->isSelf()) return;
|
||||||
|
|
||||||
|
if (const auto megagroup = _replyEditMsg->history()->peer->asMegagroup()) {
|
||||||
|
if (megagroup->amCreator() || megagroup->hasAdminRights()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString editTimeLeftText;
|
QString editTimeLeftText;
|
||||||
int updateIn = -1;
|
int updateIn = -1;
|
||||||
auto timeSinceMessage = ItemDateTime(_replyEditMsg).msecsTo(QDateTime::currentDateTime());
|
auto timeSinceMessage = ItemDateTime(_replyEditMsg).msecsTo(QDateTime::currentDateTime());
|
||||||
auto editTimeLeft = (Global::EditTimeLimit() * 1000LL) - timeSinceMessage;
|
auto editTimeLeft = (Global::EditTimeLimit() * 1000LL) - timeSinceMessage;
|
||||||
if (editTimeLeft < 2) {
|
if (editTimeLeft < 2) {
|
||||||
editTimeLeftText = qsl("0:00");
|
editTimeLeftText = qsl("0:00");
|
||||||
} else if (editTimeLeft > kDisplayEditTimeWarningMs) {
|
|
||||||
updateIn = static_cast<int>(qMin(editTimeLeft - kDisplayEditTimeWarningMs, qint64(kFullDayInMs)));
|
|
||||||
} else {
|
} else {
|
||||||
updateIn = static_cast<int>(editTimeLeft % 1000);
|
updateIn = static_cast<int>(editTimeLeft % 1000);
|
||||||
if (!updateIn) {
|
if (!updateIn) {
|
||||||
@@ -6722,7 +6726,9 @@ void HistoryWidget::paintEditHeader(Painter &p, const QRect &rect, int left, int
|
|||||||
++updateIn;
|
++updateIn;
|
||||||
|
|
||||||
editTimeLeft = (editTimeLeft - 1) / 1000; // seconds
|
editTimeLeft = (editTimeLeft - 1) / 1000; // seconds
|
||||||
editTimeLeftText = qsl("%1:%2").arg(editTimeLeft / 60).arg(editTimeLeft % 60, 2, 10, QChar('0'));
|
editTimeLeftText = (editTimeLeft >= 3600
|
||||||
|
? qsl("%1:%2:%3").arg(editTimeLeft / 3600).arg(editTimeLeft % 3600 / 60, 2, 10, QChar('0')).arg(editTimeLeft % 60, 2, 10, QChar('0'))
|
||||||
|
: qsl("%1:%2").arg(editTimeLeft / 60).arg(editTimeLeft % 60, 2, 10, QChar('0')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart timer only if we are sure that we've painted the whole timer.
|
// Restart timer only if we are sure that we've painted the whole timer.
|
||||||
|
Reference in New Issue
Block a user