Merge branch 'game_media' into player

Conflicts:
	Telegram/Resources/basic.style
	Telegram/SourceFiles/media/player/media_player_list.cpp
	Telegram/SourceFiles/title.cpp
This commit is contained in:
John Preston 2016-09-30 20:07:56 +03:00
commit 1b54ccb59c
110 changed files with 712 additions and 541 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -248,9 +248,7 @@ defaultCheckbox: Checkbox {
textPosition: point(32px, 2px); textPosition: point(32px, 2px);
diameter: 22px; diameter: 22px;
thickness: 2px; thickness: 2px;
checkIcon: icon { checkIcon: icon {{ "default_checkbox_check", #ffffff, point(4px, 7px) }};
{ "default_checkbox_check", #ffffff, point(4px, 7px) }
};
font: normalFont; font: normalFont;
duration: 120; duration: 120;
@ -445,47 +443,29 @@ titleButtonDuration: 150;
sysBtnDelta: 6px; sysBtnDelta: 6px;
sysUpd: sysButton { sysUpd: sysButton {
size: size(31px, 39px); size: size(31px, 39px);
img: sprite(184px, 1px, 19px, 19px); icon: icon {{ "title_button_update", titleBg }};
color: titleButtonFg; color: titleButtonFg;
overColor: titleButtonActiveFg; overColor: titleButtonActiveFg;
duration: titleButtonDuration; duration: titleButtonDuration;
} }
updateBlinkDuration: 500; updateBlinkDuration: 500;
sysMin: sysButton(sysUpd) { sysMin: sysButton(sysUpd) {
img: sprite(207px, 1px, 19px, 19px); icon: icon {{ "title_button_minimize", titleBg }};
} }
sysMax: sysButton(sysUpd) { sysMax: sysButton(sysUpd) {
img: sprite(230px, 1px, 19px, 19px); icon: icon {{ "title_button_maximize", titleBg }};
} }
sysRes: sysButton(sysUpd) { sysRes: sysButton(sysUpd) {
img: sprite(253px, 1px, 19px, 19px); icon: icon {{ "title_button_restore", titleBg }};
} }
sysCls: sysButton(sysUpd) { sysCls: sysButton(sysUpd) {
img: sprite(276px, 1px, 19px, 19px); icon: icon {{ "title_button_close", titleBg }};
} }
sysLock: sysButton(sysUpd) { sysLock: sysButton(sysUpd) {
img: sprite(184px, 22px, 19px, 19px); icon: icon {{ "title_button_lock", titleBg }};
} }
sysUnlock: sysButton(sysUpd) { sysUnlock: sysButton(sysUpd) {
img: sprite(207px, 22px, 19px, 19px); icon: icon {{ "title_button_unlock", titleBg }};
}
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);
} }
btnWhiteHover: #f5f5f5; btnWhiteHover: #f5f5f5;
@ -811,18 +791,6 @@ noContactsHeight: 100px;
noContactsFont: font(fsize); noContactsFont: font(fsize);
noContactsColor: #777; 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) { dlgFilter: flatInput(inpDefGray) {
font: font(fsize); font: font(fsize);
bgColor: #f2f2f2; bgColor: #f2f2f2;
@ -954,9 +922,7 @@ msgReplyPadding: margins(6px, 6px, 11px, 6px);
msgReplyBarPos: point(1px, 0px); msgReplyBarPos: point(1px, 0px);
msgReplyBarSize: size(2px, 36px); msgReplyBarSize: size(2px, 36px);
msgReplyBarSkip: 10px; msgReplyBarSkip: 10px;
msgOutReplyBarColor: #5dc452;
msgInReplyBarColor: #2fa9e2; msgInReplyBarColor: #2fa9e2;
msgOutReplyBarSelColor: #4da79f;
msgInReplyBarSelColor: #2fa9e2; msgInReplyBarSelColor: #2fa9e2;
msgBotKbDuration: 200; msgBotKbDuration: 200;
@ -990,28 +956,7 @@ msgPtr: 8px;
msgBG: ":/gui/art/bg.jpg"; msgBG: ":/gui/art/bg.jpg";
msgBG0: ":/gui/art/bg0.png"; 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; msgDateSpace: 12px;
msgDateCheckSpace: 4px;
msgDateViewsSpace: 11px;
msgDateDelta: point(2px, 5px); msgDateDelta: point(2px, 5px);
msgDateImgDelta: 4px; msgDateImgDelta: 4px;
@ -1171,31 +1116,6 @@ msgFileOutBg: #78c67f;
msgFileOutBgOver: #6bc272; msgFileOutBgOver: #6bc272;
msgFileOutBgSelected: #5fb389; 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); msgFileRed: sprite(0px, 425px, 20px, 20px);
msgFileYellow: sprite(20px, 425px, 20px, 20px); msgFileYellow: sprite(20px, 425px, 20px, 20px);
msgFileGreen: sprite(40px, 425px, 20px, 20px); msgFileGreen: sprite(40px, 425px, 20px, 20px);
@ -1627,9 +1547,7 @@ dropdownDef: dropdown {
width: 0px; width: 0px;
} }
defaultInnerDropdownShadow: icon { defaultInnerDropdownShadow: icon {{ "dropdown_shadow", windowShadowFg }};
{ "dropdown_shadow", windowShadowFg },
};
defaultInnerDropdown: InnerDropdown { defaultInnerDropdown: InnerDropdown {
padding: margins(10px, 10px, 10px, 10px); padding: margins(10px, 10px, 10px, 10px);
shadow: defaultInnerDropdownShadow; shadow: defaultInnerDropdownShadow;
@ -1863,10 +1781,6 @@ stickerPreviewDuration: 150;
stickerPreviewBg: #FFFFFFB0; stickerPreviewBg: #FFFFFFB0;
stickerPreviewMin: 0.1; stickerPreviewMin: 0.1;
verifiedCheck: sprite(285px, 221px, 14px, 14px);
verifiedCheckInv: sprite(299px, 221px, 14px, 14px);
verifiedCheckPos: point(4px, 2px);
botKbDuration: 200; botKbDuration: 200;
botKbBg: #edf1f5; botKbBg: #edf1f5;
botKbOverBg: #d8e2ec; botKbOverBg: #d8e2ec;
@ -1925,12 +1839,6 @@ mvControlMargin: 0px;
mvControlSize: 90px; mvControlSize: 90px;
mvIconSize: size(60px, 56px); 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) { mvDropdown: dropdown(dropdownDef) {
shadow: sprite(0px, 0px, 0px, 0px); shadow: sprite(0px, 0px, 0px, 0px);
padding: margins(11px, 12px, 11px, 12px); padding: margins(11px, 12px, 11px, 12px);
@ -1992,10 +1900,6 @@ mvDocExtFont: font(semibold 18px);
mvDocExtColor: white; mvDocExtColor: white;
mvDocExtPadding: 10px; mvDocExtPadding: 10px;
mvDocLinksTop: 57px; 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; mvDocIconSize: 80px;
mvDocLink: linkButton(btnDefLink) { mvDocLink: linkButton(btnDefLink) {
@ -2013,9 +1917,7 @@ mvCaptionRadius: 2px;
mvCaptionBg: #11111180; mvCaptionBg: #11111180;
mvCaptionFont: font(fsize); mvCaptionFont: font(fsize);
medviewSaveMsgCheck: icon { medviewSaveMsgCheck: icon {{ "mediaview_save_check", #ffffff }};
{ "mediaview_save_check", #ffffff }
};
medviewSaveMsgFont: font(16px); medviewSaveMsgFont: font(16px);
medviewSaveMsgPadding: margins(55px, 19px, 29px, 20px); medviewSaveMsgPadding: margins(55px, 19px, 29px, 20px);
medviewSaveMsgCheckPos: point(23px, 21px); medviewSaveMsgCheckPos: point(23px, 21px);

View File

@ -40,7 +40,7 @@ linkButton {
sysButton { sysButton {
size: size; size: size;
img: sprite; icon: icon;
color: color; color: color;
overColor: color; overColor: color;
duration: int; duration: int;

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

View File

@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_allow_bot" = "Allow"; "lng_allow_bot" = "Allow";
"lng_bot_start" = "Start"; "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_no_groups" = "You have no groups";
"lng_bot_groups_not_found" = "No groups found"; "lng_bot_groups_not_found" = "No groups found";
"lng_bot_sure_invite" = "Add the bot to «{group}»?"; "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_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_no_chats" = "You have no chats";
"lng_bot_chats_not_found" = "No chats found"; "lng_bot_chats_not_found" = "No chats found";
"lng_bot_sure_share_game" = "Share the game with {user}?"; "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_user_typing" = "{user} is typing";
"lng_users_typing" = "{user} and {second_user} are typing"; "lng_users_typing" = "{user} and {second_user} are typing";
"lng_many_typing" = "{count:_not_used_|# is|# 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_send_action_record_video" = "recording a video";
"lng_user_action_record_video" = "{user} is recording a video"; "lng_user_action_record_video" = "{user} is recording a video";
"lng_send_action_upload_video" = "sending a video"; "lng_send_action_upload_video" = "sending a video";

View File

@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_user_typing" = "{user} tippt"; "lng_user_typing" = "{user} tippt";
"lng_users_typing" = "{user} und {second_user} tippen"; "lng_users_typing" = "{user} und {second_user} tippen";
"lng_many_typing" = "{count:_not_used_|# tippt|# 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_send_action_record_video" = "schickt Video";
"lng_user_action_record_video" = "{user} sendet ein Video"; "lng_user_action_record_video" = "{user} sendet ein Video";
"lng_send_action_upload_video" = "schickt ein Video"; "lng_send_action_upload_video" = "schickt ein Video";

View File

@ -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_emoji_sticker" = "un {emoji} sticker";
"lng_action_pinned_media_game" = "el juego «{game}»"; "lng_action_pinned_media_game" = "el juego «{game}»";
"lng_action_game_score" = "{from} consiguió {count:# puntos|# punto|# puntos} en {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_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."; "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_allow_bot" = "Permitir";
"lng_bot_start" = "Iniciar"; "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_no_groups" = "No tienes grupos";
"lng_bot_groups_not_found" = "No se encontraron grupos"; "lng_bot_groups_not_found" = "No se encontraron grupos";
"lng_bot_sure_invite" = "¿Añadir el bot a «{group}»?"; "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_user_typing" = "{user} está escribiendo";
"lng_users_typing" = "{user} y {second_user} están escribiendo"; "lng_users_typing" = "{user} y {second_user} están escribiendo";
"lng_many_typing" = "{count:_not_used_|# está|# 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_send_action_record_video" = "grabando un vídeo";
"lng_user_action_record_video" = "{user} está grabando un vídeo"; "lng_user_action_record_video" = "{user} está grabando un vídeo";
"lng_send_action_upload_video" = "enviando un vídeo"; "lng_send_action_upload_video" = "enviando un vídeo";

View File

@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_allow_bot" = "Consenti"; "lng_allow_bot" = "Consenti";
"lng_bot_start" = "Avvia"; "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_no_groups" = "Non hai gruppi";
"lng_bot_groups_not_found" = "Nessun gruppo trovato"; "lng_bot_groups_not_found" = "Nessun gruppo trovato";
"lng_bot_sure_invite" = "Aggiungere il bot a «{group}»?"; "lng_bot_sure_invite" = "Aggiungere il bot a «{group}»?";
"lng_bot_already_in_group" = "Questo bot è già membro del gruppo."; "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_no_chats" = "Non hai chat";
"lng_bot_chats_not_found" = "Nessuna chat trovata"; "lng_bot_chats_not_found" = "Nessuna chat trovata";
"lng_bot_sure_share_game" = "Condividere questo gioco con {user}?"; "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_user_typing" = "{user} sta scrivendo";
"lng_users_typing" = "{user} e {second_user} stanno scrivendo"; "lng_users_typing" = "{user} e {second_user} stanno scrivendo";
"lng_many_typing" = "{count:_not_used_|# sta|# 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_send_action_record_video" = "sta registrando un video";
"lng_user_action_record_video" = "{user} sta registrando un video"; "lng_user_action_record_video" = "{user} sta registrando un video";
"lng_send_action_upload_video" = "sta inviando un video"; "lng_send_action_upload_video" = "sta inviando un video";

View File

@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_allow_bot" = "허용"; "lng_allow_bot" = "허용";
"lng_bot_start" = "시작"; "lng_bot_start" = "시작";
"lng_bot_choose_group" = "그룹 선택"; "lng_bot_choose_group" = "Select a Group";
"lng_bot_no_groups" = "그룹이 존재하지 않습니다."; "lng_bot_no_groups" = "그룹이 존재하지 않습니다.";
"lng_bot_groups_not_found" = "그룹을 찾을 수 없습니다."; "lng_bot_groups_not_found" = "그룹을 찾을 수 없습니다.";
"lng_bot_sure_invite" = "<<{group}>>에 봇을 추가 하시겠습니까?"; "lng_bot_sure_invite" = "<<{group}>>에 봇을 추가 하시겠습니까?";
"lng_bot_already_in_group" = "봇이 이미 그룹의 멤버입니다."; "lng_bot_already_in_group" = "봇이 이미 그룹의 멤버입니다.";
"lng_bot_choose_chat" = "채팅방 선택"; "lng_bot_choose_chat" = "Select a Chat";
"lng_bot_no_chats" = "채팅방이 없습니다."; "lng_bot_no_chats" = "채팅방이 없습니다.";
"lng_bot_chats_not_found" = "채팅방을 찾 을 수 없음"; "lng_bot_chats_not_found" = "채팅방을 찾 을 수 없음";
"lng_bot_sure_share_game" = "{user}에게 게임을 공유하겠습니까?"; "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_user_typing" = "{user}님이 입력중입니다.";
"lng_users_typing" = "{user}님과 {second_user}님이 입력중입니다."; "lng_users_typing" = "{user}님과 {second_user}님이 입력중입니다.";
"lng_many_typing" = "{count:_not_used_|#명이|#명이} 입력중입니다"; "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_send_action_record_video" = "비디오 녹화 중";
"lng_user_action_record_video" = "{user}님이 녹화중입니다"; "lng_user_action_record_video" = "{user}님이 녹화중입니다";
"lng_send_action_upload_video" = "비디오 전송 중"; "lng_send_action_upload_video" = "비디오 전송 중";

View File

@ -772,7 +772,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_allow_bot" = "Toestaan"; "lng_allow_bot" = "Toestaan";
"lng_bot_start" = "Begin"; "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_no_groups" = "Je hebt geen groepen";
"lng_bot_groups_not_found" = "Geen groepen gevonden"; "lng_bot_groups_not_found" = "Geen groepen gevonden";
"lng_bot_sure_invite" = "De bot toevoegen aan \"{group}\"?"; "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_user_typing" = "{user} is aan het typen";
"lng_users_typing" = "{user} en {second_user} zijn 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_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_send_action_record_video" = "video opnemen";
"lng_user_action_record_video" = "{user} neemt video op"; "lng_user_action_record_video" = "{user} neemt video op";
"lng_send_action_upload_video" = "video versturen"; "lng_send_action_upload_video" = "video versturen";

View File

@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_allow_bot" = "Permitir"; "lng_allow_bot" = "Permitir";
"lng_bot_start" = "Iniciar"; "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_no_groups" = "Você não possui grupos";
"lng_bot_groups_not_found" = "Nenhum grupo encontrado"; "lng_bot_groups_not_found" = "Nenhum grupo encontrado";
"lng_bot_sure_invite" = "Adicionar bot ao «{group}»?"; "lng_bot_sure_invite" = "Adicionar bot ao «{group}»?";
"lng_bot_already_in_group" = "O bot já é um membro do grupo."; "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_no_chats" = "Você não possui conversas";
"lng_bot_chats_not_found" = "Nenhuma conversa encontrada"; "lng_bot_chats_not_found" = "Nenhuma conversa encontrada";
"lng_bot_sure_share_game" = "Compartilhar o jogo com {user}?"; "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_user_typing" = "{user} está escrevendo";
"lng_users_typing" = "{user} e {second_user} estão escrevendo"; "lng_users_typing" = "{user} e {second_user} estão escrevendo";
"lng_many_typing" = "{count:_not_used_|# está|# 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_send_action_record_video" = "gravando um vídeo";
"lng_user_action_record_video" = "{user} está gravando um vídeo"; "lng_user_action_record_video" = "{user} está gravando um vídeo";
"lng_send_action_upload_video" = "enviando 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_duration_played" = "{played} / {duration}";
"lng_date_and_duration" = "{date}, {duration}"; "lng_date_and_duration" = "{date}, {duration}";
"lng_choose_images" = "Escolher imagens"; "lng_choose_images" = "Escolher imagens";
"lng_game_tag" = "Jogo"; "lng_game_tag" = "Jogar";
"lng_context_view_profile" = "Ver perfil"; "lng_context_view_profile" = "Ver perfil";
"lng_context_view_group" = "Ver info do grupo"; "lng_context_view_group" = "Ver info do grupo";

View File

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

View File

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

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "apiwrap.h" #include "apiwrap.h"
#include "observer_peer.h" #include "observer_peer.h"
#include "styles/style_boxes.h" #include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : AbstractBox(st::boxWidth) AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : AbstractBox(st::boxWidth)
, _save(this, lang(lng_add_contact), st::defaultBoxButton) , _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 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2); int32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2);
if (peer->isVerified()) { if (peer->isVerified()) {
namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x(); auto icon = &st::dialogsVerifiedIcon;
p.drawSpriteLeft(namex + qMin(row.name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck); 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()); row.name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());

View File

@ -80,9 +80,7 @@ shareCheckBorder: windowBg;
shareCheckBg: windowActiveBg; shareCheckBg: windowActiveBg;
shareCheckRadius: 10px; shareCheckRadius: 10px;
shareCheckSmallRadius: 3px; shareCheckSmallRadius: 3px;
shareCheckIcon: icon { shareCheckIcon: icon {{ "default_checkbox_check", windowBg, point(3px, 6px) }};
{ "default_checkbox_check", windowBg, point(3px, 6px) },
};
shareNameFont: font(11px); shareNameFont: font(11px);
shareNameFg: windowTextFg; shareNameFg: windowTextFg;
shareNameActiveFg: btnYesColor; shareNameActiveFg: btnYesColor;

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/contactsbox.h" #include "boxes/contactsbox.h"
#include "dialogs/dialogs_indexed_list.h" #include "dialogs/dialogs_indexed_list.h"
#include "styles/style_dialogs.h"
#include "lang.h" #include "lang.h"
#include "boxes/addcontactbox.h" #include "boxes/addcontactbox.h"
#include "mainwidget.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 iconw = (_chat || _creating != CreatingGroupNone) ? (st::contactsCheckPosition.x() * 2 + st::contactsCheckIcon.pxWidth()) : 0;
int32 namew = width() - namex - st::contactsPadding.right() - iconw; int32 namew = width() - namex - st::contactsPadding.right() - iconw;
if (peer->isVerified()) { if (peer->isVerified()) {
namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x(); auto icon = &st::dialogsVerifiedIcon;
p.drawSpriteLeft(namex + qMin(data->name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck); 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()); 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 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = width() - namex - st::contactsPadding.right() - (data->canKick ? (_kickWidth + st::contactsCheckPosition.x() * 2) : 0); int32 namew = width() - namex - st::contactsPadding.right() - (data->canKick ? (_kickWidth + st::contactsCheckPosition.x() * 2) : 0);
if (peer->isVerified()) { if (peer->isVerified()) {
namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x(); auto icon = &st::dialogsVerifiedIcon;
p.drawSpriteLeft(namex + qMin(data->name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck); 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()); data->name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());

View File

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "photosendbox.h" #include "photosendbox.h"
#include "history/history_media_types.h" #include "history/history_media_types.h"
#include "styles/style_history.h"
PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth) PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth)
, _file(file) , _file(file)
@ -233,7 +234,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, st::msgFileInPlay); auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
} }
} else { } else {
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
@ -272,7 +274,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); 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 { } else {
p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize)); 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.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, st::msgFileInPlay); auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
} }
} else if (_doc) { } else if (_doc) {
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
@ -591,7 +595,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); 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.setFont(st::semiboldFont);
p.setPen(st::black); p.setPen(st::black);

View File

@ -913,15 +913,24 @@ QVector<PeerData*> ShareInner::selected() const {
QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) { QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) {
auto shareHashData = QByteArray(0x10, Qt::Uninitialized); auto shareHashData = QByteArray(0x10, Qt::Uninitialized);
auto ints = reinterpret_cast<int32*>(shareHashData.data()); auto shareHashDataInts = reinterpret_cast<int32*>(shareHashData.data());
ints[0] = MTP::authedId(); auto channel = fullId.channel ? App::channelLoaded(fullId.channel) : static_cast<ChannelData*>(nullptr);
ints[1] = fullId.channel; auto channelAccessHash = channel ? channel->access : 0ULL;
ints[2] = fullId.msg; auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash);
ints[3] = 0; shareHashDataInts[0] = MTP::authedId();
shareHashDataInts[1] = fullId.channel;
shareHashDataInts[2] = fullId.msg;
shareHashDataInts[3] = channelAccessHashInts[0];
// Count SHA1() of data.
auto key128Size = 0x10; auto key128Size = 0x10;
auto shareHashEncrypted = QByteArray(key128Size + shareHashData.size(), Qt::Uninitialized); auto shareHashEncrypted = QByteArray(key128Size + shareHashData.size(), Qt::Uninitialized);
hashSha1(shareHashData.constData(), shareHashData.size(), shareHashEncrypted.data()); hashSha1(shareHashData.constData(), shareHashData.size(), shareHashEncrypted.data());
// Mix in channel access hash to the first 64 bits of SHA1 of data.
*reinterpret_cast<uint64*>(shareHashEncrypted.data()) ^= *reinterpret_cast<uint64*>(channelAccessHashInts);
// Encrypt data.
if (!Local::encrypt(shareHashData.constData(), shareHashEncrypted.data() + key128Size, shareHashData.size(), shareHashEncrypted.constData())) { if (!Local::encrypt(shareHashData.constData(), shareHashEncrypted.data() + key128Size, shareHashData.size(), shareHashEncrypted.constData())) {
return url; return url;
} }
@ -1031,29 +1040,51 @@ void shareGameScoreByHash(const QString &hash) {
return; return;
} }
// Decrypt data.
auto hashData = QByteArray(hashEncrypted.size() - key128Size, Qt::Uninitialized); auto hashData = QByteArray(hashEncrypted.size() - key128Size, Qt::Uninitialized);
if (!Local::decrypt(hashEncrypted.constData() + key128Size, hashData.data(), hashEncrypted.size() - key128Size, hashEncrypted.constData())) { if (!Local::decrypt(hashEncrypted.constData() + key128Size, hashData.data(), hashEncrypted.size() - key128Size, hashEncrypted.constData())) {
return; return;
} }
char checkSha1[20] = { 0 }; // Count SHA1() of data.
if (memcmp(hashSha1(hashData.constData(), hashData.size(), checkSha1), hashEncrypted.constData(), key128Size) != 0) { char dataSha1[20] = { 0 };
Ui::showLayer(new InformBox(lang(lng_share_wrong_user))); hashSha1(hashData.constData(), hashData.size(), dataSha1);
return;
} // Mix out channel access hash from the first 64 bits of SHA1 of data.
auto ints = reinterpret_cast<int32*>(hashData.data()); auto channelAccessHash = *reinterpret_cast<uint64*>(hashEncrypted.data()) ^ *reinterpret_cast<uint64*>(dataSha1);
if (ints[0] != MTP::authedId()) {
// 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<int32*>(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<int32*>(&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))); Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return; return;
} }
auto channelId = ints[1];
auto msgId = ints[2];
if (auto item = App::histItemById(channelId, msgId)) { if (auto item = App::histItemById(channelId, msgId)) {
shareGameScoreFromItem(item); shareGameScoreFromItem(item);
} else if (App::api()) { } else if (App::api()) {
auto channel = channelId ? App::channelLoaded(channelId) : nullptr; auto resolveMessageAndShareScore = [msgId](ChannelData *channel) {
if (channel || !channelId) {
App::api()->requestMessageData(channel, msgId, [](ChannelData *channel, MsgId msgId) { App::api()->requestMessageData(channel, msgId, [](ChannelData *channel, MsgId msgId) {
if (auto item = App::histItemById(channel, msgId)) { if (auto item = App::histItemById(channel, msgId)) {
shareGameScoreFromItem(item); shareGameScoreFromItem(item);
@ -1061,6 +1092,22 @@ void shareGameScoreByHash(const QString &hash) {
Ui::showLayer(new InformBox(lang(lng_edit_deleted))); 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<MTPInputChannel>(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);
}
}));
} }
} }
} }

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/utils.h" #include "core/utils.h"
#define BETA_VERSION_MACRO (10008003ULL) #define BETA_VERSION_MACRO (10008005ULL)
constexpr int AppVersion = 10008; constexpr int AppVersion = 10008;
constexpr str_const AppVersionStr = "0.10.8"; constexpr str_const AppVersionStr = "0.10.8";

View File

@ -63,14 +63,6 @@ dialogsScroll: flatScroll(scrollDef) {
bottomsh: 0px; bottomsh: 0px;
} }
dialogsChatImgPos: point(1px, 4px);
dialogsChannelImgPos: point(3px, 4px);
dialogsImgSkip: 22px;
dialogsCheckLeft: 5px;
dialogsCheckTop: 4px;
dialogsCheckSkip: 3px;
dialogsTextStyle: textStyle(defaultTextStyle) { dialogsTextStyle: textStyle(defaultTextStyle) {
linkFg: dialogsTextFgService; linkFg: dialogsTextFgService;
linkFgDown: dialogsTextFgService; linkFgDown: dialogsTextFgService;
@ -89,9 +81,7 @@ dialogsTextStyleDraftActive: textStyle(dialogsTextStyle) {
linkFgDown: #c6e1f7; linkFgDown: #c6e1f7;
} }
dialogsNewChatIcon: icon { dialogsNewChatIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(9px, 10px) }};
{ "dialogs_new_chat", #b7b7b7, point(9px, 10px) }
};
dialogsNewChatButton: RoundButton { dialogsNewChatButton: RoundButton {
width: 36px; width: 36px;
height: 36px; height: 36px;
@ -108,6 +98,33 @@ dialogsNewChatButton: RoundButton {
textBgOver: transparent; textBgOver: transparent;
} }
settingsEditIcon: icon { dialogsChatTypeSkip: 22px;
{ "dialogs_new_chat", #b7b7b7, point(3px, 9px) } 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) }};

View File

@ -30,7 +30,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Dialogs { namespace Dialogs {
namespace Layout { namespace Layout {
namespace { namespace {
// Show all dates that are in the last 20 hours in time format. // 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(); int32 namewidth = w - nameleft - st::dialogsPadding.x();
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height); QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
// draw chat icon if (auto chatTypeIcon = ChatTypeIcon(history->peer, active)) {
if (history->peer->isChat() || history->peer->isMegagroup()) { chatTypeIcon->paint(p, rectForName.topLeft(), w);
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), (active ? st::dlgActiveChatImg : st::dlgChatImg)); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
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);
} }
int texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip; int texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
if (draft) { if (draft) {
paintRowDate(p, date, rectForName, active); 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.setFont(st::dialogsTextFont);
p.setPen(active ? st::dialogsTextFgActive : st::dialogsTextFgService); p.setPen(active ? st::dialogsTextFgActive : st::dialogsTextFgService);
if (history->typing.isEmpty() && history->sendActions.isEmpty()) { 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()) { } else if (!item->isEmpty()) {
paintRowDate(p, date, rectForName, active); paintRowDate(p, date, rectForName, active);
// draw check paintItemCallback(nameleft, namewidth, item);
if (item->needCheck()) { }
const style::sprite *check; 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->id > 0) {
if (item->unread()) { if (item->unread()) {
check = active ? &st::dlgActiveCheckImg : &st::dlgCheckImg; return &(active ? st::dialogsSentActiveIcon : st::dialogsSentIcon);
} else {
check = active ? &st::dlgActiveDblCheckImg : &st::dlgDblCheckImg;
} }
} else { return &(active ? st::dialogsReceivedActiveIcon : st::dialogsReceivedIcon);
check = active ? &st::dlgActiveSendImg : &st::dlgSendImg;
} }
rectForName.setWidth(rectForName.width() - check->pxWidth() - st::dialogsCheckSkip); return &(active ? st::dialogsSendingActiveIcon : st::dialogsSendingIcon);
p.drawSprite(QPoint(rectForName.left() + rectForName.width() + st::dialogsCheckLeft, rectForName.top() + st::dialogsCheckTop), *check);
} }
return nullptr;
paintItemCallback(nameleft, namewidth, item); })();
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()) { if (history->peer->isUser() && history->peer->isVerified()) {
rectForName.setWidth(rectForName.width() - st::verifiedCheck.pxWidth() - st::verifiedCheckPos.x()); auto icon = &(active ? st::dialogsVerifiedActiveIcon : st::dialogsVerifiedIcon);
p.drawSprite(rectForName.topLeft() + QPoint(qMin(history->peer->dialogName().maxWidth(), rectForName.width()), 0) + st::verifiedCheckPos, (active ? st::verifiedCheckInv : st::verifiedCheck)); 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); p.setPen(active ? st::dialogsTextFgActive : st::dialogsNameFg);
@ -169,6 +162,15 @@ QImage colorizeCircleHalf(UnreadBadgeSizeData *data, int size, int half, int xof
} // namepsace } // 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) { void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
t_assert(rect.height() == st.size); t_assert(rect.height() == st.size);

View File

@ -27,6 +27,8 @@ class FakeRow;
namespace Layout { namespace Layout {
const style::icon *ChatTypeIcon(PeerData *peer, bool active);
class RowPainter { class RowPainter {
public: public:
static void paint(Painter &p, const Row *row, int w, bool active, bool selected, bool onlyBackground); static void paint(Painter &p, const Row *row, int w, bool active, bool selected, bool onlyBackground);

View File

@ -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); QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
// draw chat icon // draw chat icon
if (peer->isChat() || peer->isMegagroup()) { if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(peer, active)) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), (active ? st::dlgActiveChatImg : st::dlgChatImg)); chatTypeIcon->paint(p, rectForName.topLeft(), w);
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
} 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 (peer->isVerified()) { if (peer->isVerified()) {
rectForName.setWidth(rectForName.width() - st::verifiedCheck.pxWidth() - st::verifiedCheckPos.x()); auto icon = &(active ? st::dialogsVerifiedActiveIcon : st::dialogsVerifiedIcon);
p.drawSprite(rectForName.topLeft() + QPoint(qMin(peer->dialogName().maxWidth(), rectForName.width()), 0) + st::verifiedCheckPos, (active ? st::verifiedCheckInv : st::verifiedCheck)); 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); 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; int32 namewidth = w - nameleft - st::dialogsPadding.x() * 2 - st::btnCancelSearch.width;
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height); QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
// draw chat icon if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_searchInPeer, false)) {
if (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) { chatTypeIcon->paint(p, rectForName.topLeft(), w);
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
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);
} }
QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height); QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height);

