diff --git a/LICENSE b/LICENSE index 70566f2d0e..77e1f6119f 100644 --- a/LICENSE +++ b/LICENSE @@ -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 Copyright (C) 2007 Free Software Foundation, Inc. @@ -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 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 -. \ No newline at end of file +. diff --git a/README.md b/README.md index 152906b8ea..c9f43ea9d1 100644 --- a/README.md +++ b/README.md @@ -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. -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 @@ -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)) * Opus codec ([BSD license](http://www.opus-codec.org/license/)) * 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 diff --git a/Telegram/Deploy.sh b/Telegram/Deploy.sh index d01a68def7..f5e4a4df46 100755 --- a/Telegram/Deploy.sh +++ b/Telegram/Deploy.sh @@ -45,7 +45,7 @@ elif [ "$BuildTarget" == "mac" ]; then WinDeployPath="./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull" WinUpdateFile="tupdate$AppVersion" WinSetupFile="tsetup.$AppVersionStrFull.exe" - WinPortableFile="tportable.$AppVersionStr.zip" + WinPortableFile="tportable.$AppVersionStrFull.zip" WinRemoteFolder="tsetup" DropboxPath="./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor" DropboxDeployPath="$DropboxPath/$AppVersionStrFull" diff --git a/Telegram/Resources/lang.strings b/Telegram/Resources/lang.strings index ddccd8bc28..308aa32269 100644 --- a/Telegram/Resources/lang.strings +++ b/Telegram/Resources/lang.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "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_year" = "{month} {day}, {year}"; +"lng_box_ok" = "OK"; +"lng_box_cancel" = "CANCEL"; + "lng_cancel" = "Cancel"; "lng_continue" = "Continue"; "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_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_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_sigin_reset" = "Reset"; +"lng_signin_sure_reset" = "Warning!\n\nYou will lose all your chats and messages,\nalong with any media and files you shared!\n\nDo you want to reset your account?"; +"lng_signin_reset" = "RESET"; "lng_signup_title" = "Information and 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_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_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_path_clearing" = "Clearing.."; "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_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_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_updated" = "Your cloud password was updated."; "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_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_button" = "Terminate"; +"lng_settings_reset_button" = "TERMINATE"; "lng_settings_reset_done" = "Other sessions terminated"; "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_faq_button" = "Go to FAQ"; -"lng_settings_ask_ok" = "Ask"; +"lng_settings_faq_button" = "GO TO FAQ"; +"lng_settings_ask_ok" = "ASK"; "lng_settings_faq" = "Telegram FAQ"; "lng_settings_logout" = "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_restart_now" = "Restart"; -"lng_settings_restart_later" = "Later"; +"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_later" = "LATER"; "lng_sessions_header" = "Current session"; "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_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_next" = "Next"; "lng_create_group_create" = "Create"; "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_about" = "Channels are a tool for broadcasting your messages to unlimited audiences"; "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_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_leave_channel" = "Are you sure, you want\nto leave this 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_leave_channel" = "Are you sure, you want to leave\nthis channel?"; +"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_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_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" = "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_existing" = "Sorry, you have created too many public channels already. Please delete one 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_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_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_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_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."; @@ -528,6 +536,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org "lng_switch_stickers" = "Stickers"; "lng_switch_emoji" = "Emoji"; +"lng_box_remove" = "REMOVE"; + "lng_custom_stickers" = "Custom stickers"; "lng_stickers_remove_pack" = "Remove «{sticker_pack}»?"; "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_hide" = "Hide"; "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_group" = "Are you sure you want\nto report spam in this group?"; -"lng_report_spam_sure_channel" = "Are you sure you want\nto report spam in this channel?"; -"lng_report_spam_ok" = "Report"; +"lng_report_spam_sure" = "Are you sure you want to report spam from this user?"; +"lng_report_spam_sure_group" = "Are you sure you want to report spam in this group?"; +"lng_report_spam_sure_channel" = "Are you sure you want to report spam in this channel?"; +"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_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}"; @@ -572,7 +582,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org "lng_channel_unmute" = "Unmute"; "lng_open_this_link" = "Open this link?"; -"lng_open_link" = "Open"; +"lng_open_link" = "OPEN"; "lng_bot_start" = "Start"; "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_send_file_confirm" = "Send «{name}» 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_forwarding_from" = "{user} and {count:_not_used_|# other|# others}"; "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_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_confirm" = "Delete"; +"lng_box_delete" = "DELETE"; +"lng_box_leave" = "LEAVE"; "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]."; diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt index 0bb12fa882..b7f9ccbecc 100644 --- a/Telegram/Resources/style.txt +++ b/Telegram/Resources/style.txt @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ defaultFontFamily: 'Open Sans'; semibold: 'Open Sans Semibold'; @@ -91,6 +94,40 @@ dialogsSearchField: InputField(defaultInputField) { width: 240px; 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; titleColor: #0f8dcc;//rgb(20, 136, 210); titleHeight: 39px; @@ -936,6 +973,9 @@ defaultTextStyle: textStyle { selectOverlay: msgSelectOverlay; lineHeight: 0px; } +boxTextStyle: textStyle(defaultTextStyle) { + lineHeight: 22px; +} serviceTextStyle: textStyle(defaultTextStyle) { lnkFlags: msgServiceFont; lnkOverFlags: font(fsize semibold underline); @@ -1207,18 +1247,14 @@ layerHideDuration: 200; layerPadding: margins(10px, 10px, 10px, 10px); boxFont: font(16px); -boxPadding: margins(18px, 18px, 18px, 18px); boxVerticalMargin: 10px; -boxWidth: 364px; -boxMaxListHeight: 600px; - boxBG: white; boxGrayTitle: #777; -boxTitlePos: point(20px, 15px); -boxTitleFont: font(17px); -boxTitleHeight: 52px; +old_boxTitlePos: point(20px, 15px); +old_boxTitleFont: font(17px); +old_boxTitleHeight: 52px; confirmMaxHeight: 320px; confirmCompressedSkip: 10px; @@ -1229,6 +1265,9 @@ inpAddContact: flatInput(inpDefGray) { textMrg: margins(10px, 5px, 10px, 5px); font: font(15px); } +contactUserIcon: sprite(120px, 90px, 18px, 18px); +contactPhoneIcon: sprite(138px, 90px, 18px, 18px); +contactAddIcon: sprite(307px, 248px, 22px, 16px); btnNewGroup: iconedButton(btnDefIconed) { icon: sprite(189px, 118px, 18px, 17px); @@ -1280,7 +1319,6 @@ notifyHeight: 80px; notifyDeltaX: 6px; notifyDeltaY: 7px; -cropBoxWidth: 364px; cropPointSize: 10px; cropMinSize: 20px; @@ -1331,10 +1369,11 @@ btnShareContact: flatButton(btnDefNext, btnDefBig) { overFont: font(17px); } profileMinBtnPadding: 10px; +inviteCheckIcon: sprite(187px, 61px, 18px, 14px); +inviteCheckActiveIcon: sprite(187px, 75px, 18px, 14px); membersPadding: margins(0px, 10px, 0px, 10px); -forwardWidth: 364px; forwardMargins: margins(30px, 10px, 30px, 10px); forwardFont: font(16px); forwardBg: rgba(0, 0, 0, 76); @@ -1431,7 +1470,7 @@ newGroupName: flatInput(inpDefGray) { newGroupLink: flatInput(inpDefFlat) { width: 340px; height: 42px; - font: font(15px); + font: boxTextFont; textMrg: margins(12px, 4px, 12px, 4px); bgColor: transparent; bgActive: transparent; @@ -1559,7 +1598,7 @@ aboutCloseButton: flatButton(contactsClose) { downTextTop: 16px; } btnInfoClose: flatButton(aboutCloseButton) { - width: boxWidth; + width: boxWideWidth; } emojiTextFont: font(16px); @@ -1839,7 +1878,6 @@ stickerIconPadding: 5px; stickerIconOpacity: 0.7; stickerIconSel: 2px; stickerIconSelColor: #58b2ed; -stickerIconRecent: sprite(342px, 50px, 21px, 22px); stickerIconLeft: sprite(342px, 72px, 40px, 1px); stickerIconRight: sprite(342px, 73px, 40px, 1px); stickerIconMove: 400; @@ -2114,7 +2152,7 @@ sessionsHeight: 440px; sessionHeight: 70px; sessionPadding: margins(20px, 10px, 20px, 0); sessionsCloseButton: flatButton(aboutCloseButton) { - width: boxWidth; + width: boxWideWidth; } sessionNameFont: msgNameFont; sessionActiveFont: msgDateFont; diff --git a/Telegram/Resources/style_classes.txt b/Telegram/Resources/style_classes.txt index c5e24ba340..715c5a7d8a 100644 --- a/Telegram/Resources/style_classes.txt +++ b/Telegram/Resources/style_classes.txt @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ textStyle { lnkFlags: font; @@ -268,6 +271,21 @@ botKeyboardButton { 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 { textFg: color; textMargins: margins; diff --git a/Telegram/SourceFiles/_other/genemoji.cpp b/Telegram/SourceFiles/_other/genemoji.cpp index 6a61c2e4f8..a258bd5301 100644 --- a/Telegram/SourceFiles/_other/genemoji.cpp +++ b/Telegram/SourceFiles/_other/genemoji.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\ */\n"; tcpp << "#include \"stdafx.h\"\n#include \"gui/emoji_config.h\"\n\n"; diff --git a/Telegram/SourceFiles/_other/genemoji.h b/Telegram/SourceFiles/_other/genemoji.h index 91420feee3..2198d66d61 100644 --- a/Telegram/SourceFiles/_other/genemoji.h +++ b/Telegram/SourceFiles/_other/genemoji.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include #include diff --git a/Telegram/SourceFiles/_other/genlang.cpp b/Telegram/SourceFiles/_other/genlang.cpp index bc69f7e962..6f37418056 100644 --- a/Telegram/SourceFiles/_other/genlang.cpp +++ b/Telegram/SourceFiles/_other/genlang.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\ */\n"; tcpp << "#include \"stdafx.h\"\n#include \"lang.h\"\n\n"; tcpp << "namespace {\n"; diff --git a/Telegram/SourceFiles/_other/genlang.h b/Telegram/SourceFiles/_other/genlang.h index e352d3b35e..7f273bb430 100644 --- a/Telegram/SourceFiles/_other/genlang.h +++ b/Telegram/SourceFiles/_other/genlang.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include #include diff --git a/Telegram/SourceFiles/_other/genstyles.cpp b/Telegram/SourceFiles/_other/genstyles.cpp index 5f705afb5d..edaac42602 100644 --- a/Telegram/SourceFiles/_other/genstyles.cpp +++ b/Telegram/SourceFiles/_other/genstyles.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\ */\n"; tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace style {\n"; 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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\ */\n"; tout << "#pragma once\n\n#include \"style.h\"\n\nnamespace st {\n"; 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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\ */\n"; tcpp << "#include \"stdafx.h\"\n#include \"style_auto.h\"\n\nnamespace {\n"; 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\ GNU General Public License for more details.\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\ -Copyright (c) 2014 John Preston, https://desktop.telegram.org\n\ +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org\n\ */\n"; tnum << "#include \"stdafx.h\"\n#include \"numbers.h\"\n\n"; tnum << "QVector phoneNumberParse(const QString &number) {\n"; diff --git a/Telegram/SourceFiles/_other/genstyles.h b/Telegram/SourceFiles/_other/genstyles.h index 05c0339706..ac959eb1bd 100644 --- a/Telegram/SourceFiles/_other/genstyles.h +++ b/Telegram/SourceFiles/_other/genstyles.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include #include diff --git a/Telegram/SourceFiles/_other/memain.cpp b/Telegram/SourceFiles/_other/memain.cpp index 02d7d57029..6daade312c 100644 --- a/Telegram/SourceFiles/_other/memain.cpp +++ b/Telegram/SourceFiles/_other/memain.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "memain.h" diff --git a/Telegram/SourceFiles/_other/memain.h b/Telegram/SourceFiles/_other/memain.h index 18416ffd80..c2faceb850 100644 --- a/Telegram/SourceFiles/_other/memain.h +++ b/Telegram/SourceFiles/_other/memain.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include diff --git a/Telegram/SourceFiles/_other/mlmain.cpp b/Telegram/SourceFiles/_other/mlmain.cpp index f37e75a196..490ce50efe 100644 --- a/Telegram/SourceFiles/_other/mlmain.cpp +++ b/Telegram/SourceFiles/_other/mlmain.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "mlmain.h" diff --git a/Telegram/SourceFiles/_other/mlmain.h b/Telegram/SourceFiles/_other/mlmain.h index 150d3330f0..a909bb5025 100644 --- a/Telegram/SourceFiles/_other/mlmain.h +++ b/Telegram/SourceFiles/_other/mlmain.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include diff --git a/Telegram/SourceFiles/_other/msmain.cpp b/Telegram/SourceFiles/_other/msmain.cpp index 8719d58400..e9bbff0f9c 100644 --- a/Telegram/SourceFiles/_other/msmain.cpp +++ b/Telegram/SourceFiles/_other/msmain.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "msmain.h" #include diff --git a/Telegram/SourceFiles/_other/msmain.h b/Telegram/SourceFiles/_other/msmain.h index ecc391757d..f0e13771a2 100644 --- a/Telegram/SourceFiles/_other/msmain.h +++ b/Telegram/SourceFiles/_other/msmain.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index bd1a7df10c..a8839df97b 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "packer.h" diff --git a/Telegram/SourceFiles/_other/packer.h b/Telegram/SourceFiles/_other/packer.h index 071c6f9847..b82ccd71c2 100644 --- a/Telegram/SourceFiles/_other/packer.h +++ b/Telegram/SourceFiles/_other/packer.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/_other/updater.cpp b/Telegram/SourceFiles/_other/updater.cpp index 69d6438647..d78f215bf1 100644 --- a/Telegram/SourceFiles/_other/updater.cpp +++ b/Telegram/SourceFiles/_other/updater.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "updater.h" diff --git a/Telegram/SourceFiles/_other/updater.h b/Telegram/SourceFiles/_other/updater.h index f3b443234e..6afd341a33 100644 --- a/Telegram/SourceFiles/_other/updater.h +++ b/Telegram/SourceFiles/_other/updater.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/_other/updater_linux.cpp b/Telegram/SourceFiles/_other/updater_linux.cpp index c616c727df..35d67072c9 100644 --- a/Telegram/SourceFiles/_other/updater_linux.cpp +++ b/Telegram/SourceFiles/_other/updater_linux.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include #include diff --git a/Telegram/SourceFiles/_other/updater_osx.m b/Telegram/SourceFiles/_other/updater_osx.m index b27329095b..4c3e7c4fbb 100644 --- a/Telegram/SourceFiles/_other/updater_osx.m +++ b/Telegram/SourceFiles/_other/updater_osx.m @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #import diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 905639570d..ad156f5e75 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 3295df9ce0..03b5d98a79 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index f66d8d2afc..d87e883425 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -93,7 +96,15 @@ namespace { 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 CornersMap; + CornersMap cornersMap; QImage *cornersMask[4] = { 0 }; typedef QMap EmojisMap; @@ -618,7 +629,7 @@ namespace App { } else { if (i.key()->botInfo) { 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) { found = true; @@ -668,7 +679,7 @@ namespace App { chat->count++; if (user->botInfo) { 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 { @@ -1887,9 +1898,11 @@ namespace App { cors[1] = rect.copy(r * 2, 0, r, r); 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)); - for (int i = 0; i < 4; ++i) { - ::corners[index][i] = new QPixmap(QPixmap::fromImage(cors[i], Qt::ColorOnly)); - ::corners[index][i]->setDevicePixelRatio(cRetinaFactor()); + if (index != NoneCorners) { + for (int i = 0; i < 4; ++i) { + ::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]; - prepareCorners(MaskCorners, st::msgRadius, st::white, 0, mask); + prepareCorners(NoneCorners, st::msgRadius, st::white, 0, mask); for (int i = 0; i < 4; ++i) { ::cornersMask[i] = new QImage(mask[i].convertToFormat(QImage::Format_ARGB32_Premultiplied)); ::cornersMask[i]->setDevicePixelRatio(cRetinaFactor()); @@ -1968,10 +1981,16 @@ namespace App { ::emojisLarge = 0; for (int32 j = 0; j < 4; ++j) { 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; } + 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(); otherEmojisMap.clear(); @@ -2394,13 +2413,8 @@ namespace App { QImage **cornersMask() { return ::cornersMask; } - QPixmap **corners(RoundCorners index) { - return ::corners[index]; - } - - 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(); + void roundRect(Painter &p, int32 x, int32 y, int32 w, int32 h, const style::color &bg, const CornersPixmaps &c, const style::color *sh) { + int32 cw = c.p[0]->width() / cIntRetinaFactor(), ch = c.p[0]->height() / cIntRetinaFactor(); if (w < 2 * cw || h < 2 * ch) return; if (w > 2 * cw) { p.fillRect(QRect(x + cw, y, w - 2 * cw, ch), bg->b); @@ -2410,20 +2424,41 @@ namespace App { if (h > 2 * ch) { p.fillRect(QRect(x, y + ch, w, h - 2 * ch), bg->b); } - p.drawPixmap(QPoint(x, y), *c[0]); - p.drawPixmap(QPoint(x + w - cw, y), *c[1]); - p.drawPixmap(QPoint(x, y + h - ch), *c[2]); - p.drawPixmap(QPoint(x + w - cw, y + h - ch), *c[3]); + p.drawPixmap(QPoint(x, y), *c.p[0]); + p.drawPixmap(QPoint(x + w - cw, y), *c.p[1]); + p.drawPixmap(QPoint(x, y + h - ch), *c.p[2]); + 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) { - QPixmap **c = App::corners(index); - int32 cw = c[0]->width() / cIntRetinaFactor(), ch = c[0]->height() / cIntRetinaFactor(); + const CornersPixmaps &c = ::corners[index]; + 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, 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 + w - cw, y + h - ch + st::msgShadow, *c[3]); + p.drawPixmap(x, y + h - ch + st::msgShadow, *c.p[2]); + 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) { diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index 97fc159a93..9fdcfaa6c0 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -44,7 +47,7 @@ struct ReplyMarkup { }; enum RoundCorners { - MaskCorners = 0x00, // for images + NoneCorners = 0x00, // for images BlackCorners, ServiceCorners, ServiceSelectedCorners, @@ -260,7 +263,6 @@ namespace App { void openLocalUrl(const QString &url); 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); 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); @@ -269,6 +271,10 @@ namespace App { 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); } + 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); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 7a8d81f7fe..8e410f1ff3 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "application.h" diff --git a/Telegram/SourceFiles/application.h b/Telegram/SourceFiles/application.h index b4e1f0effe..09fb85c223 100644 --- a/Telegram/SourceFiles/application.h +++ b/Telegram/SourceFiles/application.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/art/sprite.png b/Telegram/SourceFiles/art/sprite.png index db3f756b2b..59ccef9780 100644 Binary files a/Telegram/SourceFiles/art/sprite.png and b/Telegram/SourceFiles/art/sprite.png differ diff --git a/Telegram/SourceFiles/art/sprite_200x.png b/Telegram/SourceFiles/art/sprite_200x.png index 06e97a19d8..b87d84f1e7 100644 Binary files a/Telegram/SourceFiles/art/sprite_200x.png and b/Telegram/SourceFiles/art/sprite_200x.png differ diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp index 4b7b10bdcd..a512c4ac98 100644 --- a/Telegram/SourceFiles/audio.cpp +++ b/Telegram/SourceFiles/audio.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "audio.h" diff --git a/Telegram/SourceFiles/audio.h b/Telegram/SourceFiles/audio.h index 323613c723..7a4da6e8f1 100644 --- a/Telegram/SourceFiles/audio.h +++ b/Telegram/SourceFiles/audio.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/autoupdater.cpp b/Telegram/SourceFiles/autoupdater.cpp index a84b3ca54f..3f4910e0c0 100644 --- a/Telegram/SourceFiles/autoupdater.cpp +++ b/Telegram/SourceFiles/autoupdater.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/autoupdater.h b/Telegram/SourceFiles/autoupdater.h index f8580c6b33..f8f7f87174 100644 --- a/Telegram/SourceFiles/autoupdater.h +++ b/Telegram/SourceFiles/autoupdater.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 685131f9ea..71bc8e3049 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -32,8 +35,8 @@ _text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle) { _version.move(0, st::aboutVersionTop); _text.move(0, st::aboutTextTop); - _headerWidth = st::aboutHeaderFont->m.width(qsl("Telegram ")); - _subheaderWidth = st::aboutSubheaderFont->m.width(qsl("Desktop")); + _headerWidth = st::aboutHeaderFont->width(qsl("Telegram ")); + _subheaderWidth = st::aboutSubheaderFont->width(qsl("Desktop")); _done.move(0, height() - _done.height()); diff --git a/Telegram/SourceFiles/boxes/aboutbox.h b/Telegram/SourceFiles/boxes/aboutbox.h index 35d3dd2105..36ab712804 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.h +++ b/Telegram/SourceFiles/boxes/aboutbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/abstractbox.cpp b/Telegram/SourceFiles/boxes/abstractbox.cpp index ef0e69c5eb..3aad571fc3 100644 --- a/Telegram/SourceFiles/boxes/abstractbox.cpp +++ b/Telegram/SourceFiles/boxes/abstractbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -24,8 +27,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #include "mainwidget.h" #include "window.h" -AbstractBox::AbstractBox() : _maxHeight(0), _hiding(false), a_opacity(0, 1) { - resize(st::boxWidth, 0); +AbstractBox::AbstractBox(int32 w) : _maxHeight(0), _hiding(false), a_opacity(0, 1) { + resize(w, 0); } void AbstractBox::prepare() { @@ -65,20 +68,20 @@ bool AbstractBox::paint(QPainter &p) { void AbstractBox::paintTitle(Painter &p, const QString &title, bool withShadow) { if (withShadow) { // 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 - p.setFont(st::boxTitleFont->f); + p.setFont(st::old_boxTitleFont->f); 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) { // draw box title p.setFont(st::boxFont->f); 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) { @@ -134,7 +137,7 @@ void AbstractBox::startHide() { } 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) { diff --git a/Telegram/SourceFiles/boxes/abstractbox.h b/Telegram/SourceFiles/boxes/abstractbox.h index b50f2a1338..6029a65e06 100644 --- a/Telegram/SourceFiles/boxes/abstractbox.h +++ b/Telegram/SourceFiles/boxes/abstractbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -24,7 +27,7 @@ class AbstractBox : public LayeredWidget { public: - AbstractBox(); + AbstractBox(int32 w = st::boxWideWidth); void parentResized(); void animStep(float64 ms); void keyPressEvent(QKeyEvent *e); @@ -73,7 +76,7 @@ public: 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 showAll(); @@ -92,4 +95,4 @@ public: ItemListBox(const style::flatScroll &scroll); -}; \ No newline at end of file +}; diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index c467a64125..f426106a9f 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -63,15 +66,15 @@ void AddContactBox::initBox() { if (_peer) { if (_peer->isUser()) { _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()) { _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 { bool readyToAdd = !_phoneInput.text().isEmpty() && (!_firstInput.text().isEmpty() || !_lastInput.text().isEmpty()); _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(); @@ -169,7 +172,7 @@ void AddContactBox::paintEvent(QPaintEvent *e) { } else { // draw box text 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(); 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) { 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()); _phoneInput.setGeometry(st::addContactPadding.left(), _firstInput.y() + _firstInput.height() + st::addContactDelta, _lastInput.width(), _lastInput.height()); } 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()); _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(); _phoneInput.hide(); _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(); setMaxHeight(h); update(); @@ -342,7 +345,7 @@ void AddContactBox::onRetry() { _phoneInput.setDisabled(false); _retryButton.hide(); _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(); } @@ -473,7 +476,7 @@ QRect EditChannelBox::descriptionRect() const { } 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::newGroupPublicLinkSkip + _publicLink.height(); h += st::newGroupPadding.bottom() + _saveButton.height(); @@ -497,7 +500,7 @@ bool EditChannelBox::eventFilter(QObject *obj, QEvent *e) { void EditChannelBox::resizeEvent(QResizeEvent *e) { _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()); @@ -577,7 +580,7 @@ bool EditChannelBox::onSaveFail(const RPCError &error, mtpRequestId req) { _saveDescriptionRequestId = 0; if (err == qstr("CHAT_ABOUT_NOT_MODIFIED")) { _channel->about = _sentDescription; - emit App::api()->fullPeerUpdated(_channel); + if (App::api()) emit App::api()->fullPeerUpdated(_channel); onClose(); } else { _description.setFocus(); @@ -595,6 +598,6 @@ void EditChannelBox::onSaveTitleDone(const MTPUpdates &updates) { void EditChannelBox::onSaveDescriptionDone(const MTPBool &result) { _saveDescriptionRequestId = 0; _channel->about = _sentDescription; - emit App::api()->fullPeerUpdated(_channel); + if (App::api()) emit App::api()->fullPeerUpdated(_channel); onClose(); } diff --git a/Telegram/SourceFiles/boxes/addcontactbox.h b/Telegram/SourceFiles/boxes/addcontactbox.h index b7c20ec58d..29f452a611 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.h +++ b/Telegram/SourceFiles/boxes/addcontactbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/autolockbox.cpp b/Telegram/SourceFiles/boxes/autolockbox.cpp index ec6ad7c5c4..0f271b6c61 100644 --- a/Telegram/SourceFiles/boxes/autolockbox.cpp +++ b/Telegram/SourceFiles/boxes/autolockbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.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]); - 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); for (int32 i = 0; i < cnt; ++i) { int32 v = opts[i]; diff --git a/Telegram/SourceFiles/boxes/autolockbox.h b/Telegram/SourceFiles/boxes/autolockbox.h index bef0d18d1f..12edab8e43 100644 --- a/Telegram/SourceFiles/boxes/autolockbox.h +++ b/Telegram/SourceFiles/boxes/autolockbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/backgroundbox.cpp b/Telegram/SourceFiles/boxes/backgroundbox.cpp index 7341fad737..7c523c157d 100644 --- a/Telegram/SourceFiles/boxes/backgroundbox.cpp +++ b/Telegram/SourceFiles/boxes/backgroundbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/boxes/backgroundbox.h b/Telegram/SourceFiles/boxes/backgroundbox.h index c53b8f5301..ea3f1aa616 100644 --- a/Telegram/SourceFiles/boxes/backgroundbox.h +++ b/Telegram/SourceFiles/boxes/backgroundbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index 407b099293..bbb158c6bd 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -31,42 +34,38 @@ TextParseOptions _confirmBoxTextOptions = { Qt::LayoutDirectionAuto, // dir }; -ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const QString &cancelText, const style::flatButton &doneStyle, const style::flatButton &cancelStyle) : _infoMsg(false), -_confirm(this, doneText.isEmpty() ? lang(lng_continue) : doneText, doneStyle), -_cancel(this, cancelText.isEmpty() ? lang(lng_cancel) : cancelText, cancelStyle), -_close(this, QString(), st::btnInfoClose), -_text(100) { +ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const style::BoxButton &doneStyle, const QString &cancelText, const style::BoxButton &cancelStyle) : AbstractBox(st::boxWidth), +_informative(false), +_text(100), +_confirm(this, doneText.isEmpty() ? lang(lng_box_ok) : doneText, doneStyle), +_cancel(this, cancelText.isEmpty() ? lang(lng_box_cancel) : cancelText, cancelStyle) { init(text); } -ConfirmBox::ConfirmBox(const QString &text, bool noDone, const QString &cancelText) : _infoMsg(true), -_confirm(this, QString(), st::btnSelectDone), -_cancel(this, QString(), st::btnSelectCancel), -_close(this, cancelText.isEmpty() ? lang(lng_close) : cancelText, st::btnInfoClose), -_text(100) { +ConfirmBox::ConfirmBox(const QString &text, const QString &doneText, const style::BoxButton &doneStyle, bool informative) : AbstractBox(st::boxWidth), +_informative(true), +_text(100), +_confirm(this, doneText.isEmpty() ? lang(lng_box_ok) : doneText, doneStyle), +_cancel(this, QString(), st::cancelBoxButton) { init(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(); - _textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxFont->height); - setMaxHeight(st::boxPadding.top() + _textHeight + st::boxPadding.bottom() + (_infoMsg ? _close.height() : _confirm.height())); + textstyleSet(&st::boxTextStyle); + _textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right(); + _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) { - _confirm.hide(); + connect(&_confirm, SIGNAL(clicked()), this, SIGNAL(confirmed())); + connect(&_cancel, SIGNAL(clicked()), this, SLOT(onCancel())); + if (_informative) { _cancel.hide(); - - 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())); + connect(this, SIGNAL(confirmed()), this, SLOT(onCancel())); } + setMouseTracking(_text.hasLinks()); prepare(); } @@ -121,7 +120,9 @@ void ConfirmBox::updateLink() { void ConfirmBox::updateHover() { QPoint m(mapFromGlobal(_lastMousePos)); 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); + textstyleRestore(); if (_myLink != textlnkOver()) { if (wasMy || _myLink || rect().contains(m)) { textlnkOver(_myLink); @@ -138,12 +139,11 @@ void ConfirmBox::closePressed() { void ConfirmBox::hideAll() { _confirm.hide(); _cancel.hide(); - _close.hide(); } void ConfirmBox::showAll() { - if (_infoMsg) { - _close.show(); + if (_informative) { + _confirm.show(); } else { _confirm.show(); _cancel.show(); @@ -162,27 +162,16 @@ void ConfirmBox::paintEvent(QPaintEvent *e) { QPainter p(this); 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 - p.setFont(st::boxFont->f); 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) { - if (_infoMsg) { - _close.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom()); - } else { - _confirm.move(width() - _confirm.width(), st::boxPadding.top() + _textHeight + st::boxPadding.bottom()); - _cancel.move(0, st::boxPadding.top() + _textHeight + st::boxPadding.bottom()); - } + _confirm.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _confirm.height(), width()); + _cancel.moveToRight(st::boxButtonPadding.right() + _confirm.width() + st::boxButtonPadding.left(), _confirm.y(), width()); } 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(); } -MaxInviteBox::MaxInviteBox(const QString &link) : -_close(this, lang(lng_close), st::btnInfoClose), -_text(st::boxFont, lng_participant_invite_sorry(lt_count, QString::number(cMaxGroupCount())), _confirmBoxTextOptions), +MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth), +_close(this, lang(lng_box_ok), st::defaultBoxButton), +_text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxPadding.right()), _link(link), _linkOver(false), a_goodOpacity(0, 0), a_good(animFunc(this, &MaxInviteBox::goodAnimStep)) { setMouseTracking(true); - _textWidth = st::boxWidth + 10 - st::boxPadding.left() - st::boxPadding.right(); - _textHeight = qMin(_text.countHeight(_textWidth), 16 * st::boxFont->height); - setMaxHeight(st::boxPadding.top() + _textHeight + st::newGroupLinkPadding.top() + st::newGroupLink.height + st::newGroupLinkPadding.bottom() + _close.height()); + _textWidth = st::boxWidth - st::boxPadding.left() - st::boxPadding.right(); + _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() + st::boxButtonPadding.bottom()); connect(&_close, SIGNAL(clicked()), this, SLOT(onClose())); @@ -269,9 +258,8 @@ void MaxInviteBox::paintEvent(QPaintEvent *e) { if (paint(p)) return; // draw box title / text - p.setFont(st::boxFont->f); 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); option.setWrapMode(QTextOption::WrapAnywhere); @@ -288,6 +276,6 @@ void MaxInviteBox::paintEvent(QPaintEvent *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); } diff --git a/Telegram/SourceFiles/boxes/confirmbox.h b/Telegram/SourceFiles/boxes/confirmbox.h index c6f1e7b5ed..f2a23bf407 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.h +++ b/Telegram/SourceFiles/boxes/confirmbox.h @@ -12,20 +12,23 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once #include "abstractbox.h" +class InformBox; class ConfirmBox : public AbstractBox { Q_OBJECT 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, bool noDone, const QString &cancelText = QString()); + ConfirmBox(const QString &text, const QString &doneText = QString(), const style::BoxButton &doneStyle = st::defaultBoxButton, const QString &cancelText = QString(), const style::BoxButton &cancelStyle = st::cancelBoxButton); void keyPressEvent(QKeyEvent *e); void paintEvent(QPaintEvent *e); void resizeEvent(QResizeEvent *e); @@ -53,12 +56,13 @@ protected: private: + ConfirmBox(const QString &text, const QString &doneText, const style::BoxButton &doneStyle, bool informative); + friend class InformBox; + void init(const QString &text); - bool _infoMsg; + bool _informative; - FlatButton _confirm, _cancel; - BottomButton _close; Text _text; int32 _textWidth, _textHeight; @@ -66,6 +70,14 @@ private: QPoint _lastMousePos; 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 { @@ -108,7 +120,7 @@ private: void updateSelected(const QPoint &cursorGlobalPosition); bool goodAnimStep(float64 ms); - BottomButton _close; + BoxButton _close; Text _text; int32 _textWidth, _textHeight; diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp index fca3a99e34..b1b69c7961 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.cpp +++ b/Telegram/SourceFiles/boxes/connectionbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -69,7 +72,7 @@ void ConnectionBox::showAll() { _tcpProxyRadio.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()) { h += 2 * st::boxPadding.top() + 2 * _hostInput.height(); _hostInput.show(); @@ -113,7 +116,7 @@ void ConnectionBox::paintEvent(QPaintEvent *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); int32 inputy = 0; diff --git a/Telegram/SourceFiles/boxes/connectionbox.h b/Telegram/SourceFiles/boxes/connectionbox.h index 0f5168620a..b15060a78c 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.h +++ b/Telegram/SourceFiles/boxes/connectionbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 7978ebd01e..86b86da3cb 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.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)) { int32 availw = width() - (left + st::profileListPhotoSize + st::profileListPadding.width() * 2); 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()) { 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 { p.setPen(st::profileOnlineColor->p); p.drawText(left + st::profileListPhotoSize + st::profileListPadding.width(), st::profileListPadding.height() + st::profileListPhotoSize - st::profileListStatusBottom, first); 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 { if (data->inchat || data->check) { @@ -1300,7 +1303,7 @@ void ContactsBox::paintEvent(QPaintEvent *e) { if (!addingAdmin) { 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 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(); return true; } 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 false; @@ -1430,7 +1433,7 @@ bool ContactsBox::creationFail(const RPCError &error) { MembersInner::MembersInner(ChannelData *channel, MembersFilter filter) : _channel(channel), _filter(filter), _kickText(lang(lng_profile_kick)), _time(0), -_kickWidth(st::normalFont->m.width(_kickText)), +_kickWidth(st::normalFont->width(_kickText)), _sel(-1), _kickSel(-1), _kickDown(-1), @@ -1667,6 +1670,7 @@ QMap MembersInner::already() const { } void MembersInner::clearSel() { + updateSelectedRow(); _sel = _kickSel = _kickDown = -1; _lastMousePos = QCursor::pos(); updateSel(); @@ -1938,8 +1942,7 @@ void MembersBox::onAdd() { } ContactsBox *box = new ContactsBox(_inner.channel(), _inner.filter(), _inner.already()); if (_inner.filter() == MembersFilterRecent) { - App::wnd()->hideLayer(true); - App::wnd()->showLayer(box, true); + App::wnd()->showLayer(box); } else { _addBox = box; connect(_addBox, SIGNAL(adminAdded()), this, SLOT(onAdminAdded())); @@ -1971,6 +1974,7 @@ void MembersBox::showAll() { } void MembersBox::showDone() { + _inner.clearSel(); setFocus(); } @@ -1978,7 +1982,7 @@ NewGroupBox::NewGroupBox() : AbstractBox(), _group(this, qsl("group_type"), 0, lang(lng_create_group_title), true), _channel(this, qsl("group_type"), 1, lang(lng_create_channel_title)), _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), _next(this, lang(lng_create_group_next), st::btnSelectDone), _cancel(this, lang(lng_cancel), st::btnSelectCancel) { @@ -2304,7 +2308,7 @@ bool GroupInfoBox::creationFail(const RPCError &error) { _name.notaBene(); return true; } 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 false; @@ -2315,8 +2319,7 @@ void GroupInfoBox::exportDone(const MTPExportedChatInvite &result) { if (result.type() == mtpc_chatInviteExported) { _createdChannel->invitationUrl = qs(result.c_chatInviteExported().vlink); } - App::wnd()->hideLayer(true); - App::wnd()->showLayer(new SetupChannelBox(_createdChannel), true); + App::wnd()->showLayer(new SetupChannelBox(_createdChannel)); } 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)); - _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); 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() { 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 (_tooMuchUsernames) { _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; } _link.show(); @@ -2715,8 +2718,7 @@ bool SetupChannelBox::onCheckFail(const RPCError &error) { QString err(error.type()); if (err == "CHANNELS_ADMIN_PUBLIC_TOO_MUCH") { if (_existing) { - App::wnd()->hideLayer(true); - App::wnd()->showLayer(new ConfirmBox(lang(lng_channels_too_much_public_existing), true), true); + App::wnd()->showLayer(new InformBox(lang(lng_channels_too_much_public_existing))); } else { _tooMuchUsernames = true; _private.setChecked(true); @@ -2744,8 +2746,7 @@ bool SetupChannelBox::onFirstCheckFail(const RPCError &error) { QString err(error.type()); if (err == "CHANNELS_ADMIN_PUBLIC_TOO_MUCH") { if (_existing) { - App::wnd()->hideLayer(true); - App::wnd()->showLayer(new ConfirmBox(lang(lng_channels_too_much_public_existing), true), true); + App::wnd()->showLayer(new InformBox(lang(lng_channels_too_much_public_existing))); } else { _tooMuchUsernames = true; _private.setChecked(true); diff --git a/Telegram/SourceFiles/boxes/contactsbox.h b/Telegram/SourceFiles/boxes/contactsbox.h index 45e872bb87..67a7ce5d99 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.h +++ b/Telegram/SourceFiles/boxes/contactsbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -274,6 +277,7 @@ public: bool isLoaded() const { return !_loading; } + void clearSel(); QMap already() const; @@ -298,7 +302,6 @@ public slots: private: void updateSelectedRow(); - void clearSel(); MemberData *data(int32 index); void membersReceived(const MTPchannels_ChannelParticipants &result, mtpRequestId req); diff --git a/Telegram/SourceFiles/boxes/downloadpathbox.cpp b/Telegram/SourceFiles/boxes/downloadpathbox.cpp index eaff7eedd9..bbbf26de19 100644 --- a/Telegram/SourceFiles/boxes/downloadpathbox.cpp +++ b/Telegram/SourceFiles/boxes/downloadpathbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -70,7 +73,7 @@ void DownloadPathBox::showAll() { _saveButton.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(); h += st::downloadSkip + _saveButton.height(); @@ -91,7 +94,7 @@ void DownloadPathBox::paintEvent(QPaintEvent *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); _dirRadio.move(st::boxPadding.left(), _tempRadio.y() + _tempRadio.height() + st::downloadSkip); int32 inputy = _dirRadio.y() + _dirRadio.height() + st::boxPadding.top(); diff --git a/Telegram/SourceFiles/boxes/downloadpathbox.h b/Telegram/SourceFiles/boxes/downloadpathbox.h index 7219612efa..cb09f70169 100644 --- a/Telegram/SourceFiles/boxes/downloadpathbox.h +++ b/Telegram/SourceFiles/boxes/downloadpathbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/emojibox.cpp b/Telegram/SourceFiles/boxes/emojibox.cpp index 13d894e91a..50cfa112a2 100644 --- a/Telegram/SourceFiles/boxes/emojibox.cpp +++ b/Telegram/SourceFiles/boxes/emojibox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/boxes/emojibox.h b/Telegram/SourceFiles/boxes/emojibox.h index a20a4ac32b..8e613576c3 100644 --- a/Telegram/SourceFiles/boxes/emojibox.h +++ b/Telegram/SourceFiles/boxes/emojibox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/languagebox.cpp b/Telegram/SourceFiles/boxes/languagebox.cpp index 45e2b5fae7..238a40aa5c 100644 --- a/Telegram/SourceFiles/boxes/languagebox.cpp +++ b/Telegram/SourceFiles/boxes/languagebox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -32,7 +35,7 @@ _done(this, lang(lng_about_done), st::langsCloseButton) { 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)); if (haveTestLang) { _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())); } - 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())); @@ -80,16 +83,16 @@ void LanguageBox::mousePressEvent(QMouseEvent *e) { for (int32 i = 1; i < languageCount; ++i) { LangLoaderPlain loader(qsl(":/langs/lang_") + LanguageCodes[i] + qsl(".strings"), LangLoaderRequest(lngkeys_cnt)); 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; } else if (!loader.warnings().isEmpty()) { QString warn = loader.warnings(); 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; } } - 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()) { LangLoaderResult result; 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(); } 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(); } QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)), - save = result.value(lng_continue, langOriginal(lng_continue)), - cancel = result.value(lng_cancel, langOriginal(lng_cancel)); - ConfirmBox *box = new ConfirmBox(text, save, cancel); + save = result.value(lng_box_ok, langOriginal(lng_box_ok)), + cancel = result.value(lng_box_cancel, langOriginal(lng_box_cancel)); + ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel); connect(box, SIGNAL(confirmed()), this, SLOT(onSave())); connect(box, SIGNAL(closed()), this, SLOT(onRestore())); App::wnd()->replaceLayer(box); diff --git a/Telegram/SourceFiles/boxes/languagebox.h b/Telegram/SourceFiles/boxes/languagebox.h index c5cb8e5da2..aeb08bb456 100644 --- a/Telegram/SourceFiles/boxes/languagebox.h +++ b/Telegram/SourceFiles/boxes/languagebox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/passcodebox.cpp b/Telegram/SourceFiles/boxes/passcodebox.cpp index 0dad83cccd..b4d02dcdea 100644 --- a/Telegram/SourceFiles/boxes/passcodebox.cpp +++ b/Telegram/SourceFiles/boxes/passcodebox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -25,8 +28,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org #include "localstorage.h" PasscodeBox::PasscodeBox(bool turningOff) : _replacedBy(0), _turningOff(turningOff), _cloudPwd(false), -_setRequest(0), _hasRecovery(false), _aboutHeight(0), -_about(st::boxWidth - st::addContactPadding.left() - st::addContactPadding.right()), +_setRequest(0), _hasRecovery(false), _skipEmailWarning(false), _aboutHeight(0), +_about(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right()), _saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _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), -_setRequest(0), _newSalt(newSalt), _curSalt(curSalt), _hasRecovery(hasRecovery), _hint(hint), _aboutHeight(0), -_about(st::boxWidth - st::addContactPadding.left() - st::addContactPadding.right()), +_setRequest(0), _newSalt(newSalt), _curSalt(curSalt), _hasRecovery(hasRecovery), _skipEmailWarning(false), _hint(hint), _aboutHeight(0), +_about(st::boxWideWidth - st::addContactPadding.left() - st::addContactPadding.right()), _saveButton(this, lang(_turningOff ? lng_passcode_remove_button : lng_settings_save), st::btnSelectDone), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _oldPasscode(this, st::inpAddContact, lang(lng_cloud_password_enter_old)), @@ -57,24 +60,24 @@ _recover(this, lang(lng_signin_recover)) { void PasscodeBox::init() { _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)); - _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); _newPasscode.setEchoMode(QLineEdit::Password); _reenterPasscode.setEchoMode(QLineEdit::Password); if (_turningOff) { _oldPasscode.show(); _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 { bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode(); if (has) { _oldPasscode.show(); _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 { _oldPasscode.hide(); _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) { 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()); _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()); @@ -241,18 +244,21 @@ void PasscodeBox::resizeEvent(QResizeEvent *e) { } void PasscodeBox::showDone() { - if (_oldPasscode.isHidden()) { + if (_skipEmailWarning && !_recoverEmail.isHidden()) { + _recoverEmail.setFocus(); + } else if (_oldPasscode.isHidden()) { _newPasscode.setFocus(); } else { _oldPasscode.setFocus(); } + _skipEmailWarning = false; } void PasscodeBox::setPasswordDone(const MTPBool &result) { _setRequest = 0; 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)); - App::wnd()->showLayer(box, true); + 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); } bool PasscodeBox::setPasswordFail(const RPCError &error) { @@ -280,8 +286,7 @@ bool PasscodeBox::setPasswordFail(const RPCError &error) { _recoverEmail.notaBene(); update(); } else if (err == "EMAIL_UNCONFIRMED") { - ConfirmBox *box = new ConfirmBox(lang(lng_cloud_password_almost), true, lang(lng_about_done)); - App::wnd()->showLayer(box, true); + App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_almost))); emit reloadPassword(); } else if (error.type().startsWith(qsl("FLOOD_WAIT_"))) { if (_oldPasscode.isHidden()) return false; @@ -349,7 +354,8 @@ void PasscodeBox::onSave(bool force) { return; } 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(destroyed(QObject*)), this, SLOT(onBoxDestroyed(QObject*))); App::wnd()->replaceLayer(_replacedBy); @@ -459,11 +465,11 @@ bool PasscodeBox::recoverStartFail(const RPCError &error) { } 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), _cancelButton(this, lang(lng_cancel), st::btnSelectCancel), _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(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); @@ -521,7 +527,7 @@ void RecoverBox::paintEvent(QPaintEvent *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(); _cancelButton.move(0, buttonTop); @@ -553,8 +559,7 @@ void RecoverBox::codeSubmitDone(bool recover, const MTPauth_Authorization &resul _submitRequest = 0; emit reloadPassword(); - ConfirmBox *box = new ConfirmBox(lang(lng_cloud_password_removed), true, lang(lng_about_done)); - App::wnd()->showLayer(box, true); + App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_removed))); } bool RecoverBox::codeSubmitFail(const RPCError &error) { @@ -563,8 +568,7 @@ bool RecoverBox::codeSubmitFail(const RPCError &error) { const QString &err = error.type(); if (err == "PASSWORD_EMPTY") { emit reloadPassword(); - ConfirmBox *box = new ConfirmBox(lang(lng_cloud_password_removed), true, lang(lng_about_done)); - App::wnd()->showLayer(box, true); + App::wnd()->showLayer(new InformBox(lang(lng_cloud_password_removed))); return true; } else if (err == "PASSWORD_RECOVERY_NA") { onClose(); diff --git a/Telegram/SourceFiles/boxes/passcodebox.h b/Telegram/SourceFiles/boxes/passcodebox.h index efc167c7f6..246d99c9a7 100644 --- a/Telegram/SourceFiles/boxes/passcodebox.h +++ b/Telegram/SourceFiles/boxes/passcodebox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -69,7 +72,7 @@ private: mtpRequestId _setRequest; QByteArray _newSalt, _curSalt; - bool _hasRecovery; + bool _hasRecovery, _skipEmailWarning; QString _hint; int32 _aboutHeight; diff --git a/Telegram/SourceFiles/boxes/photocropbox.cpp b/Telegram/SourceFiles/boxes/photocropbox.cpp index c3f15771b1..c47da34c7c 100644 --- a/Telegram/SourceFiles/boxes/photocropbox.cpp +++ b/Telegram/SourceFiles/boxes/photocropbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.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 &))); } - 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); _thumbw = _thumb.width(); _thumbh = _thumb.height(); @@ -55,11 +58,11 @@ PhotoCropBox::PhotoCropBox(const QImage &img, const PeerId &peer, bool upload) : _cropx = (_thumbw - _cropw) / 2; _cropy = (_thumbh - _cropw) / 2; - _thumbx = (st::cropBoxWidth - _thumbw) / 2; + _thumbx = (st::boxWideWidth - _thumbw) / 2; _thumby = st::boxPadding.top() * 2 + st::boxFont->height; 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) { diff --git a/Telegram/SourceFiles/boxes/photocropbox.h b/Telegram/SourceFiles/boxes/photocropbox.h index ce0c0f45de..7fdb74fbf3 100644 --- a/Telegram/SourceFiles/boxes/photocropbox.h +++ b/Telegram/SourceFiles/boxes/photocropbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/photosendbox.cpp b/Telegram/SourceFiles/boxes/photosendbox.cpp index 7b4010c95d..e7e5af9be3 100644 --- a/Telegram/SourceFiles/boxes/photosendbox.cpp +++ b/Telegram/SourceFiles/boxes/photosendbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -59,7 +62,7 @@ PhotoSendBox::PhotoSendBox(const ReadyLocalMedia &img) : _img(new ReadyLocalMedi _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.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.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; - _namew = st::mediaFont->m.width(_name); + _namew = st::mediaFont->width(_name); _size = formatSizeText(_img->filesize); - _textw = qMax(_namew, st::mediaFont->m.width(_size)); + _textw = qMax(_namew, st::mediaFont->width(_size)); } prepare(); } @@ -106,11 +109,11 @@ _phone(phone), _fname(fname), _lname(lname), _replyTo(replyTo) { _compressed.hide(); _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; - _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(); } @@ -161,7 +164,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) { p.setFont(st::mediaFont->f); p.setPen(st::black->c); 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 { p.drawText(x + tleft, y + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, _name); } diff --git a/Telegram/SourceFiles/boxes/photosendbox.h b/Telegram/SourceFiles/boxes/photosendbox.h index be6d67df84..935faefe90 100644 --- a/Telegram/SourceFiles/boxes/photosendbox.h +++ b/Telegram/SourceFiles/boxes/photosendbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/sessionsbox.cpp b/Telegram/SourceFiles/boxes/sessionsbox.cpp index 2cf7fe6b17..8968575012 100644 --- a/Telegram/SourceFiles/boxes/sessionsbox.cpp +++ b/Telegram/SourceFiles/boxes/sessionsbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -69,7 +72,7 @@ void SessionsInner::onTerminate() { _terminating = i.key(); 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(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*))); 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(&_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); prepare(); @@ -173,7 +176,7 @@ _terminateAll(this, lang(lng_sessions_terminate_all)), _terminateBox(0), _shortP void SessionsBox::resizeEvent(QResizeEvent *e) { ScrollableBox::resizeEvent(e); _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() { @@ -202,7 +205,7 @@ void SessionsBox::paintEvent(QPaintEvent *e) { if (paint(p)) return; paintTitle(p, lang(lng_sessions_header), true); - p.translate(0, st::boxTitleHeight); + p.translate(0, st::old_boxTitleHeight); if (_loading) { p.setFont(st::noContactsFont->f); @@ -231,10 +234,10 @@ void SessionsBox::paintEvent(QPaintEvent *e) { p.setFont(st::sessionInfoFont->f); 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 - 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 { paintTitle(p, lang(lng_sessions_other_header), false); } @@ -245,7 +248,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) { _loading = false; _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; _list.clear(); @@ -282,7 +285,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) { } data.name = appName; 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); //CountriesByISO2::const_iterator j = countries.constFind(country); @@ -297,18 +300,18 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) { data.active = QString(); data.activeWidth = 0; if (data.nameWidth > availCurrent) { - data.name = st::sessionNameFont->m.elidedText(data.name, Qt::ElideRight, availCurrent); - data.nameWidth = st::sessionNameFont->m.width(data.name); + data.name = st::sessionNameFont->elided(data.name, availCurrent); + 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) { - data.info = st::sessionInfoFont->m.elidedText(data.info, Qt::ElideRight, availCurrent); - data.infoWidth = st::sessionInfoFont->m.width(data.info); + data.info = st::sessionInfoFont->elided(data.info, availCurrent); + 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) { - data.ip = st::sessionInfoFont->m.elidedText(data.ip, Qt::ElideRight, availCurrent); - data.ipWidth = st::sessionInfoFont->m.width(data.ip); + data.ip = st::sessionInfoFont->elided(data.ip, availCurrent); + data.ipWidth = st::sessionInfoFont->width(data.ip); } _current = data; } else { @@ -322,21 +325,21 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) { } else { 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; if (data.nameWidth > availForName) { - data.name = st::sessionNameFont->m.elidedText(data.name, Qt::ElideRight, availForName); - data.nameWidth = st::sessionNameFont->m.width(data.name); + data.name = st::sessionNameFont->elided(data.name, availForName); + 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) { - data.info = st::sessionInfoFont->m.elidedText(data.info, Qt::ElideRight, availOther); - data.infoWidth = st::sessionInfoFont->m.width(data.info); + data.info = st::sessionInfoFont->elided(data.info, availOther); + 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) { - data.ip = st::sessionInfoFont->m.elidedText(data.ip, Qt::ElideRight, availOther); - data.ipWidth = st::sessionInfoFont->m.width(data.ip); + data.ip = st::sessionInfoFont->elided(data.ip, availOther); + data.ipWidth = st::sessionInfoFont->width(data.ip); } _list.push_back(data); @@ -359,7 +362,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) { void SessionsBox::onTerminateAll() { 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(destroyed(QObject*)), this, SLOT(onNoTerminateBox(QObject*))); App::wnd()->replaceLayer(_terminateBox); diff --git a/Telegram/SourceFiles/boxes/sessionsbox.h b/Telegram/SourceFiles/boxes/sessionsbox.h index d2859bbfae..e49ec799f4 100644 --- a/Telegram/SourceFiles/boxes/sessionsbox.h +++ b/Telegram/SourceFiles/boxes/sessionsbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/stickersetbox.cpp b/Telegram/SourceFiles/boxes/stickersetbox.cpp index 5c05b7471b..f893d801f4 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.cpp +++ b/Telegram/SourceFiles/boxes/stickersetbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -58,7 +61,7 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) { if (d.vset.type() == mtpc_stickerSet) { const MTPDstickerSet &s(d.vset.c_stickerSet()); _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); _setId = s.vid.v; _setAccess = s.vaccess_hash.v; @@ -69,7 +72,7 @@ void StickerSetInner::gotSet(const MTPmessages_StickerSet &set) { } 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 { int32 rows = _pack.size() / StickerPanPerRow + ((_pack.size() % StickerPanPerRow) ? 1 : 0); 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; - App::wnd()->showLayer(new ConfirmBox(lang(lng_stickers_not_found), true), true); + App::wnd()->showLayer(new InformBox(lang(lng_stickers_not_found))); return true; } @@ -134,7 +137,7 @@ void StickerSetInner::installDone(const MTPBool &result) { bool StickerSetInner::installFailed(const RPCError &error) { 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; } @@ -261,7 +264,7 @@ void StickerSetBox::onAddStickers() { void StickerSetBox::onShareStickers() { QString url = qsl("https://telegram.me/addstickers/") + _inner.shortName(); 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() { diff --git a/Telegram/SourceFiles/boxes/stickersetbox.h b/Telegram/SourceFiles/boxes/stickersetbox.h index 4adcf4550a..65171e09d3 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.h +++ b/Telegram/SourceFiles/boxes/stickersetbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/boxes/usernamebox.cpp b/Telegram/SourceFiles/boxes/usernamebox.cpp index 3e7815b391..17f8e76f48 100644 --- a/Telegram/SourceFiles/boxes/usernamebox.cpp +++ b/Telegram/SourceFiles/boxes/usernamebox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -27,14 +30,14 @@ UsernameBox::UsernameBox() : _saveButton(this, lang(lng_settings_save), st::usernameDone), _cancelButton(this, lang(lng_cancel), st::usernameCancel), _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)); _goodText = App::self()->username.isEmpty() ? QString() : lang(lng_username_available); 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(&_cancelButton, SIGNAL(clicked()), this, SLOT(onClose())); @@ -85,20 +88,20 @@ void UsernameBox::paintEvent(QPaintEvent *e) { if (!_errorText.isEmpty()) { p.setPen(st::setErrColor->p); 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); } else if (!_goodText.isEmpty()) { p.setPen(st::setGoodColor->p); 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.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) { - _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(); _cancelButton.move(0, buttonTop); diff --git a/Telegram/SourceFiles/boxes/usernamebox.h b/Telegram/SourceFiles/boxes/usernamebox.h index 481ca17d84..1f7f7e28db 100644 --- a/Telegram/SourceFiles/boxes/usernamebox.h +++ b/Telegram/SourceFiles/boxes/usernamebox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 6cff306119..894e4ec7e9 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/countries.h b/Telegram/SourceFiles/countries.h index 2df097ee18..6255464ef3 100644 --- a/Telegram/SourceFiles/countries.h +++ b/Telegram/SourceFiles/countries.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 7bfe73c9be..05c48d2ad2 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -115,13 +118,13 @@ void DialogsInner::paintRegion(Painter &p, const QRegion ®ion, 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); - 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 + st::mentionFont->elidew) { - first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, htagwidth); + first = st::mentionFont->elided(first + second, htagwidth); second = QString(); } 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(); if (!act && username.toLower().startsWith(peopleQuery)) { 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()) { 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 { p.setPen(st::dlgSystemColor->p); p.drawText(tr.left(), tr.top() + st::dlgHistFont->ascent, first); 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 { 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); @@ -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); p.setFont(st::dlgHistFont->f); 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); _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) { DialogRow *row = 0; DialogsList::RowByPeer::iterator i = dialogs.list.rowByPeer.find(history->peer->id); @@ -518,7 +521,7 @@ void DialogsInner::dlgUpdated(History *history) { if (!searchResults.isEmpty()) { int32 cnt = 0, add = searchedOffset(); 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); break; } @@ -796,7 +799,7 @@ void DialogsInner::dialogsReceived(const QVector &added) { history->peer->asChannel()->ptsReceived(d.vpts.v); if (!history->peer->asChannel()->amCreator()) { 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()); } } @@ -1558,8 +1561,8 @@ void DialogsWidget::dlgUpdated(DialogRow *row) { _inner.dlgUpdated(row); } -void DialogsWidget::dlgUpdated(History *row) { - _inner.dlgUpdated(row); +void DialogsWidget::dlgUpdated(History *row, MsgId msgId) { + _inner.dlgUpdated(row, msgId); } void DialogsWidget::dialogsToUp() { diff --git a/Telegram/SourceFiles/dialogswidget.h b/Telegram/SourceFiles/dialogswidget.h index 5f55958af1..20d882c25b 100644 --- a/Telegram/SourceFiles/dialogswidget.h +++ b/Telegram/SourceFiles/dialogswidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -57,7 +60,7 @@ public: void createDialog(History *history); void moveDialogToTop(const History::DialogLinks &links); void dlgUpdated(DialogRow *row); - void dlgUpdated(History *row); + void dlgUpdated(History *row, MsgId msgId); void removePeer(PeerData *peer); void removeContact(UserData *user); @@ -200,7 +203,7 @@ public: void loadDialogs(); void createDialog(History *history); void dlgUpdated(DialogRow *row); - void dlgUpdated(History *row); + void dlgUpdated(History *row, MsgId msgId); void dialogsToUp(); diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index de572f5849..f023a8d5c3 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" @@ -1772,9 +1775,9 @@ void EmojiPanel::updateText() { } } else { 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(); } @@ -1805,7 +1808,7 @@ void EmojiPanel::paintEvent(QPaintEvent *e) { EmojiSwitchButton::EmojiSwitchButton(QWidget *parent, bool toStickers) : Button(parent), _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); setCursor(style::cur_pointer); resize(w, st::emojiPanHeader); @@ -2613,7 +2616,7 @@ void EmojiPan::onRemoveSet(quint64 setId) { StickerSets::const_iterator it = cStickerSets().constFind(setId); if (it != cStickerSets().cend() && !(it->flags & MTPDstickerSet_flag_official)) { _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(destroyed(QObject*)), this, SLOT(onDelayedHide())); App::wnd()->showLayer(box); @@ -2662,7 +2665,7 @@ MentionsInner::MentionsInner(MentionsDropdown *parent, MentionRows *rows, Hashta void MentionsInner::paintEvent(QPaintEvent *e) { 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 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; @@ -2683,19 +2686,19 @@ void MentionsInner::paintEvent(QPaintEvent *e) { if (!_rows->isEmpty()) { 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); - 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) { namewidth = (mentionwidth * namewidth) / (namewidth + unamewidth); unamewidth = mentionwidth - namewidth; if (firstwidth < unamewidth + st::mentionFont->elidew) { if (firstwidth < unamewidth) { - first = st::mentionFont->m.elidedText(first, Qt::ElideRight, unamewidth); + first = st::mentionFont->elided(first, unamewidth); } else if (!second.isEmpty()) { - first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, unamewidth); + first = st::mentionFont->elided(first + second, unamewidth); second = QString(); } } else { - second = st::mentionFont->m.elidedText(second, Qt::ElideRight, unamewidth - firstwidth); + second = st::mentionFont->elided(second, unamewidth - firstwidth); } } user->photo->load(); @@ -2712,13 +2715,13 @@ void MentionsInner::paintEvent(QPaintEvent *e) { } else if (!_hrows->isEmpty()) { 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); - 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 + st::mentionFont->elidew) { - first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, htagwidth); + first = st::mentionFont->elided(first + second, htagwidth); second = QString(); } 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; 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 + st::mentionFont->elidew) { - first = st::mentionFont->m.elidedText(first + second, Qt::ElideRight, widthleft); + first = st::mentionFont->elided(first + second, widthleft); second = QString(); } else { - second = st::mentionFont->m.elidedText(second, Qt::ElideRight, widthleft - firstwidth); + second = st::mentionFont->elided(second, widthleft - firstwidth); } } p.setFont(st::mentionFont->f); @@ -2976,7 +2979,7 @@ void MentionsDropdown::updateFiltered(bool toDown) { QMultiMap ordered; rows.reserve(_chat->participants.isEmpty() ? _chat->lastAuthors.size() : _chat->participants.size()); if (_chat->participants.isEmpty()) { - if (_chat->count > 0) { + if (_chat->count > 0 && App::api()) { App::api()->requestFullPeer(_chat); } } else { @@ -3015,7 +3018,7 @@ void MentionsDropdown::updateFiltered(bool toDown) { int32 cnt = 0; if (_chat) { if (_chat->participants.isEmpty()) { - if (_chat->count > 0) { + if (_chat->count > 0 && App::api()) { App::api()->requestFullPeer(_chat); } } 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) { UserData *user = i.key(); 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; bots.insert(user, true); cnt += user->botInfo->commands.size(); } } } 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(); bots.insert(_user, true); } @@ -3042,7 +3045,7 @@ void MentionsDropdown::updateFiltered(bool toDown) { UserData *user = *i; if (!user->botInfo) 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; bots.remove(user); for (int32 j = 0, l = user->botInfo->commands.size(); j < l; ++j) { diff --git a/Telegram/SourceFiles/dropdown.h b/Telegram/SourceFiles/dropdown.h index e79ec8e0a4..aa20f40b11 100644 --- a/Telegram/SourceFiles/dropdown.h +++ b/Telegram/SourceFiles/dropdown.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -431,8 +434,6 @@ private: }; class EmojiSwitchButton : public Button { - Q_OBJECT - public: EmojiSwitchButton(QWidget *parent, bool toStickers); // otherwise toEmoji diff --git a/Telegram/SourceFiles/fileuploader.cpp b/Telegram/SourceFiles/fileuploader.cpp index 881a3cfbea..7894ff8873 100644 --- a/Telegram/SourceFiles/fileuploader.cpp +++ b/Telegram/SourceFiles/fileuploader.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "fileuploader.h" diff --git a/Telegram/SourceFiles/fileuploader.h b/Telegram/SourceFiles/fileuploader.h index b0fd9ef371..7c698cccf3 100644 --- a/Telegram/SourceFiles/fileuploader.h +++ b/Telegram/SourceFiles/fileuploader.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/animation.cpp b/Telegram/SourceFiles/gui/animation.cpp index 62ba39b0cd..b05b16b0d9 100644 --- a/Telegram/SourceFiles/gui/animation.cpp +++ b/Telegram/SourceFiles/gui/animation.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/gui/animation.h b/Telegram/SourceFiles/gui/animation.h index 1181f05ed5..7ed62ca0da 100644 --- a/Telegram/SourceFiles/gui/animation.h +++ b/Telegram/SourceFiles/gui/animation.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/boxshadow.cpp b/Telegram/SourceFiles/gui/boxshadow.cpp index ee83064800..7752ae93c1 100644 --- a/Telegram/SourceFiles/gui/boxshadow.cpp +++ b/Telegram/SourceFiles/gui/boxshadow.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/gui/boxshadow.h b/Telegram/SourceFiles/gui/boxshadow.h index 8d82c720a5..1ff90ef686 100644 --- a/Telegram/SourceFiles/gui/boxshadow.h +++ b/Telegram/SourceFiles/gui/boxshadow.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/button.cpp b/Telegram/SourceFiles/gui/button.cpp index 6e1653eb2b..53f0e19507 100644 --- a/Telegram/SourceFiles/gui/button.cpp +++ b/Telegram/SourceFiles/gui/button.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "button.h" diff --git a/Telegram/SourceFiles/gui/button.h b/Telegram/SourceFiles/gui/button.h index 232fb4de95..652fea137d 100644 --- a/Telegram/SourceFiles/gui/button.h +++ b/Telegram/SourceFiles/gui/button.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/contextmenu.cpp b/Telegram/SourceFiles/gui/contextmenu.cpp index 07eb5279a9..10b4a6f862 100644 --- a/Telegram/SourceFiles/gui/contextmenu.cpp +++ b/Telegram/SourceFiles/gui/contextmenu.cpp @@ -13,7 +13,7 @@ GNU General Public License for more details. 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" diff --git a/Telegram/SourceFiles/gui/contextmenu.h b/Telegram/SourceFiles/gui/contextmenu.h index a3c25dcfab..0bd427c9c2 100644 --- a/Telegram/SourceFiles/gui/contextmenu.h +++ b/Telegram/SourceFiles/gui/contextmenu.h @@ -13,7 +13,7 @@ GNU General Public License for more details. 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 diff --git a/Telegram/SourceFiles/gui/countryinput.cpp b/Telegram/SourceFiles/gui/countryinput.cpp index ec85de36e9..fcb06074e3 100644 --- a/Telegram/SourceFiles/gui/countryinput.cpp +++ b/Telegram/SourceFiles/gui/countryinput.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -199,7 +202,7 @@ void CountryInput::onFinishCountry() { } 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() { @@ -315,7 +318,7 @@ void CountryList::paintEvent(QPaintEvent *e) { } p.setFont(_st.font->f); 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.setPen(_st.codeColor->p); p.drawText(textRect, QString("+") + (*countriesNow)[i]->code, QTextOption(style::al_right)); @@ -495,8 +498,8 @@ void CountrySelect::paintEvent(QPaintEvent *e) { // draw box title / text p.setPen(st::black->p); - p.setFont(st::boxTitleFont->f); - p.drawText(_innerLeft + st::boxTitlePos.x(), _innerTop + st::boxTitlePos.y() + st::boxTitleFont->ascent, lang(lng_country_select)); + p.setFont(st::old_boxTitleFont->f); + p.drawText(_innerLeft + st::old_boxTitlePos.x(), _innerTop + st::old_boxTitlePos.y() + st::old_boxTitleFont->ascent, lang(lng_country_select)); } } } diff --git a/Telegram/SourceFiles/gui/countryinput.h b/Telegram/SourceFiles/gui/countryinput.h index 2a3a2a46d6..4f356edc0c 100644 --- a/Telegram/SourceFiles/gui/countryinput.h +++ b/Telegram/SourceFiles/gui/countryinput.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/emoji_config.cpp b/Telegram/SourceFiles/gui/emoji_config.cpp index 9c5e843266..f6f79aaf07 100644 --- a/Telegram/SourceFiles/gui/emoji_config.cpp +++ b/Telegram/SourceFiles/gui/emoji_config.cpp @@ -16,8 +16,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "gui/emoji_config.h" diff --git a/Telegram/SourceFiles/gui/emoji_config.h b/Telegram/SourceFiles/gui/emoji_config.h index 9a7a5de944..600a42e2a3 100644 --- a/Telegram/SourceFiles/gui/emoji_config.h +++ b/Telegram/SourceFiles/gui/emoji_config.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/filedialog.cpp b/Telegram/SourceFiles/gui/filedialog.cpp index 8dd7487476..8d8ea291ed 100644 --- a/Telegram/SourceFiles/gui/filedialog.cpp +++ b/Telegram/SourceFiles/gui/filedialog.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "gui/filedialog.h" diff --git a/Telegram/SourceFiles/gui/filedialog.h b/Telegram/SourceFiles/gui/filedialog.h index bf5fd2084e..58791f512c 100644 --- a/Telegram/SourceFiles/gui/filedialog.h +++ b/Telegram/SourceFiles/gui/filedialog.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/flatbutton.cpp b/Telegram/SourceFiles/gui/flatbutton.cpp index ac36eb12cb..3c495805d1 100644 --- a/Telegram/SourceFiles/gui/flatbutton.cpp +++ b/Telegram/SourceFiles/gui/flatbutton.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "gui/flatbutton.h" @@ -69,7 +72,7 @@ void FlatButton::setAutoFontSize(int32 padding, const QString &txt) { } int32 FlatButton::textWidth() const { - return _st.font->m.width(_text); + return _st.font->width(_text); } void FlatButton::resizeEvent(QResizeEvent *e) { @@ -77,7 +80,7 @@ void FlatButton::resizeEvent(QResizeEvent *e) { _autoFont = _st.font; for (int32 s = _st.font->f.pixelSize(); s >= st::fsize; --s) { _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; } } @@ -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) { 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); } @@ -162,7 +165,7 @@ void LinkButton::paintEvent(QPaintEvent *e) { void LinkButton::setText(const QString &text) { _text = text; - resize(_st.font->m.width(_text), _st.font->height); + resize(_st.font->width(_text), _st.font->height); 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) { if (_width < 0) { - _width = _st.font->m.width(text) - _width; + _width = _st.font->width(text) - _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))); resize(_width, _st.height); @@ -195,9 +198,9 @@ void IconedButton::setText(const QString &text) { if (_text != text) { _text = text; if (_st.width < 0) { - _width = _st.font->m.width(text) - _st.width; + _width = _st.font->width(text) - _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); update(); @@ -291,3 +294,70 @@ void MaskedButton::paintEvent(QPaintEvent *e) { 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(); + } +} diff --git a/Telegram/SourceFiles/gui/flatbutton.h b/Telegram/SourceFiles/gui/flatbutton.h index 98779f4d42..3a90686a5b 100644 --- a/Telegram/SourceFiles/gui/flatbutton.h +++ b/Telegram/SourceFiles/gui/flatbutton.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -136,3 +139,30 @@ public: 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; +}; diff --git a/Telegram/SourceFiles/gui/flatcheckbox.cpp b/Telegram/SourceFiles/gui/flatcheckbox.cpp index 9fbecbea9c..48df0deae9 100644 --- a/Telegram/SourceFiles/gui/flatcheckbox.cpp +++ b/Telegram/SourceFiles/gui/flatcheckbox.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.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))); setCursor(_st.cursor); 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()); resize(QSize(w, h)); } diff --git a/Telegram/SourceFiles/gui/flatcheckbox.h b/Telegram/SourceFiles/gui/flatcheckbox.h index c80b8ce35c..840c5d8182 100644 --- a/Telegram/SourceFiles/gui/flatcheckbox.h +++ b/Telegram/SourceFiles/gui/flatcheckbox.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/flatinput.cpp b/Telegram/SourceFiles/gui/flatinput.cpp index 8a3a364c99..aaa1889fcc 100644 --- a/Telegram/SourceFiles/gui/flatinput.cpp +++ b/Telegram/SourceFiles/gui/flatinput.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -191,8 +194,8 @@ void FlatInput::focusOutEvent(QFocusEvent *e) { void FlatInput::resizeEvent(QResizeEvent *e) { int32 availw = width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1; - if (_st.font->m.width(_fullph) > availw) { - _ph = _st.font->m.elidedText(_fullph, Qt::ElideRight, availw); + if (_st.font->width(_fullph) > availw) { + _ph = _st.font->elided(_fullph, availw); } else { _ph = _fullph; } @@ -455,7 +458,7 @@ _replacingEmojis(false) { _inner.setFont(_st->font->f); _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()); p.setColor(QPalette::Text, _st->textFg->c); @@ -1057,7 +1060,7 @@ void InputField::InputFieldInner::paintEvent(QPaintEvent *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)); TWidget::resizeEvent(e); } diff --git a/Telegram/SourceFiles/gui/flatinput.h b/Telegram/SourceFiles/gui/flatinput.h index 94438b2302..f9ddf0fe1b 100644 --- a/Telegram/SourceFiles/gui/flatinput.h +++ b/Telegram/SourceFiles/gui/flatinput.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/flatlabel.cpp b/Telegram/SourceFiles/gui/flatlabel.cpp index 1774996a8e..42860323e4 100644 --- a/Telegram/SourceFiles/gui/flatlabel.cpp +++ b/Telegram/SourceFiles/gui/flatlabel.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/gui/flatlabel.h b/Telegram/SourceFiles/gui/flatlabel.h index 280516eff5..28acee067c 100644 --- a/Telegram/SourceFiles/gui/flatlabel.h +++ b/Telegram/SourceFiles/gui/flatlabel.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/flattextarea.cpp b/Telegram/SourceFiles/gui/flattextarea.cpp index 0f0a215e5b..e6a88a72a2 100644 --- a/Telegram/SourceFiles/gui/flattextarea.cpp +++ b/Telegram/SourceFiles/gui/flattextarea.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -806,7 +809,7 @@ const QString &FlatTextarea::getLastText() const { void FlatTextarea::setPlaceholder(const QString &ph) { _ph = ph; - _phelided = _st.font->m.elidedText(_ph, Qt::ElideRight, width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1); + _phelided = _st.font->elided(_ph, width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1); if (_phVisible) update(); } @@ -893,7 +896,7 @@ void FlatTextarea::keyPressEvent(QKeyEvent *e) { } void FlatTextarea::resizeEvent(QResizeEvent *e) { - _phelided = _st.font->m.elidedText(_ph, Qt::ElideRight, width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1); + _phelided = _st.font->elided(_ph, width() - _st.textMrg.left() - _st.textMrg.right() - _st.phPos.x() - 1); QTextEdit::resizeEvent(e); checkContentHeight(); } diff --git a/Telegram/SourceFiles/gui/flattextarea.h b/Telegram/SourceFiles/gui/flattextarea.h index 9cbdd2c712..02d3cb139e 100644 --- a/Telegram/SourceFiles/gui/flattextarea.h +++ b/Telegram/SourceFiles/gui/flattextarea.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/images.cpp b/Telegram/SourceFiles/gui/images.cpp index a03cd513cd..c155e512fe 100644 --- a/Telegram/SourceFiles/gui/images.cpp +++ b/Telegram/SourceFiles/gui/images.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "gui/images.h" diff --git a/Telegram/SourceFiles/gui/images.h b/Telegram/SourceFiles/gui/images.h index a77ae6ee89..407821b954 100644 --- a/Telegram/SourceFiles/gui/images.h +++ b/Telegram/SourceFiles/gui/images.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/phoneinput.cpp b/Telegram/SourceFiles/gui/phoneinput.cpp index f49a5d26eb..facb894609 100644 --- a/Telegram/SourceFiles/gui/phoneinput.cpp +++ b/Telegram/SourceFiles/gui/phoneinput.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -35,7 +38,7 @@ void PhoneInput::paintEvent(QPaintEvent *e) { if (!ph.isEmpty()) { p.setClipRect(rect()); QRect phRect(placeholderRect()); - int tw = phFont()->m.width(t); + int tw = phFont()->width(t); if (tw < phRect.width()) { phRect.setLeft(phRect.left() + tw); phPrepare(p); diff --git a/Telegram/SourceFiles/gui/phoneinput.h b/Telegram/SourceFiles/gui/phoneinput.h index 55adba6eac..f89bd91c35 100644 --- a/Telegram/SourceFiles/gui/phoneinput.h +++ b/Telegram/SourceFiles/gui/phoneinput.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/scrollarea.cpp b/Telegram/SourceFiles/gui/scrollarea.cpp index 048e23035c..8523c0491d 100644 --- a/Telegram/SourceFiles/gui/scrollarea.cpp +++ b/Telegram/SourceFiles/gui/scrollarea.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" diff --git a/Telegram/SourceFiles/gui/scrollarea.h b/Telegram/SourceFiles/gui/scrollarea.h index 9d1999b27a..4029ffc25c 100644 --- a/Telegram/SourceFiles/gui/scrollarea.h +++ b/Telegram/SourceFiles/gui/scrollarea.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/style_core.cpp b/Telegram/SourceFiles/gui/style_core.cpp index 11ad9bf1c1..95e0f3441f 100644 --- a/Telegram/SourceFiles/gui/style_core.cpp +++ b/Telegram/SourceFiles/gui/style_core.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" @@ -41,8 +44,8 @@ namespace style { height = m.height(); ascent = m.ascent(); descent = m.descent(); - spacew = m.width(QLatin1Char(' ')); - elidew = m.width(QLatin1Char('.')) * 3; + spacew = width(QLatin1Char(' ')); + elidew = width(QLatin1Char('.')) * 3; } Font FontData::bold(bool set) const { diff --git a/Telegram/SourceFiles/gui/style_core.h b/Telegram/SourceFiles/gui/style_core.h index 4421091f74..c64a8f99c2 100644 --- a/Telegram/SourceFiles/gui/style_core.h +++ b/Telegram/SourceFiles/gui/style_core.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -104,8 +107,17 @@ namespace style { class FontData { public: - int32 width(const QString &str, int32 from, int32 to) { - return m.width(str.mid(from, to)); + int32 width(const QString &str) const { + return m.width(str); + } + int32 width(const QString &str, int32 from, int32 to) const { + return width(str.mid(from, to)); + } + int32 width(QChar ch) const { + return m.width(ch); + } + QString elided(const QString &str, int32 width, Qt::TextElideMode mode = Qt::ElideRight) const { + return m.elidedText(str, mode, width); } Font bold(bool set = true) const; diff --git a/Telegram/SourceFiles/gui/switcher.cpp b/Telegram/SourceFiles/gui/switcher.cpp index 410e82152a..e0e9173c3e 100644 --- a/Telegram/SourceFiles/gui/switcher.cpp +++ b/Telegram/SourceFiles/gui/switcher.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "switcher.h" diff --git a/Telegram/SourceFiles/gui/switcher.h b/Telegram/SourceFiles/gui/switcher.h index 046b3d295c..5b633514ab 100644 --- a/Telegram/SourceFiles/gui/switcher.h +++ b/Telegram/SourceFiles/gui/switcher.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp index 55b27fad0e..7ef4cf0370 100644 --- a/Telegram/SourceFiles/gui/text.cpp +++ b/Telegram/SourceFiles/gui/text.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "text.h" @@ -330,7 +333,7 @@ public: } else { QUrl url(original), good(url.isValid() ? url.toEncoded() : ""); QString readable = good.isValid() ? good.toDisplayString() : original; - result = _t->_font->m.elidedText(readable, Qt::ElideRight, st::linkCropLimit); + result = _t->_font->elided(readable, st::linkCropLimit); fullDisplayed = (result == readable) ? 1 : 0; } } @@ -1569,7 +1572,7 @@ public: line.length = lineLength; eShapeLine(line); - int32 elideWidth = _f->m.width(_Elide); + int32 elideWidth = _f->width(_Elide); _wLeft = _w - elideWidth - _elideRemoveFromEnd; int firstItem = engine.findItem(line.from), lastItem = engine.findItem(line.from + line.length - 1); diff --git a/Telegram/SourceFiles/gui/text.h b/Telegram/SourceFiles/gui/text.h index 77342dba6d..27e964b5ae 100644 --- a/Telegram/SourceFiles/gui/text.h +++ b/Telegram/SourceFiles/gui/text.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/gui/twidget.cpp b/Telegram/SourceFiles/gui/twidget.cpp index 8583ccba60..5c69e7d1ae 100644 --- a/Telegram/SourceFiles/gui/twidget.cpp +++ b/Telegram/SourceFiles/gui/twidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/gui/twidget.h b/Telegram/SourceFiles/gui/twidget.h index 15b1890feb..11ff79b6c6 100644 --- a/Telegram/SourceFiles/gui/twidget.h +++ b/Telegram/SourceFiles/gui/twidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index c021b224c1..73ce23ec28 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -190,7 +193,7 @@ void DialogRow::paint(Painter &p, int32 w, bool act, bool sel, bool onlyBackgrou } else { dt = lastDate.toString(qsl("d.MM.yy")); } - int32 dtWidth = st::dlgDateFont->m.width(dt); + int32 dtWidth = st::dlgDateFont->width(dt); rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip); p.setFont(st::dlgDateFont->f); p.setPen((act ? st::dlgActiveDateColor : st::dlgDateColor)->p); @@ -216,7 +219,7 @@ void DialogRow::paint(Painter &p, int32 w, bool act, bool sel, bool onlyBackgrou int32 lastWidth = namewidth, unread = history->unreadCount; if (unread) { QString unreadStr = QString::number(unread); - int32 unreadWidth = st::dlgUnreadFont->m.width(unreadStr); + int32 unreadWidth = st::dlgUnreadFont->width(unreadStr); int32 unreadRectWidth = unreadWidth + 2 * st::dlgUnreadPaddingHor; int32 unreadRectHeight = st::dlgUnreadFont->height + 2 * st::dlgUnreadPaddingVer; int32 unreadRectLeft = w - st::dlgPaddingHor - unreadRectWidth; @@ -274,7 +277,7 @@ void FakeDialogRow::paint(Painter &p, int32 w, bool act, bool sel, bool onlyBack } else { dt = lastDate.toString(qsl("d.MM.yy")); } - int32 dtWidth = st::dlgDateFont->m.width(dt); + int32 dtWidth = st::dlgDateFont->width(dt); rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip); p.setFont(st::dlgDateFont->f); p.setPen((act ? st::dlgActiveDateColor : st::dlgDateColor)->p); @@ -395,6 +398,12 @@ bool History::updateTyping(uint64 ms, uint32 dots, bool force) { changed = true; } } + if (changed && App::main()) { + if (!dialogs.isEmpty()) App::main()->dlgUpdated(dialogs[0]); + if (App::main()->historyPeer() == peer) { + App::main()->topBar()->update(); + } + } return changed; } @@ -1291,10 +1300,7 @@ bool Histories::animStep(float64) { uint64 ms = getms(true); for (TypingHistories::iterator i = typing.begin(), e = typing.end(); i != e;) { uint32 typingFrame = (ms - i.value()) / 150; - if (i.key()->updateTyping(ms, typingFrame)) { - App::main()->dlgUpdated(i.key()); - App::main()->topBar()->update(); - } + i.key()->updateTyping(ms, typingFrame); if (i.key()->typing.isEmpty() && i.key()->sendActions.isEmpty()) { i = typing.erase(i); } else { @@ -1712,23 +1718,19 @@ HistoryItem *History::addNewItem(HistoryBlock *to, bool newBlock, HistoryItem *a } void History::unregTyping(UserData *from) { - bool update = false; uint64 updateAtMs = 0; TypingUsers::iterator i = typing.find(from); if (i != typing.end()) { updateAtMs = getms(true); i.value() = updateAtMs; - update = true; } SendActionUsers::iterator j = sendActions.find(from); if (j != sendActions.end()) { if (!updateAtMs) updateAtMs = getms(true); j.value().until = updateAtMs; - update = true; } if (updateAtMs) { updateTyping(updateAtMs, 0, true); - App::main()->topBar()->update(); } } @@ -2129,9 +2131,8 @@ MsgId History::inboxRead(MsgId upTo) { if (!upTo) upTo = msgIdForRead(); inboxReadBefore = qMax(inboxReadBefore, upTo + 1); - if (!dialogs.isEmpty()) { - if (App::main()) App::main()->dlgUpdated(dialogs[0]); - } + if (!dialogs.isEmpty() && App::main()) App::main()->dlgUpdated(dialogs[0]); + showFrom = 0; App::wnd()->notifyClear(this); clearNotifications(); @@ -2192,7 +2193,7 @@ void History::setUnreadCount(int32 newUnreadCount, bool psUpdate) { App::histories().unreadMuted += newMute ? unreadCount : (-unreadCount); mute = newMute; if (App::wnd()) App::wnd()->updateCounter(); - if (App::main()) App::main()->dlgUpdated(this); + if (!dialogs.isEmpty() && App::main()) App::main()->dlgUpdated(dialogs[0]); } } @@ -2709,6 +2710,11 @@ void HistoryItem::destroy() { if (history()->lastMsg == this) { history()->fixLastMessage(wasAtBottom); } + if (history()->lastKeyboardId == id) { + history()->lastKeyboardId = 0; + history()->lastKeyboardFrom = 0; + if (App::main()) App::main()->updateBotKeyboard(); + } HistoryMedia *m = getMedia(true); MediaOverviewType t = m ? mediaToOverviewType(m->type()) : OverviewCount; if (t != OverviewCount) { @@ -3170,9 +3176,9 @@ HistoryVideo::HistoryVideo(const MTPDvideo &video, const QString &caption, Histo _size = formatDurationAndSizeText(data->duration, data->size); if (!_openWithWidth) { - _downloadWidth = st::mediaSaveButton.font->m.width(lang(lng_media_download)); - _openWithWidth = st::mediaSaveButton.font->m.width(lang(lng_media_open_with)); - _cancelWidth = st::mediaSaveButton.font->m.width(lang(lng_media_cancel)); + _downloadWidth = st::mediaSaveButton.font->width(lang(lng_media_download)); + _openWithWidth = st::mediaSaveButton.font->width(lang(lng_media_open_with)); + _cancelWidth = st::mediaSaveButton.font->width(lang(lng_media_cancel)); _buttonWidth = (st::mediaSaveButton.width > 0) ? st::mediaSaveButton.width : ((_downloadWidth > _openWithWidth ? (_downloadWidth > _cancelWidth ? _downloadWidth : _cancelWidth) : _openWithWidth) - st::mediaSaveButton.width); } @@ -3479,7 +3485,7 @@ void HistoryVideo::draw(Painter &p, const HistoryItem *parent, bool selected, in int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height; p.drawText(tleft, texty + st::mediaFont->ascent, statusText); if (parent->isMediaUnread()) { - int32 w = st::mediaFont->m.width(statusText); + int32 w = st::mediaFont->width(statusText); if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= twidth) { p.setRenderHint(QPainter::HighQualityAntialiasing, true); p.setPen(Qt::NoPen); @@ -3551,9 +3557,9 @@ HistoryAudio::HistoryAudio(const MTPDaudio &audio) : HistoryMedia() _size = formatDurationAndSizeText(data->duration, data->size); if (!_openWithWidth) { - _downloadWidth = st::mediaSaveButton.font->m.width(lang(lng_media_download)); - _openWithWidth = st::mediaSaveButton.font->m.width(lang(lng_media_open_with)); - _cancelWidth = st::mediaSaveButton.font->m.width(lang(lng_media_cancel)); + _downloadWidth = st::mediaSaveButton.font->width(lang(lng_media_download)); + _openWithWidth = st::mediaSaveButton.font->width(lang(lng_media_open_with)); + _cancelWidth = st::mediaSaveButton.font->width(lang(lng_media_cancel)); _buttonWidth = (st::mediaSaveButton.width > 0) ? st::mediaSaveButton.width : ((_downloadWidth > _openWithWidth ? (_downloadWidth > _cancelWidth ? _downloadWidth : _cancelWidth) : _openWithWidth) - st::mediaSaveButton.width); } } @@ -3712,7 +3718,7 @@ void HistoryAudio::draw(Painter &p, const HistoryItem *parent, bool selected, in int32 texty = skipy + st::mediaPadding.top() + st::mediaThumbSize - st::mediaDetailsShift - st::mediaFont->height; p.drawText(tleft, texty + st::mediaFont->ascent, statusText); if (parent->isMediaUnread()) { - int32 w = st::mediaFont->m.width(statusText); + int32 w = st::mediaFont->width(statusText); if (w + st::mediaUnreadSkip + st::mediaUnreadSize <= twidth) { p.setRenderHint(QPainter::HighQualityAntialiasing, true); p.setPen(Qt::NoPen); @@ -3849,15 +3855,15 @@ HistoryDocument::HistoryDocument(DocumentData *document) : HistoryMedia() , _dldDone(0) , _uplDone(0) { - _namew = st::mediaFont->m.width(_name.isEmpty() ? qsl("Document") : _name); + _namew = st::mediaFont->width(_name.isEmpty() ? qsl("Document") : _name); _size = document->song() ? formatDurationAndSizeText(document->song()->duration, data->size) : formatSizeText(data->size); _height = _minh = st::mediaPadding.top() + st::mediaThumbSize + st::mediaPadding.bottom(); if (!_openWithWidth) { - _downloadWidth = st::mediaSaveButton.font->m.width(lang(lng_media_download)); - _openWithWidth = st::mediaSaveButton.font->m.width(lang(lng_media_open_with)); - _cancelWidth = st::mediaSaveButton.font->m.width(lang(lng_media_cancel)); + _downloadWidth = st::mediaSaveButton.font->width(lang(lng_media_download)); + _openWithWidth = st::mediaSaveButton.font->width(lang(lng_media_open_with)); + _cancelWidth = st::mediaSaveButton.font->width(lang(lng_media_cancel)); _buttonWidth = (st::mediaSaveButton.width > 0) ? st::mediaSaveButton.width : ((_downloadWidth > _openWithWidth ? (_downloadWidth > _cancelWidth ? _downloadWidth : _cancelWidth) : _openWithWidth) - st::mediaSaveButton.width); } @@ -4073,7 +4079,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, bool selected, p.setFont(st::mediaFont->f); p.setPen(st::black->c); if (twidth < _namew) { - p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(_name, Qt::ElideRight, twidth)); + p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->elided(_name, twidth)); } else { p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, _name); } @@ -4185,7 +4191,7 @@ void HistoryDocument::drawInPlaylist(Painter &p, const HistoryItem *parent, bool p.setFont(st::mediaFont->f); p.setPen(st::black->c); if (twidth < _namew) { - p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(_name, Qt::ElideRight, twidth)); + p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->elided(_name, twidth)); } else { p.drawText(tleft, st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, _name); } @@ -4513,7 +4519,7 @@ HistoryContact::HistoryContact(int32 userId, const QString &first, const QString _maxw = st::mediaMaxWidth; name.setText(st::mediaFont, lng_full_name(lt_first_name, first, lt_last_name, last).trimmed(), _textNameOptions); - phonew = st::mediaFont->m.width(phone); + phonew = st::mediaFont->width(phone); if (contact) { contact->photo->load(); @@ -4530,7 +4536,7 @@ HistoryContact::HistoryContact(int32 userId, const QString &fullname, const QStr _maxw = st::mediaMaxWidth; name.setText(st::mediaFont, fullname.trimmed(), _textNameOptions); - phonew = st::mediaFont->m.width(phone); + phonew = st::mediaFont->width(phone); if (contact) { contact->photo->load(); @@ -4685,7 +4691,7 @@ void HistoryContact::draw(Painter &p, const HistoryItem *parent, bool selected, p.setFont(st::mediaFont->f); p.setPen(st::black->c); if (twidth < phonew) { - p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(phone, Qt::ElideRight, twidth)); + p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->elided(phone, twidth)); } else { p.drawText(tleft, skipy + st::mediaPadding.top() + st::mediaNameTop + st::mediaFont->ascent, phone); } @@ -4734,7 +4740,7 @@ HistoryWebPage::HistoryWebPage(WebPageData *data) : HistoryMedia() void HistoryWebPage::initDimensions(const HistoryItem *parent) { if (data->pendingTill) { _maxw = _minh = _height = 0; - //_maxw = st::webPageLeft + st::linkFont->m.width(lang((data->pendingTill < 0) ? lng_attach_failed : lng_profile_loading)); + //_maxw = st::webPageLeft + st::linkFont->width(lang((data->pendingTill < 0) ? lng_attach_failed : lng_profile_loading)); //_minh = st::replyHeight; //_height = _minh; return; @@ -4796,7 +4802,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { } _docName = documentName(data->doc); _docSize = data->doc->song() ? formatDurationAndSizeText(data->doc->song()->duration, data->doc->size) : formatSizeText(data->doc->size); - _docNameWidth = st::mediaFont->m.width(_docName.isEmpty() ? qsl("Document") : _docName); + _docNameWidth = st::mediaFont->width(_docName.isEmpty() ? qsl("Document") : _docName); if (parent == animated.msg) { _maxw = st::webPageLeft + (animated.w / cIntRetinaFactor()) + parent->skipBlockWidth(); @@ -4812,7 +4818,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { } if (!data->siteName.isEmpty()) { - _siteNameWidth = st::webPageTitleFont->m.width(data->siteName); + _siteNameWidth = st::webPageTitleFont->width(data->siteName); if (_asArticle) { _maxw = qMax(_maxw, int32(st::webPageLeft + _siteNameWidth + st::webPagePhotoDelta + st::webPagePhotoSize)); } else { @@ -4854,7 +4860,7 @@ void HistoryWebPage::initDimensions(const HistoryItem *parent) { } if (data->type == WebPageVideo && data->duration) { _duration = formatDurationText(data->duration); - _durationWidth = st::msgDateFont->m.width(_duration); + _durationWidth = st::msgDateFont->width(_duration); } _height = _minh; } @@ -4924,7 +4930,7 @@ void HistoryWebPage::draw(Painter &p, const HistoryItem *parent, bool selected, } p.setFont(st::webPageTitleFont->f); p.setPen(semibold->p); - p.drawText(0, st::webPageTitleFont->ascent, (availw >= _siteNameWidth) ? data->siteName : st::webPageTitleFont->m.elidedText(data->siteName, Qt::ElideRight, availw)); + p.drawText(0, st::webPageTitleFont->ascent, (availw >= _siteNameWidth) ? data->siteName : st::webPageTitleFont->elided(data->siteName, availw)); p.translate(0, st::webPageTitleFont->height); --articleLines; } @@ -5103,7 +5109,7 @@ void HistoryWebPage::draw(Painter &p, const HistoryItem *parent, bool selected, p.setFont(st::mediaFont->f); p.setPen(st::black->c); if (twidth < _docNameWidth) { - p.drawText(tleft, st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->m.elidedText(_docName, Qt::ElideRight, twidth)); + p.drawText(tleft, st::mediaNameTop + st::mediaFont->ascent, st::mediaFont->elided(_docName, twidth)); } else { p.drawText(tleft, st::mediaNameTop + st::mediaFont->ascent, _docName); } @@ -5876,12 +5882,12 @@ void HistoryImageLink::draw(Painter &p, const HistoryItem *parent, bool selected p.setPen(st::msgDateImgColor->p); int32 titleWidth = width - 2 * st::msgDateImgPadding.x(); if (!data->duration.isEmpty()) { - int32 durationWidth = st::msgDateFont->m.width(data->duration); + int32 durationWidth = st::msgDateFont->width(data->duration); p.drawText(skipx + width - st::msgDateImgPadding.x() - durationWidth, skipy + st::msgDateImgPadding.y() + st::msgDateFont->ascent, data->duration); titleWidth -= durationWidth + st::msgDateImgPadding.x(); } if (!data->title.isEmpty()) { - p.drawText(skipx + st::msgDateImgPadding.x(), skipy + st::msgDateImgPadding.y() + st::msgDateFont->ascent, st::msgDateFont->m.elidedText(data->title, Qt::ElideRight, titleWidth)); + p.drawText(skipx + st::msgDateImgPadding.x(), skipy + st::msgDateImgPadding.y() + st::msgDateFont->ascent, st::msgDateFont->elided(data->title, titleWidth)); } } } @@ -6103,10 +6109,10 @@ QString formatViewsCount(int32 views) { void HistoryMessage::initTime() { _timeText = date.toString(cTimeFormat()); - _timeWidth = st::msgDateFont->m.width(_timeText); + _timeWidth = st::msgDateFont->width(_timeText); _viewsText = (_views >= 0) ? formatViewsCount(_views) : QString(); - _viewsWidth = _viewsText.isEmpty() ? 0 : st::msgDateFont->m.width(_viewsText); + _viewsWidth = _viewsText.isEmpty() ? 0 : st::msgDateFont->width(_viewsText); } void HistoryMessage::initMedia(const MTPMessageMedia *media, QString ¤tText) { @@ -6377,7 +6383,7 @@ void HistoryMessage::setViewsCount(int32 count) { int32 was = _viewsWidth; _views = count; _viewsText = (_views >= 0) ? formatViewsCount(_views) : QString(); - _viewsWidth = _viewsText.isEmpty() ? 0 : st::msgDateFont->m.width(_viewsText); + _viewsWidth = _viewsText.isEmpty() ? 0 : st::msgDateFont->width(_viewsText); if (was == _viewsWidth) { if (App::main()) App::main()->msgUpdated(history()->peer->id, this); } else { @@ -6738,7 +6744,7 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, const , fwdDate(::date(msg.vfwd_date)) , fwdFrom(App::peer(peerFromMTP(msg.vfwd_from_id))) , fwdFromVersion(fwdFrom->nameVersion) -, fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from)) + st::msgServiceFont->spacew) +, fromWidth(st::msgServiceFont->width(lang(lng_forwarded_from)) + st::msgServiceFont->spacew) { fwdNameUpdated(); } @@ -6747,7 +6753,7 @@ HistoryForwarded::HistoryForwarded(History *history, HistoryBlock *block, MsgId , fwdDate(msg->dateForwarded()) , fwdFrom(msg->fromForwarded()) , fwdFromVersion(fwdFrom->nameVersion) -, fromWidth(st::msgServiceFont->m.width(lang(lng_forwarded_from)) + st::msgServiceFont->spacew) +, fromWidth(st::msgServiceFont->width(lang(lng_forwarded_from)) + st::msgServiceFont->spacew) { fwdNameUpdated(); } @@ -6793,7 +6799,7 @@ void HistoryForwarded::drawForwardedFrom(Painter &p, int32 x, int32 y, int32 w, p.setFont(serviceName->f); fwdFromName.drawElided(p, x + fromWidth, y, w - fromWidth); } else { - p.drawText(x, y + serviceFont->ascent, serviceFont->m.elidedText(lang(lng_forwarded_from), Qt::ElideRight, w)); + p.drawText(x, y + serviceFont->ascent, serviceFont->elided(lang(lng_forwarded_from), w)); } } @@ -6960,7 +6966,7 @@ HistoryReply::HistoryReply(History *history, HistoryBlock *block, const MTPDmess , replyToVersion(0) , _maxReplyWidth(0) { - if (!updateReplyTo()) { + if (!updateReplyTo() && App::api()) { App::api()->requestReplyTo(this, history->peer->asChannel(), replyToMsgId); } } @@ -6971,7 +6977,7 @@ HistoryReply::HistoryReply(History *history, HistoryBlock *block, MsgId msgId, i , replyToVersion(0) , _maxReplyWidth(0) { - if (!updateReplyTo()) { + if (!updateReplyTo() && App::api()) { App::api()->requestReplyTo(this, history->peer->asChannel(), replyToMsgId); } } @@ -6986,7 +6992,7 @@ QString HistoryReply::selectedText(uint32 selection) const { void HistoryReply::initDimensions() { if (!replyToMsg) { - _maxReplyWidth = st::msgReplyBarSkip + st::msgDateFont->m.width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message)) + st::msgPadding.left() + st::msgPadding.right(); + _maxReplyWidth = st::msgReplyBarSkip + st::msgDateFont->width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message)) + st::msgPadding.left() + st::msgPadding.right(); } HistoryMessage::initDimensions(); if (replyToMsg) { @@ -7117,7 +7123,7 @@ void HistoryReply::drawReplyTo(Painter &p, int32 x, int32 y, int32 w, bool selec } else { p.setPen(date->p); } - p.drawText(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2 + st::msgDateFont->ascent, st::msgDateFont->m.elidedText(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message), Qt::ElideRight, w - st::msgReplyBarSkip)); + p.drawText(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2 + st::msgDateFont->ascent, st::msgDateFont->elided(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message), w - st::msgReplyBarSkip)); } } } @@ -7282,7 +7288,7 @@ void HistoryReply::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, i HistoryReply::~HistoryReply() { if (replyToMsg) { App::historyUnregReply(this, replyToMsg); - } else if (replyToMsgId) { + } else if (replyToMsgId && App::api()) { App::api()->itemRemoved(this); } } diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index df916ccb11..811d88171e 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index f516c32315..3d07462cf8 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -75,7 +78,7 @@ HistoryInner::HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, His _trippleClickTimer.setSingleShot(true); - if (botInfo && !botInfo->inited) { + if (botInfo && !botInfo->inited && App::api()) { App::api()->requestFullPeer(hist->peer); } @@ -1104,7 +1107,7 @@ int32 HistoryInner::recountHeight(HistoryItem *resizedItem) { int32 tw = scrollArea->width() - st::msgMargin.left() - st::msgMargin.right(); if (tw > st::msgMaxWidth) tw = st::msgMaxWidth; tw -= st::msgPadding.left() + st::msgPadding.right(); - int32 mw = qMax(botInfo->text.maxWidth(), st::msgNameFont->m.width(lang(lng_bot_description))); + int32 mw = qMax(botInfo->text.maxWidth(), st::msgNameFont->width(lang(lng_bot_description))); if (tw > mw) tw = mw; botDescWidth = tw; @@ -1138,7 +1141,7 @@ void HistoryInner::updateBotInfo(bool recount) { int32 tw = scrollArea->width() - st::msgMargin.left() - st::msgMargin.right(); if (tw > st::msgMaxWidth) tw = st::msgMaxWidth; tw -= st::msgPadding.left() + st::msgPadding.right(); - int32 mw = qMax(botInfo->text.maxWidth(), st::msgNameFont->m.width(lang(lng_bot_description))); + int32 mw = qMax(botInfo->text.maxWidth(), st::msgNameFont->width(lang(lng_bot_description))); if (tw > mw) tw = mw; botDescWidth = tw; @@ -1837,7 +1840,8 @@ void BotKeyboard::mouseReleaseEvent(QMouseEvent *e) { updateSelected(); if (_sel == down && down >= 0) { int row = (down / MatrixRowShift), col = down % MatrixRowShift; - App::sendBotCommand(_btns.at(row).at(col).cmd, _wasForMsgId.msg); + QString cmd(_btns.at(row).at(col).cmd); + App::sendBotCommand(cmd, _wasForMsgId.msg); } } @@ -2032,11 +2036,10 @@ HistoryHider::HistoryHider(MainWidget *parent, bool forwardSelected) : QWidget(p , _sharedContact(0) , _forwardSelected(forwardSelected) , _sendPath(false) -, forwardButton(this, lang(lng_forward), st::btnSelectDone) -, cancelButton(this, lang(lng_cancel), st::btnSelectCancel) +, _send(this, lang(lng_forward_send), st::defaultBoxButton) +, _cancel(this, lang(lng_box_cancel), st::cancelBoxButton) , offered(0) -, aOpacity(0, 1) -, aOpacityFunc(anim::easeOutCirc) +, a_opacity(0, 1) , hiding(false) , _forwardRequest(0) , toTextWidth(0) @@ -2049,11 +2052,10 @@ HistoryHider::HistoryHider(MainWidget *parent, UserData *sharedContact) : QWidge , _sharedContact(sharedContact) , _forwardSelected(false) , _sendPath(false) -, forwardButton(this, lang(lng_forward_send), st::btnSelectDone) -, cancelButton(this, lang(lng_cancel), st::btnSelectCancel) +, _send(this, lang(lng_forward_send), st::defaultBoxButton) +, _cancel(this, lang(lng_box_cancel), st::cancelBoxButton) , offered(0) -, aOpacity(0, 1) -, aOpacityFunc(anim::easeOutCirc) +, a_opacity(0, 1) , hiding(false) , _forwardRequest(0) , toTextWidth(0) @@ -2066,11 +2068,10 @@ HistoryHider::HistoryHider(MainWidget *parent) : QWidget(parent) , _sharedContact(0) , _forwardSelected(false) , _sendPath(true) -, forwardButton(this, lang(lng_forward_send), st::btnSelectDone) -, cancelButton(this, lang(lng_cancel), st::btnSelectCancel) +, _send(this, lang(lng_forward_send), st::defaultBoxButton) +, _cancel(this, lang(lng_box_cancel), st::cancelBoxButton) , offered(0) -, aOpacity(0, 1) -, aOpacityFunc(anim::easeOutCirc) +, a_opacity(0, 1) , hiding(false) , _forwardRequest(0) , toTextWidth(0) @@ -2080,11 +2081,11 @@ HistoryHider::HistoryHider(MainWidget *parent) : QWidget(parent) } void HistoryHider::init() { - connect(&forwardButton, SIGNAL(clicked()), this, SLOT(forward())); - connect(&cancelButton, SIGNAL(clicked()), this, SLOT(startHide())); + connect(&_send, SIGNAL(clicked()), this, SLOT(forward())); + connect(&_cancel, SIGNAL(clicked()), this, SLOT(startHide())); connect(App::wnd()->getTitle(), SIGNAL(hiderClicked()), this, SLOT(startHide())); - _chooseWidth = st::forwardFont->m.width(lang(lng_forward_choose)); + _chooseWidth = st::forwardFont->width(lang(lng_forward_choose)); resizeEvent(0); anim::start(this); @@ -2094,17 +2095,15 @@ bool HistoryHider::animStep(float64 ms) { float64 dt = ms / 200; bool res = true; if (dt >= 1) { - aOpacity.finish(); + a_opacity.finish(); if (hiding) { QTimer::singleShot(0, this, SLOT(deleteLater())); } res = false; } else { - aOpacity.update(dt, aOpacityFunc); + a_opacity.update(dt, anim::linear); } - App::wnd()->getTitle()->setHideLevel(aOpacity.current()); - forwardButton.setOpacity(aOpacity.current()); - cancelButton.setOpacity(aOpacity.current()); + App::wnd()->getTitle()->setHideLevel(a_opacity.current()); update(); return res; } @@ -2116,9 +2115,9 @@ bool HistoryHider::withConfirm() const { void HistoryHider::paintEvent(QPaintEvent *e) { Painter p(this); if (!hiding || !cacheForAnim.isNull() || !offered) { - p.setOpacity(aOpacity.current() * st::layerAlpha); - p.fillRect(0, st::titleShadow, width(), height() - st::titleShadow, st::layerBG->b); - p.setOpacity(aOpacity.current()); + p.setOpacity(a_opacity.current() * st::layerAlpha); + p.fillRect(rect(), st::layerBG->b); + p.setOpacity(a_opacity.current()); } if (cacheForAnim.isNull() || !offered) { p.setFont(st::forwardFont->f); @@ -2128,14 +2127,8 @@ void HistoryHider::paintEvent(QPaintEvent *e) { // fill bg p.fillRect(box, st::boxBG->b); - // paint shadows - p.fillRect(box.x(), box.y() + box.height() - st::btnSelectCancel.height - st::scrollDef.bottomsh, box.width(), st::scrollDef.bottomsh, st::scrollDef.shColor->b); - - // paint button sep - p.fillRect(box.x() + st::btnSelectCancel.width, box.y() + box.height() - st::btnSelectCancel.height, st::lineWidth, st::btnSelectCancel.height, st::btnSelectSep->b); - p.setPen(st::black->p); - toText.drawElided(p, box.left() + (box.width() - toTextWidth) / 2, box.top() + st::boxPadding.top(), toTextWidth + 1); + toText.drawElided(p, box.left() + st::boxPadding.left(), box.top() + st::boxPadding.top(), toTextWidth + 2); } else { int32 w = st::forwardMargins.left() + _chooseWidth + st::forwardMargins.right(), h = st::forwardMargins.top() + st::forwardFont->height + st::forwardMargins.bottom(); App::roundRect(p, (width() - w) / 2, (height() - h) / 2, w, h, st::forwardBg, ForwardCorners); @@ -2179,7 +2172,9 @@ void HistoryHider::startHide() { if (cWideMode()) { if (offered) cacheForAnim = myGrab(this, box); if (_forwardRequest) MTP::cancel(_forwardRequest); - aOpacity.start(0); + a_opacity.start(0); + _send.hide(); + _cancel.hide(); anim::start(this); } else { QTimer::singleShot(0, this, SLOT(deleteLater())); @@ -2209,24 +2204,27 @@ MainWidget *HistoryHider::parent() { } void HistoryHider::resizeEvent(QResizeEvent *e) { - int32 w = st::forwardWidth, h = st::boxPadding.top() + st::forwardFont->height + st::boxPadding.bottom(); + int32 w = st::boxWidth, h = st::boxPadding.top() + st::boxPadding.bottom(); if (offered) { - forwardButton.show(); - cancelButton.show(); - h += forwardButton.height() + st::scrollDef.bottomsh; + if (!hiding) { + _send.show(); + _cancel.show(); + } + h += st::boxTextFont->height + st::boxButtonPadding.top() + _send.height() + st::boxButtonPadding.bottom(); } else { - forwardButton.hide(); - cancelButton.hide(); + h += st::forwardFont->height; + _send.hide(); + _cancel.hide(); } box = QRect((width() - w) / 2, (height() - h) / 2, w, h); - cancelButton.move(box.x(), box.y() + h - cancelButton.height()); - forwardButton.move(box.x() + box.width() - forwardButton.width(), cancelButton.y()); + _send.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right(), box.y() + h - st::boxButtonPadding.bottom() - _send.height(), width()); + _cancel.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right() + _send.width() + st::boxButtonPadding.left(), _send.y(), width()); } bool HistoryHider::offerPeer(PeerId peer) { if (!peer) { offered = 0; - toText.setText(st::boxFont, QString()); + toText.setText(st::boxTextFont, QString()); toTextWidth = 0; resizeEvent(0); return false; @@ -2255,7 +2253,7 @@ bool HistoryHider::offerPeer(PeerId peer) { return false; } - toText.setText(st::boxFont, phrase, _textNameOptions); + toText.setText(st::boxTextFont, phrase, _textNameOptions); toTextWidth = toText.maxWidth(); if (toTextWidth > box.width() - st::boxPadding.left() - st::boxPadding.right()) { toTextWidth = box.width() - st::boxPadding.left() - st::boxPadding.right(); @@ -2342,7 +2340,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) , _recording(false), _inRecord(false), _inField(false), _inReply(false) , a_recordingLevel(0, 0), _recordingSamples(0) , a_recordOver(0, 0), a_recordDown(0, 0), a_recordCancel(st::recordCancel->c, st::recordCancel->c) -, _recordCancelWidth(st::recordFont->m.width(lang(lng_record_cancel))) +, _recordCancelWidth(st::recordFont->width(lang(lng_record_cancel))) , _kbShown(false) , _kbWasHidden(false) , _kbReplyTo(0) @@ -2751,7 +2749,7 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { } } - if (!setsToRequest.isEmpty()) { + if (!setsToRequest.isEmpty() && App::api()) { for (QMap::const_iterator i = setsToRequest.cbegin(), e = setsToRequest.cend(); i != e; ++i) { App::api()->scheduleStickerSetRequest(i.key(), i.value()); } @@ -2842,7 +2840,7 @@ void HistoryWidget::fastShowAtEnd(History *h) { clearAllLoadRequests(); - _showAtMsgId = ShowAtTheEndMsgId; + setMsgId(ShowAtUnreadMsgId); _histInited = false; if (h->isReadyFor(_showAtMsgId, _fixedInScrollMsgId, _fixedInScrollMsgTop)) { @@ -2854,6 +2852,9 @@ void HistoryWidget::fastShowAtEnd(History *h) { } void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { + MsgId wasMsgId = _showAtMsgId; + History *wasHistory = _history; + if (_history) { if (_peer->id == peerId) { _history->lastWidth = 0; @@ -2881,7 +2882,9 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { historyLoaded(); } - emit peerShown(_peer); + App::main()->dlgUpdated(wasHistory, wasMsgId); + emit historyShown(_history, _showAtMsgId); + App::main()->topBar()->update(); update(); return; @@ -2915,8 +2918,6 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { if (_history->unreadBar) { _history->unreadBar->destroy(); } - - App::main()->dlgUpdated(_history); _history = 0; } @@ -2994,9 +2995,6 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { firstLoadMessages(); doneShow(); } - if (_history) { - App::main()->dlgUpdated(_history); - } App::main()->peerUpdated(_peer); @@ -3023,7 +3021,7 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { } if (_replyToId) { updateReplyTo(); - if (!_replyTo) App::api()->requestReplyTo(0, _peer->asChannel(), _replyToId); + if (!_replyTo && App::api()) App::api()->requestReplyTo(0, _peer->asChannel(), _replyToId); } resizeEvent(0); if (!_previewCancelled) { @@ -3038,7 +3036,9 @@ void HistoryWidget::showPeerHistory(const PeerId &peerId, MsgId showAtMsgId) { if (App::wnd()) App::wnd()->setInnerFocus(); - emit peerShown(_peer); + App::main()->dlgUpdated(wasHistory, wasMsgId); + emit historyShown(_history, _showAtMsgId); + App::main()->topBar()->update(); update(); } @@ -3422,7 +3422,7 @@ bool HistoryWidget::messagesFailed(const RPCError &error, mtpRequestId requestId if (error.type() == qstr("CHANNEL_PRIVATE")) { App::main()->showDialogs(); - App::wnd()->showLayer(new ConfirmBox(lang(lng_channel_not_accessible), true)); + App::wnd()->showLayer(new InformBox(lang(lng_channel_not_accessible))); return true; } @@ -3541,7 +3541,8 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages calcNextReplyReturn(); } - _showAtMsgId = _delayedShowAtMsgId; + setMsgId(_delayedShowAtMsgId); + _histInited = false; if (_history->isChannel() && wasOnlyImportant != _history->asChannelHistory()->onlyImportant()) { @@ -3877,7 +3878,7 @@ bool HistoryWidget::joinFail(const RPCError &error, mtpRequestId req) { if (_unblockRequest == req) _unblockRequest = 0; if (error.type() == qstr("CHANNEL_PRIVATE")) { - App::wnd()->showLayer(new ConfirmBox(lang(lng_channel_not_accessible), true)); + App::wnd()->showLayer(new InformBox(lang(lng_channel_not_accessible))); return true; } return false; @@ -3943,10 +3944,23 @@ void HistoryWidget::onSendPaths(const PeerId &peer) { uploadMedias(cSendPaths(), ToPrepareDocument); } +History *HistoryWidget::history() const { + return _history; +} + PeerData *HistoryWidget::peer() const { return _peer; } +void HistoryWidget::setMsgId(MsgId showAtMsgId) { // sometimes _showAtMsgId is set directly + if (_showAtMsgId != showAtMsgId) { + MsgId wasMsgId = _showAtMsgId; + _showAtMsgId = showAtMsgId; + App::main()->dlgUpdated(_history, wasMsgId); + emit historyShown(_history, _showAtMsgId); + } +} + MsgId HistoryWidget::msgId() const { return _showAtMsgId; } @@ -4637,7 +4651,7 @@ void HistoryWidget::updateOnlineDisplay(int32 x, int32 w) { } if (_titlePeerText != text) { _titlePeerText = text; - _titlePeerTextWidth = st::dlgHistFont->m.width(_titlePeerText); + _titlePeerTextWidth = st::dlgHistFont->width(_titlePeerText); if (App::main()) { App::main()->topBar()->update(); } @@ -5078,7 +5092,7 @@ void HistoryWidget::onAudioFailed(const FullMsgId &newId) { } void HistoryWidget::onReportSpamClicked() { - ConfirmBox *box = new ConfirmBox(lang(_peer->isUser() ? lng_report_spam_sure : (_peer->isChat() ? lng_report_spam_sure_group : lng_report_spam_sure_channel)), lang(lng_report_spam_ok)); + ConfirmBox *box = new ConfirmBox(lang(_peer->isUser() ? lng_report_spam_sure : (_peer->isChat() ? lng_report_spam_sure_group : lng_report_spam_sure_channel)), lang(lng_report_spam_ok), st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onReportSpamSure())); App::wnd()->showLayer(box); _clearPeer = _peer; @@ -5323,7 +5337,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, } else if (initial && _showAtMsgId > 0) { HistoryItem *item = App::histItemById(_channel, _showAtMsgId); if (!item || item->detached()) { - _showAtMsgId = 0; + setMsgId(0); _histInited = false; return updateListSize(addToY, initial); } else { @@ -5354,7 +5368,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, if (item) { toY = qMax(firstItemY + item->y + item->block()->y - _fixedInScrollMsgTop, 0); } else { - _showAtMsgId = ShowAtUnreadMsgId; + setMsgId(ShowAtUnreadMsgId); _fixedInScrollMsgId = 0; _fixedInScrollMsgTop = 0; _histInited = false; @@ -5370,7 +5384,7 @@ void HistoryWidget::updateListSize(int32 addToY, bool initial, bool loadedDown, if (toY < _scroll.scrollTopMax() + st::unreadBarHeight) { _history->addUnreadBar(); if (_history->unreadBar) { - _showAtMsgId = ShowAtUnreadMsgId; + setMsgId(ShowAtUnreadMsgId); _histInited = false; return updateListSize(0, true); } @@ -5903,10 +5917,12 @@ void HistoryWidget::peerUpdated(PeerData *data) { if (data && data == _peer) { updateListSize(); if (_peer->isChannel()) updateReportSpamStatus(); - if (data->isChat() && data->asChat()->count > 0 && data->asChat()->participants.isEmpty()) { - App::api()->requestFullPeer(data); - } else if (data->isUser() && data->asUser()->blocked == UserBlockUnknown) { - App::api()->requestFullPeer(data); + if (App::api()) { + if (data->isChat() && data->asChat()->count > 0 && data->asChat()->participants.isEmpty()) { + App::api()->requestFullPeer(data); + } else if (data->isUser() && data->asUser()->blocked == UserBlockUnknown) { + App::api()->requestFullPeer(data); + } } if (!_showAnim.animating()) { bool resize = (_unblock.isHidden() == isBlocked() || (!isBlocked() && _joinChannel.isHidden() == isJoinChannel())); @@ -6131,7 +6147,7 @@ void HistoryWidget::drawField(Painter &p) { } else { p.setFont(st::msgDateFont->f); p.setPen(st::msgInDateColor->p); - p.drawText(replyLeft, backy + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2 + st::msgDateFont->ascent, st::msgDateFont->m.elidedText(lang(lng_profile_loading), Qt::ElideRight, width() - replyLeft - _replyForwardPreviewCancel.width() - st::msgReplyPadding.right())); + p.drawText(replyLeft, backy + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2 + st::msgDateFont->ascent, st::msgDateFont->elided(lang(lng_profile_loading), width() - replyLeft - _replyForwardPreviewCancel.width() - st::msgReplyPadding.right())); } } } else if (from && text) { @@ -6204,7 +6220,7 @@ void HistoryWidget::drawRecording(Painter &p) { p.setPen(st::black->p); p.drawText(_attachPhoto.x() + _attachEmoji.width(), _attachPhoto.y() + st::recordTextTop + st::recordFont->ascent, duration); - int32 left = _attachPhoto.x() + _attachEmoji.width() + st::recordFont->m.width(duration) + ((_send.width() - st::btnRecordAudio.pxWidth()) / 2); + int32 left = _attachPhoto.x() + _attachEmoji.width() + st::recordFont->width(duration) + ((_send.width() - st::btnRecordAudio.pxWidth()) / 2); int32 right = width() - _send.width(); p.setPen(a_recordCancel.current()); @@ -6271,7 +6287,7 @@ void HistoryWidget::paintEvent(QPaintEvent *e) { } } else { style::font font(st::msgServiceFont); - int32 w = font->m.width(lang(lng_willbe_history)) + st::msgPadding.left() + st::msgPadding.right(), h = font->height + st::msgServicePadding.top() + st::msgServicePadding.bottom() + 2; + int32 w = font->width(lang(lng_willbe_history)) + st::msgPadding.left() + st::msgPadding.right(), h = font->height + st::msgServicePadding.top() + st::msgServicePadding.bottom() + 2; QRect tr((width() - w) / 2, (height() - _field.height() - 2 * st::sendPadding - h) / 2, w, h); App::roundRect(p, tr, App::msgServiceBg(), ServiceCorners); diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index f5b4c583f0..d52f5cb468 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -351,11 +354,9 @@ private: UserData *_sharedContact; bool _forwardSelected, _sendPath; - FlatButton forwardButton; - FlatButton cancelButton; + BoxButton _send, _cancel; PeerData *offered; - anim::fvalue aOpacity; - anim::transition aOpacityFunc; + anim::fvalue a_opacity; QRect box; bool hiding; @@ -456,7 +457,9 @@ public: void shareContact(const PeerId &peer, const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, int32 userId = 0); + History *history() const; PeerData *peer() const; + void setMsgId(MsgId showAtMsgId); MsgId msgId() const; HistoryItem *atTopImportantMsg(int32 &bottomUnderScrollTop) const; @@ -541,7 +544,7 @@ public: signals: void cancelled(); - void peerShown(PeerData *); + void historyShown(History *history, MsgId atMsgId); public slots: diff --git a/Telegram/SourceFiles/intro/intro.cpp b/Telegram/SourceFiles/intro/intro.cpp index 245349d0bd..4b2472ca07 100644 --- a/Telegram/SourceFiles/intro/intro.cpp +++ b/Telegram/SourceFiles/intro/intro.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/intro/intro.h b/Telegram/SourceFiles/intro/intro.h index af7f11d0f5..924e510f92 100644 --- a/Telegram/SourceFiles/intro/intro.h +++ b/Telegram/SourceFiles/intro/intro.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp index 9b8848b887..caabe3768e 100644 --- a/Telegram/SourceFiles/intro/introcode.cpp +++ b/Telegram/SourceFiles/intro/introcode.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/intro/introcode.h b/Telegram/SourceFiles/intro/introcode.h index b171d0574b..d9cf7b18fd 100644 --- a/Telegram/SourceFiles/intro/introcode.h +++ b/Telegram/SourceFiles/intro/introcode.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index 9c11960679..803a06a9f2 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/intro/introphone.h b/Telegram/SourceFiles/intro/introphone.h index 2eaee4580b..e100c35477 100644 --- a/Telegram/SourceFiles/intro/introphone.h +++ b/Telegram/SourceFiles/intro/introphone.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/intro/intropwdcheck.cpp b/Telegram/SourceFiles/intro/intropwdcheck.cpp index 4dc59c8b68..ee75a96d13 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.cpp +++ b/Telegram/SourceFiles/intro/intropwdcheck.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -249,7 +252,7 @@ bool IntroPwdCheck::codeSubmitFail(const RPCError &error) { } void IntroPwdCheck::recoverStarted(const MTPauth_PasswordRecovery &result) { - _emailPattern = st::introFont->m.elidedText(lng_signin_recover_hint(lt_recover_email, qs(result.c_auth_passwordRecovery().vemail_pattern)), Qt::ElideRight, textRect.width()); + _emailPattern = st::introFont->elided(lng_signin_recover_hint(lt_recover_email, qs(result.c_auth_passwordRecovery().vemail_pattern)), textRect.width()); update(); } @@ -283,14 +286,14 @@ void IntroPwdCheck::onToRecover() { } update(); } else { - ConfirmBox *box = new ConfirmBox(lang(lng_signin_no_email_forgot), true); + ConfirmBox *box = new InformBox(lang(lng_signin_no_email_forgot)); App::wnd()->showLayer(box); connect(box, SIGNAL(destroyed(QObject*)), this, SLOT(onToReset())); } } void IntroPwdCheck::onToPassword() { - ConfirmBox *box = new ConfirmBox(lang(lng_signin_no_email_forgot), true); + ConfirmBox *box = new InformBox(lang(lng_signin_cant_email_forgot)); App::wnd()->showLayer(box); connect(box, SIGNAL(destroyed(QObject*)), this, SLOT(onToReset())); } @@ -312,7 +315,7 @@ void IntroPwdCheck::onToReset() { void IntroPwdCheck::onReset() { if (sentRequest) return; - ConfirmBox *box = new ConfirmBox(lang(lng_sigin_sure_reset), lang(lng_sigin_reset), QString(), st::btnRedDone); + ConfirmBox *box = new ConfirmBox(lang(lng_signin_sure_reset), lang(lng_signin_reset), st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onResetSure())); App::wnd()->showLayer(box); } diff --git a/Telegram/SourceFiles/intro/intropwdcheck.h b/Telegram/SourceFiles/intro/intropwdcheck.h index 175d94957d..7925c31482 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.h +++ b/Telegram/SourceFiles/intro/intropwdcheck.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/intro/introsignup.cpp b/Telegram/SourceFiles/intro/introsignup.cpp index ee24a75136..538b70107a 100644 --- a/Telegram/SourceFiles/intro/introsignup.cpp +++ b/Telegram/SourceFiles/intro/introsignup.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/intro/introsignup.h b/Telegram/SourceFiles/intro/introsignup.h index 9d68fa10d8..c3ec33e543 100644 --- a/Telegram/SourceFiles/intro/introsignup.h +++ b/Telegram/SourceFiles/intro/introsignup.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/intro/introsteps.cpp b/Telegram/SourceFiles/intro/introsteps.cpp index 6b87c08f62..69ec1d1cc7 100644 --- a/Telegram/SourceFiles/intro/introsteps.cpp +++ b/Telegram/SourceFiles/intro/introsteps.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -49,7 +52,7 @@ _next(this, lang(lng_start_msgs), st::btnIntroNext) { _changeLang.show(); } - _headerWidth = st::introHeaderFont->m.width(qsl("Telegram Desktop")); + _headerWidth = st::introHeaderFont->width(qsl("Telegram Desktop")); setGeometry(parent->innerRect()); diff --git a/Telegram/SourceFiles/intro/introsteps.h b/Telegram/SourceFiles/intro/introsteps.h index 0ec8706ba8..dc8dc3ed3c 100644 --- a/Telegram/SourceFiles/intro/introsteps.h +++ b/Telegram/SourceFiles/intro/introsteps.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/lang.cpp b/Telegram/SourceFiles/lang.cpp index 0857788d75..db2cb4dc7c 100644 --- a/Telegram/SourceFiles/lang.cpp +++ b/Telegram/SourceFiles/lang.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/lang.h b/Telegram/SourceFiles/lang.h index 9091f28068..508fcdb23c 100644 --- a/Telegram/SourceFiles/lang.h +++ b/Telegram/SourceFiles/lang.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/langloaderplain.cpp b/Telegram/SourceFiles/langloaderplain.cpp index 94843061c0..3760077b69 100644 --- a/Telegram/SourceFiles/langloaderplain.cpp +++ b/Telegram/SourceFiles/langloaderplain.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "langloaderplain.h" diff --git a/Telegram/SourceFiles/langloaderplain.h b/Telegram/SourceFiles/langloaderplain.h index 8b03afb1c6..ad25438c5c 100644 --- a/Telegram/SourceFiles/langloaderplain.h +++ b/Telegram/SourceFiles/langloaderplain.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/langs/lang_de.strings b/Telegram/SourceFiles/langs/lang_de.strings index 5d122a2f02..0a44d54745 100644 --- a/Telegram/SourceFiles/langs/lang_de.strings +++ b/Telegram/SourceFiles/langs/lang_de.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "Deutsch"; "lng_switch_to_this" = "Auf Deutsch zurücksetzen"; diff --git a/Telegram/SourceFiles/langs/lang_es.strings b/Telegram/SourceFiles/langs/lang_es.strings index 7857ad42e7..58d0e67679 100644 --- a/Telegram/SourceFiles/langs/lang_es.strings +++ b/Telegram/SourceFiles/langs/lang_es.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "Español"; "lng_switch_to_this" = "Cambiar al idioma español"; diff --git a/Telegram/SourceFiles/langs/lang_it.strings b/Telegram/SourceFiles/langs/lang_it.strings index 64df4353d2..2fab7dbe00 100644 --- a/Telegram/SourceFiles/langs/lang_it.strings +++ b/Telegram/SourceFiles/langs/lang_it.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "Italiano"; "lng_switch_to_this" = "Passa all'italiano"; diff --git a/Telegram/SourceFiles/langs/lang_ko.strings b/Telegram/SourceFiles/langs/lang_ko.strings index 9271353621..a079f1e212 100644 --- a/Telegram/SourceFiles/langs/lang_ko.strings +++ b/Telegram/SourceFiles/langs/lang_ko.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "한국어"; "lng_switch_to_this" = "한국어로 변경"; diff --git a/Telegram/SourceFiles/langs/lang_nl.strings b/Telegram/SourceFiles/langs/lang_nl.strings index dca1305e35..4ca9db6407 100644 --- a/Telegram/SourceFiles/langs/lang_nl.strings +++ b/Telegram/SourceFiles/langs/lang_nl.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "Nederlands"; "lng_switch_to_this" = "Overschakelen naar Nederlands"; diff --git a/Telegram/SourceFiles/langs/lang_pt_BR.strings b/Telegram/SourceFiles/langs/lang_pt_BR.strings index 5780d74e0d..1a6d27d6cb 100644 --- a/Telegram/SourceFiles/langs/lang_pt_BR.strings +++ b/Telegram/SourceFiles/langs/lang_pt_BR.strings @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ "lng_language_name" = "Português (Brasil)"; "lng_switch_to_this" = "Trocar para Português (Brasil)"; diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp index 286ede18a0..abddad43dc 100644 --- a/Telegram/SourceFiles/layerwidget.cpp +++ b/Telegram/SourceFiles/layerwidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/layerwidget.h b/Telegram/SourceFiles/layerwidget.h index bf23ac43e5..dc25d1d6cb 100644 --- a/Telegram/SourceFiles/layerwidget.h +++ b/Telegram/SourceFiles/layerwidget.h @@ -12,14 +12,17 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once #include "gui/boxshadow.h" -class LayeredWidget : public QWidget { +class LayeredWidget : public TWidget { Q_OBJECT public: diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index 2b3ccc62a2..042786e8b3 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "localimageloader.h" diff --git a/Telegram/SourceFiles/localimageloader.h b/Telegram/SourceFiles/localimageloader.h index e77d4c4de7..d741274ec4 100644 --- a/Telegram/SourceFiles/localimageloader.h +++ b/Telegram/SourceFiles/localimageloader.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index ab33cec92b..232c633919 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "localstorage.h" @@ -3112,7 +3115,7 @@ namespace Local { peers.push_back(peer); } App::emitPeerUpdated(); - App::api()->requestPeers(peers); + if (App::api()) App::api()->requestPeers(peers); } void addSavedPeer(PeerData *peer, const QDateTime &position) { diff --git a/Telegram/SourceFiles/localstorage.h b/Telegram/SourceFiles/localstorage.h index b6789065a3..c653bf85f3 100644 --- a/Telegram/SourceFiles/localstorage.h +++ b/Telegram/SourceFiles/localstorage.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index c723b2d682..7da4da0322 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include diff --git a/Telegram/SourceFiles/logs.h b/Telegram/SourceFiles/logs.h index 83c6606446..56595b7a6d 100644 --- a/Telegram/SourceFiles/logs.h +++ b/Telegram/SourceFiles/logs.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp index 7ac4e739fc..e45f1e109f 100644 --- a/Telegram/SourceFiles/main.cpp +++ b/Telegram/SourceFiles/main.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "application.h" diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index ff123dfa1e..ee8d9b1d89 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -96,7 +99,7 @@ void TopBarWidget::onDeleteContact() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; UserData *u = p ? p->asUser() : 0; if (u) { - ConfirmBox *box = new ConfirmBox(lng_sure_delete_contact(lt_contact, p->name)); + ConfirmBox *box = new ConfirmBox(lng_sure_delete_contact(lt_contact, p->name), lang(lng_box_delete)); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteContactSure())); App::wnd()->showLayer(box); } @@ -116,7 +119,7 @@ void TopBarWidget::onDeleteAndExit() { PeerData *p = App::main() ? App::main()->profilePeer() : 0; ChatData *c = p ? p->asChat() : 0; if (c) { - ConfirmBox *box = new ConfirmBox(lng_sure_delete_and_exit(lt_group, p->name)); + ConfirmBox *box = new ConfirmBox(lng_sure_delete_and_exit(lt_group, p->name), lang(lng_box_leave), st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteAndExitSure())); App::wnd()->showLayer(box); } @@ -359,7 +362,7 @@ void TopBarWidget::showSelected(uint32 selCount, bool canDelete) { _selCount = selCount; _canDelete = canDelete; _selStr = (_selCount > 0) ? lng_selected_count(lt_count, _selCount) : QString(); - _selStrWidth = st::btnDefLink.font->m.width(_selStr); + _selStrWidth = st::btnDefLink.font->width(_selStr); setCursor((!p && _selCount) ? style::cur_default : style::cur_pointer); showAll(); } @@ -400,7 +403,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _handlingChannelDifference(false) connect(_api, SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*))); connect(this, SIGNAL(peerUpdated(PeerData*)), &history, SLOT(peerUpdated(PeerData*))); connect(&_topBar, SIGNAL(clicked()), this, SLOT(onTopBarClick())); - connect(&history, SIGNAL(peerShown(PeerData*)), this, SLOT(onPeerShown(PeerData*))); + connect(&history, SIGNAL(historyShown(History*,MsgId)), this, SLOT(onHistoryShown(History*,MsgId))); connect(&updateNotifySettingTimer, SIGNAL(timeout()), this, SLOT(onUpdateNotifySettings())); connect(this, SIGNAL(showPeerAsync(quint64,qint32)), this, SLOT(showPeerHistory(quint64,qint32)), Qt::QueuedConnection); if (audioPlayer()) { @@ -444,7 +447,7 @@ _failDifferenceTimeout(1), _lastUpdateTime(0), _handlingChannelDifference(false) bool MainWidget::onForward(const PeerId &peer, ForwardWhatMessages what) { PeerData *p = App::peer(peer); if (!peer || (p->isChannel() && !p->asChannel()->canPublish() && p->asChannel()->isBroadcast()) || (p->isChat() && (p->asChat()->haveLeft || p->asChat()->isForbidden)) || (p->isUser() && p->asUser()->access == UserNoAccess)) { - App::wnd()->showLayer(new ConfirmBox(lang(lng_forward_cant), true)); + App::wnd()->showLayer(new InformBox(lang(lng_forward_cant))); return false; } history.cancelReply(); @@ -655,7 +658,7 @@ void MainWidget::noHider(HistoryHider *destroyed) { _forwardConfirm->startHide(); _forwardConfirm = 0; } - onPeerShown(history.peer()); + onHistoryShown(history.history(), history.msgId()); if (profile || overview || (history.peer() && history.peer()->id)) { dialogs.enableShadow(false); QPixmap animCache = myGrab(this, QRect(0, _playerHeight + st::topBarHeight, _dialogsWidth, height() - _playerHeight - st::topBarHeight)), @@ -700,7 +703,7 @@ void MainWidget::hiderLayer(HistoryHider *h) { dialogs.enableShadow(); _topBar.enableShadow(); - onPeerShown(0); + onHistoryShown(0, 0); if (overview) { overview->hide(); } else if (profile) { @@ -721,7 +724,7 @@ void MainWidget::forwardLayer(int32 forwardSelected) { void MainWidget::deleteLayer(int32 selectedCount) { QString str((selectedCount < 0) ? lang(selectedCount < -1 ? lng_selected_cancel_sure_this : lng_selected_delete_sure_this) : lng_selected_delete_sure(lt_count, selectedCount)); - ConfirmBox *box = new ConfirmBox((selectedCount < 0) ? str : str.arg(selectedCount), lang(lng_selected_delete_confirm)); + ConfirmBox *box = new ConfirmBox((selectedCount < 0) ? str : str.arg(selectedCount), lang(lng_box_delete)); if (selectedCount < 0) { connect(box, SIGNAL(confirmed()), overview ? overview : static_cast(&history), SLOT(onDeleteContextSure())); } else { @@ -741,7 +744,7 @@ bool MainWidget::selectingPeer(bool withConfirm) { void MainWidget::offerPeer(PeerId peer) { App::wnd()->hideLayer(); if (_hider->offerPeer(peer) && !cWideMode()) { - _forwardConfirm = new ConfirmBox(_hider->offeredText(), lang(lng_forward)); + _forwardConfirm = new ConfirmBox(_hider->offeredText(), lang(lng_forward_send)); connect(_forwardConfirm, SIGNAL(confirmed()), _hider, SLOT(forward())); connect(_forwardConfirm, SIGNAL(cancelled()), this, SLOT(onForwardCancel())); connect(_forwardConfirm, SIGNAL(destroyed(QObject*)), this, SLOT(onForwardCancel(QObject*))); @@ -879,7 +882,7 @@ bool MainWidget::addParticipantFail(UserData *user, const RPCError &error) { } else if (error.type() == "PEER_FLOOD") { text = 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()->showLayer(new ConfirmBox(text, true)); + App::wnd()->showLayer(new InformBox(text)); return false; } @@ -893,7 +896,7 @@ bool MainWidget::addParticipantsFail(const RPCError &error) { } else if (error.type() == "PEER_FLOOD") { text = 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()->showLayer(new ConfirmBox(text, true)); + App::wnd()->showLayer(new InformBox(text)); return false; } @@ -1015,7 +1018,7 @@ bool MainWidget::sendMessageFail(const RPCError &error) { if (mtpIsFlood(error)) return false; if (error.type() == qsl("PEER_FLOOD")) { - App::wnd()->showLayer(new ConfirmBox(lng_cant_send_to_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info))), true)); + App::wnd()->showLayer(new InformBox(lng_cant_send_to_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 false; @@ -2631,11 +2634,13 @@ QRect MainWidget::historyRect() const { } void MainWidget::dlgUpdated(DialogRow *row) { + if (!row) return; dialogs.dlgUpdated(row); } -void MainWidget::dlgUpdated(History *row) { - dialogs.dlgUpdated(row); +void MainWidget::dlgUpdated(History *row, MsgId msgId) { + if (!row) return; + dialogs.dlgUpdated(row, msgId); } void MainWidget::windowShown() { @@ -2757,7 +2762,7 @@ void MainWidget::hideAll() { void MainWidget::showAll() { if (cPasswordRecovered()) { cSetPasswordRecovered(false); - App::wnd()->showLayer(new ConfirmBox(lang(lng_signin_password_removed), true, lang(lng_continue))); + App::wnd()->showLayer(new InformBox(lang(lng_signin_password_removed))); } if (cWideMode()) { if (_hider) { @@ -2783,7 +2788,7 @@ void MainWidget::showAll() { if (_hider) { _hider->hide(); if (!_forwardConfirm && _hider->wasOffered()) { - _forwardConfirm = new ConfirmBox(_hider->offeredText(), lang(lng_forward)); + _forwardConfirm = new ConfirmBox(_hider->offeredText(), lang(lng_forward_send)); connect(_forwardConfirm, SIGNAL(confirmed()), _hider, SLOT(forward())); connect(_forwardConfirm, SIGNAL(cancelled()), this, SLOT(onForwardCancel())); App::wnd()->showLayer(_forwardConfirm, true); @@ -2922,8 +2927,8 @@ void MainWidget::onTopBarClick() { } } -void MainWidget::onPeerShown(PeerData *peer) { - if ((cWideMode() || !selectingPeer()) && (profile || overview || (peer && peer->id))) { +void MainWidget::onHistoryShown(History *history, MsgId atMsgId) { + if ((cWideMode() || !selectingPeer()) && (profile || overview || history)) { _topBar.show(); } else { _topBar.hide(); @@ -2932,6 +2937,7 @@ void MainWidget::onPeerShown(PeerData *peer) { if (animating()) { _topBar.hide(); } + dlgUpdated(history, atMsgId); } void MainWidget::searchInPeer(PeerData *peer) { @@ -3609,7 +3615,7 @@ bool MainWidget::usernameResolveFail(QString name, const RPCError &error) { if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; if (error.code() == 400) { - App::wnd()->showLayer(new ConfirmBox(lng_username_not_found(lt_user, name), true)); + App::wnd()->showLayer(new InformBox(lng_username_not_found(lt_user, name))); } return true; } @@ -3646,7 +3652,7 @@ bool MainWidget::inviteCheckFail(const RPCError &error) { if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; if (error.code() == 400) { - App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_bad_link), true)); + App::wnd()->showLayer(new InformBox(lang(lng_group_invite_bad_link))); } return true; } @@ -3684,7 +3690,7 @@ bool MainWidget::inviteImportFail(const RPCError &error) { if (error.type().startsWith(qsl("FLOOD_WAIT_"))) return false; if (error.code() == 400) { - App::wnd()->showLayer(new ConfirmBox(lang(error.type() == qsl("USERS_TOO_MUCH") ? lng_group_invite_no_room : lng_group_invite_bad_link), true), App::wnd()->layerShown()); + App::wnd()->showLayer(new InformBox(lang(error.type() == qsl("USERS_TOO_MUCH") ? lng_group_invite_no_room : lng_group_invite_bad_link))); } return true; } @@ -4106,7 +4112,7 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { bool noFrom = !App::userLoaded(d.vfrom_id.v); if (!App::chatLoaded(d.vchat_id.v) || noFrom || (d.has_fwd_from_id() && !App::peerLoaded(peerFromMTP(d.vfwd_from_id)))) { MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); - if (noFrom) App::api()->requestFullPeer(App::chatLoaded(d.vchat_id.v)); + if (noFrom && App::api()) App::api()->requestFullPeer(App::chatLoaded(d.vchat_id.v)); return getDifference(); } @@ -4281,7 +4287,14 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { // update before applying skipped PeerId id = peerFromMTP(d.vpeer); App::feedOutboxRead(id, d.vmax_id.v); - if (history.peer() && history.peer()->id == id) history.update(); + if (history.peer() && history.peer()->id == id) { + history.update(); + } + if (History *h = App::historyLoaded(id)) { + if (h->lastMsg->out() && h->lastMsg->id <= d.vmax_id.v) { + dlgUpdated(h, h->lastMsg->id); + } + } ptsApplySkippedUpdates(); } break; @@ -4494,7 +4507,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { case mtpc_updateServiceNotification: { const MTPDupdateServiceNotification &d(update.c_updateServiceNotification()); if (d.vpopup.v) { - App::wnd()->showLayer(new ConfirmBox(qs(d.vmessage), true)); + App::wnd()->showLayer(new InformBox(qs(d.vmessage))); App::wnd()->serviceNotification(qs(d.vmessage), d.vmedia); } else { App::wnd()->serviceNotification(qs(d.vmessage), d.vmedia); @@ -4514,7 +4527,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { deleteConversation(channel, false); } else if (!channel->amCreator() && App::history(channel->id)) { // create history _updatedChannels.insert(channel, true); - App::api()->requestSelfParticipant(channel); + if (App::api()) App::api()->requestSelfParticipant(channel); } } } break; diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index b9a44d4ec0..d43bcaaea1 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -219,7 +222,7 @@ public: void createDialog(History *history); void dlgUpdated(DialogRow *row); - void dlgUpdated(History *row); + void dlgUpdated(History *row, MsgId msgId); void windowShown(); @@ -443,7 +446,7 @@ public slots: void showPeerHistory(quint64 peer, qint32 msgId, bool back = false); void onTopBarClick(); - void onPeerShown(PeerData *peer); + void onHistoryShown(History *history, MsgId atMsgId); void searchInPeer(PeerData *peer); diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 087f8c1e2e..3441b1eb8a 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" @@ -229,11 +232,11 @@ void MediaView::updateDocSize() { } else { _docSize = formatSizeText(_doc->size); } - _docSizeWidth = st::mvFont->m.width(_docSize); + _docSizeWidth = st::mvFont->width(_docSize); int32 maxw = st::mvDocSize.width() - st::mvDocBlue.pxWidth() - st::mvDocPadding * 3; if (_docSizeWidth > maxw) { - _docSize = st::mvFont->m.elidedText(_docSize, Qt::ElideRight, maxw); - _docSizeWidth = st::mvFont->m.width(_docSize); + _docSize = st::mvFont->elided(_docSize, maxw); + _docSizeWidth = st::mvFont->width(_docSize); } } @@ -292,10 +295,10 @@ void MediaView::updateControls() { if (_from) { _fromName.setText(st::mvFont, _from->name); _nameNav = myrtlrect(st::mvTextLeft, height() - st::mvTextTop, qMin(_fromName.maxWidth(), width() / 3), st::mvFont->height); - _dateNav = myrtlrect(st::mvTextLeft + _nameNav.width() + st::mvTextSkip, height() - st::mvTextTop, st::mvFont->m.width(_dateText), st::mvFont->height); + _dateNav = myrtlrect(st::mvTextLeft + _nameNav.width() + st::mvTextSkip, height() - st::mvTextTop, st::mvFont->width(_dateText), st::mvFont->height); } else { _nameNav = QRect(); - _dateNav = myrtlrect(st::mvTextLeft, height() - st::mvTextTop, st::mvFont->m.width(_dateText), st::mvFont->height); + _dateNav = myrtlrect(st::mvTextLeft, height() - st::mvTextTop, st::mvFont->width(_dateText), st::mvFont->height); } updateHeader(); if (_photo || (_history && _overview == OverviewPhotos)) { @@ -912,18 +915,18 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty _docName = (!_doc || _doc->name.isEmpty()) ? lang(_doc ? (_doc->type == StickerDocument ? lng_in_dlg_sticker : lng_mediaview_doc_image) : lng_message_empty) : _doc->name; int32 lastDot = _docName.lastIndexOf('.'); _docExt = _doc ? ((lastDot < 0 || lastDot + 2 > _docName.size()) ? _docName : _docName.mid(lastDot + 1)) : QString(); - _docNameWidth = st::mvDocNameFont->m.width(_docName); + _docNameWidth = st::mvDocNameFont->width(_docName); if (_docNameWidth > maxw) { - _docName = st::mvDocNameFont->m.elidedText(_docName, Qt::ElideMiddle, maxw); - _docNameWidth = st::mvDocNameFont->m.width(_docName); + _docName = st::mvDocNameFont->elided(_docName, maxw, Qt::ElideMiddle); + _docNameWidth = st::mvDocNameFont->width(_docName); } int32 extmaxw = (st::mvDocBlue.pxWidth() - st::mvDocExtPadding * 2); - _docExtWidth = st::mvDocExtFont->m.width(_docExt); + _docExtWidth = st::mvDocExtFont->width(_docExt); if (_docExtWidth > extmaxw) { - _docExt = st::mvDocNameFont->m.elidedText(_docExt, Qt::ElideMiddle, extmaxw); - _docExtWidth = st::mvDocNameFont->m.width(_docExt); + _docExt = st::mvDocNameFont->elided(_docExt, extmaxw, Qt::ElideMiddle); + _docExtWidth = st::mvDocNameFont->width(_docExt); } _docRadialFirst = _docRadialLast = _docRadialStart = 0; @@ -1953,75 +1956,13 @@ void MediaView::updateHeader() { } } _headerHasLink = (_overview != OverviewCount) && _history; - int32 hwidth = st::mvThickFont->m.width(_headerText); + int32 hwidth = st::mvThickFont->width(_headerText); if (hwidth > width() / 3) { hwidth = width() / 3; - _headerText = st::mvThickFont->m.elidedText(_headerText, Qt::ElideMiddle, hwidth); + _headerText = st::mvThickFont->elided(_headerText, hwidth, Qt::ElideMiddle); } _headerNav = myrtlrect(st::mvTextLeft, height() - st::mvHeaderTop, hwidth, st::mvThickFont->height); } -// -//void MediaView::updatePolaroid() { -// if (_doc) { -// _polaroidIn = _polaroidOut = QRect(0, 0, _avail.width(), _avail.height() - st::medviewBottomBar); -// int32 minus1 = width() - _delete.x(), minus2 = _overview.x() + st::medviewHeaderFont->m.width(_header) - st::medviewOverview.width; -// if (minus2 > minus1) minus1 = minus2; -// -// int32 dateWidth = st::medviewDateFont->m.width(_dateText), maxWidth = width() - 2 * minus1; -// if (_from) { -// int32 nameWidth = _fromName.maxWidth(); -// if (maxWidth < dateWidth) { -// maxWidth = dateWidth; -// } -// if (nameWidth > maxWidth) { -// nameWidth = maxWidth; -// } -// _nameNav = QRect((_avail.width() - nameWidth) / 2, _avail.y() + _avail.height() - ((st::medviewPolaroid.bottom() + st::medviewBottomBar) / 2) + st::medviewNameTop, nameWidth, st::medviewNameFont->height); -// _dateNav = QRect((_avail.width() - dateWidth) / 2, _avail.y() + _avail.height() - ((st::medviewPolaroid.bottom() + st::medviewBottomBar) / 2) + st::medviewDateTop, dateWidth, st::medviewDateFont->height); -// } else { -// _nameNav = QRect(_avail.x() - 1, _avail.y() - 1, 0, 0); -// _dateNav = QRect((_avail.width() - dateWidth) / 2, _avail.y() + _avail.height() - ((st::medviewPolaroid.bottom() + st::medviewBottomBar) / 2) + ((st::medviewNameTop + st::medviewDateTop) / 2), dateWidth, st::medviewDateFont->height); -// } -// } else { -// int32 pminw = qMin(st::medviewPolaroidMin.width(), int(_avail.width() - 2 * st::medviewNavBarWidth)); -// -// int32 pl = _x - st::medviewPolaroid.left(), plw = st::medviewPolaroid.left(); -// if (pl < st::medviewNavBarWidth) pl = st::medviewNavBarWidth; -// int32 pr = _x + _w + st::medviewPolaroid.right(), prw = st::medviewPolaroid.right(); -// if (pr > _avail.width() - st::medviewNavBarWidth) pr = _avail.width() - st::medviewNavBarWidth; -// -// if (_w + st::medviewPolaroid.left() + st::medviewPolaroid.right() < pminw) { -// pl = (_avail.width() - pminw) / 2; -// plw = _x - pl; -// pr = pl + pminw; -// prw = pr - (_x + _w); -// } -// -// int32 pminh = qMin(st::medviewPolaroidMin.height(), int(_avail.height() - st::medviewBottomBar)); -// -// int32 pt = _y - st::medviewPolaroid.top(), pth = st::medviewPolaroid.top(); -// if (pt < 0) pt = 0; -// int32 pb = _y + _h + st::medviewPolaroid.bottom(), pbh = st::medviewPolaroid.bottom(); -// if (pb > _avail.height() - st::medviewBottomBar) pb = _avail.height() - st::medviewBottomBar; -// -// if (_h + st::medviewPolaroid.top() + st::medviewPolaroid.bottom() < pminh) { -// pt = (_avail.height() - st::medviewBottomBar - pminh) / 2; -// pth = _y - pt; -// pb = pt + pminh; -// pbh = pb - (_y + _h); -// } -// -// _polaroidOut = QRect(pl, pt, pr - pl, pb - pt); -// _polaroidIn = QRect(pl + plw, pt + pth, pr - pl - prw - plw, pb - pt - pbh - pth); -// -// int32 nameWidth = _fromName.maxWidth(), maxWidth = _polaroidOut.width() - st::medviewPolaroid.left() - st::medviewPolaroid.right(), dateWidth = st::medviewDateFont->m.width(_dateText); -// if (nameWidth > maxWidth) { -// nameWidth = maxWidth; -// } -// _nameNav = QRect(_polaroidIn.x() + ((_polaroidIn.width() - nameWidth) / 2), _polaroidOut.y() + _polaroidOut.height() - st::medviewPolaroid.bottom() + st::medviewNameTop, nameWidth, st::medviewNameFont->height); -// _dateNav = QRect(_polaroidIn.x() + ((_polaroidIn.width() - dateWidth) / 2), _polaroidOut.y() + _polaroidOut.height() - st::medviewPolaroid.bottom() + st::medviewDateTop, dateWidth, st::medviewDateFont->height); -// } -//} QColor MediaView::overColor(const QColor &a, float64 ca, const QColor &b, float64 cb) { QColor res; diff --git a/Telegram/SourceFiles/mediaview.h b/Telegram/SourceFiles/mediaview.h index 8bdfe54deb..eed80e15b5 100644 --- a/Telegram/SourceFiles/mediaview.h +++ b/Telegram/SourceFiles/mediaview.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/generate.py b/Telegram/SourceFiles/mtproto/generate.py index 2cf1f3b322..8997a4812f 100644 --- a/Telegram/SourceFiles/mtproto/generate.py +++ b/Telegram/SourceFiles/mtproto/generate.py @@ -12,6 +12,9 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 Copyright (c) 2014 John Preston, https://desktop.telegram.org ''' @@ -54,6 +57,9 @@ out.write('but WITHOUT ANY WARRANTY; without even the implied warranty of\n'); out.write('MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n'); out.write('GNU General Public License for more details.\n'); out.write('\n'); +out.write('In addition, as a special exception, the copyright holders give permission\n'); +out.write('to link the code of portions of this program with the OpenSSL library.\n'); +out.write('\n'); out.write('Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n'); out.write('Copyright (c) 2014 John Preston, https://desktop.telegram.org\n'); out.write('*/\n'); @@ -728,36 +734,29 @@ textSerializeFull += '\ttypes.reserve(20); vtypes.reserve(20); stages.reserve(20 textSerializeFull += '\ttypes.push_back(mtpTypeId(cons)); vtypes.push_back(mtpTypeId(vcons)); stages.push_back(0); flags.push_back(0);\n\n'; textSerializeFull += '\tconst mtpPrime *start = from;\n'; textSerializeFull += '\tmtpTypeId type = cons, vtype = vcons;\n'; -textSerializeFull += '\tint32 stage = 0, flag = 0;\n'; -textSerializeFull += '\ttry {\n'; -textSerializeFull += '\t\twhile (!types.isEmpty()) {\n'; -textSerializeFull += '\t\t\ttype = types.back();\n'; -textSerializeFull += '\t\t\tvtype = vtypes.back();\n'; -textSerializeFull += '\t\t\tstage = stages.back();\n'; -textSerializeFull += '\t\t\tflag = flags.back();\n'; -textSerializeFull += '\t\t\tif (!type) {\n'; -textSerializeFull += '\t\t\t\tif (from >= end) {\n'; -textSerializeFull += '\t\t\t\t\tthrow Exception("from >= end");\n'; -textSerializeFull += '\t\t\t\t} else if (stage) {\n'; -textSerializeFull += '\t\t\t\t\tthrow Exception("unknown type on stage > 0");\n'; -textSerializeFull += '\t\t\t\t}\n'; -textSerializeFull += '\t\t\t\ttypes.back() = type = *from;\n'; -textSerializeFull += '\t\t\t\tstart = ++from;\n'; -textSerializeFull += '\t\t\t}\n\n'; -textSerializeFull += '\t\t\tint32 lev = level + types.size() - 1;\n'; -textSerializeFull += '\t\t\tTextSerializers::const_iterator it = _serializers.constFind(type);\n'; -textSerializeFull += '\t\t\tif (it != _serializers.cend()) {\n'; -textSerializeFull += '\t\t\t\t(*it.value())(to, stage, lev, types, vtypes, stages, flags, start, end, flag);\n'; -textSerializeFull += '\t\t\t} else {\n'; -textSerializeFull += '\t\t\t\tmtpTextSerializeCore(to, from, end, type, lev, vtype);\n'; -textSerializeFull += '\t\t\t\ttypes.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();\n'; -textSerializeFull += '\t\t\t\t}\n'; +textSerializeFull += '\tint32 stage = 0, flag = 0;\n\n'; +textSerializeFull += '\twhile (!types.isEmpty()) {\n'; +textSerializeFull += '\t\ttype = types.back();\n'; +textSerializeFull += '\t\tvtype = vtypes.back();\n'; +textSerializeFull += '\t\tstage = stages.back();\n'; +textSerializeFull += '\t\tflag = flags.back();\n'; +textSerializeFull += '\t\tif (!type) {\n'; +textSerializeFull += '\t\t\tif (from >= end) {\n'; +textSerializeFull += '\t\t\t\tthrow Exception("from >= end");\n'; +textSerializeFull += '\t\t\t} else if (stage) {\n'; +textSerializeFull += '\t\t\t\tthrow Exception("unknown type on stage > 0");\n'; +textSerializeFull += '\t\t\t}\n'; +textSerializeFull += '\t\t\ttypes.back() = type = *from;\n'; +textSerializeFull += '\t\t\tstart = ++from;\n'; +textSerializeFull += '\t\t}\n\n'; +textSerializeFull += '\t\tint32 lev = level + types.size() - 1;\n'; +textSerializeFull += '\t\tTextSerializers::const_iterator it = _serializers.constFind(type);\n'; +textSerializeFull += '\t\tif (it != _serializers.cend()) {\n'; +textSerializeFull += '\t\t\t(*it.value())(to, stage, lev, types, vtypes, stages, flags, start, end, flag);\n'; +textSerializeFull += '\t\t} else {\n'; +textSerializeFull += '\t\t\tmtpTextSerializeCore(to, from, end, type, lev, vtype);\n'; +textSerializeFull += '\t\t\ttypes.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();\n'; textSerializeFull += '\t\t}\n'; -textSerializeFull += '\t} catch (Exception &e) {\n'; -textSerializeFull += '\t\tto.add("[ERROR] ");\n'; -textSerializeFull += '\t\tto.add("(").add(e.what()).add("), cons: 0x").add(mtpWrapNumber(type, 16));\n'; -textSerializeFull += '\t\tif (vtype) to.add(", vcons: 0x").add(mtpWrapNumber(vtype));\n'; -textSerializeFull += '\t\tto.add(", ").add(mb(start, (end - start) * sizeof(mtpPrime)).str());\n'; textSerializeFull += '\t}\n'; textSerializeFull += '}\n'; diff --git a/Telegram/SourceFiles/mtproto/mtp.cpp b/Telegram/SourceFiles/mtproto/mtp.cpp index ac558f308f..b13f61f0e9 100644 --- a/Telegram/SourceFiles/mtproto/mtp.cpp +++ b/Telegram/SourceFiles/mtproto/mtp.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "mtp.h" diff --git a/Telegram/SourceFiles/mtproto/mtp.h b/Telegram/SourceFiles/mtproto/mtp.h index bb93446573..3cde3f3931 100644 --- a/Telegram/SourceFiles/mtproto/mtp.h +++ b/Telegram/SourceFiles/mtproto/mtp.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpAuthKey.h b/Telegram/SourceFiles/mtproto/mtpAuthKey.h index e9431935f4..372f1b3e97 100644 --- a/Telegram/SourceFiles/mtproto/mtpAuthKey.h +++ b/Telegram/SourceFiles/mtproto/mtpAuthKey.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/mtpConnection.cpp index 2e4a771144..939c2f8e2d 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp +++ b/Telegram/SourceFiles/mtproto/mtpConnection.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.h b/Telegram/SourceFiles/mtproto/mtpConnection.h index b0630e2f3a..6ccbe46da7 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.h +++ b/Telegram/SourceFiles/mtproto/mtpConnection.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp b/Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp index 90e535c5c4..fec958aad2 100644 --- a/Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp +++ b/Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "mtpCoreTypes.h" diff --git a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h b/Telegram/SourceFiles/mtproto/mtpCoreTypes.h index 71f87f590b..459c989220 100644 --- a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h +++ b/Telegram/SourceFiles/mtproto/mtpCoreTypes.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -206,7 +209,7 @@ typedef QMap mtpResponseMap; class mtpErrorUnexpected : public Exception { public: - mtpErrorUnexpected(mtpTypeId typeId, const QString &type) : Exception(QString("MTP Unexpected type id %1 read in %2").arg(typeId).arg(type), false) { // maybe api changed?.. + mtpErrorUnexpected(mtpTypeId typeId, const QString &type) : Exception(QString("MTP Unexpected type id #%1 read in %2").arg(uint32(typeId), 0, 16).arg(type), false) { // maybe api changed?.. } }; @@ -1005,7 +1008,11 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP inline QString mtpTextSerialize(const mtpPrime *&from, const mtpPrime *end) { MTPStringLogger to; - mtpTextSerializeType(to, from, end, mtpc_core_message); + try { + mtpTextSerializeType(to, from, end, mtpc_core_message); + } catch (Exception &e) { + to.add("[ERROR] (").add(e.what()).add(")"); + } return QString::fromUtf8(to.p, to.size); } diff --git a/Telegram/SourceFiles/mtproto/mtpDC.cpp b/Telegram/SourceFiles/mtproto/mtpDC.cpp index d3d77695ac..326cc20fc5 100644 --- a/Telegram/SourceFiles/mtproto/mtpDC.cpp +++ b/Telegram/SourceFiles/mtproto/mtpDC.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "mtpDC.h" diff --git a/Telegram/SourceFiles/mtproto/mtpDC.h b/Telegram/SourceFiles/mtproto/mtpDC.h index 403dc8615a..1ed240ff8c 100644 --- a/Telegram/SourceFiles/mtproto/mtpDC.h +++ b/Telegram/SourceFiles/mtproto/mtpDC.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp b/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp index 22929f3fee..4d2a5aafd1 100644 --- a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp +++ b/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "mainwidget.h" diff --git a/Telegram/SourceFiles/mtproto/mtpFileLoader.h b/Telegram/SourceFiles/mtproto/mtpFileLoader.h index d0ec0aa0bf..4cbed0a84e 100644 --- a/Telegram/SourceFiles/mtproto/mtpFileLoader.h +++ b/Telegram/SourceFiles/mtproto/mtpFileLoader.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpPublicRSA.h b/Telegram/SourceFiles/mtproto/mtpPublicRSA.h index 0383c87077..fd8b39f113 100644 --- a/Telegram/SourceFiles/mtproto/mtpPublicRSA.h +++ b/Telegram/SourceFiles/mtproto/mtpPublicRSA.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpRPC.cpp b/Telegram/SourceFiles/mtproto/mtpRPC.cpp index c92d21c22f..2f8daa3b41 100644 --- a/Telegram/SourceFiles/mtproto/mtpRPC.cpp +++ b/Telegram/SourceFiles/mtproto/mtpRPC.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "mtproto/mtpRPC.h" diff --git a/Telegram/SourceFiles/mtproto/mtpRPC.h b/Telegram/SourceFiles/mtproto/mtpRPC.h index e214ff51a0..1093b04b39 100644 --- a/Telegram/SourceFiles/mtproto/mtpRPC.h +++ b/Telegram/SourceFiles/mtproto/mtpRPC.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.cpp b/Telegram/SourceFiles/mtproto/mtpScheme.cpp index eaad1d8a79..457d33d35a 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.cpp +++ b/Telegram/SourceFiles/mtproto/mtpScheme.cpp @@ -17,7 +17,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 "mtpScheme.h" @@ -7467,36 +7467,30 @@ void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpP const mtpPrime *start = from; mtpTypeId type = cons, vtype = vcons; int32 stage = 0, flag = 0; - try { - while (!types.isEmpty()) { - type = types.back(); - vtype = vtypes.back(); - stage = stages.back(); - flag = flags.back(); - if (!type) { - if (from >= end) { - throw Exception("from >= end"); - } else if (stage) { - throw Exception("unknown type on stage > 0"); - } - types.back() = type = *from; - start = ++from; - } - int32 lev = level + types.size() - 1; - TextSerializers::const_iterator it = _serializers.constFind(type); - if (it != _serializers.cend()) { - (*it.value())(to, stage, lev, types, vtypes, stages, flags, start, end, flag); - } else { - mtpTextSerializeCore(to, from, end, type, lev, vtype); - types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); - } + while (!types.isEmpty()) { + type = types.back(); + vtype = vtypes.back(); + stage = stages.back(); + flag = flags.back(); + if (!type) { + if (from >= end) { + throw Exception("from >= end"); + } else if (stage) { + throw Exception("unknown type on stage > 0"); + } + types.back() = type = *from; + start = ++from; + } + + int32 lev = level + types.size() - 1; + TextSerializers::const_iterator it = _serializers.constFind(type); + if (it != _serializers.cend()) { + (*it.value())(to, stage, lev, types, vtypes, stages, flags, start, end, flag); + } else { + mtpTextSerializeCore(to, from, end, type, lev, vtype); + types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } - } catch (Exception &e) { - to.add("[ERROR] "); - to.add("(").add(e.what()).add("), cons: 0x").add(mtpWrapNumber(type, 16)); - if (vtype) to.add(", vcons: 0x").add(mtpWrapNumber(vtype)); - to.add(", ").add(mb(start, (end - start) * sizeof(mtpPrime)).str()); } } diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.h b/Telegram/SourceFiles/mtproto/mtpScheme.h index b6a10aaf34..f4c2cea4b5 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.h +++ b/Telegram/SourceFiles/mtproto/mtpScheme.h @@ -16,8 +16,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpSession.cpp b/Telegram/SourceFiles/mtproto/mtpSession.cpp index 89c3fa6237..d6dd6c1119 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.cpp +++ b/Telegram/SourceFiles/mtproto/mtpSession.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include diff --git a/Telegram/SourceFiles/mtproto/mtpSession.h b/Telegram/SourceFiles/mtproto/mtpSession.h index 3743f247df..95085fdceb 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.h +++ b/Telegram/SourceFiles/mtproto/mtpSession.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/mtproto/mtpSessionImpl.h b/Telegram/SourceFiles/mtproto/mtpSessionImpl.h index 033cab32d4..b2772c43c8 100644 --- a/Telegram/SourceFiles/mtproto/mtpSessionImpl.h +++ b/Telegram/SourceFiles/mtproto/mtpSessionImpl.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/numbers.h b/Telegram/SourceFiles/numbers.h index 02424f9e7c..c9b734ca56 100644 --- a/Telegram/SourceFiles/numbers.h +++ b/Telegram/SourceFiles/numbers.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 2525ae8d33..8838d6a830 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" @@ -116,7 +119,7 @@ OverviewInner::CachedLink::CachedLink(HistoryItem *item) : titleWidth(0), page(0 } } } - titleWidth = st::webPageTitleFont->m.width(title); + titleWidth = st::webPageTitleFont->width(title); } int32 OverviewInner::CachedLink::countHeight(int32 w) { @@ -1187,7 +1190,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) { p.setPen(st::black->p); p.setFont(st::webPageTitleFont->f); if (!lnk->title.isEmpty()) { - p.drawText(left, top + st::webPageTitleFont->ascent, (_linksWidth - left < lnk->titleWidth) ? st::webPageTitleFont->m.elidedText(lnk->title, Qt::ElideRight, _linksWidth - left) : lnk->title); + p.drawText(left, top + st::webPageTitleFont->ascent, (_linksWidth - left < lnk->titleWidth) ? st::webPageTitleFont->elided(lnk->title, _linksWidth - left) : lnk->title); top += st::webPageTitleFont->height; } p.setFont(st::msgFont->f); @@ -1200,7 +1203,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) { for (int32 j = 0, c = lnk->urls.size(); j < c; ++j) { bool sel = (_mousedItem == _items[i].msgid && j + 1 == _lnkOverIndex); if (sel) p.setFont(st::msgFont->underline()->f); - p.drawText(left, top + st::msgFont->ascent, (_linksWidth - left < lnk->urls[j].width) ? st::msgFont->m.elidedText(lnk->urls[j].text, Qt::ElideRight, _linksWidth - left) : lnk->urls[j].text); + p.drawText(left, top + st::msgFont->ascent, (_linksWidth - left < lnk->urls[j].width) ? st::msgFont->elided(lnk->urls[j].text, _linksWidth - left) : lnk->urls[j].text); if (sel) p.setFont(st::msgFont->f); top += st::msgFont->height; } @@ -1257,7 +1260,7 @@ void OverviewInner::paintEvent(QPaintEvent *e) { int32 left = st::msgServiceMargin.left(), width = _width - st::msgServiceMargin.left() - st::msgServiceMargin.left(), height = st::msgServiceFont->height + st::msgServicePadding.top() + st::msgServicePadding.bottom(); if (width < 1) return; - int32 strwidth = st::msgServiceFont->m.width(str) + st::msgServicePadding.left() + st::msgServicePadding.right(); + int32 strwidth = st::msgServiceFont->width(str) + st::msgServicePadding.left() + st::msgServicePadding.right(); QRect trect(QRect(left, st::msgServiceMargin.top(), width, height).marginsAdded(-st::msgServicePadding)); left += (width - strwidth) / 2; diff --git a/Telegram/SourceFiles/overviewwidget.h b/Telegram/SourceFiles/overviewwidget.h index 7a7926e9d3..02baada875 100644 --- a/Telegram/SourceFiles/overviewwidget.h +++ b/Telegram/SourceFiles/overviewwidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once @@ -154,7 +157,7 @@ private: struct Link { Link() : width(0) { } - Link(const QString &url, const QString &text) : url(url), text(text), width(st::msgFont->m.width(text)) { + Link(const QString &url, const QString &text) : url(url), text(text), width(st::msgFont->width(text)) { } QString url, text; int32 width; diff --git a/Telegram/SourceFiles/passcodewidget.cpp b/Telegram/SourceFiles/passcodewidget.cpp index 0c4bbd6294..00c1509cdf 100644 --- a/Telegram/SourceFiles/passcodewidget.cpp +++ b/Telegram/SourceFiles/passcodewidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/passcodewidget.h b/Telegram/SourceFiles/passcodewidget.h index 3dd795c2da..1b195939d2 100644 --- a/Telegram/SourceFiles/passcodewidget.h +++ b/Telegram/SourceFiles/passcodewidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/playerwidget.cpp b/Telegram/SourceFiles/playerwidget.cpp index 273e444546..472c1759c3 100644 --- a/Telegram/SourceFiles/playerwidget.cpp +++ b/Telegram/SourceFiles/playerwidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -201,7 +204,7 @@ void PlayerWidget::updateDownTime() { QString time = formatDurationText(qRound(_downDuration * _downProgress) / _downFrequency); if (time != _time) { _time = time; - _timeWidth = st::linkFont->m.width(_time); + _timeWidth = st::linkFont->width(_time); rtlupdate(_infoRect); } } @@ -583,7 +586,7 @@ void PlayerWidget::updateState(SongMsgId playing, AudioPlayerState playingState, if (time != _time || showPause != _showPause) { if (_time != time) { _time = time; - _timeWidth = st::linkFont->m.width(_time); + _timeWidth = st::linkFont->width(_time); } _showPause = showPause; if (duration != _duration || position != _position || loaded != _loaded) { diff --git a/Telegram/SourceFiles/playerwidget.h b/Telegram/SourceFiles/playerwidget.h index 9c07f01612..5fee6f57af 100644 --- a/Telegram/SourceFiles/playerwidget.h +++ b/Telegram/SourceFiles/playerwidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index 5970be2a0a..9b3797f13c 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" @@ -75,7 +78,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee // participants _pHeight(st::profileListPhotoSize + st::profileListPadding.height() * 2), - _kickWidth(st::linkFont->m.width(lang(lng_profile_kick))), + _kickWidth(st::linkFont->width(lang(lng_profile_kick))), _selectedRow(-1), _lastPreload(0), _contactId(0), _kickOver(0), _kickDown(0), _kickConfirm(0), @@ -93,7 +96,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee _photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer)); } if ((_peerUser->botInfo && !_peerUser->botInfo->inited) || (_peerUser->photoId == UnknownPeerPhotoId) || (_peerUser->photoId && !userPhoto->date) || (_peerUser->blocked == UserBlockUnknown)) { - App::api()->requestFullPeer(_peer); + if (App::api()) App::api()->requestFullPeer(_peer); } } else if (_peerChat) { PhotoData *chatPhoto = (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) ? App::photo(_peerChat->photoId) : 0; @@ -101,7 +104,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee _photoLink = TextLinkPtr(new PhotoLink(chatPhoto, _peer)); } if (_peerChat->photoId == UnknownPeerPhotoId) { - App::api()->requestFullPeer(_peer); + if (App::api()) App::api()->requestFullPeer(_peer); } } else if (_peerChannel) { PhotoData *chatPhoto = (_peerChannel->photoId && _peerChannel->photoId != UnknownPeerPhotoId) ? App::photo(_peerChannel->photoId) : 0; @@ -276,7 +279,7 @@ void ProfileInner::onUpdatePhoto() { void ProfileInner::onClearHistory() { if (_peerChannel) return; - ConfirmBox *box = new ConfirmBox(_peer->isUser() ? lng_sure_delete_history(lt_contact, _peer->name) : lng_sure_delete_group_history(lt_group, _peer->name)); + ConfirmBox *box = new ConfirmBox(_peer->isUser() ? lng_sure_delete_history(lt_contact, _peer->name) : lng_sure_delete_group_history(lt_group, _peer->name), lang(lng_box_delete), st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onClearHistorySure())); App::wnd()->showLayer(box); } @@ -287,7 +290,7 @@ void ProfileInner::onClearHistorySure() { } void ProfileInner::onDeleteConversation() { - ConfirmBox *box = new ConfirmBox(_peer->isUser() ? lng_sure_delete_history(lt_contact, _peer->name) : (_peer->isChat() ? lng_sure_delete_and_exit(lt_group, _peer->name) : lang(lng_sure_leave_channel))); + ConfirmBox *box = new ConfirmBox(_peer->isUser() ? lng_sure_delete_history(lt_contact, _peer->name) : (_peer->isChat() ? lng_sure_delete_and_exit(lt_group, _peer->name) : lang(lng_sure_leave_channel)), lang(_peer->isUser() ? lng_box_delete : lng_box_leave), _peer->isChannel() ? st::defaultBoxButton : st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteConversationSure())); App::wnd()->showLayer(box); } @@ -308,7 +311,7 @@ void ProfileInner::onDeleteConversationSure() { void ProfileInner::onDeleteChannel() { if (!_peerChannel) return; - ConfirmBox *box = new ConfirmBox(lang(lng_sure_delete_channel), lang(lng_selected_delete_confirm), QString(), st::btnRedDone); + ConfirmBox *box = new ConfirmBox(lang(lng_sure_delete_channel), lang(lng_box_delete), st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onDeleteChannelSure())); App::wnd()->showLayer(box); } @@ -398,7 +401,7 @@ void ProfileInner::onInvitationLink() { if (!_peerChat && !_peerChannel) return; QApplication::clipboard()->setText(_peerChat ? _peerChat->invitationUrl : (_peerChannel ? _peerChannel->invitationUrl : QString())); - App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_copied), true)); + App::wnd()->showLayer(new InformBox(lang(lng_group_invite_copied))); } void ProfileInner::onPublicLink() { @@ -406,7 +409,7 @@ void ProfileInner::onPublicLink() { if (_peerChannel->isPublic()) { QApplication::clipboard()->setText(qsl("https://telegram.me/") + _peerChannel->username); - App::wnd()->showLayer(new ConfirmBox(lang(lng_channel_public_link_copied), true)); + App::wnd()->showLayer(new InformBox(lang(lng_channel_public_link_copied))); } else { App::wnd()->showLayer(new SetupChannelBox(_peerChannel, true)); } @@ -607,7 +610,7 @@ void ProfileInner::reorderParticipants() { } } if (_peerChat->count > 0 && _participants.isEmpty()) { - App::api()->requestFullPeer(_peer); + if (App::api()) App::api()->requestFullPeer(_peer); if (_onlineText.isEmpty()) _onlineText = lng_chat_status_members(lt_count, _peerChat->count); } else if (onlineCount && !onlyMe) { _onlineText = lng_chat_status_members_online(lt_count, _participants.size(), lt_count_online, onlineCount); @@ -716,7 +719,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) { top += st::profileButtonTop; if (_peerChat && _peerChat->isForbidden) { - int32 w = st::btnShareContact.font->m.width(lang(lng_profile_chat_unaccessible)); + int32 w = st::btnShareContact.font->width(lang(lng_profile_chat_unaccessible)); p.setFont(st::btnShareContact.font->f); p.setPen(st::profileOfflineColor->p); p.drawText(_left + (_width - w) / 2, top + st::btnShareContact.textTop + st::btnShareContact.font->ascent, lang(lng_profile_chat_unaccessible)); @@ -952,7 +955,7 @@ void ProfileInner::mouseReleaseEvent(QMouseEvent *e) { updateSelected(); if (_kickDown && _kickDown == _kickOver) { _kickConfirm = _kickOver; - ConfirmBox *box = new ConfirmBox(lng_profile_sure_kick(lt_user, _kickOver->firstName)); + ConfirmBox *box = new ConfirmBox(lng_profile_sure_kick(lt_user, _kickOver->firstName), lang(lng_box_remove)); connect(box, SIGNAL(confirmed()), this, SLOT(onKickConfirm())); App::wnd()->showLayer(box); } @@ -1142,10 +1145,10 @@ void ProfileInner::resizeEvent(QResizeEvent *e) { top += st::profileHeaderSkip; // invite link stuff - int32 _inviteLinkTextWidth(st::linkFont->m.width(lang(lng_group_invite_link)) + st::linkFont->spacew); + int32 _inviteLinkTextWidth(st::linkFont->width(lang(lng_group_invite_link)) + st::linkFont->spacew); if (_amCreator && (!_peerChannel || !_peerChannel->isPublic())) { if (!_invitationText.isEmpty()) { - _invitationLink.setText(st::linkFont->m.elidedText(_invitationText, Qt::ElideRight, _width - _inviteLinkTextWidth)); + _invitationLink.setText(st::linkFont->elided(_invitationText, _width - _inviteLinkTextWidth)); } if ((_peerChat && !_peerChat->invitationUrl.isEmpty()) || (_peerChannel && !_peerChannel->invitationUrl.isEmpty())) { _invitationLink.move(_left + _inviteLinkTextWidth, top); diff --git a/Telegram/SourceFiles/profilewidget.h b/Telegram/SourceFiles/profilewidget.h index 667604e3db..691aaf18a2 100644 --- a/Telegram/SourceFiles/profilewidget.h +++ b/Telegram/SourceFiles/profilewidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/pspecific.h b/Telegram/SourceFiles/pspecific.h index d23762fd47..47927ca8e5 100644 --- a/Telegram/SourceFiles/pspecific.h +++ b/Telegram/SourceFiles/pspecific.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index 68f613bdd6..adec4309ad 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 "pspecific.h" diff --git a/Telegram/SourceFiles/pspecific_linux.h b/Telegram/SourceFiles/pspecific_linux.h index 52e0711023..35885c475c 100644 --- a/Telegram/SourceFiles/pspecific_linux.h +++ b/Telegram/SourceFiles/pspecific_linux.h @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index 0c7a40eb47..2050cd58c1 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 "pspecific.h" @@ -157,7 +157,7 @@ void _placeCounter(QImage &img, int size, int count, style::color bg, style::col fontSize = 16; } style::font f(fontSize); - int32 w = f->m.width(cnt), d, r; + int32 w = f->width(cnt), d, r; if (size == 22) { d = (cntSize < 2) ? 3 : 2; r = (cntSize < 2) ? 6 : 5; diff --git a/Telegram/SourceFiles/pspecific_mac.h b/Telegram/SourceFiles/pspecific_mac.h index a2342610e5..4ba32f4583 100644 --- a/Telegram/SourceFiles/pspecific_mac.h +++ b/Telegram/SourceFiles/pspecific_mac.h @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 diff --git a/Telegram/SourceFiles/pspecific_mac_p.h b/Telegram/SourceFiles/pspecific_mac_p.h index 1ed7626c03..b5ade3c858 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.h +++ b/Telegram/SourceFiles/pspecific_mac_p.h @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 diff --git a/Telegram/SourceFiles/pspecific_mac_p.mm b/Telegram/SourceFiles/pspecific_mac_p.mm index 3fbd37a5cb..623cdd05b4 100644 --- a/Telegram/SourceFiles/pspecific_mac_p.mm +++ b/Telegram/SourceFiles/pspecific_mac_p.mm @@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 "pspecific_mac_p.h" diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_wnd.cpp index e55996eec6..544ecb171e 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_wnd.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "pspecific.h" diff --git a/Telegram/SourceFiles/pspecific_wnd.h b/Telegram/SourceFiles/pspecific_wnd.h index 98ee2cc40c..0f323f3a01 100644 --- a/Telegram/SourceFiles/pspecific_wnd.h +++ b/Telegram/SourceFiles/pspecific_wnd.h @@ -13,8 +13,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index f8e994e3ca..2bbab026ea 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "pspecific.h" diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index 8f7aed552f..66800537c2 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index e96490a3ae..e3a9269920 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -144,10 +147,10 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent), _dpiAutoScale(this, lng_settings_scale_auto(lt_cur, scaleLabel(cScreenScale())), (cConfigScale() == dbisAuto)), _dpiSlider(this, st::dpiSlider, dbisScaleCount - 1, cEvalScale(cConfigScale()) - 1), - _dpiWidth1(st::dpiFont1->m.width(scaleLabel(dbisOne))), - _dpiWidth2(st::dpiFont2->m.width(scaleLabel(dbisOneAndQuarter))), - _dpiWidth3(st::dpiFont3->m.width(scaleLabel(dbisOneAndHalf))), - _dpiWidth4(st::dpiFont4->m.width(scaleLabel(dbisTwo))), + _dpiWidth1(st::dpiFont1->width(scaleLabel(dbisOne))), + _dpiWidth2(st::dpiFont2->width(scaleLabel(dbisOneAndQuarter))), + _dpiWidth3(st::dpiFont3->width(scaleLabel(dbisOneAndHalf))), + _dpiWidth4(st::dpiFont4->width(scaleLabel(dbisTwo))), // chat options _replaceEmojis(this, lang(lng_settings_replace_emojis), cReplaceEmojis()), @@ -157,12 +160,12 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent), _ctrlEnterSend(this, qsl("send_key"), 1, lang((cPlatform() == dbipMac) ? lng_settings_send_cmdenter : lng_settings_send_ctrlenter), cCtrlEnter()), _dontAskDownloadPath(this, lang(lng_download_path_dont_ask), !cAskDownloadPath()), - _downloadPathWidth(st::linkFont->m.width(lang(lng_download_path_label)) + st::linkFont->spacew), - _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_default) : ((cDownloadPath() == qsl("tmp")) ? lang(lng_download_path_temp) : st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth))), + _downloadPathWidth(st::linkFont->width(lang(lng_download_path_label)) + st::linkFont->spacew), + _downloadPathEdit(this, cDownloadPath().isEmpty() ? lang(lng_download_path_default) : ((cDownloadPath() == qsl("tmp")) ? lang(lng_download_path_temp) : st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::setVersionLeft - _downloadPathWidth))), _downloadPathClear(this, lang(lng_download_path_clear)), - _tempDirClearingWidth(st::linkFont->m.width(lang(lng_download_path_clearing))), - _tempDirClearedWidth(st::linkFont->m.width(lang(lng_download_path_cleared))), - _tempDirClearFailedWidth(st::linkFont->m.width(lang(lng_download_path_clear_failed))), + _tempDirClearingWidth(st::linkFont->width(lang(lng_download_path_clearing))), + _tempDirClearedWidth(st::linkFont->width(lang(lng_download_path_cleared))), + _tempDirClearFailedWidth(st::linkFont->width(lang(lng_download_path_clear_failed))), // chat background _backFromGallery(this, lang(lng_settings_bg_from_gallery)), @@ -173,22 +176,22 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent), // local storage _localStorageClear(this, lang(lng_local_storage_clear)), _localStorageHeight(1), - _storageClearingWidth(st::linkFont->m.width(lang(lng_local_storage_clearing))), - _storageClearedWidth(st::linkFont->m.width(lang(lng_local_storage_cleared))), - _storageClearFailedWidth(st::linkFont->m.width(lang(lng_local_storage_clear_failed))), + _storageClearingWidth(st::linkFont->width(lang(lng_local_storage_clearing))), + _storageClearedWidth(st::linkFont->width(lang(lng_local_storage_cleared))), + _storageClearFailedWidth(st::linkFont->width(lang(lng_local_storage_clear_failed))), // advanced _passcodeEdit(this, lang(cHasPasscode() ? lng_passcode_change : lng_passcode_turn_on)), _passcodeTurnOff(this, lang(lng_passcode_turn_off)), _autoLock(this, (cAutoLock() % 3600) ? lng_passcode_autolock_minutes(lt_count, cAutoLock() / 60) : lng_passcode_autolock_hours(lt_count, cAutoLock() / 3600)), _autoLockText(lang(psIdleSupported() ? lng_passcode_autolock_away : lng_passcode_autolock_inactive) + ' '), - _autoLockWidth(st::linkFont->m.width(_autoLockText)), + _autoLockWidth(st::linkFont->width(_autoLockText)), _passwordEdit(this, lang(lng_cloud_password_set)), _passwordTurnOff(this, lang(lng_passcode_turn_off)), _hasPasswordRecovery(false), _connectionType(this, lang(lng_connection_auto_connecting)), _connectionTypeText(lang(lng_connection_type) + ' '), - _connectionTypeWidth(st::linkFont->m.width(_connectionTypeText)), + _connectionTypeWidth(st::linkFont->width(_connectionTypeText)), _showSessions(this, lang(lng_settings_show_sessions)), _askQuestion(this, lang(lng_settings_ask_question)), _telegramFAQ(this, lang(lng_settings_faq)), @@ -248,9 +251,9 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : QWidget(parent), connect(&_dpiSlider, SIGNAL(changed(int32)), this, SLOT(onScaleChange())); _curVersionText = lng_settings_current_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : "")) + ' '; - _curVersionWidth = st::linkFont->m.width(_curVersionText); + _curVersionWidth = st::linkFont->width(_curVersionText); _newVersionText = lang(lng_settings_update_ready) + ' '; - _newVersionWidth = st::linkFont->m.width(_newVersionText); + _newVersionWidth = st::linkFont->width(_newVersionText); #ifndef TDESKTOP_DISABLE_AUTOUPDATE connect(App::app(), SIGNAL(updateChecking()), this, SLOT(onUpdateChecking())); @@ -921,7 +924,7 @@ void SettingsInner::gotPassword(const MTPaccount_Password &result) { if (!pattern.isEmpty()) _waitingConfirm = lng_cloud_password_waiting(lt_email, pattern); } break; } - _waitingConfirm = st::linkFont->m.elidedText(_waitingConfirm, Qt::ElideRight, st::setWidth - _passwordTurnOff.width()); + _waitingConfirm = st::linkFont->elided(_waitingConfirm, st::setWidth - _passwordTurnOff.width()); _passwordEdit.setText(lang(_curPasswordSalt.isEmpty() ? lng_cloud_password_set : lng_cloud_password_edit)); showAll(); update(); @@ -1175,7 +1178,7 @@ void SettingsInner::onShowSessions() { void SettingsInner::onAskQuestion() { if (!App::self()) return; - ConfirmBox *box = new ConfirmBox(lang(lng_settings_ask_sure), lang(lng_settings_ask_ok), lang(lng_settings_faq_button)); + ConfirmBox *box = new ConfirmBox(lang(lng_settings_ask_sure), lang(lng_settings_ask_ok), st::defaultBoxButton, lang(lng_settings_faq_button)); connect(box, SIGNAL(confirmed()), this, SLOT(onAskQuestionSure())); connect(box, SIGNAL(cancelPressed()), this, SLOT(onTelegramFAQ())); App::wnd()->showLayer(box); @@ -1204,17 +1207,17 @@ void SettingsInner::chooseCustomLang() { QByteArray arr; if (filedialogGetOpenFile(file, arr, qsl("Choose language .strings file"), qsl("Language files (*.strings)"))) { _testlang = QFileInfo(file).absoluteFilePath(); - LangLoaderPlain loader(_testlang, LangLoaderRequest(lng_sure_save_language, lng_cancel, lng_continue)); + LangLoaderPlain loader(_testlang, LangLoaderRequest(lng_sure_save_language, lng_box_cancel, lng_box_ok)); if (loader.errors().isEmpty()) { LangLoaderResult result = loader.found(); QString text = result.value(lng_sure_save_language, langOriginal(lng_sure_save_language)), - save = result.value(lng_continue, langOriginal(lng_continue)), - cancel = result.value(lng_cancel, langOriginal(lng_cancel)); - ConfirmBox *box = new ConfirmBox(text, save, cancel); + save = result.value(lng_box_ok, langOriginal(lng_box_ok)), + cancel = result.value(lng_box_cancel, langOriginal(lng_box_cancel)); + ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel); connect(box, SIGNAL(confirmed()), this, SLOT(onSaveTestLang())); App::wnd()->showLayer(box); } else { - App::wnd()->showLayer(new ConfirmBox("Custom lang failed :(\n\nError: " + loader.errors(), true, lang(lng_close))); + App::wnd()->showLayer(new InformBox("Custom lang failed :(\n\nError: " + loader.errors())); } } } @@ -1438,7 +1441,7 @@ void SettingsInner::setScale(DBIScale newScale) { _dpiSlider.setSelected(newScale - 1); } if (cEvalScale(cConfigScale()) != cEvalScale(cRealScale())) { - ConfirmBox *box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), lang(lng_settings_restart_later)); + ConfirmBox *box = new ConfirmBox(lang(lng_settings_need_restart), lang(lng_settings_restart_now), st::defaultBoxButton, lang(lng_settings_restart_later)); connect(box, SIGNAL(confirmed()), this, SLOT(onRestartNow())); App::wnd()->showLayer(box); } @@ -1626,7 +1629,7 @@ void SettingsInner::onDownloadPathEdited() { } else if (cDownloadPath() == qsl("tmp")) { path = lang(lng_download_path_temp); } else { - path = st::linkFont->m.elidedText(QDir::toNativeSeparators(cDownloadPath()), Qt::ElideRight, st::setWidth - st::setVersionLeft - _downloadPathWidth); + path = st::linkFont->elided(QDir::toNativeSeparators(cDownloadPath()), st::setWidth - st::setVersionLeft - _downloadPathWidth); } _downloadPathEdit.setText(path); showAll(); diff --git a/Telegram/SourceFiles/settingswidget.h b/Telegram/SourceFiles/settingswidget.h index 81de3b926f..a651250839 100644 --- a/Telegram/SourceFiles/settingswidget.h +++ b/Telegram/SourceFiles/settingswidget.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/stdafx.cpp b/Telegram/SourceFiles/stdafx.cpp index e2d89d33bb..01ddf641e5 100644 --- a/Telegram/SourceFiles/stdafx.cpp +++ b/Telegram/SourceFiles/stdafx.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h index e4e137875c..20e2aeeb09 100644 --- a/Telegram/SourceFiles/stdafx.h +++ b/Telegram/SourceFiles/stdafx.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #define __HUGE #define PSAPI_VERSION 1 // fix WinXP diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 7bb04408df..e9b50b557e 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -385,7 +388,7 @@ void ChannelData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see photoId = newPhotoId; photo = newPhoto; photoLoc = newPhotoLoc; - emit App::main()->peerPhotoChanged(this); + if (App::main()) emit App::main()->peerPhotoChanged(this); } } @@ -397,8 +400,10 @@ void ChannelData::setName(const QString &newName, const QString &usern) { void ChannelData::updateFull(bool force) { if (!_lastFullUpdate || force || getms(true) > _lastFullUpdate + UpdateFullChannelTimeout) { - App::api()->requestFullPeer(this); - if (!amCreator() && !inviter) App::api()->requestSelfParticipant(this); + if (App::api()) { + App::api()->requestFullPeer(this); + if (!amCreator() && !inviter) App::api()->requestSelfParticipant(this); + } } } @@ -960,7 +965,7 @@ void PeerLink::onClick(Qt::MouseButton button) const { if (button == Qt::LeftButton && App::main()) { if (peer() && peer()->isChannel() && App::main()->historyPeer() != peer()) { if (!peer()->asChannel()->isPublic() && !peer()->asChannel()->amIn()) { - App::wnd()->showLayer(new ConfirmBox(lang(lng_channel_not_accessible), true)); + App::wnd()->showLayer(new InformBox(lang(lng_channel_not_accessible))); } else { App::main()->showPeerHistory(peer()->id, ShowAtUnreadMsgId); } diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index 6cff40ea64..cda4ac21ca 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/style.h b/Telegram/SourceFiles/style.h index 819e0092a8..bcbbb5c08b 100644 --- a/Telegram/SourceFiles/style.h +++ b/Telegram/SourceFiles/style.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/sysbuttons.cpp b/Telegram/SourceFiles/sysbuttons.cpp index 039dbb8835..d84b6cdb7d 100644 --- a/Telegram/SourceFiles/sysbuttons.cpp +++ b/Telegram/SourceFiles/sysbuttons.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -27,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org SysBtn::SysBtn(QWidget *parent, const style::sysButton &st, const QString &text) : Button(parent), _st(st), a_color(_st.color->c), _overLevel(0), _text(text) { - int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->m.width(_text))); + int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text))); resize(w, _st.size.height()); setCursor(style::cur_default); connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource))); @@ -35,7 +38,7 @@ _st(st), a_color(_st.color->c), _overLevel(0), _text(text) { void SysBtn::setText(const QString &text) { _text = text; - int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->m.width(_text))); + int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text))); resize(w, _st.size.height()); } diff --git a/Telegram/SourceFiles/sysbuttons.h b/Telegram/SourceFiles/sysbuttons.h index 49174154d4..4b4a616a93 100644 --- a/Telegram/SourceFiles/sysbuttons.h +++ b/Telegram/SourceFiles/sysbuttons.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/title.cpp b/Telegram/SourceFiles/title.cpp index 47e23d5e29..c65425fa1b 100644 --- a/Telegram/SourceFiles/title.cpp +++ b/Telegram/SourceFiles/title.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "lang.h" diff --git a/Telegram/SourceFiles/title.h b/Telegram/SourceFiles/title.h index 5a785ce091..1dc420a747 100644 --- a/Telegram/SourceFiles/title.h +++ b/Telegram/SourceFiles/title.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/types.cpp b/Telegram/SourceFiles/types.cpp index 22cef79265..e24c66977c 100644 --- a/Telegram/SourceFiles/types.cpp +++ b/Telegram/SourceFiles/types.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" diff --git a/Telegram/SourceFiles/types.h b/Telegram/SourceFiles/types.h index a7447b9d38..0d9e7e4884 100644 --- a/Telegram/SourceFiles/types.h +++ b/Telegram/SourceFiles/types.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index b5db91a42e..e76739576c 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #include "stdafx.h" #include "style.h" @@ -42,7 +45,7 @@ ConnectingWidget::ConnectingWidget(QWidget *parent, const QString &text, const Q void ConnectingWidget::set(const QString &text, const QString &reconnect) { _text = text; - _textWidth = st::linkFont->m.width(_text) + st::linkFont->spacew; + _textWidth = st::linkFont->width(_text) + st::linkFont->spacew; int32 _reconnectWidth = 0; if (reconnect.isEmpty()) { _reconnect.hide(); @@ -187,7 +190,7 @@ void NotifyWindow::updateNotifyDisplay() { QDateTime now(QDateTime::currentDateTime()), lastTime(item->date); QDate nowDate(now.date()), lastDate(lastTime.date()); QString dt = lastTime.toString(cTimeFormat()); - int32 dtWidth = st::dlgHistFont->m.width(dt); + int32 dtWidth = st::dlgHistFont->width(dt); rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip); p.setFont(st::dlgDateFont->f); p.setPen(st::dlgDateColor->p); @@ -212,7 +215,7 @@ void NotifyWindow::updateNotifyDisplay() { p.drawText(r.left(), r.top() + st::dlgHistFont->ascent, lng_forward_messages(lt_count, fwdCount)); } } else { - static QString notifyText = st::dlgHistFont->m.elidedText(lang(lng_notification_preview), Qt::ElideRight, itemWidth); + static QString notifyText = st::dlgHistFont->elided(lang(lng_notification_preview), itemWidth); p.setPen(st::dlgSystemColor->p); p.drawText(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyItemTop + st::msgNameFont->height + st::dlgHistFont->ascent, notifyText); } @@ -222,7 +225,7 @@ void NotifyWindow::updateNotifyDisplay() { history->peer->dialogName().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); } else { p.setFont(st::msgNameFont->f); - static QString notifyTitle = st::msgNameFont->m.elidedText(qsl("Telegram Desktop"), Qt::ElideRight, rectForName.width()); + static QString notifyTitle = st::msgNameFont->elided(qsl("Telegram Desktop"), rectForName.width()); p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle); } } @@ -770,7 +773,8 @@ void Window::showDocument(DocumentData *doc, HistoryItem *item) { _mediaView->setFocus(); } -void Window::showLayer(LayeredWidget *w, bool fast) { +void Window::showLayer(LayeredWidget *w, bool forceFast) { + bool fast = forceFast || layerShown(); hideLayer(true); layerBG = new BackgroundWidget(this, w); if (fast) { @@ -1059,7 +1063,7 @@ void Window::onShowNewChannel() { void Window::onLogout() { if (isHidden()) showFromTray(); - ConfirmBox *box = new ConfirmBox(lang(lng_sure_logout)); + ConfirmBox *box = new ConfirmBox(lang(lng_sure_logout), lang(lng_box_logout), st::attentionBoxButton); connect(box, SIGNAL(confirmed()), this, SLOT(onLogoutSure())); App::wnd()->showLayer(box); } @@ -1638,7 +1642,7 @@ void Window::placeSmallCounter(QImage &img, int size, int count, style::color bg fontSize = (cntSize < 2) ? 22 : 22; } style::font f(fontSize); - int32 w = f->m.width(cnt), d, r; + int32 w = f->width(cnt), d, r; if (size == 16) { d = (cntSize < 2) ? 2 : 1; r = (cntSize < 2) ? 4 : 3; @@ -1687,7 +1691,7 @@ QImage Window::iconWithCounter(int size, int count, style::color bg, bool smallI fontSize = (cntSize < 2) ? 22 : ((cntSize < 3) ? 20 : 16); } style::font f(fontSize); - int32 w = f->m.width(cnt), d, r; + int32 w = f->width(cnt), d, r; if (size == 16) { d = (cntSize < 2) ? 5 : ((cntSize < 3) ? 2 : 1); r = (cntSize < 2) ? 8 : ((cntSize < 3) ? 7 : 3); diff --git a/Telegram/SourceFiles/window.h b/Telegram/SourceFiles/window.h index be20c0b4b5..0d91959478 100644 --- a/Telegram/SourceFiles/window.h +++ b/Telegram/SourceFiles/window.h @@ -12,8 +12,11 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 -Copyright (c) 2014 John Preston, https://desktop.telegram.org +Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #ifndef MAINWINDOW_H #define MAINWINDOW_H @@ -178,7 +181,7 @@ public: void showPhoto(PhotoData *photo, HistoryItem *item); void showPhoto(PhotoData *photo, PeerData *item); void showDocument(DocumentData *doc, HistoryItem *item); - void showLayer(LayeredWidget *w, bool fast = false); + void showLayer(LayeredWidget *w, bool forceFast = false); void replaceLayer(LayeredWidget *w); void hideLayer(bool fast = false); bool hideInnerLayer();