diff --git a/Telegram/Resources/art/sprite.png b/Telegram/Resources/art/sprite.png index e1f577849..e4de99008 100644 Binary files a/Telegram/Resources/art/sprite.png and b/Telegram/Resources/art/sprite.png differ diff --git a/Telegram/Resources/art/sprite_200x.png b/Telegram/Resources/art/sprite_200x.png index 9eaedee27..cd36753b0 100644 Binary files a/Telegram/Resources/art/sprite_200x.png and b/Telegram/Resources/art/sprite_200x.png differ diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index ab01b4e09..c0010e927 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -248,9 +248,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", #ffffff, point(4px, 7px) }}; font: normalFont; duration: 120; @@ -445,47 +443,29 @@ titleButtonDuration: 150; sysBtnDelta: 6px; sysUpd: sysButton { size: size(31px, 39px); - img: sprite(184px, 1px, 19px, 19px); + icon: icon {{ "title_button_update", titleBg }}; color: titleButtonFg; overColor: titleButtonActiveFg; duration: titleButtonDuration; } updateBlinkDuration: 500; sysMin: sysButton(sysUpd) { - img: sprite(207px, 1px, 19px, 19px); + icon: icon {{ "title_button_minimize", titleBg }}; } sysMax: sysButton(sysUpd) { - img: sprite(230px, 1px, 19px, 19px); + icon: icon {{ "title_button_maximize", titleBg }}; } sysRes: sysButton(sysUpd) { - img: sprite(253px, 1px, 19px, 19px); + icon: icon {{ "title_button_restore", titleBg }}; } sysCls: sysButton(sysUpd) { - img: sprite(276px, 1px, 19px, 19px); + icon: icon {{ "title_button_close", titleBg }}; } sysLock: sysButton(sysUpd) { - img: sprite(184px, 22px, 19px, 19px); + icon: icon {{ "title_button_lock", titleBg }}; } sysUnlock: sysButton(sysUpd) { - img: sprite(207px, 22px, 19px, 19px); -} -titleBackButton: iconedButton(btnDefIconed) { - icon: sprite(9px, 104px, 13px, 20px); - iconPos: point(5px, 9px); - downIcon: sprite(9px, 104px, 13px, 20px); - downIconPos: point(5px, 10px); - - bgColor: #c4d8e9; - overBgColor: #fff; - - width: -30px; - height: 39px; - - opacity: 1.; - cursor: cursor(default); - - textPos: point(23px, 10px); - downTextPos: point(23px, 11px); + icon: icon {{ "title_button_unlock", titleBg }}; } btnWhiteHover: #f5f5f5; @@ -811,18 +791,6 @@ noContactsHeight: 100px; noContactsFont: font(fsize); noContactsColor: #777; -dlgDblCheckImg: sprite(302px, 23px, 17px, 11px); -dlgCheckImg: sprite(320px, 23px, 17px, 11px); -dlgActiveDblCheckImg: sprite(302px, 36px, 17px, 11px); -dlgActiveCheckImg: sprite(320px, 36px, 17px, 11px); -dlgSendImg: sprite(122px, 25px, 17px, 11px); -dlgActiveSendImg: sprite(142px, 25px, 17px, 11px); - -dlgChatImg: sprite(104px, 26px, 16px, 11px); -dlgActiveChatImg: sprite(104px, 37px, 16px, 11px); -dlgChannelImg: sprite(105px, 1px, 12px, 11px); -dlgActiveChannelImg: sprite(105px, 14px, 12px, 11px); - dlgFilter: flatInput(inpDefGray) { font: font(fsize); bgColor: #f2f2f2; @@ -954,9 +922,7 @@ msgReplyPadding: margins(6px, 6px, 11px, 6px); msgReplyBarPos: point(1px, 0px); msgReplyBarSize: size(2px, 36px); msgReplyBarSkip: 10px; -msgOutReplyBarColor: #5dc452; msgInReplyBarColor: #2fa9e2; -msgOutReplyBarSelColor: #4da79f; msgInReplyBarSelColor: #2fa9e2; msgBotKbDuration: 200; @@ -990,28 +956,7 @@ msgPtr: 8px; msgBG: ":/gui/art/bg.jpg"; msgBG0: ":/gui/art/bg0.png"; -msgCheckPos: point(3px, 1px); -msgSendingImg: sprite(260px, 20px, 20px, 20px); -msgCheckImg: sprite(320px, 0px, 20px, 20px); -msgDblCheckImg: sprite(300px, 0px, 20px, 20px); -msgSelectCheckImg: sprite(162px, 0px, 20px, 20px); -msgSelectDblCheckImg: sprite(142px, 0px, 20px, 20px); -msgViewsPos: point(0px, -4px); -msgViewsImg: sprite(104px, 48px, 16px, 11px); -msgSelectViewsImg: sprite(104px, 70px, 16px, 11px); -msgOutViewsImg: sprite(104px, 81px, 16px, 11px); -msgSelectOutViewsImg: sprite(104px, 92px, 16px, 11px); -msgSendingViewsImg: sprite(104px, 103px, 16px, 11px); -msgSendingOutViewsImg: sprite(104px, 125px, 16px, 11px); -msgInvSendingImg: sprite(320px, 65px, 20px, 20px); -msgInvCheckImg: sprite(280px, 20px, 20px, 20px); -msgInvDblCheckImg: sprite(300px, 65px, 20px, 20px); -msgInvViewsImg: sprite(104px, 59px, 16px, 11px); -msgInvSendingViewsImg: sprite(104px, 114px, 16px, 11px); - msgDateSpace: 12px; -msgDateCheckSpace: 4px; -msgDateViewsSpace: 11px; msgDateDelta: point(2px, 5px); msgDateImgDelta: 4px; @@ -1171,31 +1116,6 @@ msgFileOutBg: #78c67f; msgFileOutBgOver: #6bc272; msgFileOutBgSelected: #5fb389; -msgFileOutImage: sprite(0px, 146px, 18px, 18px); -msgFileOutImageSelected: sprite(18px, 146px, 18px, 18px); -msgFileInImage: sprite(0px, 164px, 18px, 18px); -msgFileInImageSelected: sprite(18px, 164px, 18px, 18px); -msgFileOutFile: sprite(36px, 146px, 18px, 18px); -msgFileOutFileSelected: sprite(54px, 146px, 18px, 18px); -msgFileInFile: sprite(36px, 164px, 18px, 18px); -msgFileInFileSelected: sprite(54px, 164px, 18px, 18px); -msgFileOutDownload: sprite(72px, 142px, 14px, 20px); -msgFileOutDownloadSelected: sprite(86px, 142px, 14px, 20px); -msgFileInDownload: sprite(72px, 162px, 14px, 20px); -msgFileInDownloadSelected: sprite(86px, 162px, 14px, 20px); -msgFileOutCancel: sprite(100px, 147px, 16px, 16px); -msgFileOutCancelSelected: sprite(116px, 147px, 16px, 16px); -msgFileInCancel: sprite(100px, 165px, 16px, 16px); -msgFileInCancelSelected: sprite(116px, 165px, 16px, 16px); -msgFileOutPause: sprite(132px, 147px, 14px, 16px); -msgFileOutPauseSelected: sprite(146px, 147px, 14px, 16px); -msgFileInPause: sprite(132px, 165px, 14px, 16px); -msgFileInPauseSelected: sprite(146px, 165px, 14px, 16px); -msgFileOutPlay: sprite(160px, 146px, 20px, 18px); -msgFileOutPlaySelected: sprite(180px, 146px, 20px, 18px); -msgFileInPlay: sprite(160px, 164px, 20px, 18px); -msgFileInPlaySelected: sprite(180px, 164px, 20px, 18px); - msgFileRed: sprite(0px, 425px, 20px, 20px); msgFileYellow: sprite(20px, 425px, 20px, 20px); msgFileGreen: sprite(40px, 425px, 20px, 20px); @@ -1627,9 +1547,7 @@ dropdownDef: dropdown { width: 0px; } -defaultInnerDropdownShadow: icon { - { "dropdown_shadow", windowShadowFg }, -}; +defaultInnerDropdownShadow: icon {{ "dropdown_shadow", windowShadowFg }}; defaultInnerDropdown: InnerDropdown { padding: margins(10px, 10px, 10px, 10px); shadow: defaultInnerDropdownShadow; @@ -1863,10 +1781,6 @@ stickerPreviewDuration: 150; stickerPreviewBg: #FFFFFFB0; stickerPreviewMin: 0.1; -verifiedCheck: sprite(285px, 221px, 14px, 14px); -verifiedCheckInv: sprite(299px, 221px, 14px, 14px); -verifiedCheckPos: point(4px, 2px); - botKbDuration: 200; botKbBg: #edf1f5; botKbOverBg: #d8e2ec; @@ -1925,12 +1839,6 @@ mvControlMargin: 0px; mvControlSize: 90px; mvIconSize: size(60px, 56px); -mvLeft: sprite(320px, 445px, 12px, 22px); -mvRight: sprite(332px, 445px, 12px, 22px); -mvClose: sprite(344px, 445px, 18px, 18px); -mvSave: sprite(362px, 445px, 14px, 19px); -mvMore: sprite(376px, 445px, 5px, 21px); - mvDropdown: dropdown(dropdownDef) { shadow: sprite(0px, 0px, 0px, 0px); padding: margins(11px, 12px, 11px, 12px); @@ -1992,10 +1900,6 @@ mvDocExtFont: font(semibold 18px); mvDocExtColor: white; mvDocExtPadding: 10px; mvDocLinksTop: 57px; -mvDocRed: sprite(0px, 400px, 25px, 25px); -mvDocYellow: sprite(25px, 400px, 25px, 25px); -mvDocGreen: sprite(50px, 400px, 25px, 25px); -mvDocBlue: sprite(75px, 400px, 25px, 25px); mvDocIconSize: 80px; mvDocLink: linkButton(btnDefLink) { @@ -2013,9 +1917,7 @@ mvCaptionRadius: 2px; mvCaptionBg: #11111180; mvCaptionFont: font(fsize); -medviewSaveMsgCheck: icon { - { "mediaview_save_check", #ffffff } -}; +medviewSaveMsgCheck: icon {{ "mediaview_save_check", #ffffff }}; medviewSaveMsgFont: font(16px); medviewSaveMsgPadding: margins(55px, 19px, 29px, 20px); medviewSaveMsgCheckPos: point(23px, 21px); diff --git a/Telegram/Resources/basic_types.style b/Telegram/Resources/basic_types.style index 1d5d57f76..29724f60b 100644 --- a/Telegram/Resources/basic_types.style +++ b/Telegram/Resources/basic_types.style @@ -40,7 +40,7 @@ linkButton { sysButton { size: size; - img: sprite; + icon: icon; color: color; overColor: color; duration: int; diff --git a/Telegram/Resources/icons/dialogs_channel.png b/Telegram/Resources/icons/dialogs_channel.png new file mode 100644 index 000000000..a47d6e293 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_channel.png differ diff --git a/Telegram/Resources/icons/dialogs_channel@2x.png b/Telegram/Resources/icons/dialogs_channel@2x.png new file mode 100644 index 000000000..b02ba1a28 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_channel@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_chat.png b/Telegram/Resources/icons/dialogs_chat.png new file mode 100644 index 000000000..a17196562 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_chat.png differ diff --git a/Telegram/Resources/icons/dialogs_chat@2x.png b/Telegram/Resources/icons/dialogs_chat@2x.png new file mode 100644 index 000000000..f49e61f08 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_chat@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_received.png b/Telegram/Resources/icons/dialogs_received.png new file mode 100644 index 000000000..e49b4237b Binary files /dev/null and b/Telegram/Resources/icons/dialogs_received.png differ diff --git a/Telegram/Resources/icons/dialogs_received@2x.png b/Telegram/Resources/icons/dialogs_received@2x.png new file mode 100644 index 000000000..55895e72f Binary files /dev/null and b/Telegram/Resources/icons/dialogs_received@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_sending.png b/Telegram/Resources/icons/dialogs_sending.png new file mode 100644 index 000000000..f8069970f Binary files /dev/null and b/Telegram/Resources/icons/dialogs_sending.png differ diff --git a/Telegram/Resources/icons/dialogs_sending@2x.png b/Telegram/Resources/icons/dialogs_sending@2x.png new file mode 100644 index 000000000..f83e71981 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_sending@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_sent.png b/Telegram/Resources/icons/dialogs_sent.png new file mode 100644 index 000000000..341f6d3b9 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_sent.png differ diff --git a/Telegram/Resources/icons/dialogs_sent@2x.png b/Telegram/Resources/icons/dialogs_sent@2x.png new file mode 100644 index 000000000..10ff7a134 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_sent@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_verified_check.png b/Telegram/Resources/icons/dialogs_verified_check.png new file mode 100644 index 000000000..67b732e6d Binary files /dev/null and b/Telegram/Resources/icons/dialogs_verified_check.png differ diff --git a/Telegram/Resources/icons/dialogs_verified_check@2x.png b/Telegram/Resources/icons/dialogs_verified_check@2x.png new file mode 100644 index 000000000..b98a405e0 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_verified_check@2x.png differ diff --git a/Telegram/Resources/icons/dialogs_verified_star.png b/Telegram/Resources/icons/dialogs_verified_star.png new file mode 100644 index 000000000..9a4b8467c Binary files /dev/null and b/Telegram/Resources/icons/dialogs_verified_star.png differ diff --git a/Telegram/Resources/icons/dialogs_verified_star@2x.png b/Telegram/Resources/icons/dialogs_verified_star@2x.png new file mode 100644 index 000000000..de6571852 Binary files /dev/null and b/Telegram/Resources/icons/dialogs_verified_star@2x.png differ diff --git a/Telegram/Resources/icons/history_file_cancel.png b/Telegram/Resources/icons/history_file_cancel.png new file mode 100644 index 000000000..8ec157e20 Binary files /dev/null and b/Telegram/Resources/icons/history_file_cancel.png differ diff --git a/Telegram/Resources/icons/history_file_cancel@2x.png b/Telegram/Resources/icons/history_file_cancel@2x.png new file mode 100644 index 000000000..f7992a20c Binary files /dev/null and b/Telegram/Resources/icons/history_file_cancel@2x.png differ diff --git a/Telegram/Resources/icons/history_file_document.png b/Telegram/Resources/icons/history_file_document.png new file mode 100644 index 000000000..4e9b36908 Binary files /dev/null and b/Telegram/Resources/icons/history_file_document.png differ diff --git a/Telegram/Resources/icons/history_file_document@2x.png b/Telegram/Resources/icons/history_file_document@2x.png new file mode 100644 index 000000000..740c79060 Binary files /dev/null and b/Telegram/Resources/icons/history_file_document@2x.png differ diff --git a/Telegram/Resources/icons/history_file_download.png b/Telegram/Resources/icons/history_file_download.png new file mode 100644 index 000000000..8022c8fc1 Binary files /dev/null and b/Telegram/Resources/icons/history_file_download.png differ diff --git a/Telegram/Resources/icons/history_file_download@2x.png b/Telegram/Resources/icons/history_file_download@2x.png new file mode 100644 index 000000000..b3824bedc Binary files /dev/null and b/Telegram/Resources/icons/history_file_download@2x.png differ diff --git a/Telegram/Resources/icons/history_file_image.png b/Telegram/Resources/icons/history_file_image.png new file mode 100644 index 000000000..689d62062 Binary files /dev/null and b/Telegram/Resources/icons/history_file_image.png differ diff --git a/Telegram/Resources/icons/history_file_image@2x.png b/Telegram/Resources/icons/history_file_image@2x.png new file mode 100644 index 000000000..294ec43a4 Binary files /dev/null and b/Telegram/Resources/icons/history_file_image@2x.png differ diff --git a/Telegram/Resources/icons/history_file_pause.png b/Telegram/Resources/icons/history_file_pause.png new file mode 100644 index 000000000..85ea133ff Binary files /dev/null and b/Telegram/Resources/icons/history_file_pause.png differ diff --git a/Telegram/Resources/icons/history_file_pause@2x.png b/Telegram/Resources/icons/history_file_pause@2x.png new file mode 100644 index 000000000..c101828cf Binary files /dev/null and b/Telegram/Resources/icons/history_file_pause@2x.png differ diff --git a/Telegram/Resources/icons/history_file_play.png b/Telegram/Resources/icons/history_file_play.png new file mode 100644 index 000000000..36cf135f9 Binary files /dev/null and b/Telegram/Resources/icons/history_file_play.png differ diff --git a/Telegram/Resources/icons/history_file_play@2x.png b/Telegram/Resources/icons/history_file_play@2x.png new file mode 100644 index 000000000..97605dfda Binary files /dev/null and b/Telegram/Resources/icons/history_file_play@2x.png differ diff --git a/Telegram/Resources/icons/history_received.png b/Telegram/Resources/icons/history_received.png new file mode 100644 index 000000000..30f9ff68f Binary files /dev/null and b/Telegram/Resources/icons/history_received.png differ diff --git a/Telegram/Resources/icons/history_received@2x.png b/Telegram/Resources/icons/history_received@2x.png new file mode 100644 index 000000000..a4e03b1d0 Binary files /dev/null and b/Telegram/Resources/icons/history_received@2x.png differ diff --git a/Telegram/Resources/icons/history_sent.png b/Telegram/Resources/icons/history_sent.png new file mode 100644 index 000000000..dfd691c94 Binary files /dev/null and b/Telegram/Resources/icons/history_sent.png differ diff --git a/Telegram/Resources/icons/history_sent@2x.png b/Telegram/Resources/icons/history_sent@2x.png new file mode 100644 index 000000000..ffc898e52 Binary files /dev/null and b/Telegram/Resources/icons/history_sent@2x.png differ diff --git a/Telegram/Resources/icons/history_views.png b/Telegram/Resources/icons/history_views.png new file mode 100644 index 000000000..49f03cfa8 Binary files /dev/null and b/Telegram/Resources/icons/history_views.png differ diff --git a/Telegram/Resources/icons/history_views@2x.png b/Telegram/Resources/icons/history_views@2x.png new file mode 100644 index 000000000..28f76cf04 Binary files /dev/null and b/Telegram/Resources/icons/history_views@2x.png differ diff --git a/Telegram/Resources/icons/mediaview_close.png b/Telegram/Resources/icons/mediaview_close.png new file mode 100644 index 000000000..891b4735a Binary files /dev/null and b/Telegram/Resources/icons/mediaview_close.png differ diff --git a/Telegram/Resources/icons/mediaview_close@2x.png b/Telegram/Resources/icons/mediaview_close@2x.png new file mode 100644 index 000000000..03995759f Binary files /dev/null and b/Telegram/Resources/icons/mediaview_close@2x.png differ diff --git a/Telegram/Resources/icons/mediaview_download.png b/Telegram/Resources/icons/mediaview_download.png new file mode 100644 index 000000000..185e82ab3 Binary files /dev/null and b/Telegram/Resources/icons/mediaview_download.png differ diff --git a/Telegram/Resources/icons/mediaview_download@2x.png b/Telegram/Resources/icons/mediaview_download@2x.png new file mode 100644 index 000000000..459dd9860 Binary files /dev/null and b/Telegram/Resources/icons/mediaview_download@2x.png differ diff --git a/Telegram/Resources/icons/mediaview_file_corner.png b/Telegram/Resources/icons/mediaview_file_corner.png new file mode 100644 index 000000000..13ed15c4d Binary files /dev/null and b/Telegram/Resources/icons/mediaview_file_corner.png differ diff --git a/Telegram/Resources/icons/mediaview_file_corner@2x.png b/Telegram/Resources/icons/mediaview_file_corner@2x.png new file mode 100644 index 000000000..c25817680 Binary files /dev/null and b/Telegram/Resources/icons/mediaview_file_corner@2x.png differ diff --git a/Telegram/Resources/icons/mediaview_more.png b/Telegram/Resources/icons/mediaview_more.png new file mode 100644 index 000000000..c4712883b Binary files /dev/null and b/Telegram/Resources/icons/mediaview_more.png differ diff --git a/Telegram/Resources/icons/mediaview_more@2x.png b/Telegram/Resources/icons/mediaview_more@2x.png new file mode 100644 index 000000000..bff691fee Binary files /dev/null and b/Telegram/Resources/icons/mediaview_more@2x.png differ diff --git a/Telegram/Resources/icons/mediaview_next.png b/Telegram/Resources/icons/mediaview_next.png new file mode 100644 index 000000000..8a1869c77 Binary files /dev/null and b/Telegram/Resources/icons/mediaview_next.png differ diff --git a/Telegram/Resources/icons/mediaview_next@2x.png b/Telegram/Resources/icons/mediaview_next@2x.png new file mode 100644 index 000000000..360fae2ce Binary files /dev/null and b/Telegram/Resources/icons/mediaview_next@2x.png differ diff --git a/Telegram/Resources/icons/mediaview_previous.png b/Telegram/Resources/icons/mediaview_previous.png new file mode 100644 index 000000000..8fb04e034 Binary files /dev/null and b/Telegram/Resources/icons/mediaview_previous.png differ diff --git a/Telegram/Resources/icons/mediaview_previous@2x.png b/Telegram/Resources/icons/mediaview_previous@2x.png new file mode 100644 index 000000000..d746a1056 Binary files /dev/null and b/Telegram/Resources/icons/mediaview_previous@2x.png differ diff --git a/Telegram/Resources/icons/title_button_close.png b/Telegram/Resources/icons/title_button_close.png new file mode 100644 index 000000000..0686fc88a Binary files /dev/null and b/Telegram/Resources/icons/title_button_close.png differ diff --git a/Telegram/Resources/icons/title_button_close@2x.png b/Telegram/Resources/icons/title_button_close@2x.png new file mode 100644 index 000000000..d88a98c11 Binary files /dev/null and b/Telegram/Resources/icons/title_button_close@2x.png differ diff --git a/Telegram/Resources/icons/title_button_lock.png b/Telegram/Resources/icons/title_button_lock.png new file mode 100644 index 000000000..61984e5df Binary files /dev/null and b/Telegram/Resources/icons/title_button_lock.png differ diff --git a/Telegram/Resources/icons/title_button_lock@2x.png b/Telegram/Resources/icons/title_button_lock@2x.png new file mode 100644 index 000000000..578eec430 Binary files /dev/null and b/Telegram/Resources/icons/title_button_lock@2x.png differ diff --git a/Telegram/Resources/icons/title_button_maximize.png b/Telegram/Resources/icons/title_button_maximize.png new file mode 100644 index 000000000..a3522751f Binary files /dev/null and b/Telegram/Resources/icons/title_button_maximize.png differ diff --git a/Telegram/Resources/icons/title_button_maximize@2x.png b/Telegram/Resources/icons/title_button_maximize@2x.png new file mode 100644 index 000000000..037bb98de Binary files /dev/null and b/Telegram/Resources/icons/title_button_maximize@2x.png differ diff --git a/Telegram/Resources/icons/title_button_minimize.png b/Telegram/Resources/icons/title_button_minimize.png new file mode 100644 index 000000000..229cb7dc5 Binary files /dev/null and b/Telegram/Resources/icons/title_button_minimize.png differ diff --git a/Telegram/Resources/icons/title_button_minimize@2x.png b/Telegram/Resources/icons/title_button_minimize@2x.png new file mode 100644 index 000000000..ddfc4713a Binary files /dev/null and b/Telegram/Resources/icons/title_button_minimize@2x.png differ diff --git a/Telegram/Resources/icons/title_button_restore.png b/Telegram/Resources/icons/title_button_restore.png new file mode 100644 index 000000000..4ad86be0e Binary files /dev/null and b/Telegram/Resources/icons/title_button_restore.png differ diff --git a/Telegram/Resources/icons/title_button_restore@2x.png b/Telegram/Resources/icons/title_button_restore@2x.png new file mode 100644 index 000000000..f498810d7 Binary files /dev/null and b/Telegram/Resources/icons/title_button_restore@2x.png differ diff --git a/Telegram/Resources/icons/title_button_unlock.png b/Telegram/Resources/icons/title_button_unlock.png new file mode 100644 index 000000000..37031e3d7 Binary files /dev/null and b/Telegram/Resources/icons/title_button_unlock.png differ diff --git a/Telegram/Resources/icons/title_button_unlock@2x.png b/Telegram/Resources/icons/title_button_unlock@2x.png new file mode 100644 index 000000000..3e99f232b Binary files /dev/null and b/Telegram/Resources/icons/title_button_unlock@2x.png differ diff --git a/Telegram/Resources/icons/title_button_update.png b/Telegram/Resources/icons/title_button_update.png new file mode 100644 index 000000000..b7dc595fb Binary files /dev/null and b/Telegram/Resources/icons/title_button_update.png differ diff --git a/Telegram/Resources/icons/title_button_update@2x.png b/Telegram/Resources/icons/title_button_update@2x.png new file mode 100644 index 000000000..bf26691ea Binary files /dev/null and b/Telegram/Resources/icons/title_button_update@2x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 6e40e9452..9573d6a0c 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_allow_bot" = "Allow"; "lng_bot_start" = "Start"; -"lng_bot_choose_group" = "Choose Group"; +"lng_bot_choose_group" = "Select a Group"; "lng_bot_no_groups" = "You have no groups"; "lng_bot_groups_not_found" = "No groups found"; "lng_bot_sure_invite" = "Add the bot to «{group}»?"; "lng_bot_already_in_group" = "The bot is already a member of the group."; -"lng_bot_choose_chat" = "Choose Chat"; +"lng_bot_choose_chat" = "Select a Chat"; "lng_bot_no_chats" = "You have no chats"; "lng_bot_chats_not_found" = "No chats found"; "lng_bot_sure_share_game" = "Share the game with {user}?"; @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} is typing"; "lng_users_typing" = "{user} and {second_user} are typing"; "lng_many_typing" = "{count:_not_used_|# is|# are} typing"; +"lng_playing_game" = "playing a game"; +"lng_user_playing_game" = "{user} is playing a game"; +"lng_users_playing_game" = "{user} and {second_user} are playing a game"; +"lng_many_playing_game" = "{count:_not_used_|# is|# are} playing a game"; "lng_send_action_record_video" = "recording a video"; "lng_user_action_record_video" = "{user} is recording a video"; "lng_send_action_upload_video" = "sending a video"; diff --git a/Telegram/Resources/langs/lang_de.strings b/Telegram/Resources/langs/lang_de.strings index 73f9219f9..e8560b6cb 100644 --- a/Telegram/Resources/langs/lang_de.strings +++ b/Telegram/Resources/langs/lang_de.strings @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} tippt"; "lng_users_typing" = "{user} und {second_user} tippen"; "lng_many_typing" = "{count:_not_used_|# tippt|# tippen}"; +"lng_playing_game" = "spielt ein Spiel"; +"lng_user_playing_game" = "{user} spielt ein Spiel"; +"lng_users_playing_game" = "{user} und {second_user} spielen ein Spiel"; +"lng_many_playing_game" = "{count:_not_used_|# spielt|# spielen} ein Spiel"; "lng_send_action_record_video" = "schickt Video"; "lng_user_action_record_video" = "{user} sendet ein Video"; "lng_send_action_upload_video" = "schickt ein Video"; diff --git a/Telegram/Resources/langs/lang_es.strings b/Telegram/Resources/langs/lang_es.strings index 6787e3894..934d919f0 100644 --- a/Telegram/Resources/langs/lang_es.strings +++ b/Telegram/Resources/langs/lang_es.strings @@ -583,7 +583,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_action_pinned_media_emoji_sticker" = "un {emoji} sticker"; "lng_action_pinned_media_game" = "el juego «{game}»"; "lng_action_game_score" = "{from} consiguió {count:# puntos|# punto|# puntos} en {game}"; -"lng_action_game_you_scored" = "Conseguiste {count:# puntos|# punto|#puntos} en {game}"; +"lng_action_game_you_scored" = "Conseguiste {count:# puntos|# punto|# puntos} en {game}"; "lng_profile_migrate_reached" = "Límite de {count:_not_used_|# miembro|# miembros} alcanzado"; "lng_profile_migrate_body" = "Para superar este límite, puedes convertir tu grupo en un supergrupo."; @@ -772,7 +772,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_allow_bot" = "Permitir"; "lng_bot_start" = "Iniciar"; -"lng_bot_choose_group" = "Elegir grupo"; +"lng_bot_choose_group" = "Elige un grupo"; "lng_bot_no_groups" = "No tienes grupos"; "lng_bot_groups_not_found" = "No se encontraron grupos"; "lng_bot_sure_invite" = "¿Añadir el bot a «{group}»?"; @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} está escribiendo"; "lng_users_typing" = "{user} y {second_user} están escribiendo"; "lng_many_typing" = "{count:_not_used_|# está|# están} escribiendo"; +"lng_playing_game" = "jugando"; +"lng_user_playing_game" = "{user} está jugando"; +"lng_users_playing_game" = "{user} y {second_user} están jugando"; +"lng_many_playing_game" = "{count:_not_used_|# está|# están} jugando"; "lng_send_action_record_video" = "grabando un vídeo"; "lng_user_action_record_video" = "{user} está grabando un vídeo"; "lng_send_action_upload_video" = "enviando un vídeo"; diff --git a/Telegram/Resources/langs/lang_it.strings b/Telegram/Resources/langs/lang_it.strings index 0811a4299..0aaa9c5b9 100644 --- a/Telegram/Resources/langs/lang_it.strings +++ b/Telegram/Resources/langs/lang_it.strings @@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_allow_bot" = "Consenti"; "lng_bot_start" = "Avvia"; -"lng_bot_choose_group" = "Scegli gruppo"; +"lng_bot_choose_group" = "Seleziona un gruppo"; "lng_bot_no_groups" = "Non hai gruppi"; "lng_bot_groups_not_found" = "Nessun gruppo trovato"; "lng_bot_sure_invite" = "Aggiungere il bot a «{group}»?"; "lng_bot_already_in_group" = "Questo bot è già membro del gruppo."; -"lng_bot_choose_chat" = "Scegli chat"; +"lng_bot_choose_chat" = "Seleziona una chat"; "lng_bot_no_chats" = "Non hai chat"; "lng_bot_chats_not_found" = "Nessuna chat trovata"; "lng_bot_sure_share_game" = "Condividere questo gioco con {user}?"; @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} sta scrivendo"; "lng_users_typing" = "{user} e {second_user} stanno scrivendo"; "lng_many_typing" = "{count:_not_used_|# sta|# stanno} scrivendo"; +"lng_playing_game" = "sta giocando a un gioco"; +"lng_user_playing_game" = "{user} sta giocando a un gioco"; +"lng_users_playing_game" = "{user} e {second_user} stanno giocando a un gioco"; +"lng_many_playing_game" = "{count:_not_used_|# sta|# stanno} giocando a un gioco"; "lng_send_action_record_video" = "sta registrando un video"; "lng_user_action_record_video" = "{user} sta registrando un video"; "lng_send_action_upload_video" = "sta inviando un video"; diff --git a/Telegram/Resources/langs/lang_ko.strings b/Telegram/Resources/langs/lang_ko.strings index 0fdee3958..11bfb8444 100644 --- a/Telegram/Resources/langs/lang_ko.strings +++ b/Telegram/Resources/langs/lang_ko.strings @@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_allow_bot" = "허용"; "lng_bot_start" = "시작"; -"lng_bot_choose_group" = "그룹 선택"; +"lng_bot_choose_group" = "Select a Group"; "lng_bot_no_groups" = "그룹이 존재하지 않습니다."; "lng_bot_groups_not_found" = "그룹을 찾을 수 없습니다."; "lng_bot_sure_invite" = "<<{group}>>에 봇을 추가 하시겠습니까?"; "lng_bot_already_in_group" = "봇이 이미 그룹의 멤버입니다."; -"lng_bot_choose_chat" = "채팅방 선택"; +"lng_bot_choose_chat" = "Select a Chat"; "lng_bot_no_chats" = "채팅방이 없습니다."; "lng_bot_chats_not_found" = "채팅방을 찾 을 수 없음"; "lng_bot_sure_share_game" = "{user}에게 게임을 공유하겠습니까?"; @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user}님이 입력중입니다."; "lng_users_typing" = "{user}님과 {second_user}님이 입력중입니다."; "lng_many_typing" = "{count:_not_used_|#명이|#명이} 입력중입니다"; +"lng_playing_game" = "playing a game"; +"lng_user_playing_game" = "{user} is playing a game"; +"lng_users_playing_game" = "{user} and {second_user} are playing a game"; +"lng_many_playing_game" = "{count:_not_used_|# is|# are} playing a game"; "lng_send_action_record_video" = "비디오 녹화 중"; "lng_user_action_record_video" = "{user}님이 녹화중입니다"; "lng_send_action_upload_video" = "비디오 전송 중"; diff --git a/Telegram/Resources/langs/lang_nl.strings b/Telegram/Resources/langs/lang_nl.strings index 317066c38..b8529985b 100644 --- a/Telegram/Resources/langs/lang_nl.strings +++ b/Telegram/Resources/langs/lang_nl.strings @@ -772,7 +772,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_allow_bot" = "Toestaan"; "lng_bot_start" = "Begin"; -"lng_bot_choose_group" = "Groep kiezen"; +"lng_bot_choose_group" = "Kies group"; "lng_bot_no_groups" = "Je hebt geen groepen"; "lng_bot_groups_not_found" = "Geen groepen gevonden"; "lng_bot_sure_invite" = "De bot toevoegen aan \"{group}\"?"; @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} is aan het typen"; "lng_users_typing" = "{user} en {second_user} zijn aan het typen"; "lng_many_typing" = "{count:_not_used_|# is|# zijn} aan het typen"; +"lng_playing_game" = "speelt een spel"; +"lng_user_playing_game" = "{user} speelt een spel"; +"lng_users_playing_game" = "{user} en {second_user} spelen een spel"; +"lng_many_playing_game" = "{count:_not_used_|# is|# zijn} een spel aan het spelen"; "lng_send_action_record_video" = "video opnemen"; "lng_user_action_record_video" = "{user} neemt video op"; "lng_send_action_upload_video" = "video versturen"; diff --git a/Telegram/Resources/langs/lang_pt_BR.strings b/Telegram/Resources/langs/lang_pt_BR.strings index e75b35cbd..1a4138f2c 100644 --- a/Telegram/Resources/langs/lang_pt_BR.strings +++ b/Telegram/Resources/langs/lang_pt_BR.strings @@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_allow_bot" = "Permitir"; "lng_bot_start" = "Iniciar"; -"lng_bot_choose_group" = "Escolher Grupo"; +"lng_bot_choose_group" = "Selecione um Grupo"; "lng_bot_no_groups" = "Você não possui grupos"; "lng_bot_groups_not_found" = "Nenhum grupo encontrado"; "lng_bot_sure_invite" = "Adicionar bot ao «{group}»?"; "lng_bot_already_in_group" = "O bot já é um membro do grupo."; -"lng_bot_choose_chat" = "Escolher Conversa"; +"lng_bot_choose_chat" = "Selecione uma Conversa"; "lng_bot_no_chats" = "Você não possui conversas"; "lng_bot_chats_not_found" = "Nenhuma conversa encontrada"; "lng_bot_sure_share_game" = "Compartilhar o jogo com {user}?"; @@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} está escrevendo"; "lng_users_typing" = "{user} e {second_user} estão escrevendo"; "lng_many_typing" = "{count:_not_used_|# está|# estão} escrevendo"; +"lng_playing_game" = "jogando"; +"lng_user_playing_game" = "{user} está jogando"; +"lng_users_playing_game" = "{user} e {second_user} estão jogando"; +"lng_many_playing_game" = "{count:_not_used_|# está|# estão} jogando"; "lng_send_action_record_video" = "gravando um vídeo"; "lng_user_action_record_video" = "{user} está gravando um vídeo"; "lng_send_action_upload_video" = "enviando um vídeo"; @@ -816,7 +820,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_duration_played" = "{played} / {duration}"; "lng_date_and_duration" = "{date}, {duration}"; "lng_choose_images" = "Escolher imagens"; -"lng_game_tag" = "Jogo"; +"lng_game_tag" = "Jogar"; "lng_context_view_profile" = "Ver perfil"; "lng_context_view_group" = "Ver info do grupo"; diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 1d240708c..266393ad4 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,8,3 - PRODUCTVERSION 0,10,8,3 + FILEVERSION 0,10,8,5 + PRODUCTVERSION 0,10,8,5 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.10.8.3" + VALUE "FileVersion", "0.10.8.5" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.8.3" + VALUE "ProductVersion", "0.10.8.5" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index c82764a5c..5d7b4ab31 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,10,8,3 - PRODUCTVERSION 0,10,8,3 + FILEVERSION 0,10,8,5 + PRODUCTVERSION 0,10,8,5 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "0.10.8.3" + VALUE "FileVersion", "0.10.8.5" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.10.8.3" + VALUE "ProductVersion", "0.10.8.5" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index af35aa794..f97a39ff9 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "apiwrap.h" #include "observer_peer.h" #include "styles/style_boxes.h" +#include "styles/style_dialogs.h" AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : AbstractBox(st::boxWidth) , _save(this, lang(lng_add_contact), st::defaultBoxButton) @@ -1451,8 +1452,9 @@ void RevokePublicLinkBox::paintChat(Painter &p, const ChatRow &row, bool selecte int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(); int32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2); if (peer->isVerified()) { - namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x(); - p.drawSpriteLeft(namex + qMin(row.name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck); + auto icon = &st::dialogsVerifiedIcon; + namew -= icon->width(); + icon->paint(p, namex + qMin(row.name.maxWidth(), namew), st::contactsPadding.top() + st::contactsNameTop, width()); } row.name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width()); diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index 119c3414e..61f024f8b 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -80,9 +80,7 @@ shareCheckBorder: windowBg; shareCheckBg: windowActiveBg; shareCheckRadius: 10px; shareCheckSmallRadius: 3px; -shareCheckIcon: icon { - { "default_checkbox_check", windowBg, point(3px, 6px) }, -}; +shareCheckIcon: icon {{ "default_checkbox_check", windowBg, point(3px, 6px) }}; shareNameFont: font(11px); shareNameFg: windowTextFg; shareNameActiveFg: btnYesColor; diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index b929f3a54..b006dedbb 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "boxes/contactsbox.h" #include "dialogs/dialogs_indexed_list.h" +#include "styles/style_dialogs.h" #include "lang.h" #include "boxes/addcontactbox.h" #include "mainwidget.h" @@ -435,8 +436,9 @@ void ContactsInner::paintDialog(Painter &p, PeerData *peer, ContactData *data, b int32 iconw = (_chat || _creating != CreatingGroupNone) ? (st::contactsCheckPosition.x() * 2 + st::contactsCheckIcon.pxWidth()) : 0; int32 namew = width() - namex - st::contactsPadding.right() - iconw; if (peer->isVerified()) { - namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x(); - p.drawSpriteLeft(namex + qMin(data->name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck); + auto icon = &st::dialogsVerifiedIcon; + namew -= icon->width(); + icon->paint(p, namex + qMin(data->name.maxWidth(), namew), st::contactsPadding.top() + st::contactsNameTop, width()); } data->name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width()); @@ -1942,8 +1944,9 @@ void MembersInner::paintDialog(Painter &p, PeerData *peer, MemberData *data, boo int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(); int32 namew = width() - namex - st::contactsPadding.right() - (data->canKick ? (_kickWidth + st::contactsCheckPosition.x() * 2) : 0); if (peer->isVerified()) { - namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x(); - p.drawSpriteLeft(namex + qMin(data->name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck); + auto icon = &st::dialogsVerifiedIcon; + namew -= icon->width(); + icon->paint(p, namex + qMin(data->name.maxWidth(), namew), st::contactsPadding.top() + st::contactsNameTop, width()); } data->name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width()); diff --git a/Telegram/SourceFiles/boxes/photosendbox.cpp b/Telegram/SourceFiles/boxes/photosendbox.cpp index ff3c66b18..98aac9648 100644 --- a/Telegram/SourceFiles/boxes/photosendbox.cpp +++ b/Telegram/SourceFiles/boxes/photosendbox.cpp @@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "mainwidget.h" #include "photosendbox.h" #include "history/history_media_types.h" +#include "styles/style_history.h" PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth) , _file(file) @@ -233,7 +234,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) { p.drawEllipse(inner); p.setRenderHint(QPainter::HighQualityAntialiasing, false); - p.drawSpriteCenter(inner, st::msgFileInPlay); + auto icon = &st::historyFileInPlay; + icon->paintInCenter(p, inner); } } else { int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); @@ -272,7 +274,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) { p.drawEllipse(inner); p.setRenderHint(QPainter::HighQualityAntialiasing, false); - p.drawSpriteCenter(inner, _isImage ? st::msgFileOutImage : st::msgFileOutFile); + auto icon = &(_isImage ? st::historyFileOutImage : st::historyFileOutDocument); + icon->paintInCenter(p, inner); } else { p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize)); } @@ -553,7 +556,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) { p.drawEllipse(inner); p.setRenderHint(QPainter::HighQualityAntialiasing, false); - p.drawSpriteCenter(inner, st::msgFileInPlay); + auto icon = &st::historyFileInPlay; + icon->paintInCenter(p, inner); } } else if (_doc) { int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); @@ -591,7 +595,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) { p.drawEllipse(inner); p.setRenderHint(QPainter::HighQualityAntialiasing, false); - p.drawSpriteCenter(inner, _isImage ? st::msgFileInImage : st::msgFileInFile); + auto icon = &(_isImage ? st::historyFileInImage : st::historyFileInDocument); + icon->paintInCenter(p, inner); } p.setFont(st::semiboldFont); p.setPen(st::black); diff --git a/Telegram/SourceFiles/boxes/sharebox.cpp b/Telegram/SourceFiles/boxes/sharebox.cpp index bbf3a38dc..a7cb219ce 100644 --- a/Telegram/SourceFiles/boxes/sharebox.cpp +++ b/Telegram/SourceFiles/boxes/sharebox.cpp @@ -913,15 +913,24 @@ QVector ShareInner::selected() const { QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) { auto shareHashData = QByteArray(0x10, Qt::Uninitialized); - auto ints = reinterpret_cast(shareHashData.data()); - ints[0] = MTP::authedId(); - ints[1] = fullId.channel; - ints[2] = fullId.msg; - ints[3] = 0; + auto shareHashDataInts = reinterpret_cast(shareHashData.data()); + auto channel = fullId.channel ? App::channelLoaded(fullId.channel) : static_cast(nullptr); + auto channelAccessHash = channel ? channel->access : 0ULL; + auto channelAccessHashInts = reinterpret_cast(&channelAccessHash); + shareHashDataInts[0] = MTP::authedId(); + shareHashDataInts[1] = fullId.channel; + shareHashDataInts[2] = fullId.msg; + shareHashDataInts[3] = channelAccessHashInts[0]; + // Count SHA1() of data. auto key128Size = 0x10; auto shareHashEncrypted = QByteArray(key128Size + shareHashData.size(), Qt::Uninitialized); hashSha1(shareHashData.constData(), shareHashData.size(), shareHashEncrypted.data()); + + // Mix in channel access hash to the first 64 bits of SHA1 of data. + *reinterpret_cast(shareHashEncrypted.data()) ^= *reinterpret_cast(channelAccessHashInts); + + // Encrypt data. if (!Local::encrypt(shareHashData.constData(), shareHashEncrypted.data() + key128Size, shareHashData.size(), shareHashEncrypted.constData())) { return url; } @@ -1031,29 +1040,51 @@ void shareGameScoreByHash(const QString &hash) { return; } + // Decrypt data. auto hashData = QByteArray(hashEncrypted.size() - key128Size, Qt::Uninitialized); if (!Local::decrypt(hashEncrypted.constData() + key128Size, hashData.data(), hashEncrypted.size() - key128Size, hashEncrypted.constData())) { return; } - char checkSha1[20] = { 0 }; - if (memcmp(hashSha1(hashData.constData(), hashData.size(), checkSha1), hashEncrypted.constData(), key128Size) != 0) { - Ui::showLayer(new InformBox(lang(lng_share_wrong_user))); - return; - } - auto ints = reinterpret_cast(hashData.data()); - if (ints[0] != MTP::authedId()) { + // Count SHA1() of data. + char dataSha1[20] = { 0 }; + hashSha1(hashData.constData(), hashData.size(), dataSha1); + + // Mix out channel access hash from the first 64 bits of SHA1 of data. + auto channelAccessHash = *reinterpret_cast(hashEncrypted.data()) ^ *reinterpret_cast(dataSha1); + + // Check next 64 bits of SHA1() of data. + auto skipSha1Part = sizeof(channelAccessHash); + if (memcmp(dataSha1 + skipSha1Part, hashEncrypted.constData() + skipSha1Part, key128Size - skipSha1Part) != 0) { + Ui::showLayer(new InformBox(lang(lng_share_wrong_user))); + return; + } + + auto hashDataInts = reinterpret_cast(hashData.data()); + if (hashDataInts[0] != MTP::authedId()) { + Ui::showLayer(new InformBox(lang(lng_share_wrong_user))); + return; + } + + // Check first 32 bits of channel access hash. + auto channelAccessHashInts = reinterpret_cast(&channelAccessHash); + if (channelAccessHashInts[0] != hashDataInts[3]) { + Ui::showLayer(new InformBox(lang(lng_share_wrong_user))); + return; + } + + auto channelId = hashDataInts[1]; + auto msgId = hashDataInts[2]; + if (!channelId && channelAccessHash) { + // If there is no channel id, there should be no channel access_hash. Ui::showLayer(new InformBox(lang(lng_share_wrong_user))); return; } - auto channelId = ints[1]; - auto msgId = ints[2]; if (auto item = App::histItemById(channelId, msgId)) { shareGameScoreFromItem(item); } else if (App::api()) { - auto channel = channelId ? App::channelLoaded(channelId) : nullptr; - if (channel || !channelId) { + auto resolveMessageAndShareScore = [msgId](ChannelData *channel) { App::api()->requestMessageData(channel, msgId, [](ChannelData *channel, MsgId msgId) { if (auto item = App::histItemById(channel, msgId)) { shareGameScoreFromItem(item); @@ -1061,6 +1092,22 @@ void shareGameScoreByHash(const QString &hash) { Ui::showLayer(new InformBox(lang(lng_edit_deleted))); } }); + }; + + auto channel = channelId ? App::channelLoaded(channelId) : nullptr; + if (channel || !channelId) { + resolveMessageAndShareScore(channel); + } else { + auto requestChannelIds = MTP_vector(1, MTP_inputChannel(MTP_int(channelId), MTP_long(channelAccessHash))); + auto requestChannel = MTPchannels_GetChannels(requestChannelIds); + MTP::send(requestChannel, rpcDone([channelId, resolveMessageAndShareScore](const MTPmessages_Chats &result) { + if (result.type() == mtpc_messages_chats) { + App::feedChats(result.c_messages_chats().vchats); + } + if (auto channel = App::channelLoaded(channelId)) { + resolveMessageAndShareScore(channel); + } + })); } } } diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 170016e56..edc0a521e 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "core/utils.h" -#define BETA_VERSION_MACRO (10008003ULL) +#define BETA_VERSION_MACRO (10008005ULL) constexpr int AppVersion = 10008; constexpr str_const AppVersionStr = "0.10.8"; diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index f48a92755..abf2223dc 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -63,14 +63,6 @@ dialogsScroll: flatScroll(scrollDef) { bottomsh: 0px; } -dialogsChatImgPos: point(1px, 4px); -dialogsChannelImgPos: point(3px, 4px); -dialogsImgSkip: 22px; - -dialogsCheckLeft: 5px; -dialogsCheckTop: 4px; -dialogsCheckSkip: 3px; - dialogsTextStyle: textStyle(defaultTextStyle) { linkFg: dialogsTextFgService; linkFgDown: dialogsTextFgService; @@ -89,9 +81,7 @@ dialogsTextStyleDraftActive: textStyle(dialogsTextStyle) { linkFgDown: #c6e1f7; } -dialogsNewChatIcon: icon { - { "dialogs_new_chat", #b7b7b7, point(9px, 10px) } -}; +dialogsNewChatIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(9px, 10px) }}; dialogsNewChatButton: RoundButton { width: 36px; height: 36px; @@ -108,6 +98,33 @@ dialogsNewChatButton: RoundButton { textBgOver: transparent; } -settingsEditIcon: icon { - { "dialogs_new_chat", #b7b7b7, point(3px, 9px) } +dialogsChatTypeSkip: 22px; +dialogsChatIcon: icon {{ "dialogs_chat", #373737, point(1px, 4px) }}; +dialogsChatActiveIcon: icon {{ "dialogs_chat", #ffffff, point(1px, 4px) }}; +dialogsChannelIcon: icon {{ "dialogs_channel", #373737, point(3px, 4px) }}; +dialogsChannelActiveIcon: icon {{ "dialogs_channel", #ffffff, point(3px, 4px) }}; + +dialogsSentStateFg: #5dc452; +dialogsSendStateSkip: 20px; +dialogsSendingIcon: icon {{ "dialogs_sending", #c1c1c1, point(8px, 4px) }}; +dialogsSendingActiveIcon: icon {{ "dialogs_sending", #ffffff99, point(8px, 4px) }}; +dialogsSentIcon: icon {{ "dialogs_sent", dialogsSentStateFg, point(10px, 4px) }}; +dialogsSentActiveIcon: icon {{ "dialogs_sent", #ffffff, point(10px, 4px) }}; +dialogsReceivedIcon: icon {{ "dialogs_received", dialogsSentStateFg, point(5px, 4px) }}; +dialogsReceivedActiveIcon: icon {{ "dialogs_received", #ffffff, point(5px, 4px) }}; + +dialogsVerifiedIcon: icon { + { "dialogs_verified_star", #4abcf1, point(4px, 2px) }, + { "dialogs_verified_check", #ffffff, point(7px, 7px) }, }; +dialogsVerifiedActiveIcon: icon { + { "dialogs_verified_star", #ffffff, point(4px, 2px) }, + { "dialogs_verified_check", #6a91b1, point(7px, 7px) }, +}; + +historySendingIcon: icon {{ "dialogs_sending", #98d292, point(5px, 5px) }}; +historySendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(5px, 5px) }}; +historyViewsSendingIcon: icon {{ "dialogs_sending", #a0adb5, point(3px, 0px) }}; +historyViewsSendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(3px, 0px) }}; + +settingsEditIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(3px, 9px) }}; diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index cb19698b9..dd6d7c230 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -30,7 +30,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org namespace Dialogs { namespace Layout { - namespace { // Show all dates that are in the last 20 hours in time format. @@ -69,26 +68,15 @@ void paintRow(Painter &p, History *history, HistoryItem *item, Data::Draft *draf int32 namewidth = w - nameleft - st::dialogsPadding.x(); QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height); - // draw chat icon - if (history->peer->isChat() || history->peer->isMegagroup()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), (active ? st::dlgActiveChatImg : st::dlgChatImg)); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); - } else if (history->peer->isChannel()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), (active ? st::dlgActiveChannelImg : st::dlgChannelImg)); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); + if (auto chatTypeIcon = ChatTypeIcon(history->peer, active)) { + chatTypeIcon->paint(p, rectForName.topLeft(), w); + rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); } int texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip; if (draft) { paintRowDate(p, date, rectForName, active); - // draw check - if (draft->saveRequestId) { - auto check = active ? &st::dlgActiveSendImg : &st::dlgSendImg; - rectForName.setWidth(rectForName.width() - check->pxWidth() - st::dialogsCheckSkip); - p.drawSprite(QPoint(rectForName.left() + rectForName.width() + st::dialogsCheckLeft, rectForName.top() + st::dialogsCheckTop), *check); - } - p.setFont(st::dialogsTextFont); p.setPen(active ? st::dialogsTextFgActive : st::dialogsTextFgService); if (history->typing.isEmpty() && history->sendActions.isEmpty()) { @@ -116,28 +104,33 @@ void paintRow(Painter &p, History *history, HistoryItem *item, Data::Draft *draf } else if (!item->isEmpty()) { paintRowDate(p, date, rectForName, active); - // draw check - if (item->needCheck()) { - const style::sprite *check; + paintItemCallback(nameleft, namewidth, item); + } + auto sendStateIcon = ([draft, item, active]() -> const style::icon* { + if (draft) { + if (draft->saveRequestId) { + return &(active ? st::dialogsSendingActiveIcon : st::dialogsSendingIcon); + } + } else if (item && !item->isEmpty() && item->needCheck()) { if (item->id > 0) { if (item->unread()) { - check = active ? &st::dlgActiveCheckImg : &st::dlgCheckImg; - } else { - check = active ? &st::dlgActiveDblCheckImg : &st::dlgDblCheckImg; + return &(active ? st::dialogsSentActiveIcon : st::dialogsSentIcon); } - } else { - check = active ? &st::dlgActiveSendImg : &st::dlgSendImg; + return &(active ? st::dialogsReceivedActiveIcon : st::dialogsReceivedIcon); } - rectForName.setWidth(rectForName.width() - check->pxWidth() - st::dialogsCheckSkip); - p.drawSprite(QPoint(rectForName.left() + rectForName.width() + st::dialogsCheckLeft, rectForName.top() + st::dialogsCheckTop), *check); + return &(active ? st::dialogsSendingActiveIcon : st::dialogsSendingIcon); } - - paintItemCallback(nameleft, namewidth, item); + return nullptr; + })(); + if (sendStateIcon) { + rectForName.setWidth(rectForName.width() - st::dialogsSendStateSkip); + sendStateIcon->paint(p, rectForName.topLeft() + QPoint(rectForName.width(), 0), w); } if (history->peer->isUser() && history->peer->isVerified()) { - rectForName.setWidth(rectForName.width() - st::verifiedCheck.pxWidth() - st::verifiedCheckPos.x()); - p.drawSprite(rectForName.topLeft() + QPoint(qMin(history->peer->dialogName().maxWidth(), rectForName.width()), 0) + st::verifiedCheckPos, (active ? st::verifiedCheckInv : st::verifiedCheck)); + auto icon = &(active ? st::dialogsVerifiedActiveIcon : st::dialogsVerifiedIcon); + rectForName.setWidth(rectForName.width() - icon->width()); + icon->paint(p, rectForName.topLeft() + QPoint(qMin(history->peer->dialogName().maxWidth(), rectForName.width()), 0), w); } p.setPen(active ? st::dialogsTextFgActive : st::dialogsNameFg); @@ -169,6 +162,15 @@ QImage colorizeCircleHalf(UnreadBadgeSizeData *data, int size, int half, int xof } // namepsace +const style::icon *ChatTypeIcon(PeerData *peer, bool active) { + if (peer->isChat() || peer->isMegagroup()) { + return &(active ? st::dialogsChatActiveIcon : st::dialogsChatIcon); + } else if (peer->isChannel()) { + return &(active ? st::dialogsChannelActiveIcon : st::dialogsChannelIcon); + } + return nullptr; +} + void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) { t_assert(rect.height() == st.size); diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.h b/Telegram/SourceFiles/dialogs/dialogs_layout.h index f083f062f..6e81e317b 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.h +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.h @@ -27,6 +27,8 @@ class FakeRow; namespace Layout { +const style::icon *ChatTypeIcon(PeerData *peer, bool active); + class RowPainter { public: static void paint(Painter &p, const Row *row, int w, bool active, bool selected, bool onlyBackground); diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 38e9caf2b..757f55c10 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -253,16 +253,14 @@ void DialogsInner::peopleResultPaint(PeerData *peer, Painter &p, int32 w, bool a QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height); // draw chat icon - if (peer->isChat() || peer->isMegagroup()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), (active ? st::dlgActiveChatImg : st::dlgChatImg)); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); - } else if (peer->isChannel()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), (active ? st::dlgActiveChannelImg : st::dlgChannelImg)); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); + if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(peer, active)) { + chatTypeIcon->paint(p, rectForName.topLeft(), w); + rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); } if (peer->isVerified()) { - rectForName.setWidth(rectForName.width() - st::verifiedCheck.pxWidth() - st::verifiedCheckPos.x()); - p.drawSprite(rectForName.topLeft() + QPoint(qMin(peer->dialogName().maxWidth(), rectForName.width()), 0) + st::verifiedCheckPos, (active ? st::verifiedCheckInv : st::verifiedCheck)); + auto icon = &(active ? st::dialogsVerifiedActiveIcon : st::dialogsVerifiedIcon); + rectForName.setWidth(rectForName.width() - icon->width()); + icon->paint(p, rectForName.topLeft() + QPoint(qMin(peer->dialogName().maxWidth(), rectForName.width()), 0), w); } QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height); @@ -300,13 +298,9 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c int32 namewidth = w - nameleft - st::dialogsPadding.x() * 2 - st::btnCancelSearch.width; QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height); - // draw chat icon - if (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); - } else if (_searchInPeer->isChannel()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), st::dlgChannelImg); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); + if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_searchInPeer, false)) { + chatTypeIcon->paint(p, rectForName.topLeft(), w); + rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); } QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height); diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index f62bbc31e..ab7705a41 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -32,6 +32,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "window/top_bar_widget.h" #include "observer_peer.h" +namespace { + +constexpr int kStatusShowClientsideRecordVideo = 6000; +constexpr int kStatusShowClientsideUploadVideo = 6000; +constexpr int kStatusShowClientsideRecordVoice = 6000; +constexpr int kStatusShowClientsideUploadVoice = 6000; +constexpr int kStatusShowClientsideUploadPhoto = 6000; +constexpr int kStatusShowClientsideUploadFile = 6000; +constexpr int kStatusShowClientsideChooseLocation = 6000; +constexpr int kStatusShowClientsideChooseContact = 6000; +constexpr int kStatusShowClientsidePlayGame = 10000; + +} // namespace + void historyInit() { historyInitMessages(); historyInitMedia(); @@ -171,7 +185,7 @@ void History::draftSavedToCloud() { bool History::updateTyping(uint64 ms, bool force) { bool changed = force; - for (TypingUsers::iterator i = typing.begin(), e = typing.end(); i != e;) { + for (auto i = typing.begin(), e = typing.end(); i != e;) { if (ms >= i.value()) { i = typing.erase(i); changed = true; @@ -179,7 +193,7 @@ bool History::updateTyping(uint64 ms, bool force) { ++i; } } - for (SendActionUsers::iterator i = sendActions.begin(); i != sendActions.cend();) { + for (auto i = sendActions.begin(); i != sendActions.cend();) { if (ms >= i.value().until) { i = sendActions.erase(i); changed = true; @@ -189,23 +203,46 @@ bool History::updateTyping(uint64 ms, bool force) { } if (changed) { QString newTypingStr; - int32 cnt = typing.size(); - if (cnt > 2) { - newTypingStr = lng_many_typing(lt_count, cnt); - } else if (cnt > 1) { + int typingCount = typing.size(); + if (typingCount > 2) { + newTypingStr = lng_many_typing(lt_count, typingCount); + } else if (typingCount > 1) { newTypingStr = lng_users_typing(lt_user, typing.begin().key()->firstName, lt_second_user, (typing.end() - 1).key()->firstName); - } else if (cnt) { + } else if (typingCount) { newTypingStr = peer->isUser() ? lang(lng_typing) : lng_user_typing(lt_user, typing.begin().key()->firstName); } else if (!sendActions.isEmpty()) { - switch (sendActions.begin().value().type) { - case SendActionRecordVideo: newTypingStr = peer->isUser() ? lang(lng_send_action_record_video) : lng_user_action_record_video(lt_user, sendActions.begin().key()->firstName); break; - case SendActionUploadVideo: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_video) : lng_user_action_upload_video(lt_user, sendActions.begin().key()->firstName); break; - case SendActionRecordVoice: newTypingStr = peer->isUser() ? lang(lng_send_action_record_audio) : lng_user_action_record_audio(lt_user, sendActions.begin().key()->firstName); break; - case SendActionUploadVoice: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_audio) : lng_user_action_upload_audio(lt_user, sendActions.begin().key()->firstName); break; - case SendActionUploadPhoto: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_photo) : lng_user_action_upload_photo(lt_user, sendActions.begin().key()->firstName); break; - case SendActionUploadFile: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_file) : lng_user_action_upload_file(lt_user, sendActions.begin().key()->firstName); break; - case SendActionChooseLocation: newTypingStr = peer->isUser() ? lang(lng_send_action_geo_location) : lng_user_action_geo_location(lt_user, sendActions.begin().key()->firstName); break; - case SendActionChooseContact: newTypingStr = peer->isUser() ? lang(lng_send_action_choose_contact) : lng_user_action_choose_contact(lt_user, sendActions.begin().key()->firstName); break; + // Handles all actions except game playing. + auto sendActionString = [](SendActionType type, const QString &name) -> QString { + switch (type) { + case SendActionRecordVideo: return name.isEmpty() ? lang(lng_send_action_record_video) : lng_user_action_record_video(lt_user, name); + case SendActionUploadVideo: return name.isEmpty() ? lang(lng_send_action_upload_video) : lng_user_action_upload_video(lt_user, name); + case SendActionRecordVoice: return name.isEmpty() ? lang(lng_send_action_record_audio) : lng_user_action_record_audio(lt_user, name); + case SendActionUploadVoice: return name.isEmpty() ? lang(lng_send_action_upload_audio) : lng_user_action_upload_audio(lt_user, name); + case SendActionUploadPhoto: return name.isEmpty() ? lang(lng_send_action_upload_photo) : lng_user_action_upload_photo(lt_user, name); + case SendActionUploadFile: return name.isEmpty() ? lang(lng_send_action_upload_file) : lng_user_action_upload_file(lt_user, name); + case SendActionChooseLocation: return name.isEmpty() ? lang(lng_send_action_geo_location) : lng_user_action_geo_location(lt_user, name); + case SendActionChooseContact: return name.isEmpty() ? lang(lng_send_action_choose_contact) : lng_user_action_choose_contact(lt_user, name); + default: break; + }; + return QString(); + }; + for (auto i = sendActions.cbegin(), e = sendActions.cend(); i != e; ++i) { + newTypingStr = sendActionString(i->type, peer->isUser() ? QString() : i.key()->firstName); + if (!newTypingStr.isEmpty()) { + break; + } + } + + // Everyone in sendActions are playing a game. + if (newTypingStr.isEmpty()) { + int playingCount = sendActions.size(); + if (playingCount > 2) { + newTypingStr = lng_many_playing_game(lt_count, playingCount); + } else if (playingCount > 1) { + newTypingStr = lng_users_playing_game(lt_user, sendActions.begin().key()->firstName, lt_second_user, (sendActions.end() - 1).key()->firstName); + } else { + newTypingStr = peer->isUser() ? lang(lng_playing_game) : lng_user_playing_game(lt_user, sendActions.begin().key()->firstName); + } } } if (!newTypingStr.isEmpty()) { @@ -527,25 +564,37 @@ void Histories::regSendAction(History *history, UserData *user, const MTPSendMes if (action.type() == mtpc_sendMessageCancelAction) { history->unregTyping(user); return; + } else if (action.type() == mtpc_sendMessageGameStopAction) { + auto it = history->sendActions.find(user); + if (it != history->sendActions.end() && it->type == SendActionPlayGame) { + history->unregTyping(user); + } + return; } uint64 ms = getms(); switch (action.type()) { case mtpc_sendMessageTypingAction: history->typing[user] = ms + 6000; break; - case mtpc_sendMessageRecordVideoAction: history->sendActions.insert(user, SendAction(SendActionRecordVideo, ms + 6000)); break; - case mtpc_sendMessageUploadVideoAction: history->sendActions.insert(user, SendAction(SendActionUploadVideo, ms + 6000, action.c_sendMessageUploadVideoAction().vprogress.v)); break; - case mtpc_sendMessageRecordAudioAction: history->sendActions.insert(user, SendAction(SendActionRecordVoice, ms + 6000)); break; - case mtpc_sendMessageUploadAudioAction: history->sendActions.insert(user, SendAction(SendActionUploadVoice, ms + 6000, action.c_sendMessageUploadAudioAction().vprogress.v)); break; - case mtpc_sendMessageUploadPhotoAction: history->sendActions.insert(user, SendAction(SendActionUploadPhoto, ms + 6000, action.c_sendMessageUploadPhotoAction().vprogress.v)); break; - case mtpc_sendMessageUploadDocumentAction: history->sendActions.insert(user, SendAction(SendActionUploadFile, ms + 6000, action.c_sendMessageUploadDocumentAction().vprogress.v)); break; - case mtpc_sendMessageGeoLocationAction: history->sendActions.insert(user, SendAction(SendActionChooseLocation, ms + 6000)); break; - case mtpc_sendMessageChooseContactAction: history->sendActions.insert(user, SendAction(SendActionChooseContact, ms + 6000)); break; + case mtpc_sendMessageRecordVideoAction: history->sendActions.insert(user, SendAction(SendActionRecordVideo, ms + kStatusShowClientsideRecordVideo)); break; + case mtpc_sendMessageUploadVideoAction: history->sendActions.insert(user, SendAction(SendActionUploadVideo, ms + kStatusShowClientsideUploadVideo, action.c_sendMessageUploadVideoAction().vprogress.v)); break; + case mtpc_sendMessageRecordAudioAction: history->sendActions.insert(user, SendAction(SendActionRecordVoice, ms + kStatusShowClientsideRecordVoice)); break; + case mtpc_sendMessageUploadAudioAction: history->sendActions.insert(user, SendAction(SendActionUploadVoice, ms + kStatusShowClientsideUploadVoice, action.c_sendMessageUploadAudioAction().vprogress.v)); break; + case mtpc_sendMessageUploadPhotoAction: history->sendActions.insert(user, SendAction(SendActionUploadPhoto, ms + kStatusShowClientsideUploadPhoto, action.c_sendMessageUploadPhotoAction().vprogress.v)); break; + case mtpc_sendMessageUploadDocumentAction: history->sendActions.insert(user, SendAction(SendActionUploadFile, ms + kStatusShowClientsideUploadFile, action.c_sendMessageUploadDocumentAction().vprogress.v)); break; + case mtpc_sendMessageGeoLocationAction: history->sendActions.insert(user, SendAction(SendActionChooseLocation, ms + kStatusShowClientsideChooseLocation)); break; + case mtpc_sendMessageChooseContactAction: history->sendActions.insert(user, SendAction(SendActionChooseContact, ms + kStatusShowClientsideChooseContact)); break; + case mtpc_sendMessageGamePlayAction: { + auto it = history->sendActions.find(user); + if (it == history->sendActions.end() || it->type == SendActionPlayGame || it->until <= ms) { + history->sendActions.insert(user, SendAction(SendActionPlayGame, ms + kStatusShowClientsidePlayGame)); + } + } break; default: return; } user->madeAction(when); - TypingHistories::const_iterator i = typing.find(history); + auto i = typing.find(history); if (i == typing.cend()) { typing.insert(history, ms); history->typingDots = 0; @@ -1059,13 +1108,13 @@ HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) { void History::unregTyping(UserData *from) { uint64 updateAtMs = 0; - TypingUsers::iterator i = typing.find(from); - if (i != typing.end()) { + auto i = typing.find(from); + if (i != typing.cend()) { updateAtMs = getms(); i.value() = updateAtMs; } - SendActionUsers::iterator j = sendActions.find(from); - if (j != sendActions.end()) { + auto j = sendActions.find(from); + if (j != sendActions.cend()) { if (!updateAtMs) updateAtMs = getms(); j.value().until = updateAtMs; } diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index db8cefa65..6dd45ecd8 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -142,6 +142,7 @@ enum SendActionType { SendActionUploadFile, SendActionChooseLocation, SendActionChooseContact, + SendActionPlayGame, }; struct SendAction { SendAction(SendActionType type, uint64 until, int32 progress = 0) : type(type), until(until), progress(progress) { @@ -401,9 +402,9 @@ public: mutable const HistoryItem *textCachedFor = nullptr; // cache mutable Text lastItemTextCache; - typedef QMap TypingUsers; + using TypingUsers = QMap; TypingUsers typing; - typedef QMap SendActionUsers; + using SendActionUsers = QMap; SendActionUsers sendActions; QString typingStr; Text typingText; diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index 7fc5fe6d0..37a4fe1de 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -19,6 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ using "basic.style"; +using "dialogs/dialogs.style"; historyToDown: icon { { "history_down_shadow", #00000040 }, @@ -45,3 +46,49 @@ membersInnerDropdown: InnerDropdown(defaultInnerDropdown) { scrollMargin: margins(0px, 5px, 0px, 5px); scrollPadding: margins(0px, 3px, 8px, 3px); } + +historyFileOutImage: icon {{ "history_file_image", msgOutBg }}; +historyFileOutImageSelected: icon {{ "history_file_image", msgOutBgSelected }}; +historyFileInImage: icon {{ "history_file_image", msgInBg }}; +historyFileInImageSelected: icon {{ "history_file_image", msgInBgSelected }}; +historyFileOutDocument: icon {{ "history_file_document", msgOutBg }}; +historyFileOutDocumentSelected: icon {{ "history_file_document", msgOutBgSelected }}; +historyFileInDocument: icon {{ "history_file_document", msgInBg }}; +historyFileInDocumentSelected: icon {{ "history_file_document", msgInBgSelected }}; +historyFileOutDownload: icon {{ "history_file_download", msgOutBg }}; +historyFileOutDownloadSelected: icon {{ "history_file_download", msgOutBgSelected }}; +historyFileInDownload: icon {{ "history_file_download", msgInBg }}; +historyFileInDownloadSelected: icon {{ "history_file_download", msgInBgSelected }}; +historyFileOutCancel: icon {{ "history_file_cancel", msgOutBg }}; +historyFileOutCancelSelected: icon {{ "history_file_cancel", msgOutBgSelected }}; +historyFileInCancel: icon {{ "history_file_cancel", msgInBg }}; +historyFileInCancelSelected: icon {{ "history_file_cancel", msgInBgSelected }}; +historyFileOutPause: icon {{ "history_file_pause", msgOutBg }}; +historyFileOutPauseSelected: icon {{ "history_file_pause", msgOutBgSelected }}; +historyFileInPause: icon {{ "history_file_pause", msgInBg }}; +historyFileInPauseSelected: icon {{ "history_file_pause", msgInBgSelected }}; +historyFileOutPlay: icon {{ "history_file_play", msgOutBg }}; +historyFileOutPlaySelected: icon {{ "history_file_play", msgOutBgSelected }}; +historyFileInPlay: icon {{ "history_file_play", msgInBg }}; +historyFileInPlaySelected: icon {{ "history_file_play", msgInBgSelected }}; + +historyOutFg: dialogsSentStateFg; +historyOutSelectedFg: #4da79f; +historyInvertedFg: #ffffff; +historySendStateSpace: 24px; +historySendStatePosition: point(-17px, -19px); +historySentIcon: icon {{ "history_sent", historyOutFg, point(2px, 4px) }}; +historySentSelectedIcon: icon {{ "history_sent", historyOutSelectedFg, point(2px, 4px) }}; +historySentInvertedIcon: icon {{ "history_sent", historyInvertedFg, point(2px, 4px) }}; +historyReceivedIcon: icon {{ "history_received", historyOutFg, point(2px, 4px) }}; +historyReceivedSelectedIcon: icon {{ "history_received", historyOutSelectedFg, point(2px, 4px) }}; +historyReceivedInvertedIcon: icon {{ "history_received", historyInvertedFg, point(2px, 4px) }}; + +historyViewsSpace: 11px; +historyViewsWidth: 20px; +historyViewsTop: -15px; +historyViewsInIcon: icon {{ "history_views", #a0acb6 }}; +historyViewsInSelectedIcon: icon {{ "history_views", #6a9bc5 }}; +historyViewsOutIcon: icon {{ "history_views", historyOutFg }}; +historyViewsOutSelectedIcon: icon {{ "history_views", historyOutSelectedFg }}; +historyViewsInvertedIcon: icon {{ "history_views", #ffffffe6 }}; diff --git a/Telegram/SourceFiles/history/history_media.h b/Telegram/SourceFiles/history/history_media.h index b823dcb6a..fac47c497 100644 --- a/Telegram/SourceFiles/history/history_media.h +++ b/Telegram/SourceFiles/history/history_media.h @@ -169,6 +169,15 @@ public: return (_inBubbleState == MediaInBubbleState::Bottom) || (_inBubbleState == MediaInBubbleState::None); } + // Sometimes click on media in message is overloaded by the messsage: + // (for example it can open a link or a game instead of opening media) + // But the overloading click handler should be used only when media + // is already loaded (not a photo or gif waiting for load with auto + // load being disabled - in such case media should handle the click). + virtual bool isReadyForOpen() const { + return true; + } + protected: HistoryItem *_parent; int _width = 0; diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 5d775c83c..3505b01f5 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "boxes/addcontactbox.h" #include "core/click_handler_types.h" #include "history/history_location_manager.h" +#include "styles/style_history.h" namespace { @@ -408,7 +409,7 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, overlayCorners); } - if (notChild && (radial || (!loaded && !_data->loading()))) { + if (radial || (!loaded && !_data->loading())) { float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1; QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize); p.setPen(Qt::NoPen); @@ -432,17 +433,18 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin p.setOpacity(radial ? _animation->radial.opacity() : 1); p.setOpacity(radialOpacity); - style::sprite icon; - if (radial || _data->loading()) { - DelayedStorageImage *delayed = _data->full->toDelayedStorageImage(); - if (!delayed || !delayed->location().isNull()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); + auto icon = ([radial, this, selected]() -> const style::icon* { + if (radial || _data->loading()) { + auto delayed = _data->full->toDelayedStorageImage(); + if (!delayed || !delayed->location().isNull()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return nullptr; } - } else { - icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } - if (!icon.isEmpty()) { - p.drawSpriteCenter(inner, icon); + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + if (icon) { + icon->paintInCenter(p, inner); } if (radial) { p.setOpacity(1); @@ -769,15 +771,15 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin p.setOpacity(1); } - style::sprite icon; - if (loaded) { - icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); - } else if (radial || _data->loading()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); - } else { - icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } - p.drawSpriteCenter(inner, icon); + auto icon = ([loaded, radial, this, selected] { + if (loaded) { + return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay); + } else if (radial || _data->loading()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + icon->paintInCenter(p, inner); if (radial) { QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); _animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg); @@ -1122,14 +1124,14 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection, p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setOpacity(radialOpacity); - style::sprite icon; - if (radial || _data->loading()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); - } else { - icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } + auto icon = ([radial, this, selected] { + if (radial || _data->loading()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1); - p.drawSpriteCenter(inner, icon); + icon->paintInCenter(p, inner); if (radial) { p.setOpacity(1); @@ -1174,23 +1176,22 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection, _animation->radial.draw(p, rinner, st::msgFileRadialLine, bg); } - style::sprite icon; - if (showPause) { - icon = outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause); - } else if (radial || _data->loading()) { - icon = outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); - } else if (loaded) { - if (_data->song() || _data->voice()) { - icon = outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); - } else if (_data->isImage()) { - icon = outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage); - } else { - icon = outbg ? (selected ? st::msgFileOutFileSelected : st::msgFileOutFile) : (selected ? st::msgFileInFileSelected : st::msgFileInFile); + auto icon = ([showPause, radial, this, loaded, outbg, selected] { + if (showPause) { + return &(outbg ? (selected ? st::historyFileOutPauseSelected : st::historyFileOutPause) : (selected ? st::historyFileInPauseSelected : st::historyFileInPause)); + } else if (radial || _data->loading()) { + return &(outbg ? (selected ? st::historyFileOutCancelSelected : st::historyFileOutCancel) : (selected ? st::historyFileInCancelSelected : st::historyFileInCancel)); + } else if (loaded) { + if (_data->song() || _data->voice()) { + return &(outbg ? (selected ? st::historyFileOutPlaySelected : st::historyFileOutPlay) : (selected ? st::historyFileInPlaySelected : st::historyFileInPlay)); + } else if (_data->isImage()) { + return &(outbg ? (selected ? st::historyFileOutImageSelected : st::historyFileOutImage) : (selected ? st::historyFileInImageSelected : st::historyFileInImage)); + } + return &(outbg ? (selected ? st::historyFileOutDocumentSelected : st::historyFileOutDocument) : (selected ? st::historyFileInDocumentSelected : st::historyFileInDocument)); } - } else { - icon = outbg ? (selected ? st::msgFileOutDownloadSelected : st::msgFileOutDownload) : (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } - p.drawSpriteCenter(inner, icon); + return &(outbg ? (selected ? st::historyFileOutDownloadSelected : st::historyFileOutDownload) : (selected ? st::historyFileInDownloadSelected : st::historyFileInDownload)); + })(); + icon->paintInCenter(p, inner); } int32 namewidth = _width - nameleft - nameright; @@ -1746,18 +1747,19 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6 p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setOpacity(radialOpacity); - style::sprite icon; - if (_data->loaded() && !radial) { - icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); - } else if (radial || _data->loading()) { - if (_parent->id > 0 || _data->uploading()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); + auto icon = ([this, radial, selected]() -> const style::icon * { + if (_data->loaded() && !radial) { + return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay); + } else if (radial || _data->loading()) { + if (_parent->id > 0 || _data->uploading()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return nullptr; } - } else { - icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } - if (!icon.isEmpty()) { - p.drawSpriteCenter(inner, icon); + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + if (icon) { + icon->paintInCenter(p, inner); } if (radial) { p.setOpacity(1); @@ -2651,7 +2653,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost; bool selected = (selection == FullSelection); - style::color barfg = (selected ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); + style::color barfg = (selected ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor)); style::color semibold = (selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg)); style::color regular = (selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) : (outbg ? st::msgOutDateFg : st::msgInDateFg)); @@ -2729,10 +2731,12 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height(); if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) { - if (_data->siteName == qstr("YouTube")) { - p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon); - } else { - p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon); + if (_attach->isReadyForOpen()) { + if (_data->siteName == qstr("YouTube")) { + p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon); + } else { + p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon); + } } if (_durationWidth) { int32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); @@ -2811,7 +2815,7 @@ HistoryTextState HistoryWebPage::getState(int x, int y, HistoryStateRequest requ if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth(); result = _attach->getState(x - attachLeft, y - attachTop, request); - if (result.link && !_data->document && _data->photo) { + if (result.link && !_data->document && _data->photo && _attach->isReadyForOpen()) { if (_data->type == WebPageProfile || _data->type == WebPageVideo) { result.link = _openl; } else if (_data->type == WebPagePhoto || _data->siteName == qstr("Twitter") || _data->siteName == qstr("Facebook")) { @@ -3048,7 +3052,7 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, uint bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost; bool selected = (selection == FullSelection); - style::color barfg = (selected ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); + style::color barfg = (selected ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor)); style::color semibold = (selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg)); style::color regular = (selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) : (outbg ? st::msgOutDateFg : st::msgInDateFg)); @@ -3160,7 +3164,11 @@ HistoryTextState HistoryGame::getState(int x, int y, HistoryStateRequest request if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth(); if (x >= attachLeft && x < attachLeft + _attach->currentWidth() && y >= tshift && y < _height - bshift) { - result.link = _openl; + if (_attach->isReadyForOpen()) { + result.link = _openl; + } else { + result = _attach->getState(x - attachLeft, y - attachTop, request); + } } } diff --git a/Telegram/SourceFiles/history/history_media_types.h b/Telegram/SourceFiles/history/history_media_types.h index 341f278b6..45c0ea3ea 100644 --- a/Telegram/SourceFiles/history/history_media_types.h +++ b/Telegram/SourceFiles/history/history_media_types.h @@ -172,6 +172,9 @@ public: bool hideFromName() const override { return true; } + bool isReadyForOpen() const override { + return _data->loaded(); + } protected: float64 dataProgress() const override { @@ -481,6 +484,9 @@ public: bool hideFromName() const override { return true; } + bool isReadyForOpen() const override { + return _data->loaded(); + } ~HistoryGif(); diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 0190a3ec3..dc23b998d 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -29,6 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "history/history_service_layout.h" #include "history/history_media_types.h" #include "styles/style_dialogs.h" +#include "styles/style_history.h" namespace { @@ -244,7 +245,7 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in style::color bar; if (flags & PaintInBubble) { - bar = ((flags & PaintSelected) ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); + bar = ((flags & PaintSelected) ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor)); } else { bar = st::white; } @@ -338,8 +339,8 @@ void HistoryMessage::KeyboardStyle::paintButtonIcon(Painter &p, const QRect &rec } void HistoryMessage::KeyboardStyle::paintButtonLoading(Painter &p, const QRect &rect) const { - style::sprite sprite = st::msgInvSendingImg; - p.drawSprite(rect.x() + rect.width() - sprite.pxWidth() - st::msgBotKbIconPadding, rect.y() + rect.height() - sprite.pxHeight() - st::msgBotKbIconPadding, sprite); + auto icon = &st::historySendingInvertedIcon; + icon->paint(p, rect.x() + rect.width() - icon->width() - st::msgBotKbIconPadding, rect.y() + rect.height() - icon->height() - st::msgBotKbIconPadding, rect.x() * 2 + rect.width()); } int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const { @@ -352,7 +353,7 @@ int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::But case Button::Type::SwitchInlineSame: case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break; case Button::Type::Callback: - case Button::Type::Game: iconWidth = st::msgInvSendingImg.pxWidth(); break; + case Button::Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break; } if (iconWidth > 0) { result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding)); @@ -494,7 +495,7 @@ void HistoryMessage::updateMediaInBubbleState() { return; } - bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has(); + bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has() || Has(); bool hasSomethingBelow = false; if (!emptyText()) { if (_media->isAboveMessage()) { @@ -1076,6 +1077,28 @@ bool HistoryMessage::textHasLinks() const { return emptyText() ? false : _text.hasLinks(); } +int HistoryMessage::infoWidth() const { + int result = _timeWidth; + if (auto views = Get()) { + result += st::historyViewsSpace + views->_viewsWidth + st::historyViewsWidth; + } else if (id < 0 && history()->peer->isSelf()) { + result += st::historySendStateSpace; + } + if (out() && !isPost()) { + result += st::historySendStateSpace; + } + return result; +} +int HistoryMessage::timeLeft() const { + int result = 0; + if (auto views = Get()) { + result += st::historyViewsSpace + views->_viewsWidth + st::historyViewsWidth; + } else if (id < 0 && history()->peer->isSelf()) { + result += st::historySendStateSpace; + } + return result; +} + void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const { p.setFont(st::msgDateFont); @@ -1122,43 +1145,38 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width p.drawText(dateX, dateY + st::msgDateFont->ascent, _timeText); } - QPoint iconPos; - const style::sprite *iconRect = nullptr; if (auto views = Get()) { - iconPos = QPoint(infoRight - infoW + st::msgViewsPos.x(), infoBottom - st::msgViewsImg.pxHeight() + st::msgViewsPos.y()); + auto icon = ([this, outbg, invertedsprites, selected] { + if (id > 0) { + if (outbg) { + return &(invertedsprites ? st::historyViewsInvertedIcon : (selected ? st::historyViewsOutSelectedIcon : st::historyViewsOutIcon)); + } + return &(invertedsprites ? st::historyViewsInvertedIcon : (selected ? st::historyViewsInSelectedIcon : st::historyViewsInIcon)); + } + return &(invertedsprites ? st::historyViewsSendingInvertedIcon : st::historyViewsSendingIcon); + })(); if (id > 0) { - if (outbg) { - iconRect = &(invertedsprites ? st::msgInvViewsImg : (selected ? st::msgSelectOutViewsImg : st::msgOutViewsImg)); - } else { - iconRect = &(invertedsprites ? st::msgInvViewsImg : (selected ? st::msgSelectViewsImg : st::msgViewsImg)); - } - p.drawText(iconPos.x() + st::msgViewsImg.pxWidth() + st::msgDateCheckSpace, infoBottom - st::msgDateFont->descent, views->_viewsText); - } else { - iconPos.setX(iconPos.x() + st::msgDateViewsSpace + views->_viewsWidth); - if (outbg) { - iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingOutViewsImg); - } else { - iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingViewsImg); - } + icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width); + p.drawText(infoRight - infoW + st::historyViewsWidth, infoBottom - st::msgDateFont->descent, views->_viewsText); + } else if (!outbg) { // sending outbg icon will be painted below + auto iconSkip = st::historyViewsSpace + views->_viewsWidth; + icon->paint(p, infoRight - infoW + iconSkip, infoBottom + st::historyViewsTop, width); } - p.drawSprite(iconPos, *iconRect); } else if (id < 0 && history()->peer->isSelf()) { - iconPos = QPoint(infoRight - infoW, infoBottom - st::msgViewsImg.pxHeight() + st::msgViewsPos.y()); - iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingViewsImg); - p.drawSprite(iconPos, *iconRect); + auto icon = &(invertedsprites ? st::historyViewsSendingInvertedIcon : st::historyViewsSendingIcon); + icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width); } if (outbg) { - iconPos = QPoint(infoRight - st::msgCheckImg.pxWidth() + st::msgCheckPos.x(), infoBottom - st::msgCheckImg.pxHeight() + st::msgCheckPos.y()); - if (id > 0) { - if (unread()) { - iconRect = &(invertedsprites ? st::msgInvCheckImg : (selected ? st::msgSelectCheckImg : st::msgCheckImg)); - } else { - iconRect = &(invertedsprites ? st::msgInvDblCheckImg : (selected ? st::msgSelectDblCheckImg : st::msgDblCheckImg)); + auto icon = ([this, invertedsprites, selected] { + if (id > 0) { + if (unread()) { + return &(invertedsprites ? st::historySentInvertedIcon : (selected ? st::historySentSelectedIcon : st::historySentIcon)); + } + return &(invertedsprites ? st::historyReceivedInvertedIcon : (selected ? st::historyReceivedSelectedIcon : st::historyReceivedIcon)); } - } else { - iconRect = &(invertedsprites ? st::msgInvSendingImg : st::msgSendingImg); - } - p.drawSprite(iconPos, *iconRect); + return &(invertedsprites ? st::historySendingInvertedIcon : st::historySendingIcon); + })(); + icon->paint(p, QPoint(infoRight, infoBottom) + st::historySendStatePosition, width); } } diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index 061420f38..c52e6490c 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -105,33 +105,14 @@ public: TextWithEntities originalText() const override; bool textHasLinks() const override; - int32 infoWidth() const override { - int32 result = _timeWidth; - if (const HistoryMessageViews *views = Get()) { - result += st::msgDateViewsSpace + views->_viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth(); - } else if (id < 0 && history()->peer->isSelf()) { - result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth(); - } - if (out() && !isPost()) { - result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth(); - } - return result; - } - int32 timeLeft() const override { - int32 result = 0; - if (const HistoryMessageViews *views = Get()) { - result += st::msgDateViewsSpace + views->_viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth(); - } else if (id < 0 && history()->peer->isSelf()) { - result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth(); - } - return result; - } - int32 timeWidth() const override { + int infoWidth() const override; + int timeLeft() const override; + int timeWidth() const override { return _timeWidth; } - int32 viewsCount() const override { - if (const HistoryMessageViews *views = Get()) { + int viewsCount() const override { + if (auto views = Get()) { return views->_views; } return HistoryItem::viewsCount(); diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index f9d2d09c8..8acdfad51 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -3454,6 +3454,7 @@ void HistoryWidget::updateSendAction(History *history, SendActionType type, int3 case SendActionUploadFile: action = MTP_sendMessageUploadDocumentAction(MTP_int(progress)); break; case SendActionChooseLocation: action = MTP_sendMessageGeoLocationAction(); break; case SendActionChooseContact: action = MTP_sendMessageChooseContactAction(); break; + case SendActionPlayGame: action = MTP_sendMessageGamePlayAction(); break; } _sendActionRequests.insert(qMakePair(history, type), MTP::send(MTPmessages_SetTyping(history->peer->input, action), rpcDone(&HistoryWidget::sendActionDone))); if (type == SendActionTyping) _sendActionStopTimer.start(5000); @@ -5817,7 +5818,8 @@ void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button } void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotCallbackAnswer &answer, mtpRequestId req) { - if (auto item = App::histItemById(info.msgId)) { + auto item = App::histItemById(info.msgId); + if (item) { if (auto markup = item->Get()) { if (info.row < markup->rows.size() && info.col < markup->rows.at(info.row).size()) { if (markup->rows.at(info.row).at(info.col).requestId == req) { @@ -5842,6 +5844,9 @@ void HistoryWidget::botCallbackDone(BotCallbackInfo info, const MTPmessages_BotC if (info.game) { url = appendShareGameScoreUrl(url, info.msgId); BotGameUrlClickHandler(info.bot, url).onClick(Qt::LeftButton); + if (item && (!item->history()->peer->isChannel() || item->history()->peer->isMegagroup())) { + updateSendAction(item->history(), SendActionPlayGame); + } } else { UrlClickHandler(url).onClick(Qt::LeftButton); } diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index eb02aa509..1cf2b6259 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "inline_bots/inline_bot_layout_internal.h" #include "styles/style_overview.h" +#include "styles/style_history.h" #include "inline_bots/inline_bot_result.h" #include "media/media_clip_reader.h" #include "media/player/media_player_instance.h" @@ -178,16 +179,16 @@ void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) cons p.setOpacity(radialOpacity * p.opacity()); p.setOpacity(radialOpacity); - style::sprite icon; - if (loaded && !radial) { - icon = st::msgFileInPlay; - } else if (radial || loading) { - icon = st::msgFileInCancel; - } else { - icon = st::msgFileInDownload; - } + auto icon = ([loaded, radial, loading] { + if (loaded && !radial) { + return &st::historyFileInPlay; + } else if (radial || loading) { + return &st::historyFileInCancel; + } + return &st::historyFileInDownload; + })(); QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize); - p.drawSpriteCenter(inner, icon); + icon->paintInCenter(p, inner); if (radial) { p.setOpacity(1); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); @@ -703,7 +704,7 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con bool showPause = updateStatusText(); bool radial = isRadialAnimation(context->ms); - QRect iconCircle = rtlrect(0, st::inlineRowMargin, st::msgFileSize, st::msgFileSize, _width); + auto inner = rtlrect(0, st::inlineRowMargin, st::msgFileSize, st::msgFileSize, _width); p.setPen(Qt::NoPen); if (isThumbAnimation(context->ms)) { float64 over = _animation->a_thumbOver.current(); @@ -714,31 +715,30 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con } p.setRenderHint(QPainter::HighQualityAntialiasing); - p.drawEllipse(iconCircle); + p.drawEllipse(inner); p.setRenderHint(QPainter::HighQualityAntialiasing, false); if (radial) { - QRect radialCircle(iconCircle.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); + auto radialCircle = inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)); _animation->radial.draw(p, radialCircle, st::msgFileRadialLine, st::msgInBg); } - style::sprite icon; - if (showPause) { - icon = st::msgFileInPause; - } else if (radial || document->loading()) { - icon = st::msgFileInCancel; - } else if (true || document->loaded()) { - if (document->isImage()) { - icon = st::msgFileInImage; - } else if (document->voice() || document->song()) { - icon = st::msgFileInPlay; - } else { - icon = st::msgFileInFile; + auto icon = ([showPause, radial, document] { + if (showPause) { + return &st::historyFileInPause; + } else if (radial || document->loading()) { + return &st::historyFileInCancel; + } else if (true || document->loaded()) { + if (document->isImage()) { + return &st::historyFileInImage; + } else if (document->voice() || document->song()) { + return &st::historyFileInPlay; + } + return &st::historyFileInDocument; } - } else { - icon = st::msgFileInDownload; - } - p.drawSpriteCenter(iconCircle, icon); + return &st::historyFileInDownload; + })(); + icon->paintInCenter(p, inner); int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop; int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop; diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp index 16382fe1c..700ea0174 100644 --- a/Telegram/SourceFiles/layerwidget.cpp +++ b/Telegram/SourceFiles/layerwidget.cpp @@ -220,7 +220,6 @@ void LayerStackWidget::startHide() { if (isHidden() || _hiding) { return; } - _hiding = true; startAnimation(0); } @@ -653,13 +652,11 @@ QPixmap MediaPreviewWidget::currentImage() const { if (_cacheStatus != CacheLoaded) { if (_photo->full->loaded()) { QSize s = currentDimensions(); - LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height())); _cache = _photo->full->pix(s.width(), s.height()); _cacheStatus = CacheLoaded; } else { if (_cacheStatus != CacheThumbLoaded && _photo->thumb->loaded()) { QSize s = currentDimensions(); - LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height())); _cache = _photo->thumb->pixBlurred(s.width(), s.height()); _cacheStatus = CacheThumbLoaded; } diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index 0a3a62d58..56129b5dc 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "stdafx.h" #include "mainwindow.h" +#include "dialogs/dialogs_layout.h" #include "styles/style_dialogs.h" #include "zip.h" #include "lang.h" @@ -182,12 +183,9 @@ void NotifyWindow::updateNotifyDisplay() { QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height); if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) { - if (history->peer->isChat() || history->peer->isMegagroup()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); - } else if (history->peer->isChannel()) { - p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), st::dlgChannelImg); - rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); + if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(history->peer, false)) { + chatTypeIcon->paint(p, rectForName.topLeft(), w); + rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip); } } diff --git a/Telegram/SourceFiles/media/view/mediaview.style b/Telegram/SourceFiles/media/view/mediaview.style index 0c1abb341..99de22070 100644 --- a/Telegram/SourceFiles/media/view/mediaview.style +++ b/Telegram/SourceFiles/media/view/mediaview.style @@ -51,40 +51,51 @@ mediaviewPlayButton: IconButton { opacity: mediaviewInactiveOpacity; overOpacity: mediaviewActiveOpacity; - icon: icon { - { "media_play", #ffffff, point(3px, 0px) }, - }; + icon: icon {{ "media_play", #ffffff, point(3px, 0px) }}; iconPosition: point(3px, 1px); downIconPosition: point(3px, 1px); duration: mediaviewOverDuration; } -mediaviewPauseIcon: icon { - { "media_pause", #ffffff, point(1px, 1px) } -}; +mediaviewPauseIcon: icon {{ "media_pause", #ffffff, point(1px, 1px) }}; mediaviewPlayPauseLeft: 17px; mediaviewFullScreenLeft: 17px; mediaviewVolumeLeft: 15px; mediaviewFullScreenButton: IconButton(mediaviewPlayButton) { - icon: icon { - { "media_fullscreen_to", #ffffff, point(0px, 0px) }, - }; + icon: icon {{ "media_fullscreen_to", #ffffff, point(0px, 0px) }}; iconPosition: point(0px, 1px); downIconPosition: point(0px, 1px); } -mediaviewFullScreenOutIcon: icon { - { "media_fullscreen_from", #ffffff, point(0px, 0px) }, -}; +mediaviewFullScreenOutIcon: icon {{ "media_fullscreen_from", #ffffff, point(0px, 0px) }}; mediaviewPlaybackTop: 28px; mediaviewVolumeSize: size(44px, 20px); -mediaviewVolumeIcon: icon { - { "media_volume", mediaviewPlaybackInactive, point(0px, 0px) }, -}; -mediaviewVolumeOnIcon: icon { - { "media_volume", mediaviewPlaybackActive, point(0px, 0px) }, -}; +mediaviewVolumeIcon: icon {{ "media_volume", mediaviewPlaybackInactive, point(0px, 0px) }}; +mediaviewVolumeOnIcon: icon {{ "media_volume", mediaviewPlaybackActive, point(0px, 0px) }}; mediaviewVolumeIconTop: 8px; mediaviewControllerRadius: 25px; + +mediaviewLeft: icon {{ "mediaview_previous", #ffffff }}; +mediaviewRight: icon {{ "mediaview_next", #ffffff }}; +mediaviewClose: icon {{ "mediaview_close", #ffffff }}; +mediaviewSave: icon {{ "mediaview_download", #ffffff }}; +mediaviewMore: icon {{ "mediaview_more", #ffffff }}; + +mediaviewFileRed: icon { + { size(25px, 25px), #ffffff }, + { "mediaview_file_corner", #d55959 }, +}; +mediaviewFileYellow: icon { + { size(25px, 25px), #ffffff }, + { "mediaview_file_corner", #e8a659 }, +}; +mediaviewFileGreen: icon { + { size(25px, 25px), #ffffff }, + { "mediaview_file_corner", #49a957 }, +}; +mediaviewFileBlue: icon { + { size(25px, 25px), #ffffff }, + { "mediaview_file_corner", #599dcf }, +}; diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 7c400bbb0..2bbd3b462 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -160,11 +160,11 @@ void MediaView::moveToScreen() { int32 navSkip = 2 * st::mvControlMargin + st::mvControlSize; _closeNav = myrtlrect(width() - st::mvControlMargin - st::mvControlSize, st::mvControlMargin, st::mvControlSize, st::mvControlSize); - _closeNavIcon = centersprite(_closeNav, st::mvClose); + _closeNavIcon = centerrect(_closeNav, st::mediaviewClose); _leftNav = myrtlrect(st::mvControlMargin, navSkip, st::mvControlSize, height() - 2 * navSkip); - _leftNavIcon = centersprite(_leftNav, st::mvLeft); + _leftNavIcon = centerrect(_leftNav, st::mediaviewLeft); _rightNav = myrtlrect(width() - st::mvControlMargin - st::mvControlSize, navSkip, st::mvControlSize, height() - 2 * navSkip); - _rightNavIcon = centersprite(_rightNav, st::mvRight); + _rightNavIcon = centerrect(_rightNav, st::mediaviewRight); _saveMsg.moveTo((width() - _saveMsg.width()) / 2, (height() - _saveMsg.height()) / 2); } @@ -327,9 +327,9 @@ void MediaView::updateControls() { _saveVisible = ((_photo && _photo->loaded()) || (_doc && (_doc->loaded(DocumentData::FilePathResolveChecked) || (!fileShown() && (_photo || _doc))))); _saveNav = myrtlrect(width() - st::mvIconSize.width() * 2, height() - st::mvIconSize.height(), st::mvIconSize.width(), st::mvIconSize.height()); - _saveNavIcon = centersprite(_saveNav, st::mvSave); + _saveNavIcon = centerrect(_saveNav, st::mediaviewSave); _moreNav = myrtlrect(width() - st::mvIconSize.width(), height() - st::mvIconSize.height(), st::mvIconSize.width(), st::mvIconSize.height()); - _moreNavIcon = centersprite(_moreNav, st::mvMore); + _moreNavIcon = centerrect(_moreNav, st::mediaviewMore); QDateTime d, dNow(date(unixtime())); if (_photo) { @@ -1235,7 +1235,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty if (!_doc || _doc->thumb->isNull()) { int32 colorIndex = documentColorIndex(_doc, _docExt); _docIconColor = documentColor(colorIndex); - style::sprite thumbs[] = { st::mvDocBlue, st::mvDocGreen, st::mvDocRed, st::mvDocYellow }; + const style::icon *(thumbs[]) = { &st::mediaviewFileBlue, &st::mediaviewFileGreen, &st::mediaviewFileRed, &st::mediaviewFileYellow }; _docIcon = thumbs[colorIndex]; int32 extmaxw = (st::mvDocIconSize - st::mvDocExtPadding * 2); @@ -1552,7 +1552,7 @@ void MediaView::paintEvent(QPaintEvent *e) { } else { p.setOpacity(st::mvBgOpacity); for (int i = 0, l = region.rectCount(); i < l; ++i) { - p.fillRect(rs.at(i), st::mvBgColor->b); + p.fillRect(rs.at(i), st::mvBgColor); } p.setCompositionMode(m); } @@ -1664,8 +1664,8 @@ void MediaView::paintEvent(QPaintEvent *e) { } if (!_doc || _doc->thumb->isNull()) { p.fillRect(_docIconRect, _docIconColor->b); - if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1)) { - p.drawSprite(_docIconRect.topLeft() + QPoint(rtl() ? 0 : (_docIconRect.width() - _docIcon.pxWidth()), 0), _docIcon); + if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1) && _docIcon) { + _docIcon->paint(p, _docIconRect.x() + (_docIconRect.width() - _docIcon->width()), _docIconRect.y(), width()); p.setPen(st::mvDocExtColor->p); p.setFont(st::mvDocExtFont->f); if (!_docExt.isEmpty()) { @@ -1697,68 +1697,68 @@ void MediaView::paintEvent(QPaintEvent *e) { if (co > 0) { // left nav bar if (_leftNav.intersects(r) && _leftNavVisible) { - float64 o = overLevel(OverLeftNav); + auto o = overLevel(OverLeftNav); if (o > 0) { p.setOpacity(o * st::mvControlBgOpacity * co); for (int i = 0, l = region.rectCount(); i < l; ++i) { - QRect fill(_leftNav.intersected(rs.at(i))); + auto fill = _leftNav.intersected(rs.at(i)); if (!fill.isEmpty()) p.fillRect(fill, st::black->b); } } if (_leftNavIcon.intersects(r)) { p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); - p.drawSprite(_leftNavIcon.topLeft(), st::mvLeft); + st::mediaviewLeft.paintInCenter(p, _leftNavIcon); } } // right nav bar if (_rightNav.intersects(r) && _rightNavVisible) { - float64 o = overLevel(OverRightNav); + auto o = overLevel(OverRightNav); if (o > 0) { p.setOpacity(o * st::mvControlBgOpacity * co); for (int i = 0, l = region.rectCount(); i < l; ++i) { - QRect fill(_rightNav.intersected(rs.at(i))); + auto fill = _rightNav.intersected(rs.at(i)); if (!fill.isEmpty()) p.fillRect(fill, st::black); } } if (_rightNavIcon.intersects(r)) { p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); - p.drawSprite(_rightNavIcon.topLeft(), st::mvRight); + st::mediaviewRight.paintInCenter(p, _rightNavIcon); } } // close button if (_closeNav.intersects(r)) { - float64 o = overLevel(OverClose); + auto o = overLevel(OverClose); if (o > 0) { p.setOpacity(o * st::mvControlBgOpacity * co); for (int i = 0, l = region.rectCount(); i < l; ++i) { - QRect fill(_closeNav.intersected(rs.at(i))); + auto fill = _closeNav.intersected(rs.at(i)); if (!fill.isEmpty()) p.fillRect(fill, st::black); } } if (_closeNavIcon.intersects(r)) { p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); - p.drawSprite(_closeNavIcon.topLeft(), st::mvClose); + st::mediaviewClose.paintInCenter(p, _closeNavIcon); } } // save button if (_saveVisible && _saveNavIcon.intersects(r)) { - float64 o = overLevel(OverSave); + auto o = overLevel(OverSave); p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); - p.drawSprite(_saveNavIcon.topLeft(), st::mvSave); + st::mediaviewSave.paintInCenter(p, _saveNavIcon); } // more area if (_moreNavIcon.intersects(r)) { - float64 o = overLevel(OverMore); + auto o = overLevel(OverMore); p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); - p.drawSprite(_moreNavIcon.topLeft(), st::mvMore); + st::mediaviewMore.paintInCenter(p, _moreNavIcon); } - p.setPen(st::white->p); - p.setFont(st::mvThickFont->f); + p.setPen(st::white); + p.setFont(st::mvThickFont); // header if (_headerNav.intersects(r)) { diff --git a/Telegram/SourceFiles/mediaview.h b/Telegram/SourceFiles/mediaview.h index 361202e4d..01c0bb2be 100644 --- a/Telegram/SourceFiles/mediaview.h +++ b/Telegram/SourceFiles/mediaview.h @@ -229,7 +229,7 @@ private: bool gifShown() const; void stopGif(); - style::sprite _docIcon; + const style::icon *_docIcon = nullptr; style::color _docIconColor; QString _docName, _docSize, _docExt; int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0; diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index a68bf1fc4..c6887c5a2 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -479,6 +479,8 @@ sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction; +sendMessageGamePlayAction#dd6a8f48 = SendMessageAction; +sendMessageGameStopAction#15c2c99a = SendMessageAction; contacts.found#1aa1f784 results:Vector chats:Vector users:Vector = contacts.Found; @@ -649,7 +651,7 @@ inputBotInlineMessageText#3dcd7a87 flags:# no_webpage:flags.0?true message:strin inputBotInlineMessageMediaGeo#f4a59de1 flags:# geo_point:InputGeoPoint reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaVenue#aaafadc8 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineMessageMediaContact#2daf01a7 flags:# phone_number:string first_name:string last_name:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; -inputBotInlineMessageGame#3c00f8aa reply_markup:ReplyMarkup = InputBotInlineMessage; +inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage; inputBotInlineResult#2cbbe15a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb_url:flags.4?string content_url:flags.5?string content_type:flags.5?string w:flags.6?int h:flags.6?int duration:flags.7?int send_message:InputBotInlineMessage = InputBotInlineResult; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult; diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp index 4d9b5e892..66dc94129 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -3896,6 +3896,14 @@ void _serialize_sendMessageChooseContactAction(MTPStringLogger &to, int32 stage, to.add("{ sendMessageChooseContactAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } +void _serialize_sendMessageGamePlayAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ sendMessageGamePlayAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_sendMessageGameStopAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ sendMessageGameStopAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + void _serialize_contacts_found(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); @@ -5387,6 +5395,8 @@ void _serialize_inputBotInlineMessageMediaContact(MTPStringLogger &to, int32 sta } void _serialize_inputBotInlineMessageGame(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDinputBotInlineMessageGame::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5394,7 +5404,8 @@ void _serialize_inputBotInlineMessageGame(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" reply_markup: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPDinputBotInlineMessageGame::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } @@ -9144,6 +9155,8 @@ namespace { _serializers.insert(mtpc_sendMessageUploadDocumentAction, _serialize_sendMessageUploadDocumentAction); _serializers.insert(mtpc_sendMessageGeoLocationAction, _serialize_sendMessageGeoLocationAction); _serializers.insert(mtpc_sendMessageChooseContactAction, _serialize_sendMessageChooseContactAction); + _serializers.insert(mtpc_sendMessageGamePlayAction, _serialize_sendMessageGamePlayAction); + _serializers.insert(mtpc_sendMessageGameStopAction, _serialize_sendMessageGameStopAction); _serializers.insert(mtpc_contacts_found, _serialize_contacts_found); _serializers.insert(mtpc_inputPrivacyKeyStatusTimestamp, _serialize_inputPrivacyKeyStatusTimestamp); _serializers.insert(mtpc_inputPrivacyKeyChatInvite, _serialize_inputPrivacyKeyChatInvite); diff --git a/Telegram/SourceFiles/mtproto/scheme_auto.h b/Telegram/SourceFiles/mtproto/scheme_auto.h index 66f7527d5..d72360477 100644 --- a/Telegram/SourceFiles/mtproto/scheme_auto.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -353,6 +353,8 @@ enum { mtpc_sendMessageUploadDocumentAction = 0xaa0cd9e4, mtpc_sendMessageGeoLocationAction = 0x176f8ba1, mtpc_sendMessageChooseContactAction = 0x628cbc6f, + mtpc_sendMessageGamePlayAction = 0xdd6a8f48, + mtpc_sendMessageGameStopAction = 0x15c2c99a, mtpc_contacts_found = 0x1aa1f784, mtpc_inputPrivacyKeyStatusTimestamp = 0x4f96cb18, mtpc_inputPrivacyKeyChatInvite = 0xbdfb0426, @@ -474,7 +476,7 @@ enum { mtpc_inputBotInlineMessageMediaGeo = 0xf4a59de1, mtpc_inputBotInlineMessageMediaVenue = 0xaaafadc8, mtpc_inputBotInlineMessageMediaContact = 0x2daf01a7, - mtpc_inputBotInlineMessageGame = 0x3c00f8aa, + mtpc_inputBotInlineMessageGame = 0x4b425864, mtpc_inputBotInlineResult = 0x2cbbe15a, mtpc_inputBotInlineResultPhoto = 0xa8d864a7, mtpc_inputBotInlineResultDocument = 0xfff8fdc4, @@ -14639,11 +14641,22 @@ public: class MTPDinputBotInlineMessageGame : public mtpDataImpl { public: + enum class Flag : int32 { + f_reply_markup = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } + MTPDinputBotInlineMessageGame() { } - MTPDinputBotInlineMessageGame(const MTPReplyMarkup &_reply_markup) : vreply_markup(_reply_markup) { + MTPDinputBotInlineMessageGame(const MTPflags &_flags, const MTPReplyMarkup &_reply_markup) : vflags(_flags), vreply_markup(_reply_markup) { } + MTPflags vflags; MTPReplyMarkup vreply_markup; }; @@ -24778,6 +24791,12 @@ public: inline static MTPsendMessageAction new_sendMessageChooseContactAction() { return MTPsendMessageAction(mtpc_sendMessageChooseContactAction); } + inline static MTPsendMessageAction new_sendMessageGamePlayAction() { + return MTPsendMessageAction(mtpc_sendMessageGamePlayAction); + } + inline static MTPsendMessageAction new_sendMessageGameStopAction() { + return MTPsendMessageAction(mtpc_sendMessageGameStopAction); + } inline static MTPcontacts_found new_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users) { return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users)); } @@ -25141,8 +25160,8 @@ public: inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaContact(const MTPflags &_flags, const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, const MTPReplyMarkup &_reply_markup) { return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaContact(_flags, _phone_number, _first_name, _last_name, _reply_markup)); } - inline static MTPinputBotInlineMessage new_inputBotInlineMessageGame(const MTPReplyMarkup &_reply_markup) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageGame(_reply_markup)); + inline static MTPinputBotInlineMessage new_inputBotInlineMessageGame(const MTPflags &_flags, const MTPReplyMarkup &_reply_markup) { + return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageGame(_flags, _reply_markup)); } inline static MTPinputBotInlineResult new_inputBotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) { return MTPinputBotInlineResult(new MTPDinputBotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); @@ -32738,6 +32757,8 @@ inline void MTPsendMessageAction::read(const mtpPrime *&from, const mtpPrime *en } break; case mtpc_sendMessageGeoLocationAction: _type = cons; break; case mtpc_sendMessageChooseContactAction: _type = cons; break; + case mtpc_sendMessageGamePlayAction: _type = cons; break; + case mtpc_sendMessageGameStopAction: _type = cons; break; default: throw mtpErrorUnexpected(cons, "MTPsendMessageAction"); } } @@ -32773,6 +32794,8 @@ inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : mtpDataOwner case mtpc_sendMessageUploadDocumentAction: setData(new MTPDsendMessageUploadDocumentAction()); break; case mtpc_sendMessageGeoLocationAction: break; case mtpc_sendMessageChooseContactAction: break; + case mtpc_sendMessageGamePlayAction: break; + case mtpc_sendMessageGameStopAction: break; default: throw mtpErrorBadTypeId(type, "MTPsendMessageAction"); } } @@ -32814,6 +32837,12 @@ inline MTPsendMessageAction MTP_sendMessageGeoLocationAction() { inline MTPsendMessageAction MTP_sendMessageChooseContactAction() { return MTP::internal::TypeCreator::new_sendMessageChooseContactAction(); } +inline MTPsendMessageAction MTP_sendMessageGamePlayAction() { + return MTP::internal::TypeCreator::new_sendMessageGamePlayAction(); +} +inline MTPsendMessageAction MTP_sendMessageGameStopAction() { + return MTP::internal::TypeCreator::new_sendMessageGameStopAction(); +} inline MTPcontacts_found::MTPcontacts_found() : mtpDataOwner(new MTPDcontacts_found()) { } @@ -35653,7 +35682,7 @@ inline uint32 MTPinputBotInlineMessage::innerLength() const { } case mtpc_inputBotInlineMessageGame: { const MTPDinputBotInlineMessageGame &v(c_inputBotInlineMessageGame()); - return v.vreply_markup.innerLength(); + return v.vflags.innerLength() + (v.has_reply_markup() ? v.vreply_markup.innerLength() : 0); } } return 0; @@ -35710,7 +35739,8 @@ inline void MTPinputBotInlineMessage::read(const mtpPrime *&from, const mtpPrime case mtpc_inputBotInlineMessageGame: _type = cons; { if (!data) setData(new MTPDinputBotInlineMessageGame()); MTPDinputBotInlineMessageGame &v(_inputBotInlineMessageGame()); - v.vreply_markup.read(from, end); + v.vflags.read(from, end); + if (v.has_reply_markup()) { v.vreply_markup.read(from, end); } else { v.vreply_markup = MTPReplyMarkup(); } } break; default: throw mtpErrorUnexpected(cons, "MTPinputBotInlineMessage"); } @@ -35756,7 +35786,8 @@ inline void MTPinputBotInlineMessage::write(mtpBuffer &to) const { } break; case mtpc_inputBotInlineMessageGame: { const MTPDinputBotInlineMessageGame &v(c_inputBotInlineMessageGame()); - v.vreply_markup.write(to); + v.vflags.write(to); + if (v.has_reply_markup()) v.vreply_markup.write(to); } break; } } @@ -35803,8 +35834,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineMessageMediaContact::Flags) inline MTPinputBotInlineMessage MTP_inputBotInlineMessageMediaContact(const MTPflags &_flags, const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, const MTPReplyMarkup &_reply_markup) { return MTP::internal::TypeCreator::new_inputBotInlineMessageMediaContact(_flags, _phone_number, _first_name, _last_name, _reply_markup); } -inline MTPinputBotInlineMessage MTP_inputBotInlineMessageGame(const MTPReplyMarkup &_reply_markup) { - return MTP::internal::TypeCreator::new_inputBotInlineMessageGame(_reply_markup); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineMessageGame::Flags) +inline MTPinputBotInlineMessage MTP_inputBotInlineMessageGame(const MTPflags &_flags, const MTPReplyMarkup &_reply_markup) { + return MTP::internal::TypeCreator::new_inputBotInlineMessageGame(_flags, _reply_markup); } inline uint32 MTPinputBotInlineResult::innerLength() const { diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp index 6d7e47a92..ce9e2b1c0 100644 --- a/Telegram/SourceFiles/overview/overview_layout.cpp +++ b/Telegram/SourceFiles/overview/overview_layout.cpp @@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "overview/overview_layout.h" #include "styles/style_overview.h" +#include "styles/style_history.h" #include "ui/filedialog.h" #include "boxes/addcontactbox.h" #include "boxes/confirmbox.h" @@ -334,15 +335,15 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setOpacity((radial && loaded) ? _radial->opacity() : 1); - style::sprite icon; - if (radial) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); - } else if (loaded) { - icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); - } else { - icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } - p.drawSpriteCenter(inner, icon); + auto icon = ([radial, loaded, selected] { + if (radial) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } else if (loaded) { + return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay); + } + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + icon->paintInCenter(p, inner); if (radial) { p.setOpacity(1); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); @@ -462,17 +463,17 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const _radial->draw(p, rinner, st::msgFileRadialLine, bg); } - style::sprite icon; - if (showPause) { - icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause; - } else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) { - icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay; - } else if (_data->loading()) { - icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel; - } else { - icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload; - } - p.drawSpriteCenter(inner, icon); + auto icon = ([showPause, this, selected] { + if (showPause) { + return &(selected ? st::historyFileInPauseSelected : st::historyFileInPause); + } else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) { + return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay); + } else if (_data->loading()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + icon->paintInCenter(p, inner); } int32 namewidth = _width - nameleft - nameright; @@ -673,17 +674,17 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con _radial->draw(p, rinner, st::msgFileRadialLine, bg); } - style::sprite icon; - if (showPause) { - icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause; - } else if (loaded) { - icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay; - } else if (_data->loading()) { - icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel; - } else { - icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload; - } - p.drawSpriteCenter(inner, icon); + auto icon = ([showPause, loaded, this, selected] { + if (showPause) { + return &(selected ? st::historyFileInPauseSelected : st::historyFileInPause); + } else if (loaded) { + return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay); + } else if (_data->loading()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + icon->paintInCenter(p, inner); } } else { nameleft = st::overviewFileSize + st::overviewFilePadding.right(); @@ -749,13 +750,13 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setOpacity(radialOpacity); - style::sprite icon; - if (loaded || _data->loading()) { - icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); - } else { - icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); - } - p.drawSpriteCenter(inner, icon); + auto icon = ([loaded, this, selected] { + if (loaded || _data->loading()) { + return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel); + } + return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload); + })(); + icon->paintInCenter(p, inner); if (radial) { p.setOpacity(1); diff --git a/Telegram/SourceFiles/platform/win/main_window_win.cpp b/Telegram/SourceFiles/platform/win/main_window_win.cpp index 17d745abf..af4744cb9 100644 --- a/Telegram/SourceFiles/platform/win/main_window_win.cpp +++ b/Telegram/SourceFiles/platform/win/main_window_win.cpp @@ -529,7 +529,7 @@ private: }; _PsShadowWindows _psShadowWindows; -QColor _shActive(0, 0, 0), _shInactive(0, 0, 0); +QColor _shActive(0, 0, 0)/*, _shInactive(0, 0, 0)*/; LRESULT CALLBACK _PsShadowWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { auto wnd = App::wnd(); @@ -633,12 +633,12 @@ void MainWindow::shadowsUpdate(ShadowsChanges changes, WINDOWPOS *position) { } void MainWindow::shadowsActivate() { - _psShadowWindows.setColor(_shActive); +// _psShadowWindows.setColor(_shActive); shadowsUpdate(ShadowsChange::Activate); } void MainWindow::shadowsDeactivate() { - _psShadowWindows.setColor(_shInactive); +// _psShadowWindows.setColor(_shInactive); } void MainWindow::psShowTrayMenu() { diff --git a/Telegram/SourceFiles/profile/profile.style b/Telegram/SourceFiles/profile/profile.style index 574583292..45ede8414 100644 --- a/Telegram/SourceFiles/profile/profile.style +++ b/Telegram/SourceFiles/profile/profile.style @@ -25,9 +25,7 @@ profileBg: windowBg; profileTopBarHeight: topBarHeight; profileTopBarBackIconFg: #0290d7; -profileTopBarBackIcon: icon { - { "topbar_back_arrow", profileTopBarBackIconFg }, -}; +profileTopBarBackIcon: icon {{ "topbar_back_arrow", profileTopBarBackIconFg }}; profileTopBarBackIconPosition: point(15px, 20px); profileTopBarBackFont: font(14px); profileTopBarBackFg: #1485c2; @@ -69,9 +67,7 @@ profileSecondaryButton: RoundButton(profilePrimaryButton) { textBg: #ffffff; textBgOver: #f2f7fa; } -profileAddMemberIcon: icon { - { "profile_add_member", windowActiveBg, point(20px, 10px) }, -}; +profileAddMemberIcon: icon {{ "profile_add_member", windowActiveBg, point(20px, 10px) }}; profileAddMemberButton: RoundButton(profileSecondaryButton) { width: 62px; icon: profileAddMemberIcon; @@ -89,12 +85,8 @@ profileDropAreaBorderWidth: 3px; profileDropAreaDuration: 200; profileDividerFg: windowShadowFg; -profileDividerLeft: icon { - { "profile_divider_left", profileDividerFg }, -}; -profileDividerFill: icon { - { "profile_divider_fill", profileDividerFg }, -}; +profileDividerLeft: icon {{ "profile_divider_left", profileDividerFg }}; +profileDividerFill: icon {{ "profile_divider_fill", profileDividerFg }}; profileBlocksTop: 7px; profileBlocksBottom: 20px; @@ -143,9 +135,7 @@ profileMemberStatusPosition: point(68px, 31px); profileMemberStatusFg: windowSubTextFg; profileMemberStatusFgOver: windowSubTextFgOver; profileMemberStatusFgActive: windowActiveTextFg; -profileMemberAdminIcon: icon { - { "profile_admin_star", #3babe7, point(4px, 3px) }, -}; +profileMemberAdminIcon: icon {{ "profile_admin_star", #3babe7, point(4px, 3px) }}; profileLimitReachedLabel: flatLabel(labelDefFlat) { width: 180px; margin: margins(profileMemberPaddingLeft, 9px, profileMemberPaddingLeft, 6px); @@ -159,8 +149,8 @@ profileReportReasonOther: InputArea(defaultInputArea) { heightMax: 115px; } -profileVerifiedCheckPosition: point(-3px, 7px); +profileVerifiedCheckShift: -3px; profileVerifiedCheck: icon { - { "profile_verified_star", #4abcf1 }, - { "profile_verified_check", #ffffff, point(4px, 4px) } + { "profile_verified_star", #4abcf1, point(0px, 7px) }, + { "profile_verified_check", #ffffff, point(4px, 11px) } }; diff --git a/Telegram/SourceFiles/profile/profile_cover.cpp b/Telegram/SourceFiles/profile/profile_cover.cpp index cb13f68fc..a30bc20be 100644 --- a/Telegram/SourceFiles/profile/profile_cover.cpp +++ b/Telegram/SourceFiles/profile/profile_cover.cpp @@ -151,7 +151,7 @@ void CoverWidget::refreshNameGeometry(int newWidth) { int nameTop = _userpicButton->y() + st::profileNameTop - st::profileNameLabel.margin.top(); int nameWidth = newWidth - infoLeft - st::profileNameLeft; if (_peer->isVerified()) { - nameWidth -= st::profileVerifiedCheckPosition.x() + st::profileVerifiedCheck.width(); + nameWidth -= st::profileVerifiedCheckShift + st::profileVerifiedCheck.width(); } int marginsAdd = st::profileNameLabel.margin.left() + st::profileNameLabel.margin.right(); _name->resizeToWidth(qMin(nameWidth - marginsAdd, _name->naturalWidth()) + marginsAdd); @@ -207,7 +207,7 @@ void CoverWidget::paintEvent(QPaintEvent *e) { p.drawTextLeft(_statusPosition.x(), _statusPosition.y(), width(), _statusText); if (_peer->isVerified()) { - st::profileVerifiedCheck.paint(p, QPoint(_name->x() + _name->width(), _name->y()) + st::profileVerifiedCheckPosition, width()); + st::profileVerifiedCheck.paint(p, _name->x() + _name->width() + st::profileVerifiedCheckShift, _name->y(), width()); } paintDivider(p); diff --git a/Telegram/SourceFiles/settings/settings.style b/Telegram/SourceFiles/settings/settings.style index db2d6d930..bf41030ca 100644 --- a/Telegram/SourceFiles/settings/settings.style +++ b/Telegram/SourceFiles/settings/settings.style @@ -39,9 +39,7 @@ settingsFixedBarClose: IconButton { opacity: 0.31; overOpacity: 0.5; - icon: icon { - { "settings_close", #000000, point(0px, 0px) }, - }; + icon: icon {{ "settings_close", #000000, point(0px, 0px) }}; iconPosition: point(20px, 20px); downIconPosition: point(20px, 20px); diff --git a/Telegram/SourceFiles/stickers/stickers.style b/Telegram/SourceFiles/stickers/stickers.style index ae74a48f7..c215aadcf 100644 --- a/Telegram/SourceFiles/stickers/stickers.style +++ b/Telegram/SourceFiles/stickers/stickers.style @@ -40,9 +40,7 @@ featuredStickersAdd: RoundButton(defaultActiveButton) { stickerEmojiSkip: 5px; -stickersAddIcon: icon { - { "stickers_add", #ffffff }, -}; +stickersAddIcon: icon {{ "stickers_add", #ffffff }}; stickersAddSize: size(30px, 24px); stickersFeaturedHeight: 32px; @@ -55,6 +53,4 @@ stickersFeaturedUnreadBg: msgFileInBg; stickersFeaturedUnreadSize: 5px; stickersFeaturedUnreadSkip: 5px; stickersFeaturedUnreadTop: 7px; -stickersFeaturedInstalled: icon { - { "mediaview_save_check", #40ace3 } -}; +stickersFeaturedInstalled: icon {{ "mediaview_save_check", #40ace3 }}; diff --git a/Telegram/SourceFiles/sysbuttons.cpp b/Telegram/SourceFiles/sysbuttons.cpp index 859e5b9ca..7db90ca2f 100644 --- a/Telegram/SourceFiles/sysbuttons.cpp +++ b/Telegram/SourceFiles/sysbuttons.cpp @@ -32,14 +32,14 @@ SysBtn::SysBtn(QWidget *parent, const style::sysButton &st, const QString &text) , _a_color(animation(this, &SysBtn::step_color)) , _overLevel(0) , _text(text) { - int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text))); + int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.icon.width()) / 2 + st::titleTextButton.font->width(_text))); resize(w, _st.size.height()); setCursor(style::cur_default); } void SysBtn::setText(const QString &text) { _text = text; - int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text))); + int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.icon.width()) / 2 + st::titleTextButton.font->width(_text))); resize(w, _st.size.height()); } @@ -63,7 +63,7 @@ void SysBtn::onStateChanged(int oldState, ButtonStateChangeSource source) { void SysBtn::paintEvent(QPaintEvent *e) { Painter p(this); - int x = width() - ((_st.size.width() + _st.img.pxWidth()) / 2), y = (height() - _st.img.pxHeight()) / 2; + int x = width() - ((_st.size.width() + _st.icon.width()) / 2), y = (height() - _st.icon.height()) / 2; QColor c = a_color.current(); if (_overLevel > 0) { if (_overLevel >= 1) { @@ -74,13 +74,13 @@ void SysBtn::paintEvent(QPaintEvent *e) { c.setBlueF(c.blueF() * (1 - _overLevel) + _st.overColor->c.blueF() * _overLevel); } } - p.fillRect(x, y, _st.img.pxWidth(), _st.img.pxHeight(), c); - p.drawSprite(QPoint(x, y), _st.img); + p.fillRect(x, y, _st.icon.width(), _st.icon.height(), c); + _st.icon.paint(p, x, y, width()); if (!_text.isEmpty()) { p.setFont(st::titleTextButton.font->f); p.setPen(c); - p.drawText((_st.size.width() - _st.img.pxWidth()) / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, _text); + p.drawText((_st.size.width() - _st.icon.width()) / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, _text); } } diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp index 4279df77d..f28c19004 100644 --- a/Telegram/SourceFiles/title.cpp +++ b/Telegram/SourceFiles/title.cpp @@ -124,8 +124,8 @@ void TitleWidget::paintEvent(QPaintEvent *e) { Painter p(this); p.fillRect(rect(), st::titleBg); if (!_cancel.isHidden()) { - p.setPen(st::titleTextButton.color->p); - p.setFont(st::titleTextButton.font->f); + p.setPen(st::titleTextButton.color); + p.setFont(st::titleTextButton.font); bool inlineSwitchChoose = (App::main() && App::main()->selectingPeerForInlineSwitch()); auto chooseText = lang(inlineSwitchChoose ? lng_inline_switch_choose : lng_forward_choose); p.drawText(st::titleMenuOffset - st::titleTextButton.width / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, chooseText); diff --git a/Telegram/SourceFiles/ui/style/style_core.h b/Telegram/SourceFiles/ui/style/style_core.h index 19f4b11b9..f3848978a 100644 --- a/Telegram/SourceFiles/ui/style/style_core.h +++ b/Telegram/SourceFiles/ui/style/style_core.h @@ -37,6 +37,9 @@ inline QRect rtlrect(const QRect &r, int outerw) { inline QRect centerrect(const QRect &inRect, const QRect &rect) { return QRect(inRect.x() + (inRect.width() - rect.width()) / 2, inRect.y() + (inRect.height() - rect.height()) / 2, rect.width(), rect.height()); } +inline QRect centerrect(const QRect &inRect, const style::icon &icon) { + return centerrect(inRect, QRect(0, 0, icon.width(), icon.height())); +} namespace style { namespace internal { diff --git a/Telegram/SourceFiles/ui/style/style_core_icon.h b/Telegram/SourceFiles/ui/style/style_core_icon.h index b4c4d2a65..822a491a9 100644 --- a/Telegram/SourceFiles/ui/style/style_core_icon.h +++ b/Telegram/SourceFiles/ui/style/style_core_icon.h @@ -89,8 +89,8 @@ public: Icon(const ColoredCopy &makeCopy) { _parts.reserve(makeCopy.copyFrom._parts.size()); auto colorIt = makeCopy.colors.cbegin(), colorsEnd = makeCopy.colors.cend(); - for_const (const auto &part, makeCopy.copyFrom._parts) { - const auto &newPart = part.clone((colorIt == colorsEnd) ? Color(Qt::Uninitialized) : *(colorIt++)); + for_const (auto &part, makeCopy.copyFrom._parts) { + auto newPart = part.clone((colorIt == colorsEnd) ? Color(Qt::Uninitialized) : *(colorIt++)); _parts.push_back(newPart); } } @@ -106,6 +106,12 @@ public: } void paint(QPainter &p, const QPoint &pos, int outerw) const; + void paint(QPainter &p, int x, int y, int outerw) const { + paint(p, QPoint(x, y), outerw); + } + void paintInCenter(QPainter &p, const QRect &outer) const { + paint(p, outer.x() + (outer.width() - width()) / 2, outer.y() + (outer.height() - height()) / 2, outer.x() * 2 + outer.width()); + } void fill(QPainter &p, const QRect &rect) const; int width() const; int height() const; diff --git a/Telegram/build/version b/Telegram/build/version index 37cdddf1e..78b24b0d9 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -3,4 +3,4 @@ AppVersionStrMajor 0.10 AppVersionStrSmall 0.10.8 AppVersionStr 0.10.8 AlphaChannel 0 -BetaVersion 10008003 +BetaVersion 10008005