From d46a5f693f6c118a3eb62dee5841757a58d2afea Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 9 Sep 2017 12:04:20 +0300 Subject: [PATCH] Remove unused lang phrases and some code. --- Telegram/Resources/langs/lang.strings | 69 --------- Telegram/SourceFiles/app.cpp | 4 +- Telegram/SourceFiles/boxes/emoji_box.cpp | 146 ------------------ Telegram/SourceFiles/boxes/emoji_box.h | 51 ------ Telegram/SourceFiles/boxes/stickers_box.cpp | 40 +---- Telegram/SourceFiles/boxes/stickers_box.h | 8 - .../SourceFiles/history/history_widget.cpp | 2 +- Telegram/SourceFiles/lang/lang_keys.h | 8 - .../settings_chat_settings_widget.cpp | 14 +- .../settings/settings_chat_settings_widget.h | 2 - Telegram/gyp/telegram_sources.txt | 2 - 11 files changed, 8 insertions(+), 338 deletions(-) delete mode 100644 Telegram/SourceFiles/boxes/emoji_box.cpp delete mode 100644 Telegram/SourceFiles/boxes/emoji_box.h diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 43fce6c99..c5e569340 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -26,7 +26,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_menu_settings" = "Settings"; "lng_menu_about" = "About"; "lng_menu_update" = "Update"; -"lng_menu_restart" = "Restart"; "lng_menu_back" = "Back"; "lng_menu_night_mode" = "Night mode"; @@ -71,14 +70,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_weekday6" = "Sat"; "lng_weekday7" = "Sun"; -"lng_weekday1_full" = "Monday"; -"lng_weekday2_full" = "Tuesday"; -"lng_weekday3_full" = "Wednesday"; -"lng_weekday4_full" = "Thursday"; -"lng_weekday5_full" = "Friday"; -"lng_weekday6_full" = "Saturday"; -"lng_weekday7_full" = "Sunday"; - "lng_month_day" = "{month} {day}"; "lng_month_day_year" = "{month} {day}, {year}"; "lng_month_year" = "{month} {year}"; @@ -104,7 +95,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_status_recently" = "last seen recently"; "lng_status_last_week" = "last seen within a week"; "lng_status_last_month" = "last seen within a month"; -"lng_status_invisible" = "invisible"; "lng_status_lastseen_now" = "last seen just now"; "lng_status_lastseen_minutes#one" = "last seen {count} minute ago"; "lng_status_lastseen_minutes#other" = "last seen {count} minutes ago"; @@ -118,7 +108,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_status_connecting" = "connecting..."; "lng_chat_status_unaccessible" = "group is inaccessible"; -"lng_chat_status_no_members" = "no members"; "lng_chat_status_members#one" = "{count} member"; "lng_chat_status_members#other" = "{count} members"; "lng_chat_status_online#one" = "{count} online"; @@ -143,7 +132,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_error_pinned_max#one" = "Sorry, you can pin no more than {count} chat to the top."; "lng_error_pinned_max#other" = "Sorry, you can pin no more than {count} chats to the top."; "lng_error_public_groups_denied" = "Unfortunately, you were banned from participating in public groups.\n{more_info}"; -"lng_error_cant_edit_admin" = "Sorry, you can't edit permissions for this admin."; "lng_error_cant_add_member" = "Sorry, you can't add the bot to this group. Ask a group admin to do it."; "lng_error_cant_add_bot" = "Sorry, this bot can't be added to groups."; "lng_error_cant_add_admin_invite" = "Sorry, you can't add this user as an admin because they are not a member of this group and you are not allowed to invite them."; @@ -179,14 +167,12 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_photo_caption" = "Caption"; "lng_photos_comment" = "Comment"; -"lng_phone_ph" = "Your phone number"; "lng_phone_title" = "Your Phone"; "lng_phone_desc" = "Please confirm your country code and\nenter your phone number."; "lng_phone_notreg" = "If you don't have a Telegram account yet,\nplease [b]sign up[/b] with {link_start}Android / iPhone{link_end} or {signup_start}here{signup_end}"; "lng_country_code" = "Country Code"; "lng_bad_country_code" = "Invalid Country Code"; "lng_country_ph" = "Search"; -"lng_country_done" = "Done"; "lng_country_none" = "Country not found"; "lng_country_select" = "Select country"; @@ -276,7 +262,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_bio_about" = "You can add a few lines about yourself. Anyone who opens your profile will see this text."; "lng_settings_section_info" = "Info"; -"lng_settings_phone_number" = "Phone number:"; "lng_settings_username" = "Username:"; "lng_settings_choose_username" = "Choose username"; "lng_settings_empty_bio" = "None"; @@ -323,7 +308,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_settings_section_chat_settings" = "Chat Settings"; "lng_settings_replace_emojis" = "Replace emoji"; "lng_settings_view_emojis" = "View list"; -"lng_settings_emoji_list" = "Supported emoji"; "lng_settings_send_enter" = "Send by Enter"; "lng_settings_send_ctrlenter" = "Send by Ctrl+Enter"; "lng_settings_send_cmdenter" = "Send by Cmd+Enter"; @@ -472,7 +456,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "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"; @@ -556,9 +539,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_preview_loading" = "Getting Link Info..."; -"lng_profile_chat_unaccessible" = "Group is inaccessible"; -"lng_profile_about_section" = "About"; -"lng_profile_description_section" = "Description"; "lng_profile_settings_section" = "Settings"; "lng_profile_actions_section" = "Actions"; "lng_profile_bot_settings" = "Settings"; @@ -606,14 +586,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_profile_join_channel" = "Join"; "lng_profile_delete_and_exit" = "Leave"; "lng_profile_kick" = "Remove"; -"lng_profile_admin" = "admin"; -"lng_profile_edit_permissions" = "Edit"; "lng_profile_sure_kick" = "Remove {user} from the group?"; "lng_profile_sure_kick_channel" = "Remove {user} from the channel?"; -"lng_profile_sure_kick_admin" = "Remove {user} from administrators?"; "lng_profile_loading" = "Loading..."; "lng_profile_shared_media" = "Shared media"; -"lng_profile_no_media" = "No media in this conversation."; "lng_profile_photos#one" = "{count} photo"; "lng_profile_photos#other" = "{count} photos"; "lng_profile_photos_header" = "Photos"; @@ -653,12 +629,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_channel_add_members" = "Add members"; "lng_channel_add_banned" = "Ban user"; "lng_channel_add_restricted" = "Restrict user"; -"lng_channel_members" = "Members"; -"lng_channel_only_last_shown#one" = "Only the last {count} member is shown here"; -"lng_channel_only_last_shown#other" = "Only the last {count} members are shown here"; "lng_channel_admins" = "Administrators"; "lng_channel_add_admin" = "Add Administrator"; -"lng_channel_admins_too_much" = "Sorry, you have reached the limit of the administrators. Please remove one administrator first."; "lng_channel_admin_status_creator" = "Creator"; "lng_channel_admin_status_promoted_by" = "Promoted by {user}"; "lng_channel_admin_status_not_admin" = "Not administrator"; @@ -783,17 +755,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_profile_migrate_reached#other" = "{count} members limit reached"; "lng_profile_migrate_body" = "To get over this limit, you can upgrade your group to a supergroup."; "lng_profile_migrate_learn_more" = "Learn more »"; -"lng_profile_migrate_about" = "If you'd like to go over this limit, you can upgrade your group to a supergroup. In supergroups:"; -"lng_profile_migrate_feature1#one" = "— The members limit is {count} user"; -"lng_profile_migrate_feature1#other" = "— The members limit is {count} users"; -"lng_profile_migrate_feature2" = "— New members see the entire chat history"; -"lng_profile_migrate_feature3" = "— Admins delete messages for everyone"; -"lng_profile_migrate_feature4" = "— Notifications are muted by default"; "lng_profile_migrate_button" = "Upgrade to supergroup"; -"lng_profile_migrate_sure" = "Are you sure you want to upgrade this group to supergroup? This action cannot be undone."; -"lng_profile_convert_button" = "Convert to supergroup"; "lng_profile_convert_title" = "Convert to supergroup"; -"lng_profile_convert_about" = "In supergroups:"; "lng_profile_convert_feature1" = "— New members see the full message history"; "lng_profile_convert_feature2" = "— Messages are deleted for all members"; "lng_profile_convert_feature3" = "— Admins can pin important messages"; @@ -812,14 +775,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_channels_too_much_public_revoke" = "Revoke"; "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_members#one" = "{count} member, among them:"; "lng_group_invite_members#other" = "{count} members, among them:"; -"lng_group_invite_link" = "Invite link:"; "lng_group_invite_create" = "Create an invite link"; "lng_group_invite_about" = "Telegram users will be able to join\nyour group by following this link."; "lng_group_invite_create_new" = "Revoke invite link"; @@ -911,11 +871,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_stickers_share_pack" = "Share Stickers"; "lng_stickers_not_found" = "Sticker pack not found."; "lng_stickers_packs_archived" = "Some of your unused stickers have been archived to make room for the sets you've activated."; -"lng_stickers_archived" = "Archived Stickers"; "lng_stickers_copied" = "Sticker pack link copied to clipboard."; "lng_stickers_default_set" = "Great Minds"; "lng_stickers_you_have" = "Manage and reorder sticker packs"; -"lng_stickers_featured" = "Trending Stickers"; "lng_stickers_return" = "Undo"; "lng_stickers_count#one" = "{count} sticker"; "lng_stickers_count#other" = "{count} stickers"; @@ -945,8 +903,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_report_spam_ok" = "Report"; "lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment.\n{more_info}"; "lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment.\n{more_info}"; -"lng_cant_send_to_not_contact_flood" = "You have contacted too many non-contacts today, please try again tomorrow. You will be able to reply today if this user messages you first."; -"lng_cant_invite_not_contact_flood" = "You can't add this user because you have contacted too many non-contacts today. Please try again tomorrow. You can ask another member to add this user to the group."; "lng_cant_more_info" = "More info »"; "lng_cant_invite_banned" = "Sorry, only admin can add this user."; "lng_cant_invite_privacy" = "Sorry, you cannot add this user to groups because of their privacy settings."; @@ -1061,10 +1017,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_context_copy_hashtag" = "Copy Hashtag"; "lng_context_copy_mention" = "Copy Username"; "lng_context_save_image" = "Save Image As..."; -"lng_context_forward_image" = "Forward Image"; -"lng_context_delete_image" = "Delete Image"; "lng_context_copy_image" = "Copy Image"; -"lng_context_close_image" = "Close Image"; "lng_context_cancel_download" = "Cancel Download"; "lng_context_show_in_folder" = "Show in Folder"; "lng_context_show_in_finder" = "Show in Finder"; @@ -1074,9 +1027,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_context_pack_info" = "Pack Info"; "lng_context_pack_add" = "Add Stickers"; "lng_context_save_file" = "Save File As..."; -"lng_context_forward_file" = "Forward File"; -"lng_context_delete_file" = "Delete File"; -"lng_context_close_file" = "Close File"; "lng_context_copy_text" = "Copy Text"; "lng_context_open_gif" = "Open GIF"; "lng_context_save_gif" = "Save GIF"; @@ -1094,12 +1044,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_context_forward_selected" = "Forward Selected"; "lng_context_delete_selected" = "Delete Selected"; "lng_context_clear_selection" = "Clear Selection"; -"lng_really_send_image" = "Do you want to send this image?"; -"lng_really_send_file" = "Do you want to send this file?"; -"lng_really_share_contact" = "Do you want to share this contact?"; "lng_send_images_compress#one" = "Compress image"; "lng_send_images_compress#other" = "Compress images"; -"lng_send_image_non_local" = "Could not send a non local file: {name}"; "lng_send_image_empty" = "Could not send an empty file: {name}"; "lng_send_image_too_large" = "Could not send a file, because it is larger than 1500 MB: {name}"; "lng_send_folder" = "Could not send «{name}» because it is a directory :("; @@ -1114,7 +1060,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_forward_choose" = "Choose recipient..."; "lng_forward_cant" = "Sorry, no way to forward here :("; -"lng_forward_confirm" = "Forward to {recipient}?"; "lng_forward_share_contact" = "Share contact to {recipient}?"; "lng_forward_share_cant" = "Sorry, no way to share contact here :("; "lng_forward_send_file_confirm" = "Send «{name}» to {recipient}?"; @@ -1159,7 +1104,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_try_other_contact" = "Try other"; "lng_create_group_link" = "Link"; "lng_create_group_invite_link" = "Invite link"; -"lng_create_group_photo" = "Set Photo"; "lng_create_group_description" = "Description (optional)"; "lng_drag_images_here" = "Drop images here"; @@ -1173,8 +1117,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_selected_clear" = "Cancel"; "lng_selected_delete" = "Delete"; "lng_selected_forward" = "Forward"; -"lng_selected_count#one" = "{count} message"; -"lng_selected_count#other" = "{count} messages"; "lng_selected_cancel_sure_this" = "Cancel uploading?"; "lng_selected_upload_stop" = "Stop"; "lng_selected_delete_sure_this" = "Do you want to delete this message?"; @@ -1233,7 +1175,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_new_version_wrap" = "Telegram Desktop was updated to version {version}\n\n{changes}\n\nFull version history is available here:\n{link}"; "lng_new_version_minor" = "— Bug fixes and other minor improvements"; -"lng_new_version_text" = "— Improved video messages: radial playback progress, Picture-in-Picture support, duration countdown.\n— Voice and video messages now automatically play one after another."; "lng_menu_insert_unicode" = "Insert Unicode control character"; @@ -1342,7 +1283,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_rights_chat_banned_week#other" = "For {count} weeks"; "lng_rights_chat_banned_custom" = "Custom"; "lng_rights_chat_banned_custom_date" = "Until {date}"; -"lng_rights_chat_banned_block" = "Ban and remove from group"; "lng_restricted_send_message" = "The admins of this group restricted you from writing here."; "lng_restricted_send_media" = "The admins of this group restricted you from posting media content here."; @@ -1434,15 +1374,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_admin_log_admin_pin_messages" = "Pin messages"; "lng_admin_log_admin_add_admins" = "Add new admins"; -// Not used - -"lng_topbar_info" = "Info"; -"lng_profile_group_info" = "Group info"; -"lng_profile_channel_info" = "Channel info"; -"lng_channel_add_admins" = "New administrator"; -"lng_dlg_search_chat" = "Search in this chat"; -"lng_dlg_search_channel" = "Search in this channel"; - // Wnd specific "lng_wnd_choose_program_menu" = "Choose Default Program..."; diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index ea914d90f..3d4402b11 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -286,8 +286,8 @@ namespace { QString onlineText(TimeId online, TimeId now, bool precise) { if (online <= 0) { switch (online) { - case 0: return lang(lng_status_offline); - case -1: return lang(lng_status_invisible); + case 0: + case -1: return lang(lng_status_offline); case -2: return lang(lng_status_recently); case -3: return lang(lng_status_last_week); case -4: return lang(lng_status_last_month); diff --git a/Telegram/SourceFiles/boxes/emoji_box.cpp b/Telegram/SourceFiles/boxes/emoji_box.cpp deleted file mode 100644 index af83b50a3..000000000 --- a/Telegram/SourceFiles/boxes/emoji_box.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -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-2017 John Preston, https://desktop.telegram.org -*/ -#include "boxes/emoji_box.h" - -#include "lang/lang_keys.h" -#include "mainwidget.h" -#include "mainwindow.h" - -namespace { - -struct EmojiReplace { - uint32 code; - const char *replace; -}; - -// copied from codegen_emoji -EmojiReplace Replaces[] = { - { 0xD83DDE0AU, ":-)" }, - { 0xD83DDE0DU, "8-)" }, - { 0x2764U, "<3" }, - { 0xD83DDC8BU, ":kiss:" }, - { 0xD83DDE01U, ":grin:" }, - { 0xD83DDE02U, ":joy:" }, - { 0xD83DDE1AU, ":-*" }, - { 0xD83DDE06U, "xD" }, - { 0xD83DDC4DU, ":like:" }, - { 0xD83DDC4EU, ":dislike:" }, - { 0x261DU, ":up:" }, - { 0x270CU, ":v:" }, - { 0xD83DDC4CU, ":ok:" }, - { 0xD83DDE0EU, "B-)" }, - { 0xD83DDE03U, ":-D" }, - { 0xD83DDE09U, ";-)" }, - { 0xD83DDE1CU, ";-P" }, - { 0xD83DDE0BU, ":-p" }, - { 0xD83DDE14U, "3(" }, - { 0xD83DDE1EU, ":-(" }, - { 0xD83DDE0FU, ":]" }, - { 0xD83DDE22U, ":'(" }, - { 0xD83DDE2DU, ":_(" }, - { 0xD83DDE29U, ":((" }, - { 0xD83DDE28U, ":o" }, - { 0xD83DDE10U, ":|" }, - { 0xD83DDE0CU, "3-)" }, - { 0xD83DDE20U, ">(" }, - { 0xD83DDE21U, ">((" }, - { 0xD83DDE07U, "O:)" }, - { 0xD83DDE30U, ";o" }, - { 0xD83DDE33U, "8|" }, - { 0xD83DDE32U, "8o" }, - { 0xD83DDE37U, ":X" }, - { 0xD83DDE08U, "}:)" }, -}; - -constexpr auto kReplacesCount = base::array_size(Replaces); -constexpr auto kReplacesInRow = 7; - -} // namespace - -EmojiBox::EmojiBox(QWidget*) : _esize(Ui::Emoji::Size(Ui::Emoji::Index() + 1)) { -} - -void EmojiBox::prepare() { - setTitle(langFactory(lng_settings_emoji_list)); - fillBlocks(); - - addButton(langFactory(lng_close), [this] { closeBox(); }); - - _blockHeight = st::emojiReplaceInnerHeight; - - setDimensions(_blocks[0].size() * st::emojiReplaceWidth + 2 * st::emojiReplacePadding, st::emojiReplacePadding + _blocks.size() * st::emojiReplaceHeight + (st::emojiReplaceHeight - _blockHeight) + st::emojiReplacePadding); -} - -void EmojiBox::fillBlocks() { - BlockRow currentRow; - currentRow.reserve(kReplacesInRow); - for (uint32 i = 0; i < kReplacesCount; ++i) { - auto emoji = Ui::Emoji::FromOldKey(Replaces[i].code); - if (!emoji) continue; - - if (emoji->hasVariants()) { - auto it = cEmojiVariants().constFind(emoji->nonColoredId()); - if (it != cEmojiVariants().cend()) { - emoji = emoji->variant(it.value()); - } - } - - Block block(emoji, QString::fromUtf8(Replaces[i].replace)); - currentRow.push_back(block); - if (uint32(currentRow.size()) == kReplacesInRow) { - _blocks.push_back(currentRow); - currentRow.resize(0); - } - } - if (currentRow.size()) { - _blocks.push_back(currentRow); - } -} - -void EmojiBox::keyPressEvent(QKeyEvent *e) { - if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { - closeBox(); - } else { - BoxContent::keyPressEvent(e); - } -} - -void EmojiBox::paintEvent(QPaintEvent *e) { - BoxContent::paintEvent(e); - - Painter p(this); - - p.setFont(st::emojiTextFont); - p.setPen(st::boxTextFg); - auto top = st::emojiReplacePadding + (st::emojiReplaceHeight - _blockHeight) / 2; - for (Blocks::const_iterator i = _blocks.cbegin(), e = _blocks.cend(); i != e; ++i) { - int32 rowSize = i->size(), left = (width() - rowSize * st::emojiReplaceWidth) / 2; - for (BlockRow::const_iterator j = i->cbegin(), en = i->cend(); j != en; ++j) { - if (j->emoji) { - p.drawPixmap(QPoint(left + (st::emojiReplaceWidth - (_esize / cIntRetinaFactor())) / 2, top + (st::emojiReplaceHeight - _blockHeight) / 2), App::emojiLarge(), QRect(j->emoji->x() * _esize, j->emoji->y() * _esize, _esize, _esize)); - } - QRect trect(left, top + (st::emojiReplaceHeight + _blockHeight) / 2 - st::emojiTextFont->height, st::emojiReplaceWidth, st::emojiTextFont->height); - p.drawText(trect, j->text, QTextOption(Qt::AlignHCenter | Qt::AlignTop)); - left += st::emojiReplaceWidth; - } - top += st::emojiReplaceHeight; - } -} diff --git a/Telegram/SourceFiles/boxes/emoji_box.h b/Telegram/SourceFiles/boxes/emoji_box.h deleted file mode 100644 index b25993cc7..000000000 --- a/Telegram/SourceFiles/boxes/emoji_box.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -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-2017 John Preston, https://desktop.telegram.org -*/ -#pragma once - -#include "boxes/abstract_box.h" - -class EmojiBox : public BoxContent { -public: - EmojiBox(QWidget*); - -protected: - void prepare() override; - - void keyPressEvent(QKeyEvent *e) override; - void paintEvent(QPaintEvent *e) override; - -private: - void fillBlocks(); - - int32 _esize; - - int32 _blockHeight; - struct Block { - Block(EmojiPtr emoji = nullptr, const QString &text = QString()) : emoji(emoji), text(text) { - } - EmojiPtr emoji; - QString text; - }; - typedef QVector BlockRow; - typedef QVector Blocks; - Blocks _blocks; - -}; diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index 90c97b70c..98779482a 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -149,13 +149,6 @@ StickersBox::StickersBox(QWidget*, Section section) _tabs->setRippleTopRoundRadius(st::boxRadius); } -StickersBox::StickersBox(QWidget*, const Stickers::Order &archivedIds) -: _section(Section::ArchivedPart) -, _archived(0, this, archivedIds) -, _aboutWidth(st::boxWideWidth - 2 * st::stickersReorderPadding.top()) -, _about(st::boxLabelStyle, lang(lng_stickers_packs_archived), _defaultOptions, _aboutWidth) { -} - StickersBox::StickersBox(QWidget*, not_null megagroup) : _section(Section::Installed) , _installed(0, this, megagroup) @@ -244,8 +237,6 @@ void StickersBox::prepare() { } } else if (_section == Section::Archived) { requestArchivedSets(); - } else if (_section == Section::ArchivedPart) { - setTitle(langFactory(lng_stickers_archived)); } if (_tabs) { if (Global::ArchivedStickerSetsOrder().isEmpty()) { @@ -259,7 +250,7 @@ void StickersBox::prepare() { } if (_installed.widget() && _section != Section::Installed) _installed.widget()->hide(); if (_featured.widget() && _section != Section::Featured) _featured.widget()->hide(); - if (_archived.widget() && _section != Section::Archived && _section != Section::ArchivedPart) _archived.widget()->hide(); + if (_archived.widget() && _section != Section::Archived) _archived.widget()->hide(); if (_featured.widget()) { _featured.widget()->setInstallSetCallback([this](uint64 setId) { installSet(setId); }); @@ -278,17 +269,13 @@ void StickersBox::prepare() { if (_section == Section::Installed) { _tab = &_installed; - } else if (_section == Section::ArchivedPart) { - _aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom(); - _titleShadow.create(this); - _tab = &_archived; } else if (_section == Section::Archived) { _tab = &_archived; } else { // _section == Section::Featured _tab = &_featured; } setInnerWidget(_tab->takeWidget(), getTopSkip()); - setDimensions(st::boxWideWidth, (_section == Section::ArchivedPart) ? st::sessionsHeight : st::boxMaxListHeight); + setDimensions(st::boxWideWidth, st::boxMaxListHeight); subscribe(Auth().data().stickersUpdated(), [this] { handleStickersUpdated(); }); Auth().api().updateStickers(); @@ -358,12 +345,6 @@ void StickersBox::paintEvent(QPaintEvent *e) { Painter p(this); - if (_aboutHeight > 0) { - p.fillRect(0, st::lineWidth, width(), _aboutHeight - st::lineWidth, st::contactsAboutBg); - p.setPen(st::stickersReorderFg); - _about.draw(p, st::stickersReorderPadding.top(), st::stickersReorderPadding.top(), _aboutWidth, style::al_center); - } - if (_slideAnimation) { _slideAnimation->paintFrame(p, 0, getTopSkip(), width(), getms()); if (!_slideAnimation->animating()) { @@ -397,7 +378,7 @@ void StickersBox::updateTabsGeometry() { } int StickersBox::getTopSkip() const { - return (_tabs ? (_tabs->height() - st::lineWidth) : 0) + _aboutHeight; + return _tabs ? (_tabs->height() - st::lineWidth) : 0; } void StickersBox::switchTab() { @@ -615,17 +596,6 @@ StickersBox::Inner::Inner(QWidget *parent, StickersBox::Section section) : TWidg setup(); } -StickersBox::Inner::Inner(QWidget *parent, const Stickers::Order &archivedIds) : TWidget(parent) -, _section(StickersBox::Section::ArchivedPart) -, _archivedIds(archivedIds) -, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) -, _a_shifting(animation(this, &Inner::step_shifting)) -, _itemsTop(st::membersMarginTop) -, _addText(lang(lng_stickers_featured_add).toUpper()) -, _addWidth(st::stickersTrendingAdd.font->width(_addText)) { - setup(); -} - StickersBox::Inner::Inner(QWidget *parent, not_null megagroup) : TWidget(parent) , _section(StickersBox::Section::Installed) , _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) @@ -1307,10 +1277,8 @@ void StickersBox::Inner::rebuild() { return Global::StickerSetsOrder(); } else if (_section == Section::Featured) { return Global::FeaturedStickerSetsOrder(); - } else if (_section == Section::Archived) { - return Global::ArchivedStickerSetsOrder(); } - return _archivedIds; + return Global::ArchivedStickerSetsOrder(); })(); _rows.reserve(order.size() + 1); _animStartTimes.reserve(order.size() + 1); diff --git a/Telegram/SourceFiles/boxes/stickers_box.h b/Telegram/SourceFiles/boxes/stickers_box.h index ba63e3f35..9323eeb90 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.h +++ b/Telegram/SourceFiles/boxes/stickers_box.h @@ -45,10 +45,8 @@ public: Installed, Featured, Archived, - ArchivedPart, }; StickersBox(QWidget*, Section section); - StickersBox(QWidget*, const Stickers::Order &archivedIds); StickersBox(QWidget*, not_null megagroup); void setInnerFocus() override; @@ -130,10 +128,6 @@ private: std::unique_ptr _slideAnimation; object_ptr _titleShadow = { nullptr }; - int _aboutWidth = 0; - Text _about; - int _aboutHeight = 0; - mtpRequestId _archivedRequestId = 0; bool _archivedLoaded = false; bool _allArchivedLoaded = false; @@ -153,7 +147,6 @@ class StickersBox::Inner : public TWidget, private base::Subscriber, private MTP public: using Section = StickersBox::Section; Inner(QWidget *parent, Section section); - Inner(QWidget *parent, const Stickers::Order &archivedIds); Inner(QWidget *parent, not_null megagroup); base::Observable scrollToY; @@ -265,7 +258,6 @@ private: int countMaxNameWidth() const; Section _section; - Stickers::Order _archivedIds; int32 _rowHeight; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index c95dea1e0..e6e6056fc 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -4267,7 +4267,7 @@ bool HistoryWidget::validateSendingFiles(const SendingFilesLists &lists, Callbac App::wnd()->activateWindow(); if (!lists.nonLocalUrls.isEmpty()) { - Ui::show(Box(lng_send_image_non_local(lt_name, lists.nonLocalUrls.front().toDisplayString()))); + Ui::show(Box(lng_send_image_empty(lt_name, lists.nonLocalUrls.front().toDisplayString()))); } else if (!lists.emptyFiles.isEmpty()) { Ui::show(Box(lng_send_image_empty(lt_name, lists.emptyFiles.front()))); } else if (!lists.tooLargeFiles.isEmpty()) { diff --git a/Telegram/SourceFiles/lang/lang_keys.h b/Telegram/SourceFiles/lang/lang_keys.h index 542e183f9..550224ecf 100644 --- a/Telegram/SourceFiles/lang/lang_keys.h +++ b/Telegram/SourceFiles/lang/lang_keys.h @@ -108,14 +108,6 @@ inline QString langDayOfWeek(const QDate &date) { return langDayOfWeek(date.dayOfWeek()); } -inline QString langDayOfWeekFull(int index) { - return (index > 0 && index <= 7) ? lang(LangKey(lng_weekday1_full + index - 1)) : qsl("DAY_ERR"); -} - -inline QString langDayOfWeekFull(const QDate &date) { - return langDayOfWeekFull(date.dayOfWeek()); -} - inline QString langDateTime(const QDateTime &date) { return lng_mediaview_date_time(lt_date, langDayOfMonth(date.date()), lt_time, date.time().toString(cTimeFormat())); } diff --git a/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp b/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp index 727132ab5..b6124ba7a 100644 --- a/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_chat_settings_widget.cpp @@ -29,7 +29,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "storage/localstorage.h" #include "mainwidget.h" #include "mainwindow.h" -#include "boxes/emoji_box.h" #include "boxes/stickers_box.h" #include "boxes/download_path_box.h" #include "boxes/connection_box.h" @@ -154,12 +153,7 @@ void ChatSettingsWidget::createControls() { style::margins marginSub(0, 0, 0, st::settingsSubSkip); style::margins slidedPadding(0, marginSub.bottom() / 2, 0, marginSub.bottom() - (marginSub.bottom() / 2)); - addChildRow(_replaceEmoji, marginSub, lang(lng_settings_replace_emojis), [this](bool) { onReplaceEmoji(); }, cReplaceEmojis()); - style::margins marginList(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip); - addChildRow(_viewList, marginList, slidedPadding, lang(lng_settings_view_emojis), SLOT(onViewList()), st::defaultLinkButton); -// if (!cReplaceEmojis()) { - _viewList->hideFast(); -// } + addChildRow(_replaceEmoji, marginSkip, lang(lng_settings_replace_emojis), [this](bool) { onReplaceEmoji(); }, cReplaceEmojis()); #ifndef OS_WIN_STORE auto pathMargin = marginSub; @@ -190,12 +184,6 @@ void ChatSettingsWidget::createControls() { void ChatSettingsWidget::onReplaceEmoji() { cSetReplaceEmojis(_replaceEmoji->checked()); Local::writeUserSettings(); - - //_viewList->toggleAnimated(_replaceEmoji->checked()); -} - -void ChatSettingsWidget::onViewList() { - Ui::show(Box()); } void ChatSettingsWidget::onDontAskDownloadPath() { diff --git a/Telegram/SourceFiles/settings/settings_chat_settings_widget.h b/Telegram/SourceFiles/settings/settings_chat_settings_widget.h index d7e4f9d5d..6357e0b27 100644 --- a/Telegram/SourceFiles/settings/settings_chat_settings_widget.h +++ b/Telegram/SourceFiles/settings/settings_chat_settings_widget.h @@ -94,7 +94,6 @@ public: private slots: void onReplaceEmoji(); - void onViewList(); void onDontAskDownloadPath(); void onAutomaticMediaDownloadSettings(); void onManageStickerSets(); @@ -108,7 +107,6 @@ private: void createControls(); object_ptr _replaceEmoji = { nullptr }; - object_ptr> _viewList = { nullptr }; object_ptr _dontAskDownloadPath = { nullptr }; #ifndef OS_WIN_STORE diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index ef66965f6..fd17f0ea3 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -55,8 +55,6 @@ <(src_loc)/boxes/edit_participant_box.h <(src_loc)/boxes/edit_privacy_box.cpp <(src_loc)/boxes/edit_privacy_box.h -<(src_loc)/boxes/emoji_box.cpp -<(src_loc)/boxes/emoji_box.h <(src_loc)/boxes/language_box.cpp <(src_loc)/boxes/language_box.h <(src_loc)/boxes/local_storage_box.cpp