View File

@ -32,6 +32,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "window/top_bar_widget.h" #include "window/top_bar_widget.h"
#include "observer_peer.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() { void historyInit() {
historyInitMessages(); historyInitMessages();
historyInitMedia(); historyInitMedia();
@ -171,7 +185,7 @@ void History::draftSavedToCloud() {
bool History::updateTyping(uint64 ms, bool force) { bool History::updateTyping(uint64 ms, bool force) {
bool changed = 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()) { if (ms >= i.value()) {
i = typing.erase(i); i = typing.erase(i);
changed = true; changed = true;
@ -179,7 +193,7 @@ bool History::updateTyping(uint64 ms, bool force) {
++i; ++i;
} }
} }
for (SendActionUsers::iterator i = sendActions.begin(); i != sendActions.cend();) { for (auto i = sendActions.begin(); i != sendActions.cend();) {
if (ms >= i.value().until) { if (ms >= i.value().until) {
i = sendActions.erase(i); i = sendActions.erase(i);
changed = true; changed = true;
@ -189,23 +203,46 @@ bool History::updateTyping(uint64 ms, bool force) {
} }
if (changed) { if (changed) {
QString newTypingStr; QString newTypingStr;
int32 cnt = typing.size(); int typingCount = typing.size();
if (cnt > 2) { if (typingCount > 2) {
newTypingStr = lng_many_typing(lt_count, cnt); newTypingStr = lng_many_typing(lt_count, typingCount);
} else if (cnt > 1) { } else if (typingCount > 1) {
newTypingStr = lng_users_typing(lt_user, typing.begin().key()->firstName, lt_second_user, (typing.end() - 1).key()->firstName); 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); newTypingStr = peer->isUser() ? lang(lng_typing) : lng_user_typing(lt_user, typing.begin().key()->firstName);
} else if (!sendActions.isEmpty()) { } else if (!sendActions.isEmpty()) {
switch (sendActions.begin().value().type) { // Handles all actions except game playing.
case SendActionRecordVideo: newTypingStr = peer->isUser() ? lang(lng_send_action_record_video) : lng_user_action_record_video(lt_user, sendActions.begin().key()->firstName); break; auto sendActionString = [](SendActionType type, const QString &name) -> QString {
case SendActionUploadVideo: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_video) : lng_user_action_upload_video(lt_user, sendActions.begin().key()->firstName); break; switch (type) {
case SendActionRecordVoice: newTypingStr = peer->isUser() ? lang(lng_send_action_record_audio) : lng_user_action_record_audio(lt_user, sendActions.begin().key()->firstName); break; case SendActionRecordVideo: return name.isEmpty() ? lang(lng_send_action_record_video) : lng_user_action_record_video(lt_user, name);
case SendActionUploadVoice: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_audio) : lng_user_action_upload_audio(lt_user, sendActions.begin().key()->firstName); break; case SendActionUploadVideo: return name.isEmpty() ? lang(lng_send_action_upload_video) : lng_user_action_upload_video(lt_user, name);
case SendActionUploadPhoto: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_photo) : lng_user_action_upload_photo(lt_user, sendActions.begin().key()->firstName); break; case SendActionRecordVoice: return name.isEmpty() ? lang(lng_send_action_record_audio) : lng_user_action_record_audio(lt_user, name);
case SendActionUploadFile: newTypingStr = peer->isUser() ? lang(lng_send_action_upload_file) : lng_user_action_upload_file(lt_user, sendActions.begin().key()->firstName); break; case SendActionUploadVoice: return name.isEmpty() ? lang(lng_send_action_upload_audio) : lng_user_action_upload_audio(lt_user, name);
case SendActionChooseLocation: newTypingStr = peer->isUser() ? lang(lng_send_action_geo_location) : lng_user_action_geo_location(lt_user, sendActions.begin().key()->firstName); break; case SendActionUploadPhoto: return name.isEmpty() ? lang(lng_send_action_upload_photo) : lng_user_action_upload_photo(lt_user, name);
case SendActionChooseContact: newTypingStr = peer->isUser() ? lang(lng_send_action_choose_contact) : lng_user_action_choose_contact(lt_user, sendActions.begin().key()->firstName); break; 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()) { if (!newTypingStr.isEmpty()) {
@ -527,25 +564,37 @@ void Histories::regSendAction(History *history, UserData *user, const MTPSendMes
if (action.type() == mtpc_sendMessageCancelAction) { if (action.type() == mtpc_sendMessageCancelAction) {
history->unregTyping(user); history->unregTyping(user);
return; 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(); uint64 ms = getms();
switch (action.type()) { switch (action.type()) {
case mtpc_sendMessageTypingAction: history->typing[user] = ms + 6000; break; case mtpc_sendMessageTypingAction: history->typing[user] = ms + 6000; break;
case mtpc_sendMessageRecordVideoAction: history->sendActions.insert(user, SendAction(SendActionRecordVideo, 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 + 6000, action.c_sendMessageUploadVideoAction().vprogress.v)); 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 + 6000)); break; case mtpc_sendMessageRecordAudioAction: history->sendActions.insert(user, SendAction(SendActionRecordVoice, ms + kStatusShowClientsideRecordVoice)); break;
case mtpc_sendMessageUploadAudioAction: history->sendActions.insert(user, SendAction(SendActionUploadVoice, ms + 6000, action.c_sendMessageUploadAudioAction().vprogress.v)); 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 + 6000, action.c_sendMessageUploadPhotoAction().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 + 6000, action.c_sendMessageUploadDocumentAction().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 + 6000)); break; case mtpc_sendMessageGeoLocationAction: history->sendActions.insert(user, SendAction(SendActionChooseLocation, ms + kStatusShowClientsideChooseLocation)); break;
case mtpc_sendMessageChooseContactAction: history->sendActions.insert(user, SendAction(SendActionChooseContact, ms + 6000)); 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; default: return;
} }
user->madeAction(when); user->madeAction(when);
TypingHistories::const_iterator i = typing.find(history); auto i = typing.find(history);
if (i == typing.cend()) { if (i == typing.cend()) {
typing.insert(history, ms); typing.insert(history, ms);
history->typingDots = 0; history->typingDots = 0;
@ -1059,13 +1108,13 @@ HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) {
void History::unregTyping(UserData *from) { void History::unregTyping(UserData *from) {
uint64 updateAtMs = 0; uint64 updateAtMs = 0;
TypingUsers::iterator i = typing.find(from); auto i = typing.find(from);
if (i != typing.end()) { if (i != typing.cend()) {
updateAtMs = getms(); updateAtMs = getms();
i.value() = updateAtMs; i.value() = updateAtMs;
} }
SendActionUsers::iterator j = sendActions.find(from); auto j = sendActions.find(from);
if (j != sendActions.end()) { if (j != sendActions.cend()) {
if (!updateAtMs) updateAtMs = getms(); if (!updateAtMs) updateAtMs = getms();
j.value().until = updateAtMs; j.value().until = updateAtMs;
} }

View File

@ -142,6 +142,7 @@ enum SendActionType {
SendActionUploadFile, SendActionUploadFile,
SendActionChooseLocation, SendActionChooseLocation,
SendActionChooseContact, SendActionChooseContact,
SendActionPlayGame,
}; };
struct SendAction { struct SendAction {
SendAction(SendActionType type, uint64 until, int32 progress = 0) : type(type), until(until), progress(progress) { 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 const HistoryItem *textCachedFor = nullptr; // cache
mutable Text lastItemTextCache; mutable Text lastItemTextCache;
typedef QMap<UserData*, uint64> TypingUsers; using TypingUsers = QMap<UserData*, uint64>;
TypingUsers typing; TypingUsers typing;
typedef QMap<UserData*, SendAction> SendActionUsers; using SendActionUsers = QMap<UserData*, SendAction>;
SendActionUsers sendActions; SendActionUsers sendActions;
QString typingStr; QString typingStr;
Text typingText; Text typingText;

View File

@ -19,6 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/ */
using "basic.style"; using "basic.style";
using "dialogs/dialogs.style";
historyToDown: icon { historyToDown: icon {
{ "history_down_shadow", #00000040 }, { "history_down_shadow", #00000040 },
@ -45,3 +46,49 @@ membersInnerDropdown: InnerDropdown(defaultInnerDropdown) {
scrollMargin: margins(0px, 5px, 0px, 5px); scrollMargin: margins(0px, 5px, 0px, 5px);
scrollPadding: margins(0px, 3px, 8px, 3px); 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 }};

View File

@ -169,6 +169,15 @@ public:
return (_inBubbleState == MediaInBubbleState::Bottom) || (_inBubbleState == MediaInBubbleState::None); 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: protected:
HistoryItem *_parent; HistoryItem *_parent;
int _width = 0; int _width = 0;

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/addcontactbox.h" #include "boxes/addcontactbox.h"
#include "core/click_handler_types.h" #include "core/click_handler_types.h"
#include "history/history_location_manager.h" #include "history/history_location_manager.h"
#include "styles/style_history.h"
namespace { namespace {
@ -408,7 +409,7 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, overlayCorners); 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; 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); QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
p.setPen(Qt::NoPen); 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(radial ? _animation->radial.opacity() : 1);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([radial, this, selected]() -> const style::icon* {
if (radial || _data->loading()) { if (radial || _data->loading()) {
DelayedStorageImage *delayed = _data->full->toDelayedStorageImage(); auto delayed = _data->full->toDelayedStorageImage();
if (!delayed || !delayed->location().isNull()) { if (!delayed || !delayed->location().isNull()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return nullptr;
} }
} else { return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); })();
} if (icon) {
if (!icon.isEmpty()) { icon->paintInCenter(p, inner);
p.drawSpriteCenter(inner, icon);
} }
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
@ -769,15 +771,15 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
p.setOpacity(1); p.setOpacity(1);
} }
style::sprite icon; auto icon = ([loaded, radial, this, selected] {
if (loaded) { if (loaded) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else { }
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
} })();
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); 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); _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.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([radial, this, selected] {
if (radial || _data->loading()) { if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else { }
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
} })();
p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1); p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1);
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); 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); _animation->radial.draw(p, rinner, st::msgFileRadialLine, bg);
} }
style::sprite icon; auto icon = ([showPause, radial, this, loaded, outbg, selected] {
if (showPause) { if (showPause) {
icon = outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause); return &(outbg ? (selected ? st::historyFileOutPauseSelected : st::historyFileOutPause) : (selected ? st::historyFileInPauseSelected : st::historyFileInPause));
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
icon = outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(outbg ? (selected ? st::historyFileOutCancelSelected : st::historyFileOutCancel) : (selected ? st::historyFileInCancelSelected : st::historyFileInCancel));
} else if (loaded) { } else if (loaded) {
if (_data->song() || _data->voice()) { if (_data->song() || _data->voice()) {
icon = outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(outbg ? (selected ? st::historyFileOutPlaySelected : st::historyFileOutPlay) : (selected ? st::historyFileInPlaySelected : st::historyFileInPlay));
} else if (_data->isImage()) { } else if (_data->isImage()) {
icon = outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage); return &(outbg ? (selected ? st::historyFileOutImageSelected : st::historyFileOutImage) : (selected ? st::historyFileInImageSelected : st::historyFileInImage));
} else { }
icon = outbg ? (selected ? st::msgFileOutFileSelected : st::msgFileOutFile) : (selected ? st::msgFileInFileSelected : st::msgFileInFile); return &(outbg ? (selected ? st::historyFileOutDocumentSelected : st::historyFileOutDocument) : (selected ? st::historyFileInDocumentSelected : st::historyFileInDocument));
} }
} else { return &(outbg ? (selected ? st::historyFileOutDownloadSelected : st::historyFileOutDownload) : (selected ? st::historyFileInDownloadSelected : st::historyFileInDownload));
icon = outbg ? (selected ? st::msgFileOutDownloadSelected : st::msgFileOutDownload) : (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); })();
} icon->paintInCenter(p, inner);
p.drawSpriteCenter(inner, icon);
} }
int32 namewidth = _width - nameleft - nameright; 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.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([this, radial, selected]() -> const style::icon * {
if (_data->loaded() && !radial) { if (_data->loaded() && !radial) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
if (_parent->id > 0 || _data->uploading()) { if (_parent->id > 0 || _data->uploading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return nullptr;
} }
} else { return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); })();
} if (icon) {
if (!icon.isEmpty()) { icon->paintInCenter(p, inner);
p.drawSpriteCenter(inner, icon);
} }
if (radial) { if (radial) {
p.setOpacity(1); 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 out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
bool selected = (selection == FullSelection); 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 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)); 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(); int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height();
if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) { if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) {
if (_data->siteName == qstr("YouTube")) { if (_attach->isReadyForOpen()) {
p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon); if (_data->siteName == qstr("YouTube")) {
} else { p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon);
p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon); } else {
p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon);
}
} }
if (_durationWidth) { if (_durationWidth) {
int32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); 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(); if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth();
result = _attach->getState(x - attachLeft, y - attachTop, request); 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) { if (_data->type == WebPageProfile || _data->type == WebPageVideo) {
result.link = _openl; result.link = _openl;
} else if (_data->type == WebPagePhoto || _data->siteName == qstr("Twitter") || _data->siteName == qstr("Facebook")) { } 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 out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
bool selected = (selection == FullSelection); 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 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)); 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 (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth();
if (x >= attachLeft && x < attachLeft + _attach->currentWidth() && y >= tshift && y < _height - bshift) { 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);
}
} }
} }

