diff --git a/Telegram/SourceFiles/_other/genstyles.cpp b/Telegram/SourceFiles/_other/genstyles.cpp index cad91743a..1a16cdd62 100644 --- a/Telegram/SourceFiles/_other/genstyles.cpp +++ b/Telegram/SourceFiles/_other/genstyles.cpp @@ -609,17 +609,7 @@ ScalarValue prepareColor(int variant, const string &name, const string &token) { result.reserve(20); int r = hexDec(token[0], token[1]), g = hexDec(token[2], token[3]), b = hexDec(token[4], token[5]), a = hexDec(token[6], token[7]); - if (a == 255) { - Color c; - c.color = QString("%1, %2, %3, 255").arg(r).arg(g).arg(b).toUtf8().constData(); - colors[variant][name] = c; - if (!variant) { - for (int i = 1; i < variantsCount; ++i) { - colors[variants[i]][name] = c; - } - } - return fillPrepareResult(variant, "(Qt::Uninitialized)"); - } + Color c; c.color = QString("%1, %2, %3, %4").arg(r).arg(g).arg(b).arg(a).toUtf8().constData(); colors[variant][name] = c; diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index 910243ea0..fcd6b5e1d 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -404,7 +404,7 @@ void PinMessageBox::onPin() { if (_requestId) return; MTPchannels_UpdatePinnedMessage::Flags flags = 0; - if (_notify.checked()) { + if (!_notify.checked()) { flags |= MTPchannels_UpdatePinnedMessage::Flag::f_silent; } _requestId = MTP::send(MTPchannels_UpdatePinnedMessage(MTP_flags(flags), _channel->inputChannel, MTP_int(_msgId)), rpcDone(&PinMessageBox::pinDone), rpcFail(&PinMessageBox::pinFail)); diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index db8d48770..359dda896 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -20,10 +20,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 9043; -static const wchar_t *AppVersionStr = L"0.9.43"; -static const bool DevVersion = true; -//#define BETA_VERSION (9040128ULL) // just comment this line to build public version +static const int32 AppVersion = 9044; +static const wchar_t *AppVersionStr = L"0.9.44"; +static const bool DevVersion = false; +//#define BETA_VERSION (9044000ULL) // just comment this line to build public version static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppName = L"Telegram Desktop"; diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index ceae67a46..29bc777c1 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -2552,7 +2552,15 @@ void EmojiPanel::updateText() { availw -= st::notifyClose.icon.pxWidth() + st::emojiPanHeaderLeft; } } else { - QString switchText = lang((_setId != Stickers::NoneSetId) ? lng_switch_emoji : (cSavedGifs().isEmpty() ? lng_switch_stickers : lng_switch_stickers_gifs)); + auto switchText = ([this]() { + if (_setId != Stickers::NoneSetId) { + return lang(lng_switch_emoji); + } + if (cSavedGifs().isEmpty()) { + return lang(lng_switch_stickers); + } + return lang(lng_switch_stickers_gifs); + })(); availw -= st::emojiSwitchSkip + st::emojiPanHeaderFont->width(switchText); } _text = st::emojiPanHeaderFont->elided(_fullText, availw); @@ -2719,10 +2727,10 @@ EmojiPan::EmojiPan(QWidget *parent) : TWidget(parent) connect(&e_inner, SIGNAL(disableScroll(bool)), &e_scroll, SLOT(disableScroll(bool))); connect(&s_inner, SIGNAL(scrollToY(int)), &s_scroll, SLOT(scrollToY(int))); - connect(&s_inner, SIGNAL(scrollUpdated()), this, SLOT(onScroll())); + connect(&s_inner, SIGNAL(scrollUpdated()), this, SLOT(onScrollStickers())); - connect(&e_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); - connect(&s_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); + connect(&e_scroll, SIGNAL(scrolled()), this, SLOT(onScrollEmoji())); + connect(&s_scroll, SIGNAL(scrolled()), this, SLOT(onScrollStickers())); connect(&e_inner, SIGNAL(selected(EmojiPtr)), this, SIGNAL(emojiSelected(EmojiPtr))); connect(&s_inner, SIGNAL(selected(DocumentData*)), this, SIGNAL(stickerSelected(DocumentData*))); @@ -3503,39 +3511,42 @@ void EmojiPan::updatePanelsPositions(const QVector &panel } } -void EmojiPan::onScroll() { - int st = e_scroll.scrollTop(); - if (!_stickersShown) { - updatePanelsPositions(e_panels, st); +void EmojiPan::onScrollEmoji() { + auto st = e_scroll.scrollTop(); - DBIEmojiTab tab = e_inner.currentTab(st); - FlatRadiobutton *check = 0; - switch (tab) { - case dbietRecent : check = &_recent ; break; - case dbietPeople : check = &_people ; break; - case dbietNature : check = &_nature ; break; - case dbietFood : check = &_food ; break; - case dbietActivity: check = &_activity; break; - case dbietTravel : check = &_travel ; break; - case dbietObjects : check = &_objects ; break; - case dbietSymbols : check = &_symbols ; break; - } - if (check && !check->checked()) { - _noTabUpdate = true; - check->setChecked(true); - _noTabUpdate = false; - } + updatePanelsPositions(e_panels, st); + + auto tab = e_inner.currentTab(st); + FlatRadiobutton *check = nullptr; + switch (tab) { + case dbietRecent: check = &_recent; break; + case dbietPeople: check = &_people; break; + case dbietNature: check = &_nature; break; + case dbietFood: check = &_food; break; + case dbietActivity: check = &_activity; break; + case dbietTravel: check = &_travel; break; + case dbietObjects: check = &_objects; break; + case dbietSymbols: check = &_symbols; break; } + if (check && !check->checked()) { + _noTabUpdate = true; + check->setChecked(true); + _noTabUpdate = false; + } + e_inner.setScrollTop(st); +} - st = s_scroll.scrollTop(); - if (_stickersShown) { - updatePanelsPositions(s_panels, st); - validateSelectedIcon(true); - if (st + s_scroll.height() > s_scroll.scrollTopMax()) { - onInlineRequest(); - } +void EmojiPan::onScrollStickers() { + auto st = s_scroll.scrollTop(); + + updatePanelsPositions(s_panels, st); + + validateSelectedIcon(true); + if (st + s_scroll.height() > s_scroll.scrollTopMax()) { + onInlineRequest(); } + s_inner.setScrollTop(st); } @@ -3699,7 +3710,7 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) { _inlineRequestId = 0; Notify::inlineBotRequesting(false); - InlineCache::iterator it = _inlineCache.find(_inlineQuery); + auto it = _inlineCache.find(_inlineQuery); bool adding = (it != _inlineCache.cend()); if (result.type() == mtpc_messages_botResults) { @@ -3738,7 +3749,7 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) { if (!showInlineRows(!adding)) { it.value()->nextOffset = QString(); } - onScroll(); + onScrollStickers(); } bool EmojiPan::inlineResultsFail(const RPCError &error) { @@ -3771,7 +3782,7 @@ void EmojiPan::queryInlineBot(UserData *bot, PeerData *peer, QString query) { } if (_inlineCache.contains(query)) { _inlineRequestTimer.stop(); - _inlineQuery = query; + _inlineQuery = _inlineNextQuery = query; showInlineRows(true); } else { _inlineNextQuery = query; @@ -3798,6 +3809,7 @@ void EmojiPan::onInlineRequest() { void EmojiPan::onEmptyInlineRows() { if (_shownFromInlineQuery || hideOnNoInlineResults()) { hideAnimated(); + s_inner.clearInlineRowsPanel(); } else if (!_inlineBot) { s_inner.hideInlineRowsPanel(); } else { @@ -3825,7 +3837,7 @@ int32 EmojiPan::showInlineRows(bool newResults) { bool clear = !refreshInlineRows(&added); if (newResults) s_scroll.scrollToY(0); - e_switch.updateText(clear ? QString() : _inlineBot->username); + e_switch.updateText(s_inner.inlineResultsShown() ? _inlineBot->username : QString()); e_switch.moveToRight(0, 0, st::emojiPanWidth); bool hidden = isHidden(); diff --git a/Telegram/SourceFiles/dropdown.h b/Telegram/SourceFiles/dropdown.h index ba8eb213e..ed7fce885 100644 --- a/Telegram/SourceFiles/dropdown.h +++ b/Telegram/SourceFiles/dropdown.h @@ -629,7 +629,8 @@ public slots: void onWndActiveChanged(); void onTabChange(); - void onScroll(); + void onScrollEmoji(); + void onScrollStickers(); void onSwitch(); void onRemoveSet(quint64 setId); diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 4932f1887..54b3a7990 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -88,8 +88,16 @@ void activateBotCommand(const HistoryItem *msg, int row, int col) { } break; case HistoryMessageReplyMarkup::Button::SwitchInline: { - if (MainWidget *m = App::main()) { - if (UserData *bot = msg->history()->peer->asUser()) { + if (auto m = App::main()) { + auto getMessageBot = [msg]() -> UserData* { + if (auto bot = msg->viaBot()) { + return bot; + } else if (auto bot = msg->history()->peer->asUser()) { + return bot; + } + return nullptr; + }; + if (auto bot = getMessageBot()) { auto tryFastSwitch = [bot, &button]() -> bool { if (bot->botInfo && bot->botInfo->inlineReturnPeerId) { if (Notify::switchInlineBotButtonReceived(QString::fromUtf8(button->data))) { diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 7765dd6a2..de11508b2 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -4979,7 +4979,7 @@ ImagePtr HistoryGif::replyPreview() { bool HistoryGif::playInline(bool autoplay) { if (gif()) { stopInline(); - } else { + } else if (_data->loaded(DocumentData::FilePathResolveChecked)) { if (!cAutoPlayGif()) { App::stopGifItems(); } @@ -7635,12 +7635,15 @@ int HistoryMessage::performResizeGetHeight(int width) { } if (reply) { + int32 l = 0, w = 0; + countPositionAndSize(l, w); + if (emptyText() && !displayFromName() && !Has()) { _height += st::msgPadding.top() + st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaHeaderSkip; } else { _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); } - reply->resize(width - st::msgPadding.left() - st::msgPadding.right()); + reply->resize(w - st::msgPadding.left() - st::msgPadding.right()); } } else { _height = _media->resizeGetHeight(width); diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 81314ee64..cec615af9 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -1658,6 +1658,9 @@ public: virtual bool isDisplayed() const { return true; } + virtual bool hasTextForCopy() const { + return false; + } virtual void initDimensions() = 0; virtual int resizeGetHeight(int width) { _width = qMin(width, _maxw); @@ -1878,6 +1881,9 @@ public: TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override { return _caption.adjustSelection(selection, type); } + bool hasTextForCopy() const override { + return !_caption.isEmpty(); + } QString inDialogsText() const override; QString selectedText(TextSelection selection) const override; @@ -1955,6 +1961,9 @@ public: TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override { return _caption.adjustSelection(selection, type); } + bool hasTextForCopy() const override { + return !_caption.isEmpty(); + } QString inDialogsText() const override; QString selectedText(TextSelection selection) const override; @@ -2075,6 +2084,9 @@ public: } return selection; } + bool hasTextForCopy() const override { + return Has(); + } QString inDialogsText() const override; QString selectedText(TextSelection selection) const override; @@ -2159,6 +2171,9 @@ public: TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override { return _caption.adjustSelection(selection, type); } + bool hasTextForCopy() const override { + return !_caption.isEmpty(); + } QString inDialogsText() const override; QString selectedText(TextSelection selection) const override; @@ -2384,6 +2399,9 @@ public: HistoryTextState getState(int x, int y, HistoryStateRequest request) const override; TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override; + bool hasTextForCopy() const override { + return false; // we do not add _title and _description in FullSelection text copy. + } bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override { return _attach && _attach->toggleSelectionByHandlerClick(p); @@ -2515,6 +2533,9 @@ public: HistoryTextState getState(int x, int y, HistoryStateRequest request) const override; TextSelection adjustSelection(TextSelection selection, TextSelectType type) const override; + bool hasTextForCopy() const override { + return !_title.isEmpty() || !_description.isEmpty(); + } bool toggleSelectionByHandlerClick(const ClickHandlerPtr &p) const override { return p == _link; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 59c6ae8ec..181b72cd2 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -1037,7 +1037,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } } if (item && !isUponSelected) { - if (HistoryMedia *media = (msg ? msg->getMedia() : 0)) { + bool mediaHasTextForCopy = false; + if (HistoryMedia *media = (msg ? msg->getMedia() : nullptr)) { + mediaHasTextForCopy = media->hasTextForCopy(); if (media->type() == MediaTypeWebPage && static_cast(media)->attach()) { media = static_cast(media)->attach(); } @@ -1065,8 +1067,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } } } - QString contextMenuText = item->selectedText(FullSelection); - if (!contextMenuText.isEmpty() && msg && !msg->getMedia()) { + if (msg && (!msg->emptyText() || mediaHasTextForCopy)) { _menu->addAction(lang(lng_context_copy_text), this, SLOT(copyContextText()))->setEnabled(true); } } diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index f2a400335..79f3fa3bd 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.43 + 0.9.44 CFBundleSignature ???? CFBundleURLTypes diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index d5dcb3d74..0b4ce89d7 100644 --- a/Telegram/Telegram.rc +++ b/Telegram/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "Resources\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,43,0 - PRODUCTVERSION 0,9,43,0 + FILEVERSION 0,9,44,0 + PRODUCTVERSION 0,9,44,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.43.0" + VALUE "FileVersion", "0.9.44.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.43.0" + VALUE "ProductVersion", "0.9.44.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index ea7cbc981..58f93ee0d 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -1823,7 +1823,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.43; + CURRENT_PROJECT_VERSION = 0.9.44; DEBUG_INFORMATION_FORMAT = dwarf; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -1842,7 +1842,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 0.9.43; + CURRENT_PROJECT_VERSION = 0.9.44; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = fast; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; @@ -1871,10 +1871,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.43; + CURRENT_PROJECT_VERSION = 0.9.44; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.43; + DYLIB_CURRENT_VERSION = 0.9.44; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -2011,10 +2011,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.43; + CURRENT_PROJECT_VERSION = 0.9.44; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.43; + DYLIB_CURRENT_VERSION = 0.9.44; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; diff --git a/Telegram/Version b/Telegram/Version index 07086bb01..589e72d56 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -1,6 +1,6 @@ -AppVersion 9043 +AppVersion 9044 AppVersionStrMajor 0.9 -AppVersionStrSmall 0.9.43 -AppVersionStr 0.9.43 -DevChannel 1 +AppVersionStrSmall 0.9.44 +AppVersionStr 0.9.44 +DevChannel 0 BetaVersion 0