From f4d159b2f094e3d7e3416662366870a59ffac679 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 5 Jan 2016 12:28:06 +0800 Subject: [PATCH] version 0.9.18: crashfix + fix of transparent gifs sending --- Telegram/SourceFiles/config.h | 4 ++-- Telegram/SourceFiles/dropdown.cpp | 13 ++++++------- Telegram/SourceFiles/gui/animation.cpp | 21 ++++++++++++++------- Telegram/SourceFiles/history.cpp | 2 +- Telegram/SourceFiles/localimageloader.cpp | 10 ++++++---- Telegram/Telegram.plist | 2 +- Telegram/Telegram.rc | 8 ++++---- Telegram/Telegram.xcodeproj/project.pbxproj | 12 ++++++------ Telegram/Version | 6 +++--- 9 files changed, 43 insertions(+), 35 deletions(-) diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index c3ebc74865..ceef089c4b 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -20,8 +20,8 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 9017; -static const wchar_t *AppVersionStr = L"0.9.17"; +static const int32 AppVersion = 9018; +static const wchar_t *AppVersionStr = L"0.9.18"; static const bool DevVersion = false; //#define BETA_VERSION (9015008ULL) // just comment this line to build public version diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index 87d9fd97b2..faa204bfb5 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -1912,9 +1912,7 @@ int32 StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &res return 0; } - if (_showingInlineItems) { - clearSelection(true); - } + clearSelection(true); t_assert(_inlineBot != 0); _inlineBotTitle = lng_inline_bot_results(lt_inline_bot, _inlineBot->username.isEmpty() ? _inlineBot->name : ('@' + _inlineBot->username)); @@ -1942,10 +1940,9 @@ int32 StickerPanInner::refreshInlineRows(UserData *bot, const InlineResults &res update(); emit refreshIcons(); - if (_showingInlineItems) { - _lastMousePos = QCursor::pos(); - updateSelected(); - } + + _lastMousePos = QCursor::pos(); + updateSelected(); return added; } @@ -2440,10 +2437,12 @@ void StickerPanInner::showStickerSet(uint64 setId) { void StickerPanInner::updateShowingSavedGifs() { if (cShowingSavedGifs()) { if (!_showingInlineItems) { + clearSelection(true); _showingSavedGifs = _showingInlineItems = true; if (_inlineRows.isEmpty()) refreshSavedGifs(); } } else if (!_showingInlineItems) { + clearSelection(true); _showingSavedGifs = false; } } diff --git a/Telegram/SourceFiles/gui/animation.cpp b/Telegram/SourceFiles/gui/animation.cpp index ee49bb92c1..e096845cde 100644 --- a/Telegram/SourceFiles/gui/animation.cpp +++ b/Telegram/SourceFiles/gui/animation.cpp @@ -189,18 +189,25 @@ QPixmap _prepareFrame(const ClipFrameRequest &request, const QImage &original, b bool needOuter = (request.outerw != request.framew) || (request.outerh != request.frameh); if (badSize || needOuter || hasAlpha || request.rounded) { int32 factor(request.factor); - bool fill = false; - if (cache.width() != request.outerw || cache.height() != request.outerh) { + bool newcache = (cache.width() != request.outerw || cache.height() != request.outerh); + if (newcache) { cache = QImage(request.outerw, request.outerh, QImage::Format_ARGB32_Premultiplied); - if (request.framew < request.outerw || request.frameh < request.outerh || hasAlpha) { - fill = true; - } cache.setDevicePixelRatio(factor); } { Painter p(&cache); - if (fill) { - p.fillRect(0, 0, cache.width() / factor, cache.height() / factor, st::black); + if (newcache) { + if (request.framew < request.outerw) { + p.fillRect(0, 0, (request.outerw - request.framew) / (2 * factor), cache.height() / factor, st::black); + p.fillRect((request.outerw - request.framew) / (2 * factor) + (request.framew / factor), 0, (cache.width() / factor) - ((request.outerw - request.framew) / (2 * factor) + (request.framew / factor)), cache.height() / factor, st::black); + } + if (request.frameh < request.outerh) { + p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), 0, qMin(cache.width(), request.framew) / factor, (request.outerh - request.frameh) / (2 * factor), st::black); + p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), (request.outerh - request.frameh) / (2 * factor) + (request.frameh / factor), qMin(cache.width(), request.framew) / factor, (cache.height() / factor) - ((request.outerh - request.frameh) / (2 * factor) + (request.frameh / factor)), st::black); + } + } + if (hasAlpha) { + p.fillRect(qMax(0, (request.outerw - request.framew) / (2 * factor)), qMax(0, (request.outerh - request.frameh) / (2 * factor)), qMin(cache.width(), request.framew) / factor, qMin(cache.height(), request.frameh) / factor, st::white); } QPoint position((request.outerw - request.framew) / (2 * factor), (request.outerh - request.frameh) / (2 * factor)); if (badSize) { diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index 8adc6896bc..aee3391aa8 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -4575,7 +4575,7 @@ void HistoryGif::draw(Painter &p, const HistoryItem *parent, const QRect &r, boo if (_data->loaded() && !radial) { icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); } else if (radial || _data->loading()) { - if (parent->id > 0) { + if (parent->id > 0 || _data->uploading()) { icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); } } else { diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index e2596a7c2b..3b1f8d797a 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -135,7 +135,7 @@ TaskQueue::~TaskQueue() { void TaskQueueWorker::onTaskAdded() { if (_inTaskAdded) return; _inTaskAdded = true; - + bool someTasksLeft = false; do { TaskPtr task; @@ -326,7 +326,7 @@ void FileLoadTask::process() { } } } - if (filemime == qstr("video/mp4") || filename.endsWith(qstr(".mp4"), Qt::CaseInsensitive)) { + if (filemime == qstr("video/mp4") || filename.endsWith(qstr(".mp4"), Qt::CaseInsensitive) || animated) { QImage cover; MTPDocumentAttribute animatedAttribute = clipReadAnimatedAttributes(_filepath, _content, cover); if (animatedAttribute.type() == mtpc_documentAttributeVideo) { @@ -350,7 +350,9 @@ void FileLoadTask::process() { thumbId = MTP::nonce(); - filemime = qstr("video/mp4"); + if (filename.endsWith(qstr(".mp4"), Qt::CaseInsensitive)) { + filemime = qstr("video/mp4"); + } } } } @@ -414,7 +416,7 @@ void FileLoadTask::process() { _type = PrepareDocument; } } - + _result->type = _type; _result->filepath = _filepath; _result->content = _content; diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index 1ce05ba2a3..f6bb209621 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.17 + 0.9.18 CFBundleSignature ???? CFBundleURLTypes diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index b4ef2e97d9..c7e7c48bd9 100644 --- a/Telegram/Telegram.rc +++ b/Telegram/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,17,0 - PRODUCTVERSION 0,9,17,0 + FILEVERSION 0,9,18,0 + PRODUCTVERSION 0,9,18,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.17.0" + VALUE "FileVersion", "0.9.18.0" VALUE "LegalCopyright", "Copyright (C) 2013" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.17.0" + VALUE "ProductVersion", "0.9.18.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index 6716e5cc2a..cd6cc53379 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -1701,7 +1701,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.17; + CURRENT_PROJECT_VERSION = 0.9.18; DEBUG_INFORMATION_FORMAT = dwarf; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -1720,7 +1720,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 0.9.17; + CURRENT_PROJECT_VERSION = 0.9.18; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = fast; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; @@ -1747,10 +1747,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.17; + CURRENT_PROJECT_VERSION = 0.9.18; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.17; + DYLIB_CURRENT_VERSION = 0.9.18; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -1882,10 +1882,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.17; + CURRENT_PROJECT_VERSION = 0.9.18; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.17; + DYLIB_CURRENT_VERSION = 0.9.18; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; diff --git a/Telegram/Version b/Telegram/Version index 38e8f55ba2..cbec672c63 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -1,6 +1,6 @@ -AppVersion 9017 +AppVersion 9018 AppVersionStrMajor 0.9 -AppVersionStrSmall 0.9.17 -AppVersionStr 0.9.17 +AppVersionStrSmall 0.9.18 +AppVersionStr 0.9.18 DevChannel 0 BetaVersion 0 9015008