View File

@ -172,6 +172,9 @@ public:
bool hideFromName() const override { bool hideFromName() const override {
return true; return true;
} }
bool isReadyForOpen() const override {
return _data->loaded();
}
protected: protected:
float64 dataProgress() const override { float64 dataProgress() const override {
@ -481,6 +484,9 @@ public:
bool hideFromName() const override { bool hideFromName() const override {
return true; return true;
} }
bool isReadyForOpen() const override {
return _data->loaded();
}
~HistoryGif(); ~HistoryGif();

View File

@ -29,6 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "history/history_service_layout.h" #include "history/history_service_layout.h"
#include "history/history_media_types.h" #include "history/history_media_types.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "styles/style_history.h"
namespace { namespace {
@ -244,7 +245,7 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in
style::color bar; style::color bar;
if (flags & PaintInBubble) { 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 { } else {
bar = st::white; 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 { void HistoryMessage::KeyboardStyle::paintButtonLoading(Painter &p, const QRect &rect) const {
style::sprite sprite = st::msgInvSendingImg; auto icon = &st::historySendingInvertedIcon;
p.drawSprite(rect.x() + rect.width() - sprite.pxWidth() - st::msgBotKbIconPadding, rect.y() + rect.height() - sprite.pxHeight() - st::msgBotKbIconPadding, sprite); 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 { 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::SwitchInlineSame:
case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break; case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break;
case Button::Type::Callback: 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) { if (iconWidth > 0) {
result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding)); result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding));
@ -494,7 +495,7 @@ void HistoryMessage::updateMediaInBubbleState() {
return; return;
} }
bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has<HistoryMessageVia>(); bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has<HistoryMessageReply>() || Has<HistoryMessageVia>();
bool hasSomethingBelow = false; bool hasSomethingBelow = false;
if (!emptyText()) { if (!emptyText()) {
if (_media->isAboveMessage()) { if (_media->isAboveMessage()) {
@ -1076,6 +1077,28 @@ bool HistoryMessage::textHasLinks() const {
return emptyText() ? false : _text.hasLinks(); return emptyText() ? false : _text.hasLinks();
} }
int HistoryMessage::infoWidth() const {
int result = _timeWidth;
if (auto views = Get<HistoryMessageViews>()) {
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<HistoryMessageViews>()) {
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 { void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const {
p.setFont(st::msgDateFont); 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); p.drawText(dateX, dateY + st::msgDateFont->ascent, _timeText);
} }
QPoint iconPos;
const style::sprite *iconRect = nullptr;
if (auto views = Get<HistoryMessageViews>()) { if (auto views = Get<HistoryMessageViews>()) {
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 (id > 0) {
if (outbg) { icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width);
iconRect = &(invertedsprites ? st::msgInvViewsImg : (selected ? st::msgSelectOutViewsImg : st::msgOutViewsImg)); p.drawText(infoRight - infoW + st::historyViewsWidth, infoBottom - st::msgDateFont->descent, views->_viewsText);
} else { } else if (!outbg) { // sending outbg icon will be painted below
iconRect = &(invertedsprites ? st::msgInvViewsImg : (selected ? st::msgSelectViewsImg : st::msgViewsImg)); auto iconSkip = st::historyViewsSpace + views->_viewsWidth;
} icon->paint(p, infoRight - infoW + iconSkip, infoBottom + st::historyViewsTop, width);
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);
}
} }
p.drawSprite(iconPos, *iconRect);
} else if (id < 0 && history()->peer->isSelf()) { } else if (id < 0 && history()->peer->isSelf()) {
iconPos = QPoint(infoRight - infoW, infoBottom - st::msgViewsImg.pxHeight() + st::msgViewsPos.y()); auto icon = &(invertedsprites ? st::historyViewsSendingInvertedIcon : st::historyViewsSendingIcon);
iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingViewsImg); icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width);
p.drawSprite(iconPos, *iconRect);
} }
if (outbg) { if (outbg) {
iconPos = QPoint(infoRight - st::msgCheckImg.pxWidth() + st::msgCheckPos.x(), infoBottom - st::msgCheckImg.pxHeight() + st::msgCheckPos.y()); auto icon = ([this, invertedsprites, selected] {
if (id > 0) { if (id > 0) {
if (unread()) { if (unread()) {
iconRect = &(invertedsprites ? st::msgInvCheckImg : (selected ? st::msgSelectCheckImg : st::msgCheckImg)); return &(invertedsprites ? st::historySentInvertedIcon : (selected ? st::historySentSelectedIcon : st::historySentIcon));
} else { }
iconRect = &(invertedsprites ? st::msgInvDblCheckImg : (selected ? st::msgSelectDblCheckImg : st::msgDblCheckImg)); return &(invertedsprites ? st::historyReceivedInvertedIcon : (selected ? st::historyReceivedSelectedIcon : st::historyReceivedIcon));
} }
} else { return &(invertedsprites ? st::historySendingInvertedIcon : st::historySendingIcon);
iconRect = &(invertedsprites ? st::msgInvSendingImg : st::msgSendingImg); })();
} icon->paint(p, QPoint(infoRight, infoBottom) + st::historySendStatePosition, width);
p.drawSprite(iconPos, *iconRect);
} }
} }

View File

@ -105,33 +105,14 @@ public:
TextWithEntities originalText() const override; TextWithEntities originalText() const override;
bool textHasLinks() const override; bool textHasLinks() const override;
int32 infoWidth() const override { int infoWidth() const override;
int32 result = _timeWidth; int timeLeft() const override;
if (const HistoryMessageViews *views = Get<HistoryMessageViews>()) { int timeWidth() const override {
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<HistoryMessageViews>()) {
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 {
return _timeWidth; return _timeWidth;
} }
int32 viewsCount() const override { int viewsCount() const override {
if (const HistoryMessageViews *views = Get<HistoryMessageViews>()) { if (auto views = Get<HistoryMessageViews>()) {
return views->_views; return views->_views;
} }
return HistoryItem::viewsCount(); return HistoryItem::viewsCount();

View File

@ -3454,6 +3454,7 @@ void HistoryWidget::updateSendAction(History *history, SendActionType type, int3
case SendActionUploadFile: action = MTP_sendMessageUploadDocumentAction(MTP_int(progress)); break; case SendActionUploadFile: action = MTP_sendMessageUploadDocumentAction(MTP_int(progress)); break;
case SendActionChooseLocation: action = MTP_sendMessageGeoLocationAction(); break; case SendActionChooseLocation: action = MTP_sendMessageGeoLocationAction(); break;
case SendActionChooseContact: action = MTP_sendMessageChooseContactAction(); 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))); _sendActionRequests.insert(qMakePair(history, type), MTP::send(MTPmessages_SetTyping(history->peer->input, action), rpcDone(&HistoryWidget::sendActionDone)));
if (type == SendActionTyping) _sendActionStopTimer.start(5000); 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) { 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<HistoryMessageReplyMarkup>()) { if (auto markup = item->Get<HistoryMessageReplyMarkup>()) {
if (info.row < markup->rows.size() && info.col < markup->rows.at(info.row).size()) { 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) { 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) { if (info.game) {
url = appendShareGameScoreUrl(url, info.msgId); url = appendShareGameScoreUrl(url, info.msgId);
BotGameUrlClickHandler(info.bot, url).onClick(Qt::LeftButton); BotGameUrlClickHandler(info.bot, url).onClick(Qt::LeftButton);
if (item && (!item->history()->peer->isChannel() || item->history()->peer->isMegagroup())) {
updateSendAction(item->history(), SendActionPlayGame);
}
} else { } else {
UrlClickHandler(url).onClick(Qt::LeftButton); UrlClickHandler(url).onClick(Qt::LeftButton);
} }

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "inline_bots/inline_bot_layout_internal.h" #include "inline_bots/inline_bot_layout_internal.h"
#include "styles/style_overview.h" #include "styles/style_overview.h"
#include "styles/style_history.h"
#include "inline_bots/inline_bot_result.h" #include "inline_bots/inline_bot_result.h"
#include "media/media_clip_reader.h" #include "media/media_clip_reader.h"
#include "media/player/media_player_instance.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 * p.opacity());
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([loaded, radial, loading] {
if (loaded && !radial) { if (loaded && !radial) {
icon = st::msgFileInPlay; return &st::historyFileInPlay;
} else if (radial || loading) { } else if (radial || loading) {
icon = st::msgFileInCancel; return &st::historyFileInCancel;
} else { }
icon = st::msgFileInDownload; return &st::historyFileInDownload;
} })();
QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize); QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); 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 showPause = updateStatusText();
bool radial = isRadialAnimation(context->ms); 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); p.setPen(Qt::NoPen);
if (isThumbAnimation(context->ms)) { if (isThumbAnimation(context->ms)) {
float64 over = _animation->a_thumbOver.current(); 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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(iconCircle); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
if (radial) { 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); _animation->radial.draw(p, radialCircle, st::msgFileRadialLine, st::msgInBg);
} }
style::sprite icon; auto icon = ([showPause, radial, document] {
if (showPause) { if (showPause) {
icon = st::msgFileInPause; return &st::historyFileInPause;
} else if (radial || document->loading()) { } else if (radial || document->loading()) {
icon = st::msgFileInCancel; return &st::historyFileInCancel;
} else if (true || document->loaded()) { } else if (true || document->loaded()) {
if (document->isImage()) { if (document->isImage()) {
icon = st::msgFileInImage; return &st::historyFileInImage;
} else if (document->voice() || document->song()) { } else if (document->voice() || document->song()) {
icon = st::msgFileInPlay; return &st::historyFileInPlay;
} else { }
icon = st::msgFileInFile; return &st::historyFileInDocument;
} }
} else { return &st::historyFileInDownload;
icon = st::msgFileInDownload; })();
} icon->paintInCenter(p, inner);
p.drawSpriteCenter(iconCircle, icon);
int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop; int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop;
int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop; int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop;

View File

@ -220,7 +220,6 @@ void LayerStackWidget::startHide() {
if (isHidden() || _hiding) { if (isHidden() || _hiding) {
return; return;
} }
_hiding = true; _hiding = true;
startAnimation(0); startAnimation(0);
} }
@ -653,13 +652,11 @@ QPixmap MediaPreviewWidget::currentImage() const {
if (_cacheStatus != CacheLoaded) { if (_cacheStatus != CacheLoaded) {
if (_photo->full->loaded()) { if (_photo->full->loaded()) {
QSize s = currentDimensions(); QSize s = currentDimensions();
LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height()));
_cache = _photo->full->pix(s.width(), s.height()); _cache = _photo->full->pix(s.width(), s.height());
_cacheStatus = CacheLoaded; _cacheStatus = CacheLoaded;
} else { } else {
if (_cacheStatus != CacheThumbLoaded && _photo->thumb->loaded()) { if (_cacheStatus != CacheThumbLoaded && _photo->thumb->loaded()) {
QSize s = currentDimensions(); QSize s = currentDimensions();
LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height()));
_cache = _photo->thumb->pixBlurred(s.width(), s.height()); _cache = _photo->thumb->pixBlurred(s.width(), s.height());
_cacheStatus = CacheThumbLoaded; _cacheStatus = CacheThumbLoaded;
} }

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h" #include "stdafx.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h" #include "styles/style_dialogs.h"
#include "zip.h" #include "zip.h"
#include "lang.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); QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) { if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) {
if (history->peer->isChat() || history->peer->isMegagroup()) { if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(history->peer, false)) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg); chatTypeIcon->paint(p, rectForName.topLeft(), w);
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip); rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
} 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);
} }
} }

