From 73a8d27bfd1a48a3ee8396a8a41dbace07ebe2a8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 29 Sep 2016 12:10:32 +0300 Subject: [PATCH] You scored phrase for game service messages. Game layout bug fix. --- Telegram/Resources/langs/lang.strings | 3 ++- .../SourceFiles/history/history_media_types.cpp | 3 ++- Telegram/SourceFiles/history/history_message.cpp | 14 +++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index d36c93ffc2..6e40e9452d 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -581,8 +581,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_action_pinned_media_location" = "a location mark"; "lng_action_pinned_media_sticker" = "a sticker"; "lng_action_pinned_media_emoji_sticker" = "a {emoji} sticker"; -"lng_action_pinned_media_game" = "a game «{game}»"; +"lng_action_pinned_media_game" = "the game «{game}»"; "lng_action_game_score" = "{from} scored {count:#|#|#} in {game}"; +"lng_action_game_you_scored" = "You scored {count:#|#|#} in {game}"; "lng_profile_migrate_reached" = "{count:_not_used_|# member|# members} limit reached"; "lng_profile_migrate_body" = "To get over this limit, you can upgrade your group to a supergroup."; diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index a6816c6c3c..10c39c5468 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -2959,7 +2959,8 @@ void HistoryGame::initDimensions() { _minh = 0; int32 titleMinHeight = _title.isEmpty() ? 0 : _lineHeight; - int32 descMaxLines = (4 + (titleMinHeight ? 0 : 1)); + // enable any count of lines in game description / message + int descMaxLines = 4096; int32 descriptionMinHeight = _description.isEmpty() ? 0 : qMin(_description.minHeight(), descMaxLines * _lineHeight); if (!_title.isEmpty()) { diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index cf0894118e..88f0ba908b 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -1968,7 +1968,7 @@ bool HistoryService::preparePinnedText(const QString &from, QString *outText, Li bool HistoryService::prepareGameScoreText(const QString &from, QString *outText, Links *outLinks) { bool result = false; - QString text; + QString gameTitle; ClickHandlerPtr second; auto gamescore = Get(); @@ -1981,15 +1981,19 @@ bool HistoryService::prepareGameScoreText(const QString &from, QString *outText, } return lang(lng_deleted_message); }; - text = lng_action_game_score(lt_from, from, lt_count, gamescore->score, lt_game, getGameTitle()); + gameTitle = getGameTitle(); result = true; } else if (gamescore && gamescore->msgId) { - text = lng_action_game_score(lt_from, from, lt_count, gamescore->score, lt_game, lang(lng_contacts_loading)); + gameTitle = lang(lng_contacts_loading); result = true; } else { - text = lng_action_game_score(lt_from, from, lt_count, gamescore->score, lt_game, lang(lng_deleted_message)); + gameTitle = lang(lng_deleted_message); + } + if (_from->isSelf()) { + *outText = lng_action_game_you_scored(lt_count, gamescore->score, lt_game, gameTitle); + } else { + *outText = lng_action_game_score(lt_from, from, lt_count, gamescore->score, lt_game, gameTitle); } - *outText = text; if (second) { outLinks->push_back(second); }