2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Version 0.10.12.alpha: major notifications update.

This commit is contained in:
John Preston
2016-10-07 16:24:19 +03:00
parent 15ee4b40dc
commit 4369c23314
9 changed files with 54 additions and 28 deletions

View File

@@ -296,9 +296,12 @@ void Manager::doClearAllFast() {
_queuedNotifications.clear();
auto notifications = createAndSwap(_notifications);
for_const (auto notification, notifications) {
notification->deleteLater();
delete notification;
}
if (_hideAll) {
auto hideAll = createAndSwap(_hideAll);
delete hideAll;
}
showNextFromQueue();
}
void Manager::doClearFromHistory(History *history) {
@@ -347,21 +350,33 @@ Widget::Widget(QPoint startPosition, int shift, Direction shiftDirection) : TWid
, _a_shift(animation(this, &Widget::step_shift)) {
setWindowOpacity(0.);
setAttribute(Qt::WA_OpaquePaintEvent);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::NoDropShadowWindowHint);
setAttribute(Qt::WA_OpaquePaintEvent);
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
_a_opacity.start();
}
void Widget::destroyDelayed() {
hide();
if (_deleted) return;
_deleted = true;
// Ubuntu has a lag if deleteLater() called immediately.
#if defined Q_OS_LINUX32 || defined Q_OS_LINUX64
QTimer::singleShot(1000, [this] { delete this; });
#else // Q_OS_LINUX32 || Q_OS_LINUX64
deleteLater();
#endif // Q_OS_LINUX32 || Q_OS_LINUX64
}
void Widget::step_opacity(float64 ms, bool timer) {
float64 dt = ms / float64(_opacityDuration);
if (dt >= 1) {
a_opacity.finish();
_a_opacity.stop();
if (_hiding) {
deleteLater();
destroyDelayed();
}
} else {
a_opacity.update(dt, a_func);
@@ -500,11 +515,6 @@ Notification::Notification(History *history, PeerData *peer, PeerData *author, H
prepareActionsCache();
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::NoDropShadowWindowHint);
setAttribute(Qt::WA_MacAlwaysShowToolWindow);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
show();
}