View File

@ -51,40 +51,51 @@ mediaviewPlayButton: IconButton {
opacity: mediaviewInactiveOpacity; opacity: mediaviewInactiveOpacity;
overOpacity: mediaviewActiveOpacity; overOpacity: mediaviewActiveOpacity;
icon: icon { icon: icon {{ "media_play", #ffffff, point(3px, 0px) }};
{ "media_play", #ffffff, point(3px, 0px) },
};
iconPosition: point(3px, 1px); iconPosition: point(3px, 1px);
downIconPosition: point(3px, 1px); downIconPosition: point(3px, 1px);
duration: mediaviewOverDuration; duration: mediaviewOverDuration;
} }
mediaviewPauseIcon: icon { mediaviewPauseIcon: icon {{ "media_pause", #ffffff, point(1px, 1px) }};
{ "media_pause", #ffffff, point(1px, 1px) }
};
mediaviewPlayPauseLeft: 17px; mediaviewPlayPauseLeft: 17px;
mediaviewFullScreenLeft: 17px; mediaviewFullScreenLeft: 17px;
mediaviewVolumeLeft: 15px; mediaviewVolumeLeft: 15px;
mediaviewFullScreenButton: IconButton(mediaviewPlayButton) { mediaviewFullScreenButton: IconButton(mediaviewPlayButton) {
icon: icon { icon: icon {{ "media_fullscreen_to", #ffffff, point(0px, 0px) }};
{ "media_fullscreen_to", #ffffff, point(0px, 0px) },
};
iconPosition: point(0px, 1px); iconPosition: point(0px, 1px);
downIconPosition: point(0px, 1px); downIconPosition: point(0px, 1px);
} }
mediaviewFullScreenOutIcon: icon { mediaviewFullScreenOutIcon: icon {{ "media_fullscreen_from", #ffffff, point(0px, 0px) }};
{ "media_fullscreen_from", #ffffff, point(0px, 0px) },
};
mediaviewPlaybackTop: 28px; mediaviewPlaybackTop: 28px;
mediaviewVolumeSize: size(44px, 20px); mediaviewVolumeSize: size(44px, 20px);
mediaviewVolumeIcon: icon { mediaviewVolumeIcon: icon {{ "media_volume", mediaviewPlaybackInactive, point(0px, 0px) }};
{ "media_volume", mediaviewPlaybackInactive, point(0px, 0px) }, mediaviewVolumeOnIcon: icon {{ "media_volume", mediaviewPlaybackActive, point(0px, 0px) }};
};
mediaviewVolumeOnIcon: icon {
{ "media_volume", mediaviewPlaybackActive, point(0px, 0px) },
};
mediaviewVolumeIconTop: 8px; mediaviewVolumeIconTop: 8px;
mediaviewControllerRadius: 25px; 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 },
};

View File

@ -160,11 +160,11 @@ void MediaView::moveToScreen() {
int32 navSkip = 2 * st::mvControlMargin + st::mvControlSize; int32 navSkip = 2 * st::mvControlMargin + st::mvControlSize;
_closeNav = myrtlrect(width() - st::mvControlMargin - st::mvControlSize, st::mvControlMargin, st::mvControlSize, 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); _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); _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); _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))))); _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()); _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()); _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())); QDateTime d, dNow(date(unixtime()));
if (_photo) { if (_photo) {
@ -1235,7 +1235,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty
if (!_doc || _doc->thumb->isNull()) { if (!_doc || _doc->thumb->isNull()) {
int32 colorIndex = documentColorIndex(_doc, _docExt); int32 colorIndex = documentColorIndex(_doc, _docExt);
_docIconColor = documentColor(colorIndex); _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]; _docIcon = thumbs[colorIndex];
int32 extmaxw = (st::mvDocIconSize - st::mvDocExtPadding * 2); int32 extmaxw = (st::mvDocIconSize - st::mvDocExtPadding * 2);
@ -1552,7 +1552,7 @@ void MediaView::paintEvent(QPaintEvent *e) {
} else { } else {
p.setOpacity(st::mvBgOpacity); p.setOpacity(st::mvBgOpacity);
for (int i = 0, l = region.rectCount(); i < l; ++i) { 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); p.setCompositionMode(m);
} }
@ -1664,8 +1664,8 @@ void MediaView::paintEvent(QPaintEvent *e) {
} }
if (!_doc || _doc->thumb->isNull()) { if (!_doc || _doc->thumb->isNull()) {
p.fillRect(_docIconRect, _docIconColor->b); p.fillRect(_docIconRect, _docIconColor->b);
if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1)) { if ((!_doc || _doc->loaded()) && (!radial || radialOpacity < 1) && _docIcon) {
p.drawSprite(_docIconRect.topLeft() + QPoint(rtl() ? 0 : (_docIconRect.width() - _docIcon.pxWidth()), 0), _docIcon); _docIcon->paint(p, _docIconRect.x() + (_docIconRect.width() - _docIcon->width()), _docIconRect.y(), width());
p.setPen(st::mvDocExtColor->p); p.setPen(st::mvDocExtColor->p);
p.setFont(st::mvDocExtFont->f); p.setFont(st::mvDocExtFont->f);
if (!_docExt.isEmpty()) { if (!_docExt.isEmpty()) {
@ -1697,68 +1697,68 @@ void MediaView::paintEvent(QPaintEvent *e) {
if (co > 0) { if (co > 0) {
// left nav bar // left nav bar
if (_leftNav.intersects(r) && _leftNavVisible) { if (_leftNav.intersects(r) && _leftNavVisible) {
float64 o = overLevel(OverLeftNav); auto o = overLevel(OverLeftNav);
if (o > 0) { if (o > 0) {
p.setOpacity(o * st::mvControlBgOpacity * co); p.setOpacity(o * st::mvControlBgOpacity * co);
for (int i = 0, l = region.rectCount(); i < l; ++i) { 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 (!fill.isEmpty()) p.fillRect(fill, st::black->b);
} }
} }
if (_leftNavIcon.intersects(r)) { if (_leftNavIcon.intersects(r)) {
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
p.drawSprite(_leftNavIcon.topLeft(), st::mvLeft); st::mediaviewLeft.paintInCenter(p, _leftNavIcon);
} }
} }
// right nav bar // right nav bar
if (_rightNav.intersects(r) && _rightNavVisible) { if (_rightNav.intersects(r) && _rightNavVisible) {
float64 o = overLevel(OverRightNav); auto o = overLevel(OverRightNav);
if (o > 0) { if (o > 0) {
p.setOpacity(o * st::mvControlBgOpacity * co); p.setOpacity(o * st::mvControlBgOpacity * co);
for (int i = 0, l = region.rectCount(); i < l; ++i) { 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 (!fill.isEmpty()) p.fillRect(fill, st::black);
} }
} }
if (_rightNavIcon.intersects(r)) { if (_rightNavIcon.intersects(r)) {
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
p.drawSprite(_rightNavIcon.topLeft(), st::mvRight); st::mediaviewRight.paintInCenter(p, _rightNavIcon);
} }
} }
// close button // close button
if (_closeNav.intersects(r)) { if (_closeNav.intersects(r)) {
float64 o = overLevel(OverClose); auto o = overLevel(OverClose);
if (o > 0) { if (o > 0) {
p.setOpacity(o * st::mvControlBgOpacity * co); p.setOpacity(o * st::mvControlBgOpacity * co);
for (int i = 0, l = region.rectCount(); i < l; ++i) { 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 (!fill.isEmpty()) p.fillRect(fill, st::black);
} }
} }
if (_closeNavIcon.intersects(r)) { if (_closeNavIcon.intersects(r)) {
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
p.drawSprite(_closeNavIcon.topLeft(), st::mvClose); st::mediaviewClose.paintInCenter(p, _closeNavIcon);
} }
} }
// save button // save button
if (_saveVisible && _saveNavIcon.intersects(r)) { if (_saveVisible && _saveNavIcon.intersects(r)) {
float64 o = overLevel(OverSave); auto o = overLevel(OverSave);
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co);
p.drawSprite(_saveNavIcon.topLeft(), st::mvSave); st::mediaviewSave.paintInCenter(p, _saveNavIcon);
} }
// more area // more area
if (_moreNavIcon.intersects(r)) { if (_moreNavIcon.intersects(r)) {
float64 o = overLevel(OverMore); auto o = overLevel(OverMore);
p.setOpacity((o * st::mvIconOverOpacity + (1 - o) * st::mvIconOpacity) * co); 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.setPen(st::white);
p.setFont(st::mvThickFont->f); p.setFont(st::mvThickFont);
// header // header
if (_headerNav.intersects(r)) { if (_headerNav.intersects(r)) {

View File

@ -229,7 +229,7 @@ private:
bool gifShown() const; bool gifShown() const;
void stopGif(); void stopGif();
style::sprite _docIcon; const style::icon *_docIcon = nullptr;
style::color _docIconColor; style::color _docIconColor;
QString _docName, _docSize, _docExt; QString _docName, _docSize, _docExt;
int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0; int _docNameWidth = 0, _docSizeWidth = 0, _docExtWidth = 0;

View File

@ -479,6 +479,8 @@ sendMessageUploadPhotoAction#d1d34a26 progress:int = SendMessageAction;
sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction; sendMessageUploadDocumentAction#aa0cd9e4 progress:int = SendMessageAction;
sendMessageGeoLocationAction#176f8ba1 = SendMessageAction; sendMessageGeoLocationAction#176f8ba1 = SendMessageAction;
sendMessageChooseContactAction#628cbc6f = SendMessageAction; sendMessageChooseContactAction#628cbc6f = SendMessageAction;
sendMessageGamePlayAction#dd6a8f48 = SendMessageAction;
sendMessageGameStopAction#15c2c99a = SendMessageAction;
contacts.found#1aa1f784 results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = contacts.Found; contacts.found#1aa1f784 results:Vector<Peer> chats:Vector<Chat> users:Vector<User> = 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; 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; 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; 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; 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; inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;

View File

@ -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(); 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) { 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) { if (stage) {
to.add(",\n").addSpaces(lev); 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) { 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) { if (stage) {
to.add(",\n").addSpaces(lev); to.add(",\n").addSpaces(lev);
} else { } else {
@ -5394,7 +5404,8 @@ void _serialize_inputBotInlineMessageGame(MTPStringLogger &to, int32 stage, int3
to.add("\n").addSpaces(lev); to.add("\n").addSpaces(lev);
} }
switch (stage) { 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; 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_sendMessageUploadDocumentAction, _serialize_sendMessageUploadDocumentAction);
_serializers.insert(mtpc_sendMessageGeoLocationAction, _serialize_sendMessageGeoLocationAction); _serializers.insert(mtpc_sendMessageGeoLocationAction, _serialize_sendMessageGeoLocationAction);
_serializers.insert(mtpc_sendMessageChooseContactAction, _serialize_sendMessageChooseContactAction); _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_contacts_found, _serialize_contacts_found);
_serializers.insert(mtpc_inputPrivacyKeyStatusTimestamp, _serialize_inputPrivacyKeyStatusTimestamp); _serializers.insert(mtpc_inputPrivacyKeyStatusTimestamp, _serialize_inputPrivacyKeyStatusTimestamp);
_serializers.insert(mtpc_inputPrivacyKeyChatInvite, _serialize_inputPrivacyKeyChatInvite); _serializers.insert(mtpc_inputPrivacyKeyChatInvite, _serialize_inputPrivacyKeyChatInvite);

View File

@ -353,6 +353,8 @@ enum {
mtpc_sendMessageUploadDocumentAction = 0xaa0cd9e4, mtpc_sendMessageUploadDocumentAction = 0xaa0cd9e4,
mtpc_sendMessageGeoLocationAction = 0x176f8ba1, mtpc_sendMessageGeoLocationAction = 0x176f8ba1,
mtpc_sendMessageChooseContactAction = 0x628cbc6f, mtpc_sendMessageChooseContactAction = 0x628cbc6f,
mtpc_sendMessageGamePlayAction = 0xdd6a8f48,
mtpc_sendMessageGameStopAction = 0x15c2c99a,
mtpc_contacts_found = 0x1aa1f784, mtpc_contacts_found = 0x1aa1f784,
mtpc_inputPrivacyKeyStatusTimestamp = 0x4f96cb18, mtpc_inputPrivacyKeyStatusTimestamp = 0x4f96cb18,
mtpc_inputPrivacyKeyChatInvite = 0xbdfb0426, mtpc_inputPrivacyKeyChatInvite = 0xbdfb0426,
@ -474,7 +476,7 @@ enum {
mtpc_inputBotInlineMessageMediaGeo = 0xf4a59de1, mtpc_inputBotInlineMessageMediaGeo = 0xf4a59de1,
mtpc_inputBotInlineMessageMediaVenue = 0xaaafadc8, mtpc_inputBotInlineMessageMediaVenue = 0xaaafadc8,
mtpc_inputBotInlineMessageMediaContact = 0x2daf01a7, mtpc_inputBotInlineMessageMediaContact = 0x2daf01a7,
mtpc_inputBotInlineMessageGame = 0x3c00f8aa, mtpc_inputBotInlineMessageGame = 0x4b425864,
mtpc_inputBotInlineResult = 0x2cbbe15a, mtpc_inputBotInlineResult = 0x2cbbe15a,
mtpc_inputBotInlineResultPhoto = 0xa8d864a7, mtpc_inputBotInlineResultPhoto = 0xa8d864a7,
mtpc_inputBotInlineResultDocument = 0xfff8fdc4, mtpc_inputBotInlineResultDocument = 0xfff8fdc4,
@ -14639,11 +14641,22 @@ public:
class MTPDinputBotInlineMessageGame : public mtpDataImpl<MTPDinputBotInlineMessageGame> { class MTPDinputBotInlineMessageGame : public mtpDataImpl<MTPDinputBotInlineMessageGame> {
public: 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<int32>(v)); }
bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; }
MTPDinputBotInlineMessageGame() { MTPDinputBotInlineMessageGame() {
} }
MTPDinputBotInlineMessageGame(const MTPReplyMarkup &_reply_markup) : vreply_markup(_reply_markup) { MTPDinputBotInlineMessageGame(const MTPflags<MTPDinputBotInlineMessageGame::Flags> &_flags, const MTPReplyMarkup &_reply_markup) : vflags(_flags), vreply_markup(_reply_markup) {
} }
MTPflags<MTPDinputBotInlineMessageGame::Flags> vflags;
MTPReplyMarkup vreply_markup; MTPReplyMarkup vreply_markup;
}; };
@ -24778,6 +24791,12 @@ public:
inline static MTPsendMessageAction new_sendMessageChooseContactAction() { inline static MTPsendMessageAction new_sendMessageChooseContactAction() {
return MTPsendMessageAction(mtpc_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<MTPPeer> &_results, const MTPVector<MTPChat> &_chats, const MTPVector<MTPUser> &_users) { inline static MTPcontacts_found new_contacts_found(const MTPVector<MTPPeer> &_results, const MTPVector<MTPChat> &_chats, const MTPVector<MTPUser> &_users) {
return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users)); return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users));
} }
@ -25141,8 +25160,8 @@ public:
inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaContact(const MTPflags<MTPDinputBotInlineMessageMediaContact::Flags> &_flags, const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, const MTPReplyMarkup &_reply_markup) { inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaContact(const MTPflags<MTPDinputBotInlineMessageMediaContact::Flags> &_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)); return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaContact(_flags, _phone_number, _first_name, _last_name, _reply_markup));
} }
inline static MTPinputBotInlineMessage new_inputBotInlineMessageGame(const MTPReplyMarkup &_reply_markup) { inline static MTPinputBotInlineMessage new_inputBotInlineMessageGame(const MTPflags<MTPDinputBotInlineMessageGame::Flags> &_flags, const MTPReplyMarkup &_reply_markup) {
return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageGame(_reply_markup)); return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageGame(_flags, _reply_markup));
} }
inline static MTPinputBotInlineResult new_inputBotInlineResult(const MTPflags<MTPDinputBotInlineResult::Flags> &_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) { inline static MTPinputBotInlineResult new_inputBotInlineResult(const MTPflags<MTPDinputBotInlineResult::Flags> &_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)); 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; } break;
case mtpc_sendMessageGeoLocationAction: _type = cons; break; case mtpc_sendMessageGeoLocationAction: _type = cons; break;
case mtpc_sendMessageChooseContactAction: _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"); default: throw mtpErrorUnexpected(cons, "MTPsendMessageAction");
} }
} }
@ -32773,6 +32794,8 @@ inline MTPsendMessageAction::MTPsendMessageAction(mtpTypeId type) : mtpDataOwner
case mtpc_sendMessageUploadDocumentAction: setData(new MTPDsendMessageUploadDocumentAction()); break; case mtpc_sendMessageUploadDocumentAction: setData(new MTPDsendMessageUploadDocumentAction()); break;
case mtpc_sendMessageGeoLocationAction: break; case mtpc_sendMessageGeoLocationAction: break;
case mtpc_sendMessageChooseContactAction: break; case mtpc_sendMessageChooseContactAction: break;
case mtpc_sendMessageGamePlayAction: break;
case mtpc_sendMessageGameStopAction: break;
default: throw mtpErrorBadTypeId(type, "MTPsendMessageAction"); default: throw mtpErrorBadTypeId(type, "MTPsendMessageAction");
} }
} }
@ -32814,6 +32837,12 @@ inline MTPsendMessageAction MTP_sendMessageGeoLocationAction() {
inline MTPsendMessageAction MTP_sendMessageChooseContactAction() { inline MTPsendMessageAction MTP_sendMessageChooseContactAction() {
return MTP::internal::TypeCreator::new_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()) { inline MTPcontacts_found::MTPcontacts_found() : mtpDataOwner(new MTPDcontacts_found()) {
} }
@ -35653,7 +35682,7 @@ inline uint32 MTPinputBotInlineMessage::innerLength() const {
} }
case mtpc_inputBotInlineMessageGame: { case mtpc_inputBotInlineMessageGame: {
const MTPDinputBotInlineMessageGame &v(c_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; return 0;
@ -35710,7 +35739,8 @@ inline void MTPinputBotInlineMessage::read(const mtpPrime *&from, const mtpPrime
case mtpc_inputBotInlineMessageGame: _type = cons; { case mtpc_inputBotInlineMessageGame: _type = cons; {
if (!data) setData(new MTPDinputBotInlineMessageGame()); if (!data) setData(new MTPDinputBotInlineMessageGame());
MTPDinputBotInlineMessageGame &v(_inputBotInlineMessageGame()); 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; } break;
default: throw mtpErrorUnexpected(cons, "MTPinputBotInlineMessage"); default: throw mtpErrorUnexpected(cons, "MTPinputBotInlineMessage");
} }
@ -35756,7 +35786,8 @@ inline void MTPinputBotInlineMessage::write(mtpBuffer &to) const {
} break; } break;
case mtpc_inputBotInlineMessageGame: { case mtpc_inputBotInlineMessageGame: {
const MTPDinputBotInlineMessageGame &v(c_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; } break;
} }
} }
@ -35803,8 +35834,9 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineMessageMediaContact::Flags)
inline MTPinputBotInlineMessage MTP_inputBotInlineMessageMediaContact(const MTPflags<MTPDinputBotInlineMessageMediaContact::Flags> &_flags, const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, const MTPReplyMarkup &_reply_markup) { inline MTPinputBotInlineMessage MTP_inputBotInlineMessageMediaContact(const MTPflags<MTPDinputBotInlineMessageMediaContact::Flags> &_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); return MTP::internal::TypeCreator::new_inputBotInlineMessageMediaContact(_flags, _phone_number, _first_name, _last_name, _reply_markup);
} }
inline MTPinputBotInlineMessage MTP_inputBotInlineMessageGame(const MTPReplyMarkup &_reply_markup) { Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineMessageGame::Flags)
return MTP::internal::TypeCreator::new_inputBotInlineMessageGame(_reply_markup); inline MTPinputBotInlineMessage MTP_inputBotInlineMessageGame(const MTPflags<MTPDinputBotInlineMessageGame::Flags> &_flags, const MTPReplyMarkup &_reply_markup) {
return MTP::internal::TypeCreator::new_inputBotInlineMessageGame(_flags, _reply_markup);
} }
inline uint32 MTPinputBotInlineResult::innerLength() const { inline uint32 MTPinputBotInlineResult::innerLength() const {

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "overview/overview_layout.h" #include "overview/overview_layout.h"
#include "styles/style_overview.h" #include "styles/style_overview.h"
#include "styles/style_history.h"
#include "ui/filedialog.h" #include "ui/filedialog.h"
#include "boxes/addcontactbox.h" #include "boxes/addcontactbox.h"
#include "boxes/confirmbox.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.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity((radial && loaded) ? _radial->opacity() : 1); p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
style::sprite icon; auto icon = ([radial, loaded, selected] {
if (radial) { if (radial) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else if (loaded) { } else if (loaded) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else { }
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
} })();
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); 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); _radial->draw(p, rinner, st::msgFileRadialLine, bg);
} }
style::sprite icon; auto icon = ([showPause, this, selected] {
if (showPause) { if (showPause) {
icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause; return &(selected ? st::historyFileInPauseSelected : st::historyFileInPause);
} else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) { } else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) {
icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay; return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (_data->loading()) { } else if (_data->loading()) {
icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel; return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else { }
icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload; return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
} })();
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
} }
int32 namewidth = _width - nameleft - nameright; 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); _radial->draw(p, rinner, st::msgFileRadialLine, bg);
} }
style::sprite icon; auto icon = ([showPause, loaded, this, selected] {
if (showPause) { if (showPause) {
icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause; return &(selected ? st::historyFileInPauseSelected : st::historyFileInPause);
} else if (loaded) { } else if (loaded) {
icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay; return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (_data->loading()) { } else if (_data->loading()) {
icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel; return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else { }
icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload; return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
} })();
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
} }
} else { } else {
nameleft = st::overviewFileSize + st::overviewFilePadding.right(); 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.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([loaded, this, selected] {
if (loaded || _data->loading()) { if (loaded || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else { }
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload); return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
} })();
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);

Some files were not shown because too many files have changed in this diff Show More