diff --git a/.travis.yml b/.travis.yml index 1f5333843..841d2ef65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,14 +3,24 @@ sudo: required language: cpp env: - - BUILD_VERSION="" - - BUILD_VERSION="disable_autoupdate" - - BUILD_VERSION="disable_register_custom_scheme" - - BUILD_VERSION="disable_crash_reports" - - BUILD_VERSION="disable_network_proxy" - - BUILD_VERSION="disable_desktop_file_generation" + global: + # GitHub auth token (GH_AUTH_TOKEN) + - secure: "QBbD9VXAx3Mn0vFmHZtm6/sq+twMyR7ilQh7TQm8gBy2TrjhHKDKQ4wRQ5sa2MUFUbzrUOvPlPGq1WuY1mAUt8UE6jZDJNyyDWb6iIlcEmNRsd39XAhYHvJ+uI9JsD+U3OctZ+7Bo4fno0RLv1D5lzh5bpohmjgWxx9TiSZItbsRU+m0XM0Tahx335aXF8NFoVjheGXCOcLAXDt6OmaKPmlrXreuta5nOoRKeOg5vHlt/KNU1pYb8MFvWJc14DKxq3jNqrYlo9vHFv5tVhR1aqvVFWTD/4Z88OSxx3POzyVWdMso0lFov9uxs8qHoqLsGhDMElggyz/jnqZIHpwQMaYIGQ0LLYDv21jGgOuCOWKYlfjDY+tuESXmVPzerTlYBWLZDPrpE8BnXVYo8B/sF4WN6oCuBRjawlqYhqTH+tDDORc9Uc9pamhcuh6OsLMx3PHoyg8joN3t8yUnwhySXyfQ36hqlZ+Y4bBDRZBH/SB/EPmedyLGwdhzQFsUnOBotYeOym7LUdnGraGcj1iTPLdo5TMlBYlAiB12J5mHTNuzUKXh+PBV4REg4Mm2xYX+Pue5Qo1JcOWJteIX4BdPv526DXB3yaNWS1pZgGvYqtBwQlCeOfwOYupS0PksvmV7aX7c4qJSyW3dmEd03cxmebD0b2SbqyPxGFuUajJ7B60=" + matrix: + - BUILD_VERSION="" + - BUILD_VERSION="disable_autoupdate" + - BUILD_VERSION="disable_register_custom_scheme" + - BUILD_VERSION="disable_crash_reports" + - BUILD_VERSION="disable_network_proxy" + - BUILD_VERSION="disable_desktop_file_generation" + - BUILD_VERSION="disable_unity_integration" + +matrix: + fast_finish: true arch: + repos: + - home_ItachiSan_archlinux_Arch_Extra=http://download.opensuse.org/repositories/home:/ItachiSan:/archlinux/Arch_Extra/$arch packages: - bzr - wget @@ -18,7 +28,7 @@ arch: - git - patch - - dee-fixed + - home_ItachiSan_archlinux_Arch_Extra/dee # Use fixed dee version (See #2005) - libunity - libappindicator-gtk2 diff --git a/.travis/build.sh b/.travis/build.sh index b31262833..99ca6d464 100755 --- a/.travis/build.sh +++ b/.travis/build.sh @@ -83,6 +83,10 @@ prepare() { options+="\nDEFINES += TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION" fi + if [[ $BUILD_VERSION == *"disable_unity_integration"* ]]; then + options+="\nDEFINES += TDESKTOP_DISABLE_UNITY_INTEGRATION" + fi + options+='\nINCLUDEPATH += "/usr/lib/glib-2.0/include"' options+='\nINCLUDEPATH += "/usr/lib/gtk-2.0/include"' options+='\nINCLUDEPATH += "/usr/include/opus"' diff --git a/.travis/check.sh b/.travis/check.sh index 3fe7c7fd3..2aaae0471 100755 --- a/.travis/check.sh +++ b/.travis/check.sh @@ -13,6 +13,7 @@ checkCommitMessage() { if [[ $TRAVIS_COMMIT_MSG != *"Signed-off-by: "* ]];then error_msg "The commit message does not contain the signature!" error_msg "More information: https://github.com/telegramdesktop/tdesktop/blob/master/.github/CONTRIBUTING.md#sign-your-work" + addMissingSignatureInfos exit 1 else success_msg "Commit message contains signature" @@ -20,6 +21,37 @@ checkCommitMessage() { fi } +addMissingSignatureInfos() { + if [[ $BUILD_VERSION == "" ]]; then + local TEXT="Hi,\n\ +thanks for the pull request!\n\ +\n\ +Please read our [contributing policy](https://github.com/telegramdesktop/tdesktop/blob/master/.github/CONTRIBUTING.md). You'll need to make a pull request with the \\\"Signed-off-by:\\\" signature being the last line of your commit message, like it is described in [sign your work](https://github.com/telegramdesktop/tdesktop/blob/master/.github/CONTRIBUTING.md#sign-your-work) section. That will grant your work into the public domain.\n\ +\n\ +(See [travis build](https://travis-ci.org/telegramdesktop/tdesktop/jobs/${TRAVIS_JOB_ID}))" + addCommentToGitHub "${TEXT}" + addLabelToGitHub "missing signature" + info_msg "Added missing signature info on github" + fi +} + +addCommentToGitHub() { + local BODY=$1 + sendGitHubRequest "POST" "{\"body\": \"${BODY}\"}" "repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}/comments" +} + +addLabelToGitHub() { + local LABEL=$1 + sendGitHubRequest "PATCH" "{\"labels\": [\"${LABEL}\"]}" "repos/${TRAVIS_REPO_SLUG}/issues/${TRAVIS_PULL_REQUEST}" +} + +sendGitHubRequest() { + local METHOD=$1 + local BODY=$2 + local URI=$3 + curl -H "Authorization: token ${GH_AUTH_TOKEN}" --request "${METHOD}" --data "${BODY}" --silent "https://api.github.com/${URI}" > /dev/null +} + source ./.travis/common.sh run diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp index 63bbf96c8..4d1ba3d80 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp @@ -118,9 +118,11 @@ f_gtk_get_current_event_time gtk_get_current_event_time = nullptr; f_g_object_ref_sink g_object_ref_sink = nullptr; f_g_object_unref g_object_unref = nullptr; f_g_idle_add g_idle_add = nullptr; +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION f_unity_launcher_entry_set_count unity_launcher_entry_set_count = nullptr; f_unity_launcher_entry_set_count_visible unity_launcher_entry_set_count_visible = nullptr; f_unity_launcher_entry_get_for_desktop_id unity_launcher_entry_get_for_desktop_id = nullptr; +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION void start() { DEBUG_LOG(("Loading libraries")); @@ -174,6 +176,7 @@ void start() { LOG(("Could not load gtk-x11-2.0!")); } +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION if (QString(getenv("XDG_CURRENT_DESKTOP")).toLower() == qstr("unity")) { QLibrary lib_unity(qstr("unity"), 9, 0); loadLibrary(lib_unity, "unity", 9); @@ -182,6 +185,7 @@ void start() { load(lib_unity, "unity_launcher_entry_set_count", unity_launcher_entry_set_count); load(lib_unity, "unity_launcher_entry_set_count_visible", unity_launcher_entry_set_count_visible); } +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION } } // namespace Libs diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h index 459d666bb..3376f6965 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.h +++ b/Telegram/SourceFiles/platform/linux/linux_libs.h @@ -27,7 +27,9 @@ extern "C" { #define signals public } // extern "C" +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION #include +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION namespace Platform { namespace Libs { @@ -167,6 +169,7 @@ extern f_g_object_unref g_object_unref; typedef guint (*f_g_idle_add)(GSourceFunc function, gpointer data); extern f_g_idle_add g_idle_add; +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION typedef void (*f_unity_launcher_entry_set_count)(UnityLauncherEntry* self, gint64 value); extern f_unity_launcher_entry_set_count unity_launcher_entry_set_count; @@ -175,6 +178,7 @@ extern f_unity_launcher_entry_set_count_visible unity_launcher_entry_set_count_v typedef UnityLauncherEntry* (*f_unity_launcher_entry_get_for_desktop_id)(const gchar* desktop_id); extern f_unity_launcher_entry_get_for_desktop_id unity_launcher_entry_get_for_desktop_id; +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION } // namespace Libs } // namespace Platform diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index dfc4b7462..8971a4976 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -181,7 +181,9 @@ static gboolean _trayIconCheck(gpointer/* pIn*/) { return FALSE; } +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION UnityLauncherEntry *_psUnityLauncherEntry = nullptr; +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION } // namespace @@ -319,6 +321,7 @@ void MainWindow::psUpdateCounter() { int32 counter = App::histories().unreadBadge(); setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram")); +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION if (_psUnityLauncherEntry) { if (counter > 0) { Libs::unity_launcher_entry_set_count(_psUnityLauncherEntry, (counter > 9999) ? 9999 : counter); @@ -327,6 +330,7 @@ void MainWindow::psUpdateCounter() { Libs::unity_launcher_entry_set_count_visible(_psUnityLauncherEntry, FALSE); } } +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION if (noQtTrayIcon) { if (useAppIndicator) { @@ -416,12 +420,14 @@ void MainWindow::LibsLoaded() { DEBUG_LOG(("Status icon api loaded!")); } +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION useUnityCount = (Libs::unity_launcher_entry_get_for_desktop_id != nullptr) && (Libs::unity_launcher_entry_set_count != nullptr) && (Libs::unity_launcher_entry_set_count_visible != nullptr); if (useUnityCount) { DEBUG_LOG(("Unity count api loaded!")); } +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION } void MainWindow::psUpdateDelegate() { @@ -598,6 +604,7 @@ void MainWindow::psCreateTrayIcon() { void MainWindow::psFirstShow() { psCreateTrayIcon(); +#ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION if (useUnityCount) { _psUnityLauncherEntry = Libs::unity_launcher_entry_get_for_desktop_id("telegramdesktop.desktop"); if (_psUnityLauncherEntry) { @@ -613,6 +620,7 @@ void MainWindow::psFirstShow() { } else { LOG(("Not using Unity Launcher count.")); } +#endif // TDESKTOP_DISABLE_UNITY_INTEGRATION psUpdateMargins(); diff --git a/Telegram/SourceFiles/ui/scrollarea.cpp b/Telegram/SourceFiles/ui/scrollarea.cpp index 6289d2526..1e5dc1637 100644 --- a/Telegram/SourceFiles/ui/scrollarea.cpp +++ b/Telegram/SourceFiles/ui/scrollarea.cpp @@ -651,6 +651,8 @@ void ScrollArea::moveEvent(QMoveEvent *e) { void ScrollArea::keyPressEvent(QKeyEvent *e) { if ((e->key() == Qt::Key_Up || e->key() == Qt::Key_Down) && e->modifiers().testFlag(Qt::AltModifier)) { e->ignore(); + } else if(e->key() == Qt::Key_Escape || e->key() == Qt::Key_Back) { + ((QObject*)widget())->event(e); } else { QScrollArea::keyPressEvent(e); } diff --git a/doc/building-msvc.md b/doc/building-msvc.md index f07e8be9f..58865d87e 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -1,10 +1,36 @@ -##Build instructions for Visual Studio 2015 +# Build instructions for Visual Studio 2015 -###Prepare folder + * [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.0, 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 Choose a folder for the future build, for example **D:\TBuild\**. There you will have two folders, **Libraries** for third-party libs and **tdesktop** (or **tdesktop-master**) for the app. -###Clone source code +## Clone source code By git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild** and run @@ -12,9 +38,9 @@ By git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild** and r or download in ZIP and extract to **D:\TBuild\**, rename **tdesktop-master** to **tdesktop** to have **D:\TBuild\tdesktop\Telegram.sln** solution -###Prepare libraries +## Prepare libraries -####OpenSSL +### OpenSSL Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\\TBuild\\Libraries** and run @@ -35,13 +61,13 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > nmake -f ms\nt.mak install -####LZMA SDK 9.20 +### LZMA SDK 9.20 http://www.7-zip.org/sdk.html > Download [**LZMA SDK (C, C++, C#, Java)** 9.20](http://downloads.sourceforge.net/sevenzip/lzma920.tar.bz2) Extract to **D:\TBuild\Libraries** -#####Building library +#### Building library * Open in VS2015 **D:\TBuild\Libraries\lzma\C\Util\LzmaLib\LzmaLib.dsw** > One-way upgrade – **OK** * For **Debug** and **Release** configurations @@ -53,13 +79,13 @@ Extract to **D:\TBuild\Libraries** * Build Debug configuration * Build Release configuration -####zlib 1.2.8 +### zlib 1.2.8 http://www.zlib.net/ > Download [**zlib source code, version 1.2.8, zipfile format**](http://zlib.net/zlib128.zip) Extract to **D:\\TBuild\\Libraries\\** -#####Building library +#### Building library * Open in VS2015 **D:\TBuild\Libraries\zlib-1.2.8\contrib\vstudio\vc11\zlibvc.sln** > One-way upgrade – **OK** * We are interested only in **zlibstat** project, but it depends on some custom pre-build step, so build all @@ -70,7 +96,7 @@ Extract to **D:\\TBuild\\Libraries\\** * Build Solution for Debug configuration – only **zlibstat** project builds successfully * Build Solution for Release configuration – only **zlibstat** project builds successfully -####libexif 0.6.20 +### libexif 0.6.20 Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild/libraries** and run @@ -78,13 +104,13 @@ Get sources from https://github.com/telegramdesktop/libexif-0.6.20, by git – i or download in ZIP and extract to **D:\TBuild\Libraries\**, rename **libexif-0.6.20-master** to **libexif-0.6.20** to have **D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln** solution -#####Building library +#### Building library * Open in VS2015 **D:\TBuild\Libraries\libexif-0.6.20\win32\lib_exif.sln** * Build Debug configuration * Build Release configuration -####OpenAL Soft, slightly patched +### OpenAL Soft, slightly patched Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\\TBuild\\Libraries** and run @@ -93,7 +119,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > git checkout 90349b38 git apply ./../../tdesktop/Telegram/Patches/openal.diff -#####Building library +#### Building library * Install [CMake](http://www.cmake.org/) * Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\TBuild\Libraries\openal-soft\build\** and run @@ -102,7 +128,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > * Open in VS2015 **D:\TBuild\Libraries\openal-soft\build\OpenAL.sln** and build Debug and Release configurations -####Opus codec +### Opus codec Get sources by git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tbuild/libraries** and run @@ -110,13 +136,13 @@ Get sources by git – in [Git Bash](http://git-scm.com/downloads) go to **/d/tb to have **D:\TBuild\Libraries\opus\win32** -#####Building libraries +#### Building libraries * Open in VS2015 **D:\TBuild\Libraries\opus\win32\VS2010\opus.sln** * Build Debug configuration * Build Release configuration (it will be required in **FFmpeg** build!) -####FFmpeg +### FFmpeg Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder) and run @@ -126,7 +152,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > http://msys2.github.io/ > Download [msys2-x86_64-20150512.exe](http://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-x86_64-20150512.exe/download) and install to **D:\\msys64** -#####Building libraries +#### Building libraries Download [yasm for Win64](http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe) from http://yasm.tortall.net/Download.html, rename **yasm-1.3.0-win64.exe** to **yasm.exe** and place it to your Visual C++ **bin** directory, like **\\Program Files (x86)\\Microsoft Visual Studio 14\\VC\\bin\\** @@ -148,7 +174,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > make make install -####Qt 5.6.0, slightly patched +### Qt 5.6.0, slightly patched * Install Python 3.3.2 from https://www.python.org/download/releases/3.3.2 > [**Windows x86 MSI Installer (3.3.2)**](https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi) * Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder) @@ -168,17 +194,17 @@ and run cd qtimageformats && git checkout v5.6.0 && cd .. cd qtbase && git checkout v5.6.0 && cd .. -#####Apply the patch +#### Apply the patch cd qtbase && git apply ../../../tdesktop/Telegram/Patches/qtbase_5_6_0.diff && cd .. -#####Install Windows SDKs +#### Install Windows SDKs If you didn't install Windows SDKs before, you need to install them now. To install the SDKs just open Telegram solution at **D:\TBuild\tdesktop\Telegram.sln** and on startup Visual Studio 2015 will popup dialog box and ask to download and install extra components (including Windows 7 SDK). If you already have Windows SDKs then find the library folder and correct it at configure's command below (like **C:\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86**). -#####Building library +#### Building library configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "D:\TBuild\Libraries\openssl\Release\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\openssl_debug\Debug\lib\ssleay32.lib D:\TBuild\Libraries\openssl_debug\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\openssl\Release\lib\ssleay32.lib D:\TBuild\Libraries\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015 nmake @@ -186,15 +212,19 @@ If you already have Windows SDKs then find the library folder and correct it at building (**nmake** command) will take really long time. -####Qt5Package +### Qt5Package https://visualstudiogallery.msdn.microsoft.com/c89ff880-8509-47a4-a262-e4fa07168408 Download, close all VS2015 instances and install for VS2015 -####Google Breakpad +### Google Breakpad -* Install Python 2.7.11 from https://www.python.org/downloads/release/python-2711/ > [**Windows x86 MSI installer**](https://www.python.org/ftp/python/2.7.11/python-2.7.11.msi) +Breakpad is a set of client and server components which implement a crash-reporting system. + +#### Install + +* 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). * Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder) There go to Libraries directory @@ -204,19 +234,18 @@ There go to Libraries directory and run - set PATH=C:\Python27;%PATH% 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 cd .. - md breakpad - cd breakpad + md breakpad && cd breakpad ..\depot_tools\fetch breakpad ..\depot_tools\gclient sync + xcopy src\src\* src /s /i -There's now a src folder within a src folder: D:\TBuild\Libraries\breakpad\src\src. Telegram only expects one src folder. Either via the command line or File Explorer, rename the top-level src folder and move the inner src folder one level up. This way, what was once breakpad\src\src\client is now breakpad\src\client, etc. -#####Building library +#### 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 @@ -224,7 +253,7 @@ There's now a src folder within a src folder: D:\TBuild\Libraries\breakpad\src\s * Build Debug configuration * Build Release configuration -###Building Telegram Desktop +## Building Telegram Desktop * Launch VS2015 for configuring Qt5Package * QT5 > Qt Options > Add