mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-28 22:34:48 +00:00
almost all boxes done
This commit is contained in:
parent
13f6eedcb2
commit
542d9435d8
@ -66,7 +66,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_month_day_year" = "{month} {day}, {year}";
|
"lng_month_day_year" = "{month} {day}, {year}";
|
||||||
|
|
||||||
"lng_box_ok" = "OK";
|
"lng_box_ok" = "OK";
|
||||||
"lng_box_cancel" = "CANCEL";
|
|
||||||
|
|
||||||
"lng_cancel" = "Cancel";
|
"lng_cancel" = "Cancel";
|
||||||
"lng_continue" = "Continue";
|
"lng_continue" = "Continue";
|
||||||
@ -116,6 +115,8 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_intro_finish" = "SIGN UP";
|
"lng_intro_finish" = "SIGN UP";
|
||||||
"lng_intro_submit" = "SUBMIT";
|
"lng_intro_submit" = "SUBMIT";
|
||||||
|
|
||||||
|
"lng_photo_caption" = "Caption";
|
||||||
|
|
||||||
"lng_phone_ph" = "Your phone number";
|
"lng_phone_ph" = "Your phone number";
|
||||||
"lng_phone_title" = "Your Phone";
|
"lng_phone_title" = "Your Phone";
|
||||||
"lng_phone_desc" = "Please confirm your country code and\nenter your phone number.";
|
"lng_phone_desc" = "Please confirm your country code and\nenter your phone number.";
|
||||||
@ -125,7 +126,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_country_ph" = "Search";
|
"lng_country_ph" = "Search";
|
||||||
"lng_country_done" = "Done";
|
"lng_country_done" = "Done";
|
||||||
"lng_country_none" = "Country not found";
|
"lng_country_none" = "Country not found";
|
||||||
"lng_country_select" = "Select Country";
|
"lng_country_select" = "Select country";
|
||||||
|
|
||||||
"lng_code_ph" = "Your code";
|
"lng_code_ph" = "Your code";
|
||||||
"lng_code_desc" = "We have sent you a message with activation\ncode to your phone. Please enter it below.";
|
"lng_code_desc" = "We have sent you a message with activation\ncode to your phone. Please enter it below.";
|
||||||
@ -159,7 +160,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_signin_cant_email_forgot" = "If you can't restore access to the e-mail, your remaining options are either to remember your password or to reset your account.";
|
"lng_signin_cant_email_forgot" = "If you can't restore access to the e-mail, your remaining options are either to remember your password or to reset your account.";
|
||||||
"lng_signin_reset_account" = "Reset your account";
|
"lng_signin_reset_account" = "Reset your account";
|
||||||
"lng_signin_sure_reset" = "Warning!\n\nYou will lose all your chats and messages,\nalong with any media and files you shared!\n\nDo you want to reset your account?";
|
"lng_signin_sure_reset" = "Warning!\n\nYou will lose all your chats and messages,\nalong with any media and files you shared!\n\nDo you want to reset your account?";
|
||||||
"lng_signin_reset" = "RESET";
|
"lng_signin_reset" = "Reset";
|
||||||
|
|
||||||
"lng_signup_title" = "Information and photo";
|
"lng_signup_title" = "Information and photo";
|
||||||
"lng_signup_desc" = "Please enter your name and\nupload a photo.";
|
"lng_signup_desc" = "Please enter your name and\nupload a photo.";
|
||||||
@ -177,7 +178,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_dlg_search_chat" = "Search in this chat";
|
"lng_dlg_search_chat" = "Search in this chat";
|
||||||
"lng_dlg_search_for_messages" = "Search for messages";
|
"lng_dlg_search_for_messages" = "Search for messages";
|
||||||
|
|
||||||
"lng_settings_save" = "SAVE";
|
"lng_settings_save" = "Save";
|
||||||
"lng_settings_upload" = "Set Profile Photo";
|
"lng_settings_upload" = "Set Profile Photo";
|
||||||
"lng_settings_crop_profile" = "Select a square area for your profile photo";
|
"lng_settings_crop_profile" = "Select a square area for your profile photo";
|
||||||
"lng_settings_uploading_photo" = "Uploading photo..";
|
"lng_settings_uploading_photo" = "Uploading photo..";
|
||||||
@ -234,7 +235,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_settings_section_chat" = "Chat options";
|
"lng_settings_section_chat" = "Chat options";
|
||||||
"lng_settings_replace_emojis" = "Replace emoji";
|
"lng_settings_replace_emojis" = "Replace emoji";
|
||||||
"lng_settings_view_emojis" = "View list";
|
"lng_settings_view_emojis" = "View list";
|
||||||
"lng_settings_emoji_list" = "List of supported emoji";
|
"lng_settings_emoji_list" = "Supported emoji";
|
||||||
"lng_settings_send_enter" = "Send by Enter";
|
"lng_settings_send_enter" = "Send by Enter";
|
||||||
"lng_settings_send_ctrlenter" = "Send by Ctrl+Enter";
|
"lng_settings_send_ctrlenter" = "Send by Ctrl+Enter";
|
||||||
"lng_settings_send_cmdenter" = "Send by Cmd+Enter";
|
"lng_settings_send_cmdenter" = "Send by Cmd+Enter";
|
||||||
@ -258,7 +259,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_download_path_choose" = "Choose download path";
|
"lng_download_path_choose" = "Choose download path";
|
||||||
"lng_sure_clear_downloads" = "Do you want to remove all downloaded files from temp folder? It is done automatically on logout or program uninstall.";
|
"lng_sure_clear_downloads" = "Do you want to remove all downloaded files from temp folder? It is done automatically on logout or program uninstall.";
|
||||||
"lng_download_path_failed" = "File download could not be started. It could happen because of a bad download location.\n\nYou can change download path in Settings.";
|
"lng_download_path_failed" = "File download could not be started. It could happen because of a bad download location.\n\nYou can change download path in Settings.";
|
||||||
"lng_download_path_settings" = "SETTINGS";
|
"lng_download_path_settings" = "Settings";
|
||||||
"lng_download_finish_failed" = "File download could not be finished.\n\nWould you like to try again?";
|
"lng_download_finish_failed" = "File download could not be finished.\n\nWould you like to try again?";
|
||||||
"lng_download_path_clearing" = "Clearing..";
|
"lng_download_path_clearing" = "Clearing..";
|
||||||
"lng_download_path_cleared" = "Cleared!";
|
"lng_download_path_cleared" = "Cleared!";
|
||||||
@ -315,7 +316,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_cloud_password_bad_email" = "Incorrect e-mail, please try other.";
|
"lng_cloud_password_bad_email" = "Incorrect e-mail, please try other.";
|
||||||
"lng_cloud_password_about" = "This password will be required when you log in on a new device in addition to the pin code.";
|
"lng_cloud_password_about" = "This password will be required when you log in on a new device in addition to the pin code.";
|
||||||
"lng_cloud_password_about_recover" = "Warning! Are you sure you don't want to\nadd a password recovery e-mail?\n\nIf you forget your password, you will\nlose access to your Telegram account.";
|
"lng_cloud_password_about_recover" = "Warning! Are you sure you don't want to\nadd a password recovery e-mail?\n\nIf you forget your password, you will\nlose access to your Telegram account.";
|
||||||
"lng_cloud_password_skip_email" = "SKIP E-MAIL";
|
"lng_cloud_password_skip_email" = "Skip e-mail";
|
||||||
"lng_cloud_password_almost" = "A confirmation link was sent to the e-mail you provided. Two-step verification will be enabled as soon as you follow that link.";
|
"lng_cloud_password_almost" = "A confirmation link was sent to the e-mail you provided. Two-step verification will be enabled as soon as you follow that link.";
|
||||||
"lng_cloud_password_was_set" = "Two-step verification enabled.";
|
"lng_cloud_password_was_set" = "Two-step verification enabled.";
|
||||||
"lng_cloud_password_updated" = "Your cloud password was updated.";
|
"lng_cloud_password_updated" = "Your cloud password was updated.";
|
||||||
@ -338,21 +339,20 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_connection_port_ph" = "Port";
|
"lng_connection_port_ph" = "Port";
|
||||||
"lng_connection_user_ph" = "Username";
|
"lng_connection_user_ph" = "Username";
|
||||||
"lng_connection_password_ph" = "Password";
|
"lng_connection_password_ph" = "Password";
|
||||||
"lng_connection_save" = "SAVE";
|
"lng_connection_save" = "Save";
|
||||||
"lng_settings_show_sessions" = "Show all sessions";
|
"lng_settings_show_sessions" = "Show all sessions";
|
||||||
"lng_settings_reset" = "Terminate all other sessions";
|
"lng_settings_reset" = "Terminate all other sessions";
|
||||||
"lng_settings_reset_sure" = "Are you sure you want to terminate\nall other sessions?";
|
"lng_settings_reset_sure" = "Are you sure you want to terminate\nall other sessions?";
|
||||||
"lng_settings_reset_one_sure" = "Do you want to terminate this session?";
|
"lng_settings_reset_one_sure" = "Do you want to terminate this session?";
|
||||||
"lng_settings_reset_button" = "TERMINATE";
|
"lng_settings_reset_button" = "Terminate";
|
||||||
"lng_settings_reset_done" = "Other sessions terminated";
|
"lng_settings_reset_done" = "Other sessions terminated";
|
||||||
"lng_settings_ask_question" = "Ask a Question";
|
"lng_settings_ask_question" = "Ask a Question";
|
||||||
"lng_settings_ask_sure" = "Please note that Telegram Support is done by volunteers. We try to respond as quickly as possible, but it may take a while.\n\nPlease take a look at the Telegram FAQ: it has important troubleshooting tips and answers to most questions.";
|
"lng_settings_ask_sure" = "Please note that Telegram Support is done by volunteers. We try to respond as quickly as possible, but it may take a while.\n\nPlease take a look at the Telegram FAQ: it has important troubleshooting tips and answers to most questions.";
|
||||||
"lng_settings_faq_button" = "GO TO FAQ";
|
"lng_settings_faq_button" = "Go to FAQ";
|
||||||
"lng_settings_ask_ok" = "ASK";
|
"lng_settings_ask_ok" = "Ask";
|
||||||
"lng_settings_faq" = "Telegram FAQ";
|
"lng_settings_faq" = "Telegram FAQ";
|
||||||
"lng_settings_logout" = "Log Out";
|
"lng_settings_logout" = "Log Out";
|
||||||
"lng_sure_logout" = "Are you sure you want to log out?";
|
"lng_sure_logout" = "Are you sure you want to log out?";
|
||||||
"lng_box_logout" = "LOG OUT";
|
|
||||||
|
|
||||||
"lng_settings_need_restart" = "You need to restart for applying some of the new settings. Restart now?";
|
"lng_settings_need_restart" = "You need to restart for applying some of the new settings. Restart now?";
|
||||||
"lng_settings_restart_now" = "RESTART";
|
"lng_settings_restart_now" = "RESTART";
|
||||||
@ -420,7 +420,8 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_profile_audio_files_header" = "Playlist";
|
"lng_profile_audio_files_header" = "Playlist";
|
||||||
"lng_profile_copy_phone" = "Copy phone number";
|
"lng_profile_copy_phone" = "Copy phone number";
|
||||||
|
|
||||||
"lng_channel_add_admins" = "Add";
|
"lng_channel_add_admins" = "New administrator";
|
||||||
|
"lng_channel_add_members" = "Add members";
|
||||||
"lng_channel_members" = "Members";
|
"lng_channel_members" = "Members";
|
||||||
"lng_channel_admins" = "Administrators";
|
"lng_channel_admins" = "Administrators";
|
||||||
"lng_channel_add_admin" = "Add Administrator";
|
"lng_channel_add_admin" = "Add Administrator";
|
||||||
@ -429,9 +430,9 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_participant_filter" = "Search";
|
"lng_participant_filter" = "Search";
|
||||||
"lng_participant_invite" = "Invite";
|
"lng_participant_invite" = "Invite";
|
||||||
"lng_participant_invite_sorry" = "Sorry, you can only add the first {count:_not_used|# member|# members} to a channel personally.\n\nFrom now on, people will need to join via your invite link.";
|
"lng_participant_invite_sorry" = "Sorry, you can only add the first {count:_not_used|# member|# members} to a channel personally.\n\nFrom now on, people will need to join via your invite link.";
|
||||||
"lng_create_group_back" = "BACK";
|
"lng_create_group_back" = "Back";
|
||||||
"lng_create_group_next" = "NEXT";
|
"lng_create_group_next" = "Next";
|
||||||
"lng_create_group_create" = "CREATE";
|
"lng_create_group_create" = "Create";
|
||||||
"lng_create_group_title" = "New Group";
|
"lng_create_group_title" = "New Group";
|
||||||
"lng_create_group_about" = "Groups are ideal for smaller communities,\nthey can have up to {count:_not_used|# member|# members}";
|
"lng_create_group_about" = "Groups are ideal for smaller communities,\nthey can have up to {count:_not_used|# member|# members}";
|
||||||
"lng_create_channel_title" = "New Channel";
|
"lng_create_channel_title" = "New Channel";
|
||||||
@ -442,7 +443,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_create_private_channel_about" = "Only people with a special invite link may join";
|
"lng_create_private_channel_about" = "Only people with a special invite link may join";
|
||||||
"lng_create_channel_comments" = "Enable Comments";
|
"lng_create_channel_comments" = "Enable Comments";
|
||||||
"lng_create_channel_comments_about" = "If you enable comments, members will be able to discuss your posts in the channel";
|
"lng_create_channel_comments_about" = "If you enable comments, members will be able to discuss your posts in the channel";
|
||||||
"lng_create_group_skip" = "SKIP";
|
"lng_create_group_skip" = "Skip";
|
||||||
|
|
||||||
"lng_create_channel_link_invalid" = "This link is invalid";
|
"lng_create_channel_link_invalid" = "This link is invalid";
|
||||||
"lng_create_channel_link_occupied" = "Sorry, this link is already occupied";
|
"lng_create_channel_link_occupied" = "Sorry, this link is already occupied";
|
||||||
@ -495,7 +496,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_group_invite_bad_link" = "This invite link is broken or has expired.";
|
"lng_group_invite_bad_link" = "This invite link is broken or has expired.";
|
||||||
"lng_group_invite_want_join" = "Do you want to join the group «{title}»?";
|
"lng_group_invite_want_join" = "Do you want to join the group «{title}»?";
|
||||||
"lng_group_invite_want_join_channel" = "Do you want to join the channel «{title}»?";
|
"lng_group_invite_want_join_channel" = "Do you want to join the channel «{title}»?";
|
||||||
"lng_group_invite_join" = "JOIN";
|
"lng_group_invite_join" = "Join";
|
||||||
|
|
||||||
"lng_group_invite_link" = "Invite link:";
|
"lng_group_invite_link" = "Invite link:";
|
||||||
"lng_group_invite_create" = "Create an invite link";
|
"lng_group_invite_create" = "Create an invite link";
|
||||||
@ -539,11 +540,11 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_switch_stickers" = "Stickers";
|
"lng_switch_stickers" = "Stickers";
|
||||||
"lng_switch_emoji" = "Emoji";
|
"lng_switch_emoji" = "Emoji";
|
||||||
|
|
||||||
"lng_box_remove" = "REMOVE";
|
"lng_box_remove" = "Remove";
|
||||||
|
|
||||||
"lng_custom_stickers" = "Custom stickers";
|
"lng_custom_stickers" = "Custom stickers";
|
||||||
"lng_stickers_remove_pack" = "Remove «{sticker_pack}»?";
|
"lng_stickers_remove_pack" = "Remove «{sticker_pack}»?";
|
||||||
"lng_stickers_add_pack" = "Add {count:_not_used_|# Sticker|# Stickers}";
|
"lng_stickers_add_pack" = "Add stickers";
|
||||||
"lng_stickers_share_pack" = "Share Stickers";
|
"lng_stickers_share_pack" = "Share Stickers";
|
||||||
"lng_stickers_not_found" = "Sticker pack not found.";
|
"lng_stickers_not_found" = "Sticker pack not found.";
|
||||||
"lng_stickers_copied" = "Sticker pack link copied to clipboard.";
|
"lng_stickers_copied" = "Sticker pack link copied to clipboard.";
|
||||||
@ -563,7 +564,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_report_spam_sure" = "Are you sure you want to report spam from this user?";
|
"lng_report_spam_sure" = "Are you sure you want to report spam from this user?";
|
||||||
"lng_report_spam_sure_group" = "Are you sure you want to report spam in this group?";
|
"lng_report_spam_sure_group" = "Are you sure you want to report spam in this group?";
|
||||||
"lng_report_spam_sure_channel" = "Are you sure you want to report spam in this channel?";
|
"lng_report_spam_sure_channel" = "Are you sure you want to report spam in this channel?";
|
||||||
"lng_report_spam_ok" = "REPORT";
|
"lng_report_spam_ok" = "Report";
|
||||||
"lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment. {more_info}";
|
"lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment. {more_info}";
|
||||||
"lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment. {more_info}";
|
"lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment. {more_info}";
|
||||||
"lng_cant_invite_not_contact_channel" = "Sorry, you can only add mutual contacts\nto channels at the moment. {more_info}";
|
"lng_cant_invite_not_contact_channel" = "Sorry, you can only add mutual contacts\nto channels at the moment. {more_info}";
|
||||||
@ -585,7 +586,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_channel_unmute" = "Unmute";
|
"lng_channel_unmute" = "Unmute";
|
||||||
|
|
||||||
"lng_open_this_link" = "Open this link?";
|
"lng_open_this_link" = "Open this link?";
|
||||||
"lng_open_link" = "OPEN";
|
"lng_open_link" = "Open";
|
||||||
|
|
||||||
"lng_bot_start" = "Start";
|
"lng_bot_start" = "Start";
|
||||||
"lng_bot_choose_group" = "Choose Group";
|
"lng_bot_choose_group" = "Choose Group";
|
||||||
@ -675,7 +676,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_forward_share_contact" = "Share contact to {recipient}?";
|
"lng_forward_share_contact" = "Share contact to {recipient}?";
|
||||||
"lng_forward_send_file_confirm" = "Send «{name}» to {recipient}?";
|
"lng_forward_send_file_confirm" = "Send «{name}» to {recipient}?";
|
||||||
"lng_forward_send_files_confirm" = "Send selected files to {recipient}?";
|
"lng_forward_send_files_confirm" = "Send selected files to {recipient}?";
|
||||||
"lng_forward_send" = "SEND";
|
"lng_forward_send" = "Send";
|
||||||
"lng_forward_messages" = "{count:_not_used_|Forwarded message|# forwarded messages}";
|
"lng_forward_messages" = "{count:_not_used_|Forwarded message|# forwarded messages}";
|
||||||
"lng_forwarding_from" = "{user} and {count:_not_used_|# other|# others}";
|
"lng_forwarding_from" = "{user} and {count:_not_used_|# other|# others}";
|
||||||
"lng_forwarding_from_two" = "{user} and {second_user}";
|
"lng_forwarding_from_two" = "{user} and {second_user}";
|
||||||
@ -688,7 +689,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_edit_self_title" = "Edit your name";
|
"lng_edit_self_title" = "Edit your name";
|
||||||
"lng_confirm_contact_data" = "New Contact";
|
"lng_confirm_contact_data" = "New Contact";
|
||||||
"lng_add_contact" = "Create";
|
"lng_add_contact" = "Create";
|
||||||
"lng_add_contact_button" = "Add Contact";
|
"lng_add_contact_button" = "New contact";
|
||||||
"lng_contacts_header" = "Contacts";
|
"lng_contacts_header" = "Contacts";
|
||||||
"lng_contact_not_joined" = "Unfortunately {name} did not join Telegram yet, but you can send your friend an invitation.\n\nWe will notify you about any of your contacts who is joining Telegram.";
|
"lng_contact_not_joined" = "Unfortunately {name} did not join Telegram yet, but you can send your friend an invitation.\n\nWe will notify you about any of your contacts who is joining Telegram.";
|
||||||
"lng_try_other_contact" = "Try other";
|
"lng_try_other_contact" = "Try other";
|
||||||
@ -713,8 +714,8 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
"lng_selected_cancel_sure_this" = "Do you want to cancel this upload?";
|
"lng_selected_cancel_sure_this" = "Do you want to cancel this upload?";
|
||||||
"lng_selected_delete_sure_this" = "Do you want to delete this message?";
|
"lng_selected_delete_sure_this" = "Do you want to delete this message?";
|
||||||
"lng_selected_delete_sure" = "Do you want to delete {count:_not_used_|# message|# messages}?";
|
"lng_selected_delete_sure" = "Do you want to delete {count:_not_used_|# message|# messages}?";
|
||||||
"lng_box_delete" = "DELETE";
|
"lng_box_delete" = "Delete";
|
||||||
"lng_box_leave" = "LEAVE";
|
"lng_box_leave" = "Leave";
|
||||||
|
|
||||||
"lng_about_version" = "Version {version}";
|
"lng_about_version" = "Version {version}";
|
||||||
"lng_about_text" = "Official free messaging app based on [a href=\"https://core.telegram.org/mtproto\"]MTProto[/a] and\n[a href=\"https://core.telegram.org/api\"]Telegram API[/a] for speed and security\n\nThis software is licensed under [a href=\"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\"]GNU GPL[/a] version 3,\nsource code is available on [a href=\"https://github.com/telegramdesktop/tdesktop\"]GitHub[/a].";
|
"lng_about_text" = "Official free messaging app based on [a href=\"https://core.telegram.org/mtproto\"]MTProto[/a] and\n[a href=\"https://core.telegram.org/api\"]Telegram API[/a] for speed and security\n\nThis software is licensed under [a href=\"https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\"]GNU GPL[/a] version 3,\nsource code is available on [a href=\"https://github.com/telegramdesktop/tdesktop\"]GitHub[/a].";
|
||||||
|
@ -59,24 +59,30 @@ wndShadow: sprite(209px, 46px, 19px, 19px);
|
|||||||
wndShadowShift: 1px;
|
wndShadowShift: 1px;
|
||||||
|
|
||||||
layerAlpha: 0.5;
|
layerAlpha: 0.5;
|
||||||
layerBG: black;
|
layerBg: black;
|
||||||
|
|
||||||
|
boxBg: white;
|
||||||
|
boxVerticalMargin: 10px;
|
||||||
boxWidth: 320px;
|
boxWidth: 320px;
|
||||||
boxWideWidth: 364px;
|
boxWideWidth: 364px;
|
||||||
boxPadding: margins(26px, 30px, 26px, 8px);
|
boxPadding: margins(26px, 30px, 34px, 8px);
|
||||||
boxMaxListHeight: 600px;
|
boxMaxListHeight: 600px;
|
||||||
boxFontSize: 14px;
|
boxFontSize: 14px;
|
||||||
boxTextFont: font(boxFontSize);
|
boxTextFont: font(boxFontSize);
|
||||||
|
|
||||||
boxTitleFont: font(boxFontSize semibold);
|
boxTitleFg: #444444;
|
||||||
|
boxTitleFont: font(boxFontSize bold);
|
||||||
boxTitlePosition: point(26px, 28px);
|
boxTitlePosition: point(26px, 28px);
|
||||||
boxTitleHeight: 54px;
|
boxTitleHeight: 54px;
|
||||||
|
|
||||||
boxBlueTitleHeight: 54px;
|
|
||||||
boxBlueTitleBg: #6393b5;
|
boxBlueTitleBg: #6393b5;
|
||||||
boxBlueTitleAdditionalFg: #dae9f5;
|
boxBlueTitleAdditionalFg: #dae9f5;
|
||||||
boxBlueTitleAdditionalSkip: 12px;
|
boxBlueTitleAdditionalSkip: 12px;
|
||||||
boxBlueTitlePosition: point(23px, 18px);
|
boxBlueTitlePosition: point(23px, 18px);
|
||||||
|
boxBlueCloseIcon: sprite(120px, 108px, 12px, 12px);
|
||||||
|
boxBlueCloseBg: #c8e1f0;
|
||||||
|
boxBlueCloseDuration: 150;
|
||||||
|
boxBlueShadow: sprite(132px, 108px, 1px, 4px);
|
||||||
|
|
||||||
boxButtonFont: font(boxFontSize semibold);
|
boxButtonFont: font(boxFontSize semibold);
|
||||||
defaultBoxButton: BoxButton {
|
defaultBoxButton: BoxButton {
|
||||||
@ -205,6 +211,73 @@ defaultRadiobutton: Radiobutton {
|
|||||||
font: boxTextFont;
|
font: boxTextFont;
|
||||||
duration: 120;
|
duration: 120;
|
||||||
}
|
}
|
||||||
|
solidScroll: flatScroll {
|
||||||
|
barColor: #3f729734;
|
||||||
|
bgColor: #214f751a;
|
||||||
|
barOverColor: #3f729734;
|
||||||
|
bgOverColor: #214f751a;
|
||||||
|
|
||||||
|
round: 0px;
|
||||||
|
minHeight: 20px;
|
||||||
|
|
||||||
|
deltax: 5px;
|
||||||
|
width: 14px;
|
||||||
|
deltat: 6px;
|
||||||
|
deltab: 6px;
|
||||||
|
|
||||||
|
topsh: 0px;
|
||||||
|
bottomsh: 0px;
|
||||||
|
shColor: rgba(0, 0, 0, 18);
|
||||||
|
|
||||||
|
duration: 150;
|
||||||
|
hiding: 0;
|
||||||
|
}
|
||||||
|
boxScroll: flatScroll(solidScroll) {
|
||||||
|
width: 18px;
|
||||||
|
deltax: 6px;
|
||||||
|
}
|
||||||
|
boxScrollSkip: 6px;
|
||||||
|
boxScrollShadowBg: #00000012;
|
||||||
|
|
||||||
|
boxSearchField: InputField(defaultInputField) {
|
||||||
|
textMargins: margins(41px, 16px, 41px, 0px);
|
||||||
|
|
||||||
|
placeholderFg: #999;
|
||||||
|
placeholderFgActive: #aaa;
|
||||||
|
placeholderMargins: margins(4px, 0px, 4px, 0px);
|
||||||
|
|
||||||
|
border: 0px;
|
||||||
|
borderActive: 0px;
|
||||||
|
borderError: 0px;
|
||||||
|
|
||||||
|
height: 48px;
|
||||||
|
|
||||||
|
iconSprite: sprite(227px, 21px, 24px, 24px);
|
||||||
|
iconPosition: point(15px, 14px);
|
||||||
|
}
|
||||||
|
boxSearchCancel: iconedButton {
|
||||||
|
color: white;
|
||||||
|
bgColor: white;
|
||||||
|
overBgColor: white;
|
||||||
|
font: font(fsize);
|
||||||
|
|
||||||
|
opacity: 0.3;
|
||||||
|
overOpacity: 0.4;
|
||||||
|
|
||||||
|
textPos: point(0px, 0px);
|
||||||
|
downTextPos: point(0px, 0px);
|
||||||
|
|
||||||
|
duration: 150;
|
||||||
|
cursor: cursor(pointer);
|
||||||
|
|
||||||
|
icon: sprite(133px, 108px, 12px, 12px);
|
||||||
|
iconPos: point(8px, 18px);
|
||||||
|
downIcon: sprite(133px, 108px, 12px, 12px);
|
||||||
|
downIconPos: point(8px, 18px);
|
||||||
|
|
||||||
|
width: 41px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
titleBG: #6389a8;
|
titleBG: #6389a8;
|
||||||
titleColor: #0f8dcc;//rgb(20, 136, 210);
|
titleColor: #0f8dcc;//rgb(20, 136, 210);
|
||||||
@ -586,73 +659,26 @@ inpIntroPassword: flatInput(inpIntroPhone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
introSelectDelta: 30px;
|
introSelectDelta: 30px;
|
||||||
btnSelectDone: flatButton(btnDefFlat) {
|
|
||||||
color: btnYesColor;
|
|
||||||
overColor: btnYesHover;
|
|
||||||
downColor: btnYesHover;
|
|
||||||
|
|
||||||
bgColor: white;
|
|
||||||
overBgColor: btnBoxWhiteHover;
|
|
||||||
downBgColor: btnBoxWhiteHover;
|
|
||||||
|
|
||||||
width: 182px;
|
|
||||||
height: 52px;
|
|
||||||
|
|
||||||
textTop: 14px;
|
|
||||||
overTextTop: 14px;
|
|
||||||
downTextTop: 15px;
|
|
||||||
|
|
||||||
font: font(17px);
|
|
||||||
overFont: font(17px);
|
|
||||||
}
|
|
||||||
btnSelectCancel: flatButton(btnSelectDone) {
|
|
||||||
width: 181px;
|
|
||||||
color: btnNoColor;
|
|
||||||
overColor: btnNoHover;
|
|
||||||
downColor: btnNoHover;
|
|
||||||
}
|
|
||||||
btnSelectSep: #e0e0e0;
|
btnSelectSep: #e0e0e0;
|
||||||
btnRedLink: linkButton(btnDefLink) {
|
btnRedLink: linkButton(btnDefLink) {
|
||||||
color: #d15948;
|
color: #d15948;
|
||||||
overColor: #d15948;
|
overColor: #d15948;
|
||||||
downColor: #db6352;
|
downColor: #db6352;
|
||||||
}
|
}
|
||||||
btnRedDone: flatButton(btnSelectDone) {
|
|
||||||
color: #d15948;
|
countryRowHeight: 36px;
|
||||||
overColor: #d15948;
|
countryRowNameFont: font(fsize semibold);
|
||||||
downColor: #db6352;
|
countryRowPadding: margins(22px, 9px, 8px, 0px);
|
||||||
|
countryRowCodeFont: font(fsize);
|
||||||
|
countryRowBgOver: #f5f8fa;
|
||||||
|
countryRowCodeFg: #808080;
|
||||||
|
countryRowCodeFgOver: #7c99b2;
|
||||||
|
countriesSkip: 12px;
|
||||||
|
countriesScroll: flatScroll(boxScroll) {
|
||||||
|
deltat: 9px;
|
||||||
|
deltab: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
countryList: countryList {
|
|
||||||
notFoundColor: #aaa;//rgb(20, 136, 210);
|
|
||||||
notFoundFont: font(18px);
|
|
||||||
|
|
||||||
verticalMargin: 0px;
|
|
||||||
|
|
||||||
font: font(18px);
|
|
||||||
codeFont: font(16px);
|
|
||||||
rowHeight: 42px;
|
|
||||||
color: #000;
|
|
||||||
codeColor: #aaaaaa;//rgb(20, 136, 210);
|
|
||||||
bgColor: #FFF;
|
|
||||||
bgHovered: #f5f5f5;
|
|
||||||
margin: 13px;
|
|
||||||
codeWidth: 60px;
|
|
||||||
|
|
||||||
borderMargin: 0px;
|
|
||||||
borderColor: rgba(228, 233, 240, 127);
|
|
||||||
borderWidth: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
countriesSlideShift: 500px;
|
|
||||||
countriesSlideDuration: 200;
|
|
||||||
countriesHideFunc: transition(easeInCirc);
|
|
||||||
countriesShowFunc: transition(easeOutCirc);
|
|
||||||
countriesBackHideFunc: transition(linear);
|
|
||||||
countriesBackShowFunc: transition(linear);
|
|
||||||
countriesAlphaHideFunc: transition(easeOutCirc);
|
|
||||||
countriesAlphaShowFunc: transition(easeInCirc);
|
|
||||||
|
|
||||||
introErrWidth: 450px;
|
introErrWidth: 450px;
|
||||||
introErrDuration: 200;
|
introErrDuration: 200;
|
||||||
introErrFunc: transition(linear);
|
introErrFunc: transition(linear);
|
||||||
@ -724,7 +750,7 @@ setErrBG: #ffa5a5;
|
|||||||
setErrColor: #d84d4d;
|
setErrColor: #d84d4d;
|
||||||
setErrHeight: 30px;
|
setErrHeight: 30px;
|
||||||
setErrFont: font(fsize);
|
setErrFont: font(fsize);
|
||||||
setGoodColor: #008000;
|
setGoodColor: #4ab44a;
|
||||||
|
|
||||||
setBackgroundSize: 120px;
|
setBackgroundSize: 120px;
|
||||||
|
|
||||||
@ -1324,28 +1350,35 @@ layerSlideDuration: 200;
|
|||||||
layerHideDuration: 200;
|
layerHideDuration: 200;
|
||||||
layerPadding: margins(10px, 10px, 10px, 10px);
|
layerPadding: margins(10px, 10px, 10px, 10px);
|
||||||
|
|
||||||
boxFont: font(16px);
|
contactPadding: margins(49px, 22px, 0px, 6px);
|
||||||
boxVerticalMargin: 10px;
|
contactSkip: 13px;
|
||||||
|
contactPhoneSkip: 30px;
|
||||||
boxBG: white;
|
|
||||||
boxGrayTitle: #777;
|
|
||||||
|
|
||||||
old_boxTitlePos: point(20px, 15px);
|
|
||||||
old_boxTitleFont: font(17px);
|
|
||||||
old_boxTitleHeight: 52px;
|
|
||||||
|
|
||||||
confirmMaxHeight: 320px;
|
|
||||||
confirmCompressedSkip: 10px;
|
|
||||||
addContactPadding: margins(18px, 24px, 18px, 24px);
|
|
||||||
addContactSkip: 14px;
|
|
||||||
inpAddContact: flatInput(inpDefGray) {
|
|
||||||
height: 42px;
|
|
||||||
textMrg: margins(10px, 5px, 10px, 5px);
|
|
||||||
font: font(15px);
|
|
||||||
}
|
|
||||||
contactUserIcon: sprite(120px, 90px, 18px, 18px);
|
contactUserIcon: sprite(120px, 90px, 18px, 18px);
|
||||||
contactPhoneIcon: sprite(138px, 90px, 18px, 18px);
|
contactPhoneIcon: sprite(138px, 90px, 18px, 18px);
|
||||||
contactAddIcon: sprite(307px, 248px, 22px, 16px);
|
contactIconTop: 10px;
|
||||||
|
|
||||||
|
contactsPhotoSize: 42px;
|
||||||
|
contactsPadding: margins(16px, 7px, 16px, 7px);
|
||||||
|
contactsNameTop: 2px;
|
||||||
|
contactsNameFont: font(fsize semibold);
|
||||||
|
contactsStatusTop: 23px;
|
||||||
|
contactsStatusFont: font(fsize);
|
||||||
|
contactsStatusFg: #999999;
|
||||||
|
contactsStatusFgOver: #7c99b2;
|
||||||
|
contactsStatusFgOnline: #3b8dcc;
|
||||||
|
contactsBgOver: #f5f8fa;
|
||||||
|
contactsBgActive: #6f9cbd;
|
||||||
|
contactsCheckPosition: point(8px, 16px);
|
||||||
|
contactsCheckIcon: sprite(187px, 61px, 18px, 14px);
|
||||||
|
contactsCheckActiveIcon: sprite(187px, 75px, 18px, 14px);
|
||||||
|
contactsNewItemHeight: 53px;
|
||||||
|
contactsNewItemIcon: sprite(307px, 248px, 22px, 16px);
|
||||||
|
contactsNewItemIconPosition: point(29px, 19px);
|
||||||
|
contactsNewItemTop: 18px;
|
||||||
|
contactsNewItemFg: #4b82af;
|
||||||
|
contactsScroll: flatScroll(boxScroll) {
|
||||||
|
deltab: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
btnNewGroup: iconedButton(btnDefIconed) {
|
btnNewGroup: iconedButton(btnDefIconed) {
|
||||||
icon: sprite(189px, 118px, 18px, 17px);
|
icon: sprite(189px, 118px, 18px, 17px);
|
||||||
@ -1397,8 +1430,19 @@ notifyHeight: 80px;
|
|||||||
notifyDeltaX: 6px;
|
notifyDeltaX: 6px;
|
||||||
notifyDeltaY: 7px;
|
notifyDeltaY: 7px;
|
||||||
|
|
||||||
|
boxPhotoPadding: margins(28px, 28px, 28px, 18px);
|
||||||
|
boxPhotoCompressedPadding: margins(0px, 2px, 0px, 22px);
|
||||||
|
boxPhotoTextFg: #808080;
|
||||||
cropPointSize: 10px;
|
cropPointSize: 10px;
|
||||||
|
cropSkip: 13px;
|
||||||
cropMinSize: 20px;
|
cropMinSize: 20px;
|
||||||
|
confirmCaptionArea: InputArea(defaultInputArea) {
|
||||||
|
textMargins: margins(1px, 6px, 1px, 4px);
|
||||||
|
heightMax: 56px;
|
||||||
|
}
|
||||||
|
confirmBg: #f2f2f2;
|
||||||
|
confirmMaxHeight: 245px;
|
||||||
|
confirmCompressedSkip: 10px;
|
||||||
|
|
||||||
profileMaxWidth: 410px;
|
profileMaxWidth: 410px;
|
||||||
profilePadding: margins(28px, 30px, 28px, 0px);
|
profilePadding: margins(28px, 30px, 28px, 0px);
|
||||||
@ -1427,8 +1471,6 @@ profileListStatusBottom: 6px;
|
|||||||
profileHoverBG: #f5f5f5;
|
profileHoverBG: #f5f5f5;
|
||||||
profileActiveBG: #6294b9;
|
profileActiveBG: #6294b9;
|
||||||
profileSubFont: font(fsize);
|
profileSubFont: font(fsize);
|
||||||
profileCheckDeltaX: 18px;
|
|
||||||
profileCheckDeltaY: 1px;
|
|
||||||
profileListNameFont: font(fsize semibold);
|
profileListNameFont: font(fsize semibold);
|
||||||
profileListNameColor: #000;
|
profileListNameColor: #000;
|
||||||
profileOnlineColor: titleTypingColor;
|
profileOnlineColor: titleTypingColor;
|
||||||
@ -1445,8 +1487,6 @@ btnShareContact: flatButton(btnDefNext, btnDefBig) {
|
|||||||
overFont: font(17px);
|
overFont: font(17px);
|
||||||
}
|
}
|
||||||
profileMinBtnPadding: 10px;
|
profileMinBtnPadding: 10px;
|
||||||
inviteCheckIcon: sprite(187px, 61px, 18px, 14px);
|
|
||||||
inviteCheckActiveIcon: sprite(187px, 75px, 18px, 14px);
|
|
||||||
|
|
||||||
membersPadding: margins(0px, 10px, 0px, 10px);
|
membersPadding: margins(0px, 10px, 0px, 10px);
|
||||||
|
|
||||||
@ -1497,14 +1537,6 @@ profileNameInput: flatInput(setNameInput) {
|
|||||||
width: 230px;
|
width: 230px;
|
||||||
}
|
}
|
||||||
|
|
||||||
boxScroll: flatScroll(scrollDef) {
|
|
||||||
topsh: -2px;
|
|
||||||
bottomsh: -2px;
|
|
||||||
}
|
|
||||||
boxNoTopScroll: flatScroll(boxScroll) {
|
|
||||||
topsh: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
participantInnerAdd: flatButton(btnDefNext) {
|
participantInnerAdd: flatButton(btnDefNext) {
|
||||||
width: 145px;
|
width: 145px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
@ -1538,8 +1570,6 @@ contactsFilter: flatInput(dlgFilter) {
|
|||||||
inpCountry: flatInput(contactsFilter) {
|
inpCountry: flatInput(contactsFilter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
old_newGroupNamePadding: margins(12px, 15px, 12px, 13px);
|
|
||||||
|
|
||||||
newGroupLimitFg: #a4a4a4;
|
newGroupLimitFg: #a4a4a4;
|
||||||
newGroupAboutFg: #808080;
|
newGroupAboutFg: #808080;
|
||||||
newGroupPadding: margins(4px, 6px, 4px, 3px);
|
newGroupPadding: margins(4px, 6px, 4px, 3px);
|
||||||
@ -1547,10 +1577,10 @@ newGroupSkip: 17px;
|
|||||||
newGroupInfoPadding: margins(0px, -4px, 0px, 1px);
|
newGroupInfoPadding: margins(0px, -4px, 0px, 1px);
|
||||||
|
|
||||||
newGroupLink: InputField(defaultInputField) {
|
newGroupLink: InputField(defaultInputField) {
|
||||||
textMargins: margins(0px, 6px, 0px, 4px);
|
textMargins: margins(0px, 6px, 0px, 0px);
|
||||||
}
|
}
|
||||||
newGroupLinkPadding: margins(4px, 27px, 4px, 27px);
|
newGroupLinkPadding: margins(4px, 27px, 4px, 12px);
|
||||||
newGroupLinkTop: -3px;
|
newGroupLinkTop: 3px;
|
||||||
newGroupLinkFont: font(16px);
|
newGroupLinkFont: font(16px);
|
||||||
|
|
||||||
newGroupPhotoSize: 76px;
|
newGroupPhotoSize: 76px;
|
||||||
@ -1561,7 +1591,7 @@ newGroupPhotoIconPosition: point(23px, 25px);
|
|||||||
|
|
||||||
newGroupNamePosition: point(27px, 20px);
|
newGroupNamePosition: point(27px, 20px);
|
||||||
newGroupName: InputField(defaultInputField) {
|
newGroupName: InputField(defaultInputField) {
|
||||||
textMargins: margins(1px, 6px, 1px, 4px);
|
textMargins: margins(1px, 6px, 1px, 0px);
|
||||||
}
|
}
|
||||||
|
|
||||||
newGroupDescriptionPadding: margins(0px, 23px, 0px, 14px);
|
newGroupDescriptionPadding: margins(0px, 23px, 0px, 14px);
|
||||||
@ -1587,26 +1617,6 @@ connectionPasswordInputField: InputField(defaultInputField) {
|
|||||||
}
|
}
|
||||||
connectionIPv6Skip: 11px;
|
connectionIPv6Skip: 11px;
|
||||||
|
|
||||||
contactsClose: flatButton {
|
|
||||||
color: btnYesColor;
|
|
||||||
overColor: btnYesHover;
|
|
||||||
downColor: btnYesHover;
|
|
||||||
|
|
||||||
bgColor: white;
|
|
||||||
overBgColor: white;
|
|
||||||
downBgColor: white;
|
|
||||||
|
|
||||||
width: 364px;
|
|
||||||
height: 46px;
|
|
||||||
|
|
||||||
textTop: 12px;
|
|
||||||
overTextTop: 12px;
|
|
||||||
downTextTop: 13px;
|
|
||||||
|
|
||||||
font: font(16px);
|
|
||||||
overFont: font(16px);
|
|
||||||
}
|
|
||||||
contactsImg: sprite(31px, 104px, 9px, 16px);
|
|
||||||
contactsAdd: flatButton(topBarButton) {
|
contactsAdd: flatButton(topBarButton) {
|
||||||
width: -40px;
|
width: -40px;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
@ -1639,21 +1649,34 @@ aboutLabel: flatLabel(labelDefFlat) {
|
|||||||
aboutTextStyle: textStyle(defaultTextStyle) {
|
aboutTextStyle: textStyle(defaultTextStyle) {
|
||||||
lineHeight: 24px;
|
lineHeight: 24px;
|
||||||
}
|
}
|
||||||
aboutCloseButton: flatButton(contactsClose) {
|
aboutCloseButton: flatButton {
|
||||||
|
color: btnYesColor;
|
||||||
|
overColor: btnYesHover;
|
||||||
|
downColor: btnYesHover;
|
||||||
|
|
||||||
|
bgColor: white;
|
||||||
|
overBgColor: white;
|
||||||
|
downBgColor: white;
|
||||||
|
|
||||||
width: aboutWidth;
|
width: aboutWidth;
|
||||||
height: 52px;
|
height: 52px;
|
||||||
|
|
||||||
textTop: 15px;
|
textTop: 15px;
|
||||||
overTextTop: 15px;
|
overTextTop: 15px;
|
||||||
downTextTop: 16px;
|
downTextTop: 16px;
|
||||||
|
|
||||||
|
font: font(16px);
|
||||||
|
overFont: font(16px);
|
||||||
}
|
}
|
||||||
btnInfoClose: flatButton(aboutCloseButton) {
|
btnInfoClose: flatButton(aboutCloseButton) {
|
||||||
width: boxWideWidth;
|
width: boxWideWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
emojiTextFont: font(16px);
|
emojiTextFont: font(15px);
|
||||||
emojiReplaceWidth: 56px;
|
emojiReplaceWidth: 52px;
|
||||||
emojiReplaceHeight: 56px;
|
emojiReplaceHeight: 56px;
|
||||||
emojiReplaceInnerHeight: 42px;
|
emojiReplaceInnerHeight: 42px;
|
||||||
|
emojiReplacePadding: 14px;
|
||||||
|
|
||||||
connectingBG: #fffe;
|
connectingBG: #fffe;
|
||||||
connectingColor: #777;
|
connectingColor: #777;
|
||||||
@ -1732,54 +1755,16 @@ dpiFont2: linkFont;
|
|||||||
dpiFont3: linkFont;
|
dpiFont3: linkFont;
|
||||||
dpiFont4: linkFont;
|
dpiFont4: linkFont;
|
||||||
|
|
||||||
newScroll: flatScroll(scrollDef) {
|
stickersMaxHeight: 440px;
|
||||||
barColor: #3f729734;
|
stickersPadding: margins(19px, 17px, 19px, 17px);
|
||||||
bgColor: #214f751a;
|
|
||||||
barOverColor: #3f729734;
|
|
||||||
bgOverColor: #214f751a;
|
|
||||||
|
|
||||||
deltax: 5px;
|
|
||||||
width: 14px;
|
|
||||||
deltat: 6px;
|
|
||||||
deltab: 6px;
|
|
||||||
|
|
||||||
topsh: 0px;
|
|
||||||
bottomsh: 0px;
|
|
||||||
|
|
||||||
hiding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
stickersMaxHeight: 340px;
|
|
||||||
stickersAddOrShare: 70px;
|
|
||||||
btnStickersAdd: flatButton(btnDefNext, btnDefBig) {
|
|
||||||
width: 200px;
|
|
||||||
height: 42px;
|
|
||||||
|
|
||||||
textTop: 9px;
|
|
||||||
overTextTop: 9px;
|
|
||||||
downTextTop: 10px;
|
|
||||||
|
|
||||||
font: font(17px);
|
|
||||||
overFont: font(17px);
|
|
||||||
|
|
||||||
bgColor: #15c23c;
|
|
||||||
overBgColor: #13a835;
|
|
||||||
downBgColor: #13a835;
|
|
||||||
}
|
|
||||||
btnStickersClose: iconedButton(notifyClose) {
|
|
||||||
iconPos: point(21px, 21px);
|
|
||||||
downIconPos: point(21px, 22px);
|
|
||||||
width: 52px;
|
|
||||||
height: 48px;
|
|
||||||
}
|
|
||||||
stickersWidth: 344px;
|
|
||||||
stickersPadding: 10px;
|
|
||||||
stickersSize: size(64px, 64px);
|
stickersSize: size(64px, 64px);
|
||||||
stickersScroll: flatScroll(newScroll) {
|
stickersScroll: flatScroll(boxScroll) {
|
||||||
deltab: 76px;
|
deltax: 7px;
|
||||||
|
deltat: 23px;
|
||||||
|
deltab: 9px;
|
||||||
}
|
}
|
||||||
|
|
||||||
emojiScroll: flatScroll(newScroll) {
|
emojiScroll: flatScroll(solidScroll) {
|
||||||
deltat: 48px;
|
deltat: 48px;
|
||||||
}
|
}
|
||||||
emojiRecentOver: sprite(0px, 196px, 21px, 22px);
|
emojiRecentOver: sprite(0px, 196px, 21px, 22px);
|
||||||
@ -1945,7 +1930,7 @@ botKbTinyButton: botKeyboardButton {
|
|||||||
textTop: 2px;
|
textTop: 2px;
|
||||||
downTextTop: 3px;
|
downTextTop: 3px;
|
||||||
}
|
}
|
||||||
botKbScroll: flatScroll(newScroll) {
|
botKbScroll: flatScroll(solidScroll) {
|
||||||
deltax: 3px;
|
deltax: 3px;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
}
|
}
|
||||||
@ -2150,6 +2135,12 @@ langsButton: Radiobutton(defaultRadiobutton) {
|
|||||||
|
|
||||||
backgroundPadding: 10px;
|
backgroundPadding: 10px;
|
||||||
backgroundSize: size(108px, 193px);
|
backgroundSize: size(108px, 193px);
|
||||||
|
backgroundScroll: flatScroll(boxScroll) {
|
||||||
|
width: 10px;
|
||||||
|
deltax: 3px;
|
||||||
|
deltat: 10px;
|
||||||
|
deltab: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
passcodeHeaderFont: font(19px);
|
passcodeHeaderFont: font(19px);
|
||||||
passcodeHeaderHeight: 80px;
|
passcodeHeaderHeight: 80px;
|
||||||
|
@ -198,27 +198,6 @@ countryInput {
|
|||||||
align: align;
|
align: align;
|
||||||
}
|
}
|
||||||
|
|
||||||
countryList {
|
|
||||||
notFoundColor: color;
|
|
||||||
notFoundFont: font;
|
|
||||||
|
|
||||||
verticalMargin: number;
|
|
||||||
|
|
||||||
font: font;
|
|
||||||
codeFont: font;
|
|
||||||
rowHeight: number;
|
|
||||||
color: color;
|
|
||||||
codeColor: color;
|
|
||||||
bgColor: color;
|
|
||||||
bgHovered: color;
|
|
||||||
margin: number;
|
|
||||||
codeWidth: number;
|
|
||||||
|
|
||||||
borderMargin: number;
|
|
||||||
borderColor: color;
|
|
||||||
borderWidth: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
slider {
|
slider {
|
||||||
color: color;
|
color: color;
|
||||||
thikness: number;
|
thikness: number;
|
||||||
|
@ -1965,7 +1965,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
|
|||||||
while (!already.isEmpty() && (already.size() > k.size() || !already.endsWith(k.at(already.size() - 1)))) {
|
while (!already.isEmpty() && (already.size() > k.size() || !already.endsWith(k.at(already.size() - 1)))) {
|
||||||
if (!onlyLastChanged) {
|
if (!onlyLastChanged) {
|
||||||
tnum << QString("\t").repeated(1 + already.size()) << "}\n";
|
tnum << QString("\t").repeated(1 + already.size()) << "}\n";
|
||||||
tnum << QString("\t").repeated(1 + already.size()) << "return result;\n";
|
tnum << QString("\t").repeated(already.size()) << "break;\n";
|
||||||
}
|
}
|
||||||
already = already.mid(0, already.size() - 1);
|
already = already.mid(0, already.size() - 1);
|
||||||
onlyLastChanged = false;
|
onlyLastChanged = false;
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 176 KiB |
Binary file not shown.
Before Width: | Height: | Size: 235 KiB After Width: | Height: | Size: 236 KiB |
@ -27,7 +27,62 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
AbstractBox::AbstractBox(int32 w) : _maxHeight(0), _hiding(false), a_opacity(0, 1) {
|
void BlueTitleShadow::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
|
||||||
|
QRect r(e->rect());
|
||||||
|
p.drawPixmap(QRect(r.left(), 0, r.width(), height()), App::sprite(), st::boxBlueShadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlueTitleClose::BlueTitleClose(QWidget *parent) : Button(parent)
|
||||||
|
, a_iconFg(st::boxBlueCloseBg->c)
|
||||||
|
, _a_over(animFunc(this, &BlueTitleClose::animStep_over)) {
|
||||||
|
resize(st::boxTitleHeight, st::boxTitleHeight);
|
||||||
|
setCursor(style::cur_pointer);
|
||||||
|
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlueTitleClose::onStateChange(int oldState, ButtonStateChangeSource source) {
|
||||||
|
if ((oldState & StateOver) != (_state & StateOver)) {
|
||||||
|
a_iconFg.start(((_state & StateOver) ? st::white : st::boxBlueCloseBg)->c);
|
||||||
|
_a_over.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BlueTitleClose::animStep_over(float64 ms) {
|
||||||
|
float64 dt = ms / st::boxBlueCloseDuration;
|
||||||
|
bool res = true;
|
||||||
|
if (dt >= 1) {
|
||||||
|
res = false;
|
||||||
|
a_iconFg.finish();
|
||||||
|
} else {
|
||||||
|
a_iconFg.update(dt, anim::linear);
|
||||||
|
}
|
||||||
|
update((st::boxTitleHeight - st::boxBlueCloseIcon.pxWidth()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.pxHeight()) / 2, st::boxBlueCloseIcon.pxWidth(), st::boxBlueCloseIcon.pxHeight());
|
||||||
|
return res;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlueTitleClose::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
|
||||||
|
QRect r(e->rect()), s((st::boxTitleHeight - st::boxBlueCloseIcon.pxWidth()) / 2, (st::boxTitleHeight - st::boxBlueCloseIcon.pxHeight()) / 2, st::boxBlueCloseIcon.pxWidth(), st::boxBlueCloseIcon.pxHeight());
|
||||||
|
if (!s.contains(r)) {
|
||||||
|
p.fillRect(r, st::boxBlueTitleBg->b);
|
||||||
|
}
|
||||||
|
if (s.intersects(r)) {
|
||||||
|
p.fillRect(s.intersected(r), a_iconFg.current());
|
||||||
|
p.drawSprite(s.topLeft(), st::boxBlueCloseIcon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractBox::AbstractBox(int32 w) : LayeredWidget()
|
||||||
|
, _maxHeight(0)
|
||||||
|
, _hiding(false)
|
||||||
|
, a_opacity(0, 1)
|
||||||
|
, _blueTitle(false)
|
||||||
|
, _blueClose(0)
|
||||||
|
, _blueShadow(0) {
|
||||||
resize(w, 0);
|
resize(w, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +100,16 @@ void AbstractBox::keyPressEvent(QKeyEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractBox::resizeEvent(QResizeEvent *e) {
|
||||||
|
if (_blueClose) {
|
||||||
|
_blueClose->moveToRight(0, 0);
|
||||||
|
}
|
||||||
|
if (_blueShadow) {
|
||||||
|
_blueShadow->moveToLeft(0, st::boxTitleHeight);
|
||||||
|
_blueShadow->resize(width(), st::boxBlueShadow.pxHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractBox::parentResized() {
|
void AbstractBox::parentResized() {
|
||||||
int32 newHeight = countHeight();
|
int32 newHeight = countHeight();
|
||||||
setGeometry((App::wnd()->width() - width()) / 2, (App::wnd()->height() - newHeight) / 2, width(), newHeight);
|
setGeometry((App::wnd()->width() - width()) / 2, (App::wnd()->height() - newHeight) / 2, width(), newHeight);
|
||||||
@ -57,7 +122,7 @@ bool AbstractBox::paint(QPainter &p) {
|
|||||||
result = (_hiding && a_opacity.current() < 0.01);
|
result = (_hiding && a_opacity.current() < 0.01);
|
||||||
|
|
||||||
// fill bg
|
// fill bg
|
||||||
p.fillRect(rect(), st::boxBG->b);
|
p.fillRect(rect(), st::boxBg->b);
|
||||||
} else {
|
} else {
|
||||||
p.setOpacity(a_opacity.current());
|
p.setOpacity(a_opacity.current());
|
||||||
p.drawPixmap(0, 0, _cache);
|
p.drawPixmap(0, 0, _cache);
|
||||||
@ -65,29 +130,10 @@ bool AbstractBox::paint(QPainter &p) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::paintOldTitle(Painter &p, const QString &title, bool withShadow) {
|
void AbstractBox::paintTitle(Painter &p, const QString &title, const QString &additional) {
|
||||||
if (withShadow) {
|
|
||||||
// paint shadow
|
|
||||||
p.fillRect(0, st::old_boxTitleHeight, width(), st::scrollDef.topsh, st::scrollDef.shColor->b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// paint box title
|
|
||||||
p.setFont(st::old_boxTitleFont->f);
|
|
||||||
p.setPen(st::black->p);
|
|
||||||
p.drawTextLeft(st::old_boxTitlePos.x(), st::old_boxTitlePos.y(), width(), title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractBox::paintTitle(Painter &p, const QString &title) {
|
|
||||||
// paint box title
|
|
||||||
p.setFont(st::boxTitleFont);
|
|
||||||
p.setPen(st::black);
|
|
||||||
p.drawTextLeft(st::boxTitlePosition.x(), st::boxTitlePosition.y(), width(), title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractBox::paintBlueTitle(Painter &p, const QString &title, const QString &additional) {
|
|
||||||
// paint box title
|
|
||||||
p.fillRect(0, 0, width(), st::boxBlueTitleHeight, st::boxBlueTitleBg->b);
|
|
||||||
p.setFont(st::boxTitleFont);
|
p.setFont(st::boxTitleFont);
|
||||||
|
if (_blueTitle) {
|
||||||
|
p.fillRect(0, 0, width(), st::boxTitleHeight, st::boxBlueTitleBg->b);
|
||||||
p.setPen(st::white);
|
p.setPen(st::white);
|
||||||
|
|
||||||
int32 titleWidth = st::boxTitleFont->width(title);
|
int32 titleWidth = st::boxTitleFont->width(title);
|
||||||
@ -98,13 +144,10 @@ void AbstractBox::paintBlueTitle(Painter &p, const QString &title, const QString
|
|||||||
p.setPen(st::boxBlueTitleAdditionalFg);
|
p.setPen(st::boxBlueTitleAdditionalFg);
|
||||||
p.drawTextLeft(st::boxBlueTitlePosition.x() + titleWidth + st::boxBlueTitleAdditionalSkip, st::boxBlueTitlePosition.y(), width(), additional);
|
p.drawTextLeft(st::boxBlueTitlePosition.x() + titleWidth + st::boxBlueTitleAdditionalSkip, st::boxBlueTitlePosition.y(), width(), additional);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
p.setPen(st::boxTitleFg);
|
||||||
|
p.drawTextLeft(st::boxTitlePosition.x(), st::boxTitlePosition.y(), width(), title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::paintGrayTitle(QPainter &p, const QString &title) {
|
|
||||||
// draw box title
|
|
||||||
p.setFont(st::boxFont->f);
|
|
||||||
p.setPen(st::boxGrayTitle->p);
|
|
||||||
p.drawText(QRect(st::old_boxTitlePos.x(), st::old_boxTitlePos.y(), width() - 2 * st::old_boxTitlePos.x(), st::boxFont->height), title, style::al_top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::paintEvent(QPaintEvent *e) {
|
void AbstractBox::paintEvent(QPaintEvent *e) {
|
||||||
@ -159,12 +202,35 @@ void AbstractBox::startHide() {
|
|||||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollableBox::ScrollableBox(const style::flatScroll &scroll) : AbstractBox(),
|
void AbstractBox::setBlueTitle(bool blue) {
|
||||||
_scroll(this, scroll), _innerPtr(0), _topSkip(st::old_boxTitleHeight), _bottomSkip(0) {
|
_blueTitle = blue;
|
||||||
|
delete _blueShadow;
|
||||||
|
_blueShadow = new BlueTitleShadow(this);
|
||||||
|
delete _blueClose;
|
||||||
|
_blueClose = new BlueTitleClose(this);
|
||||||
|
_blueClose->setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
connect(_blueClose, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractBox::raiseShadow() {
|
||||||
|
if (_blueShadow) {
|
||||||
|
_blueShadow->raise();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollableBoxShadow::paintEvent(QPaintEvent *e) {
|
||||||
|
Painter p(this);
|
||||||
|
p.fillRect(e->rect(), st::boxScrollShadowBg->b);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollableBox::ScrollableBox(const style::flatScroll &scroll, int32 w) : AbstractBox(w),
|
||||||
|
_scroll(this, scroll), _innerPtr(0), _topSkip(st::boxTitleHeight), _bottomSkip(st::boxScrollSkip) {
|
||||||
|
setBlueTitle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollableBox::resizeEvent(QResizeEvent *e) {
|
void ScrollableBox::resizeEvent(QResizeEvent *e) {
|
||||||
_scroll.setGeometry(0, _topSkip, width(), height() - _topSkip - _bottomSkip);
|
_scroll.setGeometry(0, _topSkip, width(), height() - _topSkip - _bottomSkip);
|
||||||
|
AbstractBox::resizeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollableBox::init(QWidget *inner, int32 bottomSkip, int32 topSkip) {
|
void ScrollableBox::init(QWidget *inner, int32 bottomSkip, int32 topSkip) {
|
||||||
@ -178,12 +244,14 @@ void ScrollableBox::init(QWidget *inner, int32 bottomSkip, int32 topSkip) {
|
|||||||
|
|
||||||
void ScrollableBox::hideAll() {
|
void ScrollableBox::hideAll() {
|
||||||
_scroll.hide();
|
_scroll.hide();
|
||||||
|
AbstractBox::hideAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollableBox::showAll() {
|
void ScrollableBox::showAll() {
|
||||||
_scroll.show();
|
_scroll.show();
|
||||||
|
AbstractBox::showAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemListBox::ItemListBox(const style::flatScroll &scroll) : ScrollableBox(scroll) {
|
ItemListBox::ItemListBox(const style::flatScroll &scroll, int32 w) : ScrollableBox(scroll, w) {
|
||||||
setMaxHeight(st::boxMaxListHeight);
|
setMaxHeight(st::boxMaxListHeight);
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,31 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
#include "layerwidget.h"
|
#include "layerwidget.h"
|
||||||
|
|
||||||
|
class BlueTitleShadow : public TWidget {
|
||||||
|
public:
|
||||||
|
BlueTitleShadow(QWidget *parent) : TWidget(parent) {
|
||||||
|
}
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
};
|
||||||
|
|
||||||
|
class BlueTitleClose : public Button {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
BlueTitleClose(QWidget *parent);
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void onStateChange(int oldState, ButtonStateChangeSource source);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool animStep_over(float64 ms);
|
||||||
|
anim::cvalue a_iconFg;
|
||||||
|
Animation _a_over;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
class AbstractBox : public LayeredWidget {
|
class AbstractBox : public LayeredWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -31,9 +56,13 @@ public:
|
|||||||
void parentResized();
|
void parentResized();
|
||||||
void animStep(float64 ms);
|
void animStep(float64 ms);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void startHide();
|
void startHide();
|
||||||
|
|
||||||
|
void setBlueTitle(bool blue);
|
||||||
|
void raiseShadow();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onClose();
|
void onClose();
|
||||||
@ -42,18 +71,19 @@ protected:
|
|||||||
|
|
||||||
void prepare();
|
void prepare();
|
||||||
bool paint(QPainter &p);
|
bool paint(QPainter &p);
|
||||||
void paintTitle(Painter &p, const QString &title);
|
void paintTitle(Painter &p, const QString &title, const QString &additional = QString());
|
||||||
void paintBlueTitle(Painter &p, const QString &title, const QString &additional = QString());
|
|
||||||
void paintOldTitle(Painter &p, const QString &title, bool withShadow);
|
|
||||||
void paintGrayTitle(QPainter &p, const QString &title);
|
|
||||||
void setMaxHeight(int32 maxHeight);
|
void setMaxHeight(int32 maxHeight);
|
||||||
void resizeMaxHeight(int32 newWidth, int32 maxHeight);
|
void resizeMaxHeight(int32 newWidth, int32 maxHeight);
|
||||||
|
|
||||||
virtual void closePressed() {
|
virtual void closePressed() {
|
||||||
}
|
}
|
||||||
virtual void hideAll() {
|
virtual void hideAll() {
|
||||||
|
if (_blueClose) _blueClose->hide();
|
||||||
|
if (_blueShadow) _blueShadow->hide();
|
||||||
}
|
}
|
||||||
virtual void showAll() {
|
virtual void showAll() {
|
||||||
|
if (_blueClose) _blueClose->show();
|
||||||
|
if (_blueShadow) _blueShadow->show();
|
||||||
}
|
}
|
||||||
virtual void showDone() {
|
virtual void showDone() {
|
||||||
setFocus();
|
setFocus();
|
||||||
@ -68,17 +98,28 @@ private:
|
|||||||
QPixmap _cache;
|
QPixmap _cache;
|
||||||
|
|
||||||
anim::fvalue a_opacity;
|
anim::fvalue a_opacity;
|
||||||
|
|
||||||
|
bool _blueTitle;
|
||||||
|
BlueTitleClose *_blueClose;
|
||||||
|
BlueTitleShadow *_blueShadow;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ScrollableBoxShadow : public TWidget {
|
||||||
|
public:
|
||||||
|
ScrollableBoxShadow(QWidget *parent) : TWidget(parent) {
|
||||||
|
}
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScrollableBox : public AbstractBox {
|
class ScrollableBox : public AbstractBox {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ScrollableBox(const style::flatScroll &scroll);
|
ScrollableBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void init(QWidget *inner, int32 bottomSkip = 0, int32 topSkip = st::old_boxTitleHeight);
|
void init(QWidget *inner, int32 bottomSkip = st::boxScrollSkip, int32 topSkip = st::boxTitleHeight);
|
||||||
|
|
||||||
virtual void hideAll();
|
virtual void hideAll();
|
||||||
virtual void showAll();
|
virtual void showAll();
|
||||||
@ -95,6 +136,12 @@ private:
|
|||||||
class ItemListBox : public ScrollableBox {
|
class ItemListBox : public ScrollableBox {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ItemListBox(const style::flatScroll &scroll);
|
ItemListBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CreatingGroupType {
|
||||||
|
CreatingGroupNone,
|
||||||
|
CreatingGroupGroup,
|
||||||
|
CreatingGroupChannel,
|
||||||
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -28,18 +28,18 @@ class AddContactBox : public AbstractBox, public RPCSender {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
AddContactBox(QString fname = QString(), QString lname = QString(), QString phone = QString());
|
AddContactBox(QString fname = QString(), QString lname = QString(), QString phone = QString());
|
||||||
AddContactBox(PeerData *peer);
|
AddContactBox(UserData *user);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
void setInnerFocus() {
|
void setInnerFocus() {
|
||||||
_firstInput.setFocus();
|
_first.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSend();
|
void onSubmit();
|
||||||
|
void onSave();
|
||||||
void onRetry();
|
void onRetry();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -52,20 +52,17 @@ private:
|
|||||||
|
|
||||||
void onImportDone(const MTPcontacts_ImportedContacts &res);
|
void onImportDone(const MTPcontacts_ImportedContacts &res);
|
||||||
|
|
||||||
void onSaveSelfDone(const MTPUser &user);
|
|
||||||
bool onSaveSelfFail(const RPCError &error);
|
|
||||||
|
|
||||||
void onSaveChatDone(const MTPUpdates &updates);
|
|
||||||
void onSaveUserDone(const MTPcontacts_ImportedContacts &res);
|
void onSaveUserDone(const MTPcontacts_ImportedContacts &res);
|
||||||
bool onSaveFail(const RPCError &e);
|
bool onSaveUserFail(const RPCError &e);
|
||||||
|
|
||||||
void initBox();
|
void initBox();
|
||||||
|
|
||||||
PeerData *_peer;
|
UserData *_user;
|
||||||
QString _boxTitle;
|
QString _boxTitle;
|
||||||
|
|
||||||
FlatButton _addButton, _retryButton, _cancelButton;
|
BoxButton _save, _cancel, _retry;
|
||||||
FlatInput _firstInput, _lastInput, _phoneInput;
|
InputField _first, _last;
|
||||||
|
PhoneInput _phone;
|
||||||
|
|
||||||
bool _invertOrder;
|
bool _invertOrder;
|
||||||
|
|
||||||
@ -75,6 +72,169 @@ private:
|
|||||||
QString _sentName;
|
QString _sentName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class NewGroupBox : public AbstractBox {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
NewGroupBox();
|
||||||
|
void keyPressEvent(QKeyEvent *e);
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void onNext();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void hideAll();
|
||||||
|
void showAll();
|
||||||
|
void showDone();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
Radiobutton _group, _channel;
|
||||||
|
int32 _aboutGroupWidth, _aboutGroupHeight;
|
||||||
|
Text _aboutGroup, _aboutChannel;
|
||||||
|
BoxButton _next, _cancel;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class GroupInfoBox : public AbstractBox, public RPCSender {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose);
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
void mouseMoveEvent(QMouseEvent *e);
|
||||||
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
void leaveEvent(QEvent *e);
|
||||||
|
|
||||||
|
bool animStep_photoOver(float64 ms);
|
||||||
|
|
||||||
|
void setInnerFocus() {
|
||||||
|
_title.setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void onPhoto();
|
||||||
|
void onPhotoReady(const QImage &img);
|
||||||
|
|
||||||
|
void onNext();
|
||||||
|
void onNameSubmit();
|
||||||
|
void onDescriptionResized();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void hideAll();
|
||||||
|
void showAll();
|
||||||
|
void showDone();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
QRect photoRect() const;
|
||||||
|
|
||||||
|
void updateMaxHeight();
|
||||||
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||||
|
CreatingGroupType _creating;
|
||||||
|
|
||||||
|
anim::fvalue a_photoOver;
|
||||||
|
Animation _a_photoOver;
|
||||||
|
bool _photoOver;
|
||||||
|
|
||||||
|
InputField _title;
|
||||||
|
InputArea _description;
|
||||||
|
|
||||||
|
QImage _photoBig;
|
||||||
|
QPixmap _photoSmall;
|
||||||
|
BoxButton _next, _cancel;
|
||||||
|
|
||||||
|
// channel creation
|
||||||
|
int32 _creationRequestId;
|
||||||
|
ChannelData *_createdChannel;
|
||||||
|
|
||||||
|
void creationDone(const MTPUpdates &updates);
|
||||||
|
bool creationFail(const RPCError &e);
|
||||||
|
void exportDone(const MTPExportedChatInvite &result);
|
||||||
|
};
|
||||||
|
|
||||||
|
class SetupChannelBox : public AbstractBox, public RPCSender {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
SetupChannelBox(ChannelData *channel, bool existing = false);
|
||||||
|
void keyPressEvent(QKeyEvent *e);
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
void mouseMoveEvent(QMouseEvent *e);
|
||||||
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
void leaveEvent(QEvent *e);
|
||||||
|
|
||||||
|
void closePressed();
|
||||||
|
|
||||||
|
void setInnerFocus() {
|
||||||
|
if (_link.isHidden()) {
|
||||||
|
setFocus();
|
||||||
|
} else {
|
||||||
|
_link.setFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void onSave();
|
||||||
|
void onChange();
|
||||||
|
void onCheck();
|
||||||
|
|
||||||
|
void onPrivacyChange();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void hideAll();
|
||||||
|
void showAll();
|
||||||
|
void showDone();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||||
|
bool animStep_goodFade(float64 ms);
|
||||||
|
|
||||||
|
void onUpdateDone(const MTPBool &result);
|
||||||
|
bool onUpdateFail(const RPCError &error);
|
||||||
|
|
||||||
|
void onCheckDone(const MTPBool &result);
|
||||||
|
bool onCheckFail(const RPCError &error);
|
||||||
|
bool onFirstCheckFail(const RPCError &error);
|
||||||
|
|
||||||
|
ChannelData *_channel;
|
||||||
|
bool _existing;
|
||||||
|
|
||||||
|
Radiobutton _public, _private;
|
||||||
|
Checkbox _comments;
|
||||||
|
int32 _aboutPublicWidth, _aboutPublicHeight;
|
||||||
|
Text _aboutPublic, _aboutPrivate, _aboutComments;
|
||||||
|
UsernameInput _link;
|
||||||
|
QRect _invitationLink;
|
||||||
|
bool _linkOver;
|
||||||
|
BoxButton _save, _skip;
|
||||||
|
|
||||||
|
bool _tooMuchUsernames;
|
||||||
|
|
||||||
|
mtpRequestId _saveRequestId, _checkRequestId;
|
||||||
|
QString _sentUsername, _checkUsername, _errorText, _goodText;
|
||||||
|
|
||||||
|
QString _goodTextLink;
|
||||||
|
anim::fvalue a_goodOpacity;
|
||||||
|
Animation _a_goodFade;
|
||||||
|
|
||||||
|
QTimer _checkTimer;
|
||||||
|
};
|
||||||
|
|
||||||
class EditNameTitleBox : public AbstractBox, public RPCSender {
|
class EditNameTitleBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
BackgroundInner::BackgroundInner() :
|
BackgroundInner::BackgroundInner() :
|
||||||
_bgCount(0), _rows(0), _over(-1), _overDown(-1) {
|
_bgCount(0), _rows(0), _over(-1), _overDown(-1) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
if (App::cServerBackgrounds().isEmpty()) {
|
if (App::cServerBackgrounds().isEmpty()) {
|
||||||
resize(BackgroundsInRow * (st::backgroundSize.width() + st::backgroundPadding) + st::backgroundPadding, 2 * (st::backgroundSize.height() + st::backgroundPadding) + st::backgroundPadding);
|
resize(BackgroundsInRow * (st::backgroundSize.width() + st::backgroundPadding) + st::backgroundPadding, 2 * (st::backgroundSize.height() + st::backgroundPadding) + st::backgroundPadding);
|
||||||
MTP::send(MTPaccount_GetWallPapers(), rpcDone(&BackgroundInner::gotWallpapers));
|
MTP::send(MTPaccount_GetWallPapers(), rpcDone(&BackgroundInner::gotWallpapers));
|
||||||
@ -174,39 +175,21 @@ BackgroundInner::~BackgroundInner() {
|
|||||||
void BackgroundInner::resizeEvent(QResizeEvent *e) {
|
void BackgroundInner::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundBox::BackgroundBox() : ItemListBox(st::boxScroll), _inner(),
|
BackgroundBox::BackgroundBox() : ItemListBox(st::backgroundScroll)
|
||||||
_close(this, lang(lng_cancel), st::contactsClose) {
|
, _inner() {
|
||||||
|
|
||||||
init(&_inner, _close.height(), st::boxFont->height + st::old_newGroupNamePadding.top() + st::old_newGroupNamePadding.bottom());
|
init(&_inner);
|
||||||
|
|
||||||
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
|
|
||||||
connect(&_inner, SIGNAL(backgroundChosen(int)), this, SLOT(onBackgroundChosen(int)));
|
connect(&_inner, SIGNAL(backgroundChosen(int)), this, SLOT(onBackgroundChosen(int)));
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundBox::hideAll() {
|
|
||||||
ItemListBox::hideAll();
|
|
||||||
_close.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundBox::showAll() {
|
|
||||||
ItemListBox::showAll();
|
|
||||||
_close.show();
|
|
||||||
_close.raise();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundBox::paintEvent(QPaintEvent *e) {
|
void BackgroundBox::paintEvent(QPaintEvent *e) {
|
||||||
QPainter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintGrayTitle(p, lang(lng_backgrounds_header));
|
paintTitle(p, lang(lng_backgrounds_header));
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundBox::resizeEvent(QResizeEvent *e) {
|
|
||||||
ItemListBox::resizeEvent(e);
|
|
||||||
_inner.resize(width(), _inner.height());
|
|
||||||
_close.move(0, height() - _close.height());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundBox::onBackgroundChosen(int index) {
|
void BackgroundBox::onBackgroundChosen(int index) {
|
||||||
|
@ -58,19 +58,13 @@ public:
|
|||||||
|
|
||||||
BackgroundBox();
|
BackgroundBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onBackgroundChosen(int index);
|
void onBackgroundChosen(int index);
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void hideAll();
|
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
BackgroundInner _inner;
|
BackgroundInner _inner;
|
||||||
BottomButton _close;
|
|
||||||
};
|
};
|
||||||
|
@ -38,7 +38,7 @@ ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const style
|
|||||||
_informative(false),
|
_informative(false),
|
||||||
_text(100),
|
_text(100),
|
||||||
_confirm(this, doneText.isEmpty() ? lang(lng_box_ok) : doneText, doneStyle),
|
_confirm(this, doneText.isEmpty() ? lang(lng_box_ok) : doneText, doneStyle),
|
||||||
_cancel(this, cancelText.isEmpty() ? lang(lng_box_cancel) : cancelText, cancelStyle) {
|
_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, cancelStyle) {
|
||||||
init(text);
|
init(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ void ConfirmBox::init(const QString &text) {
|
|||||||
_text.setText(st::boxTextFont, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);
|
_text.setText(st::boxTextFont, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);
|
||||||
|
|
||||||
textstyleSet(&st::boxTextStyle);
|
textstyleSet(&st::boxTextStyle);
|
||||||
_textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
|
_textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right();
|
||||||
_textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight));
|
_textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight));
|
||||||
setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + st::boxButtonPadding.top() + _confirm.height() + st::boxButtonPadding.bottom());
|
setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + st::boxButtonPadding.top() + _confirm.height() + st::boxButtonPadding.bottom());
|
||||||
textstyleRestore();
|
textstyleRestore();
|
||||||
@ -189,14 +189,14 @@ void ConfirmLinkBox::onOpenLink() {
|
|||||||
|
|
||||||
MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth),
|
MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth),
|
||||||
_close(this, lang(lng_box_ok), st::defaultBoxButton),
|
_close(this, lang(lng_box_ok), st::defaultBoxButton),
|
||||||
_text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxPadding.right()),
|
_text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()),
|
||||||
_link(link), _linkOver(false),
|
_link(link), _linkOver(false),
|
||||||
a_goodOpacity(0, 0), a_good(animFunc(this, &MaxInviteBox::goodAnimStep)) {
|
a_goodOpacity(0, 0), a_good(animFunc(this, &MaxInviteBox::goodAnimStep)) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
_textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
|
_textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right();
|
||||||
_textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight));
|
_textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight));
|
||||||
setMaxHeight(st::boxPadding.top() + _textHeight + st::boxTextFont->height + st::boxTextFont->height * 2 + st::newGroupLinkPadding.bottom() + _close.height() + st::boxButtonPadding.bottom());
|
setMaxHeight(st::boxPadding.top() + _textHeight + st::boxTextFont->height + st::boxTextFont->height * 2 + st::newGroupLinkPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom());
|
||||||
|
|
||||||
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
|
|
||||||
@ -277,5 +277,5 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
|
|||||||
|
|
||||||
void MaxInviteBox::resizeEvent(QResizeEvent *e) {
|
void MaxInviteBox::resizeEvent(QResizeEvent *e) {
|
||||||
_close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height());
|
_close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height());
|
||||||
_invitationLink = myrtlrect(st::boxPadding.left(), st::boxPadding.top() + _textHeight + st::boxTextFont->height, width() - st::boxPadding.left() - (st::boxButtonPadding.right() - (st::defaultBoxButton.width / 2)), 2 * st::boxTextFont->height);
|
_invitationLink = myrtlrect(st::boxPadding.left(), st::boxPadding.top() + _textHeight + st::boxTextFont->height, width() - st::boxPadding.left() - st::boxPadding.right(), 2 * st::boxTextFont->height);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ _httpProxyRadio(this, qsl("conn_type"), dbictHttpProxy, lang(lng_connection_http
|
|||||||
_tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)),
|
_tcpProxyRadio(this, qsl("conn_type"), dbictTcpProxy, lang(lng_connection_tcp_proxy_rb), (cConnectionType() == dbictTcpProxy)),
|
||||||
_tryIPv6(this, lang(lng_connection_try_ipv6), cTryIPv6()),
|
_tryIPv6(this, lang(lng_connection_try_ipv6), cTryIPv6()),
|
||||||
_save(this, lang(lng_connection_save), st::defaultBoxButton),
|
_save(this, lang(lng_connection_save), st::defaultBoxButton),
|
||||||
_cancel(this, lang(lng_box_cancel), st::cancelBoxButton) {
|
_cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||||
|
|
||||||
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
@ -51,8 +51,6 @@ _cancel(this, lang(lng_box_cancel), st::cancelBoxButton) {
|
|||||||
connect(&_userInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
connect(&_userInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||||
connect(&_passwordInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
connect(&_passwordInput, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||||
|
|
||||||
_passwordInput.setEchoMode(QLineEdit::Password);
|
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,9 +126,9 @@ void ConnectionBox::resizeEvent(QResizeEvent *e) {
|
|||||||
|
|
||||||
if (inputy) {
|
if (inputy) {
|
||||||
_hostInput.moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultRadiobutton.textPosition.x() - st::defaultInputField.textMargins.left(), inputy);
|
_hostInput.moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultRadiobutton.textPosition.x() - st::defaultInputField.textMargins.left(), inputy);
|
||||||
_portInput.moveToRight(st::boxButtonPadding.right() - (st::defaultBoxButton.width / 2), inputy);
|
_portInput.moveToRight(st::boxPadding.right(), inputy);
|
||||||
_userInput.moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultRadiobutton.textPosition.x() - st::defaultInputField.textMargins.left(), _hostInput.y() + _hostInput.height() + st::boxOptionListPadding.top());
|
_userInput.moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultRadiobutton.textPosition.x() - st::defaultInputField.textMargins.left(), _hostInput.y() + _hostInput.height() + st::boxOptionListPadding.top());
|
||||||
_passwordInput.moveToRight(st::boxButtonPadding.right() - (st::defaultBoxButton.width / 2), _userInput.y());
|
_passwordInput.moveToRight(st::boxPadding.right(), _userInput.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 tryipv6y = (_tcpProxyRadio.checked() ? (_userInput.y() + _userInput.height()) : (_tcpProxyRadio.y() + _tcpProxyRadio.height())) + st::boxOptionListPadding.top() + st::connectionIPv6Skip;
|
int32 tryipv6y = (_tcpProxyRadio.checked() ? (_userInput.y() + _userInput.height()) : (_tcpProxyRadio.y() + _tcpProxyRadio.height())) + st::boxOptionListPadding.top() + st::connectionIPv6Skip;
|
||||||
|
@ -48,7 +48,7 @@ private:
|
|||||||
InputField _hostInput;
|
InputField _hostInput;
|
||||||
PortInput _portInput;
|
PortInput _portInput;
|
||||||
InputField _userInput;
|
InputField _userInput;
|
||||||
MaskedInputField _passwordInput;
|
PasswordField _passwordInput;
|
||||||
Radiobutton _autoRadio, _httpProxyRadio, _tcpProxyRadio;
|
Radiobutton _autoRadio, _httpProxyRadio, _tcpProxyRadio;
|
||||||
Checkbox _tryIPv6;
|
Checkbox _tryIPv6;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,12 +22,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
#include "abstractbox.h"
|
#include "abstractbox.h"
|
||||||
|
|
||||||
enum CreatingGroupType {
|
|
||||||
CreatingGroupNone,
|
|
||||||
CreatingGroupGroup,
|
|
||||||
CreatingGroupChannel,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MembersFilter {
|
enum MembersFilter {
|
||||||
MembersFilterRecent,
|
MembersFilterRecent,
|
||||||
MembersFilterAdmins,
|
MembersFilterAdmins,
|
||||||
@ -96,6 +90,7 @@ signals:
|
|||||||
void searchByUsername();
|
void searchByUsername();
|
||||||
void chosenChanged();
|
void chosenChanged();
|
||||||
void adminAdded();
|
void adminAdded();
|
||||||
|
void addRequested();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@ -115,6 +110,9 @@ private:
|
|||||||
void addAdminDone(const MTPBool &result, mtpRequestId req);
|
void addAdminDone(const MTPBool &result, mtpRequestId req);
|
||||||
bool addAdminFail(const RPCError &error, mtpRequestId req);
|
bool addAdminFail(const RPCError &error, mtpRequestId req);
|
||||||
|
|
||||||
|
int32 _rowHeight, _newItemHeight;
|
||||||
|
bool _newItemSel;
|
||||||
|
|
||||||
ChatData *_chat;
|
ChatData *_chat;
|
||||||
ChannelData *_channel;
|
ChannelData *_channel;
|
||||||
MembersFilter _channelFilter;
|
MembersFilter _channelFilter;
|
||||||
@ -194,9 +192,10 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onFilterUpdate();
|
void onFilterUpdate();
|
||||||
|
void onFilterCancel();
|
||||||
|
void onChosenChanged();
|
||||||
void onScroll();
|
void onScroll();
|
||||||
|
|
||||||
void onAdd();
|
|
||||||
void onInvite();
|
void onInvite();
|
||||||
void onCreate();
|
void onCreate();
|
||||||
|
|
||||||
@ -214,12 +213,14 @@ private:
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
ContactsInner _inner;
|
ContactsInner _inner;
|
||||||
FlatButton _addContact;
|
InputField _filter;
|
||||||
FlatInput _filter;
|
IconedButton _filterCancel;
|
||||||
|
|
||||||
FlatButton _next, _cancel;
|
BoxButton _next, _cancel;
|
||||||
MembersFilter _membersFilter;
|
MembersFilter _membersFilter;
|
||||||
|
|
||||||
|
ScrollableBoxShadow _topShadow, *_bottomShadow;
|
||||||
|
|
||||||
void peopleReceived(const MTPcontacts_Found &result, mtpRequestId req);
|
void peopleReceived(const MTPcontacts_Found &result, mtpRequestId req);
|
||||||
bool peopleFailed(const RPCError &error, mtpRequestId req);
|
bool peopleFailed(const RPCError &error, mtpRequestId req);
|
||||||
|
|
||||||
@ -286,7 +287,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
|
|
||||||
void mustScrollTo(int ymin, int ymax);
|
void mustScrollTo(int ymin, int ymax);
|
||||||
|
void addRequested();
|
||||||
void loaded();
|
void loaded();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
@ -314,6 +315,9 @@ private:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
int32 _rowHeight, _newItemHeight;
|
||||||
|
bool _newItemSel;
|
||||||
|
|
||||||
ChannelData *_channel;
|
ChannelData *_channel;
|
||||||
MembersFilter _filter;
|
MembersFilter _filter;
|
||||||
|
|
||||||
@ -374,7 +378,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onLoaded();
|
|
||||||
void onScroll();
|
void onScroll();
|
||||||
|
|
||||||
void onAdd();
|
void onAdd();
|
||||||
@ -382,179 +385,13 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void hideAll();
|
|
||||||
void showAll();
|
|
||||||
void showDone();
|
void showDone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MembersInner _inner;
|
MembersInner _inner;
|
||||||
FlatButton _add, _done;
|
|
||||||
|
|
||||||
ContactsBox *_addBox;
|
ContactsBox *_addBox;
|
||||||
|
|
||||||
SingleTimer _loadTimer;
|
SingleTimer _loadTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NewGroupBox : public AbstractBox {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
NewGroupBox();
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void onNext();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void hideAll();
|
|
||||||
void showAll();
|
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Radiobutton _group, _channel;
|
|
||||||
int32 _aboutGroupWidth, _aboutGroupHeight;
|
|
||||||
Text _aboutGroup, _aboutChannel;
|
|
||||||
BoxButton _next, _cancel;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class GroupInfoBox : public AbstractBox, public RPCSender {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
|
|
||||||
bool animStep_photoOver(float64 ms);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_title.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void onPhoto();
|
|
||||||
void onPhotoReady(const QImage &img);
|
|
||||||
|
|
||||||
void onNext();
|
|
||||||
void onNameSubmit();
|
|
||||||
void onDescriptionResized();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void hideAll();
|
|
||||||
void showAll();
|
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
QRect photoRect() const;
|
|
||||||
|
|
||||||
void updateMaxHeight();
|
|
||||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
|
||||||
CreatingGroupType _creating;
|
|
||||||
|
|
||||||
anim::fvalue a_photoOver;
|
|
||||||
Animation _a_photoOver;
|
|
||||||
bool _photoOver;
|
|
||||||
|
|
||||||
InputField _title;
|
|
||||||
InputArea _description;
|
|
||||||
|
|
||||||
QImage _photoBig;
|
|
||||||
QPixmap _photoSmall;
|
|
||||||
BoxButton _next, _cancel;
|
|
||||||
|
|
||||||
// channel creation
|
|
||||||
int32 _creationRequestId;
|
|
||||||
ChannelData *_createdChannel;
|
|
||||||
|
|
||||||
void creationDone(const MTPUpdates &updates);
|
|
||||||
bool creationFail(const RPCError &e);
|
|
||||||
void exportDone(const MTPExportedChatInvite &result);
|
|
||||||
};
|
|
||||||
|
|
||||||
class SetupChannelBox : public AbstractBox, public RPCSender {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SetupChannelBox(ChannelData *channel, bool existing = false);
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
|
|
||||||
void closePressed();
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
if (_link.isHidden()) {
|
|
||||||
setFocus();
|
|
||||||
} else {
|
|
||||||
_link.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void onSave();
|
|
||||||
void onChange();
|
|
||||||
void onCheck();
|
|
||||||
|
|
||||||
void onPrivacyChange();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void hideAll();
|
|
||||||
void showAll();
|
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
|
||||||
bool animStep_goodFade(float64 ms);
|
|
||||||
|
|
||||||
void onUpdateDone(const MTPBool &result);
|
|
||||||
bool onUpdateFail(const RPCError &error);
|
|
||||||
|
|
||||||
void onCheckDone(const MTPBool &result);
|
|
||||||
bool onCheckFail(const RPCError &error);
|
|
||||||
bool onFirstCheckFail(const RPCError &error);
|
|
||||||
|
|
||||||
ChannelData *_channel;
|
|
||||||
bool _existing;
|
|
||||||
|
|
||||||
Radiobutton _public, _private;
|
|
||||||
Checkbox _comments;
|
|
||||||
int32 _aboutPublicWidth, _aboutPublicHeight;
|
|
||||||
Text _aboutPublic, _aboutPrivate, _aboutComments;
|
|
||||||
UsernameInput _link;
|
|
||||||
QRect _invitationLink;
|
|
||||||
bool _linkOver;
|
|
||||||
BoxButton _save, _skip;
|
|
||||||
|
|
||||||
bool _tooMuchUsernames;
|
|
||||||
|
|
||||||
mtpRequestId _saveRequestId, _checkRequestId;
|
|
||||||
QString _sentUsername, _checkUsername, _errorText, _goodText;
|
|
||||||
|
|
||||||
QString _goodTextLink;
|
|
||||||
anim::fvalue a_goodOpacity;
|
|
||||||
Animation _a_goodFade;
|
|
||||||
|
|
||||||
QTimer _checkTimer;
|
|
||||||
};
|
|
||||||
|
@ -33,7 +33,7 @@ DownloadPathBox::DownloadPathBox() :
|
|||||||
_dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp")),
|
_dir(this, qsl("dir_type"), 2, lang(lng_download_path_dir_radio), !_path.isEmpty() && _path != qsl("tmp")),
|
||||||
_pathLink(this, QString(), st::defaultBoxLinkButton),
|
_pathLink(this, QString(), st::defaultBoxLinkButton),
|
||||||
_save(this, lang(lng_connection_save), st::defaultBoxButton),
|
_save(this, lang(lng_connection_save), st::defaultBoxButton),
|
||||||
_cancel(this, lang(lng_box_cancel), st::cancelBoxButton) {
|
_cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||||
|
|
||||||
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||||
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
@ -143,6 +143,6 @@ void DownloadPathBox::onSave() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DownloadPathBox::setPathText(const QString &text) {
|
void DownloadPathBox::setPathText(const QString &text) {
|
||||||
int32 availw = st::boxWideWidth - st::boxPadding.left() - st::defaultRadiobutton.textPosition.x() - (st::boxButtonPadding.right() - (st::defaultBoxButton.width / 2));
|
int32 availw = st::boxWideWidth - st::boxPadding.left() - st::defaultRadiobutton.textPosition.x() - st::boxPadding.right();
|
||||||
_pathLink.setText(st::boxTextFont->elided(text, availw));
|
_pathLink.setText(st::boxTextFont->elided(text, availw));
|
||||||
}
|
}
|
||||||
|
@ -71,14 +71,14 @@ namespace {
|
|||||||
const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace), replacesInRow = 7;
|
const uint32 replacesCount = sizeof(replaces) / sizeof(EmojiReplace), replacesInRow = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmojiBox::EmojiBox() : _esize(EmojiSizes[EIndex + 1]), _done(this, lang(lng_about_done), st::aboutCloseButton) {
|
EmojiBox::EmojiBox() : _esize(EmojiSizes[EIndex + 1]) {
|
||||||
|
setBlueTitle(true);
|
||||||
|
|
||||||
fillBlocks();
|
fillBlocks();
|
||||||
|
|
||||||
_blockHeight = st::emojiReplaceInnerHeight;
|
_blockHeight = st::emojiReplaceInnerHeight;
|
||||||
|
|
||||||
resizeMaxHeight(_blocks[0].size() * st::emojiReplaceWidth + (st::emojiReplaceWidth - _esize), st::boxPadding.top() + st::boxFont->height + _blocks.size() * st::emojiReplaceHeight + (st::emojiReplaceHeight - _blockHeight) + _done.height());
|
resizeMaxHeight(_blocks[0].size() * st::emojiReplaceWidth + 2 * st::emojiReplacePadding, st::boxTitleHeight + st::emojiReplacePadding + _blocks.size() * st::emojiReplaceHeight + (st::emojiReplaceHeight - _blockHeight) + st::emojiReplacePadding);
|
||||||
|
|
||||||
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));
|
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
@ -113,14 +113,6 @@ void EmojiBox::fillBlocks() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmojiBox::hideAll() {
|
|
||||||
_done.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmojiBox::showAll() {
|
|
||||||
_done.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmojiBox::keyPressEvent(QKeyEvent *e) {
|
void EmojiBox::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||||
onClose();
|
onClose();
|
||||||
@ -130,14 +122,14 @@ void EmojiBox::keyPressEvent(QKeyEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmojiBox::paintEvent(QPaintEvent *e) {
|
void EmojiBox::paintEvent(QPaintEvent *e) {
|
||||||
QPainter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintGrayTitle(p, lang(lng_settings_emoji_list));
|
paintTitle(p, lang(lng_settings_emoji_list));
|
||||||
|
|
||||||
p.setFont(st::emojiTextFont->f);
|
p.setFont(st::emojiTextFont->f);
|
||||||
p.setPen(st::black->p);
|
p.setPen(st::black->p);
|
||||||
int32 top = st::boxPadding.top() + st::boxFont->height + (st::emojiReplaceHeight - _blockHeight) / 2;
|
int32 top = st::boxTitleHeight + st::emojiReplacePadding + (st::emojiReplaceHeight - _blockHeight) / 2;
|
||||||
for (Blocks::const_iterator i = _blocks.cbegin(), e = _blocks.cend(); i != e; ++i) {
|
for (Blocks::const_iterator i = _blocks.cbegin(), e = _blocks.cend(); i != e; ++i) {
|
||||||
int32 rowSize = i->size(), left = (width() - rowSize * st::emojiReplaceWidth) / 2;
|
int32 rowSize = i->size(), left = (width() - rowSize * st::emojiReplaceWidth) / 2;
|
||||||
for (BlockRow::const_iterator j = i->cbegin(), en = i->cend(); j != en; ++j) {
|
for (BlockRow::const_iterator j = i->cbegin(), en = i->cend(); j != en; ++j) {
|
||||||
@ -151,7 +143,3 @@ void EmojiBox::paintEvent(QPaintEvent *e) {
|
|||||||
top += st::emojiReplaceHeight;
|
top += st::emojiReplaceHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmojiBox::resizeEvent(QResizeEvent *e) {
|
|
||||||
_done.setGeometry(0, height() - _done.height(), width(), _done.height());
|
|
||||||
}
|
|
||||||
|
@ -30,19 +30,12 @@ public:
|
|||||||
EmojiBox();
|
EmojiBox();
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void hideAll();
|
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void fillBlocks();
|
void fillBlocks();
|
||||||
|
|
||||||
int32 _esize;
|
int32 _esize;
|
||||||
BottomButton _done;
|
|
||||||
|
|
||||||
int32 _blockHeight;
|
int32 _blockHeight;
|
||||||
struct Block {
|
struct Block {
|
||||||
|
@ -112,15 +112,15 @@ void LanguageBox::onChange() {
|
|||||||
if (_langs[i]->checked() && langId != cLang()) {
|
if (_langs[i]->checked() && langId != cLang()) {
|
||||||
LangLoaderResult result;
|
LangLoaderResult result;
|
||||||
if (langId > 0) {
|
if (langId > 0) {
|
||||||
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId] + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_box_cancel, lng_box_ok));
|
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId] + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok));
|
||||||
result = loader.found();
|
result = loader.found();
|
||||||
} else if (langId == languageTest) {
|
} else if (langId == languageTest) {
|
||||||
LangLoaderPlain loader(cLangFile(), LangLoaderRequest(lng_sure_save_language, lng_box_cancel, lng_box_ok));
|
LangLoaderPlain loader(cLangFile(), LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok));
|
||||||
result = loader.found();
|
result = loader.found();
|
||||||
}
|
}
|
||||||
QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)),
|
QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)),
|
||||||
save = result.value(lng_box_ok, langOriginal(lng_box_ok)),
|
save = result.value(lng_box_ok, langOriginal(lng_box_ok)),
|
||||||
cancel = result.value(lng_box_cancel, langOriginal(lng_box_cancel));
|
cancel = result.value(lng_cancel, langOriginal(lng_cancel));
|
||||||
ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
|
ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
|
||||||
connect(box, SIGNAL(confirmed()), this, SLOT(onSave()));
|
connect(box, SIGNAL(confirmed()), this, SLOT(onSave()));
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(onRestore()));
|
connect(box, SIGNAL(closed()), this, SLOT(onRestore()));
|
||||||
|
@ -29,14 +29,14 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
PasscodeBox::PasscodeBox(bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(false),
|
PasscodeBox::PasscodeBox(bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(false),
|
||||||
_setRequest(0), _hasRecovery(false), _skipEmailWarning(false), _aboutHeight(0),
|
_setRequest(0), _hasRecovery(false), _skipEmailWarning(false), _aboutHeight(0),
|
||||||
_about(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right()),
|
_about(st::boxWideWidth - st::boxPadding.left() - st::boxPadding.right()),
|
||||||
_saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::btnSelectDone),
|
_saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::defaultBoxButton),
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
_cancelButton(this, lang(lng_cancel), st::cancelBoxButton),
|
||||||
_oldPasscode(this, st::inpAddContact, lang(lng_passcode_enter_old)),
|
_oldPasscode(this, st::defaultInputField, lang(lng_passcode_enter_old)),
|
||||||
_newPasscode(this, st::inpAddContact, lang(cHasPasscode() ? lng_passcode_enter_new : lng_passcode_enter_first)),
|
_newPasscode(this, st::defaultInputField, lang(cHasPasscode() ? lng_passcode_enter_new : lng_passcode_enter_first)),
|
||||||
_reenterPasscode(this, st::inpAddContact, lang(lng_passcode_confirm_new)),
|
_reenterPasscode(this, st::defaultInputField, lang(lng_passcode_confirm_new)),
|
||||||
_passwordHint(this, st::inpAddContact, lang(lng_cloud_password_hint)),
|
_passwordHint(this, st::defaultInputField, lang(lng_cloud_password_hint)),
|
||||||
_recoverEmail(this, st::inpAddContact, lang(lng_cloud_password_email)),
|
_recoverEmail(this, st::defaultInputField, lang(lng_cloud_password_email)),
|
||||||
_recover(this, lang(lng_signin_recover)) {
|
_recover(this, lang(lng_signin_recover)) {
|
||||||
init();
|
init();
|
||||||
prepare();
|
prepare();
|
||||||
@ -44,14 +44,14 @@ _recover(this, lang(lng_signin_recover)) {
|
|||||||
|
|
||||||
PasscodeBox::PasscodeBox(const QByteArray &newSalt, const QByteArray &curSalt, bool hasRecovery, const QString &hint, bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(true),
|
PasscodeBox::PasscodeBox(const QByteArray &newSalt, const QByteArray &curSalt, bool hasRecovery, const QString &hint, bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(true),
|
||||||
_setRequest(0), _newSalt(newSalt), _curSalt(curSalt), _hasRecovery(hasRecovery), _skipEmailWarning(false), _hint(hint), _aboutHeight(0),
|
_setRequest(0), _newSalt(newSalt), _curSalt(curSalt), _hasRecovery(hasRecovery), _skipEmailWarning(false), _hint(hint), _aboutHeight(0),
|
||||||
_about(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right()),
|
_about(st::boxWideWidth - st::boxPadding.left() - st::boxPadding.right()),
|
||||||
_saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::btnSelectDone),
|
_saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::defaultBoxButton),
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
_cancelButton(this, lang(lng_cancel), st::cancelBoxButton),
|
||||||
_oldPasscode(this, st::inpAddContact, lang(lng_cloud_password_enter_old)),
|
_oldPasscode(this, st::defaultInputField, lang(lng_cloud_password_enter_old)),
|
||||||
_newPasscode(this, st::inpAddContact, lang(curSalt.isEmpty() ? lng_cloud_password_enter_first : lng_cloud_password_enter_new)),
|
_newPasscode(this, st::defaultInputField, lang(curSalt.isEmpty() ? lng_cloud_password_enter_first : lng_cloud_password_enter_new)),
|
||||||
_reenterPasscode(this, st::inpAddContact, lang(lng_cloud_password_confirm_new)),
|
_reenterPasscode(this, st::defaultInputField, lang(lng_cloud_password_confirm_new)),
|
||||||
_passwordHint(this, st::inpAddContact, lang(lng_cloud_password_hint)),
|
_passwordHint(this, st::defaultInputField, lang(lng_cloud_password_hint)),
|
||||||
_recoverEmail(this, st::inpAddContact, lang(lng_cloud_password_email)),
|
_recoverEmail(this, st::defaultInputField, lang(lng_cloud_password_email)),
|
||||||
_recover(this, lang(lng_signin_recover)) {
|
_recover(this, lang(lng_signin_recover)) {
|
||||||
init();
|
init();
|
||||||
prepare();
|
prepare();
|
||||||
@ -60,24 +60,24 @@ _recover(this, lang(lng_signin_recover)) {
|
|||||||
void PasscodeBox::init() {
|
void PasscodeBox::init() {
|
||||||
_about.setRichText(st::normalFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about));
|
_about.setRichText(st::normalFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about));
|
||||||
if (!_hint.isEmpty()) _hintText.setText(st::normalFont, lng_signin_hint(lt_password_hint, _hint));
|
if (!_hint.isEmpty()) _hintText.setText(st::normalFont, lng_signin_hint(lt_password_hint, _hint));
|
||||||
_aboutHeight = _about.countHeight(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right());
|
_aboutHeight = _about.countHeight(st::boxWideWidth - st::boxPadding.left() - st::boxPadding.right());
|
||||||
_oldPasscode.setEchoMode(QLineEdit::Password);
|
_oldPasscode.setEchoMode(QLineEdit::Password);
|
||||||
_newPasscode.setEchoMode(QLineEdit::Password);
|
_newPasscode.setEchoMode(QLineEdit::Password);
|
||||||
_reenterPasscode.setEchoMode(QLineEdit::Password);
|
_reenterPasscode.setEchoMode(QLineEdit::Password);
|
||||||
if (_turningOff) {
|
if (_turningOff) {
|
||||||
_oldPasscode.show();
|
_oldPasscode.show();
|
||||||
_boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove);
|
_boxTitle = lang(_cloudPwd ? lng_cloud_password_remove : lng_passcode_remove);
|
||||||
setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 1 * _oldPasscode.height() + st::usernameSkip + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::addContactPadding.bottom() + _saveButton.height());
|
setMaxHeight(st::boxTitleHeight + st::contactPadding.top() + 1 * _oldPasscode.height() + st::usernameSkip + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::contactPadding.bottom() + _saveButton.height());
|
||||||
} else {
|
} else {
|
||||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
|
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
|
||||||
if (has) {
|
if (has) {
|
||||||
_oldPasscode.show();
|
_oldPasscode.show();
|
||||||
_boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change);
|
_boxTitle = lang(_cloudPwd ? lng_cloud_password_change : lng_passcode_change);
|
||||||
setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 3 * _oldPasscode.height() + st::usernameSkip * 2 + 1 * st::addContactSkip + (_cloudPwd ? _passwordHint.height() + st::addContactSkip : 0) + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::addContactPadding.bottom() + _saveButton.height());
|
setMaxHeight(st::boxTitleHeight + st::contactPadding.top() + 3 * _oldPasscode.height() + st::usernameSkip * 2 + 1 * st::contactSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::contactPadding.bottom() + _saveButton.height());
|
||||||
} else {
|
} else {
|
||||||
_oldPasscode.hide();
|
_oldPasscode.hide();
|
||||||
_boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create);
|
_boxTitle = lang(_cloudPwd ? lng_cloud_password_create : lng_passcode_create);
|
||||||
setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 2 * _oldPasscode.height() + st::usernameSkip + 1 * st::addContactSkip + (_cloudPwd ? _passwordHint.height() + st::addContactSkip : 0) + _aboutHeight + (_cloudPwd ? st::addContactSkip + _recoverEmail.height() + st::usernameSkip : st::addContactPadding.bottom()) + _saveButton.height());
|
setMaxHeight(st::boxTitleHeight + st::contactPadding.top() + 2 * _oldPasscode.height() + st::usernameSkip + 1 * st::contactSkip + (_cloudPwd ? _passwordHint.height() + st::contactSkip : 0) + _aboutHeight + (_cloudPwd ? st::contactSkip + _recoverEmail.height() + st::usernameSkip : st::contactPadding.bottom()) + _saveButton.height());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,12 +158,12 @@ void PasscodeBox::keyPressEvent(QKeyEvent *e) {
|
|||||||
} else if (_reenterPasscode.hasFocus()) {
|
} else if (_reenterPasscode.hasFocus()) {
|
||||||
if (has && _oldPasscode.text().isEmpty()) {
|
if (has && _oldPasscode.text().isEmpty()) {
|
||||||
_oldPasscode.setFocus();
|
_oldPasscode.setFocus();
|
||||||
_oldPasscode.notaBene();
|
_oldPasscode.showError();
|
||||||
} else if (_newPasscode.text().isEmpty()) {
|
} else if (_newPasscode.text().isEmpty()) {
|
||||||
_newPasscode.setFocus();
|
_newPasscode.setFocus();
|
||||||
_newPasscode.notaBene();
|
_newPasscode.showError();
|
||||||
} else if (_reenterPasscode.text().isEmpty()) {
|
} else if (_reenterPasscode.text().isEmpty()) {
|
||||||
_reenterPasscode.notaBene();
|
_reenterPasscode.showError();
|
||||||
} else if (!_passwordHint.isHidden()) {
|
} else if (!_passwordHint.isHidden()) {
|
||||||
_passwordHint.setFocus();
|
_passwordHint.setFocus();
|
||||||
} else {
|
} else {
|
||||||
@ -187,19 +187,16 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintOldTitle(p, _boxTitle, true);
|
paintTitle(p, _boxTitle);
|
||||||
|
|
||||||
// paint shadow
|
int32 w = width() - st::boxPadding.left() - st::boxPadding.right();
|
||||||
p.fillRect(0, height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
int32 abouty = (_passwordHint.isHidden() ? (_reenterPasscode.isHidden() ? _oldPasscode : _reenterPasscode).y() + st::usernameSkip : _passwordHint.y() + st::contactSkip) + _oldPasscode.height();
|
||||||
|
|
||||||
int32 w = width() - st::addContactPadding.left() - st::addContactPadding.right();
|
|
||||||
int32 abouty = (_passwordHint.isHidden() ? (_reenterPasscode.isHidden() ? _oldPasscode : _reenterPasscode).y() + st::usernameSkip : _passwordHint.y() + st::addContactSkip) + _oldPasscode.height();
|
|
||||||
p.setPen(st::black);
|
p.setPen(st::black);
|
||||||
_about.draw(p, st::addContactPadding.left(), abouty, w);
|
_about.draw(p, st::boxPadding.left(), abouty, w);
|
||||||
|
|
||||||
if (!_hint.isEmpty() && _oldError.isEmpty()) {
|
if (!_hint.isEmpty() && _oldError.isEmpty()) {
|
||||||
p.setPen(st::black->p);
|
p.setPen(st::black->p);
|
||||||
_hintText.drawElided(p, st::addContactPadding.left(), _oldPasscode.y() + _oldPasscode.height() + ((st::usernameSkip - st::normalFont->height) / 2), w, 1, style::al_top);
|
_hintText.drawElided(p, st::boxPadding.left(), _oldPasscode.y() + _oldPasscode.height() + ((st::usernameSkip - st::normalFont->height) / 2), w, 1, style::al_top);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_oldError.isEmpty()) {
|
if (!_oldError.isEmpty()) {
|
||||||
@ -216,25 +213,22 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
|
|||||||
p.setPen(st::setErrColor->p);
|
p.setPen(st::setErrColor->p);
|
||||||
p.drawText(QRect(0, _recoverEmail.y() + _recoverEmail.height(), width(), st::usernameSkip), _emailError, style::al_center);
|
p.drawText(QRect(0, _recoverEmail.y() + _recoverEmail.height(), width(), st::usernameSkip), _emailError, style::al_center);
|
||||||
}
|
}
|
||||||
|
|
||||||
// paint button sep
|
|
||||||
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasscodeBox::resizeEvent(QResizeEvent *e) {
|
void PasscodeBox::resizeEvent(QResizeEvent *e) {
|
||||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
|
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
|
||||||
_oldPasscode.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _oldPasscode.height());
|
_oldPasscode.setGeometry(st::boxPadding.left(), st::boxTitleHeight + st::contactPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), _oldPasscode.height());
|
||||||
_newPasscode.setGeometry(st::addContactPadding.left(), _oldPasscode.y() + ((_turningOff || has) ? (_oldPasscode.height() + st::usernameSkip) : 0), _oldPasscode.width(), _oldPasscode.height());
|
_newPasscode.setGeometry(st::boxPadding.left(), _oldPasscode.y() + ((_turningOff || has) ? (_oldPasscode.height() + st::usernameSkip) : 0), _oldPasscode.width(), _oldPasscode.height());
|
||||||
_reenterPasscode.setGeometry(st::addContactPadding.left(), _newPasscode.y() + _newPasscode.height() + st::addContactSkip, _newPasscode.width(), _newPasscode.height());
|
_reenterPasscode.setGeometry(st::boxPadding.left(), _newPasscode.y() + _newPasscode.height() + st::contactSkip, _newPasscode.width(), _newPasscode.height());
|
||||||
_passwordHint.setGeometry(st::addContactPadding.left(), _reenterPasscode.y() + _reenterPasscode.height() + st::usernameSkip, _reenterPasscode.width(), _reenterPasscode.height());
|
_passwordHint.setGeometry(st::boxPadding.left(), _reenterPasscode.y() + _reenterPasscode.height() + st::usernameSkip, _reenterPasscode.width(), _reenterPasscode.height());
|
||||||
|
|
||||||
_recoverEmail.setGeometry(st::addContactPadding.left(), _passwordHint.y() + _passwordHint.height() + st::addContactSkip + _aboutHeight + st::addContactSkip, _passwordHint.width(), _passwordHint.height());
|
_recoverEmail.setGeometry(st::boxPadding.left(), _passwordHint.y() + _passwordHint.height() + st::contactSkip + _aboutHeight + st::contactSkip, _passwordHint.width(), _passwordHint.height());
|
||||||
|
|
||||||
if (!_recover.isHidden()) {
|
if (!_recover.isHidden()) {
|
||||||
if (_turningOff) {
|
if (_turningOff) {
|
||||||
_recover.move((width() - _recover.width()) / 2, _oldPasscode.y() + _oldPasscode.height() + st::usernameSkip + _aboutHeight + ((st::usernameSkip - _recover.height()) / 2));
|
_recover.move((width() - _recover.width()) / 2, _oldPasscode.y() + _oldPasscode.height() + st::usernameSkip + _aboutHeight + ((st::usernameSkip - _recover.height()) / 2));
|
||||||
} else {
|
} else {
|
||||||
_recover.move((width() - _recover.width()) / 2, _passwordHint.y() + _passwordHint.height() + st::addContactSkip + _aboutHeight + ((st::usernameSkip - _recover.height()) / 2));
|
_recover.move((width() - _recover.width()) / 2, _passwordHint.y() + _passwordHint.height() + st::contactSkip + _aboutHeight + ((st::usernameSkip - _recover.height()) / 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +268,7 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||||||
}
|
}
|
||||||
} else if (err == "NEW_PASSWORD_BAD") {
|
} else if (err == "NEW_PASSWORD_BAD") {
|
||||||
_newPasscode.setFocus();
|
_newPasscode.setFocus();
|
||||||
_newPasscode.notaBene();
|
_newPasscode.showError();
|
||||||
_newError = lang(lng_cloud_password_bad);
|
_newError = lang(lng_cloud_password_bad);
|
||||||
update();
|
update();
|
||||||
} else if (err == "NEW_SALT_INVALID") {
|
} else if (err == "NEW_SALT_INVALID") {
|
||||||
@ -283,7 +277,7 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||||||
} else if (err == "EMAIL_INVALID") {
|
} else if (err == "EMAIL_INVALID") {
|
||||||
_emailError = lang(lng_cloud_password_bad_email);
|
_emailError = lang(lng_cloud_password_bad_email);
|
||||||
_recoverEmail.setFocus();
|
_recoverEmail.setFocus();
|
||||||
_recoverEmail.notaBene();
|
_recoverEmail.showError();
|
||||||
update();
|
update();
|
||||||
} else if (err == "EMAIL_UNCONFIRMED") {
|
} else if (err == "EMAIL_UNCONFIRMED") {
|
||||||
App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_almost)));
|
App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_almost)));
|
||||||
@ -293,7 +287,7 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||||||
|
|
||||||
_oldPasscode.selectAll();
|
_oldPasscode.selectAll();
|
||||||
_oldPasscode.setFocus();
|
_oldPasscode.setFocus();
|
||||||
_oldPasscode.notaBene();
|
_oldPasscode.showError();
|
||||||
_oldError = lang(lng_flood_error);
|
_oldError = lang(lng_flood_error);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -308,7 +302,7 @@ void PasscodeBox::onSave(bool force) {
|
|||||||
if (!passcodeCanTry()) {
|
if (!passcodeCanTry()) {
|
||||||
_oldError = lang(lng_flood_error);
|
_oldError = lang(lng_flood_error);
|
||||||
_oldPasscode.setFocus();
|
_oldPasscode.setFocus();
|
||||||
_oldPasscode.notaBene();
|
_oldPasscode.showError();
|
||||||
update();
|
update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -325,13 +319,13 @@ void PasscodeBox::onSave(bool force) {
|
|||||||
}
|
}
|
||||||
if (!_turningOff && pwd.isEmpty()) {
|
if (!_turningOff && pwd.isEmpty()) {
|
||||||
_newPasscode.setFocus();
|
_newPasscode.setFocus();
|
||||||
_newPasscode.notaBene();
|
_newPasscode.showError();
|
||||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pwd != conf) {
|
if (pwd != conf) {
|
||||||
_reenterPasscode.setFocus();
|
_reenterPasscode.setFocus();
|
||||||
_reenterPasscode.notaBene();
|
_reenterPasscode.showError();
|
||||||
if (!conf.isEmpty()) {
|
if (!conf.isEmpty()) {
|
||||||
_newError = lang(_cloudPwd ? lng_cloud_password_differ : lng_passcode_differ);
|
_newError = lang(_cloudPwd ? lng_cloud_password_differ : lng_passcode_differ);
|
||||||
update();
|
update();
|
||||||
@ -339,15 +333,15 @@ void PasscodeBox::onSave(bool force) {
|
|||||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||||
} else if (!_turningOff && has && old == pwd) {
|
} else if (!_turningOff && has && old == pwd) {
|
||||||
_newPasscode.setFocus();
|
_newPasscode.setFocus();
|
||||||
_newPasscode.notaBene();
|
_newPasscode.showError();
|
||||||
_newError = lang(_cloudPwd ? lng_cloud_password_is_same : lng_passcode_is_same);
|
_newError = lang(_cloudPwd ? lng_cloud_password_is_same : lng_passcode_is_same);
|
||||||
update();
|
update();
|
||||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||||
} else if (_cloudPwd) {
|
} else if (_cloudPwd) {
|
||||||
QString hint = _passwordHint.text(), email = _recoverEmail.text().trimmed();
|
QString hint = _passwordHint.getLastText(), email = _recoverEmail.getLastText().trimmed();
|
||||||
if (_cloudPwd && pwd == hint && !_passwordHint.isHidden() && !_newPasscode.isHidden()) {
|
if (_cloudPwd && pwd == hint && !_passwordHint.isHidden() && !_newPasscode.isHidden()) {
|
||||||
_newPasscode.setFocus();
|
_newPasscode.setFocus();
|
||||||
_newPasscode.notaBene();
|
_newPasscode.showError();
|
||||||
_newError = lang(lng_cloud_password_bad);
|
_newError = lang(lng_cloud_password_bad);
|
||||||
update();
|
update();
|
||||||
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
if (isHidden() && _replacedBy && !_replacedBy->isHidden()) _replacedBy->onClose();
|
||||||
@ -392,7 +386,7 @@ void PasscodeBox::onSave(bool force) {
|
|||||||
void PasscodeBox::onBadOldPasscode() {
|
void PasscodeBox::onBadOldPasscode() {
|
||||||
_oldPasscode.selectAll();
|
_oldPasscode.selectAll();
|
||||||
_oldPasscode.setFocus();
|
_oldPasscode.setFocus();
|
||||||
_oldPasscode.notaBene();
|
_oldPasscode.showError();
|
||||||
_oldError = lang(_cloudPwd ? lng_cloud_password_wrong : lng_passcode_wrong);
|
_oldError = lang(_cloudPwd ? lng_cloud_password_wrong : lng_passcode_wrong);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -465,11 +459,11 @@ bool PasscodeBox::recoverStartFail(const RPCError &error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RecoverBox::RecoverBox(const QString &pattern) :
|
RecoverBox::RecoverBox(const QString &pattern) :
|
||||||
_submitRequest(0), _pattern(st::normalFont->elided(lng_signin_recover_hint(lt_recover_email, pattern), st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right())),
|
_submitRequest(0), _pattern(st::normalFont->elided(lng_signin_recover_hint(lt_recover_email, pattern), st::boxWideWidth - st::boxPadding.left() - st::boxPadding.right())),
|
||||||
_saveButton(this, lang(lng_passcode_submit), st::btnSelectDone),
|
_saveButton(this, lang(lng_passcode_submit), st::defaultBoxButton),
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
_cancelButton(this, lang(lng_cancel), st::cancelBoxButton),
|
||||||
_recoverCode(this, st::inpAddContact, lang(lng_signin_code)) {
|
_recoverCode(this, st::defaultInputField, lang(lng_signin_code)) {
|
||||||
setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + st::usernameSkip + _recoverCode.height() + st::usernameSkip + st::addContactPadding.bottom() + _saveButton.height());
|
setMaxHeight(st::boxTitleHeight + st::contactPadding.top() + st::usernameSkip + _recoverCode.height() + st::usernameSkip + st::contactPadding.bottom() + _saveButton.height());
|
||||||
|
|
||||||
connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit()));
|
connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSubmit()));
|
||||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
@ -493,9 +487,9 @@ void RecoverBox::showAll() {
|
|||||||
|
|
||||||
void RecoverBox::keyPressEvent(QKeyEvent *e) {
|
void RecoverBox::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||||
if (_recoverCode.text().isEmpty()) {
|
if (_recoverCode.getLastText().isEmpty()) {
|
||||||
_recoverCode.setFocus();
|
_recoverCode.setFocus();
|
||||||
_recoverCode.notaBene();
|
_recoverCode.showError();
|
||||||
} else {
|
} else {
|
||||||
onSubmit();
|
onSubmit();
|
||||||
}
|
}
|
||||||
@ -508,26 +502,20 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintOldTitle(p, lang(lng_signin_recover), true);
|
paintTitle(p, lang(lng_signin_recover));
|
||||||
|
|
||||||
// paint shadow
|
|
||||||
p.fillRect(0, height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
|
||||||
|
|
||||||
p.setFont(st::normalFont->f);
|
p.setFont(st::normalFont->f);
|
||||||
int32 w = width() - st::addContactPadding.left() - st::addContactPadding.right();
|
int32 w = width() - st::boxPadding.left() - st::boxPadding.right();
|
||||||
p.drawText(QRect(st::addContactPadding.left(), _recoverCode.y() - st::usernameSkip - st::addContactPadding.top(), w, st::addContactPadding.top() + st::usernameSkip), _pattern, style::al_center);
|
p.drawText(QRect(st::boxPadding.left(), _recoverCode.y() - st::usernameSkip - st::contactPadding.top(), w, st::contactPadding.top() + st::usernameSkip), _pattern, style::al_center);
|
||||||
|
|
||||||
if (!_error.isEmpty()) {
|
if (!_error.isEmpty()) {
|
||||||
p.setPen(st::setErrColor->p);
|
p.setPen(st::setErrColor->p);
|
||||||
p.drawText(QRect(0, _recoverCode.y() + _recoverCode.height(), width(), st::usernameSkip), _error, style::al_center);
|
p.drawText(QRect(0, _recoverCode.y() + _recoverCode.height(), width(), st::usernameSkip), _error, style::al_center);
|
||||||
}
|
}
|
||||||
|
|
||||||
// paint button sep
|
|
||||||
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecoverBox::resizeEvent(QResizeEvent *e) {
|
void RecoverBox::resizeEvent(QResizeEvent *e) {
|
||||||
_recoverCode.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top() + st::usernameSkip, width() - st::addContactPadding.left() - st::addContactPadding.right(), _recoverCode.height());
|
_recoverCode.setGeometry(st::boxPadding.left(), st::boxTitleHeight + st::contactPadding.top() + st::usernameSkip, width() - st::boxPadding.left() - st::boxPadding.right(), _recoverCode.height());
|
||||||
|
|
||||||
int32 buttonTop = height() - _cancelButton.height();
|
int32 buttonTop = height() - _cancelButton.height();
|
||||||
_cancelButton.move(0, buttonTop);
|
_cancelButton.move(0, buttonTop);
|
||||||
@ -541,9 +529,9 @@ void RecoverBox::showDone() {
|
|||||||
void RecoverBox::onSubmit() {
|
void RecoverBox::onSubmit() {
|
||||||
if (_submitRequest) return;
|
if (_submitRequest) return;
|
||||||
|
|
||||||
QString code = _recoverCode.text().trimmed();
|
QString code = _recoverCode.getLastText().trimmed();
|
||||||
if (code.isEmpty()) {
|
if (code.isEmpty()) {
|
||||||
_recoverCode.notaBene();
|
_recoverCode.showError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,12 +568,12 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
|
|||||||
} else if (err == "CODE_INVALID") {
|
} else if (err == "CODE_INVALID") {
|
||||||
_error = lang(lng_signin_wrong_code);
|
_error = lang(lng_signin_wrong_code);
|
||||||
update();
|
update();
|
||||||
_recoverCode.notaBene();
|
_recoverCode.showError();
|
||||||
return true;
|
return true;
|
||||||
} else if (mtpIsFlood(error)) {
|
} else if (mtpIsFlood(error)) {
|
||||||
_error = lang(lng_flood_error);
|
_error = lang(lng_flood_error);
|
||||||
update();
|
update();
|
||||||
_recoverCode.notaBene();
|
_recoverCode.showError();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cDebug()) { // internal server error
|
if (cDebug()) { // internal server error
|
||||||
|
@ -80,8 +80,9 @@ private:
|
|||||||
QString _boxTitle;
|
QString _boxTitle;
|
||||||
Text _about, _hintText;
|
Text _about, _hintText;
|
||||||
|
|
||||||
FlatButton _saveButton, _cancelButton;
|
BoxButton _saveButton, _cancelButton;
|
||||||
FlatInput _oldPasscode, _newPasscode, _reenterPasscode, _passwordHint, _recoverEmail;
|
PasswordField _oldPasscode, _newPasscode, _reenterPasscode;
|
||||||
|
InputField _passwordHint, _recoverEmail;
|
||||||
LinkButton _recover;
|
LinkButton _recover;
|
||||||
|
|
||||||
QString _oldError, _newError, _emailError;
|
QString _oldError, _newError, _emailError;
|
||||||
@ -122,8 +123,8 @@ private:
|
|||||||
|
|
||||||
QString _pattern;
|
QString _pattern;
|
||||||
|
|
||||||
FlatButton _saveButton, _cancelButton;
|
BoxButton _saveButton, _cancelButton;
|
||||||
FlatInput _recoverCode;
|
InputField _recoverCode;
|
||||||
|
|
||||||
QString _error;
|
QString _error;
|
||||||
};
|
};
|
||||||
|
@ -27,11 +27,12 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
#include "photocropbox.h"
|
#include "photocropbox.h"
|
||||||
#include "fileuploader.h"
|
#include "fileuploader.h"
|
||||||
|
|
||||||
PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) : _downState(0),
|
PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) : AbstractBox()
|
||||||
_sendButton(this, lang(lng_settings_save), st::btnSelectDone),
|
, _downState(0)
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
, _done(this, lang(lng_settings_save), st::defaultBoxButton)
|
||||||
_img(img), _peerId(peer) {
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||||
|
, _img(img)
|
||||||
|
, _peerId(peer) {
|
||||||
if (peerIsChannel(_peerId)) {
|
if (peerIsChannel(_peerId)) {
|
||||||
_title = lang(lng_create_channel_crop);
|
_title = lang(lng_create_channel_crop);
|
||||||
} else if (peerIsChat(_peerId)) {
|
} else if (peerIsChat(_peerId)) {
|
||||||
@ -40,13 +41,13 @@ PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) :
|
|||||||
_title = lang(lng_settings_crop_profile);
|
_title = lang(lng_settings_crop_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend()));
|
connect(&_done, SIGNAL(clicked()), this, SLOT(onSend()));
|
||||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
if (_peerId && upload) {
|
if (_peerId && upload) {
|
||||||
connect(this, SIGNAL(ready(const QImage&)), this, SLOT(onReady(const QImage&)));
|
connect(this, SIGNAL(ready(const QImage&)), this, SLOT(onReady(const QImage&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 s = st::boxWideWidth - st::boxPadding.left() - st::boxPadding.right();
|
int32 s = st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||||
_thumb = QPixmap::fromImage(img.scaled(s, s, Qt::KeepAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
_thumb = QPixmap::fromImage(img.scaled(s, s, Qt::KeepAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
||||||
_thumbw = _thumb.width();
|
_thumbw = _thumb.width();
|
||||||
_thumbh = _thumb.height();
|
_thumbh = _thumb.height();
|
||||||
@ -59,10 +60,10 @@ PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) :
|
|||||||
_cropy = (_thumbh - _cropw) / 2;
|
_cropy = (_thumbh - _cropw) / 2;
|
||||||
|
|
||||||
_thumbx = (st::boxWideWidth - _thumbw) / 2;
|
_thumbx = (st::boxWideWidth - _thumbw) / 2;
|
||||||
_thumby = st::boxPadding.top() * 2 + st::boxFont->height;
|
_thumby = st::boxPhotoPadding.top();
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
resizeMaxHeight(st::boxWideWidth, _thumbh + st::boxPadding.top() + st::boxFont->height + st::boxPadding.top() + st::boxPadding.bottom() + _sendButton.height());
|
resizeMaxHeight(st::boxWideWidth, st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxTextFont->height + st::cropSkip + st::boxButtonPadding.top() + _done.height() + st::boxButtonPadding.bottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
|
void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
|
||||||
@ -211,16 +212,12 @@ void PhotoCropBox::keyPressEvent(QKeyEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::paintEvent(QPaintEvent *e) {
|
void PhotoCropBox::paintEvent(QPaintEvent *e) {
|
||||||
QPainter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
// paint shadow
|
p.setFont(st::boxTextFont);
|
||||||
p.fillRect(0, height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
p.setPen(st::boxPhotoTextFg);
|
||||||
|
p.drawText(QRect(st::boxPhotoPadding.left(), st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom(), width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(), st::boxTextFont->height), _title, style::al_top);
|
||||||
// paint button sep
|
|
||||||
p.fillRect(st::btnSelectCancel.width, height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
|
||||||
|
|
||||||
paintGrayTitle(p, _title);
|
|
||||||
|
|
||||||
p.translate(_thumbx, _thumby);
|
p.translate(_thumbx, _thumby);
|
||||||
p.drawPixmap(0, 0, _thumb);
|
p.drawPixmap(0, 0, _thumb);
|
||||||
@ -246,8 +243,8 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::resizeEvent(QResizeEvent *e) {
|
void PhotoCropBox::resizeEvent(QResizeEvent *e) {
|
||||||
_sendButton.move(width() - _sendButton.width(), height() - _sendButton.height());
|
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height());
|
||||||
_cancelButton.move(0, height() - _cancelButton.height());
|
_cancel.moveToRight(st::boxButtonPadding.right() + _done.width() + st::boxButtonPadding.left(), _done.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::onSend() {
|
void PhotoCropBox::onSend() {
|
||||||
@ -288,11 +285,11 @@ void PhotoCropBox::onReady(const QImage &tosend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::hideAll() {
|
void PhotoCropBox::hideAll() {
|
||||||
_sendButton.hide();
|
_done.hide();
|
||||||
_cancelButton.hide();
|
_cancel.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::showAll() {
|
void PhotoCropBox::showAll() {
|
||||||
_sendButton.show();
|
_done.show();
|
||||||
_cancelButton.show();
|
_cancel.show();
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||||
int32 _cropx, _cropy, _cropw;
|
int32 _cropx, _cropy, _cropw;
|
||||||
int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
|
int32 _fromposx, _fromposy, _fromcropx, _fromcropy, _fromcropw;
|
||||||
FlatButton _sendButton, _cancelButton;
|
BoxButton _done, _cancel;
|
||||||
QImage _img;
|
QImage _img;
|
||||||
QPixmap _thumb;
|
QPixmap _thumb;
|
||||||
PeerId _peerId;
|
PeerId _peerId;
|
||||||
|
@ -27,14 +27,21 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "photosendbox.h"
|
#include "photosendbox.h"
|
||||||
|
|
||||||
PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : _img(new ReadyLocalMedia(img)),
|
PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : AbstractBox(st::boxWideWidth)
|
||||||
_thumbx(0), _thumby(0), _thumbw(0), _thumbh(0), _namew(0), _textw(0),
|
, _img(new ReadyLocalMedia(img))
|
||||||
_compressed(this, lang(lng_send_image_compressed), cCompressPastedImage()),
|
, _thumbx(0)
|
||||||
_sendButton(this, lang(lng_send_button), st::btnSelectDone),
|
, _thumby(0)
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
, _thumbw(0)
|
||||||
_replyTo(img.replyTo) {
|
, _thumbh(0)
|
||||||
connect(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend()));
|
, _namew(0)
|
||||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
, _textw(0)
|
||||||
|
, _caption(this, st::confirmCaptionArea, lang(lng_photo_caption))
|
||||||
|
, _compressed(this, lang(lng_send_image_compressed), cCompressPastedImage())
|
||||||
|
, _send(this, lang(lng_send_button), st::defaultBoxButton)
|
||||||
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||||
|
, _replyTo(img.replyTo) {
|
||||||
|
connect(&_send, SIGNAL(clicked()), this, SLOT(onSend()));
|
||||||
|
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
|
|
||||||
if (_img->type == ToPreparePhoto) {
|
if (_img->type == ToPreparePhoto) {
|
||||||
int32 maxW = 0, maxH = 0;
|
int32 maxW = 0, maxH = 0;
|
||||||
@ -49,7 +56,7 @@ PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : _img(new ReadyLocalMedi
|
|||||||
if (!tw || !th) {
|
if (!tw || !th) {
|
||||||
tw = th = 1;
|
tw = th = 1;
|
||||||
}
|
}
|
||||||
_thumbw = width() - st::boxPadding.left() - st::boxPadding.right();
|
_thumbw = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
|
||||||
if (_thumb.width() < _thumbw) {
|
if (_thumb.width() < _thumbw) {
|
||||||
_thumbw = (_thumb.width() > 20) ? _thumb.width() : 20;
|
_thumbw = (_thumb.width() > 20) ? _thumb.width() : 20;
|
||||||
}
|
}
|
||||||
@ -62,7 +69,7 @@ PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : _img(new ReadyLocalMedi
|
|||||||
_thumbw = 10;
|
_thumbw = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resizeMaxHeight(st::boxWideWidth, _thumbh + st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::boxPadding.bottom() + _compressed.height() + _sendButton.height());
|
_thumbx = (width() - _thumbw) / 2;
|
||||||
|
|
||||||
_thumb = QPixmap::fromImage(_thumb.toImage().scaled(_thumbw * cIntRetinaFactor(), _thumbh * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
_thumb = QPixmap::fromImage(_thumb.toImage().scaled(_thumbw * cIntRetinaFactor(), _thumbh * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly);
|
||||||
_thumb.setDevicePixelRatio(cRetinaFactor());
|
_thumb.setDevicePixelRatio(cRetinaFactor());
|
||||||
@ -87,24 +94,37 @@ PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : _img(new ReadyLocalMedi
|
|||||||
_thumb = QPixmap::fromImage(_thumb.toImage().scaledToWidth(_thumbw * cIntRetinaFactor(), Qt::SmoothTransformation), Qt::ColorOnly);
|
_thumb = QPixmap::fromImage(_thumb.toImage().scaledToWidth(_thumbw * cIntRetinaFactor(), Qt::SmoothTransformation), Qt::ColorOnly);
|
||||||
_thumb.setDevicePixelRatio(cRetinaFactor());
|
_thumb.setDevicePixelRatio(cRetinaFactor());
|
||||||
}
|
}
|
||||||
resizeMaxHeight(st::boxWideWidth, st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom() + st::boxPadding.bottom() + _sendButton.height());
|
|
||||||
|
|
||||||
_name = _img->filename;
|
_name = _img->filename;
|
||||||
_namew = st::mediaFont->width(_name);
|
_namew = st::mediaFont->width(_name);
|
||||||
_size = formatSizeText(_img->filesize);
|
_size = formatSizeText(_img->filesize);
|
||||||
_textw = qMax(_namew, st::mediaFont->width(_size));
|
_textw = qMax(_namew, st::mediaFont->width(_size));
|
||||||
}
|
}
|
||||||
|
updateBoxSize();
|
||||||
|
_caption.setMaxLength(MaxPhotoCaption);
|
||||||
|
_caption.setCtrlEnterSubmit(false);
|
||||||
|
connect(&_compressed, SIGNAL(changed()), this, SLOT(onCompressedChange()));
|
||||||
|
connect(&_caption, SIGNAL(resized()), this, SLOT(onCaptionResized()));
|
||||||
|
connect(&_caption, SIGNAL(submitted(bool)), this, SLOT(onSend(bool)));
|
||||||
|
connect(&_caption, SIGNAL(cancelled()), this, SLOT(onClose()));
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
PhotoSendBox::PhotoSendBox(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo) : _img(0),
|
PhotoSendBox::PhotoSendBox(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo) : AbstractBox(st::boxWideWidth)
|
||||||
_thumbx(0), _thumby(0), _thumbw(0), _thumbh(0), _namew(0), _textw(0),
|
, _img(0)
|
||||||
_compressed(this, lang(lng_send_image_compressed), true),
|
, _thumbx(0)
|
||||||
_sendButton(this, lang(lng_send_button), st::btnSelectDone),
|
, _thumby(0)
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
, _thumbw(0)
|
||||||
_phone(phone), _fname(fname), _lname(lname), _replyTo(replyTo) {
|
, _thumbh(0)
|
||||||
connect(&_sendButton, SIGNAL(clicked()), this, SLOT(onSend()));
|
, _namew(0)
|
||||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
|
, _textw(0)
|
||||||
|
, _caption(this, st::confirmCaptionArea, lang(lng_photo_caption))
|
||||||
|
, _compressed(this, lang(lng_send_image_compressed), true)
|
||||||
|
, _send(this, lang(lng_send_button), st::defaultBoxButton)
|
||||||
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||||
|
, _phone(phone), _fname(fname), _lname(lname), _replyTo(replyTo) {
|
||||||
|
connect(&_send, SIGNAL(clicked()), this, SLOT(onSend()));
|
||||||
|
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
|
|
||||||
_compressed.hide();
|
_compressed.hide();
|
||||||
|
|
||||||
@ -113,10 +133,35 @@ _phone(phone), _fname(fname), _lname(lname), _replyTo(replyTo) {
|
|||||||
_size = _phone;
|
_size = _phone;
|
||||||
_textw = qMax(_namew, st::mediaFont->width(_size));
|
_textw = qMax(_namew, st::mediaFont->width(_size));
|
||||||
|
|
||||||
resizeMaxHeight(st::boxWideWidth, st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom() + st::boxPadding.bottom() + _sendButton.height());
|
updateBoxSize();
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhotoSendBox::onCompressedChange() {
|
||||||
|
showAll();
|
||||||
|
if (_caption.isHidden()) {
|
||||||
|
setFocus();
|
||||||
|
} else {
|
||||||
|
_caption.setFocus();
|
||||||
|
}
|
||||||
|
updateBoxSize();
|
||||||
|
resizeEvent(0);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoSendBox::onCaptionResized() {
|
||||||
|
updateBoxSize();
|
||||||
|
resizeEvent(0);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhotoSendBox::updateBoxSize() {
|
||||||
|
if (_img && _img->type == ToPreparePhoto) {
|
||||||
|
setMaxHeight(st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxPhotoCompressedPadding.top() + _compressed.height() + (_compressed.checked() ? (st::boxPhotoCompressedPadding.bottom() + _caption.height()) : 0) + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
||||||
|
} else {
|
||||||
|
setMaxHeight(st::boxPhotoPadding.top() + st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom() + st::boxPhotoPadding.bottom() + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PhotoSendBox::keyPressEvent(QKeyEvent *e) {
|
void PhotoSendBox::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||||
@ -130,26 +175,23 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
// paint shadow
|
|
||||||
p.fillRect(0, height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
|
||||||
|
|
||||||
// paint button sep
|
|
||||||
p.fillRect(st::btnSelectCancel.width, height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
|
||||||
|
|
||||||
if (_img && _img->type == ToPreparePhoto) {
|
if (_img && _img->type == ToPreparePhoto) {
|
||||||
paintGrayTitle(p, lang(lng_really_send_image));
|
if (_thumbx > st::boxPhotoPadding.left()) {
|
||||||
p.drawPixmap((width() - _thumbw) / 2, st::boxPadding.top() * 2 + st::boxFont->height, _thumb);
|
p.fillRect(st::boxPhotoPadding.left(), st::boxPhotoPadding.top(), _thumbx - st::boxPhotoPadding.left(), _thumbh, st::confirmBg->b);
|
||||||
|
}
|
||||||
|
if (_thumbx + _thumbw < width() - st::boxPhotoPadding.right()) {
|
||||||
|
p.fillRect(_thumbx + _thumbw, st::boxPhotoPadding.top(), width() - st::boxPhotoPadding.right() - _thumbx - _thumbw, _thumbh, st::confirmBg->b);
|
||||||
|
}
|
||||||
|
p.drawPixmap(_thumbx, st::boxPhotoPadding.top(), _thumb);
|
||||||
} else {
|
} else {
|
||||||
paintGrayTitle(p, lang(_img ? lng_really_send_file : lng_really_share_contact));
|
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(), h = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom();
|
||||||
|
|
||||||
int32 w = width() - st::boxPadding.left() - st::boxPadding.right(), h = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom();
|
|
||||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||||
int32 twidth = w - tleft - st::mediaPadding.right();
|
int32 twidth = w - tleft - st::mediaPadding.right();
|
||||||
if (twidth > _textw) {
|
if (twidth > _textw) {
|
||||||
w -= (twidth - _textw);
|
w -= (twidth - _textw);
|
||||||
twidth = _textw;
|
twidth = _textw;
|
||||||
}
|
}
|
||||||
int32 x = (width() - w) / 2, y = st::boxPadding.top() * 2 + st::boxFont->height;
|
int32 x = (width() - w) / 2, y = st::boxPhotoPadding.top();
|
||||||
|
|
||||||
App::roundRect(p, x, y, w, h, st::msgOutBg, MessageOutCorners, &st::msgOutShadow);
|
App::roundRect(p, x, y, w, h, st::msgOutBg, MessageOutCorners, &st::msgOutShadow);
|
||||||
if (_thumbw) {
|
if (_thumbw) {
|
||||||
@ -175,9 +217,11 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::resizeEvent(QResizeEvent *e) {
|
void PhotoSendBox::resizeEvent(QResizeEvent *e) {
|
||||||
_sendButton.move(width() - _sendButton.width(), height() - _sendButton.height());
|
_send.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _send.height());
|
||||||
_cancelButton.move(0, height() - _cancelButton.height());
|
_cancel.moveToRight(st::boxButtonPadding.right() + _send.width() + st::boxButtonPadding.left(), _send.y());
|
||||||
_compressed.move((width() - _compressed.width()) / 2, height() - _cancelButton.height() - _compressed.height() - st::confirmCompressedSkip);
|
_caption.resize(st::boxWideWidth - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(), _caption.height());
|
||||||
|
_caption.moveToLeft(st::boxPhotoPadding.left(), _send.y() - st::boxButtonPadding.top() - _caption.height());
|
||||||
|
_compressed.moveToLeft(st::boxPhotoPadding.left(), st::boxPhotoPadding.top() + _thumbh + st::boxPhotoPadding.bottom() + st::boxPhotoCompressedPadding.top());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::closePressed() {
|
void PhotoSendBox::closePressed() {
|
||||||
@ -185,21 +229,32 @@ void PhotoSendBox::closePressed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::hideAll() {
|
void PhotoSendBox::hideAll() {
|
||||||
_sendButton.hide();
|
_send.hide();
|
||||||
_cancelButton.hide();
|
_cancel.hide();
|
||||||
|
_caption.hide();
|
||||||
_compressed.hide();
|
_compressed.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::showAll() {
|
void PhotoSendBox::showAll() {
|
||||||
_sendButton.show();
|
_send.show();
|
||||||
_cancelButton.show();
|
_cancel.show();
|
||||||
if (_img && _img->type == ToPreparePhoto) {
|
if (_img && _img->type == ToPreparePhoto) {
|
||||||
_compressed.show();
|
_compressed.show();
|
||||||
|
if (_compressed.checked()) {
|
||||||
|
_caption.show();
|
||||||
} else {
|
} else {
|
||||||
|
_caption.hide();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_caption.hide();
|
||||||
_compressed.hide();
|
_compressed.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PhotoSendBox::showDone() {
|
||||||
|
setInnerFocus();
|
||||||
|
}
|
||||||
|
|
||||||
void PhotoSendBox::onSend(bool ctrlShiftEnter) {
|
void PhotoSendBox::onSend(bool ctrlShiftEnter) {
|
||||||
if (!_img) {
|
if (!_img) {
|
||||||
if (App::main()) App::main()->confirmShareContact(ctrlShiftEnter, _phone, _fname, _lname, _replyTo);
|
if (App::main()) App::main()->confirmShareContact(ctrlShiftEnter, _phone, _fname, _lname, _replyTo);
|
||||||
@ -212,6 +267,7 @@ void PhotoSendBox::onSend(bool ctrlShiftEnter) {
|
|||||||
}
|
}
|
||||||
if (_compressed.isHidden() || _compressed.checked()) {
|
if (_compressed.isHidden() || _compressed.checked()) {
|
||||||
_img->ctrlShiftEnter = ctrlShiftEnter;
|
_img->ctrlShiftEnter = ctrlShiftEnter;
|
||||||
|
_img->caption = _caption.isHidden() ? QString() : _caption.getLastText();
|
||||||
if (App::main()) App::main()->confirmSendImage(*_img);
|
if (App::main()) App::main()->confirmSendImage(*_img);
|
||||||
} else {
|
} else {
|
||||||
if (App::main()) App::main()->confirmSendImageUncompressed(ctrlShiftEnter, _replyTo);
|
if (App::main()) App::main()->confirmSendImageUncompressed(ctrlShiftEnter, _replyTo);
|
||||||
|
@ -33,6 +33,15 @@ public:
|
|||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
|
void setInnerFocus() {
|
||||||
|
if (_caption.isHidden()) {
|
||||||
|
setFocus();
|
||||||
|
} else {
|
||||||
|
_caption.setFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
~PhotoSendBox();
|
~PhotoSendBox();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -41,6 +50,8 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
void onCompressedChange();
|
||||||
|
void onCaptionResized();
|
||||||
void onSend(bool ctrlShiftEnter = false);
|
void onSend(bool ctrlShiftEnter = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -48,15 +59,19 @@ protected:
|
|||||||
void closePressed();
|
void closePressed();
|
||||||
void hideAll();
|
void hideAll();
|
||||||
void showAll();
|
void showAll();
|
||||||
|
void showDone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void updateBoxSize();
|
||||||
|
|
||||||
ReadyLocalMedia *_img;
|
ReadyLocalMedia *_img;
|
||||||
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
int32 _thumbx, _thumby, _thumbw, _thumbh;
|
||||||
QString _name, _size;
|
QString _name, _size;
|
||||||
int32 _namew, _textw;
|
int32 _namew, _textw;
|
||||||
FlatCheckbox _compressed;
|
InputArea _caption;
|
||||||
FlatButton _sendButton, _cancelButton;
|
Checkbox _compressed;
|
||||||
|
BoxButton _send, _cancel;
|
||||||
QPixmap _thumb;
|
QPixmap _thumb;
|
||||||
|
|
||||||
QString _phone, _fname, _lname;
|
QString _phone, _fname, _lname;
|
||||||
|
@ -164,7 +164,7 @@ _terminateAll(this, lang(lng_sessions_terminate_all)), _terminateBox(0), _shortP
|
|||||||
connect(App::wnd(), SIGNAL(newAuthorization()), this, SLOT(onNewAuthorization()));
|
connect(App::wnd(), SIGNAL(newAuthorization()), this, SLOT(onNewAuthorization()));
|
||||||
connect(&_shortPollTimer, SIGNAL(timeout()), this, SLOT(onShortPollAuthorizations()));
|
connect(&_shortPollTimer, SIGNAL(timeout()), this, SLOT(onShortPollAuthorizations()));
|
||||||
|
|
||||||
init(&_inner, _done.height(), st::old_boxTitleHeight + st::sessionHeight + st::old_boxTitleHeight);
|
init(&_inner, _done.height(), st::boxTitleHeight + st::sessionHeight + st::boxTitleHeight);
|
||||||
_inner.resize(width(), st::noContactsHeight);
|
_inner.resize(width(), st::noContactsHeight);
|
||||||
|
|
||||||
prepare();
|
prepare();
|
||||||
@ -176,7 +176,7 @@ _terminateAll(this, lang(lng_sessions_terminate_all)), _terminateBox(0), _shortP
|
|||||||
void SessionsBox::resizeEvent(QResizeEvent *e) {
|
void SessionsBox::resizeEvent(QResizeEvent *e) {
|
||||||
ScrollableBox::resizeEvent(e);
|
ScrollableBox::resizeEvent(e);
|
||||||
_done.move(0, height() - _done.height());
|
_done.move(0, height() - _done.height());
|
||||||
_terminateAll.moveToRight(st::sessionPadding.left(), st::old_boxTitleHeight + st::sessionHeight + st::old_boxTitlePos.y() + st::old_boxTitleFont->ascent - st::linkFont->ascent);
|
_terminateAll.moveToRight(st::sessionPadding.left(), st::boxTitleHeight + st::sessionHeight + st::boxTitlePosition.y() + st::boxTitleFont->ascent - st::linkFont->ascent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionsBox::hideAll() {
|
void SessionsBox::hideAll() {
|
||||||
@ -204,8 +204,8 @@ void SessionsBox::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintOldTitle(p, lang(lng_sessions_header), true);
|
paintTitle(p, lang(lng_sessions_header));
|
||||||
p.translate(0, st::old_boxTitleHeight);
|
p.translate(0, st::boxTitleHeight);
|
||||||
|
|
||||||
if (_loading) {
|
if (_loading) {
|
||||||
p.setFont(st::noContactsFont->f);
|
p.setFont(st::noContactsFont->f);
|
||||||
@ -230,16 +230,16 @@ void SessionsBox::paintEvent(QPaintEvent *e) {
|
|||||||
p.drawTextLeft(x, st::sessionPadding.top() + st::sessionNameFont->height + st::sessionInfoFont->height, w, _current.ip, _current.ipWidth);
|
p.drawTextLeft(x, st::sessionPadding.top() + st::sessionNameFont->height + st::sessionInfoFont->height, w, _current.ip, _current.ipWidth);
|
||||||
p.translate(0, st::sessionHeight);
|
p.translate(0, st::sessionHeight);
|
||||||
if (_list.isEmpty()) {
|
if (_list.isEmpty()) {
|
||||||
paintOldTitle(p, lang(lng_sessions_no_other), true);
|
paintTitle(p, lang(lng_sessions_no_other));
|
||||||
|
|
||||||
p.setFont(st::sessionInfoFont->f);
|
p.setFont(st::sessionInfoFont->f);
|
||||||
p.setPen(st::sessionInfoColor->p);
|
p.setPen(st::sessionInfoColor->p);
|
||||||
p.drawText(QRect(st::sessionPadding.left(), st::old_boxTitleHeight + st::old_boxTitlePos.y(), width() - st::sessionPadding.left() - st::sessionPadding.right(), _scroll.height()), lang(lng_sessions_other_desc), style::al_topleft);
|
p.drawText(QRect(st::sessionPadding.left(), st::boxTitleHeight + st::boxTitlePosition.y(), width() - st::sessionPadding.left() - st::sessionPadding.right(), _scroll.height()), lang(lng_sessions_other_desc), style::al_topleft);
|
||||||
|
|
||||||
// paint shadow
|
// paint shadow
|
||||||
p.fillRect(0, height() - st::sessionsCloseButton.height - st::scrollDef.bottomsh - st::sessionHeight - st::old_boxTitleHeight, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
p.fillRect(0, height() - st::sessionsCloseButton.height - st::scrollDef.bottomsh - st::sessionHeight - st::boxTitleHeight, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
|
||||||
} else {
|
} else {
|
||||||
paintOldTitle(p, lang(lng_sessions_other_header), false);
|
paintTitle(p, lang(lng_sessions_other_header));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,10 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
#include "localstorage.h"
|
#include "localstorage.h"
|
||||||
|
|
||||||
void StickerSetPanel::paintEvent(QPaintEvent *e) {
|
|
||||||
Painter p(this);
|
|
||||||
p.fillRect(e->rect(), st::emojiPanHeaderBg->b);
|
|
||||||
}
|
|
||||||
|
|
||||||
StickerSetInner::StickerSetInner(const MTPInputStickerSet &set) :
|
StickerSetInner::StickerSetInner(const MTPInputStickerSet &set) :
|
||||||
_loaded(false), _setId(0), _setAccess(0), _setCount(0), _setHash(0), _setFlags(0), _bottom(0),
|
_loaded(false), _setId(0), _setAccess(0), _setCount(0), _setHash(0), _setFlags(0), _bottom(0),
|
||||||
_input(set), _installRequest(0), _panel(0) {
|
_input(set), _installRequest(0) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
switch (set.type()) {
|
switch (set.type()) {
|
||||||
case mtpc_inputStickerSetID: _setId = set.c_inputStickerSetID().vid.v; _setAccess = set.c_inputStickerSetID().vaccess_hash.v; break;
|
case mtpc_inputStickerSetID: _setId = set.c_inputStickerSetID().vid.v; _setAccess = set.c_inputStickerSetID().vaccess_hash.v; break;
|
||||||
case mtpc_inputStickerSetShortName: _setShortName = qs(set.c_inputStickerSetShortName().vshort_name); break;
|
case mtpc_inputStickerSetShortName: _setShortName = qs(set.c_inputStickerSetShortName().vshort_name); break;
|
||||||
@ -61,7 +57,7 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
|
|||||||
if (d.vset.type() == mtpc_stickerSet) {
|
if (d.vset.type() == mtpc_stickerSet) {
|
||||||
const MTPDstickerSet &s(d.vset.c_stickerSet());
|
const MTPDstickerSet &s(d.vset.c_stickerSet());
|
||||||
_setTitle = qs(s.vtitle);
|
_setTitle = qs(s.vtitle);
|
||||||
_title = st::old_boxTitleFont->elided(_setTitle, width() - st::btnStickersClose.width - st::old_boxTitlePos.x());
|
_title = st::boxTitleFont->elided(_setTitle, width() - st::boxTitlePosition.x() - st::boxTitleHeight);
|
||||||
_setShortName = qs(s.vshort_name);
|
_setShortName = qs(s.vshort_name);
|
||||||
_setId = s.vid.v;
|
_setId = s.vid.v;
|
||||||
_setAccess = s.vaccess_hash.v;
|
_setAccess = s.vaccess_hash.v;
|
||||||
@ -75,10 +71,7 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
|
|||||||
App::wnd()->showLayer(new InformBox(lang(lng_stickers_not_found)));
|
App::wnd()->showLayer(new InformBox(lang(lng_stickers_not_found)));
|
||||||
} else {
|
} else {
|
||||||
int32 rows = _pack.size() / StickerPanPerRow + ((_pack.size() % StickerPanPerRow) ? 1 : 0);
|
int32 rows = _pack.size() / StickerPanPerRow + ((_pack.size() % StickerPanPerRow) ? 1 : 0);
|
||||||
resize(st::stickersPadding + StickerPanPerRow * st::stickersSize.width(), rows * st::stickersSize.height() + st::stickersAddOrShare);
|
resize(st::stickersPadding.left() + StickerPanPerRow * st::stickersSize.width(), st::stickersPadding.top() + rows * st::stickersSize.height() + st::stickersPadding.bottom());
|
||||||
_panel = new StickerSetPanel(parentWidget());
|
|
||||||
_panel->setGeometry(0, parentWidget()->height() - st::stickersAddOrShare, width(), st::stickersAddOrShare);
|
|
||||||
_panel->show();
|
|
||||||
}
|
}
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
|
||||||
@ -157,7 +150,7 @@ void StickerSetInner::paintEvent(QPaintEvent *e) {
|
|||||||
if (index >= _pack.size()) break;
|
if (index >= _pack.size()) break;
|
||||||
|
|
||||||
DocumentData *doc = _pack.at(index);
|
DocumentData *doc = _pack.at(index);
|
||||||
QPoint pos(st::stickerPanPadding + j * st::stickersSize.width(), i * st::stickersSize.height());
|
QPoint pos(st::stickersPadding.left() + j * st::stickersSize.width(), st::stickersPadding.top() + i * st::stickersSize.height());
|
||||||
|
|
||||||
bool goodThumb = !doc->thumb->isNull() && ((doc->thumb->width() >= 128) || (doc->thumb->height() >= 128));
|
bool goodThumb = !doc->thumb->isNull() && ((doc->thumb->width() >= 128) || (doc->thumb->height() >= 128));
|
||||||
if (goodThumb) {
|
if (goodThumb) {
|
||||||
@ -225,21 +218,20 @@ void StickerSetInner::install() {
|
|||||||
StickerSetInner::~StickerSetInner() {
|
StickerSetInner::~StickerSetInner() {
|
||||||
}
|
}
|
||||||
|
|
||||||
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll), _inner(set),
|
StickerSetBox::StickerSetBox(const MTPInputStickerSet &set) : ScrollableBox(st::stickersScroll)
|
||||||
_close(this, st::btnStickersClose),
|
, _inner(set)
|
||||||
_addStickers(this, lng_stickers_add_pack(lt_count, 0), st::btnStickersAdd),
|
, _shadow(this)
|
||||||
_shareStickers(this, lang(lng_stickers_share_pack), st::btnStickersAdd),
|
, _add(this, lang(lng_stickers_add_pack), st::defaultBoxButton)
|
||||||
_closeStickers(this, lang(lng_close), st::btnStickersAdd) {
|
, _share(this, lang(lng_stickers_share_pack), st::defaultBoxButton)
|
||||||
resize(st::stickersWidth, height());
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||||
setMaxHeight(st::stickersMaxHeight);
|
setMaxHeight(st::stickersMaxHeight);
|
||||||
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
|
connect(App::main(), SIGNAL(stickersUpdated()), this, SLOT(onStickersUpdated()));
|
||||||
|
|
||||||
init(&_inner, 0, st::boxFont->height + st::old_newGroupNamePadding.top() + st::old_newGroupNamePadding.bottom());
|
init(&_inner, st::boxButtonPadding.bottom() + _cancel.height() + st::boxButtonPadding.top());
|
||||||
|
|
||||||
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(&_add, SIGNAL(clicked()), this, SLOT(onAddStickers()));
|
||||||
connect(&_addStickers, SIGNAL(clicked()), this, SLOT(onAddStickers()));
|
connect(&_share, SIGNAL(clicked()), this, SLOT(onShareStickers()));
|
||||||
connect(&_shareStickers, SIGNAL(clicked()), this, SLOT(onShareStickers()));
|
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
connect(&_closeStickers, SIGNAL(clicked()), this, SLOT(onClose()));
|
|
||||||
|
|
||||||
connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
|
connect(&_inner, SIGNAL(updateButtons()), this, SLOT(onUpdateButtons()));
|
||||||
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll()));
|
||||||
@ -268,7 +260,9 @@ void StickerSetBox::onShareStickers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StickerSetBox::onUpdateButtons() {
|
void StickerSetBox::onUpdateButtons() {
|
||||||
if (!_close.isHidden()) showAll();
|
if (!_cancel.isHidden()) {
|
||||||
|
showAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickerSetBox::onScroll() {
|
void StickerSetBox::onScroll() {
|
||||||
@ -277,37 +271,35 @@ void StickerSetBox::onScroll() {
|
|||||||
|
|
||||||
void StickerSetBox::hideAll() {
|
void StickerSetBox::hideAll() {
|
||||||
ScrollableBox::hideAll();
|
ScrollableBox::hideAll();
|
||||||
_close.hide();
|
_shadow.hide();
|
||||||
_addStickers.hide();
|
_cancel.hide();
|
||||||
_shareStickers.hide();
|
_add.hide();
|
||||||
|
_share.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickerSetBox::showAll() {
|
void StickerSetBox::showAll() {
|
||||||
ScrollableBox::showAll();
|
ScrollableBox::showAll();
|
||||||
_close.show();
|
_shadow.show();
|
||||||
|
_cancel.show();
|
||||||
int32 cnt = _inner.notInstalled();
|
int32 cnt = _inner.notInstalled();
|
||||||
if (_inner.loaded()) {
|
if (_inner.loaded()) {
|
||||||
if (_inner.official()) {
|
if (_inner.official()) {
|
||||||
_addStickers.hide();
|
_add.hide();
|
||||||
_shareStickers.hide();
|
_share.hide();
|
||||||
_closeStickers.show();
|
|
||||||
} else if (_inner.notInstalled()) {
|
} else if (_inner.notInstalled()) {
|
||||||
_addStickers.setText(lng_stickers_add_pack(lt_count, cnt));
|
_add.show();
|
||||||
_addStickers.show();
|
_add.raise();
|
||||||
_addStickers.raise();
|
_share.hide();
|
||||||
_shareStickers.hide();
|
|
||||||
_closeStickers.hide();
|
|
||||||
} else {
|
} else {
|
||||||
_shareStickers.show();
|
_share.show();
|
||||||
_shareStickers.raise();
|
_share.raise();
|
||||||
_addStickers.hide();
|
_add.hide();
|
||||||
_closeStickers.hide();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_addStickers.hide();
|
_add.hide();
|
||||||
_shareStickers.hide();
|
_share.hide();
|
||||||
_closeStickers.hide();
|
|
||||||
}
|
}
|
||||||
|
resizeEvent(0);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,14 +307,20 @@ void StickerSetBox::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintOldTitle(p, _inner.title(), false);
|
paintTitle(p, _inner.title());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickerSetBox::resizeEvent(QResizeEvent *e) {
|
void StickerSetBox::resizeEvent(QResizeEvent *e) {
|
||||||
ScrollableBox::resizeEvent(e);
|
ScrollableBox::resizeEvent(e);
|
||||||
_inner.resize(width(), _inner.height());
|
_inner.resize(width(), _inner.height());
|
||||||
_close.moveToRight(0, 0);
|
_shadow.setGeometry(0, height() - st::boxButtonPadding.bottom() - _cancel.height() - st::boxButtonPadding.top() - st::lineWidth, width(), st::lineWidth);
|
||||||
_addStickers.move((width() - _addStickers.width()) / 2, height() - (st::stickersAddOrShare + _addStickers.height()) / 2);
|
_add.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _add.height());
|
||||||
_shareStickers.move((width() - _shareStickers.width()) / 2, height() - (st::stickersAddOrShare + _shareStickers.height()) / 2);
|
_share.moveToRight(st::boxButtonPadding.right(), _add.y());
|
||||||
_closeStickers.move((width() - _closeStickers.width()) / 2, height() - (st::stickersAddOrShare + _closeStickers.height()) / 2);
|
if (_add.isHidden() && _share.isHidden()) {
|
||||||
|
_cancel.moveToRight(st::boxButtonPadding.right(), _add.y());
|
||||||
|
} else if (_add.isHidden()) {
|
||||||
|
_cancel.moveToRight(st::boxButtonPadding.right() + _share.width() + st::boxButtonPadding.left(), _add.y());
|
||||||
|
} else {
|
||||||
|
_cancel.moveToRight(st::boxButtonPadding.right() + _add.width() + st::boxButtonPadding.left(), _add.y());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,15 +22,6 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
#include "abstractbox.h"
|
#include "abstractbox.h"
|
||||||
|
|
||||||
class StickerSetPanel : public TWidget {
|
|
||||||
public:
|
|
||||||
|
|
||||||
StickerSetPanel(QWidget *parent) : TWidget(parent) {
|
|
||||||
}
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class StickerSetInner : public TWidget, public RPCSender {
|
class StickerSetInner : public TWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -51,6 +42,8 @@ public:
|
|||||||
void setScrollBottom(int32 bottom);
|
void setScrollBottom(int32 bottom);
|
||||||
void install();
|
void install();
|
||||||
|
|
||||||
|
QString getTitle() const;
|
||||||
|
|
||||||
~StickerSetInner();
|
~StickerSetInner();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -76,8 +69,6 @@ private:
|
|||||||
MTPInputStickerSet _input;
|
MTPInputStickerSet _input;
|
||||||
|
|
||||||
mtpRequestId _installRequest;
|
mtpRequestId _installRequest;
|
||||||
|
|
||||||
StickerSetPanel *_panel;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class StickerSetBox : public ScrollableBox, public RPCSender {
|
class StickerSetBox : public ScrollableBox, public RPCSender {
|
||||||
@ -111,6 +102,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
StickerSetInner _inner;
|
StickerSetInner _inner;
|
||||||
IconedButton _close;
|
ScrollableBoxShadow _shadow;
|
||||||
FlatButton _addStickers, _shareStickers, _closeStickers;
|
BoxButton _add, _share, _cancel;
|
||||||
|
QString _title;
|
||||||
};
|
};
|
||||||
|
@ -28,16 +28,18 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
|
|
||||||
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
|
UsernameBox::UsernameBox() : AbstractBox(st::boxWidth),
|
||||||
_save(this, lang(lng_settings_save), st::defaultBoxButton),
|
_save(this, lang(lng_settings_save), st::defaultBoxButton),
|
||||||
_cancel(this, lang(lng_box_cancel), st::cancelBoxButton),
|
_cancel(this, lang(lng_cancel), st::cancelBoxButton),
|
||||||
_username(this, st::usernameField, qsl("@username"), App::self()->username, false),
|
_username(this, st::usernameField, qsl("@username"), App::self()->username, false),
|
||||||
_link(this, QString(), st::defaultBoxLinkButton),
|
_link(this, QString(), st::defaultBoxLinkButton),
|
||||||
_saveRequestId(0), _checkRequestId(0),
|
_saveRequestId(0), _checkRequestId(0),
|
||||||
_about(st::boxWidth - st::usernamePadding.left()) {
|
_about(st::boxWidth - st::usernamePadding.left()) {
|
||||||
|
setBlueTitle(true);
|
||||||
|
|
||||||
_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);
|
_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);
|
||||||
|
|
||||||
textstyleSet(&st::usernameTextStyle);
|
textstyleSet(&st::usernameTextStyle);
|
||||||
_about.setRichText(st::boxTextFont, lang(lng_username_about));
|
_about.setRichText(st::boxTextFont, lang(lng_username_about));
|
||||||
resizeMaxHeight(st::boxWidth, st::boxBlueTitleHeight + st::usernamePadding.top() + _username.height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left() - st::usernamePadding.right()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom());
|
resizeMaxHeight(st::boxWidth, st::boxTitleHeight + st::usernamePadding.top() + _username.height() + st::usernameSkip + _about.countHeight(st::boxWidth - st::usernamePadding.left() - st::usernamePadding.right()) + 3 * st::usernameTextStyle.lineHeight + st::usernamePadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom());
|
||||||
textstyleRestore();
|
textstyleRestore();
|
||||||
|
|
||||||
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
connect(&_save, SIGNAL(clicked()), this, SLOT(onSave()));
|
||||||
@ -58,6 +60,8 @@ void UsernameBox::hideAll() {
|
|||||||
_save.hide();
|
_save.hide();
|
||||||
_cancel.hide();
|
_cancel.hide();
|
||||||
_link.hide();
|
_link.hide();
|
||||||
|
|
||||||
|
AbstractBox::hideAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameBox::showAll() {
|
void UsernameBox::showAll() {
|
||||||
@ -65,6 +69,8 @@ void UsernameBox::showAll() {
|
|||||||
_save.show();
|
_save.show();
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
updateLinkText();
|
updateLinkText();
|
||||||
|
|
||||||
|
AbstractBox::showAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameBox::showDone() {
|
void UsernameBox::showDone() {
|
||||||
@ -75,7 +81,7 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
|
|
||||||
paintBlueTitle(p, lang(lng_username_title));
|
paintTitle(p, lang(lng_username_title));
|
||||||
|
|
||||||
if (!_copiedTextLink.isEmpty()) {
|
if (!_copiedTextLink.isEmpty()) {
|
||||||
p.setPen(st::usernameDefaultFg);
|
p.setPen(st::usernameDefaultFg);
|
||||||
@ -112,7 +118,7 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
|
|||||||
|
|
||||||
void UsernameBox::resizeEvent(QResizeEvent *e) {
|
void UsernameBox::resizeEvent(QResizeEvent *e) {
|
||||||
_username.resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username.height());
|
_username.resize(width() - st::usernamePadding.left() - st::usernamePadding.right(), _username.height());
|
||||||
_username.moveToLeft(st::usernamePadding.left(), st::boxBlueTitleHeight + st::usernamePadding.top());
|
_username.moveToLeft(st::usernamePadding.left(), st::boxTitleHeight + st::usernamePadding.top());
|
||||||
|
|
||||||
textstyleSet(&st::usernameTextStyle);
|
textstyleSet(&st::usernameTextStyle);
|
||||||
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
int32 availw = st::boxWidth - st::usernamePadding.left(), h = _about.countHeight(availw);
|
||||||
@ -122,6 +128,8 @@ void UsernameBox::resizeEvent(QResizeEvent *e) {
|
|||||||
|
|
||||||
_save.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save.height());
|
_save.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _save.height());
|
||||||
_cancel.moveToRight(st::boxButtonPadding.right() + _save.width() + st::boxButtonPadding.left(), _save.y());
|
_cancel.moveToRight(st::boxButtonPadding.right() + _save.width() + st::boxButtonPadding.left(), _save.y());
|
||||||
|
|
||||||
|
AbstractBox::resizeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameBox::onSave() {
|
void UsernameBox::onSave() {
|
||||||
|
@ -66,6 +66,7 @@ enum {
|
|||||||
|
|
||||||
MaxSelectedItems = 100,
|
MaxSelectedItems = 100,
|
||||||
|
|
||||||
|
MaxPhoneCodeLength = 4, // max length of country phone code
|
||||||
MaxPhoneTailLength = 18, // rest of the phone number, without country code (seen 12 at least)
|
MaxPhoneTailLength = 18, // rest of the phone number, without country code (seen 12 at least)
|
||||||
|
|
||||||
MaxScrollSpeed = 37, // 37px per 15ms while select-by-drag
|
MaxScrollSpeed = 37, // 37px per 15ms while select-by-drag
|
||||||
@ -127,6 +128,8 @@ enum {
|
|||||||
UsernameCheckTimeout = 200,
|
UsernameCheckTimeout = 200,
|
||||||
|
|
||||||
MaxChannelDescription = 120,
|
MaxChannelDescription = 120,
|
||||||
|
MaxGroupChannelTitle = 255,
|
||||||
|
MaxPhotoCaption = 140,
|
||||||
|
|
||||||
MaxMessageSize = 4096,
|
MaxMessageSize = 4096,
|
||||||
MaxHttpRedirects = 5, // when getting external data/images
|
MaxHttpRedirects = 5, // when getting external data/images
|
||||||
|
@ -48,6 +48,7 @@ _addContactLnk(this, lang(lng_add_contact_button)),
|
|||||||
_cancelSearchInPeer(this, st::btnCancelSearch),
|
_cancelSearchInPeer(this, st::btnCancelSearch),
|
||||||
_overDelete(false),
|
_overDelete(false),
|
||||||
_searchInPeer(0) {
|
_searchInPeer(0) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)));
|
connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)));
|
||||||
connect(main, SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*)));
|
connect(main, SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*)));
|
||||||
connect(main, SIGNAL(dialogRowReplaced(DialogRow*,DialogRow*)), this, SLOT(onDialogRowReplaced(DialogRow*,DialogRow*)));
|
connect(main, SIGNAL(dialogRowReplaced(DialogRow*,DialogRow*)), this, SLOT(onDialogRowReplaced(DialogRow*,DialogRow*)));
|
||||||
@ -1525,7 +1526,6 @@ DialogsWidget::DialogsWidget(MainWidget *parent) : QWidget(parent)
|
|||||||
connect(&_addContact, SIGNAL(clicked()), this, SLOT(onAddContact()));
|
connect(&_addContact, SIGNAL(clicked()), this, SLOT(onAddContact()));
|
||||||
connect(&_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup()));
|
connect(&_newGroup, SIGNAL(clicked()), this, SLOT(onNewGroup()));
|
||||||
connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
|
connect(&_cancelSearch, SIGNAL(clicked()), this, SLOT(onCancelSearch()));
|
||||||
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
|
||||||
|
|
||||||
_chooseByDragTimer.setSingleShot(true);
|
_chooseByDragTimer.setSingleShot(true);
|
||||||
connect(&_chooseByDragTimer, SIGNAL(timeout()), this, SLOT(onChooseByDrag()));
|
connect(&_chooseByDragTimer, SIGNAL(timeout()), this, SLOT(onChooseByDrag()));
|
||||||
|
@ -25,6 +25,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "gui/countryinput.h"
|
#include "gui/countryinput.h"
|
||||||
#include "gui/scrollarea.h"
|
#include "gui/scrollarea.h"
|
||||||
|
#include "boxes/contactsbox.h"
|
||||||
|
|
||||||
#include "countries.h"
|
#include "countries.h"
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ namespace {
|
|||||||
CountriesByLetter countriesByLetter;
|
CountriesByLetter countriesByLetter;
|
||||||
CountriesNames countriesNames;
|
CountriesNames countriesNames;
|
||||||
|
|
||||||
QString lastFilter, lastValidISO;
|
QString lastValidISO;
|
||||||
int countriesCount = sizeof(countries) / sizeof(countries[0]);
|
int countriesCount = sizeof(countries) / sizeof(countries[0]);
|
||||||
|
|
||||||
void initCountries() {
|
void initCountries() {
|
||||||
@ -87,7 +88,7 @@ QString findValidCode(QString fullCode) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _text(lang(lng_country_code)), _select(0) {
|
CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _text(lang(lng_country_code)) {
|
||||||
initCountries();
|
initCountries();
|
||||||
|
|
||||||
resize(_st.width, _st.height + _st.ptrSize.height());
|
resize(_st.width, _st.height + _st.ptrSize.height());
|
||||||
@ -134,15 +135,9 @@ void CountryInput::mouseMoveEvent(QMouseEvent *e) {
|
|||||||
void CountryInput::mousePressEvent(QMouseEvent *e) {
|
void CountryInput::mousePressEvent(QMouseEvent *e) {
|
||||||
mouseMoveEvent(e);
|
mouseMoveEvent(e);
|
||||||
if (_active) {
|
if (_active) {
|
||||||
Window *w = App::wnd();
|
CountrySelectBox *box = new CountrySelectBox();
|
||||||
if (w->focusWidget()) w->focusWidget()->clearFocus();
|
connect(box, SIGNAL(countryChosen(const QString&)), this, SLOT(onChooseCountry(const QString&)));
|
||||||
if (_select) {
|
App::wnd()->showLayer(box);
|
||||||
_select->hide();
|
|
||||||
_select->deleteLater();
|
|
||||||
}
|
|
||||||
_select = new CountrySelect();
|
|
||||||
connect(_select, SIGNAL(countryChosen(const QString &)), this, SLOT(onChooseCountry(const QString &)));
|
|
||||||
connect(_select, SIGNAL(countryFinished()), this, SLOT(onFinishCountry()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,12 +152,7 @@ void CountryInput::leaveEvent(QEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CountryInput::onChooseCode(const QString &code) {
|
void CountryInput::onChooseCode(const QString &code) {
|
||||||
if (_select) {
|
App::wnd()->hideLayer();
|
||||||
_select->hide();
|
|
||||||
_select->deleteLater();
|
|
||||||
_select = 0;
|
|
||||||
emit selectClosed();
|
|
||||||
}
|
|
||||||
if (code.length()) {
|
if (code.length()) {
|
||||||
CountriesByCode::const_iterator i = _countriesByCode.constFind(code);
|
CountriesByCode::const_iterator i = _countriesByCode.constFind(code);
|
||||||
if (i != _countriesByCode.cend()) {
|
if (i != _countriesByCode.cend()) {
|
||||||
@ -179,6 +169,8 @@ void CountryInput::onChooseCode(const QString &code) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CountryInput::onChooseCountry(const QString &iso) {
|
bool CountryInput::onChooseCountry(const QString &iso) {
|
||||||
|
App::wnd()->hideLayer();
|
||||||
|
|
||||||
CountriesByISO2::const_iterator i = _countriesByISO2.constFind(iso);
|
CountriesByISO2::const_iterator i = _countriesByISO2.constFind(iso);
|
||||||
const CountryInfo *info = (i == _countriesByISO2.cend()) ? 0 : (*i);
|
const CountryInfo *info = (i == _countriesByISO2.cend()) ? 0 : (*i);
|
||||||
|
|
||||||
@ -192,25 +184,19 @@ bool CountryInput::onChooseCountry(const QString &iso) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountryInput::onFinishCountry() {
|
|
||||||
if (_select) {
|
|
||||||
_select->hide();
|
|
||||||
_select->deleteLater();
|
|
||||||
_select = 0;
|
|
||||||
emit selectClosed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryInput::setText(const QString &newText) {
|
void CountryInput::setText(const QString &newText) {
|
||||||
_text = _st.font->elided(newText, width() - _st.textMrg.left() - _st.textMrg.right());
|
_text = _st.font->elided(newText, width() - _st.textMrg.left() - _st.textMrg.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
CountryInput::~CountryInput() {
|
CountryInput::~CountryInput() {
|
||||||
delete _select;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidget(parent), _sel(0),
|
CountrySelectInner::CountrySelectInner() : TWidget()
|
||||||
_st(st), _mouseSel(false) {
|
, _rowHeight(st::countryRowHeight)
|
||||||
|
, _sel(0)
|
||||||
|
, _mouseSel(false) {
|
||||||
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
|
||||||
CountriesByISO2::const_iterator l = _countriesByISO2.constFind(lastValidISO);
|
CountriesByISO2::const_iterator l = _countriesByISO2.constFind(lastValidISO);
|
||||||
bool seenLastValid = false;
|
bool seenLastValid = false;
|
||||||
int already = countriesAll.size();
|
int already = countriesAll.size();
|
||||||
@ -248,27 +234,108 @@ CountryList::CountryList(QWidget *parent, const style::countryList &st) : QWidge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastFilter = "";
|
_filter = qsl("a");
|
||||||
resetList();
|
updateFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountryList::resetList() {
|
void CountrySelectInner::paintEvent(QPaintEvent *e) {
|
||||||
countriesNow = &countriesAll;
|
Painter p(this);
|
||||||
if (lastFilter.length()) {
|
QRect r(e->rect());
|
||||||
QChar first = lastFilter[0].toLower();
|
p.setClipRect(r);
|
||||||
CountriesIds &ids(countriesByLetter[first]);
|
|
||||||
|
|
||||||
QStringList filterList = lastFilter.split(QRegularExpression("[\\s\\-]"), QString::SkipEmptyParts);
|
int l = countriesNow->size();
|
||||||
|
if (l) {
|
||||||
|
if (r.intersects(QRect(0, 0, width(), st::countriesSkip))) {
|
||||||
|
p.fillRect(r.intersected(QRect(0, 0, width(), st::countriesSkip)), st::white->b);
|
||||||
|
}
|
||||||
|
int32 from = floorclamp(r.y() - st::countriesSkip, _rowHeight, 0, l);
|
||||||
|
int32 to = ceilclamp(r.y() + r.height() - st::countriesSkip, _rowHeight, 0, l);
|
||||||
|
for (int32 i = from; i < to; ++i) {
|
||||||
|
bool sel = (i == _sel);
|
||||||
|
int32 y = st::countriesSkip + i * _rowHeight;
|
||||||
|
|
||||||
|
p.fillRect(0, y, width(), _rowHeight, (sel ? st::countryRowBgOver : st::white)->b);
|
||||||
|
|
||||||
|
QString code = QString("+") + (*countriesNow)[i]->code;
|
||||||
|
int32 codeWidth = st::countryRowCodeFont->width(code);
|
||||||
|
|
||||||
|
QString name = QString::fromUtf8((*countriesNow)[i]->name);
|
||||||
|
int32 nameWidth = st::countryRowNameFont->width(name);
|
||||||
|
int32 availWidth = width() - st::countryRowPadding.left() - st::countryRowPadding.right() - codeWidth - st::contactsScroll.width;
|
||||||
|
if (nameWidth > availWidth) {
|
||||||
|
name = st::countryRowNameFont->elided(name, availWidth);
|
||||||
|
nameWidth = st::countryRowNameFont->width(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.setFont(st::countryRowNameFont);
|
||||||
|
p.setPen(st::black);
|
||||||
|
p.drawTextLeft(st::countryRowPadding.left(), y + st::countryRowPadding.top(), width(), name);
|
||||||
|
p.setFont(st::countryRowCodeFont);
|
||||||
|
p.setPen(sel ? st::countryRowCodeFgOver : st::countryRowCodeFg);
|
||||||
|
p.drawTextLeft(st::countryRowPadding.left() + nameWidth + st::countryRowPadding.right(), y + st::countryRowPadding.top(), width(), code);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p.fillRect(r, st::white->b);
|
||||||
|
p.setFont(st::noContactsFont->f);
|
||||||
|
p.setPen(st::noContactsColor->p);
|
||||||
|
p.drawText(QRect(0, 0, width(), st::noContactsHeight), lang(lng_country_none), style::al_center);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::enterEvent(QEvent *e) {
|
||||||
|
setMouseTracking(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::leaveEvent(QEvent *e) {
|
||||||
|
_mouseSel = false;
|
||||||
|
setMouseTracking(false);
|
||||||
|
if (_sel >= 0) {
|
||||||
|
updateSelectedRow();
|
||||||
|
_sel = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::mouseMoveEvent(QMouseEvent *e) {
|
||||||
|
_mouseSel = true;
|
||||||
|
_lastMousePos = e->globalPos();
|
||||||
|
updateSel();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::mousePressEvent(QMouseEvent *e) {
|
||||||
|
_mouseSel = true;
|
||||||
|
_lastMousePos = e->globalPos();
|
||||||
|
updateSel();
|
||||||
|
if (e->button() == Qt::LeftButton) {
|
||||||
|
chooseCountry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::updateFilter(QString filter) {
|
||||||
|
filter = textSearchKey(filter);
|
||||||
|
|
||||||
|
QStringList f;
|
||||||
|
if (!filter.isEmpty()) {
|
||||||
|
QStringList filterList = filter.split(cWordSplit(), QString::SkipEmptyParts);
|
||||||
int l = filterList.size();
|
int l = filterList.size();
|
||||||
|
|
||||||
CountryNames filter;
|
f.reserve(l);
|
||||||
filter.reserve(l);
|
|
||||||
for (int i = 0; i < l; ++i) {
|
for (int i = 0; i < l; ++i) {
|
||||||
QString filterName = filterList[i].trimmed();
|
QString filterName = filterList[i].trimmed();
|
||||||
if (!filterName.length()) continue;
|
if (filterName.isEmpty()) continue;
|
||||||
filter.push_back(filterName);
|
f.push_back(filterName);
|
||||||
}
|
}
|
||||||
CountryNames::const_iterator fb = filter.cbegin(), fe = filter.cend(), fi;
|
filter = f.join(' ');
|
||||||
|
}
|
||||||
|
if (_filter != filter) {
|
||||||
|
_filter = filter;
|
||||||
|
|
||||||
|
if (_filter.isEmpty()) {
|
||||||
|
countriesNow = &countriesAll;
|
||||||
|
} else {
|
||||||
|
QChar first = _filter[0].toLower();
|
||||||
|
CountriesIds &ids(countriesByLetter[first]);
|
||||||
|
|
||||||
|
QStringList::const_iterator fb = f.cbegin(), fe = f.cend(), fi;
|
||||||
|
|
||||||
countriesFiltered.clear();
|
countriesFiltered.clear();
|
||||||
for (CountriesIds::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) {
|
for (CountriesIds::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) {
|
||||||
@ -292,324 +359,159 @@ void CountryList::resetList() {
|
|||||||
}
|
}
|
||||||
countriesNow = &countriesFiltered;
|
countriesNow = &countriesFiltered;
|
||||||
}
|
}
|
||||||
resize(width(), countriesNow->length() ? (countriesNow->length() * _st.rowHeight + 2 * _st.verticalMargin) : parentWidget()->height());
|
refresh();
|
||||||
setSelected(0);
|
_sel = countriesNow->isEmpty() ? -1 : 0;
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::paintEvent(QPaintEvent *e) {
|
|
||||||
QRect r(e->rect());
|
|
||||||
bool trivial = (rect() == r);
|
|
||||||
|
|
||||||
QPainter p(this);
|
|
||||||
if (!trivial) {
|
|
||||||
p.setClipRect(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
int l = countriesNow->size();
|
|
||||||
if (l) {
|
|
||||||
int32 from = floorclamp(r.y() - _st.verticalMargin, _st.rowHeight, 0, l);
|
|
||||||
int32 to = ceilclamp(r.y() + r.height() - _st.verticalMargin, _st.rowHeight, 0, l);
|
|
||||||
p.setFont(_st.font->f);
|
|
||||||
QRectF textRect(_st.margin + _st.borderMargin, _st.verticalMargin + from * _st.rowHeight, width() - 2 * _st.margin - 2 * _st.borderMargin, _st.rowHeight - _st.borderWidth);
|
|
||||||
for (int i = from; i < to; ++i) {
|
|
||||||
bool sel = (i == _sel);
|
|
||||||
if (sel) {
|
|
||||||
p.fillRect(_st.borderMargin, _st.verticalMargin + i * _st.rowHeight, width() - 2 * _st.borderMargin, _st.rowHeight, _st.bgHovered->b);
|
|
||||||
}
|
|
||||||
p.setFont(_st.font->f);
|
|
||||||
p.setPen(_st.color->p);
|
|
||||||
p.drawText(textRect, _st.font->elided(QString::fromUtf8((*countriesNow)[i]->name), width() - 2 * _st.margin - _st.codeWidth), QTextOption(style::al_left));
|
|
||||||
p.setFont(_st.codeFont->f);
|
|
||||||
p.setPen(_st.codeColor->p);
|
|
||||||
p.drawText(textRect, QString("+") + (*countriesNow)[i]->code, QTextOption(style::al_right));
|
|
||||||
textRect.setBottom(textRect.bottom() + _st.rowHeight);
|
|
||||||
textRect.setTop(textRect.top() + _st.rowHeight);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p.setFont(_st.notFoundFont->f);
|
|
||||||
p.setPen(_st.notFoundColor->p);
|
|
||||||
p.drawText(r, lang(lng_country_none), QTextOption(style::al_center));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::mouseMoveEvent(QMouseEvent *e) {
|
|
||||||
_mouseSel = true;
|
|
||||||
_mousePos = mapToGlobal(e->pos());
|
|
||||||
onUpdateSelected(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::onUpdateSelected(bool force) {
|
|
||||||
QPoint p(mapFromGlobal(_mousePos));
|
|
||||||
if ((!force && !rect().contains(p)) || !_mouseSel) return;
|
|
||||||
|
|
||||||
int newSelected = p.y();
|
|
||||||
newSelected = (newSelected > _st.verticalMargin) ? (newSelected - _st.verticalMargin) / _st.rowHeight : 0;
|
|
||||||
int l = countriesNow->size();
|
|
||||||
|
|
||||||
if (newSelected >= l) newSelected = l - 1;
|
|
||||||
if (newSelected < 0) newSelected = 0;
|
|
||||||
if (newSelected != _sel) {
|
|
||||||
_sel = newSelected;
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountryList::mousePressEvent(QMouseEvent *e) {
|
void CountrySelectInner::selectSkip(int32 dir) {
|
||||||
_mouseSel = true;
|
|
||||||
_mousePos = mapToGlobal(e->pos());
|
|
||||||
onUpdateSelected(true);
|
|
||||||
|
|
||||||
emit countrySelected();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::enterEvent(QEvent *e) {
|
|
||||||
setMouseTracking(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::leaveEvent(QEvent *e) {
|
|
||||||
setMouseTracking(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::updateFiltered() {
|
|
||||||
resetList();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::onParentGeometryChanged() {
|
|
||||||
_mousePos = QCursor::pos();
|
|
||||||
if (rect().contains(mapFromGlobal(_mousePos))) {
|
|
||||||
setMouseTracking(true);
|
|
||||||
onUpdateSelected(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::selectSkip(int delta) {
|
|
||||||
setSelected(_sel + delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::selectSkipPage(int h, int delta) {
|
|
||||||
setSelected(_sel + delta * (h / int(_st.rowHeight) - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountryList::setSelected(int newSelected) {
|
|
||||||
_mouseSel = false;
|
_mouseSel = false;
|
||||||
if (newSelected >= countriesNow->size()) {
|
|
||||||
newSelected = countriesNow->size() - 1;
|
int cur = (_sel >= 0) ? _sel : -1;
|
||||||
|
cur += dir;
|
||||||
|
if (cur <= 0) {
|
||||||
|
_sel = countriesNow->isEmpty() ? -1 : 0;
|
||||||
|
} else if (cur >= countriesNow->size()) {
|
||||||
|
_sel = -1;
|
||||||
|
} else {
|
||||||
|
_sel = cur;
|
||||||
}
|
}
|
||||||
if (newSelected < 0) {
|
if (_sel >= 0) {
|
||||||
newSelected = 0;
|
emit mustScrollTo(st::countriesSkip + _sel * _rowHeight, st::countriesSkip + (_sel + 1) * _rowHeight);
|
||||||
}
|
}
|
||||||
_sel = newSelected;
|
|
||||||
emit mustScrollTo(_sel * _st.rowHeight, (_sel + 1) * _st.rowHeight);
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CountryList::getSelectedCountry() const {
|
void CountrySelectInner::selectSkipPage(int32 h, int32 dir) {
|
||||||
if (lastFilter.length()) {
|
int32 points = h / _rowHeight;
|
||||||
if (_sel < countriesFiltered.size()) {
|
if (!points) return;
|
||||||
return countriesFiltered[_sel]->iso2;
|
selectSkip(points * dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::chooseCountry() {
|
||||||
|
QString result;
|
||||||
|
if (_filter.isEmpty()) {
|
||||||
|
if (_sel >= 0 && _sel < countriesAll.size()) {
|
||||||
|
result = countriesAll[_sel]->iso2;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return "";
|
if (_sel >= 0 && _sel < countriesFiltered.size()) {
|
||||||
|
result = countriesFiltered[_sel]->iso2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return countriesAll[_sel]->iso2;
|
emit countryChosen(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
CountrySelect::CountrySelect() : QWidget(App::wnd()),
|
void CountrySelectInner::refresh() {
|
||||||
_result("none"),
|
resize(width(), countriesNow->length() ? (countriesNow->length() * _rowHeight + st::countriesSkip) : st::noContactsHeight);
|
||||||
_filter(this, st::inpCountry, lang(lng_country_ph)), _scroll(this, st::scrollCountries), _list(&_scroll),
|
}
|
||||||
_doneButton(this, lang(lng_country_done), st::btnSelectDone),
|
|
||||||
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
|
|
||||||
_innerLeft(0), _innerTop(0), _innerWidth(0), _innerHeight(0),
|
|
||||||
a_alpha(0), a_bgAlpha(0), a_coord(st::countriesSlideShift), _shadow(st::boxShadow) {
|
|
||||||
setGeometry(App::wnd()->rect());
|
|
||||||
|
|
||||||
App::wnd()->topWidget(this);
|
void CountrySelectInner::updateSel() {
|
||||||
|
if (!_mouseSel) return;
|
||||||
|
|
||||||
connect(App::wnd(), SIGNAL(resized(const QSize &)), this, SLOT(onParentResize(const QSize &)));
|
QPoint p(mapFromGlobal(_lastMousePos));
|
||||||
connect(&_doneButton, SIGNAL(clicked()), this, SLOT(onCountryChoose()));
|
bool in = parentWidget()->rect().contains(parentWidget()->mapFromGlobal(_lastMousePos));
|
||||||
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onCountryCancel()));
|
|
||||||
connect(&_scroll, SIGNAL(scrollFinished()), this, SLOT(onScrollFinished()));
|
int32 newSel = (in && p.y() >= st::countriesSkip && p.y() < st::countriesSkip + countriesNow->size() * _rowHeight) ? ((p.y() - st::countriesSkip) / _rowHeight) : -1;
|
||||||
connect(&_scroll, SIGNAL(geometryChanged()), &_list, SLOT(onParentGeometryChanged()));
|
if (newSel != _sel) {
|
||||||
connect(&_scroll, SIGNAL(scrolled()), &_list, SLOT(onUpdateSelected()));
|
updateSelectedRow();
|
||||||
connect(&_list, SIGNAL(countrySelected()), this, SLOT(onCountryChoose()));
|
_sel = newSel;
|
||||||
|
updateSelectedRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectInner::updateSelectedRow() {
|
||||||
|
if (_sel >= 0) {
|
||||||
|
update(0, st::countriesSkip + _sel * _rowHeight, width(), _rowHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CountrySelectBox::CountrySelectBox() : ItemListBox(st::countriesScroll, st::boxWidth)
|
||||||
|
, _inner()
|
||||||
|
, _filter(this, st::boxSearchField, lang(lng_country_ph))
|
||||||
|
, _filterCancel(this, st::boxSearchCancel)
|
||||||
|
, _topShadow(this) {
|
||||||
|
ItemListBox::init(&_inner, st::boxScrollSkip, st::boxTitleHeight + _filter.height());
|
||||||
|
|
||||||
|
connect(&_scroll, SIGNAL(scrolled()), &_inner, SLOT(updateSel()));
|
||||||
connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
connect(&_filter, SIGNAL(changed()), this, SLOT(onFilterUpdate()));
|
||||||
connect(&_list, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int)));
|
connect(&_filter, SIGNAL(submitted(bool)), this, SLOT(onSubmit()));
|
||||||
|
connect(&_filterCancel, SIGNAL(clicked()), this, SLOT(onFilterCancel()));
|
||||||
|
connect(&_inner, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int)));
|
||||||
|
connect(&_inner, SIGNAL(countryChosen(const QString&)), this, SIGNAL(countryChosen(const QString&)));
|
||||||
|
|
||||||
show();
|
_filterCancel.setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
setFocus();
|
|
||||||
_scroll.setWidget(&_list);
|
|
||||||
_scroll.setFocusPolicy(Qt::NoFocus);
|
|
||||||
|
|
||||||
prepareAnimation(0);
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::prepareAnimation(int to) {
|
void CountrySelectBox::onSubmit() {
|
||||||
if (to) {
|
_inner.chooseCountry();
|
||||||
if (_result == "none") _result = "";
|
|
||||||
a_alpha.start(0);
|
|
||||||
af_alpha = st::countriesAlphaHideFunc;
|
|
||||||
a_bgAlpha.start(0);
|
|
||||||
af_bgAlpha = st::countriesBackHideFunc;
|
|
||||||
a_coord.start(to * st::countriesSlideShift);
|
|
||||||
af_coord = st::countriesHideFunc;
|
|
||||||
} else {
|
|
||||||
_result = "none";
|
|
||||||
a_alpha.start(1);
|
|
||||||
af_alpha = st::countriesAlphaShowFunc;
|
|
||||||
a_bgAlpha.start(1);
|
|
||||||
af_bgAlpha = st::countriesBackShowFunc;
|
|
||||||
a_coord.start(0);
|
|
||||||
af_coord = st::countriesShowFunc;
|
|
||||||
}
|
|
||||||
_cache = myGrab(this, QRect(_innerLeft, _innerTop, _innerWidth, _innerHeight));
|
|
||||||
_scroll.hide();
|
|
||||||
_doneButton.hide();
|
|
||||||
_cancelButton.hide();
|
|
||||||
_filter.hide();
|
|
||||||
anim::start(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::paintEvent(QPaintEvent *e) {
|
void CountrySelectBox::keyPressEvent(QKeyEvent *e) {
|
||||||
bool trivial = (rect() == e->rect());
|
if (e->key() == Qt::Key_Down) {
|
||||||
|
_inner.selectSkip(1);
|
||||||
QPainter p(this);
|
|
||||||
if (!trivial) {
|
|
||||||
p.setClipRect(e->rect());
|
|
||||||
}
|
|
||||||
p.setOpacity(st::layerAlpha * a_bgAlpha.current());
|
|
||||||
p.fillRect(rect(), st::layerBG->b);
|
|
||||||
if (animating()) {
|
|
||||||
p.setOpacity(a_alpha.current());
|
|
||||||
p.drawPixmap(a_coord.current() + _innerLeft, _innerTop, _cache);
|
|
||||||
} else {
|
|
||||||
p.setOpacity(1);
|
|
||||||
|
|
||||||
QRect inner(_innerLeft, _innerTop, _innerWidth, _innerHeight);
|
|
||||||
_shadow.paint(p, inner, st::boxShadowShift);
|
|
||||||
if (trivial || e->rect().intersects(inner)) {
|
|
||||||
// fill bg
|
|
||||||
p.fillRect(inner, st::white->b);
|
|
||||||
|
|
||||||
// paint shadows
|
|
||||||
p.fillRect(_innerLeft, _innerTop + st::participantFilter.height, _innerWidth, st::scrollDef.topsh, st::scrollDef.shColor->b);
|
|
||||||
|
|
||||||
// paint button sep
|
|
||||||
p.fillRect(_innerLeft + st::btnSelectCancel.width, _innerTop + _innerHeight - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
|
|
||||||
|
|
||||||
// draw box title / text
|
|
||||||
p.setPen(st::black->p);
|
|
||||||
p.setFont(st::old_boxTitleFont->f);
|
|
||||||
p.drawText(_innerLeft + st::old_boxTitlePos.x(), _innerTop + st::old_boxTitlePos.y() + st::old_boxTitleFont->ascent, lang(lng_country_select));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountrySelect::keyPressEvent(QKeyEvent *e) {
|
|
||||||
if (e->key() == Qt::Key_Escape) {
|
|
||||||
onCountryCancel();
|
|
||||||
} else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
|
|
||||||
onCountryChoose();
|
|
||||||
} else if (e->key() == Qt::Key_Down) {
|
|
||||||
_list.selectSkip(1);
|
|
||||||
} else if (e->key() == Qt::Key_Up) {
|
} else if (e->key() == Qt::Key_Up) {
|
||||||
_list.selectSkip(-1);
|
_inner.selectSkip(-1);
|
||||||
} else if (e->key() == Qt::Key_PageDown) {
|
} else if (e->key() == Qt::Key_PageDown) {
|
||||||
_list.selectSkipPage(_scroll.height(), 1);
|
_inner.selectSkipPage(_scroll.height(), 1);
|
||||||
} else if (e->key() == Qt::Key_PageUp) {
|
} else if (e->key() == Qt::Key_PageUp) {
|
||||||
_list.selectSkipPage(_scroll.height(), -1);
|
_inner.selectSkipPage(_scroll.height(), -1);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountrySelect::mousePressEvent(QMouseEvent *e) {
|
|
||||||
if (!QRect(_innerLeft, _innerTop, _innerWidth, _innerHeight).contains(e->pos())) {
|
|
||||||
onCountryCancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountrySelect::onFilterUpdate() {
|
|
||||||
QString newFilter(_filter.text().trimmed().toLower());
|
|
||||||
if (newFilter != lastFilter) {
|
|
||||||
lastFilter = newFilter;
|
|
||||||
_list.updateFiltered();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountrySelect::resizeEvent(QResizeEvent *e) {
|
|
||||||
if (width() != e->oldSize().width()) {
|
|
||||||
_innerWidth = st::old_newGroupNamePadding.left() + _filter.width() + st::old_newGroupNamePadding.right();
|
|
||||||
_innerLeft = (width() - _innerWidth) / 2;
|
|
||||||
|
|
||||||
_list.resize(_innerWidth, _list.height());
|
|
||||||
}
|
|
||||||
if (height() != e->oldSize().height()) {
|
|
||||||
_innerTop = st::introSelectDelta;
|
|
||||||
_innerHeight = height() - _innerTop - st::introSelectDelta;
|
|
||||||
if (_innerHeight > st::boxMaxListHeight) {
|
|
||||||
_innerHeight = st::boxMaxListHeight;
|
|
||||||
_innerTop = (height() - _innerHeight) / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_filter.move(_innerLeft + st::old_newGroupNamePadding.left(), _innerTop + st::contactsAdd.height + st::old_newGroupNamePadding.top());
|
|
||||||
int32 scrollTop = _filter.y() + _filter.height() + st::old_newGroupNamePadding.bottom();
|
|
||||||
int32 scrollHeight = _innerHeight - st::contactsAdd.height - st::old_newGroupNamePadding.top() - _filter.height() - st::old_newGroupNamePadding.bottom() - _cancelButton.height();
|
|
||||||
_scroll.setGeometry(_innerLeft, scrollTop, _innerWidth, scrollHeight);
|
|
||||||
|
|
||||||
int btnTop = scrollTop + scrollHeight;
|
|
||||||
_cancelButton.move(_innerLeft, btnTop);
|
|
||||||
_doneButton.move(_innerLeft + _innerWidth - _doneButton.width(), btnTop);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CountrySelect::animStep(float64 ms) {
|
|
||||||
float64 dt = ms / st::countriesSlideDuration;
|
|
||||||
bool res = true;
|
|
||||||
if (dt >= 1) {
|
|
||||||
a_alpha.finish();
|
|
||||||
a_bgAlpha.finish();
|
|
||||||
a_coord.finish();
|
|
||||||
_cache = QPixmap();
|
|
||||||
_scroll.show();
|
|
||||||
_doneButton.show();
|
|
||||||
_cancelButton.show();
|
|
||||||
_filter.show();
|
|
||||||
_filter.setFocus();
|
|
||||||
if (_result != "none") {
|
|
||||||
QTimer::singleShot(0, this, SIGNAL(countryFinished()));
|
|
||||||
}
|
|
||||||
res = false;
|
|
||||||
} else {
|
} else {
|
||||||
a_alpha.update(dt, af_alpha);
|
ItemListBox::keyPressEvent(e);
|
||||||
a_bgAlpha.update(dt, af_bgAlpha);
|
|
||||||
a_coord.update(dt, af_coord);
|
|
||||||
}
|
}
|
||||||
update();
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::onParentResize(const QSize &newSize) {
|
void CountrySelectBox::paintEvent(QPaintEvent *e) {
|
||||||
resize(App::wnd()->size());
|
Painter p(this);
|
||||||
|
if (paint(p)) return;
|
||||||
|
|
||||||
|
paintTitle(p, lang(lng_country_select));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::onCountryCancel() {
|
void CountrySelectBox::resizeEvent(QResizeEvent *e) {
|
||||||
finish("");
|
ItemListBox::resizeEvent(e);
|
||||||
|
_filter.resize(width(), _filter.height());
|
||||||
|
_filter.moveToLeft(0, st::boxTitleHeight);
|
||||||
|
_filterCancel.moveToRight(0, st::boxTitleHeight);
|
||||||
|
_inner.resize(width(), _inner.height());
|
||||||
|
_topShadow.setGeometry(0, st::boxTitleHeight + _filter.height(), width(), st::lineWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::onCountryChoose() {
|
void CountrySelectBox::hideAll() {
|
||||||
finish(_list.getSelectedCountry());
|
_filter.hide();
|
||||||
|
_filterCancel.hide();
|
||||||
|
_topShadow.hide();
|
||||||
|
ItemListBox::hideAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::finish(const QString &res) {
|
void CountrySelectBox::showAll() {
|
||||||
_result = res;
|
_filter.show();
|
||||||
prepareAnimation(_result.length() ? -1 : 1);
|
if (_filter.getLastText().isEmpty()) {
|
||||||
emit countryChosen(_result);
|
_filterCancel.hide();
|
||||||
|
} else {
|
||||||
|
_filterCancel.show();
|
||||||
|
}
|
||||||
|
_topShadow.show();
|
||||||
|
ItemListBox::showAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelect::onScrollFinished() {
|
void CountrySelectBox::onFilterCancel() {
|
||||||
|
_filter.setText(QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectBox::onFilterUpdate() {
|
||||||
|
_scroll.scrollToY(0);
|
||||||
|
if (_filter.getLastText().isEmpty()) {
|
||||||
|
_filterCancel.hide();
|
||||||
|
} else {
|
||||||
|
_filterCancel.show();
|
||||||
|
}
|
||||||
|
_inner.updateFilter(_filter.getLastText());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CountrySelectBox::showDone() {
|
||||||
_filter.setFocus();
|
_filter.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
CountrySelect::~CountrySelect() {
|
|
||||||
if (App::wnd()) {
|
|
||||||
App::wnd()->noTopWidget(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -20,13 +20,13 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QtWidgets/QWidget>
|
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
|
|
||||||
#include "gui/flatinput.h"
|
#include "gui/flatinput.h"
|
||||||
#include "gui/scrollarea.h"
|
#include "gui/scrollarea.h"
|
||||||
#include "gui/flatbutton.h"
|
#include "gui/flatbutton.h"
|
||||||
#include "gui/boxshadow.h"
|
#include "gui/boxshadow.h"
|
||||||
|
#include "boxes/abstractbox.h"
|
||||||
|
|
||||||
QString findValidCode(QString fullCode);
|
QString findValidCode(QString fullCode);
|
||||||
|
|
||||||
@ -51,12 +51,10 @@ public slots:
|
|||||||
|
|
||||||
void onChooseCode(const QString &code);
|
void onChooseCode(const QString &code);
|
||||||
bool onChooseCountry(const QString &country);
|
bool onChooseCountry(const QString &country);
|
||||||
void onFinishCountry();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void codeChanged(const QString &code);
|
void codeChanged(const QString &code);
|
||||||
void selectClosed();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -72,6 +70,89 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CountrySelectInner : public TWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
CountrySelectInner();
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
void enterEvent(QEvent *e);
|
||||||
|
void leaveEvent(QEvent *e);
|
||||||
|
void mouseMoveEvent(QMouseEvent *e);
|
||||||
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
|
||||||
|
void updateFilter(QString filter = QString());
|
||||||
|
|
||||||
|
void selectSkip(int32 dir);
|
||||||
|
void selectSkipPage(int32 h, int32 dir);
|
||||||
|
|
||||||
|
void chooseCountry();
|
||||||
|
|
||||||
|
void refresh();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void countryChosen(const QString &iso);
|
||||||
|
void mustScrollTo(int ymin, int ymax);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void updateSel();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void updateSelectedRow();
|
||||||
|
|
||||||
|
int32 _rowHeight;
|
||||||
|
|
||||||
|
int32 _sel;
|
||||||
|
QString _filter;
|
||||||
|
bool _mouseSel;
|
||||||
|
|
||||||
|
QPoint _lastMousePos;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CountrySelectBox : public ItemListBox {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
CountrySelectBox();
|
||||||
|
void keyPressEvent(QKeyEvent *e);
|
||||||
|
void paintEvent(QPaintEvent *e);
|
||||||
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
|
void setInnerFocus() {
|
||||||
|
_filter.setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void countryChosen(const QString &iso);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void onFilterUpdate();
|
||||||
|
void onFilterCancel();
|
||||||
|
void onSubmit();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void showDone();
|
||||||
|
void hideAll();
|
||||||
|
void showAll();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
CountrySelectInner _inner;
|
||||||
|
InputField _filter;
|
||||||
|
IconedButton _filterCancel;
|
||||||
|
|
||||||
|
ScrollableBoxShadow _topShadow;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** /
|
||||||
class CountryList : public QWidget {
|
class CountryList : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -153,7 +234,7 @@ private:
|
|||||||
FlatInput _filter;
|
FlatInput _filter;
|
||||||
ScrollArea _scroll;
|
ScrollArea _scroll;
|
||||||
CountryList _list;
|
CountryList _list;
|
||||||
FlatButton _doneButton, _cancelButton;
|
BoxButton _doneButton, _cancelButton;
|
||||||
int32 _innerLeft, _innerTop, _innerWidth, _innerHeight;
|
int32 _innerLeft, _innerTop, _innerWidth, _innerHeight;
|
||||||
|
|
||||||
anim::fvalue a_alpha, a_bgAlpha;
|
anim::fvalue a_alpha, a_bgAlpha;
|
||||||
@ -164,3 +245,4 @@ private:
|
|||||||
BoxShadow _shadow;
|
BoxShadow _shadow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
*/
|
@ -296,7 +296,7 @@ void MaskedButton::paintEvent(QPaintEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoxButton::BoxButton(QWidget *parent, const QString &text, const style::BoxButton &st) : Button(parent),
|
BoxButton::BoxButton(QWidget *parent, const QString &text, const style::BoxButton &st) : Button(parent),
|
||||||
_text(text), _fullText(text), _textWidth(st.font->width(text)),
|
_text(text.toUpper()), _fullText(text.toUpper()), _textWidth(st.font->width(_text)),
|
||||||
_st(st),
|
_st(st),
|
||||||
a_textBgOverOpacity(0), a_textFg(st.textFg->c), _a_over(animFunc(this, &BoxButton::animStep_over)) {
|
a_textBgOverOpacity(0), a_textFg(st.textFg->c), _a_over(animFunc(this, &BoxButton::animStep_over)) {
|
||||||
if (_st.width <= 0) {
|
if (_st.width <= 0) {
|
||||||
|
@ -400,10 +400,10 @@ void CountryCodeInput::correctValue(const QString &was, QString &now) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PhoneInput::PhoneInput(QWidget *parent, const style::flatInput &st) : FlatInput(parent, st, lang(lng_phone_ph)) {
|
PhonePartInput::PhonePartInput(QWidget *parent, const style::flatInput &st) : FlatInput(parent, st, lang(lng_phone_ph)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneInput::paintEvent(QPaintEvent *e) {
|
void PhonePartInput::paintEvent(QPaintEvent *e) {
|
||||||
FlatInput::paintEvent(e);
|
FlatInput::paintEvent(e);
|
||||||
|
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
@ -423,7 +423,7 @@ void PhoneInput::paintEvent(QPaintEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneInput::keyPressEvent(QKeyEvent *e) {
|
void PhonePartInput::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Backspace && text().isEmpty()) {
|
if (e->key() == Qt::Key_Backspace && text().isEmpty()) {
|
||||||
emit voidBackspace(e);
|
emit voidBackspace(e);
|
||||||
} else {
|
} else {
|
||||||
@ -431,7 +431,7 @@ void PhoneInput::keyPressEvent(QKeyEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneInput::correctValue(const QString &was, QString &now) {
|
void PhonePartInput::correctValue(const QString &was, QString &now) {
|
||||||
QString newText;
|
QString newText;
|
||||||
int oldPos(cursorPosition()), newPos(-1), oldLen(now.length()), digitCount = 0;
|
int oldPos(cursorPosition()), newPos(-1), oldLen(now.length()), digitCount = 0;
|
||||||
for (int i = 0; i < oldLen; ++i) {
|
for (int i = 0; i < oldLen; ++i) {
|
||||||
@ -497,7 +497,7 @@ void PhoneInput::correctValue(const QString &was, QString &now) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneInput::addedToNumber(const QString &added) {
|
void PhonePartInput::addedToNumber(const QString &added) {
|
||||||
setFocus();
|
setFocus();
|
||||||
QString wasText(getLastText()), newText = added + wasText;
|
QString wasText(getLastText()), newText = added + wasText;
|
||||||
setText(newText);
|
setText(newText);
|
||||||
@ -506,7 +506,7 @@ void PhoneInput::addedToNumber(const QString &added) {
|
|||||||
updatePlaceholder();
|
updatePlaceholder();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhoneInput::onChooseCode(const QString &code) {
|
void PhonePartInput::onChooseCode(const QString &code) {
|
||||||
pattern = phoneNumberParse(code);
|
pattern = phoneNumberParse(code);
|
||||||
if (!pattern.isEmpty() && pattern.at(0) == code.size()) {
|
if (!pattern.isEmpty() && pattern.at(0) == code.size()) {
|
||||||
pattern.pop_front();
|
pattern.pop_front();
|
||||||
@ -1119,6 +1119,10 @@ void InputArea::customUpDown(bool custom) {
|
|||||||
_customUpDown = custom;
|
_customUpDown = custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputArea::setCtrlEnterSubmit(bool ctrlEnterSubmit) {
|
||||||
|
_ctrlEnterSubmit = ctrlEnterSubmit;
|
||||||
|
}
|
||||||
|
|
||||||
void InputArea::InputAreaInner::keyPressEvent(QKeyEvent *e) {
|
void InputArea::InputAreaInner::keyPressEvent(QKeyEvent *e) {
|
||||||
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier);
|
bool shift = e->modifiers().testFlag(Qt::ShiftModifier), alt = e->modifiers().testFlag(Qt::AltModifier);
|
||||||
bool macmeta = (cPlatform() == dbipMac) && e->modifiers().testFlag(Qt::ControlModifier) && !e->modifiers().testFlag(Qt::MetaModifier) && !e->modifiers().testFlag(Qt::AltModifier);
|
bool macmeta = (cPlatform() == dbipMac) && e->modifiers().testFlag(Qt::ControlModifier) && !e->modifiers().testFlag(Qt::MetaModifier) && !e->modifiers().testFlag(Qt::AltModifier);
|
||||||
@ -1201,7 +1205,7 @@ _oldtext(val),
|
|||||||
_undoAvailable(false),
|
_undoAvailable(false),
|
||||||
_redoAvailable(false),
|
_redoAvailable(false),
|
||||||
|
|
||||||
_customUpDown(false),
|
_customUpDown(true),
|
||||||
|
|
||||||
_placeholderFull(ph),
|
_placeholderFull(ph),
|
||||||
_placeholderVisible(val.isEmpty()),
|
_placeholderVisible(val.isEmpty()),
|
||||||
@ -1717,6 +1721,13 @@ void InputField::onRedoAvailable(bool avail) {
|
|||||||
if (App::wnd()) App::wnd()->updateGlobalMenu();
|
if (App::wnd()) App::wnd()->updateGlobalMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputField::selectAll() {
|
||||||
|
QTextCursor c(_inner.textCursor());
|
||||||
|
c.setPosition(0);
|
||||||
|
c.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
|
||||||
|
_inner.setTextCursor(c);
|
||||||
|
}
|
||||||
|
|
||||||
bool InputField::animStep_placeholderFg(float64 ms) {
|
bool InputField::animStep_placeholderFg(float64 ms) {
|
||||||
float dt = ms / _st.duration;
|
float dt = ms / _st.duration;
|
||||||
bool res = true;
|
bool res = true;
|
||||||
@ -2102,10 +2113,14 @@ bool MaskedInputField::animStep_border(float64 ms) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaskedInputField::setPlaceholder(const QString &placeholder) {
|
bool MaskedInputField::setPlaceholder(const QString &placeholder) {
|
||||||
|
if (_placeholderFull != placeholder) {
|
||||||
_placeholderFull = placeholder;
|
_placeholderFull = placeholder;
|
||||||
resizeEvent(0);
|
resizeEvent(0);
|
||||||
update();
|
update();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaskedInputField::setPlaceholderFast(bool fast) {
|
void MaskedInputField::setPlaceholderFast(bool fast) {
|
||||||
@ -2213,7 +2228,7 @@ void MaskedInputField::onTextEdited() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MaskedInputField::onTextChange(const QString &text) {
|
void MaskedInputField::onTextChange(const QString &text) {
|
||||||
_oldtext = text;
|
_oldtext = QLineEdit::text();
|
||||||
if (_error) {
|
if (_error) {
|
||||||
_error = false;
|
_error = false;
|
||||||
startBorderAnimation();
|
startBorderAnimation();
|
||||||
@ -2225,6 +2240,10 @@ void MaskedInputField::onCursorPositionChanged(int oldPosition, int position) {
|
|||||||
_oldcursor = position;
|
_oldcursor = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PasswordField::PasswordField(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : MaskedInputField(parent, st, ph, val) {
|
||||||
|
setEchoMode(QLineEdit::Password);
|
||||||
|
}
|
||||||
|
|
||||||
PortInput::PortInput(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : MaskedInputField(parent, st, ph, val) {
|
PortInput::PortInput(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : MaskedInputField(parent, st, ph, val) {
|
||||||
if (!val.toInt() || val.toInt() > 65535) {
|
if (!val.toInt() || val.toInt() > 65535) {
|
||||||
setText(QString());
|
setText(QString());
|
||||||
@ -2307,3 +2326,143 @@ void UsernameInput::correctValue(const QString &was, int32 wasCursor, QString &n
|
|||||||
setCursorPosition(newCursor);
|
setCursorPosition(newCursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PhoneInput::PhoneInput(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val) : MaskedInputField(parent, st, ph, val)
|
||||||
|
, _defaultPlaceholder(ph) {
|
||||||
|
QString phone(val);
|
||||||
|
if (phone.isEmpty()) {
|
||||||
|
clearText();
|
||||||
|
} else {
|
||||||
|
int32 pos = phone.size();
|
||||||
|
correctValue(QString(), 0, phone, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhoneInput::focusInEvent(QFocusEvent *e) {
|
||||||
|
MaskedInputField::focusInEvent(e);
|
||||||
|
setSelection(cursorPosition(), cursorPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhoneInput::clearText() {
|
||||||
|
QString phone;
|
||||||
|
if (App::self()) {
|
||||||
|
QVector<int> newPattern = phoneNumberParse(App::self()->phone);
|
||||||
|
if (!newPattern.isEmpty()) {
|
||||||
|
phone = App::self()->phone.mid(0, newPattern.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setText(phone);
|
||||||
|
int32 pos = phone.size();
|
||||||
|
correctValue(QString(), 0, phone, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhoneInput::paintPlaceholder(Painter &p) {
|
||||||
|
QString t(getLastText());
|
||||||
|
if (!pattern.isEmpty() && !t.isEmpty()) {
|
||||||
|
QString ph = placeholder().mid(t.size());
|
||||||
|
if (!ph.isEmpty()) {
|
||||||
|
p.setClipRect(rect());
|
||||||
|
QRect phRect(placeholderRect());
|
||||||
|
int tw = phFont()->width(t);
|
||||||
|
if (tw < phRect.width()) {
|
||||||
|
phRect.setLeft(phRect.left() + tw);
|
||||||
|
placeholderPreparePaint(p);
|
||||||
|
p.drawText(phRect, ph, style::al_topleft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MaskedInputField::paintPlaceholder(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PhoneInput::correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor) {
|
||||||
|
QString digits(now);
|
||||||
|
digits.replace(QRegularExpression(qsl("[^\\d]")), QString());
|
||||||
|
pattern = phoneNumberParse(digits);
|
||||||
|
|
||||||
|
QString newPlaceholder;
|
||||||
|
if (pattern.isEmpty()) {
|
||||||
|
newPlaceholder = lang(lng_contact_phone);
|
||||||
|
} else if (pattern.size() == 1 && pattern.at(0) == digits.size()) {
|
||||||
|
newPlaceholder = QString(pattern.at(0) + 2, ' ') + lang(lng_contact_phone);
|
||||||
|
} else {
|
||||||
|
newPlaceholder.reserve(20);
|
||||||
|
for (int i = 0, l = pattern.size(); i < l; ++i) {
|
||||||
|
if (i) {
|
||||||
|
newPlaceholder.append(' ');
|
||||||
|
} else {
|
||||||
|
newPlaceholder.append('+');
|
||||||
|
}
|
||||||
|
newPlaceholder.append(i ? QString(pattern.at(i), QChar(0x2212)) : digits.mid(0, pattern.at(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (setPlaceholder(newPlaceholder)) {
|
||||||
|
setPlaceholderFast(!pattern.isEmpty());
|
||||||
|
updatePlaceholder();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString newText;
|
||||||
|
int oldPos(nowCursor), newPos(-1), oldLen(now.length()), digitCount = qMin(digits.size(), MaxPhoneCodeLength + MaxPhoneTailLength);
|
||||||
|
|
||||||
|
bool inPart = !pattern.isEmpty(), plusFound = false;
|
||||||
|
int curPart = 0, leftInPart = inPart ? pattern.at(curPart) : 0;
|
||||||
|
newText.reserve(oldLen + 1);
|
||||||
|
newText.append('+');
|
||||||
|
for (int i = 0; i < oldLen; ++i) {
|
||||||
|
if (i == oldPos && newPos < 0) {
|
||||||
|
newPos = newText.length();
|
||||||
|
}
|
||||||
|
|
||||||
|
QChar ch(now[i]);
|
||||||
|
if (ch.isDigit()) {
|
||||||
|
if (!digitCount--) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (inPart) {
|
||||||
|
if (leftInPart) {
|
||||||
|
--leftInPart;
|
||||||
|
} else {
|
||||||
|
newText += ' ';
|
||||||
|
++curPart;
|
||||||
|
inPart = curPart < pattern.size();
|
||||||
|
leftInPart = inPart ? (pattern.at(curPart) - 1) : 0;
|
||||||
|
|
||||||
|
++oldPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newText += ch;
|
||||||
|
} else if (ch == ' ' || ch == '-' || ch == '(' || ch == ')') {
|
||||||
|
if (inPart) {
|
||||||
|
if (leftInPart) {
|
||||||
|
} else {
|
||||||
|
newText += ch;
|
||||||
|
++curPart;
|
||||||
|
inPart = curPart < pattern.size();
|
||||||
|
leftInPart = inPart ? pattern.at(curPart) : 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newText += ch;
|
||||||
|
}
|
||||||
|
} else if (ch == '+') {
|
||||||
|
plusFound = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!plusFound && newText == qstr("+")) {
|
||||||
|
newText = QString();
|
||||||
|
newPos = 0;
|
||||||
|
}
|
||||||
|
int32 newlen = newText.size();
|
||||||
|
while (newlen > 0 && newText.at(newlen - 1).isSpace()) {
|
||||||
|
--newlen;
|
||||||
|
}
|
||||||
|
if (newlen < newText.size()) newText = newText.mid(0, newlen);
|
||||||
|
if (newPos < 0) {
|
||||||
|
newPos = newText.length();
|
||||||
|
}
|
||||||
|
if (newText != now) {
|
||||||
|
now = newText;
|
||||||
|
setText(newText);
|
||||||
|
updatePlaceholder();
|
||||||
|
setCursorPosition(newPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -135,12 +135,12 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PhoneInput : public FlatInput {
|
class PhonePartInput : public FlatInput {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PhoneInput(QWidget *parent, const style::flatInput &st);
|
PhonePartInput(QWidget *parent, const style::flatInput &st);
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
@ -203,6 +203,7 @@ public:
|
|||||||
bool isRedoAvailable() const;
|
bool isRedoAvailable() const;
|
||||||
|
|
||||||
void customUpDown(bool isCustom);
|
void customUpDown(bool isCustom);
|
||||||
|
void setCtrlEnterSubmit(bool ctrlEnterSubmit);
|
||||||
|
|
||||||
void setTextCursor(const QTextCursor &cursor) {
|
void setTextCursor(const QTextCursor &cursor) {
|
||||||
return _inner.setTextCursor(cursor);
|
return _inner.setTextCursor(cursor);
|
||||||
@ -333,6 +334,10 @@ public:
|
|||||||
void contextMenuEvent(QContextMenuEvent *e);
|
void contextMenuEvent(QContextMenuEvent *e);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
|
void setMaxLength(int32 maxLength) {
|
||||||
|
_maxLength = maxLength;
|
||||||
|
}
|
||||||
|
|
||||||
void showError();
|
void showError();
|
||||||
|
|
||||||
const QString &getLastText() const {
|
const QString &getLastText() const {
|
||||||
@ -397,6 +402,8 @@ public slots:
|
|||||||
void onUndoAvailable(bool avail);
|
void onUndoAvailable(bool avail);
|
||||||
void onRedoAvailable(bool avail);
|
void onRedoAvailable(bool avail);
|
||||||
|
|
||||||
|
void selectAll();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void changed();
|
void changed();
|
||||||
@ -499,7 +506,7 @@ public:
|
|||||||
|
|
||||||
void showError();
|
void showError();
|
||||||
|
|
||||||
void setPlaceholder(const QString &ph);
|
bool setPlaceholder(const QString &ph);
|
||||||
void setPlaceholderFast(bool fast);
|
void setPlaceholderFast(bool fast);
|
||||||
void updatePlaceholder();
|
void updatePlaceholder();
|
||||||
|
|
||||||
@ -591,9 +598,14 @@ private:
|
|||||||
QPoint _touchStart;
|
QPoint _touchStart;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PortInput : public MaskedInputField {
|
class PasswordField : public MaskedInputField {
|
||||||
Q_OBJECT
|
public:
|
||||||
|
|
||||||
|
PasswordField(QWidget *parent, const style::InputField &st, const QString &ph = QString(), const QString &val = QString());
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class PortInput : public MaskedInputField {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PortInput(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val);
|
PortInput(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val);
|
||||||
@ -619,3 +631,23 @@ private:
|
|||||||
QString _linkPlaceholder;
|
QString _linkPlaceholder;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PhoneInput : public MaskedInputField {
|
||||||
|
public:
|
||||||
|
|
||||||
|
PhoneInput(QWidget *parent, const style::InputField &st, const QString &ph, const QString &val);
|
||||||
|
|
||||||
|
void focusInEvent(QFocusEvent *e);
|
||||||
|
void clearText();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void paintPlaceholder(Painter &p);
|
||||||
|
void correctValue(const QString &was, int32 wasCursor, QString &now, int32 &nowCursor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
QString _defaultPlaceholder;
|
||||||
|
QVector<int> pattern;
|
||||||
|
|
||||||
|
};
|
||||||
|
@ -1100,6 +1100,9 @@ public:
|
|||||||
virtual ImagePtr replyPreview() {
|
virtual ImagePtr replyPreview() {
|
||||||
return ImagePtr();
|
return ImagePtr();
|
||||||
}
|
}
|
||||||
|
virtual QString getCaption() const {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
int32 currentWidth() const {
|
int32 currentWidth() const {
|
||||||
return qMin(w, _maxw);
|
return qMin(w, _maxw);
|
||||||
@ -1152,6 +1155,10 @@ public:
|
|||||||
}
|
}
|
||||||
ImagePtr replyPreview();
|
ImagePtr replyPreview();
|
||||||
|
|
||||||
|
QString getCaption() const {
|
||||||
|
return _caption.original(0, 0xFFFFU, true);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int16 pixw, pixh;
|
int16 pixw, pixh;
|
||||||
PhotoData *data;
|
PhotoData *data;
|
||||||
|
@ -67,6 +67,7 @@ HistoryInner::HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, His
|
|||||||
, _touchAccelerationTime(0)
|
, _touchAccelerationTime(0)
|
||||||
, _touchTime(0)
|
, _touchTime(0)
|
||||||
, _menu(0) {
|
, _menu(0) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
|
|
||||||
linkTipTimer.setSingleShot(true);
|
linkTipTimer.setSingleShot(true);
|
||||||
connect(&linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip()));
|
connect(&linkTipTimer, SIGNAL(timeout()), this, SLOT(showLinkTip()));
|
||||||
@ -2037,7 +2038,7 @@ HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(p
|
|||||||
, _forwardSelected(forwardSelected)
|
, _forwardSelected(forwardSelected)
|
||||||
, _sendPath(false)
|
, _sendPath(false)
|
||||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||||
, _cancel(this, lang(lng_box_cancel), st::cancelBoxButton)
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||||
, offered(0)
|
, offered(0)
|
||||||
, a_opacity(0, 1)
|
, a_opacity(0, 1)
|
||||||
, hiding(false)
|
, hiding(false)
|
||||||
@ -2053,7 +2054,7 @@ HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidge
|
|||||||
, _forwardSelected(false)
|
, _forwardSelected(false)
|
||||||
, _sendPath(false)
|
, _sendPath(false)
|
||||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||||
, _cancel(this, lang(lng_box_cancel), st::cancelBoxButton)
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||||
, offered(0)
|
, offered(0)
|
||||||
, a_opacity(0, 1)
|
, a_opacity(0, 1)
|
||||||
, hiding(false)
|
, hiding(false)
|
||||||
@ -2069,7 +2070,7 @@ HistoryHider::HistoryHider(MainWidget *parent) : QWidget(parent)
|
|||||||
, _forwardSelected(false)
|
, _forwardSelected(false)
|
||||||
, _sendPath(true)
|
, _sendPath(true)
|
||||||
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
, _send(this, lang(lng_forward_send), st::defaultBoxButton)
|
||||||
, _cancel(this, lang(lng_box_cancel), st::cancelBoxButton)
|
, _cancel(this, lang(lng_cancel), st::cancelBoxButton)
|
||||||
, offered(0)
|
, offered(0)
|
||||||
, a_opacity(0, 1)
|
, a_opacity(0, 1)
|
||||||
, hiding(false)
|
, hiding(false)
|
||||||
@ -2116,7 +2117,7 @@ void HistoryHider::paintEvent(QPaintEvent *e) {
|
|||||||
Painter p(this);
|
Painter p(this);
|
||||||
if (!hiding || !cacheForAnim.isNull() || !offered) {
|
if (!hiding || !cacheForAnim.isNull() || !offered) {
|
||||||
p.setOpacity(a_opacity.current() * st::layerAlpha);
|
p.setOpacity(a_opacity.current() * st::layerAlpha);
|
||||||
p.fillRect(rect(), st::layerBG->b);
|
p.fillRect(rect(), st::layerBg->b);
|
||||||
p.setOpacity(a_opacity.current());
|
p.setOpacity(a_opacity.current());
|
||||||
}
|
}
|
||||||
if (cacheForAnim.isNull() || !offered) {
|
if (cacheForAnim.isNull() || !offered) {
|
||||||
@ -2125,7 +2126,7 @@ void HistoryHider::paintEvent(QPaintEvent *e) {
|
|||||||
shadow.paint(p, box, st::boxShadowShift);
|
shadow.paint(p, box, st::boxShadowShift);
|
||||||
|
|
||||||
// fill bg
|
// fill bg
|
||||||
p.fillRect(box, st::boxBG->b);
|
p.fillRect(box, st::boxBg->b);
|
||||||
|
|
||||||
p.setPen(st::black->p);
|
p.setPen(st::black->p);
|
||||||
toText.drawElided(p, box.left() + st::boxPadding.left(), box.top() + st::boxPadding.top(), toTextWidth + 2);
|
toText.drawElided(p, box.left() + st::boxPadding.left(), box.top() + st::boxPadding.top(), toTextWidth + 2);
|
||||||
@ -2255,8 +2256,8 @@ bool HistoryHider::offerPeer(PeerId peer) {
|
|||||||
|
|
||||||
toText.setText(st::boxTextFont, phrase, _textNameOptions);
|
toText.setText(st::boxTextFont, phrase, _textNameOptions);
|
||||||
toTextWidth = toText.maxWidth();
|
toTextWidth = toText.maxWidth();
|
||||||
if (toTextWidth > box.width() - st::boxPadding.left() - st::boxPadding.right()) {
|
if (toTextWidth > box.width() - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
||||||
toTextWidth = box.width() - st::boxPadding.left() - st::boxPadding.right();
|
toTextWidth = box.width() - st::boxPadding.left() - st::boxButtonPadding.right();
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeEvent(0);
|
resizeEvent(0);
|
||||||
@ -4878,7 +4879,7 @@ void HistoryWidget::confirmSendImage(const ReadyLocalMedia &img) {
|
|||||||
flags |= MTPDmessage::flag_from_id;
|
flags |= MTPDmessage::flag_from_id;
|
||||||
}
|
}
|
||||||
if (img.type == ToPreparePhoto) {
|
if (img.type == ToPreparePhoto) {
|
||||||
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string("")), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(img.photo, MTP_string(img.caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
||||||
} else if (img.type == ToPrepareDocument) {
|
} else if (img.type == ToPrepareDocument) {
|
||||||
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(img.peer), MTPPeer(), MTPint(), MTP_int(img.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(img.document), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
|
||||||
} else if (img.type == ToPrepareAudio) {
|
} else if (img.type == ToPrepareAudio) {
|
||||||
@ -4919,7 +4920,8 @@ void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, const MTPInputFile &
|
|||||||
if (fromChannelName) {
|
if (fromChannelName) {
|
||||||
sendFlags |= MTPmessages_SendMessage_flag_broadcast;
|
sendFlags |= MTPmessages_SendMessage_flag_broadcast;
|
||||||
}
|
}
|
||||||
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string("")), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFail, randomId), 0, 0, hist->sendRequestId);
|
QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString();
|
||||||
|
hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendPhotoFail, randomId), 0, 0, hist->sendRequestId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,6 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent),
|
|||||||
connect(&code, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
|
connect(&code, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
|
||||||
connect(&country, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
|
connect(&country, SIGNAL(codeChanged(const QString &)), &phone, SLOT(onChooseCode(const QString &)));
|
||||||
connect(&code, SIGNAL(addedToNumber(const QString &)), &phone, SLOT(addedToNumber(const QString &)));
|
connect(&code, SIGNAL(addedToNumber(const QString &)), &phone, SLOT(addedToNumber(const QString &)));
|
||||||
connect(&country, SIGNAL(selectClosed()), this, SLOT(onSelectClose()));
|
|
||||||
connect(&phone, SIGNAL(changed()), this, SLOT(onInputChange()));
|
connect(&phone, SIGNAL(changed()), this, SLOT(onInputChange()));
|
||||||
connect(&code, SIGNAL(changed()), this, SLOT(onInputChange()));
|
connect(&code, SIGNAL(changed()), this, SLOT(onInputChange()));
|
||||||
connect(intro(), SIGNAL(countryChanged()), this, SLOT(countryChanged()));
|
connect(intro(), SIGNAL(countryChanged()), this, SLOT(countryChanged()));
|
||||||
@ -162,10 +161,6 @@ void IntroPhone::countryChanged() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntroPhone::onSelectClose() {
|
|
||||||
phone.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IntroPhone::onInputChange() {
|
void IntroPhone::onInputChange() {
|
||||||
changed = true;
|
changed = true;
|
||||||
showError("");
|
showError("");
|
||||||
|
@ -53,7 +53,6 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void countryChanged();
|
void countryChanged();
|
||||||
void onSelectClose();
|
|
||||||
void onInputChange();
|
void onInputChange();
|
||||||
void onSubmitPhone(bool force = false);
|
void onSubmitPhone(bool force = false);
|
||||||
void onCheckRequest();
|
void onCheckRequest();
|
||||||
@ -76,7 +75,7 @@ private:
|
|||||||
QRect textRect;
|
QRect textRect;
|
||||||
|
|
||||||
CountryInput country;
|
CountryInput country;
|
||||||
PhoneInput phone;
|
PhonePartInput phone;
|
||||||
CountryCodeInput code;
|
CountryCodeInput code;
|
||||||
|
|
||||||
FlatLabel _signup;
|
FlatLabel _signup;
|
||||||
|
@ -54,7 +54,7 @@ void BackgroundWidget::paintEvent(QPaintEvent *e) {
|
|||||||
p.setClipRect(e->rect());
|
p.setClipRect(e->rect());
|
||||||
}
|
}
|
||||||
p.setOpacity(st::layerAlpha * aBackground.current());
|
p.setOpacity(st::layerAlpha * aBackground.current());
|
||||||
p.fillRect(rect(), st::layerBG->b);
|
p.fillRect(rect(), st::layerBg->b);
|
||||||
|
|
||||||
p.setOpacity(aBackground.current());
|
p.setOpacity(aBackground.current());
|
||||||
shadow.paint(p, w->geometry(), st::boxShadowShift);
|
shadow.paint(p, w->geometry(), st::boxShadowShift);
|
||||||
|
@ -81,6 +81,7 @@ struct ReadyLocalMedia {
|
|||||||
|
|
||||||
bool broadcast;
|
bool broadcast;
|
||||||
bool ctrlShiftEnter;
|
bool ctrlShiftEnter;
|
||||||
|
QString caption;
|
||||||
};
|
};
|
||||||
typedef QList<ReadyLocalMedia> ReadyLocalMedias;
|
typedef QList<ReadyLocalMedia> ReadyLocalMedias;
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ void TopBarWidget::onEdit() {
|
|||||||
App::wnd()->showLayer(new EditChannelBox(p->asChannel()));
|
App::wnd()->showLayer(new EditChannelBox(p->asChannel()));
|
||||||
} else if (p->isChat()) {
|
} else if (p->isChat()) {
|
||||||
App::wnd()->showLayer(new EditNameTitleBox(p));
|
App::wnd()->showLayer(new EditNameTitleBox(p));
|
||||||
} else {
|
} else if (p->isUser()) {
|
||||||
App::wnd()->showLayer(new AddContactBox(p));
|
App::wnd()->showLayer(new AddContactBox(p->asUser()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, ScrollArea *scroll, const
|
|||||||
, _touchAccelerationTime(0)
|
, _touchAccelerationTime(0)
|
||||||
, _touchTime(0)
|
, _touchTime(0)
|
||||||
, _menu(0) {
|
, _menu(0) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
|
|
||||||
resize(_width, height());
|
resize(_width, height());
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ void PasscodeWidget::paintEvent(QPaintEvent *e) {
|
|||||||
p.drawText(QRect(0, _passcode.y() - st::passcodeHeaderHeight, width(), st::passcodeHeaderHeight), lang(lng_passcode_enter), style::al_center);
|
p.drawText(QRect(0, _passcode.y() - st::passcodeHeaderHeight, width(), st::passcodeHeaderHeight), lang(lng_passcode_enter), style::al_center);
|
||||||
|
|
||||||
if (!_error.isEmpty()) {
|
if (!_error.isEmpty()) {
|
||||||
p.setFont(st::boxFont->f);
|
p.setFont(st::boxTextFont->f);
|
||||||
p.setPen(st::setErrColor->p);
|
p.setPen(st::setErrColor->p);
|
||||||
p.drawText(QRect(0, _passcode.y() + _passcode.height(), width(), st::usernameSkip), _error, style::al_center);
|
p.drawText(QRect(0, _passcode.y() + _passcode.height(), width(), st::usernameSkip), _error, style::al_center);
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
|||||||
_kickOver(0), _kickDown(0), _kickConfirm(0),
|
_kickOver(0), _kickDown(0), _kickConfirm(0),
|
||||||
|
|
||||||
_menu(0) {
|
_menu(0) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
|
|
||||||
connect(App::api(), SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*)));
|
connect(App::api(), SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*)));
|
||||||
|
|
||||||
|
@ -199,6 +199,8 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent),
|
|||||||
_supportGetRequest(0)
|
_supportGetRequest(0)
|
||||||
{
|
{
|
||||||
if (self()) {
|
if (self()) {
|
||||||
|
connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update()));
|
||||||
|
|
||||||
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
|
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
|
||||||
PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
|
PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
|
||||||
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
|
||||||
@ -1207,12 +1209,12 @@ void SettingsInner::chooseCustomLang() {
|
|||||||
QByteArray arr;
|
QByteArray arr;
|
||||||
if (filedialogGetOpenFile(file, arr, qsl("Choose language .strings file"), qsl("Language files (*.strings)"))) {
|
if (filedialogGetOpenFile(file, arr, qsl("Choose language .strings file"), qsl("Language files (*.strings)"))) {
|
||||||
_testlang = QFileInfo(file).absoluteFilePath();
|
_testlang = QFileInfo(file).absoluteFilePath();
|
||||||
LangLoaderPlain loader(_testlang, LangLoaderRequest(lng_sure_save_language, lng_box_cancel, lng_box_ok));
|
LangLoaderPlain loader(_testlang, LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_box_ok));
|
||||||
if (loader.errors().isEmpty()) {
|
if (loader.errors().isEmpty()) {
|
||||||
LangLoaderResult result = loader.found();
|
LangLoaderResult result = loader.found();
|
||||||
QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)),
|
QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)),
|
||||||
save = result.value(lng_box_ok, langOriginal(lng_box_ok)),
|
save = result.value(lng_box_ok, langOriginal(lng_box_ok)),
|
||||||
cancel = result.value(lng_box_cancel, langOriginal(lng_box_cancel));
|
cancel = result.value(lng_cancel, langOriginal(lng_cancel));
|
||||||
ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
|
ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
|
||||||
connect(box, SIGNAL(confirmed()), this, SLOT(onSaveTestLang()));
|
connect(box, SIGNAL(confirmed()), this, SLOT(onSaveTestLang()));
|
||||||
App::wnd()->showLayer(box);
|
App::wnd()->showLayer(box);
|
||||||
|
@ -35,7 +35,7 @@ TitleHider::TitleHider(QWidget *parent) : QWidget(parent), _level(0) {
|
|||||||
void TitleHider::paintEvent(QPaintEvent *e) {
|
void TitleHider::paintEvent(QPaintEvent *e) {
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.setOpacity(_level * st::layerAlpha);
|
p.setOpacity(_level * st::layerAlpha);
|
||||||
p.fillRect(App::main()->dlgsWidth() - st::dlgShadow, 0, width() + st::dlgShadow - App::main()->dlgsWidth(), height(), st::layerBG->b);
|
p.fillRect(App::main()->dlgsWidth() - st::dlgShadow, 0, width() + st::dlgShadow - App::main()->dlgsWidth(), height(), st::layerBg->b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TitleHider::mousePressEvent(QMouseEvent *e) {
|
void TitleHider::mousePressEvent(QMouseEvent *e) {
|
||||||
|
@ -34,6 +34,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
|
|||||||
#include "settingswidget.h"
|
#include "settingswidget.h"
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
#include "boxes/contactsbox.h"
|
#include "boxes/contactsbox.h"
|
||||||
|
#include "boxes/addcontactbox.h"
|
||||||
|
|
||||||
#include "mediaview.h"
|
#include "mediaview.h"
|
||||||
#include "localstorage.h"
|
#include "localstorage.h"
|
||||||
@ -357,7 +358,7 @@ NotifyWindow::~NotifyWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Window::Window(QWidget *parent) : PsMainWindow(parent), _serviceHistoryRequest(0), title(0),
|
Window::Window(QWidget *parent) : PsMainWindow(parent), _serviceHistoryRequest(0), title(0),
|
||||||
_passcode(0), intro(0), main(0), settings(0), layerBG(0), _isActive(false), _topWidget(0),
|
_passcode(0), intro(0), main(0), settings(0), layerBg(0), _isActive(false),
|
||||||
_connecting(0), _clearManager(0), dragging(false), _inactivePress(false), _shouldLockAt(0), _mediaView(0) {
|
_connecting(0), _clearManager(0), dragging(false), _inactivePress(false), _shouldLockAt(0), _mediaView(0) {
|
||||||
|
|
||||||
icon16 = icon256.scaledToWidth(16, Qt::SmoothTransformation);
|
icon16 = icon256.scaledToWidth(16, Qt::SmoothTransformation);
|
||||||
@ -389,7 +390,6 @@ _connecting(0), _clearManager(0), dragging(false), _inactivePress(false), _shoul
|
|||||||
|
|
||||||
connect(&_autoLockTimer, SIGNAL(timeout()), this, SLOT(checkAutoLock()));
|
connect(&_autoLockTimer, SIGNAL(timeout()), this, SLOT(checkAutoLock()));
|
||||||
|
|
||||||
connect(this, SIGNAL(imageLoaded()), this, SLOT(update()));
|
|
||||||
connect(this, SIGNAL(imageLoaded()), this, SLOT(notifyUpdateAllPhotos()));
|
connect(this, SIGNAL(imageLoaded()), this, SLOT(notifyUpdateAllPhotos()));
|
||||||
|
|
||||||
setAttribute(Qt::WA_NoSystemBackground);
|
setAttribute(Qt::WA_NoSystemBackground);
|
||||||
@ -776,17 +776,17 @@ void Window::showDocument(DocumentData *doc, HistoryItem *item) {
|
|||||||
void Window::showLayer(LayeredWidget *w, bool forceFast) {
|
void Window::showLayer(LayeredWidget *w, bool forceFast) {
|
||||||
bool fast = forceFast || layerShown();
|
bool fast = forceFast || layerShown();
|
||||||
hideLayer(true);
|
hideLayer(true);
|
||||||
layerBG = new BackgroundWidget(this, w);
|
layerBg = new BackgroundWidget(this, w);
|
||||||
if (fast) {
|
if (fast) {
|
||||||
layerBG->showFast();
|
layerBg->showFast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::replaceLayer(LayeredWidget *w) {
|
void Window::replaceLayer(LayeredWidget *w) {
|
||||||
if (layerBG) {
|
if (layerBg) {
|
||||||
layerBG->replaceInner(w);
|
layerBg->replaceInner(w);
|
||||||
} else {
|
} else {
|
||||||
layerBG = new BackgroundWidget(this, w);
|
layerBg = new BackgroundWidget(this, w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,26 +815,26 @@ void Window::hideConnecting() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::hideLayer(bool fast) {
|
void Window::hideLayer(bool fast) {
|
||||||
if (layerBG) {
|
if (layerBg) {
|
||||||
layerBG->onClose();
|
layerBg->onClose();
|
||||||
if (fast) {
|
if (fast) {
|
||||||
layerBG->hide();
|
layerBg->hide();
|
||||||
layerBG->deleteLater();
|
layerBg->deleteLater();
|
||||||
layerBG = 0;
|
layerBg = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hideMediaview();
|
hideMediaview();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::hideInnerLayer() {
|
bool Window::hideInnerLayer() {
|
||||||
if (layerBG) {
|
if (layerBg) {
|
||||||
return layerBG->onInnerClose();
|
return layerBg->onInnerClose();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::layerShown() {
|
bool Window::layerShown() {
|
||||||
return !!layerBG || !!_topWidget;
|
return !!layerBg;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::historyIsActive() const {
|
bool Window::historyIsActive() const {
|
||||||
@ -849,11 +849,11 @@ void Window::checkHistoryActivation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::layerHidden() {
|
void Window::layerHidden() {
|
||||||
if (layerBG) {
|
if (layerBg) {
|
||||||
layerBG->hide();
|
layerBg->hide();
|
||||||
layerBG->deleteLater();
|
layerBg->deleteLater();
|
||||||
}
|
}
|
||||||
layerBG = 0;
|
layerBg = 0;
|
||||||
hideMediaview();
|
hideMediaview();
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}
|
}
|
||||||
@ -871,13 +871,13 @@ void Window::hideMediaview() {
|
|||||||
|
|
||||||
bool Window::contentOverlapped(const QRect &globalRect) {
|
bool Window::contentOverlapped(const QRect &globalRect) {
|
||||||
if (main && main->contentOverlapped(globalRect)) return true;
|
if (main && main->contentOverlapped(globalRect)) return true;
|
||||||
if (layerBG && layerBG->contentOverlapped(globalRect)) return true;
|
if (layerBg && layerBg->contentOverlapped(globalRect)) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setInnerFocus() {
|
void Window::setInnerFocus() {
|
||||||
if (layerBG && layerBG->canSetFocus()) {
|
if (layerBg && layerBg->canSetFocus()) {
|
||||||
layerBG->setInnerFocus();
|
layerBg->setInnerFocus();
|
||||||
} else if (_passcode) {
|
} else if (_passcode) {
|
||||||
_passcode->setInnerFocus();
|
_passcode->setInnerFocus();
|
||||||
} else if (settings) {
|
} else if (settings) {
|
||||||
@ -1063,7 +1063,7 @@ void Window::onShowNewChannel() {
|
|||||||
void Window::onLogout() {
|
void Window::onLogout() {
|
||||||
if (isHidden()) showFromTray();
|
if (isHidden()) showFromTray();
|
||||||
|
|
||||||
ConfirmBox *box = new ConfirmBox(lang(lng_sure_logout), lang(lng_box_logout), st::attentionBoxButton);
|
ConfirmBox *box = new ConfirmBox(lang(lng_sure_logout), lang(lng_settings_logout), st::attentionBoxButton);
|
||||||
connect(box, SIGNAL(confirmed()), this, SLOT(onLogoutSure()));
|
connect(box, SIGNAL(confirmed()), this, SLOT(onLogoutSure()));
|
||||||
App::wnd()->showLayer(box);
|
App::wnd()->showLayer(box);
|
||||||
}
|
}
|
||||||
@ -1116,34 +1116,23 @@ void Window::noMain(MainWidget *was) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::noBox(BackgroundWidget *was) {
|
void Window::noBox(BackgroundWidget *was) {
|
||||||
if (was == layerBG) {
|
if (was == layerBg) {
|
||||||
layerBG = 0;
|
layerBg = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::layerFinishedHide(BackgroundWidget *was) {
|
void Window::layerFinishedHide(BackgroundWidget *was) {
|
||||||
if (was == layerBG) {
|
if (was == layerBg) {
|
||||||
QTimer::singleShot(0, this, SLOT(layerHidden()));
|
QTimer::singleShot(0, this, SLOT(layerHidden()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::fixOrder() {
|
void Window::fixOrder() {
|
||||||
title->raise();
|
title->raise();
|
||||||
if (layerBG) layerBG->raise();
|
if (layerBg) layerBg->raise();
|
||||||
if (_topWidget) _topWidget->raise();
|
|
||||||
if (_connecting) _connecting->raise();
|
if (_connecting) _connecting->raise();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::topWidget(QWidget *w) {
|
|
||||||
_topWidget = w;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::noTopWidget(QWidget *w) {
|
|
||||||
if (_topWidget == w) {
|
|
||||||
_topWidget = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::showFromTray(QSystemTrayIcon::ActivationReason reason) {
|
void Window::showFromTray(QSystemTrayIcon::ActivationReason reason) {
|
||||||
if (reason != QSystemTrayIcon::Context) {
|
if (reason != QSystemTrayIcon::Context) {
|
||||||
QTimer::singleShot(1, this, SLOT(updateTrayMenu()));
|
QTimer::singleShot(1, this, SLOT(updateTrayMenu()));
|
||||||
@ -1168,7 +1157,7 @@ void Window::toggleTray(QSystemTrayIcon::ActivationReason reason) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Window::closeEvent(QCloseEvent *e) {
|
void Window::closeEvent(QCloseEvent *e) {
|
||||||
if (MTP::authedId() && minimizeToTray()) {
|
if (MTP::authedId() && !App::app()->isSavingSession() && minimizeToTray()) {
|
||||||
e->ignore();
|
e->ignore();
|
||||||
} else {
|
} else {
|
||||||
App::quit();
|
App::quit();
|
||||||
@ -1188,7 +1177,7 @@ void Window::resizeEvent(QResizeEvent *e) {
|
|||||||
updateWideMode();
|
updateWideMode();
|
||||||
}
|
}
|
||||||
title->setGeometry(0, 0, width(), st::titleHeight);
|
title->setGeometry(0, 0, width(), st::titleHeight);
|
||||||
if (layerBG) layerBG->resize(width(), height());
|
if (layerBg) layerBg->resize(width(), height());
|
||||||
if (_connecting) _connecting->setGeometry(0, height() - _connecting->height(), _connecting->width(), _connecting->height());
|
if (_connecting) _connecting->setGeometry(0, height() - _connecting->height(), _connecting->width(), _connecting->height());
|
||||||
emit resized(QSize(width(), height() - st::titleHeight));
|
emit resized(QSize(width(), height() - st::titleHeight));
|
||||||
}
|
}
|
||||||
@ -1198,7 +1187,7 @@ void Window::updateWideMode() {
|
|||||||
if (main) main->updateWideMode();
|
if (main) main->updateWideMode();
|
||||||
if (settings) settings->updateWideMode();
|
if (settings) settings->updateWideMode();
|
||||||
if (intro) intro->updateWideMode();
|
if (intro) intro->updateWideMode();
|
||||||
if (layerBG) layerBG->updateWideMode();
|
if (layerBg) layerBg->updateWideMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::needBackButton() {
|
bool Window::needBackButton() {
|
||||||
|
@ -198,9 +198,6 @@ public:
|
|||||||
void noBox(BackgroundWidget *was);
|
void noBox(BackgroundWidget *was);
|
||||||
void layerFinishedHide(BackgroundWidget *was);
|
void layerFinishedHide(BackgroundWidget *was);
|
||||||
|
|
||||||
void topWidget(QWidget *w);
|
|
||||||
void noTopWidget(QWidget *w);
|
|
||||||
|
|
||||||
void fixOrder();
|
void fixOrder();
|
||||||
|
|
||||||
enum TempDirState {
|
enum TempDirState {
|
||||||
@ -309,12 +306,11 @@ private:
|
|||||||
IntroWidget *intro;
|
IntroWidget *intro;
|
||||||
MainWidget *main;
|
MainWidget *main;
|
||||||
SettingsWidget *settings;
|
SettingsWidget *settings;
|
||||||
BackgroundWidget *layerBG;
|
BackgroundWidget *layerBg;
|
||||||
|
|
||||||
QTimer _isActiveTimer;
|
QTimer _isActiveTimer;
|
||||||
bool _isActive;
|
bool _isActive;
|
||||||
|
|
||||||
QWidget *_topWidget; // temp hack for CountrySelect
|
|
||||||
ConnectingWidget *_connecting;
|
ConnectingWidget *_connecting;
|
||||||
|
|
||||||
Local::ClearManager *_clearManager;
|
Local::ClearManager *_clearManager;
|
||||||
|
Loading…
Reference in New Issue
Block a user