diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 45c0530b9..33588e255 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -185,7 +185,8 @@ namespace { // is applied once for blocks list in a history and once for items list in the found block template 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(list.size()); while (end - start > 1) { auto middle = (start + end) / 2; auto top = list[middle]->y; diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index def584f5d..97e047098 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -561,6 +561,7 @@ enum { dbiNotificationsCorner = 0x46, dbiTheme = 0x47, dbiDialogsWidthRatio = 0x48, + dbiUseExternalVideoPlayer = 0x49, dbiEncryptedWithSalt = 333, dbiEncrypted = 444, @@ -931,6 +932,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; @@ -1710,6 +1719,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()); { data.stream << quint32(dbiRecentEmoji) << recentEmojiPreloadData; diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index 69aaf46cd..f63f8cc6a 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 61238346b..a1ff506b0 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 0d98903d6..be96830b8 100644 --- a/Telegram/SourceFiles/settings/settings_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_widget.cpp @@ -102,6 +102,14 @@ void fillCodes() { Codes.insert(qsl("edittheme"), []() { Window::Theme::Editor::Start(); }); + Codes.insert(qsl("videoplayer"), []() { + auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?"); + Ui::show(Box(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 c6b5cd43c..4e7f9c5d8 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() { diff --git a/doc/building-msvc.md b/doc/building-msvc.md index ca1e49160..848e5a826 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 @@ -86,7 +91,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** @@ -222,28 +227,38 @@ 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 + rmdir src\src /s /q #### 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