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

@ -254,6 +254,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_notification_preview" = "You have a new message"; "lng_notification_preview" = "You have a new message";
"lng_notification_reply" = "Reply"; "lng_notification_reply" = "Reply";
"lng_notification_hide_all" = "Hide all"; "lng_notification_hide_all" = "Hide all";
"lng_notification_sample" = "This is a sample notification";
"lng_settings_section_general" = "General"; "lng_settings_section_general" = "General";
"lng_settings_change_lang" = "Change language"; "lng_settings_change_lang" = "Change language";

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,11,0 FILEVERSION 0,10,12,0
PRODUCTVERSION 0,10,11,0 PRODUCTVERSION 0,10,12,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.11.0" VALUE "FileVersion", "0.10.12.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.11.0" VALUE "ProductVersion", "0.10.12.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,11,0 FILEVERSION 0,10,12,0
PRODUCTVERSION 0,10,11,0 PRODUCTVERSION 0,10,12,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater" VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.10.11.0" VALUE "FileVersion", "0.10.12.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.11.0" VALUE "ProductVersion", "0.10.12.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -1085,8 +1085,8 @@ void AppClass::checkMapVersion() {
if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion() < AppVersion) {
if (Local::oldMapVersion()) { if (Local::oldMapVersion()) {
QString versionFeatures; QString versionFeatures;
if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 10003) { if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 10012) {
versionFeatures = QString::fromUtf8("\xe2\x80\x94 New cute design for the Settings page"); versionFeatures = QString::fromUtf8("Windows and Linux:\n\xe2\x80\x94 Quick reply from notifications\n\xe2\x80\x94 Hide all notifications button added\n\xe2\x80\x94 Change notifications location and maximum count\n\nLinux:\n\xe2\x80\x94 You can enable native notifications in Settings");
} else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 10005) { } else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 10005) {
versionFeatures = langNewVersionText(); versionFeatures = langNewVersionText();
} else { } else {

View File

@ -84,14 +84,27 @@ private:
_owner->removeSample(this); _owner->removeSample(this);
} }
hide(); hide();
deleteLater(); destroyDelayed();
} }
} }
void destroyDelayed() {
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
}
NotificationsBox *_owner; NotificationsBox *_owner;
QPixmap _cache; QPixmap _cache;
FloatAnimation _opacity; FloatAnimation _opacity;
bool _hiding = false; bool _hiding = false;
bool _deleted = false;
}; };

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL) #define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 10011; constexpr int AppVersion = 10012;
constexpr str_const AppVersionStr = "0.10.11"; constexpr str_const AppVersionStr = "0.10.12";
constexpr bool AppAlphaVersion = false; constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View File

@ -296,9 +296,12 @@ void Manager::doClearAllFast() {
_queuedNotifications.clear(); _queuedNotifications.clear();
auto notifications = createAndSwap(_notifications); auto notifications = createAndSwap(_notifications);
for_const (auto notification, notifications) { for_const (auto notification, notifications) {
notification->deleteLater(); delete notification;
}
if (_hideAll) {
auto hideAll = createAndSwap(_hideAll);
delete hideAll;
} }
showNextFromQueue();
} }
void Manager::doClearFromHistory(History *history) { 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)) { , _a_shift(animation(this, &Widget::step_shift)) {
setWindowOpacity(0.); setWindowOpacity(0.);
setAttribute(Qt::WA_OpaquePaintEvent);
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::NoDropShadowWindowHint); setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint | Qt::NoDropShadowWindowHint);
setAttribute(Qt::WA_OpaquePaintEvent);
setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacAlwaysShowToolWindow);
_a_opacity.start(); _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) { void Widget::step_opacity(float64 ms, bool timer) {
float64 dt = ms / float64(_opacityDuration); float64 dt = ms / float64(_opacityDuration);
if (dt >= 1) { if (dt >= 1) {
a_opacity.finish(); a_opacity.finish();
_a_opacity.stop(); _a_opacity.stop();
if (_hiding) { if (_hiding) {
deleteLater(); destroyDelayed();
} }
} else { } else {
a_opacity.update(dt, a_func); a_opacity.update(dt, a_func);
@ -500,11 +515,6 @@ Notification::Notification(History *history, PeerData *peer, PeerData *author, H
prepareActionsCache(); 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(); show();
} }

View File

@ -148,12 +148,14 @@ protected:
virtual void updateGeometry(int x, int y, int width, int height); virtual void updateGeometry(int x, int y, int width, int height);
private: private:
void destroyDelayed();
void moveByShift(); void moveByShift();
void hideAnimated(float64 duration, anim::transition func); void hideAnimated(float64 duration, anim::transition func);
void step_opacity(float64 ms, bool timer); void step_opacity(float64 ms, bool timer);
void step_shift(float64 ms, bool timer); void step_shift(float64 ms, bool timer);
bool _hiding = false; bool _hiding = false;
bool _deleted = false;
float64 _opacityDuration; float64 _opacityDuration;
anim::fvalue a_opacity; anim::fvalue a_opacity;
anim::transition a_func; anim::transition a_func;

View File

@ -1,6 +1,6 @@
AppVersion 10011 AppVersion 10012
AppVersionStrMajor 0.10 AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.11 AppVersionStrSmall 0.10.12
AppVersionStr 0.10.11 AppVersionStr 0.10.12
AlphaChannel 0 AlphaChannel 1
BetaVersion 0 BetaVersion 0