diff --git a/Telegram/Resources/art/bg.jpg b/Telegram/Resources/art/bg.jpg index f9ee1054a..7fa05b3ed 100644 Binary files a/Telegram/Resources/art/bg.jpg and b/Telegram/Resources/art/bg.jpg differ diff --git a/Telegram/Resources/art/bg_old.png b/Telegram/Resources/art/bg_initial.png similarity index 100% rename from Telegram/Resources/art/bg_old.png rename to Telegram/Resources/art/bg_initial.png diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 8992a0b5a..0e8d43032 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -103,7 +103,7 @@ boxLabel: flatLabel(labelDefFlat) { defaultLeftOutlineButton: OutlineButton { outlineWidth: 3px; outlineFg: windowBg; - outlineFgOver: windowActiveFill; + outlineFgOver: windowActiveBg; textBg: windowBg; textBgOver: #f2f7fa; @@ -180,7 +180,7 @@ defaultCheckbox: Checkbox { checkBg: #ffffff; checkFg: #b3b3b3; checkFgOver: #b3b3b3; - checkFgActive: windowActiveFill; + checkFgActive: windowActiveBg; width: -44px; height: 22px; @@ -188,7 +188,7 @@ defaultCheckbox: Checkbox { textPosition: point(32px, 2px); diameter: 22px; thickness: 2px; - checkIcon: icon {{ "default_checkbox_check", #ffffff, point(4px, 7px) }}; + checkIcon: icon {{ "default_checkbox_check", windowActiveFg, point(4px, 7px) }}; font: normalFont; duration: 120; @@ -655,7 +655,7 @@ msgFileThumbLinkOutFgSelected: #31a298; msgFileNameTop: 16px; msgFileStatusTop: 37px; msgFileMinWidth: 294px; -msgFileInBg: windowActiveFill; +msgFileInBg: windowActiveBg; msgFileInBgOver: #4eade3; msgFileInBgSelected: #51a3d3; msgFileOutBg: #78c67f; @@ -671,7 +671,7 @@ msgWaveformBar: 2px; msgWaveformSkip: 1px; msgWaveformMin: 2px; msgWaveformMax: 20px; -msgWaveformInActive: windowActiveFill; +msgWaveformInActive: windowActiveBg; msgWaveformInActiveSelected: #51a3d3; msgWaveformInInactive: #d4dee6; msgWaveformInInactiveSelected: #9cc1e1; diff --git a/Telegram/Resources/colors.palette b/Telegram/Resources/colors.palette index d7fc7245a..ac980b21e 100644 --- a/Telegram/Resources/colors.palette +++ b/Telegram/Resources/colors.palette @@ -23,19 +23,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org windowBg: #ffffff; // white: fallback for background windowTextFg: #000000; // black: fallback for text color windowSubTextFg: #999999; // gray: fallback for subtext color -windowActiveFill: #40ace3; // bright blue: fallback for blue filled active areas +windowActiveBg: #40ace3; // bright blue: fallback for blue filled active areas +windowActiveFg: #ffffff; // text on bright blue: fallback for text on active areas windowOverBg: #f0f0f0; // light gray: fallback for over background windowSubTextFgOver: #7c99b2; // gray over light blue: fallback for subtext over color -windowActiveTextFg: #1485c2; // online blue: fallback for active color +windowActiveTextFg: #2687bf; // online blue: fallback for active color windowShadowFg: #000000; // black: fallback for shadow color imageBg: #000000; imageBgTransparent: #ffffff; // widgets -activeButtonBg: windowActiveFill; +activeButtonBg: windowActiveBg; activeButtonBgOver: #46b4eb; -activeButtonFg: #ffffff; +activeButtonFg: windowActiveFg; activeButtonFgOver: activeButtonFg; activeButtonSecondaryFg: #cceeff; activeButtonSecondaryFgOver: activeButtonSecondaryFg; @@ -45,7 +46,8 @@ lightButtonBgOver: #edf7ff; lightButtonFg: #2b99d5; lightButtonFgOver: lightButtonFg; -menuIconFg: windowSubTextFg; +menuIconFg: #a8a8a8; +menuIconFgOver: #999999; // custom title bar for Windows titleBg: windowOverBg; @@ -95,7 +97,7 @@ settingsCloseFgOver: cancelIconFgOver; notificationsBoxMonitorFg: windowTextFg; -notificationSampleUserpicFg: windowActiveFill; +notificationSampleUserpicFg: windowActiveBg; notificationSampleCloseFg: #d7d7d7 | windowSubTextFg; notificationSampleTextFg: #d7d7d7 | windowSubTextFg; notificationSampleNameFg: #939393 | windowSubTextFg; @@ -106,6 +108,7 @@ introErrorFg: windowTextFg; // dialogs dialogsMenuIconFg: menuIconFg; +dialogsMenuIconFgOver: menuIconFgOver; dialogsBg: windowBg; dialogsNameFg: #373737; @@ -118,7 +121,7 @@ dialogsVerifiedIconBg: #4abcf1; dialogsVerifiedIconFg: #ffffff; dialogsSendingIconFg: #c1c1c1; dialogsSentIconFg: #5dc452; -dialogsUnreadBg: windowActiveFill; +dialogsUnreadBg: windowActiveBg; dialogsUnreadBgMuted: #bbbbbb; dialogsUnreadFg: #ffffff; @@ -137,22 +140,23 @@ dialogsUnreadBgOver: dialogsUnreadBg; dialogsUnreadBgMutedOver: dialogsUnreadBgMuted; dialogsUnreadFgOver: dialogsUnreadFg; -dialogsBgActive: dialogsBgOver; -dialogsNameFgActive: dialogsNameFgOver; +dialogsBgActive: #419fd9; +dialogsNameFgActive: windowActiveFg; dialogsChatIconFgActive: dialogsNameFgActive; -dialogsDateFgActive: dialogsDateFgOver; -dialogsTextFgActive: dialogsTextFgOver; -dialogsTextFgServiceActive: dialogsTextFgServiceOver; -dialogsDraftFgActive: dialogsDraftFgOver; -dialogsVerifiedIconBgActive: dialogsVerifiedIconBgOver; -dialogsVerifiedIconFgActive: dialogsVerifiedIconFgOver; -dialogsSendingIconFgActive: dialogsSendingIconFgOver; -dialogsSentIconFgActive: dialogsSentIconFgOver; -dialogsUnreadBgActive: dialogsUnreadBgOver; -dialogsUnreadBgMutedActive: dialogsUnreadBgMutedOver; -dialogsUnreadFgActive: dialogsUnreadFgOver; +dialogsDateFgActive: windowActiveFg; +dialogsTextFgActive: windowActiveFg; +dialogsTextFgServiceActive: dialogsTextFgActive; +dialogsDraftFgActive: #c6e1f7; +dialogsVerifiedIconBgActive: dialogsTextFgActive; +dialogsVerifiedIconFgActive: dialogsBgActive; +dialogsSendingIconFgActive: #ffffff99; +dialogsSentIconFgActive: dialogsTextFgActive; +dialogsUnreadBgActive: dialogsTextFgActive; +dialogsUnreadBgMutedActive: #d3e2ee; +dialogsUnreadFgActive: dialogsBgActive; -dialogsForwardFg: #ffffff; +dialogsForwardBg: dialogsBgActive; +dialogsForwardFg: dialogsNameFgActive; // history topBarBg: windowBg; @@ -163,8 +167,8 @@ emojiPanHeaderFg: #999999 | windowSubTextFg; emojiPanHeaderBg: #fffffff2 | emojiPanBg; historyComposeAreaBg: windowBg; -historyComposeIconFg: #cccccc; -historyComposeIconFgOver: #bebebe; +historyComposeIconFg: menuIconFg; +historyComposeIconFgOver: menuIconFgOver; historyPinnedBg: historyComposeAreaBg; historyReplyBg: historyComposeAreaBg; historyReplyCancelIconFg: cancelIconFg; @@ -172,7 +176,6 @@ historyReplyCancelIconFgOver: cancelIconFgOver; historySendBg: historyComposeAreaBg; historySendBgOver: #f5f5f5 | historySendBg; -historyMenuItemBgOver: historySendBgOver; historyTextInFg: windowTextFg; historyTextOutFg: windowTextFg; diff --git a/Telegram/Resources/icons/dialogs_lock@2x.png b/Telegram/Resources/icons/dialogs_lock@2x.png index 74689cf49..d8f8bfd74 100644 Binary files a/Telegram/Resources/icons/dialogs_lock@2x.png and b/Telegram/Resources/icons/dialogs_lock@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_unlock@2x.png b/Telegram/Resources/icons/dialogs_unlock@2x.png index 04b3ef9e6..a6c7bbd2f 100644 Binary files a/Telegram/Resources/icons/dialogs_unlock@2x.png and b/Telegram/Resources/icons/dialogs_unlock@2x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 6ca0bc71d..00ce0a17c 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -473,8 +473,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_no_media" = "No media in this conversation."; "lng_profile_photos" = "{count:_not_used_|# photo|# photos}"; "lng_profile_photos_header" = "Photos overview"; -"lng_profile_videos" = "{count:_not_used_|# video file|# video files}"; -"lng_profile_videos_header" = "Video files overview"; +"lng_profile_videos" = "{count:_not_used_|# video|# videos}"; +"lng_profile_videos_header" = "Videos overview"; "lng_profile_songs" = "{count:_not_used_|# audio file|# audio files}"; "lng_profile_songs_header" = "Audio files overview"; "lng_profile_files" = "{count:_not_used_|# file|# files}"; @@ -582,7 +582,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_action_pinned_message" = "{from} pinned «{text}»"; "lng_action_pinned_media" = "{from} pinned {media}"; "lng_action_pinned_media_photo" = "a photo"; -"lng_action_pinned_media_video" = "a video file"; +"lng_action_pinned_media_video" = "a video"; "lng_action_pinned_media_audio" = "an audio file"; "lng_action_pinned_media_voice" = "a voice message"; "lng_action_pinned_media_file" = "a file"; @@ -666,7 +666,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_media_type" = "Media type"; "lng_media_type_photos" = "Photos"; -"lng_media_type_videos" = "Video files"; +"lng_media_type_videos" = "Videos"; "lng_media_type_songs" = "Audio files"; "lng_media_type_files" = "Files"; "lng_media_type_audios" = "Voice messages"; @@ -675,7 +675,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_media_open_with" = "Open With"; "lng_media_download" = "Download"; "lng_media_cancel" = "Cancel"; -"lng_media_video" = "Video file"; +"lng_media_video" = "Video"; "lng_media_audio" = "Voice message"; "lng_media_auto_settings" = "Automatic media download settings"; @@ -730,7 +730,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_masks_pack" = "This is a pack of mask stickers. You can use them in the photo editor on our mobile apps."; "lng_in_dlg_photo" = "Photo"; -"lng_in_dlg_video" = "Video file"; +"lng_in_dlg_video" = "Video"; "lng_in_dlg_audio_file" = "Audio file"; "lng_in_dlg_contact" = "Contact"; "lng_in_dlg_audio" = "Voice message"; @@ -825,7 +825,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_maps_point" = "Location"; "lng_save_photo" = "Save image"; -"lng_save_video" = "Save video file"; +"lng_save_video" = "Save video"; "lng_save_audio_file" = "Save audio file"; "lng_save_audio" = "Save voice message"; "lng_save_file" = "Save file"; @@ -853,7 +853,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "Cancel Download"; "lng_context_show_in_folder" = "Show in Folder"; "lng_context_show_in_finder" = "Show in Finder"; -"lng_context_save_video" = "Save Video File As..."; +"lng_context_save_video" = "Save Video As..."; "lng_context_save_audio_file" = "Save Audio File As..."; "lng_context_save_audio" = "Save Voice Message As..."; "lng_context_pack_info" = "Pack Info"; diff --git a/Telegram/Resources/sample.tdesktop-theme b/Telegram/Resources/sample.tdesktop-theme index 6a55e0c44..128f748a8 100644 --- a/Telegram/Resources/sample.tdesktop-theme +++ b/Telegram/Resources/sample.tdesktop-theme @@ -24,16 +24,17 @@ windowBg: #ffffff; windowTextFg: #000000; windowSubTextFg: #999999; -windowActiveFill: #40ace3; +windowActiveBg: #40ace3; +windowActiveFg: #ffffff; windowOverBg: #f0f0f0; windowSubTextFgOver: #7c99b2; -windowActiveTextFg: #1485c2; +windowActiveTextFg: #2687bf; windowShadowFg: #000000; imageBg: #000000; imageBgTransparent: #ffffff; -activeButtonBg: windowActiveFill; +activeButtonBg: windowActiveBg; activeButtonBgOver: #46b4eb; -activeButtonFg: #ffffff; +activeButtonFg: windowActiveFg; activeButtonFgOver: activeButtonFg; activeButtonSecondaryFg: #cceeff; activeButtonSecondaryFgOver: activeButtonSecondaryFg; @@ -41,7 +42,8 @@ lightButtonBg: windowBg; lightButtonBgOver: #edf7ff; lightButtonFg: #2b99d5; lightButtonFgOver: lightButtonFg; -menuIconFg: windowSubTextFg; +menuIconFg: #a8a8a8; +menuIconFgOver: #999999; titleBg: windowOverBg; titleShadow: #00000003; titleButtonFg: #ababab; @@ -75,13 +77,14 @@ settingsFixedBarBg: boxBg; settingsCloseFg: cancelIconFg; settingsCloseFgOver: cancelIconFgOver; notificationsBoxMonitorFg: windowTextFg; -notificationSampleUserpicFg: windowActiveFill; +notificationSampleUserpicFg: windowActiveBg; notificationSampleCloseFg: #d7d7d7; // windowSubTextFg; notificationSampleTextFg: #d7d7d7; // windowSubTextFg; notificationSampleNameFg: #939393; // windowSubTextFg; introHeaderFg: windowTextFg; introErrorFg: windowTextFg; dialogsMenuIconFg: menuIconFg; +dialogsMenuIconFgOver: menuIconFgOver; dialogsBg: windowBg; dialogsNameFg: #373737; dialogsChatIconFg: dialogsNameFg; @@ -93,7 +96,7 @@ dialogsVerifiedIconBg: #4abcf1; dialogsVerifiedIconFg: #ffffff; dialogsSendingIconFg: #c1c1c1; dialogsSentIconFg: #5dc452; -dialogsUnreadBg: windowActiveFill; +dialogsUnreadBg: windowActiveBg; dialogsUnreadBgMuted: #bbbbbb; dialogsUnreadFg: #ffffff; dialogsBgOver: windowOverBg; @@ -110,36 +113,36 @@ dialogsSentIconFgOver: dialogsSentIconFg; dialogsUnreadBgOver: dialogsUnreadBg; dialogsUnreadBgMutedOver: dialogsUnreadBgMuted; dialogsUnreadFgOver: dialogsUnreadFg; -dialogsBgActive: dialogsBgOver; -dialogsNameFgActive: dialogsNameFgOver; +dialogsBgActive: #419fd9; +dialogsNameFgActive: windowActiveFg; dialogsChatIconFgActive: dialogsNameFgActive; -dialogsDateFgActive: dialogsDateFgOver; -dialogsTextFgActive: dialogsTextFgOver; -dialogsTextFgServiceActive: dialogsTextFgServiceOver; -dialogsDraftFgActive: dialogsDraftFgOver; -dialogsVerifiedIconBgActive: dialogsVerifiedIconBgOver; -dialogsVerifiedIconFgActive: dialogsVerifiedIconFgOver; -dialogsSendingIconFgActive: dialogsSendingIconFgOver; -dialogsSentIconFgActive: dialogsSentIconFgOver; -dialogsUnreadBgActive: dialogsUnreadBgOver; -dialogsUnreadBgMutedActive: dialogsUnreadBgMutedOver; -dialogsUnreadFgActive: dialogsUnreadFgOver; -dialogsForwardFg: #ffffff; +dialogsDateFgActive: windowActiveFg; +dialogsTextFgActive: windowActiveFg; +dialogsTextFgServiceActive: dialogsTextFgActive; +dialogsDraftFgActive: #c6e1f7; +dialogsVerifiedIconBgActive: dialogsTextFgActive; +dialogsVerifiedIconFgActive: dialogsBgActive; +dialogsSendingIconFgActive: #ffffff99; +dialogsSentIconFgActive: dialogsTextFgActive; +dialogsUnreadBgActive: dialogsTextFgActive; +dialogsUnreadBgMutedActive: #d3e2ee; +dialogsUnreadFgActive: dialogsBgActive; +dialogsForwardBg: dialogsBgActive; +dialogsForwardFg: dialogsNameFgActive; topBarBg: windowBg; emojiPanBg: windowBg; emojiPanCategories: #f7f7f7; // windowBg; emojiPanHeaderFg: windowSubTextFg; emojiPanHeaderBg: #fffffff2; // emojiPanBg; historyComposeAreaBg: windowBg; -historyComposeIconFg: #cccccc; -historyComposeIconFgOver: #bebebe; +historyComposeIconFg: menuIconFg; +historyComposeIconFgOver: menuIconFgOver; historyPinnedBg: historyComposeAreaBg; historyReplyBg: historyComposeAreaBg; historyReplyCancelIconFg: cancelIconFg; historyReplyCancelIconFgOver: cancelIconFgOver; historySendBg: historyComposeAreaBg; historySendBgOver: #f5f5f5; // historySendBg; -historyMenuItemBgOver: historySendBgOver; historyTextInFg: windowTextFg; historyTextOutFg: windowTextFg; historyCaptionInFg: historyTextInFg; diff --git a/Telegram/Resources/telegram.qrc b/Telegram/Resources/telegram.qrc index 53c94d871..1ab21fca9 100644 --- a/Telegram/Resources/telegram.qrc +++ b/Telegram/Resources/telegram.qrc @@ -5,7 +5,7 @@ art/fonts/OpenSans-Semibold.ttf art/newmsg.wav art/bg.jpg - art/bg_old.png + art/bg_initial.png art/icon256.png art/iconbig256.png diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index 8203e2019..48e0a8b05 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -56,79 +56,83 @@ QString countBetaVersionSignature(quint64 version); typedef unsigned char uchar; typedef unsigned int uint32; typedef signed int int32; + namespace{ - inline uint32 sha1Shift(uint32 v, uint32 shift) { - return ((v << shift) | (v >> (32 - shift))); - } - void sha1PartHash(uint32 *sha, uint32 *temp) - { - uint32 a = sha[0], b = sha[1], c = sha[2], d = sha[3], e = sha[4], round = 0; - #define _shiftswap(f, v) { \ - uint32 t = sha1Shift(a, 5) + (f) + e + v + temp[round]; \ - e = d; \ - d = c; \ - c = sha1Shift(b, 30); \ - b = a; \ - a = t; \ - ++round; \ - } - #define _shiftshiftswap(f, v) { \ - temp[round] = sha1Shift((temp[round - 3] ^ temp[round - 8] ^ temp[round - 14] ^ temp[round - 16]), 1); \ - _shiftswap(f, v) \ - } - - while (round < 16) _shiftswap((b & c) | (~b & d), 0x5a827999) - while (round < 20) _shiftshiftswap((b & c) | (~b & d), 0x5a827999) - while (round < 40) _shiftshiftswap(b ^ c ^ d, 0x6ed9eba1) - while (round < 60) _shiftshiftswap((b & c) | (b & d) | (c & d), 0x8f1bbcdc) - while (round < 80) _shiftshiftswap(b ^ c ^ d, 0xca62c1d6) - - #undef _shiftshiftswap - #undef _shiftswap - - sha[0] += a; - sha[1] += b; - sha[2] += c; - sha[3] += d; - sha[4] += e; - } +inline uint32 sha1Shift(uint32 v, uint32 shift) { + return ((v << shift) | (v >> (32 - shift))); } +void sha1PartHash(uint32 *sha, uint32 *temp) { + uint32 a = sha[0], b = sha[1], c = sha[2], d = sha[3], e = sha[4], round = 0; + +#define _shiftswap(f, v) { \ + uint32 t = sha1Shift(a, 5) + (f) + e + v + temp[round]; \ + e = d; \ + d = c; \ + c = sha1Shift(b, 30); \ + b = a; \ + a = t; \ + ++round; \ + } + +#define _shiftshiftswap(f, v) { \ + temp[round] = sha1Shift((temp[round - 3] ^ temp[round - 8] ^ temp[round - 14] ^ temp[round - 16]), 1); \ + _shiftswap(f, v) \ + } + + while (round < 16) _shiftswap((b & c) | (~b & d), 0x5a827999) + while (round < 20) _shiftshiftswap((b & c) | (~b & d), 0x5a827999) + while (round < 40) _shiftshiftswap(b ^ c ^ d, 0x6ed9eba1) + while (round < 60) _shiftshiftswap((b & c) | (b & d) | (c & d), 0x8f1bbcdc) + while (round < 80) _shiftshiftswap(b ^ c ^ d, 0xca62c1d6) + +#undef _shiftshiftswap +#undef _shiftswap + + sha[0] += a; + sha[1] += b; + sha[2] += c; + sha[3] += d; + sha[4] += e; +} + +} // namespace + int32 *hashSha1(const void *data, uint32 len, void *dest) { const uchar *buf = (const uchar *)data; - uint32 temp[80], block = 0, end; - uint32 sha[5] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}; - for (end = block + 64; block + 64 <= len; end = block + 64) { - for (uint32 i = 0; block < end; block += 4) { - temp[i++] = (uint32) buf[block + 3] - | (((uint32) buf[block + 2]) << 8) - | (((uint32) buf[block + 1]) << 16) - | (((uint32) buf[block]) << 24); - } - sha1PartHash(sha, temp); - } + uint32 temp[80], block = 0, end; + uint32 sha[5] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0}; + for (end = block + 64; block + 64 <= len; end = block + 64) { + for (uint32 i = 0; block < end; block += 4) { + temp[i++] = (uint32) buf[block + 3] + | (((uint32) buf[block + 2]) << 8) + | (((uint32) buf[block + 1]) << 16) + | (((uint32) buf[block]) << 24); + } + sha1PartHash(sha, temp); + } - end = len - block; + end = len - block; memset(temp, 0, sizeof(uint32) * 16); - uint32 last = 0; - for (; last < end; ++last) { - temp[last >> 2] |= (uint32)buf[last + block] << ((3 - (last & 0x03)) << 3); - } - temp[last >> 2] |= 0x80 << ((3 - (last & 3)) << 3); - if (end >= 56) { - sha1PartHash(sha, temp); + uint32 last = 0; + for (; last < end; ++last) { + temp[last >> 2] |= (uint32)buf[last + block] << ((3 - (last & 0x03)) << 3); + } + temp[last >> 2] |= 0x80 << ((3 - (last & 3)) << 3); + if (end >= 56) { + sha1PartHash(sha, temp); memset(temp, 0, sizeof(uint32) * 16); - } - temp[15] = len << 3; - sha1PartHash(sha, temp); + } + temp[15] = len << 3; + sha1PartHash(sha, temp); uchar *sha1To = (uchar*)dest; - for (int32 i = 19; i >= 0; --i) { - sha1To[i] = (sha[i >> 2] >> (((3 - i) & 0x03) << 3)) & 0xFF; - } + for (int32 i = 19; i >= 0; --i) { + sha1To[i] = (sha[i >> 2] >> (((3 - i) & 0x03) << 3)) & 0xFF; + } return (int32*)sha1To; } diff --git a/Telegram/SourceFiles/_other/updater.cpp b/Telegram/SourceFiles/_other/updater.cpp index f70e65ca8..ef9f4a624 100644 --- a/Telegram/SourceFiles/_other/updater.cpp +++ b/Telegram/SourceFiles/_other/updater.cpp @@ -468,13 +468,13 @@ static const WCHAR *_exeName = L"Updater.exe"; LPTOP_LEVEL_EXCEPTION_FILTER _oldWndExceptionFilter = 0; typedef BOOL (FAR STDAPICALLTYPE *t_miniDumpWriteDump)( - _In_ HANDLE hProcess, - _In_ DWORD ProcessId, - _In_ HANDLE hFile, - _In_ MINIDUMP_TYPE DumpType, - _In_opt_ PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, - _In_opt_ PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, - _In_opt_ PMINIDUMP_CALLBACK_INFORMATION CallbackParam + _In_ HANDLE hProcess, + _In_ DWORD ProcessId, + _In_ HANDLE hFile, + _In_ MINIDUMP_TYPE DumpType, + _In_opt_ PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + _In_opt_ PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, + _In_opt_ PMINIDUMP_CALLBACK_INFORMATION CallbackParam ); t_miniDumpWriteDump miniDumpWriteDump = 0; @@ -483,7 +483,7 @@ HANDLE _generateDumpFileAtPath(const WCHAR *path) { WCHAR szPath[maxFileLen]; wsprintf(szPath, L"%stdata\\", path); - if (!CreateDirectory(szPath, NULL)) { + if (!CreateDirectory(szPath, NULL)) { if (GetLastError() != ERROR_ALREADY_EXISTS) { return 0; } @@ -495,7 +495,7 @@ HANDLE _generateDumpFileAtPath(const WCHAR *path) { } } - WCHAR szFileName[maxFileLen]; + WCHAR szFileName[maxFileLen]; WCHAR szExeName[maxFileLen]; wcscpy_s(szExeName, _exeName); @@ -504,16 +504,16 @@ HANDLE _generateDumpFileAtPath(const WCHAR *path) { wsprintf(dotFrom, L""); } - SYSTEMTIME stLocalTime; + SYSTEMTIME stLocalTime; - GetLocalTime(&stLocalTime); + GetLocalTime(&stLocalTime); - wsprintf(szFileName, L"%s%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", - szPath, szExeName, updaterVersionStr, - stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay, - stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond, - GetCurrentProcessId(), GetCurrentThreadId()); - return CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); + wsprintf(szFileName, L"%s%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", + szPath, szExeName, updaterVersionStr, + stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay, + stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond, + GetCurrentProcessId(), GetCurrentThreadId()); + return CreateFile(szFileName, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); } void _generateDump(EXCEPTION_POINTERS* pExceptionPointers) { @@ -553,16 +553,16 @@ void _generateDump(EXCEPTION_POINTERS* pExceptionPointers) { } MINIDUMP_EXCEPTION_INFORMATION ExpParam = {0}; - ExpParam.ThreadId = GetCurrentThreadId(); - ExpParam.ExceptionPointers = pExceptionPointers; - ExpParam.ClientPointers = TRUE; + ExpParam.ThreadId = GetCurrentThreadId(); + ExpParam.ExceptionPointers = pExceptionPointers; + ExpParam.ClientPointers = TRUE; - miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL); + miniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, &ExpParam, NULL, NULL); } LONG CALLBACK _exceptionFilter(EXCEPTION_POINTERS* pExceptionPointers) { _generateDump(pExceptionPointers); - return _oldWndExceptionFilter ? (*_oldWndExceptionFilter)(pExceptionPointers) : EXCEPTION_CONTINUE_SEARCH; + return _oldWndExceptionFilter ? (*_oldWndExceptionFilter)(pExceptionPointers) : EXCEPTION_CONTINUE_SEARCH; } // see http://www.codeproject.com/Articles/154686/SetUnhandledExceptionFilter-and-the-C-C-Runtime-Li diff --git a/Telegram/SourceFiles/boxes/backgroundbox.cpp b/Telegram/SourceFiles/boxes/backgroundbox.cpp index a31418997..70e1e1b0d 100644 --- a/Telegram/SourceFiles/boxes/backgroundbox.cpp +++ b/Telegram/SourceFiles/boxes/backgroundbox.cpp @@ -73,15 +73,14 @@ BackgroundBox::Inner::Inner(QWidget *parent) : TWidget(parent) void BackgroundBox::Inner::gotWallpapers(const MTPVector &result) { App::WallPapers wallpapers; - auto oldBackground = ImagePtr(qsl(":/gui/art/bg_old.png")); - wallpapers.push_back(App::WallPaper(Window::Theme::kOldBackground, oldBackground, oldBackground)); - const auto &v(result.c_vector().v); - for (int i = 0, l = v.size(); i < l; ++i) { - const auto &w(v.at(i)); + auto oldBackground = ImagePtr(qsl(":/gui/art/bg_initial.png")); + wallpapers.push_back(App::WallPaper(Window::Theme::kInitialBackground, oldBackground, oldBackground)); + auto &v = result.c_vector().v; + for_const (auto &w, v) { switch (w.type()) { case mtpc_wallPaper: { - const auto &d(w.c_wallPaper()); - const auto &sizes(d.vsizes.c_vector().v); + auto &d = w.c_wallPaper(); + auto &sizes = d.vsizes.c_vector().v; const MTPPhotoSize *thumb = 0, *full = 0; int32 thumbLevel = -1, fullLevel = -1; for (QVector::const_iterator j = sizes.cbegin(), e = sizes.cend(); j != e; ++j) { @@ -89,14 +88,14 @@ void BackgroundBox::Inner::gotWallpapers(const MTPVector &result) int32 w = 0, h = 0; switch (j->type()) { case mtpc_photoSize: { - const auto &s(j->c_photoSize().vtype.c_string().v); + auto &s = j->c_photoSize().vtype.c_string().v; if (s.size()) size = s[0]; w = j->c_photoSize().vw.v; h = j->c_photoSize().vh.v; } break; case mtpc_photoCachedSize: { - const auto &s(j->c_photoCachedSize().vtype.c_string().v); + auto &s = j->c_photoCachedSize().vtype.c_string().v; if (s.size()) size = s[0]; w = j->c_photoCachedSize().vw.v; h = j->c_photoCachedSize().vh.v; @@ -120,7 +119,7 @@ void BackgroundBox::Inner::gotWallpapers(const MTPVector &result) } break; case mtpc_wallPaperSolid: { - const auto &d(w.c_wallPaperSolid()); + auto &d = w.c_wallPaperSolid(); } break; } } diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index ff7d14d7b..293dc5ed8 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -166,13 +166,13 @@ contactsPhotoCheckbox: RoundImageCheckbox { imageRadius: 21px; imageSmallRadius: 18px; selectWidth: 2px; - selectFg: windowActiveFill; + selectFg: windowActiveBg; selectDuration: 150; checkBorder: windowBg; - checkBg: windowActiveFill; + checkBg: windowActiveBg; checkRadius: 10px; checkSmallRadius: 3px; - checkIcon: icon {{ "default_checkbox_check", windowBg, point(3px, 6px) }}; + checkIcon: icon {{ "default_checkbox_check", windowActiveFg, point(3px, 6px) }}; } contactsPhotoDisabledCheckFg: #bbbbbb; contactsNameCheckedFg: #2b88b8; diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 3f056af98..704741cae 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -356,7 +356,7 @@ void ContactsBox::onFilterUpdate(const QString &filter) { void ContactsBox::addPeerToMultiSelect(PeerData *peer, bool skipAnimation) { using AddItemWay = Ui::MultiSelect::AddItemWay; auto addItemWay = skipAnimation ? AddItemWay::SkipAnimation : AddItemWay::Default; - _select->entity()->addItem(peer->id, peer->shortName(), st::windowActiveFill, PaintUserpicCallback(peer), addItemWay); + _select->entity()->addItem(peer->id, peer->shortName(), st::activeButtonBg, PaintUserpicCallback(peer), addItemWay); } void ContactsBox::onPeerSelectedChanged(PeerData *peer, bool checked) { diff --git a/Telegram/SourceFiles/boxes/sharebox.cpp b/Telegram/SourceFiles/boxes/sharebox.cpp index 16a20cca7..9365d8b11 100644 --- a/Telegram/SourceFiles/boxes/sharebox.cpp +++ b/Telegram/SourceFiles/boxes/sharebox.cpp @@ -236,7 +236,7 @@ void ShareBox::onFilterUpdate(const QString &query) { void ShareBox::addPeerToMultiSelect(PeerData *peer, bool skipAnimation) { using AddItemWay = Ui::MultiSelect::AddItemWay; auto addItemWay = skipAnimation ? AddItemWay::SkipAnimation : AddItemWay::Default; - _select->addItem(peer->id, peer->shortName(), st::windowActiveFill, PaintUserpicCallback(peer), addItemWay); + _select->addItem(peer->id, peer->shortName(), st::activeButtonBg, PaintUserpicCallback(peer), addItemWay); } void ShareBox::onPeerSelectedChanged(PeerData *peer, bool checked) { diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 4d5ea7338..437c2c747 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -81,13 +81,16 @@ dialogsMenuToggle: IconButton { height: 32px; icon: icon {{ "dialogs_menu", dialogsMenuIconFg }}; + iconOver: icon {{ "dialogs_menu", dialogsMenuIconFgOver }}; iconPosition: point(6px, 6px); iconPositionDown: point(6px, 6px); } dialogsLock: IconButton(dialogsMenuToggle) { icon: icon {{ "dialogs_lock", dialogsMenuIconFg }}; + iconOver: icon {{ "dialogs_lock", dialogsMenuIconFgOver }}; } dialogsUnlockIcon: icon {{ "dialogs_unlock", dialogsMenuIconFg }}; +dialogsUnlockIconOver: icon {{ "dialogs_unlock", dialogsMenuIconFgOver }}; dialogsFilter: flatInput(inpDefGray) { font: font(fsize); @@ -114,10 +117,15 @@ dialogsMenu: DropdownMenu(defaultDropdownMenu) { } dialogsMenuPosition: point(-3px, -2px); dialogsMenuNewGroup: icon {{ "menu_new_group", menuIconFg }}; +dialogsMenuNewGroupOver: icon {{ "menu_new_group", menuIconFgOver }}; dialogsMenuNewChannel: icon {{ "menu_new_channel", menuIconFg }}; +dialogsMenuNewChannelOver: icon {{ "menu_new_channel", menuIconFgOver }}; dialogsMenuContacts: icon {{ "menu_contacts", menuIconFg }}; +dialogsMenuContactsOver: icon {{ "menu_contacts", menuIconFgOver }}; dialogsMenuSettings: icon {{ "menu_settings", menuIconFg }}; +dialogsMenuSettingsOver: icon {{ "menu_settings", menuIconFgOver }}; dialogsMenuHelp: icon {{ "menu_help", menuIconFg }}; +dialogsMenuHelpOver: icon {{ "menu_help", menuIconFgOver }}; dialogsChatTypeSkip: 22px; dialogsChatIcon: icon {{ "dialogs_chat", dialogsChatIconFg, point(1px, 4px) }}; @@ -191,4 +199,3 @@ dialogsForwardCancel: IconButton { iconPositionDown: point(12px, 11px); } dialogsForwardFont: semiboldFont; -dialogsForwardBg: windowActiveFill; diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 93679c934..cf6a0a662 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -1701,7 +1701,7 @@ DialogsWidget::DialogsWidget(QWidget *parent) : TWidget(parent) _lockUnlock->setVisible(Global::LocalPasscode()); subscribe(Global::RefLocalPasscodeChanged(), [this] { updateLockUnlockVisibility(); }); _lockUnlock->setClickedCallback([this] { - _lockUnlock->setIcon(&st::dialogsUnlockIcon); + _lockUnlock->setIcon(&st::dialogsUnlockIcon, &st::dialogsUnlockIconOver); App::wnd()->setupPasscode(); _lockUnlock->setIcon(nullptr); }); @@ -2016,19 +2016,19 @@ void DialogsWidget::showMainMenu() { _mainMenu.create(this, st::dialogsMenu); _mainMenu->addAction(lang(lng_create_group_title), [] { App::wnd()->onShowNewGroup(); - }, &st::dialogsMenuNewGroup); + }, &st::dialogsMenuNewGroup, &st::dialogsMenuNewGroupOver); _mainMenu->addAction(lang(lng_create_channel_title), [] { App::wnd()->onShowNewChannel(); - }, &st::dialogsMenuNewChannel); + }, &st::dialogsMenuNewChannel, &st::dialogsMenuNewChannelOver); _mainMenu->addAction(lang(lng_menu_contacts), [] { Ui::showLayer(new ContactsBox()); - }, &st::dialogsMenuContacts); + }, &st::dialogsMenuContacts, &st::dialogsMenuContactsOver); _mainMenu->addAction(lang(lng_menu_settings), [] { App::wnd()->showSettings(); - }, &st::dialogsMenuSettings); + }, &st::dialogsMenuSettings, &st::dialogsMenuSettingsOver); _mainMenu->addAction(lang(lng_settings_faq), [] { QDesktopServices::openUrl(telegramFaqLink()); - }, &st::dialogsMenuHelp); + }, &st::dialogsMenuHelp, &st::dialogsMenuHelpOver); } updateMainMenuGeometry(); _mainMenu->showAnimated(); diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index 6f21d0d5a..d373a3282 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -157,32 +157,19 @@ historyComposeField: flatTextarea { historyComposeFieldMaxHeight: 224px; // historyMinHeight: 56px; -historyMediaTypeFile: icon {{ "media_type_file", historyComposeIconFg, point(2px, 2px) }}; -historyMediaTypeFileOver: icon {{ "media_type_file", historyComposeIconFgOver, point(2px, 2px) }}; -historyMediaTypePhoto: icon {{ "media_type_photo", historyComposeIconFg, point(2px, 2px) }}; -historyMediaTypePhotoOver: icon {{ "media_type_photo", historyComposeIconFgOver, point(2px, 2px) }}; -historyMediaTypeVideo: icon {{ "media_type_video", historyComposeIconFg, point(2px, 2px) }}; -historyMediaTypeVideoOver: icon {{ "media_type_video", historyComposeIconFgOver, point(2px, 2px) }}; -historyMediaTypeSong: icon {{ "media_type_song", historyComposeIconFg, point(0px, 0px) }}; -historyMediaTypeSongOver: icon {{ "media_type_song", historyComposeIconFgOver, point(0px, 0px) }}; -historyMediaTypeVoice: icon {{ "media_type_voice", historyComposeIconFg, point(2px, 2px) }}; -historyMediaTypeVoiceOver: icon {{ "media_type_voice", historyComposeIconFgOver, point(2px, 2px) }}; -historyMediaTypeLink: icon {{ "media_type_link", historyComposeIconFg, point(2px, 2px) }}; -historyMediaTypeLinkOver: icon {{ "media_type_link", historyComposeIconFgOver, point(2px, 2px) }}; - historyAttachDocument: IconButton { width: 46px; height: 46px; - icon: historyMediaTypeFile; - iconOver: historyMediaTypeFileOver; + icon: icon {{ "media_type_file", historyComposeIconFg, point(2px, 2px) }}; + iconOver: icon {{ "media_type_file", historyComposeIconFgOver, point(2px, 2px) }}; iconPosition: point(9px, 9px); iconPositionDown: point(9px, 10px); } historyAttachPhoto: IconButton(historyAttachDocument) { - icon: historyMediaTypePhoto; - iconOver: historyMediaTypePhotoOver; + icon: icon {{ "media_type_photo", historyComposeIconFg, point(2px, 2px) }}; + iconOver: icon {{ "media_type_photo", historyComposeIconFgOver, point(2px, 2px) }}; } historyAttachEmoji: IconButton(historyAttachDocument) { width: 33px; @@ -233,11 +220,23 @@ historyRecordFont: font(13px); historyRecordDurationFg: #000000; historyRecordTextTop: 14px; +historyMediaTypeFile: icon {{ "media_type_file", menuIconFg, point(2px, 2px) }}; +historyMediaTypeFileOver: icon {{ "media_type_file", menuIconFgOver, point(2px, 2px) }}; +historyMediaTypePhoto: icon {{ "media_type_photo", menuIconFg, point(2px, 2px) }}; +historyMediaTypePhotoOver: icon {{ "media_type_photo", menuIconFgOver, point(2px, 2px) }}; +historyMediaTypeVideo: icon {{ "media_type_video", menuIconFg, point(2px, 2px) }}; +historyMediaTypeVideoOver: icon {{ "media_type_video", menuIconFgOver, point(2px, 2px) }}; +historyMediaTypeSong: icon {{ "media_type_song", menuIconFg, point(0px, 0px) }}; +historyMediaTypeSongOver: icon {{ "media_type_song", menuIconFgOver, point(0px, 0px) }}; +historyMediaTypeVoice: icon {{ "media_type_voice", menuIconFg, point(2px, 2px) }}; +historyMediaTypeVoiceOver: icon {{ "media_type_voice", menuIconFgOver, point(2px, 2px) }}; +historyMediaTypeLink: icon {{ "media_type_link", menuIconFg, point(2px, 2px) }}; +historyMediaTypeLinkOver: icon {{ "media_type_link", menuIconFgOver, point(2px, 2px) }}; + historyAttachDropdownMenu: DropdownMenu(defaultDropdownMenu) { menu: Menu(defaultMenu) { skip: 5px; - itemBgOver: historyMenuItemBgOver; itemIconPosition: point(12px, 6px); itemPadding: margins(48px, 11px, 48px, 11px); } @@ -277,15 +276,15 @@ topBarSearch: IconButton { width: 44px; height: topBarHeight; - icon: icon {{ "title_search", #a8a8a8 }}; - iconOver: icon {{ "title_search", #a3a3a3 }}; + icon: icon {{ "title_search", menuIconFg }}; + iconOver: icon {{ "title_search", menuIconFgOver }}; iconPosition: point(13px, 18px); iconPositionDown: point(13px, 18px); } topBarMenuToggle: IconButton(topBarSearch) { - icon: icon {{ "title_menu_dots", #a8a8a8 }}; - iconOver: icon {{ "title_menu_dots", #a3a3a3 }}; + icon: icon {{ "title_menu_dots", menuIconFg }}; + iconOver: icon {{ "title_menu_dots", menuIconFgOver }}; iconPosition: point(18px, 17px); iconPositionDown: point(18px, 17px); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 8a1d11b03..08159e603 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -5004,8 +5004,8 @@ void HistoryWidget::loadMessages() { return firstLoadMessages(); } - bool loadMigrated = _migrated && (_history->isEmpty() || _history->loadedAtTop() || (!_migrated->isEmpty() && !_migrated->loadedAtBottom())); - History *from = loadMigrated ? _migrated : _history; + auto loadMigrated = _migrated && (_history->isEmpty() || _history->loadedAtTop() || (!_migrated->isEmpty() && !_migrated->loadedAtBottom())); + auto from = loadMigrated ? _migrated : _history; if (from->loadedAtTop()) { return; } diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index a4d188441..d56a65240 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -3630,8 +3630,7 @@ void writeBackground(int32 id, const QImage &img) { } quint32 size = sizeof(qint32) + sizeof(quint32) + (bmp.isEmpty() ? 0 : (sizeof(quint32) + bmp.size())); EncryptedDescriptor data(size); - data.stream << qint32(id); - if (!bmp.isEmpty()) data.stream << bmp; + data.stream << qint32(id) << bmp; FileWriteDescriptor file(_backgroundKey); file.writeEncrypted(data); @@ -3653,21 +3652,21 @@ bool readBackground() { QByteArray pngData; qint32 id; - bg.stream >> id; - if (id == Window::Theme::kOldBackground || id == Window::Theme::kDefaultBackground) { + bg.stream >> id >> pngData; + auto oldEmptyImage = (bg.stream.status() != QDataStream::Ok); + if (oldEmptyImage + || id == Window::Theme::kInitialBackground + || id == Window::Theme::kDefaultBackground) { _backgroundCanWrite = false; - if (bg.version < 8005) { + if (oldEmptyImage || bg.version < 8005) { Window::Theme::Background()->setImage(Window::Theme::kDefaultBackground); - if (id == Window::Theme::kOldBackground) { - Window::Theme::Background()->setTile(false); - } + Window::Theme::Background()->setTile(false); } else { Window::Theme::Background()->setImage(id); } _backgroundCanWrite = true; return true; } - bg.stream >> pngData; QImage image; QBuffer buf(&pngData); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 72780f900..3f9ff7e99 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1925,7 +1925,9 @@ void MainWidget::checkChatBackground() { if (_background->full->loaded()) { if (_background->full->isNull()) { Window::Theme::Background()->setImage(Window::Theme::kDefaultBackground); - } else if (_background->id == Window::Theme::kOldBackground || _background->id == Window::Theme::kDefaultBackground) { + } else if (false + || _background->id == Window::Theme::kInitialBackground + || _background->id == Window::Theme::kDefaultBackground) { Window::Theme::Background()->setImage(_background->id); } else { Window::Theme::Background()->setImage(_background->id, _background->full->pix().toImage()); diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index da17f3560..e3dd2d5ee 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -159,8 +159,8 @@ void MainWindow::onStateChanged(Qt::WindowState state) { savePosition(state); } -void MainWindow::init() { - Platform::MainWindow::init(); +void MainWindow::initHook() { + Platform::MainWindow::initHook(); setWindowIcon(wndIcon); @@ -198,6 +198,7 @@ void MainWindow::firstShow() { trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true); } psUpdateWorkmode(); + psFirstShow(); updateTrayMenu(); diff --git a/Telegram/SourceFiles/mainwindow.h b/Telegram/SourceFiles/mainwindow.h index 0fd6813a8..a40ca68b4 100644 --- a/Telegram/SourceFiles/mainwindow.h +++ b/Telegram/SourceFiles/mainwindow.h @@ -77,7 +77,6 @@ public: MainWindow(); ~MainWindow(); - void init(); void firstShow(); QWidget *filedialogParent(); @@ -168,6 +167,8 @@ protected: void closeEvent(QCloseEvent *e) override; void resizeEvent(QResizeEvent *e) override; + void initHook() override; + public slots: void updateIsActive(int timeout = 0); diff --git a/Telegram/SourceFiles/platform/win/window_title_win.cpp b/Telegram/SourceFiles/platform/win/window_title_win.cpp index a27c96f5d..32437e143 100644 --- a/Telegram/SourceFiles/platform/win/window_title_win.cpp +++ b/Telegram/SourceFiles/platform/win/window_title_win.cpp @@ -47,11 +47,12 @@ TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent) }); setAttribute(Qt::WA_OpaquePaintEvent); +} + +void TitleWidget::init() { + connect(window()->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState))); + _maximized = (window()->windowState() & Qt::WindowMaximized); updateMaximizeRestoreButton(); - - onWindowStateChanged(); - - connect(parent->window()->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState))); } void TitleWidget::paintEvent(QPaintEvent *e) { diff --git a/Telegram/SourceFiles/platform/win/window_title_win.h b/Telegram/SourceFiles/platform/win/window_title_win.h index 49a4f11d2..cc7a0fa49 100644 --- a/Telegram/SourceFiles/platform/win/window_title_win.h +++ b/Telegram/SourceFiles/platform/win/window_title_win.h @@ -35,6 +35,8 @@ class TitleWidget : public Window::TitleWidget, private base::Subscriber { public: TitleWidget(QWidget *parent); + void init() override; + Window::HitTestResult hitTest(const QPoint &p) const override; public slots: diff --git a/Telegram/SourceFiles/profile/profile.style b/Telegram/SourceFiles/profile/profile.style index 5c7ffca41..efc6ff1ed 100644 --- a/Telegram/SourceFiles/profile/profile.style +++ b/Telegram/SourceFiles/profile/profile.style @@ -60,11 +60,11 @@ profilePrimaryButton: defaultActiveButton; profileSecondaryButton: defaultLightButton; profileAddMemberButton: RoundButton(profileSecondaryButton) { width: 62px; - icon: icon {{ "profile_add_member", windowActiveFill, point(20px, 10px) }}; + icon: icon {{ "profile_add_member", lightButtonFg, point(20px, 10px) }}; } profileDropAreaBg: profileBg; -profileDropAreaFg: windowActiveFill; +profileDropAreaFg: lightButtonFg; profileDropAreaPadding: margins(25px, 3px, 25px, 20px); profileDropAreaTitleFont: font(24px); profileDropAreaTitleTop: 30px; diff --git a/Telegram/SourceFiles/stickers/emoji_pan.cpp b/Telegram/SourceFiles/stickers/emoji_pan.cpp index 7b0873f00..4bb43c4d2 100644 --- a/Telegram/SourceFiles/stickers/emoji_pan.cpp +++ b/Telegram/SourceFiles/stickers/emoji_pan.cpp @@ -2135,7 +2135,7 @@ void StickerPanInner::updateSelected() { t_assert(row >= 0 && row < _inlineRows.size() && col >= 0 && col < _inlineRows.at(row).items.size()); Ui::repaintInlineItem(_inlineRows.at(row).items.at(col)); } - if (_pressed >= 0 && _selected >= 0 && _pressed != _selected) { + if (_previewShown && _selected >= 0 && _pressed != _selected) { _pressed = _selected; if (row >= 0 && col >= 0) { auto layout = _inlineRows.at(row).items.at(col); @@ -2260,7 +2260,7 @@ void StickerPanInner::updateSelected() { } } _selected = selIndex; - if (_pressed >= 0 && _selected >= 0 && _pressed != _selected) { + if (_previewShown && _selected >= 0 && _pressed != _selected) { _pressed = _selected; if (newSel >= 0 && xNewSel < 0) { Ui::showMediaPreview(sets.at(newSelTab).pack.at(newSel % MatrixRowShift)); diff --git a/Telegram/SourceFiles/stickers/stickers.style b/Telegram/SourceFiles/stickers/stickers.style index 91ba059a5..752abc675 100644 --- a/Telegram/SourceFiles/stickers/stickers.style +++ b/Telegram/SourceFiles/stickers/stickers.style @@ -56,7 +56,7 @@ stickersFeaturedUnreadBg: msgFileInBg; stickersFeaturedUnreadSize: 5px; stickersFeaturedUnreadSkip: 5px; stickersFeaturedUnreadTop: 7px; -stickersFeaturedInstalled: icon {{ "mediaview_save_check", windowActiveFill }}; +stickersFeaturedInstalled: icon {{ "mediaview_save_check", lightButtonFg }}; stickersMaxHeight: 440px; stickersPadding: margins(19px, 17px, 19px, 17px); diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 2e0b1c931..a49e87450 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -28,10 +28,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org namespace Window { -MainWindow::MainWindow() : QMainWindow() +MainWindow::MainWindow() : QWidget() , _positionUpdatedTimer(this) , _body(this) { - setCentralWidget(_body); subscribe(Theme::Background(), [this](const Theme::BackgroundUpdate &data) { using Type = Theme::BackgroundUpdate::Type; if (data.type == Type::TestingTheme || data.type == Type::RevertingTheme || data.type == Type::ApplyingTheme) { @@ -40,20 +39,21 @@ MainWindow::MainWindow() : QMainWindow() } } }); + + _title = Platform::CreateTitleWidget(this); } void MainWindow::init() { _positionUpdatedTimer->setSingleShot(true); connect(_positionUpdatedTimer, SIGNAL(timeout()), this, SLOT(savePositionByTimer())); - _title = Platform::CreateTitleWidget(this); - auto p = palette(); p.setColor(QPalette::Window, st::windowBg->c); setPalette(p); - initSize(); + if (_title) _title->init(); + initSize(); initHook(); } diff --git a/Telegram/SourceFiles/window/main_window.h b/Telegram/SourceFiles/window/main_window.h index 319b52163..f1c0e8fc4 100644 --- a/Telegram/SourceFiles/window/main_window.h +++ b/Telegram/SourceFiles/window/main_window.h @@ -26,7 +26,7 @@ namespace Window { class TitleWidget; -class MainWindow : public QMainWindow, protected base::Subscriber { +class MainWindow : public QWidget, protected base::Subscriber { Q_OBJECT public: diff --git a/Telegram/SourceFiles/window/window.style b/Telegram/SourceFiles/window/window.style index 0253aa14d..06a2cdfe0 100644 --- a/Telegram/SourceFiles/window/window.style +++ b/Telegram/SourceFiles/window/window.style @@ -76,7 +76,7 @@ notifySendReply: IconButton { width: 36px; height: 36px; - icon: icon {{ "notification_send", windowActiveFill, point(3px, 9px) }}; + icon: icon {{ "notification_send", lightButtonFg, point(3px, 9px) }}; iconPosition: point(0px, 0px); iconPositionDown: point(0px, 1px); } diff --git a/Telegram/SourceFiles/window/window_theme.cpp b/Telegram/SourceFiles/window/window_theme.cpp index 6a107cb8c..9865d38f1 100644 --- a/Telegram/SourceFiles/window/window_theme.cpp +++ b/Telegram/SourceFiles/window/window_theme.cpp @@ -440,18 +440,18 @@ void ChatBackground::setImage(int32 id, QImage &&image) { } setPreparedImage(std_::move(image)); } else { - if (_id == kDefaultBackground) { - image.load(qsl(":/gui/art/bg.jpg")); - } else if (_id == kOldBackground || image.isNull()) { - _id = kOldBackground; - image.load(qsl(":/gui/art/bg_old.png")); + if (_id == kInitialBackground) { + image.load(qsl(":/gui/art/bg_initial.png")); if (cRetina()) { image = image.scaledToWidth(image.width() * 2, Qt::SmoothTransformation); } else if (cScale() != dbisOne) { image = image.scaledToWidth(convertScale(image.width()), Qt::SmoothTransformation); } + } else if (_id == kDefaultBackground || image.isNull()) { + _id = kDefaultBackground; + image.load(qsl(":/gui/art/bg.jpg")); } - Local::writeBackground(_id, (_id == kDefaultBackground || _id == kOldBackground) ? QImage() : image); + Local::writeBackground(_id, (_id == kDefaultBackground || _id == kInitialBackground) ? QImage() : image); setPreparedImage(prepareBackgroundImage(std_::move(image))); } t_assert(!_image.isNull()); diff --git a/Telegram/SourceFiles/window/window_theme.h b/Telegram/SourceFiles/window/window_theme.h index 85c9d8b52..06b21e224 100644 --- a/Telegram/SourceFiles/window/window_theme.h +++ b/Telegram/SourceFiles/window/window_theme.h @@ -32,8 +32,8 @@ constexpr int32 kTestingDefaultBackground = -665; constexpr int32 kThemeBackground = -2; constexpr int32 kCustomBackground = -1; -constexpr int32 kOldBackground = 0; -constexpr int32 kDefaultBackground = 21; +constexpr int32 kInitialBackground = 0; +constexpr int32 kDefaultBackground = 105; struct Cached { QByteArray colors; diff --git a/Telegram/SourceFiles/window/window_title.h b/Telegram/SourceFiles/window/window_title.h index 15dad581d..578812eb3 100644 --- a/Telegram/SourceFiles/window/window_title.h +++ b/Telegram/SourceFiles/window/window_title.h @@ -40,6 +40,9 @@ enum class HitTestResult { class TitleWidget : public TWidget { public: using TWidget::TWidget; + + virtual void init() { + } virtual HitTestResult hitTest(const QPoint &p) const { return HitTestResult::None; }