From e2cdb8a9ed01124a516adf766e44ab4aceaf9384 Mon Sep 17 00:00:00 2001 From: Christoph Auer <auer.christoph@outlook.at> Date: Thu, 16 Feb 2017 10:35:50 +0100 Subject: [PATCH 1/5] Fix zlib download link --- doc/building-msvc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/building-msvc.md b/doc/building-msvc.md index ca1e49160..f49fa869c 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -86,7 +86,7 @@ Extract to **D:\\TBuild\\Libraries** ### zlib 1.2.8 -http://www.zlib.net/ > Download [**zlib source code, version 1.2.8, zipfile format**](http://zlib.net/zlib128.zip) +http://www.zlib.net/fossils/ > Download [zlib-1.2.8.tar.gz](http://www.zlib.net/fossils/zlib-1.2.8.tar.gz) Extract to **D:\\TBuild\\Libraries** From 5ac51efb3e5ef0ad5d090d84e995a461178cc7b6 Mon Sep 17 00:00:00 2001 From: Christoph <auchri@users.noreply.github.com> Date: Thu, 16 Feb 2017 11:57:53 +0100 Subject: [PATCH 2/5] Fix breakpad installation on windows --- doc/building-msvc.md | 84 ++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/doc/building-msvc.md b/doc/building-msvc.md index f49fa869c..64d0c7b0c 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -1,30 +1,35 @@ # Build instructions for Visual Studio 2015 - * [Prepare folder](#prepare-folder) - * [Clone source code](#clone-source-code) - * [Prepare libraries](#prepare-libraries) - + [OpenSSL](#openssl) - + [LZMA SDK 9.20](#lzma-sdk-920) - - [Building library](#building-library) - + [zlib 1.2.8](#zlib-128) - - [Building library](#building-library-1) - + [libexif 0.6.20](#libexif-0620) - - [Building library](#building-library-2) - + [OpenAL Soft, slightly patched](#openal-soft-slightly-patched) - - [Building library](#building-library-3) - + [Opus codec](#opus-codec) - - [Building libraries](#building-libraries) - + [FFmpeg](#ffmpeg) - - [Building libraries](#building-libraries-1) - + [Qt 5.6.2, slightly patched](#qt-560-slightly-patched) - - [Apply the patch](#apply-the-patch) - - [Install Windows SDKs](#install-windows-sdks) - - [Building library](#building-library-4) - + [Qt5Package](#qt5package) - + [Google Breakpad](#google-breakpad) - - [Install](#install) - - [Build](#build) - * [Building Telegram Desktop](#building-telegram-desktop) +- [Prepare folder](#prepare-folder) +- [Clone source code](#clone-source-code) +- [Prepare libraries](#prepare-libraries) + * [OpenSSL](#openssl) + * [LZMA SDK 9.20](#lzma-sdk-920) + + [Building library](#building-library) + * [zlib 1.2.8](#zlib-128) + + [Building library](#building-library-1) + * [libexif 0.6.20](#libexif-0620) + + [Building library](#building-library-2) + * [OpenAL Soft, slightly patched](#openal-soft-slightly-patched) + + [Building library](#building-library-3) + * [Opus codec](#opus-codec) + + [Building libraries](#building-libraries) + * [FFmpeg](#ffmpeg) + + [Building libraries](#building-libraries-1) + * [Qt 5.6.2, slightly patched](#qt-562-slightly-patched) + + [Apply the patch](#apply-the-patch) + + [Install Windows SDKs](#install-windows-sdks) + + [Building library](#building-library-4) + * [Qt5Package](#qt5package) + * [Google Breakpad](#google-breakpad) + + [Installation](#installation) + - [depot_tools](#depot_tools) + - [Breakpad](#breakpad) + + [Build](#build) +- [Building Telegram Desktop](#building-telegram-desktop) + + [Setup GYP/Ninja and generate VS solution](#setup-gypninja-and-generate-vs-solution) + + [Configure VS](#configure-vs) + + [Build the project](#build-the-project) ## Prepare folder @@ -222,28 +227,37 @@ Download, close all VS2015 instances and install for VS2015 Breakpad is a set of client and server components which implement a crash-reporting system. -#### Install +#### Installation -* Install Python 2.7.12 from https://www.python.org/downloads/release/python-2712/ > [**Windows x86 MSI installer**](https://www.python.org/ftp/python/2.7.12/python-2.7.12.msi). Make sure that python is added to your `PATH` (there is an option for this in the python installer). -* Go to **D:\\TBuild\\Libraries** and run +##### depot_tools -<!-- --> +Go to `D:\TBuild\Libraries` and run git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git cd depot_tools - gclient config "https://chromium.googlesource.com/breakpad/breakpad.git" - gclient sync + gclient + +If you get errors like + + Cannot rebase: You have unstaged changes. + Please commit or stash them. + Failed to update depot_tools. + +run `git reset --hard HEAD` and execute `gclient` again + +##### Breakpad + cd .. - md breakpad && cd breakpad + mkdir breakpad && cd breakpad ..\depot_tools\fetch breakpad ..\depot_tools\gclient sync xcopy src\src\* src /s /i #### Build -* Open in VS2015 **D:\\TBuild\\Libraries\\breakpad\\src\\client\\windows\\breakpad_client.sln** -* Change "Treat WChar_t As Built in Type" to "No" in all projects & configurations (should be in project>>properties>>C/C++>>Language) -* Change "Treat Warnings As Errors" to "No" in all projects & configurations (should be in project>>properties>>C/C++>>General) +* Open `D:\TBuild\Libraries\breakpad\src\client\windows\breakpad_client.sln` in VS2015 +* Change `Treat WChar_t As Built in Type` to `No` in all projects & configurations (should be in Project -> Properties -> C/C++ -> Language) +* Change `Treat Warnings As Errors` to `No` in all projects & configurations (should be in Project -> Properties -> C/C++ -> General) * Build Debug configuration * Build Release configuration From e071e2cf6fb5ca31de605212d15ee47789fd849a Mon Sep 17 00:00:00 2001 From: Christoph <auchri@users.noreply.github.com> Date: Fri, 17 Feb 2017 13:28:29 +0100 Subject: [PATCH 3/5] Remove duplicated src folder of breakpad [ci skip] --- doc/building-msvc.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/building-msvc.md b/doc/building-msvc.md index 64d0c7b0c..848e5a826 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -252,6 +252,7 @@ run `git reset --hard HEAD` and execute `gclient` again ..\depot_tools\fetch breakpad ..\depot_tools\gclient sync xcopy src\src\* src /s /i + rmdir src\src /s /q #### Build From 54c409d967f9e823afdb8d9f94d775074c284aa0 Mon Sep 17 00:00:00 2001 From: Behnam Emamian <emamian@persianprocess.com> Date: Fri, 17 Feb 2017 23:50:27 +1100 Subject: [PATCH 4/5] Use external video player by hidden setting (#3021) Signed-off-by: Behnam Emamian <emamian@persianprocess.com> (github: BehnamEmamian) --- Telegram/SourceFiles/localstorage.cpp | 10 ++++++++++ Telegram/SourceFiles/settings.cpp | 1 + Telegram/SourceFiles/settings.h | 1 + Telegram/SourceFiles/settings/settings_widget.cpp | 8 ++++++++ Telegram/SourceFiles/window/main_window.cpp | 12 ++++++++---- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index 928ffed1d..4be868571 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -559,6 +559,7 @@ enum { dbiNotificationsCorner = 0x46, dbiTheme = 0x47, dbiDialogsWidthRatio = 0x48, + dbiUseExternalVideoPlayer = 0x49, dbiEncryptedWithSalt = 333, dbiEncrypted = 444, @@ -928,6 +929,14 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version) { cSetSendToMenu(v == 1); } break; + case dbiUseExternalVideoPlayer: { + qint32 v; + stream >> v; + if (!_checkStreamStatus(stream)) return false; + + cSetUseExternalVideoPlayer(v == 1); + } break; + case dbiSoundNotify: { qint32 v; stream >> v; @@ -1656,6 +1665,7 @@ void _writeUserSettings() { data.stream << quint32(dbiModerateMode) << qint32(Global::ModerateModeEnabled() ? 1 : 0); data.stream << quint32(dbiAutoPlay) << qint32(cAutoPlayGif() ? 1 : 0); data.stream << quint32(dbiDialogsWidthRatio) << qint32(snap(qRound(Global::DialogsWidthRatio() * 1000000), 0, 1000000)); + data.stream << quint32(dbiUseExternalVideoPlayer) << qint32(cUseExternalVideoPlayer()); { RecentEmojisPreload v(cRecentEmojisPreload()); diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index eebfbc1b6..5d1a59c7d 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -51,6 +51,7 @@ bool gStartMinimized = false; bool gStartInTray = false; bool gAutoStart = false; bool gSendToMenu = false; +bool gUseExternalVideoPlayer = false; bool gAutoUpdate = true; TWindowPos gWindowPos; LaunchMode gLaunchMode = LaunchModeNormal; diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index 2801d48b1..afacd7025 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -69,6 +69,7 @@ DeclareSetting(bool, AutoStart); DeclareSetting(bool, StartMinimized); DeclareSetting(bool, StartInTray); DeclareSetting(bool, SendToMenu); +DeclareSetting(bool, UseExternalVideoPlayer); enum LaunchMode { LaunchModeNormal = 0, LaunchModeAutoStart, diff --git a/Telegram/SourceFiles/settings/settings_widget.cpp b/Telegram/SourceFiles/settings/settings_widget.cpp index 6db50f88e..f107776f5 100644 --- a/Telegram/SourceFiles/settings/settings_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_widget.cpp @@ -88,6 +88,14 @@ void fillCodes() { main->getDifference(); } }); + Codes.insert(qsl("videoplayer"), []() { + auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?"); + Ui::show(Box<ConfirmBox>(text, [] { + cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer()); + Local::writeUserSettings(); + Ui::hideLayer(); + })); + }); } void codesFeedString(const QString &text) { diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 11a64eed3..5881928ad 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -99,10 +99,14 @@ void MainWindow::showPhoto(PhotoData *photo, PeerData *peer) { } void MainWindow::showDocument(DocumentData *doc, HistoryItem *item) { - if (_mediaView->isHidden()) Ui::hideLayer(true); - _mediaView->showDocument(doc, item); - _mediaView->activateWindow(); - _mediaView->setFocus(); + if (cUseExternalVideoPlayer() && doc->isVideo()) { + QDesktopServices::openUrl(QUrl("file:///" + doc->location(false).fname)); + } else { + if (_mediaView->isHidden()) Ui::hideLayer(true); + _mediaView->showDocument(doc, item); + _mediaView->activateWindow(); + _mediaView->setFocus(); + } } bool MainWindow::ui_isMediaViewShown() { From 540ba9bfafbfee33c4b2ca58caed11d702369401 Mon Sep 17 00:00:00 2001 From: Wouter van Kesteren <woutershep@gmail.com> Date: Fri, 17 Feb 2017 15:56:52 +0100 Subject: [PATCH 5/5] Fix compilation of history widget with GCC 6. (#3016) error: inconsistent deduction for 'auto': 'int' and then 'auto' auto start = 0, end = list.size(); ^~~~ Signed-off-by: Wouter van Kesteren <woutershep@gmail.com> (github: woutershep) --- Telegram/SourceFiles/historywidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index c28d64b79..9ff4e10d9 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -190,7 +190,8 @@ namespace { // is applied once for blocks list in a history and once for items list in the found block template <bool TopToBottom, typename T> int binarySearchBlocksOrItems(const T &list, int edge) { - auto start = 0, end = list.size(); + // static_cast to work around GCC bug #78693 + auto start = 0, end = static_cast<int>(list.size()); while (end - start > 1) { auto middle = (start + end) / 2; auto top = list[middle]->y;