This commit is contained in:
John Preston 2015-10-03 19:01:27 +03:00
commit cb7b736fb8
210 changed files with 1659 additions and 890 deletions

17
LICENSE
View File

@ -1,4 +1,17 @@
GNU GENERAL PUBLIC LICENSE Telegram Desktop is licensed under the GNU General Public License
version 3 with the addition of the following special exception:
In addition, as a special exception, the copyright holders give
permission to link the code of portions of this program with the OpenSSL
library.
You must obey the GNU General Public License in all respects for all of
the code used other than OpenSSL. If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so, delete
this exception statement from your version. If you delete this exception
statement from all source files in the program, then also delete it here.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@ -671,4 +684,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -2,7 +2,7 @@
This is the complete source code and the build instructions for the alpha version of the official desktop client for the [Telegram][telegram] messenger, based on the [Telegram API][telegram_api] and the [MTProto][telegram_proto] secure protocol. This is the complete source code and the build instructions for the alpha version of the official desktop client for the [Telegram][telegram] messenger, based on the [Telegram API][telegram_api] and the [MTProto][telegram_proto] secure protocol.
The source code is published under GPLv3, the license is available [here][license]. The source code is published under GPLv3 with OpenSSL exception, the license is available [here][license].
## Supported systems ## Supported systems
@ -23,7 +23,7 @@ The source code is published under GPLv3, the license is available [here][licens
* OpenAL Soft ([LGPL](http://kcat.strangesoft.net/openal.html)) * OpenAL Soft ([LGPL](http://kcat.strangesoft.net/openal.html))
* Opus codec ([BSD license](http://www.opus-codec.org/license/)) * Opus codec ([BSD license](http://www.opus-codec.org/license/))
* FFmpeg ([LGPL](https://www.ffmpeg.org/legal.html)) * FFmpeg ([LGPL](https://www.ffmpeg.org/legal.html))
* Open Sans font ([Apache License](http://www.apache.org/licenses/LICENSE-2.0.html)) * Open Sans font ([Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html))
## Build instructions ## Build instructions

View File

@ -45,7 +45,7 @@ elif [ "$BuildTarget" == "mac" ]; then
WinDeployPath="./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull" WinDeployPath="./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull"
WinUpdateFile="tupdate$AppVersion" WinUpdateFile="tupdate$AppVersion"
WinSetupFile="tsetup.$AppVersionStrFull.exe" WinSetupFile="tsetup.$AppVersionStrFull.exe"
WinPortableFile="tportable.$AppVersionStr.zip" WinPortableFile="tportable.$AppVersionStrFull.zip"
WinRemoteFolder="tsetup" WinRemoteFolder="tsetup"
DropboxPath="./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor" DropboxPath="./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor"
DropboxDeployPath="$DropboxPath/$AppVersionStrFull" DropboxDeployPath="$DropboxPath/$AppVersionStrFull"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
"lng_language_name" = "English"; "lng_language_name" = "English";
"lng_switch_to_this" = "Switch to English"; "lng_switch_to_this" = "Switch to English";
@ -62,6 +65,9 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_month_day" = "{month} {day}"; "lng_month_day" = "{month} {day}";
"lng_month_day_year" = "{month} {day}, {year}"; "lng_month_day_year" = "{month} {day}, {year}";
"lng_box_ok" = "OK";
"lng_box_cancel" = "CANCEL";
"lng_cancel" = "Cancel"; "lng_cancel" = "Cancel";
"lng_continue" = "Continue"; "lng_continue" = "Continue";
"lng_close" = "Close"; "lng_close" = "Close";
@ -152,8 +158,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_signin_no_email_forgot" = "Since you haven't provided a recovery\ne-mail when setting up your password, your remaining options are either to remember your password or to reset your account."; "lng_signin_no_email_forgot" = "Since you haven't provided a recovery\ne-mail when setting up your password, 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_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_sigin_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_sigin_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.";
@ -248,7 +254,7 @@ Copyright (c) 2014 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" = "Go to 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!";
@ -305,7 +311,8 @@ Copyright (c) 2014 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_almost" = "A confirmation link was sent\nto the e-mail you provided.\n\nTwo-step verification will be enabled\nas soon as you follow that link."; "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_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.";
"lng_cloud_password_removed" = "Two-step verification was disabled."; "lng_cloud_password_removed" = "Two-step verification was disabled.";
@ -332,19 +339,20 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"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\nsome 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";
"lng_settings_restart_later" = "Later"; "lng_settings_restart_later" = "LATER";
"lng_sessions_header" = "Current session"; "lng_sessions_header" = "Current session";
"lng_sessions_other_header" = "Active sessions"; "lng_sessions_other_header" = "Active sessions";
@ -416,12 +424,12 @@ Copyright (c) 2014 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\n{count} members to a channel personally.\n\nFrom now on, people will need\nto 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, they can have up to {count} members"; "lng_create_group_about" = "Groups are ideal for smaller communities, they can have up to {count:_not_used|# member|# members}";
"lng_create_channel_title" = "New Channel"; "lng_create_channel_title" = "New Channel";
"lng_create_channel_about" = "Channels are a tool for broadcasting your messages to unlimited audiences"; "lng_create_channel_about" = "Channels are a tool for broadcasting your messages to unlimited audiences";
"lng_create_public_channel_title" = "Public Channel"; "lng_create_public_channel_title" = "Public Channel";
@ -451,8 +459,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_sure_delete_history" = "Are you sure, you want to delete all message history with {contact}?\n\nThis action cannot be undone."; "lng_sure_delete_history" = "Are you sure, you want to delete all message history with {contact}?\n\nThis action cannot be undone.";
"lng_sure_delete_group_history" = "Are you sure, you want to delete all message history in «{group}»?\n\nThis action cannot be undone."; "lng_sure_delete_group_history" = "Are you sure, you want to delete all message history in «{group}»?\n\nThis action cannot be undone.";
"lng_sure_delete_and_exit" = "Are you sure, you want to delete all message history and leave «{group}»?\n\nThis action cannot be undone."; "lng_sure_delete_and_exit" = "Are you sure, you want to delete all message history and leave «{group}»?\n\nThis action cannot be undone.";
"lng_sure_leave_channel" = "Are you sure, you want\nto leave this channel?"; "lng_sure_leave_channel" = "Are you sure, you want to leave\nthis channel?";
"lng_sure_delete_channel" = "Are you sure, you want\nto delete this channel?\n\nAll members will be removed\nand all messages will be lost."; "lng_sure_delete_channel" = "Are you sure, you want to delete this channel? All members will be removed and all messages will be lost.";
"lng_message_empty" = "Empty Message"; "lng_message_empty" = "Empty Message";
"lng_media_unsupported" = "Media Unsupported"; "lng_media_unsupported" = "Media Unsupported";
@ -478,13 +486,13 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_channel_hide_comments" = "Hide comments"; "lng_channel_hide_comments" = "Hide comments";
"lng_channel_not_accessible" = "Sorry, this channel is not accessible."; "lng_channel_not_accessible" = "Sorry, this channel is not accessible.";
"lng_channels_too_much_public_existing" = "Sorry, you have created\ntoo many public channels already.\n\nPlease delete one first."; "lng_channels_too_much_public_existing" = "Sorry, you have created too many public channels already. Please delete one first.";
"lng_channels_too_much_public" = "Sorry, you have created\ntoo many public channels.\n\nYou can either create a private channel\nor delete one of your public channels first."; "lng_channels_too_much_public" = "Sorry, you have created too many public channels.\n\nYou can either create a private channel\nor delete one of your public channels first.";
"lng_group_invite_bad_link" = "This invite link is broken\nor 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";
@ -492,7 +500,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_group_invite_create_new" = "Revoke invite link"; "lng_group_invite_create_new" = "Revoke invite link";
"lng_group_invite_about_new" = "Your previous link will be deactivated\nand we'll generate a new invite link for you."; "lng_group_invite_about_new" = "Your previous link will be deactivated\nand we'll generate a new invite link for you.";
"lng_group_invite_copied" = "Invite link copied to clipboard."; "lng_group_invite_copied" = "Invite link copied to clipboard.";
"lng_group_invite_no_room" = "Unable to join this group because there are\ntoo many members in it already."; "lng_group_invite_no_room" = "Unable to join this group because there are too many members in it already.";
"lng_channel_public_link_copied" = "Link copied to clipboard."; "lng_channel_public_link_copied" = "Link copied to clipboard.";
@ -528,6 +536,8 @@ Copyright (c) 2014 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_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 {count:_not_used_|# Sticker|# Stickers}";
@ -547,10 +557,10 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
"lng_report_spam" = "Report Spam"; "lng_report_spam" = "Report Spam";
"lng_report_spam_hide" = "Hide"; "lng_report_spam_hide" = "Hide";
"lng_report_spam_thanks" = "Thank you for your report!"; "lng_report_spam_thanks" = "Thank you for your report!";
"lng_report_spam_sure" = "Are you sure you want\nto 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\nto 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\nto 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}";
@ -572,7 +582,7 @@ Copyright (c) 2014 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";
@ -662,8 +672,7 @@ Copyright (c) 2014 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" = "Forward"; "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}";
@ -701,7 +710,8 @@ Copyright (c) 2014 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_selected_delete_confirm" = "Delete"; "lng_box_delete" = "DELETE";
"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].";

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
defaultFontFamily: 'Open Sans'; defaultFontFamily: 'Open Sans';
semibold: 'Open Sans Semibold'; semibold: 'Open Sans Semibold';
@ -91,6 +94,40 @@ dialogsSearchField: InputField(defaultInputField) {
width: 240px; width: 240px;
height: 34px; height: 34px;
} }
boxWidth: 320px;
boxWideWidth: 364px;
boxPadding: margins(26px, 30px, 26px, 16px);
boxMaxListHeight: 600px;
boxFontSize: 13px;
boxTextFont: font(boxFontSize);
boxTitleFont: font(boxFontSize semibold);
boxButtonFont: font(boxFontSize semibold);
boxTitleHeight: 54px;
defaultBoxButton: BoxButton {
textFg: #2f9fea;
textFgOver: #2f9fea;
textBg: white;
textBgOver: #edf7ff;
width: -24px;
height: 36px;
textTop: 9px;
font: boxButtonFont;
duration: 200;
}
cancelBoxButton: BoxButton(defaultBoxButton) {
textFg: #aeaeae;
}
attentionBoxButton: BoxButton(defaultBoxButton) {
textFg: #ea4b2f;
textFgOver: #ea4b2f;
textBgOver: #fff0ed;
}
boxButtonPadding: margins(12px, 16px, 22px, 16px);
titleBG: #6389a8; titleBG: #6389a8;
titleColor: #0f8dcc;//rgb(20, 136, 210); titleColor: #0f8dcc;//rgb(20, 136, 210);
titleHeight: 39px; titleHeight: 39px;
@ -936,6 +973,9 @@ defaultTextStyle: textStyle {
selectOverlay: msgSelectOverlay; selectOverlay: msgSelectOverlay;
lineHeight: 0px; lineHeight: 0px;
} }
boxTextStyle: textStyle(defaultTextStyle) {
lineHeight: 22px;
}
serviceTextStyle: textStyle(defaultTextStyle) { serviceTextStyle: textStyle(defaultTextStyle) {
lnkFlags: msgServiceFont; lnkFlags: msgServiceFont;
lnkOverFlags: font(fsize semibold underline); lnkOverFlags: font(fsize semibold underline);
@ -1207,18 +1247,14 @@ layerHideDuration: 200;
layerPadding: margins(10px, 10px, 10px, 10px); layerPadding: margins(10px, 10px, 10px, 10px);
boxFont: font(16px); boxFont: font(16px);
boxPadding: margins(18px, 18px, 18px, 18px);
boxVerticalMargin: 10px; boxVerticalMargin: 10px;
boxWidth: 364px;
boxMaxListHeight: 600px;
boxBG: white; boxBG: white;
boxGrayTitle: #777; boxGrayTitle: #777;
boxTitlePos: point(20px, 15px); old_boxTitlePos: point(20px, 15px);
boxTitleFont: font(17px); old_boxTitleFont: font(17px);
boxTitleHeight: 52px; old_boxTitleHeight: 52px;
confirmMaxHeight: 320px; confirmMaxHeight: 320px;
confirmCompressedSkip: 10px; confirmCompressedSkip: 10px;
@ -1229,6 +1265,9 @@ inpAddContact: flatInput(inpDefGray) {
textMrg: margins(10px, 5px, 10px, 5px); textMrg: margins(10px, 5px, 10px, 5px);
font: font(15px); font: font(15px);
} }
contactUserIcon: sprite(120px, 90px, 18px, 18px);
contactPhoneIcon: sprite(138px, 90px, 18px, 18px);
contactAddIcon: sprite(307px, 248px, 22px, 16px);
btnNewGroup: iconedButton(btnDefIconed) { btnNewGroup: iconedButton(btnDefIconed) {
icon: sprite(189px, 118px, 18px, 17px); icon: sprite(189px, 118px, 18px, 17px);
@ -1280,7 +1319,6 @@ notifyHeight: 80px;
notifyDeltaX: 6px; notifyDeltaX: 6px;
notifyDeltaY: 7px; notifyDeltaY: 7px;
cropBoxWidth: 364px;
cropPointSize: 10px; cropPointSize: 10px;
cropMinSize: 20px; cropMinSize: 20px;
@ -1331,10 +1369,11 @@ 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);
forwardWidth: 364px;
forwardMargins: margins(30px, 10px, 30px, 10px); forwardMargins: margins(30px, 10px, 30px, 10px);
forwardFont: font(16px); forwardFont: font(16px);
forwardBg: rgba(0, 0, 0, 76); forwardBg: rgba(0, 0, 0, 76);
@ -1431,7 +1470,7 @@ newGroupName: flatInput(inpDefGray) {
newGroupLink: flatInput(inpDefFlat) { newGroupLink: flatInput(inpDefFlat) {
width: 340px; width: 340px;
height: 42px; height: 42px;
font: font(15px); font: boxTextFont;
textMrg: margins(12px, 4px, 12px, 4px); textMrg: margins(12px, 4px, 12px, 4px);
bgColor: transparent; bgColor: transparent;
bgActive: transparent; bgActive: transparent;
@ -1559,7 +1598,7 @@ aboutCloseButton: flatButton(contactsClose) {
downTextTop: 16px; downTextTop: 16px;
} }
btnInfoClose: flatButton(aboutCloseButton) { btnInfoClose: flatButton(aboutCloseButton) {
width: boxWidth; width: boxWideWidth;
} }
emojiTextFont: font(16px); emojiTextFont: font(16px);
@ -1839,7 +1878,6 @@ stickerIconPadding: 5px;
stickerIconOpacity: 0.7; stickerIconOpacity: 0.7;
stickerIconSel: 2px; stickerIconSel: 2px;
stickerIconSelColor: #58b2ed; stickerIconSelColor: #58b2ed;
stickerIconRecent: sprite(342px, 50px, 21px, 22px);
stickerIconLeft: sprite(342px, 72px, 40px, 1px); stickerIconLeft: sprite(342px, 72px, 40px, 1px);
stickerIconRight: sprite(342px, 73px, 40px, 1px); stickerIconRight: sprite(342px, 73px, 40px, 1px);
stickerIconMove: 400; stickerIconMove: 400;
@ -2114,7 +2152,7 @@ sessionsHeight: 440px;
sessionHeight: 70px; sessionHeight: 70px;
sessionPadding: margins(20px, 10px, 20px, 0); sessionPadding: margins(20px, 10px, 20px, 0);
sessionsCloseButton: flatButton(aboutCloseButton) { sessionsCloseButton: flatButton(aboutCloseButton) {
width: boxWidth; width: boxWideWidth;
} }
sessionNameFont: msgNameFont; sessionNameFont: msgNameFont;
sessionActiveFont: msgDateFont; sessionActiveFont: msgDateFont;

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
textStyle { textStyle {
lnkFlags: font; lnkFlags: font;
@ -268,6 +271,21 @@ botKeyboardButton {
downTextTop: number; downTextTop: number;
} }
BoxButton {
textFg: color;
textFgOver: color;
textBg: color; // rect of textBg with rounded rect of textBgOver upon it
textBgOver: color;
width: number;
height: number;
textTop: number;
font: font;
duration: number;
}
InputField { InputField {
textFg: color; textFg: color;
textMargins: margins; textMargins: margins;

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "genemoji.h" #include "genemoji.h"
@ -1533,8 +1536,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
tcpp << "#include \"stdafx.h\"\n#include \"gui/emoji_config.h\"\n\n"; tcpp << "#include \"stdafx.h\"\n#include \"gui/emoji_config.h\"\n\n";

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QVector> #include <QtCore/QVector>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "genlang.h" #include "genlang.h"
@ -416,8 +419,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
th << "#pragma once\n\n"; th << "#pragma once\n\n";
@ -497,8 +503,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
tcpp << "#include \"stdafx.h\"\n#include \"lang.h\"\n\n"; tcpp << "#include \"stdafx.h\"\n#include \"lang.h\"\n\n";
tcpp << "namespace {\n"; tcpp << "namespace {\n";

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QVector> #include <QtCore/QVector>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "genstyles.h" #include "genstyles.h"
@ -374,8 +377,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace style {\n"; tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace style {\n";
for (int i = 0, l = byIndex.size(); i < l; ++i) { for (int i = 0, l = byIndex.size(); i < l; ++i) {
@ -1537,8 +1543,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace st {\n"; tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace st {\n";
tcpp << "\ tcpp << "\
@ -1560,8 +1569,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\nnamespace {\n"; tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\nnamespace {\n";
for (int i = 0, l = scalars.size(); i < l; ++i) { for (int i = 0, l = scalars.size(); i < l; ++i) {
@ -1934,8 +1946,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
GNU General Public License for more details.\n\ GNU General Public License for more details.\n\
\n\ \n\
In addition, as a special exception, the copyright holders give permission\n\
to link the code of portions of this program with the OpenSSL library.\n\
\n\
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n\
Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\
*/\n"; */\n";
tnum << "#include \"stdafx.h\"\n#include \"numbers.h\"\n\n"; tnum << "#include \"stdafx.h\"\n#include \"numbers.h\"\n\n";
tnum << "QVector<int> phoneNumberParse(const QString &number) {\n"; tnum << "QVector<int> phoneNumberParse(const QString &number) {\n";

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QVector> #include <QtCore/QVector>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "memain.h" #include "memain.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <QtCore/QTimer> #include <QtCore/QTimer>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "mlmain.h" #include "mlmain.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <QtCore/QTimer> #include <QtCore/QTimer>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "msmain.h" #include "msmain.h"
#include <QtCore/QDir> #include <QtCore/QDir>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <QtCore/QTimer> #include <QtCore/QTimer>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "packer.h" #include "packer.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "updater.h" #include "updater.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include <cstdio> #include <cstdio>
#include <sys/stat.h> #include <sys/stat.h>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -93,7 +96,15 @@ namespace {
QPixmap *sprite = 0, *emojis = 0, *emojisLarge = 0; QPixmap *sprite = 0, *emojis = 0, *emojisLarge = 0;
QPixmap *corners[RoundCornersCount][4] = { { 0 } }; struct CornersPixmaps {
CornersPixmaps() {
memset(p, 0, sizeof(p));
}
QPixmap *p[4];
};
CornersPixmaps corners[RoundCornersCount];
typedef QMap<uint32, CornersPixmaps> CornersMap;
CornersMap cornersMap;
QImage *cornersMask[4] = { 0 }; QImage *cornersMask[4] = { 0 };
typedef QMap<uint64, QPixmap> EmojisMap; typedef QMap<uint64, QPixmap> EmojisMap;
@ -618,7 +629,7 @@ namespace App {
} else { } else {
if (i.key()->botInfo) { if (i.key()->botInfo) {
botStatus = (botStatus > 0/* || i.key()->botInfo->readsAllHistory*/) ? 2 : 1; botStatus = (botStatus > 0/* || i.key()->botInfo->readsAllHistory*/) ? 2 : 1;
if (requestBotInfos && !i.key()->botInfo->inited) App::api()->requestFullPeer(i.key()); if (requestBotInfos && !i.key()->botInfo->inited && App::api()) App::api()->requestFullPeer(i.key());
} }
if (!found && i.key()->id == h->lastKeyboardFrom) { if (!found && i.key()->id == h->lastKeyboardFrom) {
found = true; found = true;
@ -668,7 +679,7 @@ namespace App {
chat->count++; chat->count++;
if (user->botInfo) { if (user->botInfo) {
chat->botStatus = (chat->botStatus > 0/* || !user->botInfo->readsAllHistory*/) ? 2 : 1; chat->botStatus = (chat->botStatus > 0/* || !user->botInfo->readsAllHistory*/) ? 2 : 1;
if (!user->botInfo->inited) App::api()->requestFullPeer(user); if (!user->botInfo->inited && App::api()) App::api()->requestFullPeer(user);
} }
} }
} else { } else {
@ -1887,9 +1898,11 @@ namespace App {
cors[1] = rect.copy(r * 2, 0, r, r); cors[1] = rect.copy(r * 2, 0, r, r);
cors[2] = rect.copy(0, r * 2, r, r + (shadow ? s : 0)); cors[2] = rect.copy(0, r * 2, r, r + (shadow ? s : 0));
cors[3] = rect.copy(r * 2, r * 2, r, r + (shadow ? s : 0)); cors[3] = rect.copy(r * 2, r * 2, r, r + (shadow ? s : 0));
for (int i = 0; i < 4; ++i) { if (index != NoneCorners) {
::corners[index][i] = new QPixmap(QPixmap::fromImage(cors[i], Qt::ColorOnly)); for (int i = 0; i < 4; ++i) {
::corners[index][i]->setDevicePixelRatio(cRetinaFactor()); ::corners[index].p[i] = new QPixmap(QPixmap::fromImage(cors[i], Qt::ColorOnly));
::corners[index].p[i]->setDevicePixelRatio(cRetinaFactor());
}
} }
} }
@ -1916,7 +1929,7 @@ namespace App {
} }
QImage mask[4]; QImage mask[4];
prepareCorners(MaskCorners, st::msgRadius, st::white, 0, mask); prepareCorners(NoneCorners, st::msgRadius, st::white, 0, mask);
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
::cornersMask[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied)); ::cornersMask[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied));
::cornersMask[i]->setDevicePixelRatio(cRetinaFactor()); ::cornersMask[i]->setDevicePixelRatio(cRetinaFactor());
@ -1968,10 +1981,16 @@ namespace App {
::emojisLarge = 0; ::emojisLarge = 0;
for (int32 j = 0; j < 4; ++j) { for (int32 j = 0; j < 4; ++j) {
for (int32 i = 0; i < RoundCornersCount; ++i) { for (int32 i = 0; i < RoundCornersCount; ++i) {
delete ::corners[i][j]; ::corners[i][j] = 0; delete ::corners[i].p[j]; ::corners[i].p[j] = 0;
} }
delete ::cornersMask[j]; ::cornersMask[j] = 0; delete ::cornersMask[j]; ::cornersMask[j] = 0;
} }
for (CornersMap::const_iterator i = ::cornersMap.cbegin(), e = ::cornersMap.cend(); i != e; ++i) {
for (int32 j = 0; j < 4; ++j) {
delete i->p[j];
}
}
::cornersMap.clear();
mainEmojisMap.clear(); mainEmojisMap.clear();
otherEmojisMap.clear(); otherEmojisMap.clear();
@ -2394,13 +2413,8 @@ namespace App {
QImage **cornersMask() { QImage **cornersMask() {
return ::cornersMask; return ::cornersMask;
} }
QPixmap **corners(RoundCorners index) { void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, const CornersPixmaps &c, const style::color *sh) {
return ::corners[index]; int32 cw = c.p[0]->width() / cIntRetinaFactor(), ch = c.p[0]->height() / cIntRetinaFactor();
}
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, RoundCorners index, const style::color *sh) {
QPixmap **c = ::corners[index];
int32 cw = c[0]->width() / cIntRetinaFactor(), ch = c[0]->height() / cIntRetinaFactor();
if (w < 2 * cw || h < 2 * ch) return; if (w < 2 * cw || h < 2 * ch) return;
if (w > 2 * cw) { if (w > 2 * cw) {
p.fillRect(QRect(x + cw, y, w - 2 * cw, ch), bg->b); p.fillRect(QRect(x + cw, y, w - 2 * cw, ch), bg->b);
@ -2410,20 +2424,41 @@ namespace App {
if (h > 2 * ch) { if (h > 2 * ch) {
p.fillRect(QRect(x, y + ch, w, h - 2 * ch), bg->b); p.fillRect(QRect(x, y + ch, w, h - 2 * ch), bg->b);
} }
p.drawPixmap(QPoint(x, y), *c[0]); p.drawPixmap(QPoint(x, y), *c.p[0]);
p.drawPixmap(QPoint(x + w - cw, y), *c[1]); p.drawPixmap(QPoint(x + w - cw, y), *c.p[1]);
p.drawPixmap(QPoint(x, y + h - ch), *c[2]); p.drawPixmap(QPoint(x, y + h - ch), *c.p[2]);
p.drawPixmap(QPoint(x + w - cw, y + h - ch), *c[3]); p.drawPixmap(QPoint(x + w - cw, y + h - ch), *c.p[3]);
}
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, RoundCorners index, const style::color *sh) {
roundRect(p, x, y, w, h, bg, ::corners[index], sh);
} }
void roundShadow(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &sh, RoundCorners index) { void roundShadow(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &sh, RoundCorners index) {
QPixmap **c = App::corners(index); const CornersPixmaps &c = ::corners[index];
int32 cw = c[0]->width() / cIntRetinaFactor(), ch = c[0]->height() / cIntRetinaFactor(); int32 cw = c.p[0]->width() / cIntRetinaFactor(), ch = c.p[0]->height() / cIntRetinaFactor();
p.fillRect(x + cw, y + h, w - 2 * cw, st::msgShadow, sh->b); p.fillRect(x + cw, y + h, w - 2 * cw, st::msgShadow, sh->b);
p.fillRect(x, y + h - ch, cw, st::msgShadow, sh->b); p.fillRect(x, y + h - ch, cw, st::msgShadow, sh->b);
p.fillRect(x + w - cw, y + h - ch, cw, st::msgShadow, sh->b); p.fillRect(x + w - cw, y + h - ch, cw, st::msgShadow, sh->b);
p.drawPixmap(x, y + h - ch + st::msgShadow, *c[2]); p.drawPixmap(x, y + h - ch + st::msgShadow, *c.p[2]);
p.drawPixmap(x + w - cw, y + h - ch + st::msgShadow, *c[3]); p.drawPixmap(x + w - cw, y + h - ch + st::msgShadow, *c.p[3]);
}
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg) {
uint32 colorKey = ((uint32(bg->c.alpha()) & 0xFF) << 24) | ((uint32(bg->c.red()) & 0xFF) << 16) | ((uint32(bg->c.green()) & 0xFF) << 8) | ((uint32(bg->c.blue()) & 0xFF) << 24);
CornersMap::const_iterator i = cornersMap.find(colorKey);
if (i == cornersMap.cend()) {
QImage images[4];
prepareCorners(NoneCorners, st::msgRadius, bg, 0, images);
CornersPixmaps pixmaps;
for (int j = 0; j < 4; ++j) {
pixmaps.p[j] = new QPixmap(QPixmap::fromImage(images[j], Qt::ColorOnly));
pixmaps.p[j]->setDevicePixelRatio(cRetinaFactor());
}
i = cornersMap.insert(colorKey, pixmaps);
}
roundRect(p, x, y, w, h, bg, i.value(), 0);
} }
void initBackground(int32 id, const QImage &p, bool nowrite) { void initBackground(int32 id, const QImage &p, bool nowrite) {

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -44,7 +47,7 @@ struct ReplyMarkup {
}; };
enum RoundCorners { enum RoundCorners {
MaskCorners = 0x00, // for images NoneCorners = 0x00, // for images
BlackCorners, BlackCorners,
ServiceCorners, ServiceCorners,
ServiceSelectedCorners, ServiceSelectedCorners,
@ -260,7 +263,6 @@ namespace App {
void openLocalUrl(const QString &url); void openLocalUrl(const QString &url);
QImage **cornersMask(); QImage **cornersMask();
QPixmap **corners(RoundCorners index);
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, RoundCorners index, const style::color *sh = 0); void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, RoundCorners index, const style::color *sh = 0);
inline void roundRect(Painter &p, const QRect &rect, const style::color &bg, RoundCorners index, const style::color *sh = 0) { inline void roundRect(Painter &p, const QRect &rect, const style::color &bg, RoundCorners index, const style::color *sh = 0) {
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, sh); return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg, index, sh);
@ -269,6 +271,10 @@ namespace App {
inline void roundShadow(Painter &p, const QRect &rect, const style::color &sh, RoundCorners index) { inline void roundShadow(Painter &p, const QRect &rect, const style::color &sh, RoundCorners index) {
return roundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), sh, index); return roundShadow(p, rect.x(), rect.y(), rect.width(), rect.height(), sh, index);
} }
void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg);
inline void roundRect(Painter &p, const QRect &rect, const style::color &bg) {
return roundRect(p, rect.x(), rect.y(), rect.width(), rect.height(), bg);
}
void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false); void initBackground(int32 id = DefaultChatBackground, const QImage &p = QImage(), bool nowrite = false);

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "application.h" #include "application.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 234 KiB

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "audio.h" #include "audio.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -32,8 +35,8 @@ _text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle) {
_version.move(0, st::aboutVersionTop); _version.move(0, st::aboutVersionTop);
_text.move(0, st::aboutTextTop); _text.move(0, st::aboutTextTop);
_headerWidth = st::aboutHeaderFont->m.width(qsl("Telegram ")); _headerWidth = st::aboutHeaderFont->width(qsl("Telegram "));
_subheaderWidth = st::aboutSubheaderFont->m.width(qsl("Desktop")); _subheaderWidth = st::aboutSubheaderFont->width(qsl("Desktop"));
_done.move(0, height() - _done.height()); _done.move(0, height() - _done.height());

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -24,8 +27,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
#include "mainwidget.h" #include "mainwidget.h"
#include "window.h" #include "window.h"
AbstractBox::AbstractBox() : _maxHeight(0), _hiding(false), a_opacity(0, 1) { AbstractBox::AbstractBox(int32 w) : _maxHeight(0), _hiding(false), a_opacity(0, 1) {
resize(st::boxWidth, 0); resize(w, 0);
} }
void AbstractBox::prepare() { void AbstractBox::prepare() {
@ -65,20 +68,20 @@ bool AbstractBox::paint(QPainter &p) {
void AbstractBox::paintTitle(Painter &p, const QString &title, bool withShadow) { void AbstractBox::paintTitle(Painter &p, const QString &title, bool withShadow) {
if (withShadow) { if (withShadow) {
// paint shadow // paint shadow
p.fillRect(0, st::boxTitleHeight, width(), st::scrollDef.topsh, st::scrollDef.shColor->b); p.fillRect(0, st::old_boxTitleHeight, width(), st::scrollDef.topsh, st::scrollDef.shColor->b);
} }
// paint box title // paint box title
p.setFont(st::boxTitleFont->f); p.setFont(st::old_boxTitleFont->f);
p.setPen(st::black->p); p.setPen(st::black->p);
p.drawTextLeft(st::boxTitlePos.x(), st::boxTitlePos.y(), width(), title); p.drawTextLeft(st::old_boxTitlePos.x(), st::old_boxTitlePos.y(), width(), title);
} }
void AbstractBox::paintGrayTitle(QPainter &p, const QString &title) { void AbstractBox::paintGrayTitle(QPainter &p, const QString &title) {
// draw box title // draw box title
p.setFont(st::boxFont->f); p.setFont(st::boxFont->f);
p.setPen(st::boxGrayTitle->p); p.setPen(st::boxGrayTitle->p);
p.drawText(QRect(st::boxTitlePos.x(), st::boxTitlePos.y(), width() - 2 * st::boxTitlePos.x(), st::boxFont->height), title, style::al_top); 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) {
@ -134,7 +137,7 @@ void AbstractBox::startHide() {
} }
ScrollableBox::ScrollableBox(const style::flatScroll &scroll) : AbstractBox(), ScrollableBox::ScrollableBox(const style::flatScroll &scroll) : AbstractBox(),
_scroll(this, scroll), _innerPtr(0), _topSkip(st::boxTitleHeight), _bottomSkip(0) { _scroll(this, scroll), _innerPtr(0), _topSkip(st::old_boxTitleHeight), _bottomSkip(0) {
} }
void ScrollableBox::resizeEvent(QResizeEvent *e) { void ScrollableBox::resizeEvent(QResizeEvent *e) {

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -24,7 +27,7 @@ class AbstractBox : public LayeredWidget {
public: public:
AbstractBox(); AbstractBox(int32 w = st::boxWideWidth);
void parentResized(); void parentResized();
void animStep(float64 ms); void animStep(float64 ms);
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
@ -73,7 +76,7 @@ public:
protected: protected:
void init(QWidget *inner, int32 bottomSkip = 0, int32 topSkip = st::boxTitleHeight); void init(QWidget *inner, int32 bottomSkip = 0, int32 topSkip = st::old_boxTitleHeight);
virtual void hideAll(); virtual void hideAll();
virtual void showAll(); virtual void showAll();
@ -92,4 +95,4 @@ public:
ItemListBox(const style::flatScroll &scroll); ItemListBox(const style::flatScroll &scroll);
}; };

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -63,15 +66,15 @@ void AddContactBox::initBox() {
if (_peer) { if (_peer) {
if (_peer->isUser()) { if (_peer->isUser()) {
_boxTitle = lang(_peer == App::self() ? lng_edit_self_title : lng_edit_contact_title); _boxTitle = lang(_peer == App::self() ? lng_edit_self_title : lng_edit_contact_title);
setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 2 * _firstInput.height() + 1 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 2 * _firstInput.height() + 1 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height());
} else if (_peer->isChat()) { } else if (_peer->isChat()) {
_boxTitle = lang(lng_edit_group_title); _boxTitle = lang(lng_edit_group_title);
setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 1 * _firstInput.height() + st::addContactPadding.bottom() + _addButton.height());
} }
} else { } else {
bool readyToAdd = !_phoneInput.text().isEmpty() && (!_firstInput.text().isEmpty() || !_lastInput.text().isEmpty()); bool readyToAdd = !_phoneInput.text().isEmpty() && (!_firstInput.text().isEmpty() || !_lastInput.text().isEmpty());
_boxTitle = lang(readyToAdd ? lng_confirm_contact_data : lng_enter_contact_data); _boxTitle = lang(readyToAdd ? lng_confirm_contact_data : lng_enter_contact_data);
setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height());
} }
_retryButton.hide(); _retryButton.hide();
@ -169,7 +172,7 @@ void AddContactBox::paintEvent(QPaintEvent *e) {
} else { } else {
// draw box text // draw box text
p.setPen(st::black->p); p.setPen(st::black->p);
p.setFont(st::boxTitleFont->f); p.setFont(st::old_boxTitleFont->f);
int32 h = size().height() - st::boxPadding.top() * 2 - _retryButton.height() - st::boxPadding.bottom(); int32 h = size().height() - st::boxPadding.top() * 2 - _retryButton.height() - st::boxPadding.bottom();
p.drawText(QRect(st::boxPadding.left(), st::boxPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), h), lng_contact_not_joined(lt_name, _sentName), style::al_topleft); p.drawText(QRect(st::boxPadding.left(), st::boxPadding.top(), width() - st::boxPadding.left() - st::boxPadding.right(), h), lng_contact_not_joined(lt_name, _sentName), style::al_topleft);
} }
@ -183,11 +186,11 @@ void AddContactBox::paintEvent(QPaintEvent *e) {
void AddContactBox::resizeEvent(QResizeEvent *e) { void AddContactBox::resizeEvent(QResizeEvent *e) {
if (_invertOrder) { if (_invertOrder) {
_lastInput.setGeometry(st::addContactPadding.left(), st::boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _lastInput.height()); _lastInput.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _lastInput.height());
_firstInput.setGeometry(st::addContactPadding.left(), _lastInput.y() + _lastInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height()); _firstInput.setGeometry(st::addContactPadding.left(), _lastInput.y() + _lastInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height());
_phoneInput.setGeometry(st::addContactPadding.left(), _firstInput.y() + _firstInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height()); _phoneInput.setGeometry(st::addContactPadding.left(), _firstInput.y() + _firstInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height());
} else { } else {
_firstInput.setGeometry(st::addContactPadding.left(), st::boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _firstInput.height()); _firstInput.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _firstInput.height());
_lastInput.setGeometry(st::addContactPadding.left(), _firstInput.y() + _firstInput.height() + st::addContactDelta, _firstInput.width(), _firstInput.height()); _lastInput.setGeometry(st::addContactPadding.left(), _firstInput.y() + _firstInput.height() + st::addContactDelta, _firstInput.width(), _firstInput.height());
_phoneInput.setGeometry(st::addContactPadding.left(), _lastInput.y() + _lastInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height()); _phoneInput.setGeometry(st::addContactPadding.left(), _lastInput.y() + _lastInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height());
} }
@ -309,7 +312,7 @@ void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) {
_lastInput.hide(); _lastInput.hide();
_phoneInput.hide(); _phoneInput.hide();
_retryButton.show(); _retryButton.show();
int32 theight = st::boxTitleFont->m.boundingRect(0, 0, width() - st::boxPadding.left() - st::boxPadding.right(), 1, Qt::TextWordWrap, lng_contact_not_joined(lt_name, _sentName)).height(); int32 theight = st::old_boxTitleFont->m.boundingRect(0, 0, width() - st::boxPadding.left() - st::boxPadding.right(), 1, Qt::TextWordWrap, lng_contact_not_joined(lt_name, _sentName)).height();
int32 h = st::boxPadding.top() * 2 + theight + _retryButton.height() + st::boxPadding.bottom(); int32 h = st::boxPadding.top() * 2 + theight + _retryButton.height() + st::boxPadding.bottom();
setMaxHeight(h); setMaxHeight(h);
update(); update();
@ -342,7 +345,7 @@ void AddContactBox::onRetry() {
_phoneInput.setDisabled(false); _phoneInput.setDisabled(false);
_retryButton.hide(); _retryButton.hide();
_firstInput.setFocus(); _firstInput.setFocus();
setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 3 * _firstInput.height() + 2 * st::addContactDelta + st::addContactPadding.bottom() + _addButton.height());
update(); update();
} }
@ -473,7 +476,7 @@ QRect EditChannelBox::descriptionRect() const {
} }
void EditChannelBox::updateMaxHeight() { void EditChannelBox::updateMaxHeight() {
int32 h = st::boxTitleHeight + st::newGroupPadding.top() + _title.height(); int32 h = st::old_boxTitleHeight + st::newGroupPadding.top() + _title.height();
h += st::newGroupDescriptionSkip + st::newGroupDescriptionPadding.top() + _description.height() + st::newGroupDescriptionPadding.bottom(); h += st::newGroupDescriptionSkip + st::newGroupDescriptionPadding.top() + _description.height() + st::newGroupDescriptionPadding.bottom();
h += st::newGroupPublicLinkSkip + _publicLink.height(); h += st::newGroupPublicLinkSkip + _publicLink.height();
h += st::newGroupPadding.bottom() + _saveButton.height(); h += st::newGroupPadding.bottom() + _saveButton.height();
@ -497,7 +500,7 @@ bool EditChannelBox::eventFilter(QObject *obj, QEvent *e) {
void EditChannelBox::resizeEvent(QResizeEvent *e) { void EditChannelBox::resizeEvent(QResizeEvent *e) {
_title.resize(width() - st::newGroupPadding.left() - st::newGroupPadding.right(), _title.height()); _title.resize(width() - st::newGroupPadding.left() - st::newGroupPadding.right(), _title.height());
_title.moveToLeft(st::newGroupPadding.left(), st::boxTitleHeight + st::newGroupPadding.top(), width()); _title.moveToLeft(st::newGroupPadding.left(), st::old_boxTitleHeight + st::newGroupPadding.top(), width());
_description.moveToLeft(st::newGroupPadding.left() + st::newGroupDescriptionPadding.left(), _title.y() + _title.height() + st::newGroupDescriptionSkip + st::newGroupDescriptionPadding.top(), width()); _description.moveToLeft(st::newGroupPadding.left() + st::newGroupDescriptionPadding.left(), _title.y() + _title.height() + st::newGroupDescriptionSkip + st::newGroupDescriptionPadding.top(), width());
@ -577,7 +580,7 @@ bool EditChannelBox::onSaveFail(const RPCError &error, mtpRequestId req) {
_saveDescriptionRequestId = 0; _saveDescriptionRequestId = 0;
if (err == qstr("CHAT_ABOUT_NOT_MODIFIED")) { if (err == qstr("CHAT_ABOUT_NOT_MODIFIED")) {
_channel->about = _sentDescription; _channel->about = _sentDescription;
emit App::api()->fullPeerUpdated(_channel); if (App::api()) emit App::api()->fullPeerUpdated(_channel);
onClose(); onClose();
} else { } else {
_description.setFocus(); _description.setFocus();
@ -595,6 +598,6 @@ void EditChannelBox::onSaveTitleDone(const MTPUpdates &updates) {
void EditChannelBox::onSaveDescriptionDone(const MTPBool &result) { void EditChannelBox::onSaveDescriptionDone(const MTPBool &result) {
_saveDescriptionRequestId = 0; _saveDescriptionRequestId = 0;
_channel->about = _sentDescription; _channel->about = _sentDescription;
emit App::api()->fullPeerUpdated(_channel); if (App::api()) emit App::api()->fullPeerUpdated(_channel);
onClose(); onClose();
} }

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -32,9 +35,9 @@ _done(this, lang(lng_about_done), st::langsCloseButton) {
int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]); int32 opts[] = { 60, 300, 3600, 18000 }, cnt = sizeof(opts) / sizeof(opts[0]);
resizeMaxHeight(st::langsWidth, st::boxTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + cnt * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height()); resizeMaxHeight(st::langsWidth, st::old_boxTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + cnt * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height());
int32 y = st::boxTitleHeight + st::langsPadding.top(); int32 y = st::old_boxTitleHeight + st::langsPadding.top();
_options.reserve(cnt); _options.reserve(cnt);
for (int32 i = 0; i < cnt; ++i) { for (int32 i = 0; i < cnt; ++i) {
int32 v = opts[i]; int32 v = opts[i];

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -31,42 +34,38 @@ TextParseOptions _confirmBoxTextOptions = {
Qt::LayoutDirectionAuto, // dir Qt::LayoutDirectionAuto, // dir
}; };
ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const QString &cancelText, const style::flatButton &doneStyle, const style::flatButton &cancelStyle) : _infoMsg(false), ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const style::BoxButton &doneStyle, const QString &cancelText, const style::BoxButton &cancelStyle) : AbstractBox(st::boxWidth),
_confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, doneStyle), _informative(false),
_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, cancelStyle), _text(100),
_close(this, QString(), st::btnInfoClose), _confirm(this, doneText.isEmpty() ? lang(lng_box_ok) : doneText, doneStyle),
_text(100) { _cancel(this, cancelText.isEmpty() ? lang(lng_box_cancel) : cancelText, cancelStyle) {
init(text); init(text);
} }
ConfirmBox::ConfirmBox(const QString &text, bool noDone, const QString &cancelText) : _infoMsg(true), ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const style::BoxButton &doneStyle, bool informative) : AbstractBox(st::boxWidth),
_confirm(this, QString(), st::btnSelectDone), _informative(true),
_cancel(this, QString(), st::btnSelectCancel), _text(100),
_close(this, cancelText.isEmpty() ? lang(lng_close) : cancelText, st::btnInfoClose), _confirm(this, doneText.isEmpty() ? lang(lng_box_ok) : doneText, doneStyle),
_text(100) { _cancel(this, QString(), st::cancelBoxButton) {
init(text); init(text);
} }
void ConfirmBox::init(const QString &text) { void ConfirmBox::init(const QString &text) {
_text.setText(st::boxFont, text, (_infoMsg ? _confirmBoxTextOptions : _textPlainOptions)); _text.setText(st::boxTextFont, text, _informative ? _confirmBoxTextOptions : _textPlainOptions);
_textWidth = st::boxWidth + 10 - st::boxPadding.left() - st::boxPadding.right(); textstyleSet(&st::boxTextStyle);
_textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxFont->height); _textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + (_infoMsg ? _close.height() : _confirm.height())); _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());
textstyleRestore();
if (_infoMsg) { connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed()));
_confirm.hide(); connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel()));
if (_informative) {
_cancel.hide(); _cancel.hide();
connect(this, SIGNAL(confirmed()), this, SLOT(onCancel()));
connect(&_close, SIGNAL(clicked()), this, SLOT(onCancel()));
setMouseTracking(_text.hasLinks());
} else {
_close.hide();
connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed()));
connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel()));
} }
setMouseTracking(_text.hasLinks());
prepare(); prepare();
} }
@ -121,7 +120,9 @@ void ConfirmBox::updateLink() {
void ConfirmBox::updateHover() { void ConfirmBox::updateHover() {
QPoint m(mapFromGlobal(_lastMousePos)); QPoint m(mapFromGlobal(_lastMousePos));
bool wasMy = (_myLink == textlnkOver()); bool wasMy = (_myLink == textlnkOver());
textstyleSet(&st::boxTextStyle);
_myLink = _text.link(m.x() - st::boxPadding.left(), m.y() - st::boxPadding.top(), _textWidth, (_text.maxWidth() < width()) ? style::al_center : style::al_left); _myLink = _text.link(m.x() - st::boxPadding.left(), m.y() - st::boxPadding.top(), _textWidth, (_text.maxWidth() < width()) ? style::al_center : style::al_left);
textstyleRestore();
if (_myLink != textlnkOver()) { if (_myLink != textlnkOver()) {
if (wasMy || _myLink || rect().contains(m)) { if (wasMy || _myLink || rect().contains(m)) {
textlnkOver(_myLink); textlnkOver(_myLink);
@ -138,12 +139,11 @@ void ConfirmBox::closePressed() {
void ConfirmBox::hideAll() { void ConfirmBox::hideAll() {
_confirm.hide(); _confirm.hide();
_cancel.hide(); _cancel.hide();
_close.hide();
} }
void ConfirmBox::showAll() { void ConfirmBox::showAll() {
if (_infoMsg) { if (_informative) {
_close.show(); _confirm.show();
} else { } else {
_confirm.show(); _confirm.show();
_cancel.show(); _cancel.show();
@ -162,27 +162,16 @@ void ConfirmBox::paintEvent(QPaintEvent *e) {
QPainter p(this); QPainter p(this);
if (paint(p)) return; if (paint(p)) return;
if (!_infoMsg) {
// paint shadows
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);
}
// draw box title / text // draw box title / text
p.setFont(st::boxFont->f);
p.setPen(st::black->p); p.setPen(st::black->p);
_text.drawElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, 16, (_text.maxWidth() < width()) ? style::al_center : style::al_left); textstyleSet(&st::boxTextStyle);
_text.drawElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, 16, style::al_left);
textstyleRestore();
} }
void ConfirmBox::resizeEvent(QResizeEvent *e) { void ConfirmBox::resizeEvent(QResizeEvent *e) {
if (_infoMsg) { _confirm.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _confirm.height(), width());
_close.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom()); _cancel.moveToRight(st::boxButtonPadding.right() + _confirm.width() + st::boxButtonPadding.left(), _confirm.y(), width());
} else {
_confirm.move(width() - _confirm.width(), st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
_cancel.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom());
}
} }
ConfirmLinkBox::ConfirmLinkBox(const QString &url) : ConfirmBox(lang(lng_open_this_link) + qsl("\n\n") + url, lang(lng_open_link)), _url(url) { ConfirmLinkBox::ConfirmLinkBox(const QString &url) : ConfirmBox(lang(lng_open_this_link) + qsl("\n\n") + url, lang(lng_open_link)), _url(url) {
@ -198,16 +187,16 @@ void ConfirmLinkBox::onOpenLink() {
App::wnd()->hideLayer(); App::wnd()->hideLayer();
} }
MaxInviteBox::MaxInviteBox(const QString &link) : MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth),
_close(this, lang(lng_close), st::btnInfoClose), _close(this, lang(lng_box_ok), st::defaultBoxButton),
_text(st::boxFont, lng_participant_invite_sorry(lt_count, QString::number(cMaxGroupCount())), _confirmBoxTextOptions), _text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxPadding.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 + 10 - st::boxPadding.left() - st::boxPadding.right(); _textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right();
_textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxFont->height); _textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight));
setMaxHeight(st::boxPadding.top() + _textHeight + st::newGroupLinkPadding.top() + st::newGroupLink.height + st::newGroupLinkPadding.bottom() + _close.height()); setMaxHeight(st::boxPadding.top() + _textHeight + st::newGroupLinkPadding.top() + st::newGroupLink.height + st::newGroupLinkPadding.bottom() + _close.height() + st::boxButtonPadding.bottom());
connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));
@ -269,9 +258,8 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
if (paint(p)) return; if (paint(p)) return;
// draw box title / text // draw box title / text
p.setFont(st::boxFont->f);
p.setPen(st::black->p); p.setPen(st::black->p);
_text.drawElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, 16, (_text.maxWidth() < width()) ? style::al_center : style::al_left); _text.drawElided(p, st::boxPadding.left(), st::boxPadding.top(), _textWidth, 16, style::al_left);
QTextOption option(style::al_left); QTextOption option(style::al_left);
option.setWrapMode(QTextOption::WrapAnywhere); option.setWrapMode(QTextOption::WrapAnywhere);
@ -288,6 +276,6 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) {
} }
void MaxInviteBox::resizeEvent(QResizeEvent *e) { void MaxInviteBox::resizeEvent(QResizeEvent *e) {
_close.move(0, height() - _close.height()); _close.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _close.height(), width());
_invitationLink = QRect(st::newGroupPadding.left(), st::boxPadding.top() + _textHeight + st::newGroupLinkPadding.top() + (st::newGroupLink.height / 2) - st::newGroupLinkFont->height, width() - st::newGroupPadding.left() - st::newGroupPadding.right(), 2 * st::newGroupLinkFont->height); _invitationLink = QRect(st::newGroupPadding.left(), st::boxPadding.top() + _textHeight + st::newGroupLinkPadding.top() + (st::newGroupLink.height / 2) - st::newGroupLinkFont->height, width() - st::newGroupPadding.left() - st::newGroupPadding.right(), 2 * st::newGroupLinkFont->height);
} }

View File

@ -12,20 +12,23 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
#include "abstractbox.h" #include "abstractbox.h"
class InformBox;
class ConfirmBox : public AbstractBox { class ConfirmBox : public AbstractBox {
Q_OBJECT Q_OBJECT
public: public:
ConfirmBox(const QString &text, const QString &doneText = QString(), const QString &cancelText = QString(), const style::flatButton &doneStyle = st::btnSelectDone, const style::flatButton &cancelStyle = st::btnSelectCancel); ConfirmBox(const QString &text, const QString &doneText = QString(), const style::BoxButton &doneStyle = st::defaultBoxButton, const QString &cancelText = QString(), const style::BoxButton &cancelStyle = st::cancelBoxButton);
ConfirmBox(const QString &text, bool noDone, const QString &cancelText = QString());
void keyPressEvent(QKeyEvent *e); void keyPressEvent(QKeyEvent *e);
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
@ -53,12 +56,13 @@ protected:
private: private:
ConfirmBox(const QString &text, const QString &doneText, const style::BoxButton &doneStyle, bool informative);
friend class InformBox;
void init(const QString &text); void init(const QString &text);
bool _infoMsg; bool _informative;
FlatButton _confirm, _cancel;
BottomButton _close;
Text _text; Text _text;
int32 _textWidth, _textHeight; int32 _textWidth, _textHeight;
@ -66,6 +70,14 @@ private:
QPoint _lastMousePos; QPoint _lastMousePos;
TextLinkPtr _myLink; TextLinkPtr _myLink;
BoxButton _confirm, _cancel;
};
class InformBox : public ConfirmBox {
public:
InformBox(const QString &text, const QString &doneText = QString(), const style::BoxButton &doneStyle = st::defaultBoxButton) : ConfirmBox(text, doneText, doneStyle, true) {
}
}; };
class ConfirmLinkBox : public ConfirmBox { class ConfirmLinkBox : public ConfirmBox {
@ -108,7 +120,7 @@ private:
void updateSelected(const QPoint &cursorGlobalPosition); void updateSelected(const QPoint &cursorGlobalPosition);
bool goodAnimStep(float64 ms); bool goodAnimStep(float64 ms);
BottomButton _close; BoxButton _close;
Text _text; Text _text;
int32 _textWidth, _textHeight; int32 _textWidth, _textHeight;

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -69,7 +72,7 @@ void ConnectionBox::showAll() {
_tcpProxyRadio.show(); _tcpProxyRadio.show();
_tryIPv6.show(); _tryIPv6.show();
int32 h = st::boxTitleHeight + st::connectionSkip + _autoRadio.height() + st::connectionSkip + _httpProxyRadio.height() + st::connectionSkip + _tcpProxyRadio.height() + st::connectionSkip + st::lineWidth + st::connectionSkip + _tryIPv6.height() + st::connectionSkip; int32 h = st::old_boxTitleHeight + st::connectionSkip + _autoRadio.height() + st::connectionSkip + _httpProxyRadio.height() + st::connectionSkip + _tcpProxyRadio.height() + st::connectionSkip + st::lineWidth + st::connectionSkip + _tryIPv6.height() + st::connectionSkip;
if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) { if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) {
h += 2 * st::boxPadding.top() + 2 * _hostInput.height(); h += 2 * st::boxPadding.top() + 2 * _hostInput.height();
_hostInput.show(); _hostInput.show();
@ -113,7 +116,7 @@ void ConnectionBox::paintEvent(QPaintEvent *e) {
} }
void ConnectionBox::resizeEvent(QResizeEvent *e) { void ConnectionBox::resizeEvent(QResizeEvent *e) {
_autoRadio.move(st::boxPadding.left(), st::boxTitleHeight + st::connectionSkip); _autoRadio.move(st::boxPadding.left(), st::old_boxTitleHeight + st::connectionSkip);
_httpProxyRadio.move(st::boxPadding.left(), _autoRadio.y() + _autoRadio.height() + st::connectionSkip); _httpProxyRadio.move(st::boxPadding.left(), _autoRadio.y() + _autoRadio.height() + st::connectionSkip);
int32 inputy = 0; int32 inputy = 0;

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -322,15 +325,15 @@ void ContactsInner::paintDialog(Painter &p, PeerData *peer, ContactData *data, b
if (uname && !data->inchat && !data->check && !_lastQuery.isEmpty() && peer->userName().startsWith(_lastQuery, Qt::CaseInsensitive)) { if (uname && !data->inchat && !data->check && !_lastQuery.isEmpty() && peer->userName().startsWith(_lastQuery, Qt::CaseInsensitive)) {
int32 availw = width() - (left + st::profileListPhotoSize + st::profileListPadding.width() * 2); int32 availw = width() - (left + st::profileListPhotoSize + st::profileListPadding.width() * 2);
QString first = '@' + peer->userName().mid(0, _lastQuery.size()), second = peer->userName().mid(_lastQuery.size()); QString first = '@' + peer->userName().mid(0, _lastQuery.size()), second = peer->userName().mid(_lastQuery.size());
int32 w = st::profileSubFont->m.width(first); int32 w = st::profileSubFont->width(first);
if (w >= availw || second.isEmpty()) { if (w >= availw || second.isEmpty()) {
p.setPen(st::profileOnlineColor->p); p.setPen(st::profileOnlineColor->p);
p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, st::profileSubFont->m.elidedText(first, Qt::ElideRight, availw)); p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, st::profileSubFont->elided(first, availw));
} else { } else {
p.setPen(st::profileOnlineColor->p); p.setPen(st::profileOnlineColor->p);
p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, first); p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, first);
p.setPen(st::profileOfflineColor->p); p.setPen(st::profileOfflineColor->p);
p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width() + w, st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, st::profileSubFont->m.elidedText(second, Qt::ElideRight, availw - w)); p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width() + w, st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, st::profileSubFont->elided(second, availw - w));
} }
} else { } else {
if (data->inchat || data->check) { if (data->inchat || data->check) {
@ -1300,7 +1303,7 @@ void ContactsBox::paintEvent(QPaintEvent *e) {
if (!addingAdmin) { if (!addingAdmin) {
p.setPen(st::newGroupLimitFg); p.setPen(st::newGroupLimitFg);
p.drawTextLeft(st::boxTitlePos.x() + st::boxTitleFont->m.width(title) + st::addContactDelta, st::boxTitlePos.y(), width(), QString("%1 / %2").arg(_inner.selectedCount()).arg(cMaxGroupCount())); p.drawTextLeft(st::old_boxTitlePos.x() + st::old_boxTitleFont->width(title) + st::addContactDelta, st::old_boxTitlePos.y(), width(), QString("%1 / %2").arg(_inner.selectedCount()).arg(cMaxGroupCount()));
// paint button sep // paint button sep
p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b); p.fillRect(st::btnSelectCancel.width, size().height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b);
@ -1421,7 +1424,7 @@ bool ContactsBox::creationFail(const RPCError &error) {
_filter.notaBene(); _filter.notaBene();
return true; return true;
} else if (error.type() == "PEER_FLOOD") { } else if (error.type() == "PEER_FLOOD") {
App::wnd()->replaceLayer(new ConfirmBox(lng_cant_invite_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info))))); App::wnd()->replaceLayer(new InformBox(lng_cant_invite_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info)))));
return true; return true;
} }
return false; return false;
@ -1430,7 +1433,7 @@ bool ContactsBox::creationFail(const RPCError &error) {
MembersInner::MembersInner(ChannelData *channel, MembersFilter filter) : _channel(channel), _filter(filter), MembersInner::MembersInner(ChannelData *channel, MembersFilter filter) : _channel(channel), _filter(filter),
_kickText(lang(lng_profile_kick)), _kickText(lang(lng_profile_kick)),
_time(0), _time(0),
_kickWidth(st::normalFont->m.width(_kickText)), _kickWidth(st::normalFont->width(_kickText)),
_sel(-1), _sel(-1),
_kickSel(-1), _kickSel(-1),
_kickDown(-1), _kickDown(-1),
@ -1667,6 +1670,7 @@ QMap<UserData*, bool> MembersInner::already() const {
} }
void MembersInner::clearSel() { void MembersInner::clearSel() {
updateSelectedRow();
_sel = _kickSel = _kickDown = -1; _sel = _kickSel = _kickDown = -1;
_lastMousePos = QCursor::pos(); _lastMousePos = QCursor::pos();
updateSel(); updateSel();
@ -1938,8 +1942,7 @@ void MembersBox::onAdd() {
} }
ContactsBox *box = new ContactsBox(_inner.channel(), _inner.filter(), _inner.already()); ContactsBox *box = new ContactsBox(_inner.channel(), _inner.filter(), _inner.already());
if (_inner.filter() == MembersFilterRecent) { if (_inner.filter() == MembersFilterRecent) {
App::wnd()->hideLayer(true); App::wnd()->showLayer(box);
App::wnd()->showLayer(box, true);
} else { } else {
_addBox = box; _addBox = box;
connect(_addBox, SIGNAL(adminAdded()), this, SLOT(onAdminAdded())); connect(_addBox, SIGNAL(adminAdded()), this, SLOT(onAdminAdded()));
@ -1971,6 +1974,7 @@ void MembersBox::showAll() {
} }
void MembersBox::showDone() { void MembersBox::showDone() {
_inner.clearSel();
setFocus(); setFocus();
} }
@ -1978,7 +1982,7 @@ NewGroupBox::NewGroupBox() : AbstractBox(),
_group(this, qsl("group_type"), 0, lang(lng_create_group_title), true), _group(this, qsl("group_type"), 0, lang(lng_create_group_title), true),
_channel(this, qsl("group_type"), 1, lang(lng_create_channel_title)), _channel(this, qsl("group_type"), 1, lang(lng_create_channel_title)),
_aboutGroupWidth(width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft), _aboutGroupWidth(width() - st::newGroupPadding.left() - st::newGroupPadding.right() - st::rbDefFlat.textLeft),
_aboutGroup(st::normalFont, lng_create_group_about(lt_count, QString::number(cMaxGroupCount())), _defaultOptions, _aboutGroupWidth), _aboutGroup(st::normalFont, lng_create_group_about(lt_count, cMaxGroupCount()), _defaultOptions, _aboutGroupWidth),
_aboutChannel(st::normalFont, lang(lng_create_channel_about), _defaultOptions, _aboutGroupWidth), _aboutChannel(st::normalFont, lang(lng_create_channel_about), _defaultOptions, _aboutGroupWidth),
_next(this, lang(lng_create_group_next), st::btnSelectDone), _next(this, lang(lng_create_group_next), st::btnSelectDone),
_cancel(this, lang(lng_cancel), st::btnSelectCancel) { _cancel(this, lang(lng_cancel), st::btnSelectCancel) {
@ -2304,7 +2308,7 @@ bool GroupInfoBox::creationFail(const RPCError &error) {
_name.notaBene(); _name.notaBene();
return true; return true;
} else if (error.type() == "PEER_FLOOD") { } else if (error.type() == "PEER_FLOOD") {
App::wnd()->replaceLayer(new ConfirmBox(lng_cant_invite_not_contact_channel(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info))))); App::wnd()->replaceLayer(new InformBox(lng_cant_invite_not_contact_channel(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info)))));
return true; return true;
} }
return false; return false;
@ -2315,8 +2319,7 @@ void GroupInfoBox::exportDone(const MTPExportedChatInvite &result) {
if (result.type() == mtpc_chatInviteExported) { if (result.type() == mtpc_chatInviteExported) {
_createdChannel->invitationUrl = qs(result.c_chatInviteExported().vlink); _createdChannel->invitationUrl = qs(result.c_chatInviteExported().vlink);
} }
App::wnd()->hideLayer(true); App::wnd()->showLayer(new SetupChannelBox(_createdChannel));
App::wnd()->showLayer(new SetupChannelBox(_createdChannel), true);
} }
void GroupInfoBox::onDescriptionResized() { void GroupInfoBox::onDescriptionResized() {
@ -2395,7 +2398,7 @@ a_goodOpacity(0, 0), a_good(animFunc(this, &SetupChannelBox::goodAnimStep)) {
_checkRequestId = MTP::send(MTPchannels_CheckUsername(_channel->inputChannel, MTP_string("preston")), RPCDoneHandlerPtr(), rpcFail(&SetupChannelBox::onFirstCheckFail)); _checkRequestId = MTP::send(MTPchannels_CheckUsername(_channel->inputChannel, MTP_string("preston")), RPCDoneHandlerPtr(), rpcFail(&SetupChannelBox::onFirstCheckFail));
_link.setTextMargin(style::margins(st::newGroupLink.textMrg.left() + st::newGroupLink.font->m.width(_linkPlaceholder), st::newGroupLink.textMrg.top(), st::newGroupLink.textMrg.right(), st::newGroupLink.textMrg.bottom())); _link.setTextMargin(style::margins(st::newGroupLink.textMrg.left() + st::newGroupLink.font->width(_linkPlaceholder), st::newGroupLink.textMrg.top(), st::newGroupLink.textMrg.right(), st::newGroupLink.textMrg.bottom()));
_aboutPublicHeight = _aboutPublic.countHeight(_aboutPublicWidth); _aboutPublicHeight = _aboutPublic.countHeight(_aboutPublicWidth);
setMaxHeight(st::newGroupPadding.top() + _public.height() + _aboutPublicHeight + st::newGroupSkip + _private.height() + _aboutPrivate.countHeight(_aboutPublicWidth)/* + st::newGroupSkip + _comments.height() + _aboutComments.countHeight(_aboutPublicWidth)*/ + st::newGroupPadding.bottom() + st::newGroupLinkPadding.top() + _link.height() + st::newGroupLinkPadding.bottom() + _save.height()); setMaxHeight(st::newGroupPadding.top() + _public.height() + _aboutPublicHeight + st::newGroupSkip + _private.height() + _aboutPrivate.countHeight(_aboutPublicWidth)/* + st::newGroupSkip + _comments.height() + _aboutComments.countHeight(_aboutPublicWidth)*/ + st::newGroupPadding.bottom() + st::newGroupLinkPadding.top() + _link.height() + st::newGroupLinkPadding.bottom() + _save.height());
@ -2569,7 +2572,7 @@ bool SetupChannelBox::goodAnimStep(float64 ms) {
void SetupChannelBox::closePressed() { void SetupChannelBox::closePressed() {
if (!_existing) { if (!_existing) {
App::wnd()->showLayer(new ContactsBox(_channel), true); App::wnd()->showLayer(new ContactsBox(_channel));
} }
} }
@ -2654,7 +2657,7 @@ void SetupChannelBox::onPrivacyChange() {
if (_public.checked()) { if (_public.checked()) {
if (_tooMuchUsernames) { if (_tooMuchUsernames) {
_private.setChecked(true); _private.setChecked(true);
App::wnd()->replaceLayer(new ConfirmBox(lang(lng_channels_too_much_public), true)); App::wnd()->replaceLayer(new InformBox(lang(lng_channels_too_much_public)));
return; return;
} }
_link.show(); _link.show();
@ -2715,8 +2718,7 @@ bool SetupChannelBox::onCheckFail(const RPCError &error) {
QString err(error.type()); QString err(error.type());
if (err == "CHANNELS_ADMIN_PUBLIC_TOO_MUCH") { if (err == "CHANNELS_ADMIN_PUBLIC_TOO_MUCH") {
if (_existing) { if (_existing) {
App::wnd()->hideLayer(true); App::wnd()->showLayer(new InformBox(lang(lng_channels_too_much_public_existing)));
App::wnd()->showLayer(new ConfirmBox(lang(lng_channels_too_much_public_existing), true), true);
} else { } else {
_tooMuchUsernames = true; _tooMuchUsernames = true;
_private.setChecked(true); _private.setChecked(true);
@ -2744,8 +2746,7 @@ bool SetupChannelBox::onFirstCheckFail(const RPCError &error) {
QString err(error.type()); QString err(error.type());
if (err == "CHANNELS_ADMIN_PUBLIC_TOO_MUCH") { if (err == "CHANNELS_ADMIN_PUBLIC_TOO_MUCH") {
if (_existing) { if (_existing) {
App::wnd()->hideLayer(true); App::wnd()->showLayer(new InformBox(lang(lng_channels_too_much_public_existing)));
App::wnd()->showLayer(new ConfirmBox(lang(lng_channels_too_much_public_existing), true), true);
} else { } else {
_tooMuchUsernames = true; _tooMuchUsernames = true;
_private.setChecked(true); _private.setChecked(true);

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -274,6 +277,7 @@ public:
bool isLoaded() const { bool isLoaded() const {
return !_loading; return !_loading;
} }
void clearSel();
QMap<UserData*, bool> already() const; QMap<UserData*, bool> already() const;
@ -298,7 +302,6 @@ public slots:
private: private:
void updateSelectedRow(); void updateSelectedRow();
void clearSel();
MemberData *data(int32 index); MemberData *data(int32 index);
void membersReceived(const MTPchannels_ChannelParticipants &result, mtpRequestId req); void membersReceived(const MTPchannels_ChannelParticipants &result, mtpRequestId req);

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -70,7 +73,7 @@ void DownloadPathBox::showAll() {
_saveButton.show(); _saveButton.show();
_cancelButton.show(); _cancelButton.show();
int32 h = st::boxTitleHeight + st::downloadSkip + _defaultRadio.height() + st::downloadSkip + _tempRadio.height() + st::downloadSkip + _dirRadio.height(); int32 h = st::old_boxTitleHeight + st::downloadSkip + _defaultRadio.height() + st::downloadSkip + _tempRadio.height() + st::downloadSkip + _dirRadio.height();
if (_dirRadio.checked()) h += st::boxPadding.top() + _dirInput.height(); if (_dirRadio.checked()) h += st::boxPadding.top() + _dirInput.height();
h += st::downloadSkip + _saveButton.height(); h += st::downloadSkip + _saveButton.height();
@ -91,7 +94,7 @@ void DownloadPathBox::paintEvent(QPaintEvent *e) {
} }
void DownloadPathBox::resizeEvent(QResizeEvent *e) { void DownloadPathBox::resizeEvent(QResizeEvent *e) {
_defaultRadio.move(st::boxPadding.left(), st::boxTitleHeight + st::downloadSkip); _defaultRadio.move(st::boxPadding.left(), st::old_boxTitleHeight + st::downloadSkip);
_tempRadio.move(st::boxPadding.left(), _defaultRadio.y() + _defaultRadio.height() + st::downloadSkip); _tempRadio.move(st::boxPadding.left(), _defaultRadio.y() + _defaultRadio.height() + st::downloadSkip);
_dirRadio.move(st::boxPadding.left(), _tempRadio.y() + _tempRadio.height() + st::downloadSkip); _dirRadio.move(st::boxPadding.left(), _tempRadio.y() + _tempRadio.height() + st::downloadSkip);
int32 inputy = _dirRadio.y() + _dirRadio.height() + st::boxPadding.top(); int32 inputy = _dirRadio.y() + _dirRadio.height() + st::boxPadding.top();

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -32,7 +35,7 @@ _done(this, lang(lng_about_done), st::langsCloseButton) {
bool haveTestLang = (cLang() == languageTest); bool haveTestLang = (cLang() == languageTest);
int32 y = st::boxTitleHeight + st::langsPadding.top(); int32 y = st::old_boxTitleHeight + st::langsPadding.top();
_langs.reserve(languageCount + (haveTestLang ? 1 : 0)); _langs.reserve(languageCount + (haveTestLang ? 1 : 0));
if (haveTestLang) { if (haveTestLang) {
_langs.push_back(new FlatRadiobutton(this, qsl("lang"), languageTest, qsl("Custom Lang"), (cLang() == languageTest), st::langButton)); _langs.push_back(new FlatRadiobutton(this, qsl("lang"), languageTest, qsl("Custom Lang"), (cLang() == languageTest), st::langButton));
@ -54,7 +57,7 @@ _done(this, lang(lng_about_done), st::langsCloseButton) {
connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange())); connect(_langs.back(), SIGNAL(changed()), this, SLOT(onChange()));
} }
resizeMaxHeight(st::langsWidth, st::boxTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + (languageCount + (haveTestLang ? 1 : 0)) * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height()); resizeMaxHeight(st::langsWidth, st::old_boxTitleHeight + st::langsPadding.top() + st::langsPadding.bottom() + (languageCount + (haveTestLang ? 1 : 0)) * (st::langPadding.top() + st::rbDefFlat.height + st::langPadding.bottom()) + _done.height());
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));
@ -80,16 +83,16 @@ void LanguageBox::mousePressEvent(QMouseEvent *e) {
for (int32 i = 1; i < languageCount; ++i) { for (int32 i = 1; i < languageCount; ++i) {
LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lngkeys_cnt)); LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lngkeys_cnt));
if (!loader.errors().isEmpty()) { if (!loader.errors().isEmpty()) {
App::wnd()->showLayer(new ConfirmBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" error :(\n\nError: ") + loader.errors(), true, lang(lng_close))); App::wnd()->showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" error :(\n\nError: ") + loader.errors()));
return; return;
} else if (!loader.warnings().isEmpty()) { } else if (!loader.warnings().isEmpty()) {
QString warn = loader.warnings(); QString warn = loader.warnings();
if (warn.size() > 256) warn = warn.mid(0, 254) + qsl(".."); if (warn.size() > 256) warn = warn.mid(0, 254) + qsl("..");
App::wnd()->showLayer(new ConfirmBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" warnings :(\n\nWarnings: ") + warn, true, lang(lng_close))); App::wnd()->showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" warnings :(\n\nWarnings: ") + warn));
return; return;
} }
} }
App::wnd()->showLayer(new ConfirmBox(qsl("Everything seems great in all %1 languages!").arg(languageCount - 1), true, lang(lng_close))); App::wnd()->showLayer(new InformBox(qsl("Everything seems great in all %1 languages!").arg(languageCount - 1)));
} }
} }
@ -112,16 +115,16 @@ 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_cancel, lng_continue)); LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[langId] + qsl(".strings"), LangLoaderRequest(lng_sure_save_language, lng_box_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_cancel, lng_continue)); LangLoaderPlain loader(cLangFile(), LangLoaderRequest(lng_sure_save_language, lng_box_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_continue, langOriginal(lng_continue)), save = result.value(lng_box_ok, langOriginal(lng_box_ok)),
cancel = result.value(lng_cancel, langOriginal(lng_cancel)); cancel = result.value(lng_box_cancel, langOriginal(lng_box_cancel));
ConfirmBox *box = new ConfirmBox(text, save, 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()));
App::wnd()->replaceLayer(box); App::wnd()->replaceLayer(box);

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -25,8 +28,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
#include "localstorage.h" #include "localstorage.h"
PasscodeBox::PasscodeBox(bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(false), PasscodeBox::PasscodeBox(bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(false),
_setRequest(0), _hasRecovery(false), _aboutHeight(0), _setRequest(0), _hasRecovery(false), _skipEmailWarning(false), _aboutHeight(0),
_about(st::boxWidth - st::addContactPadding.left() - st::addContactPadding.right()), _about(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.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::btnSelectDone),
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
_oldPasscode(this, st::inpAddContact, lang(lng_passcode_enter_old)), _oldPasscode(this, st::inpAddContact, lang(lng_passcode_enter_old)),
@ -40,8 +43,8 @@ _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), _hint(hint), _aboutHeight(0), _setRequest(0), _newSalt(newSalt), _curSalt(curSalt), _hasRecovery(hasRecovery), _skipEmailWarning(false), _hint(hint), _aboutHeight(0),
_about(st::boxWidth - st::addContactPadding.left() - st::addContactPadding.right()), _about(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.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::btnSelectDone),
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
_oldPasscode(this, st::inpAddContact, lang(lng_cloud_password_enter_old)), _oldPasscode(this, st::inpAddContact, lang(lng_cloud_password_enter_old)),
@ -57,24 +60,24 @@ _recover(this, lang(lng_signin_recover)) {
void PasscodeBox::init() { void PasscodeBox::init() {
_about.setRichText(st::usernameFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about)); _about.setRichText(st::usernameFont, lang(_cloudPwd ? lng_cloud_password_about : lng_passcode_about));
if (!_hint.isEmpty()) _hintText.setText(st::usernameFont, lng_signin_hint(lt_password_hint, _hint)); if (!_hint.isEmpty()) _hintText.setText(st::usernameFont, lng_signin_hint(lt_password_hint, _hint));
_aboutHeight = _about.countHeight(st::boxWidth - st::addContactPadding.left() - st::addContactPadding.right()); _aboutHeight = _about.countHeight(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.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::boxTitleHeight + st::addContactPadding.top() + 1 * _oldPasscode.height() + st::usernameSkip + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::addContactPadding.bottom() + _saveButton.height()); 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());
} 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::boxTitleHeight + st::addContactPadding.top() + 3 * _oldPasscode.height() + st::usernameSkip * 2 + 1 * st::addContactDelta + (_cloudPwd ? _passwordHint.height() + st::addContactDelta : 0) + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::addContactPadding.bottom() + _saveButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 3 * _oldPasscode.height() + st::usernameSkip * 2 + 1 * st::addContactDelta + (_cloudPwd ? _passwordHint.height() + st::addContactDelta : 0) + _aboutHeight + (_hasRecovery ? ((st::usernameSkip + _recover.height()) / 2) : 0) + st::addContactPadding.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::boxTitleHeight + st::addContactPadding.top() + 2 * _oldPasscode.height() + st::usernameSkip + 1 * st::addContactDelta + (_cloudPwd ? _passwordHint.height() + st::addContactDelta : 0) + _aboutHeight + (_cloudPwd ? st::addContactDelta + _recoverEmail.height() + st::usernameSkip : st::addContactPadding.bottom()) + _saveButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + 2 * _oldPasscode.height() + st::usernameSkip + 1 * st::addContactDelta + (_cloudPwd ? _passwordHint.height() + st::addContactDelta : 0) + _aboutHeight + (_cloudPwd ? st::addContactDelta + _recoverEmail.height() + st::usernameSkip : st::addContactPadding.bottom()) + _saveButton.height());
} }
} }
@ -220,7 +223,7 @@ void PasscodeBox::paintEvent(QPaintEvent *e) {
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::boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _oldPasscode.height()); _oldPasscode.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _oldPasscode.height());
_newPasscode.setGeometry(st::addContactPadding.left(), _oldPasscode.y() + ((_turningOff || has) ? (_oldPasscode.height() + st::usernameSkip) : 0), _oldPasscode.width(), _oldPasscode.height()); _newPasscode.setGeometry(st::addContactPadding.left(), _oldPasscode.y() + ((_turningOff || has) ? (_oldPasscode.height() + st::usernameSkip) : 0), _oldPasscode.width(), _oldPasscode.height());
_reenterPasscode.setGeometry(st::addContactPadding.left(), _newPasscode.y() + _newPasscode.height() + st::addContactDelta, _newPasscode.width(), _newPasscode.height()); _reenterPasscode.setGeometry(st::addContactPadding.left(), _newPasscode.y() + _newPasscode.height() + st::addContactDelta, _newPasscode.width(), _newPasscode.height());
_passwordHint.setGeometry(st::addContactPadding.left(), _reenterPasscode.y() + _reenterPasscode.height() + st::usernameSkip, _reenterPasscode.width(), _reenterPasscode.height()); _passwordHint.setGeometry(st::addContactPadding.left(), _reenterPasscode.y() + _reenterPasscode.height() + st::usernameSkip, _reenterPasscode.width(), _reenterPasscode.height());
@ -241,18 +244,21 @@ void PasscodeBox::resizeEvent(QResizeEvent *e) {
} }
void PasscodeBox::showDone() { void PasscodeBox::showDone() {
if (_oldPasscode.isHidden()) { if (_skipEmailWarning && !_recoverEmail.isHidden()) {
_recoverEmail.setFocus();
} else if (_oldPasscode.isHidden()) {
_newPasscode.setFocus(); _newPasscode.setFocus();
} else { } else {
_oldPasscode.setFocus(); _oldPasscode.setFocus();
} }
_skipEmailWarning = false;
} }
void PasscodeBox::setPasswordDone(const MTPBool &result) { void PasscodeBox::setPasswordDone(const MTPBool &result) {
_setRequest = 0; _setRequest = 0;
emit reloadPassword(); emit reloadPassword();
ConfirmBox *box = new ConfirmBox(lang(_reenterPasscode.isHidden() ? lng_cloud_password_removed : (_oldPasscode.isHidden() ? lng_cloud_password_was_set : lng_cloud_password_updated)), true, lang(lng_about_done)); ConfirmBox *box = new InformBox(lang(_reenterPasscode.isHidden() ? lng_cloud_password_removed : (_oldPasscode.isHidden() ? lng_cloud_password_was_set : lng_cloud_password_updated)));
App::wnd()->showLayer(box, true); App::wnd()->showLayer(box);
} }
bool PasscodeBox::setPasswordFail(const RPCError &error) { bool PasscodeBox::setPasswordFail(const RPCError &error) {
@ -280,8 +286,7 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) {
_recoverEmail.notaBene(); _recoverEmail.notaBene();
update(); update();
} else if (err == "EMAIL_UNCONFIRMED") { } else if (err == "EMAIL_UNCONFIRMED") {
ConfirmBox *box = new ConfirmBox(lang(lng_cloud_password_almost), true, lang(lng_about_done)); App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_almost)));
App::wnd()->showLayer(box, true);
emit reloadPassword(); emit reloadPassword();
} else if (error.type().startsWith(qsl("FLOOD_WAIT_"))) { } else if (error.type().startsWith(qsl("FLOOD_WAIT_"))) {
if (_oldPasscode.isHidden()) return false; if (_oldPasscode.isHidden()) return false;
@ -349,7 +354,8 @@ void PasscodeBox::onSave(bool force) {
return; return;
} }
if (!_recoverEmail.isHidden() && email.isEmpty() && !force) { if (!_recoverEmail.isHidden() && email.isEmpty() && !force) {
_replacedBy = new ConfirmBox(lang(lng_cloud_password_about_recover)); _skipEmailWarning = true;
_replacedBy = new ConfirmBox(lang(lng_cloud_password_about_recover), lang(lng_cloud_password_skip_email), st::attentionBoxButton);
connect(_replacedBy, SIGNAL(confirmed()), this, SLOT(onForceNoMail())); connect(_replacedBy, SIGNAL(confirmed()), this, SLOT(onForceNoMail()));
connect(_replacedBy, SIGNAL(destroyed(QObject*)), this, SLOT(onBoxDestroyed(QObject*))); connect(_replacedBy, SIGNAL(destroyed(QObject*)), this, SLOT(onBoxDestroyed(QObject*)));
App::wnd()->replaceLayer(_replacedBy); App::wnd()->replaceLayer(_replacedBy);
@ -459,11 +465,11 @@ bool PasscodeBox::recoverStartFail(const RPCError &error) {
} }
RecoverBox::RecoverBox(const QString &pattern) : RecoverBox::RecoverBox(const QString &pattern) :
_submitRequest(0), _pattern(st::usernameFont->m.elidedText(lng_signin_recover_hint(lt_recover_email, pattern), Qt::ElideRight, st::boxWidth - st::addContactPadding.left() - st::addContactPadding.right())), _submitRequest(0), _pattern(st::usernameFont->elided(lng_signin_recover_hint(lt_recover_email, pattern), st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right())),
_saveButton(this, lang(lng_passcode_submit), st::btnSelectDone), _saveButton(this, lang(lng_passcode_submit), st::btnSelectDone),
_cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel),
_recoverCode(this, st::inpAddContact, lang(lng_signin_code)) { _recoverCode(this, st::inpAddContact, lang(lng_signin_code)) {
setMaxHeight(st::boxTitleHeight + st::addContactPadding.top() + st::usernameSkip + _recoverCode.height() + st::usernameSkip + st::addContactPadding.bottom() + _saveButton.height()); setMaxHeight(st::old_boxTitleHeight + st::addContactPadding.top() + st::usernameSkip + _recoverCode.height() + st::usernameSkip + st::addContactPadding.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()));
@ -521,7 +527,7 @@ void RecoverBox::paintEvent(QPaintEvent *e) {
} }
void RecoverBox::resizeEvent(QResizeEvent *e) { void RecoverBox::resizeEvent(QResizeEvent *e) {
_recoverCode.setGeometry(st::addContactPadding.left(), st::boxTitleHeight + st::addContactPadding.top() + st::usernameSkip, width() - st::addContactPadding.left() - st::addContactPadding.right(), _recoverCode.height()); _recoverCode.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top() + st::usernameSkip, width() - st::addContactPadding.left() - st::addContactPadding.right(), _recoverCode.height());
int32 buttonTop = height() - _cancelButton.height(); int32 buttonTop = height() - _cancelButton.height();
_cancelButton.move(0, buttonTop); _cancelButton.move(0, buttonTop);
@ -553,8 +559,7 @@ void RecoverBox::codeSubmitDone(bool recover, const MTPauth_Authorization &resul
_submitRequest = 0; _submitRequest = 0;
emit reloadPassword(); emit reloadPassword();
ConfirmBox *box = new ConfirmBox(lang(lng_cloud_password_removed), true, lang(lng_about_done)); App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_removed)));
App::wnd()->showLayer(box, true);
} }
bool RecoverBox::codeSubmitFail(const RPCError &error) { bool RecoverBox::codeSubmitFail(const RPCError &error) {
@ -563,8 +568,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) {
const QString &err = error.type(); const QString &err = error.type();
if (err == "PASSWORD_EMPTY") { if (err == "PASSWORD_EMPTY") {
emit reloadPassword(); emit reloadPassword();
ConfirmBox *box = new ConfirmBox(lang(lng_cloud_password_removed), true, lang(lng_about_done)); App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_removed)));
App::wnd()->showLayer(box, true);
return true; return true;
} else if (err == "PASSWORD_RECOVERY_NA") { } else if (err == "PASSWORD_RECOVERY_NA") {
onClose(); onClose();

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -69,7 +72,7 @@ private:
mtpRequestId _setRequest; mtpRequestId _setRequest;
QByteArray _newSalt, _curSalt; QByteArray _newSalt, _curSalt;
bool _hasRecovery; bool _hasRecovery, _skipEmailWarning;
QString _hint; QString _hint;
int32 _aboutHeight; int32 _aboutHeight;

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"
@ -43,7 +46,7 @@ PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool 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::cropBoxWidth - st::boxPadding.left() - st::boxPadding.right(); int32 s = st::boxWideWidth - st::boxPadding.left() - st::boxPadding.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();
@ -55,11 +58,11 @@ PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) :
_cropx = (_thumbw - _cropw) / 2; _cropx = (_thumbw - _cropw) / 2;
_cropy = (_thumbh - _cropw) / 2; _cropy = (_thumbh - _cropw) / 2;
_thumbx = (st::cropBoxWidth - _thumbw) / 2; _thumbx = (st::boxWideWidth - _thumbw) / 2;
_thumby = st::boxPadding.top() * 2 + st::boxFont->height; _thumby = st::boxPadding.top() * 2 + st::boxFont->height;
setMouseTracking(true); setMouseTracking(true);
resizeMaxHeight(st::cropBoxWidth, _thumbh + st::boxPadding.top() + st::boxFont->height + st::boxPadding.top() + st::boxPadding.bottom() + _sendButton.height()); resizeMaxHeight(st::boxWideWidth, _thumbh + st::boxPadding.top() + st::boxFont->height + st::boxPadding.top() + st::boxPadding.bottom() + _sendButton.height());
} }
void PhotoCropBox::mousePressEvent(QMouseEvent *e) { void PhotoCropBox::mousePressEvent(QMouseEvent *e) {

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"
@ -59,7 +62,7 @@ PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : _img(new ReadyLocalMedi
_thumbw = 10; _thumbw = 10;
} }
} }
resizeMaxHeight(st::boxWidth, _thumbh + st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::boxPadding.bottom() + _compressed.height() + _sendButton.height()); resizeMaxHeight(st::boxWideWidth, _thumbh + st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::boxPadding.bottom() + _compressed.height() + _sendButton.height());
_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());
@ -84,12 +87,12 @@ 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::boxWidth, st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom() + st::boxPadding.bottom() + _sendButton.height()); 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->m.width(_name); _namew = st::mediaFont->width(_name);
_size = formatSizeText(_img->filesize); _size = formatSizeText(_img->filesize);
_textw = qMax(_namew, st::mediaFont->m.width(_size)); _textw = qMax(_namew, st::mediaFont->width(_size));
} }
prepare(); prepare();
} }
@ -106,11 +109,11 @@ _phone(phone), _fname(fname), _lname(lname), _replyTo(replyTo) {
_compressed.hide(); _compressed.hide();
_name = lng_full_name(lt_first_name, _fname, lt_last_name, _lname); _name = lng_full_name(lt_first_name, _fname, lt_last_name, _lname);
_namew = st::mediaFont->m.width(_name); _namew = st::mediaFont->width(_name);
_size = _phone; _size = _phone;
_textw = qMax(_namew, st::mediaFont->m.width(_size)); _textw = qMax(_namew, st::mediaFont->width(_size));
resizeMaxHeight(st::boxWidth, st::boxPadding.top() + st::boxFont->height + st::boxPadding.bottom() + st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom() + st::boxPadding.bottom() + _sendButton.height()); 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());
prepare(); prepare();
} }
@ -161,7 +164,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.setFont(st::mediaFont->f); p.setFont(st::mediaFont->f);
p.setPen(st::black->c); p.setPen(st::black->c);
if (twidth < _namew) { if (twidth < _namew) {
p.drawText(x + tleft, y + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(_name, Qt::ElideRight, twidth)); p.drawText(x + tleft, y + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->elided(_name, twidth));
} else { } else {
p.drawText(x + tleft, y + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, _name); p.drawText(x + tleft, y + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, _name);
} }

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -69,7 +72,7 @@ void SessionsInner::onTerminate() {
_terminating = i.key(); _terminating = i.key();
if (_terminateBox) _terminateBox->deleteLater(); if (_terminateBox) _terminateBox->deleteLater();
_terminateBox = new ConfirmBox(lang(lng_settings_reset_one_sure), lang(lng_settings_reset_button)); _terminateBox = new ConfirmBox(lang(lng_settings_reset_one_sure), lang(lng_settings_reset_button), st::attentionBoxButton);
connect(_terminateBox, SIGNAL(confirmed()), this, SLOT(onTerminateSure())); connect(_terminateBox, SIGNAL(confirmed()), this, SLOT(onTerminateSure()));
connect(_terminateBox, SIGNAL(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*))); connect(_terminateBox, SIGNAL(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*)));
App::wnd()->replaceLayer(_terminateBox); App::wnd()->replaceLayer(_terminateBox);
@ -161,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::boxTitleHeight + st::sessionHeight + st::boxTitleHeight); init(&_inner, _done.height(), st::old_boxTitleHeight + st::sessionHeight + st::old_boxTitleHeight);
_inner.resize(width(), st::noContactsHeight); _inner.resize(width(), st::noContactsHeight);
prepare(); prepare();
@ -173,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::boxTitleHeight + st::sessionHeight + st::boxTitlePos.y() + st::boxTitleFont->ascent - st::linkFont->ascent, width()); _terminateAll.moveToRight(st::sessionPadding.left(), st::old_boxTitleHeight + st::sessionHeight + st::old_boxTitlePos.y() + st::old_boxTitleFont->ascent - st::linkFont->ascent, width());
} }
void SessionsBox::hideAll() { void SessionsBox::hideAll() {
@ -202,7 +205,7 @@ void SessionsBox::paintEvent(QPaintEvent *e) {
if (paint(p)) return; if (paint(p)) return;
paintTitle(p, lang(lng_sessions_header), true); paintTitle(p, lang(lng_sessions_header), true);
p.translate(0, st::boxTitleHeight); p.translate(0, st::old_boxTitleHeight);
if (_loading) { if (_loading) {
p.setFont(st::noContactsFont->f); p.setFont(st::noContactsFont->f);
@ -231,10 +234,10 @@ void SessionsBox::paintEvent(QPaintEvent *e) {
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::boxTitleHeight + st::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::old_boxTitleHeight + st::old_boxTitlePos.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::boxTitleHeight, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b); p.fillRect(0, height() - st::sessionsCloseButton.height - st::scrollDef.bottomsh - st::sessionHeight - st::old_boxTitleHeight, width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b);
} else { } else {
paintTitle(p, lang(lng_sessions_other_header), false); paintTitle(p, lang(lng_sessions_other_header), false);
} }
@ -245,7 +248,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
_loading = false; _loading = false;
_shortPollRequest = 0; _shortPollRequest = 0;
int32 availCurrent = st::boxWidth - st::sessionPadding.left() - st::sessionTerminateSkip; int32 availCurrent = st::boxWideWidth - st::sessionPadding.left() - st::sessionTerminateSkip;
int32 availOther = availCurrent - st::sessionTerminate.iconPos.x();// -st::sessionTerminate.width - st::sessionTerminateSkip; int32 availOther = availCurrent - st::sessionTerminate.iconPos.x();// -st::sessionTerminate.width - st::sessionTerminateSkip;
_list.clear(); _list.clear();
@ -282,7 +285,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
} }
data.name = appName; data.name = appName;
if (!appVer.isEmpty()) data.name += ' ' + appVer; if (!appVer.isEmpty()) data.name += ' ' + appVer;
data.nameWidth = st::sessionNameFont->m.width(data.name); data.nameWidth = st::sessionNameFont->width(data.name);
QString country = qs(d.vcountry), platform = qs(d.vplatform); QString country = qs(d.vcountry), platform = qs(d.vplatform);
//CountriesByISO2::const_iterator j = countries.constFind(country); //CountriesByISO2::const_iterator j = countries.constFind(country);
@ -297,18 +300,18 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
data.active = QString(); data.active = QString();
data.activeWidth = 0; data.activeWidth = 0;
if (data.nameWidth > availCurrent) { if (data.nameWidth > availCurrent) {
data.name = st::sessionNameFont->m.elidedText(data.name, Qt::ElideRight, availCurrent); data.name = st::sessionNameFont->elided(data.name, availCurrent);
data.nameWidth = st::sessionNameFont->m.width(data.name); data.nameWidth = st::sessionNameFont->width(data.name);
} }
data.infoWidth = st::sessionInfoFont->m.width(data.info); data.infoWidth = st::sessionInfoFont->width(data.info);
if (data.infoWidth > availCurrent) { if (data.infoWidth > availCurrent) {
data.info = st::sessionInfoFont->m.elidedText(data.info, Qt::ElideRight, availCurrent); data.info = st::sessionInfoFont->elided(data.info, availCurrent);
data.infoWidth = st::sessionInfoFont->m.width(data.info); data.infoWidth = st::sessionInfoFont->width(data.info);
} }
data.ipWidth = st::sessionInfoFont->m.width(data.ip); data.ipWidth = st::sessionInfoFont->width(data.ip);
if (data.ipWidth > availCurrent) { if (data.ipWidth > availCurrent) {
data.ip = st::sessionInfoFont->m.elidedText(data.ip, Qt::ElideRight, availCurrent); data.ip = st::sessionInfoFont->elided(data.ip, availCurrent);
data.ipWidth = st::sessionInfoFont->m.width(data.ip); data.ipWidth = st::sessionInfoFont->width(data.ip);
} }
_current = data; _current = data;
} else { } else {
@ -322,21 +325,21 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
} else { } else {
data.active = lastDate.toString(qsl("d.MM.yy")); data.active = lastDate.toString(qsl("d.MM.yy"));
} }
data.activeWidth = st::sessionActiveFont->m.width(data.active); data.activeWidth = st::sessionActiveFont->width(data.active);
int32 availForName = availOther - st::sessionPadding.right() - data.activeWidth; int32 availForName = availOther - st::sessionPadding.right() - data.activeWidth;
if (data.nameWidth > availForName) { if (data.nameWidth > availForName) {
data.name = st::sessionNameFont->m.elidedText(data.name, Qt::ElideRight, availForName); data.name = st::sessionNameFont->elided(data.name, availForName);
data.nameWidth = st::sessionNameFont->m.width(data.name); data.nameWidth = st::sessionNameFont->width(data.name);
} }
data.infoWidth = st::sessionInfoFont->m.width(data.info); data.infoWidth = st::sessionInfoFont->width(data.info);
if (data.infoWidth > availOther) { if (data.infoWidth > availOther) {
data.info = st::sessionInfoFont->m.elidedText(data.info, Qt::ElideRight, availOther); data.info = st::sessionInfoFont->elided(data.info, availOther);
data.infoWidth = st::sessionInfoFont->m.width(data.info); data.infoWidth = st::sessionInfoFont->width(data.info);
} }
data.ipWidth = st::sessionInfoFont->m.width(data.ip); data.ipWidth = st::sessionInfoFont->width(data.ip);
if (data.ipWidth > availOther) { if (data.ipWidth > availOther) {
data.ip = st::sessionInfoFont->m.elidedText(data.ip, Qt::ElideRight, availOther); data.ip = st::sessionInfoFont->elided(data.ip, availOther);
data.ipWidth = st::sessionInfoFont->m.width(data.ip); data.ipWidth = st::sessionInfoFont->width(data.ip);
} }
_list.push_back(data); _list.push_back(data);
@ -359,7 +362,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) {
void SessionsBox::onTerminateAll() { void SessionsBox::onTerminateAll() {
if (_terminateBox) _terminateBox->deleteLater(); if (_terminateBox) _terminateBox->deleteLater();
_terminateBox = new ConfirmBox(lang(lng_settings_reset_sure), lang(lng_settings_reset_button)); _terminateBox = new ConfirmBox(lang(lng_settings_reset_sure), lang(lng_settings_reset_button), st::attentionBoxButton);
connect(_terminateBox, SIGNAL(confirmed()), this, SLOT(onTerminateAllSure())); connect(_terminateBox, SIGNAL(confirmed()), this, SLOT(onTerminateAllSure()));
connect(_terminateBox, SIGNAL(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*))); connect(_terminateBox, SIGNAL(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*)));
App::wnd()->replaceLayer(_terminateBox); App::wnd()->replaceLayer(_terminateBox);

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -58,7 +61,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::boxTitleFont->m.elidedText(_setTitle, Qt::ElideRight, width() - st::btnStickersClose.width - st::boxTitlePos.x()); _title = st::old_boxTitleFont->elided(_setTitle, width() - st::btnStickersClose.width - st::old_boxTitlePos.x());
_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;
@ -69,7 +72,7 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) {
} }
if (_pack.isEmpty()) { if (_pack.isEmpty()) {
App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_not_found), true), true); 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 + StickerPanPerRow * st::stickersSize.width(), rows * st::stickersSize.height() + st::stickersAddOrShare);
@ -87,7 +90,7 @@ bool StickerSetInner::failedSet(const RPCError &error) {
_loaded = true; _loaded = true;
App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_not_found), true), true); App::wnd()->showLayer(new InformBox(lang(lng_stickers_not_found)));
return true; return true;
} }
@ -134,7 +137,7 @@ void StickerSetInner::installDone(const MTPBool &result) {
bool StickerSetInner::installFailed(const RPCError &error) { bool StickerSetInner::installFailed(const RPCError &error) {
if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false;
App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_not_found), true), true); App::wnd()->showLayer(new InformBox(lang(lng_stickers_not_found)));
return true; return true;
} }
@ -261,7 +264,7 @@ void StickerSetBox::onAddStickers() {
void StickerSetBox::onShareStickers() { void StickerSetBox::onShareStickers() {
QString url = qsl("https://telegram.me/addstickers/") + _inner.shortName(); QString url = qsl("https://telegram.me/addstickers/") + _inner.shortName();
QApplication::clipboard()->setText(url); QApplication::clipboard()->setText(url);
App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_copied), true), true); App::wnd()->showLayer(new InformBox(lang(lng_stickers_copied)));
} }
void StickerSetBox::onUpdateButtons() { void StickerSetBox::onUpdateButtons() {

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "lang.h" #include "lang.h"
@ -27,14 +30,14 @@ UsernameBox::UsernameBox() :
_saveButton(this, lang(lng_settings_save), st::usernameDone), _saveButton(this, lang(lng_settings_save), st::usernameDone),
_cancelButton(this, lang(lng_cancel), st::usernameCancel), _cancelButton(this, lang(lng_cancel), st::usernameCancel),
_usernameInput(this, st::inpAddContact, qsl("@username"), App::self()->username), _usernameInput(this, st::inpAddContact, qsl("@username"), App::self()->username),
_saveRequest(0), _checkRequest(0), _about(st::usernameWidth - 2 * st::boxTitlePos.x()) { _saveRequest(0), _checkRequest(0), _about(st::usernameWidth - 2 * st::old_boxTitlePos.x()) {
_about.setRichText(st::usernameFont, lang(lng_username_about)); _about.setRichText(st::usernameFont, lang(lng_username_about));
_goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available); _goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available);
initBox(); initBox();
} }
void UsernameBox::initBox() { void UsernameBox::initBox() {
resizeMaxHeight(st::usernameWidth, st::boxTitleHeight + st::addContactPadding.top() + _usernameInput.height() + st::addContactPadding.bottom() + _about.countHeight(st::usernameWidth - 2 * st::boxTitlePos.x()) + st::usernameSkip + _saveButton.height()); resizeMaxHeight(st::usernameWidth, st::old_boxTitleHeight + st::addContactPadding.top() + _usernameInput.height() + st::addContactPadding.bottom() + _about.countHeight(st::usernameWidth - 2 * st::old_boxTitlePos.x()) + st::usernameSkip + _saveButton.height());
connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave())); connect(&_saveButton, SIGNAL(clicked()), this, SLOT(onSave()));
connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); connect(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose()));
@ -85,20 +88,20 @@ void UsernameBox::paintEvent(QPaintEvent *e) {
if (!_errorText.isEmpty()) { if (!_errorText.isEmpty()) {
p.setPen(st::setErrColor->p); p.setPen(st::setErrColor->p);
p.setFont(st::setErrFont->f); p.setFont(st::setErrFont->f);
int32 w = st::setErrFont->m.width(_errorText); int32 w = st::setErrFont->width(_errorText);
p.drawText((width() - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _errorText); p.drawText((width() - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _errorText);
} else if (!_goodText.isEmpty()) { } else if (!_goodText.isEmpty()) {
p.setPen(st::setGoodColor->p); p.setPen(st::setGoodColor->p);
p.setFont(st::setErrFont->f); p.setFont(st::setErrFont->f);
int32 w = st::setErrFont->m.width(_goodText); int32 w = st::setErrFont->width(_goodText);
p.drawText((width() - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _goodText); p.drawText((width() - w) / 2, _usernameInput.y() + _usernameInput.height() + ((st::usernameSkip - st::setErrFont->height) / 2) + st::setErrFont->ascent, _goodText);
} }
p.setPen(st::usernameColor->p); p.setPen(st::usernameColor->p);
_about.draw(p, st::boxTitlePos.x(), _usernameInput.y() + _usernameInput.height() + st::usernameSkip, width() - 2 * st::boxTitlePos.x()); _about.draw(p, st::old_boxTitlePos.x(), _usernameInput.y() + _usernameInput.height() + st::usernameSkip, width() - 2 * st::old_boxTitlePos.x());
} }
void UsernameBox::resizeEvent(QResizeEvent *e) { void UsernameBox::resizeEvent(QResizeEvent *e) {
_usernameInput.setGeometry(st::addContactPadding.left(), st::boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _usernameInput.height()); _usernameInput.setGeometry(st::addContactPadding.left(), st::old_boxTitleHeight + st::addContactPadding.top(), width() - st::addContactPadding.left() - st::addContactPadding.right(), _usernameInput.height());
int32 buttonTop = height() - _cancelButton.height(); int32 buttonTop = height() - _cancelButton.height();
_cancelButton.move(0, buttonTop); _cancelButton.move(0, buttonTop);

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"
@ -115,13 +118,13 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
} }
QString first = (_hashtagFilter.size() < 2) ? QString() : ('#' + hashtagResults.at(from).mid(0, _hashtagFilter.size() - 1)), second = (_hashtagFilter.size() < 2) ? ('#' + hashtagResults.at(from)) : hashtagResults.at(from).mid(_hashtagFilter.size() - 1); QString first = (_hashtagFilter.size() < 2) ? QString() : ('#' + hashtagResults.at(from).mid(0, _hashtagFilter.size() - 1)), second = (_hashtagFilter.size() < 2) ? ('#' + hashtagResults.at(from)) : hashtagResults.at(from).mid(_hashtagFilter.size() - 1);
int32 firstwidth = st::mentionFont->m.width(first), secondwidth = st::mentionFont->m.width(second); int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
if (htagwidth < firstwidth + secondwidth) { if (htagwidth < firstwidth + secondwidth) {
if (htagwidth < firstwidth + st::mentionFont->elidew) { if (htagwidth < firstwidth + st::mentionFont->elidew) {
first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, htagwidth); first = st::mentionFont->elided(first + second, htagwidth);
second = QString(); second = QString();
} else { } else {
second = st::mentionFont->m.elidedText(second, Qt::ElideRight, htagwidth - firstwidth); second = st::mentionFont->elided(second, htagwidth - firstwidth);
} }
} }
@ -251,19 +254,19 @@ void DialogsInner::peopleResultPaint(PeerData *peer, Painter &p, int32 w, bool a
QString username = peer->userName(); QString username = peer->userName();
if (!act && username.toLower().startsWith(peopleQuery)) { if (!act && username.toLower().startsWith(peopleQuery)) {
QString first = '@' + username.mid(0, peopleQuery.size()), second = username.mid(peopleQuery.size()); QString first = '@' + username.mid(0, peopleQuery.size()), second = username.mid(peopleQuery.size());
int32 w = st::dlgHistFont->m.width(first); int32 w = st::dlgHistFont->width(first);
if (w >= tr.width()) { if (w >= tr.width()) {
p.setPen(st::dlgSystemColor->p); p.setPen(st::dlgSystemColor->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText(first, Qt::ElideRight, tr.width())); p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided(first, tr.width()));
} else { } else {
p.setPen(st::dlgSystemColor->p); p.setPen(st::dlgSystemColor->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, first); p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, first);
p.setPen(st::dlgTextColor->p); p.setPen(st::dlgTextColor->p);
p.drawText(tr.left() + w, tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText(second, Qt::ElideRight, tr.width() - w)); p.drawText(tr.left() + w, tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided(second, tr.width() - w));
} }
} else { } else {
p.setPen((act ? st::dlgActiveColor : st::dlgSystemColor)->p); p.setPen((act ? st::dlgActiveColor : st::dlgSystemColor)->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText('@' + username, Qt::ElideRight, tr.width())); p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided('@' + username, tr.width()));
} }
p.setPen((act ? st::dlgActiveColor : st::dlgNameColor)->p); p.setPen((act ? st::dlgActiveColor : st::dlgNameColor)->p);
@ -293,7 +296,7 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c
QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height); QRect tr(nameleft, st::dlgPaddingVer + st::dlgFont->height + st::dlgSep, namewidth, st::dlgFont->height);
p.setFont(st::dlgHistFont->f); p.setFont(st::dlgHistFont->f);
p.setPen(st::dlgTextColor->p); p.setPen(st::dlgTextColor->p);
p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->m.elidedText(lang(lng_dlg_search_chat), Qt::ElideRight, tr.width())); p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, st::dlgHistFont->elided(lang(lng_dlg_search_chat), tr.width()));
p.setPen(st::dlgNameColor->p); p.setPen(st::dlgNameColor->p);
_searchInPeer->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); _searchInPeer->nameText.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
@ -484,7 +487,7 @@ void DialogsInner::dlgUpdated(DialogRow *row) {
} }
} }
void DialogsInner::dlgUpdated(History *history) { void DialogsInner::dlgUpdated(History *history, MsgId msgId) {
if (_state == DefaultState) { if (_state == DefaultState) {
DialogRow *row = 0; DialogRow *row = 0;
DialogsList::RowByPeer::iterator i = dialogs.list.rowByPeer.find(history->peer->id); DialogsList::RowByPeer::iterator i = dialogs.list.rowByPeer.find(history->peer->id);
@ -518,7 +521,7 @@ void DialogsInner::dlgUpdated(History *history) {
if (!searchResults.isEmpty()) { if (!searchResults.isEmpty()) {
int32 cnt = 0, add = searchedOffset(); int32 cnt = 0, add = searchedOffset();
for (SearchResults::const_iterator i = searchResults.cbegin(), e = searchResults.cend(); i != e; ++i) { for (SearchResults::const_iterator i = searchResults.cbegin(), e = searchResults.cend(); i != e; ++i) {
if ((*i)->_item->history() == history) { if ((*i)->_item->history() == history && (*i)->_item->id == msgId) {
update(0, add + cnt * st::dlgHeight, fullWidth(), st::dlgHeight); update(0, add + cnt * st::dlgHeight, fullWidth(), st::dlgHeight);
break; break;
} }
@ -796,7 +799,7 @@ void DialogsInner::dialogsReceived(const QVector<MTPDialog> &added) {
history->peer->asChannel()->ptsReceived(d.vpts.v); history->peer->asChannel()->ptsReceived(d.vpts.v);
if (!history->peer->asChannel()->amCreator()) { if (!history->peer->asChannel()->amCreator()) {
if (HistoryItem *top = App::histItemById(history->channelId(), d.vtop_important_message.v)) { if (HistoryItem *top = App::histItemById(history->channelId(), d.vtop_important_message.v)) {
if (top->date <= date(history->peer->asChannel()->date)) { if (top->date <= date(history->peer->asChannel()->date) && App::api()) {
App::api()->requestSelfParticipant(history->peer->asChannel()); App::api()->requestSelfParticipant(history->peer->asChannel());
} }
} }
@ -1558,8 +1561,8 @@ void DialogsWidget::dlgUpdated(DialogRow *row) {
_inner.dlgUpdated(row); _inner.dlgUpdated(row);
} }
void DialogsWidget::dlgUpdated(History *row) { void DialogsWidget::dlgUpdated(History *row, MsgId msgId) {
_inner.dlgUpdated(row); _inner.dlgUpdated(row, msgId);
} }
void DialogsWidget::dialogsToUp() { void DialogsWidget::dialogsToUp() {

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -57,7 +60,7 @@ public:
void createDialog(History *history); void createDialog(History *history);
void moveDialogToTop(const History::DialogLinks &links); void moveDialogToTop(const History::DialogLinks &links);
void dlgUpdated(DialogRow *row); void dlgUpdated(DialogRow *row);
void dlgUpdated(History *row); void dlgUpdated(History *row, MsgId msgId);
void removePeer(PeerData *peer); void removePeer(PeerData *peer);
void removeContact(UserData *user); void removeContact(UserData *user);
@ -200,7 +203,7 @@ public:
void loadDialogs(); void loadDialogs();
void createDialog(History *history); void createDialog(History *history);
void dlgUpdated(DialogRow *row); void dlgUpdated(DialogRow *row);
void dlgUpdated(History *row); void dlgUpdated(History *row, MsgId msgId);
void dialogsToUp(); void dialogsToUp();

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
@ -1772,9 +1775,9 @@ void EmojiPanel::updateText() {
} }
} else { } else {
QString switchText = lang((_setId != NoneStickerSetId) ? lng_switch_emoji : lng_switch_stickers); QString switchText = lang((_setId != NoneStickerSetId) ? lng_switch_emoji : lng_switch_stickers);
availw -= st::emojiSwitchSkip + st::emojiPanHeaderFont->m.width(switchText); availw -= st::emojiSwitchSkip + st::emojiPanHeaderFont->width(switchText);
} }
_text = st::emojiPanHeaderFont->m.elidedText(_fullText, Qt::ElideRight, availw); _text = st::emojiPanHeaderFont->elided(_fullText, availw);
update(); update();
} }
@ -1805,7 +1808,7 @@ void EmojiPanel::paintEvent(QPaintEvent *e) {
EmojiSwitchButton::EmojiSwitchButton(QWidget *parent, bool toStickers) : Button(parent), EmojiSwitchButton::EmojiSwitchButton(QWidget *parent, bool toStickers) : Button(parent),
_toStickers(toStickers), _text(lang(_toStickers ? lng_switch_stickers : lng_switch_emoji)), _toStickers(toStickers), _text(lang(_toStickers ? lng_switch_stickers : lng_switch_emoji)),
_textWidth(st::emojiPanHeaderFont->m.width(_text)) { _textWidth(st::emojiPanHeaderFont->width(_text)) {
int32 w = st::emojiSwitchSkip + _textWidth + (st::emojiSwitchSkip - st::emojiSwitchImgSkip); int32 w = st::emojiSwitchSkip + _textWidth + (st::emojiSwitchSkip - st::emojiSwitchImgSkip);
setCursor(style::cur_pointer); setCursor(style::cur_pointer);
resize(w, st::emojiPanHeader); resize(w, st::emojiPanHeader);
@ -2613,7 +2616,7 @@ void EmojiPan::onRemoveSet(quint64 setId) {
StickerSets::const_iterator it = cStickerSets().constFind(setId); StickerSets::const_iterator it = cStickerSets().constFind(setId);
if (it != cStickerSets().cend() && !(it->flags & MTPDstickerSet_flag_official)) { if (it != cStickerSets().cend() && !(it->flags & MTPDstickerSet_flag_official)) {
_removingSetId = it->id; _removingSetId = it->id;
ConfirmBox *box = new ConfirmBox(lng_stickers_remove_pack(lt_sticker_pack, it->title)); ConfirmBox *box = new ConfirmBox(lng_stickers_remove_pack(lt_sticker_pack, it->title), lang(lng_box_remove));
connect(box, SIGNAL(confirmed()), this, SLOT(onRemoveSetSure())); connect(box, SIGNAL(confirmed()), this, SLOT(onRemoveSetSure()));
connect(box, SIGNAL(destroyed(QObject*)), this, SLOT(onDelayedHide())); connect(box, SIGNAL(destroyed(QObject*)), this, SLOT(onDelayedHide()));
App::wnd()->showLayer(box); App::wnd()->showLayer(box);
@ -2662,7 +2665,7 @@ MentionsInner::MentionsInner(MentionsDropdown *parent, MentionRows *rows, Hashta
void MentionsInner::paintEvent(QPaintEvent *e) { void MentionsInner::paintEvent(QPaintEvent *e) {
QPainter p(this); QPainter p(this);
int32 atwidth = st::mentionFont->m.width('@'), hashwidth = st::mentionFont->m.width('#'); int32 atwidth = st::mentionFont->width('@'), hashwidth = st::mentionFont->width('#');
int32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize; int32 mentionleft = 2 * st::mentionPadding.left() + st::mentionPhotoSize;
int32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right(); int32 mentionwidth = width() - mentionleft - 2 * st::mentionPadding.right();
int32 htagleft = st::btnAttachPhoto.width + st::taMsgField.textMrg.left() - st::dlgShadow, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width; int32 htagleft = st::btnAttachPhoto.width + st::taMsgField.textMrg.left() - st::dlgShadow, htagwidth = width() - st::mentionPadding.right() - htagleft - st::mentionScroll.width;
@ -2683,19 +2686,19 @@ void MentionsInner::paintEvent(QPaintEvent *e) {
if (!_rows->isEmpty()) { if (!_rows->isEmpty()) {
UserData *user = _rows->at(i); UserData *user = _rows->at(i);
QString first = (_parent->filter().size() < 2) ? QString() : ('@' + user->username.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('@' + user->username) : user->username.mid(_parent->filter().size() - 1); QString first = (_parent->filter().size() < 2) ? QString() : ('@' + user->username.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('@' + user->username) : user->username.mid(_parent->filter().size() - 1);
int32 firstwidth = st::mentionFont->m.width(first), secondwidth = st::mentionFont->m.width(second), unamewidth = firstwidth + secondwidth, namewidth = user->nameText.maxWidth(); int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second), unamewidth = firstwidth + secondwidth, namewidth = user->nameText.maxWidth();
if (mentionwidth < unamewidth + namewidth) { if (mentionwidth < unamewidth + namewidth) {
namewidth = (mentionwidth * namewidth) / (namewidth + unamewidth); namewidth = (mentionwidth * namewidth) / (namewidth + unamewidth);
unamewidth = mentionwidth - namewidth; unamewidth = mentionwidth - namewidth;
if (firstwidth < unamewidth + st::mentionFont->elidew) { if (firstwidth < unamewidth + st::mentionFont->elidew) {
if (firstwidth < unamewidth) { if (firstwidth < unamewidth) {
first = st::mentionFont->m.elidedText(first, Qt::ElideRight, unamewidth); first = st::mentionFont->elided(first, unamewidth);
} else if (!second.isEmpty()) { } else if (!second.isEmpty()) {
first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, unamewidth); first = st::mentionFont->elided(first + second, unamewidth);
second = QString(); second = QString();
} }
} else { } else {
second = st::mentionFont->m.elidedText(second, Qt::ElideRight, unamewidth - firstwidth); second = st::mentionFont->elided(second, unamewidth - firstwidth);
} }
} }
user->photo->load(); user->photo->load();
@ -2712,13 +2715,13 @@ void MentionsInner::paintEvent(QPaintEvent *e) {
} else if (!_hrows->isEmpty()) { } else if (!_hrows->isEmpty()) {
QString hrow = _hrows->at(i); QString hrow = _hrows->at(i);
QString first = (_parent->filter().size() < 2) ? QString() : ('#' + hrow.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('#' + hrow) : hrow.mid(_parent->filter().size() - 1); QString first = (_parent->filter().size() < 2) ? QString() : ('#' + hrow.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('#' + hrow) : hrow.mid(_parent->filter().size() - 1);
int32 firstwidth = st::mentionFont->m.width(first), secondwidth = st::mentionFont->m.width(second); int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
if (htagwidth < firstwidth + secondwidth) { if (htagwidth < firstwidth + secondwidth) {
if (htagwidth < firstwidth + st::mentionFont->elidew) { if (htagwidth < firstwidth + st::mentionFont->elidew) {
first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, htagwidth); first = st::mentionFont->elided(first + second, htagwidth);
second = QString(); second = QString();
} else { } else {
second = st::mentionFont->m.elidedText(second, Qt::ElideRight, htagwidth - firstwidth); second = st::mentionFont->elided(second, htagwidth - firstwidth);
} }
} }
@ -2747,13 +2750,13 @@ void MentionsInner::paintEvent(QPaintEvent *e) {
int32 addleft = 0, widthleft = mentionwidth; int32 addleft = 0, widthleft = mentionwidth;
QString first = (_parent->filter().size() < 2) ? QString() : ('/' + toHighlight.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('/' + toHighlight) : toHighlight.mid(_parent->filter().size() - 1); QString first = (_parent->filter().size() < 2) ? QString() : ('/' + toHighlight.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('/' + toHighlight) : toHighlight.mid(_parent->filter().size() - 1);
int32 firstwidth = st::mentionFont->m.width(first), secondwidth = st::mentionFont->m.width(second); int32 firstwidth = st::mentionFont->width(first), secondwidth = st::mentionFont->width(second);
if (widthleft < firstwidth + secondwidth) { if (widthleft < firstwidth + secondwidth) {
if (widthleft < firstwidth + st::mentionFont->elidew) { if (widthleft < firstwidth + st::mentionFont->elidew) {
first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, widthleft); first = st::mentionFont->elided(first + second, widthleft);
second = QString(); second = QString();
} else { } else {
second = st::mentionFont->m.elidedText(second, Qt::ElideRight, widthleft - firstwidth); second = st::mentionFont->elided(second, widthleft - firstwidth);
} }
} }
p.setFont(st::mentionFont->f); p.setFont(st::mentionFont->f);
@ -2976,7 +2979,7 @@ void MentionsDropdown::updateFiltered(bool toDown) {
QMultiMap<int32, UserData*> ordered; QMultiMap<int32, UserData*> ordered;
rows.reserve(_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size()); rows.reserve(_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size());
if (_chat->participants.isEmpty()) { if (_chat->participants.isEmpty()) {
if (_chat->count > 0) { if (_chat->count > 0 && App::api()) {
App::api()->requestFullPeer(_chat); App::api()->requestFullPeer(_chat);
} }
} else { } else {
@ -3015,7 +3018,7 @@ void MentionsDropdown::updateFiltered(bool toDown) {
int32 cnt = 0; int32 cnt = 0;
if (_chat) { if (_chat) {
if (_chat->participants.isEmpty()) { if (_chat->participants.isEmpty()) {
if (_chat->count > 0) { if (_chat->count > 0 && App::api()) {
App::api()->requestFullPeer(_chat); App::api()->requestFullPeer(_chat);
} }
} else { } else {
@ -3023,14 +3026,14 @@ void MentionsDropdown::updateFiltered(bool toDown) {
for (ChatData::Participants::const_iterator i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) { for (ChatData::Participants::const_iterator i = _chat->participants.cbegin(), e = _chat->participants.cend(); i != e; ++i) {
UserData *user = i.key(); UserData *user = i.key();
if (!user->botInfo) continue; if (!user->botInfo) continue;
if (!user->botInfo->inited) App::api()->requestFullPeer(user); if (!user->botInfo->inited && App::api()) App::api()->requestFullPeer(user);
if (user->botInfo->commands.isEmpty()) continue; if (user->botInfo->commands.isEmpty()) continue;
bots.insert(user, true); bots.insert(user, true);
cnt += user->botInfo->commands.size(); cnt += user->botInfo->commands.size();
} }
} }
} else if (_user && _user->botInfo) { } else if (_user && _user->botInfo) {
if (!_user->botInfo->inited) App::api()->requestFullPeer(_user); if (!_user->botInfo->inited && App::api()) App::api()->requestFullPeer(_user);
cnt = _user->botInfo->commands.size(); cnt = _user->botInfo->commands.size();
bots.insert(_user, true); bots.insert(_user, true);
} }
@ -3042,7 +3045,7 @@ void MentionsDropdown::updateFiltered(bool toDown) {
UserData *user = *i; UserData *user = *i;
if (!user->botInfo) continue; if (!user->botInfo) continue;
if (!bots.contains(user)) continue; if (!bots.contains(user)) continue;
if (!user->botInfo->inited) App::api()->requestFullPeer(user); if (!user->botInfo->inited && App::api()) App::api()->requestFullPeer(user);
if (user->botInfo->commands.isEmpty()) continue; if (user->botInfo->commands.isEmpty()) continue;
bots.remove(user); bots.remove(user);
for (int32 j = 0, l = user->botInfo->commands.size(); j < l; ++j) { for (int32 j = 0, l = user->botInfo->commands.size(); j < l; ++j) {

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -431,8 +434,6 @@ private:
}; };
class EmojiSwitchButton : public Button { class EmojiSwitchButton : public Button {
Q_OBJECT
public: public:
EmojiSwitchButton(QWidget *parent, bool toStickers); // otherwise toEmoji EmojiSwitchButton(QWidget *parent, bool toStickers); // otherwise toEmoji

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "fileuploader.h" #include "fileuploader.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "button.h" #include "button.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -13,7 +13,7 @@
GNU General Public License for more details. GNU General Public License for more details.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"

View File

@ -13,7 +13,7 @@
GNU General Public License for more details. GNU General Public License for more details.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"
@ -199,7 +202,7 @@ void CountryInput::onFinishCountry() {
} }
void CountryInput::setText(const QString &newText) { void CountryInput::setText(const QString &newText) {
_text = _st.font->m.elidedText(newText, Qt::ElideRight, width() - _st.textMrg.left() - _st.textMrg.right()); _text = _st.font->elided(newText, width() - _st.textMrg.left() - _st.textMrg.right());
} }
CountryInput::~CountryInput() { CountryInput::~CountryInput() {
@ -315,7 +318,7 @@ void CountryList::paintEvent(QPaintEvent *e) {
} }
p.setFont(_st.font->f); p.setFont(_st.font->f);
p.setPen(_st.color->p); p.setPen(_st.color->p);
p.drawText(textRect, _st.font->m.elidedText(QString::fromUtf8((*countriesNow)[i]->name), Qt::ElideRight, width() - 2 * _st.margin - _st.codeWidth), QTextOption(style::al_left)); 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.setFont(_st.codeFont->f);
p.setPen(_st.codeColor->p); p.setPen(_st.codeColor->p);
p.drawText(textRect, QString("+") + (*countriesNow)[i]->code, QTextOption(style::al_right)); p.drawText(textRect, QString("+") + (*countriesNow)[i]->code, QTextOption(style::al_right));
@ -495,8 +498,8 @@ void CountrySelect::paintEvent(QPaintEvent *e) {
// draw box title / text // draw box title / text
p.setPen(st::black->p); p.setPen(st::black->p);
p.setFont(st::boxTitleFont->f); p.setFont(st::old_boxTitleFont->f);
p.drawText(_innerLeft + st::boxTitlePos.x(), _innerTop + st::boxTitlePos.y() + st::boxTitleFont->ascent, lang(lng_country_select)); p.drawText(_innerLeft + st::old_boxTitlePos.x(), _innerTop + st::old_boxTitlePos.y() + st::old_boxTitleFont->ascent, lang(lng_country_select));
} }
} }
} }

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -16,8 +16,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "gui/emoji_config.h" #include "gui/emoji_config.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "gui/filedialog.h" #include "gui/filedialog.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "gui/flatbutton.h" #include "gui/flatbutton.h"
@ -69,7 +72,7 @@ void FlatButton::setAutoFontSize(int32 padding, const QString &txt) {
} }
int32 FlatButton::textWidth() const { int32 FlatButton::textWidth() const {
return _st.font->m.width(_text); return _st.font->width(_text);
} }
void FlatButton::resizeEvent(QResizeEvent *e) { void FlatButton::resizeEvent(QResizeEvent *e) {
@ -77,7 +80,7 @@ void FlatButton::resizeEvent(QResizeEvent *e) {
_autoFont = _st.font; _autoFont = _st.font;
for (int32 s = _st.font->f.pixelSize(); s >= st::fsize; --s) { for (int32 s = _st.font->f.pixelSize(); s >= st::fsize; --s) {
_autoFont = style::font(s, _st.font->flags(), _st.font->family()); _autoFont = style::font(s, _st.font->flags(), _st.font->family());
if (2 * _autoFontPadding + _autoFont->m.width(_textForAutoSize) <= width()) { if (2 * _autoFontPadding + _autoFont->width(_textForAutoSize) <= width()) {
break; break;
} }
} }
@ -149,7 +152,7 @@ void BottomButton::paintEvent(QPaintEvent *e) {
LinkButton::LinkButton(QWidget *parent, const QString &text, const style::linkButton &st) : Button(parent), _text(text), _st(st) { LinkButton::LinkButton(QWidget *parent, const QString &text, const style::linkButton &st) : Button(parent), _text(text), _st(st) {
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
resize(_st.font->m.width(_text), _st.font->height); resize(_st.font->width(_text), _st.font->height);
setCursor(style::cur_pointer); setCursor(style::cur_pointer);
} }
@ -162,7 +165,7 @@ void LinkButton::paintEvent(QPaintEvent *e) {
void LinkButton::setText(const QString &text) { void LinkButton::setText(const QString &text) {
_text = text; _text = text;
resize(_st.font->m.width(_text), _st.font->height); resize(_st.font->width(_text), _st.font->height);
update(); update();
} }
@ -177,9 +180,9 @@ IconedButton::IconedButton(QWidget *parent, const style::iconedButton &st, const
_text(text), _st(st), _width(_st.width), a_opacity(_st.opacity), a_bg(_st.bgColor->c), _opacity(1) { _text(text), _st(st), _width(_st.width), a_opacity(_st.opacity), a_bg(_st.bgColor->c), _opacity(1) {
if (_width < 0) { if (_width < 0) {
_width = _st.font->m.width(text) - _width; _width = _st.font->width(text) - _width;
} else if (!_width) { } else if (!_width) {
_width = _st.font->m.width(text) + _st.height - _st.font->height; _width = _st.font->width(text) + _st.height - _st.font->height;
} }
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
resize(_width, _st.height); resize(_width, _st.height);
@ -195,9 +198,9 @@ void IconedButton::setText(const QString &text) {
if (_text != text) { if (_text != text) {
_text = text; _text = text;
if (_st.width < 0) { if (_st.width < 0) {
_width = _st.font->m.width(text) - _st.width; _width = _st.font->width(text) - _st.width;
} else if (!_st.width) { } else if (!_st.width) {
_width = _st.font->m.width(text) + _st.height - _st.font->height; _width = _st.font->width(text) + _st.height - _st.font->height;
} }
resize(_width, _st.height); resize(_width, _st.height);
update(); update();
@ -291,3 +294,70 @@ void MaskedButton::paintEvent(QPaintEvent *e) {
p.drawPixmap(t, App::sprite(), i); p.drawPixmap(t, App::sprite(), i);
} }
} }
BoxButton::BoxButton(QWidget *parent, const QString &text, const style::BoxButton &st) : Button(parent),
_text(text), _fullText(text), _textWidth(st.font->width(text)),
_st(st),
a_textBgOverOpacity(0), a_textFg(st.textFg->c), _a_over(animFunc(this, &BoxButton::animStep_over)) {
if (_st.width <= 0) {
resize(_textWidth - _st.width, _st.height);
} else if (_st.width < _textWidth + (_st.height - _st.font->height)) {
_text = _st.font->elided(_fullText, qMax(_st.width - (_st.height - _st.font->height), 1.));
_textWidth = _st.font->width(_text);
}
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
setCursor(style::cur_pointer);
setAttribute(Qt::WA_OpaquePaintEvent);
}
void BoxButton::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(rect(), _st.textBg->b);
float64 o = a_textBgOverOpacity.current();
if (o > 0) {
p.setOpacity(o);
App::roundRect(p, rect(), _st.textBgOver);
p.setOpacity(1);
p.setPen(a_textFg.current());
} else {
p.setPen(_st.textFg);
}
p.setFont(_st.font);
p.drawText((width() - _textWidth) / 2, _st.textTop + _st.font->ascent, _text);
}
bool BoxButton::animStep_over(float64 ms) {
float64 dt = ms / _st.duration;
bool res = true;
if (dt >= 1) {
a_textFg.finish();
a_textBgOverOpacity.finish();
res = false;
} else {
a_textFg.update(dt, anim::linear);
a_textBgOverOpacity.update(dt, anim::linear);
}
update();
return res;
}
void BoxButton::onStateChange(int oldState, ButtonStateChangeSource source) {
float64 textBgOverOpacity = (_state & StateOver) ? 1 : 0;
style::color textFg = (_state & StateOver) ? (_st.textFgOver) : _st.textFg;
a_textBgOverOpacity.start(textBgOverOpacity);
a_textFg.start(textFg->c);
if (source == ButtonByUser || source == ButtonByPress) {
_a_over.stop();
a_textBgOverOpacity.finish();
a_textFg.finish();
update();
} else {
_a_over.start();
}
}

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once
@ -136,3 +139,30 @@ public:
void paintEvent(QPaintEvent *e); void paintEvent(QPaintEvent *e);
}; };
class BoxButton : public Button {
Q_OBJECT
public:
BoxButton(QWidget *parent, const QString &text, const style::BoxButton &st);
void paintEvent(QPaintEvent *e);
bool animStep_over(float64 ms);
public slots:
void onStateChange(int oldState, ButtonStateChangeSource source);
private:
QString _text, _fullText;
int32 _textWidth;
const style::BoxButton &_st;
anim::fvalue a_textBgOverOpacity;
anim::cvalue a_textFg;
Animation _a_over;
};

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"
@ -27,7 +30,7 @@ FlatCheckbox::FlatCheckbox(QWidget *parent, const QString &text, bool checked, c
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
setCursor(_st.cursor); setCursor(_st.cursor);
int32 w = _st.width, h = _st.height; int32 w = _st.width, h = _st.height;
if (w <= 0) w = _st.textLeft + _st.font->m.width(_text) + 2; if (w <= 0) w = _st.textLeft + _st.font->width(_text) + 2;
if (h <= 0) h = qMax(_st.font->height, _st.imageRect.pxHeight()); if (h <= 0) h = qMax(_st.font->height, _st.imageRect.pxHeight());
resize(QSize(w, h)); resize(QSize(w, h));
} }

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "style.h" #include "style.h"
@ -191,8 +194,8 @@ void FlatInput::focusOutEvent(QFocusEvent *e) {
void FlatInput::resizeEvent(QResizeEvent *e) { void FlatInput::resizeEvent(QResizeEvent *e) {
int32 availw = width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1; int32 availw = width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1;
if (_st.font->m.width(_fullph) > availw) { if (_st.font->width(_fullph) > availw) {
_ph = _st.font->m.elidedText(_fullph, Qt::ElideRight, availw); _ph = _st.font->elided(_fullph, availw);
} else { } else {
_ph = _fullph; _ph = _fullph;
} }
@ -455,7 +458,7 @@ _replacingEmojis(false) {
_inner.setFont(_st->font->f); _inner.setFont(_st->font->f);
_inner.setAlignment(cRtl() ? Qt::AlignRight : Qt::AlignLeft); _inner.setAlignment(cRtl() ? Qt::AlignRight : Qt::AlignLeft);
_placeholder = _st->font->m.elidedText(_placeholderFull, Qt::ElideRight, width() - _st->textMargins.left() - _st->textMargins.right() - _st->placeholderMargins.left() - _st->placeholderMargins.right() - 1); _placeholder = _st->font->elided(_placeholderFull, width() - _st->textMargins.left() - _st->textMargins.right() - _st->placeholderMargins.left() - _st->placeholderMargins.right() - 1);
QPalette p(palette()); QPalette p(palette());
p.setColor(QPalette::Text, _st->textFg->c); p.setColor(QPalette::Text, _st->textFg->c);
@ -1057,7 +1060,7 @@ void InputField::InputFieldInner::paintEvent(QPaintEvent *e) {
} }
void InputField::resizeEvent(QResizeEvent *e) { void InputField::resizeEvent(QResizeEvent *e) {
_placeholder = _st->font->m.elidedText(_placeholderFull, Qt::ElideRight, width() - _st->textMargins.left() - _st->textMargins.right() - _st->placeholderMargins.left() - _st->placeholderMargins.right() - 1); _placeholder = _st->font->elided(_placeholderFull, width() - _st->textMargins.left() - _st->textMargins.right() - _st->placeholderMargins.left() - _st->placeholderMargins.right() - 1);
_inner.setGeometry(rect().marginsRemoved(_st->textMargins)); _inner.setGeometry(rect().marginsRemoved(_st->textMargins));
TWidget::resizeEvent(e); TWidget::resizeEvent(e);
} }

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#include "stdafx.h" #include "stdafx.h"

View File

@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014 John Preston, https://desktop.telegram.org Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
*/ */
#pragma once #pragma once

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