diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.1.23-libtgvoip.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.2.21-libtgvoip.patchset similarity index 68% rename from net-im/telegram-desktop/patches/telegram_desktop-1.1.23-libtgvoip.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-1.2.21-libtgvoip.patchset index 864b39362..37bdb2289 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.1.23-libtgvoip.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.2.21-libtgvoip.patchset @@ -1,13 +1,13 @@ -From ec7bde5fd17969a08b8149785445ecb69b09c729 Mon Sep 17 00:00:00 2001 +From 5eb650e32842dd21d764aad9ea8f9977b4b11477 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:18:56 +1000 +Date: Mon, 21 May 2018 20:18:03 +1000 Subject: Fix opus header path -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusDecoder.h b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusDecoder.h -index 51bbbac..31c8b29 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusDecoder.h -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusDecoder.h +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusDecoder.h b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusDecoder.h +index 1a88ce5..e8389f5 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusDecoder.h ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusDecoder.h @@ -9,7 +9,11 @@ @@ -20,10 +20,10 @@ index 51bbbac..31c8b29 100644 #include "threading.h" #include "BlockingQueue.h" #include "BufferPool.h" -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusEncoder.h b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusEncoder.h +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusEncoder.h b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusEncoder.h index 9329f89..b2a9305 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusEncoder.h -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/OpusEncoder.h +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusEncoder.h ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/OpusEncoder.h @@ -9,7 +9,11 @@ @@ -37,20 +37,20 @@ index 9329f89..b2a9305 100644 #include "BlockingQueue.h" #include "BufferPool.h" -- -2.13.1 +2.16.2 -From 11ec9121c35bcf4127ff2e982329ba2c354d0259 Mon Sep 17 00:00:00 2001 +From 19836869446c2ef6c5883caab8e748801963c952 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:22:31 +1000 +Date: Mon, 21 May 2018 20:19:19 +1000 Subject: Add haiku -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioInput.cpp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioInput.cpp -index 674b955..6021425 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioInput.cpp -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioInput.cpp -@@ -23,6 +23,8 @@ +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioInput.cpp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioInput.cpp +index cc552ab..5b7b8eb 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioInput.cpp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioInput.cpp +@@ -22,6 +22,8 @@ #elif defined(__linux__) #include "../os/linux/AudioInputALSA.h" #include "../os/linux/AudioInputPulse.h" @@ -59,11 +59,11 @@ index 674b955..6021425 100644 #else #error "Unsupported operating system" #endif -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioOutput.cpp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioOutput.cpp -index 4f5fdfa..a0409e6 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioOutput.cpp -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/audio/AudioOutput.cpp -@@ -24,6 +24,8 @@ +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioOutput.cpp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioOutput.cpp +index a6364bc..0e5516a 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioOutput.cpp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/audio/AudioOutput.cpp +@@ -23,6 +23,8 @@ #elif defined(__linux__) #include "../os/linux/AudioOutputALSA.h" #include "../os/linux/AudioOutputPulse.h" @@ -72,12 +72,12 @@ index 4f5fdfa..a0409e6 100644 #else #error "Unsupported operating system" #endif -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/libtgvoip.gyp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/libtgvoip.gyp -index 52fbea1..6a44ab3 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/libtgvoip.gyp -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/libtgvoip.gyp -@@ -81,18 +81,12 @@ - '<(tgvoip_src_loc)/os/darwin/AudioOutputAudioUnitOSX.h', +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/libtgvoip.gyp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/libtgvoip.gyp +index 5ff19f6..9523ea3 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/libtgvoip.gyp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/libtgvoip.gyp +@@ -87,18 +87,12 @@ + '<(tgvoip_src_loc)/os/darwin/AudioUnitIO.h', '<(tgvoip_src_loc)/os/darwin/DarwinSpecific.mm', '<(tgvoip_src_loc)/os/darwin/DarwinSpecific.h', - @@ -101,22 +101,23 @@ index 52fbea1..6a44ab3 100644 # POSIX '<(tgvoip_src_loc)/os/posix/NetworkSocketPosix.cpp', -@@ -253,6 +247,11 @@ +@@ -258,6 +252,11 @@ + 'sources/': [['exclude', '<(tgvoip_src_loc)/os/darwin/']], }, ], - [ ++ [ + '"<(OS)" != "haiku"', { + 'sources/': [['exclude', '<(tgvoip_src_loc)/os/haiku/']], + }, + ], -+ [ + [ '"<(OS)" != "linux"', { 'sources/': [['exclude', '<(tgvoip_src_loc)/os/linux/']], - }, -@@ -371,6 +370,22 @@ +@@ -377,6 +376,22 @@ + }, }, ], - [ ++ [ + '"<(OS)" == "haiku"', { + 'defines': [ + 'WEBRTC_POSIX', @@ -132,15 +133,103 @@ index 52fbea1..6a44ab3 100644 + }, + }, + ], -+ [ + [ '"<(OS)" == "linux"', { 'defines': [ - 'WEBRTC_POSIX', -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioInputHaiku.cpp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioInputHaiku.cpp +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/posix/NetworkSocketPosix.cpp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/posix/NetworkSocketPosix.cpp +index a0ddd5f..f55f054 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/posix/NetworkSocketPosix.cpp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/posix/NetworkSocketPosix.cpp +@@ -40,6 +40,7 @@ NetworkSocketPosix::~NetworkSocketPosix(){ + } + + void NetworkSocketPosix::SetMaxPriority(){ ++#ifndef __HAIKU__ + #ifdef __APPLE__ + int prio=NET_SERVICE_TYPE_VO; + int res=setsockopt(fd, SOL_SOCKET, SO_NET_SERVICE_TYPE, &prio, sizeof(prio)); +@@ -58,6 +59,7 @@ void NetworkSocketPosix::SetMaxPriority(){ + LOGE("error setting ip tos: %d / %s", errno, strerror(errno)); + } + #endif ++#endif + } + + void NetworkSocketPosix::Send(NetworkPacket *packet){ +@@ -299,6 +301,10 @@ void NetworkSocketPosix::OnActiveInterfaceChanged(){ + } + + std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6Address *v6addr){ ++#ifdef __HAIKU__ ++ std::string name=""; ++ return name; ++#else + struct ifconf ifc; + struct ifreq* ifr; + char buf[16384]; +@@ -348,6 +354,7 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A + } + close(sd); + return name; ++#endif + } + + uint16_t NetworkSocketPosix::GetLocalPort(){ +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/threading.h b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/threading.h +index 8a6f438..c45d3fb 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/threading.h ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/threading.h +@@ -7,7 +7,7 @@ + #ifndef __THREADING_H + #define __THREADING_H + +-#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) ++#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__) + + #include + #include +@@ -19,7 +19,7 @@ typedef pthread_cond_t tgvoip_lock_t; + + #define start_thread(ref, entry, arg) pthread_create(&ref, NULL, entry, arg) + #define join_thread(thread) pthread_join(thread, NULL) +-#ifndef __APPLE__ ++#if !defined(__APPLE__) && !defined(__HAIKU__) + #define set_thread_name(thread, name) pthread_setname_np(thread, name) + #else + #define set_thread_name(thread, name) +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c +index c9c4e65..9d93596 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c +@@ -99,7 +99,12 @@ static void once(void (*func)(void)) { + static pthread_once_t lock = PTHREAD_ONCE_INIT; + pthread_once(&lock, func); + } +- ++#elif defined(__HAIKU__) ++#include ++static void once(void (*func)(void)) { ++ static pthread_once_t lock = PTHREAD_ONCE_INIT; ++ pthread_once(&lock, func); ++} + #elif defined(_WIN32) + #include + +-- +2.16.2 + + +From 8a0e51e26e7f6452f5b1d047703dd0acdeb9958c Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Mon, 21 May 2018 20:20:19 +1000 +Subject: Add haiku audio input/output module + + +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioInputHaiku.cpp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioInputHaiku.cpp new file mode 100644 index 0000000..0bf2433 --- /dev/null -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioInputHaiku.cpp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioInputHaiku.cpp @@ -0,0 +1,52 @@ +// +// libtgvoip is free and unencumbered public domain software. @@ -194,11 +283,11 @@ index 0000000..0bf2433 + +void AudioInputHaiku::EnumerateDevices(std::vector& devs){ +} -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioInputHaiku.h b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioInputHaiku.h +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioInputHaiku.h b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioInputHaiku.h new file mode 100644 index 0000000..e268ee5 --- /dev/null -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioInputHaiku.h ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioInputHaiku.h @@ -0,0 +1,36 @@ +// +// libtgvoip is free and unencumbered public domain software. @@ -236,11 +325,11 @@ index 0000000..e268ee5 +} + +#endif //LIBTGVOIP_AUDIOINPUTALSA_H -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioOutputHaiku.cpp +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioOutputHaiku.cpp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioOutputHaiku.cpp new file mode 100644 index 0000000..c5d88b4 --- /dev/null -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioOutputHaiku.cpp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioOutputHaiku.cpp @@ -0,0 +1,54 @@ +// +// libtgvoip is free and unencumbered public domain software. @@ -296,11 +385,11 @@ index 0000000..c5d88b4 + +void AudioOutputHaiku::EnumerateDevices(std::vector& devs){ +} -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioOutputHaiku.h b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioOutputHaiku.h +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioOutputHaiku.h b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioOutputHaiku.h new file mode 100644 index 0000000..759e867 --- /dev/null -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/haiku/AudioOutputHaiku.h ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/os/haiku/AudioOutputHaiku.h @@ -0,0 +1,36 @@ +// +// libtgvoip is free and unencumbered public domain software. @@ -338,100 +427,21 @@ index 0000000..759e867 +} + +#endif //LIBTGVOIP_AudioOutputHaiku_H -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/posix/NetworkSocketPosix.cpp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/posix/NetworkSocketPosix.cpp -index 7fa7063..0b90f8a 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/posix/NetworkSocketPosix.cpp -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/os/posix/NetworkSocketPosix.cpp -@@ -39,6 +39,7 @@ NetworkSocketPosix::~NetworkSocketPosix(){ - } - - void NetworkSocketPosix::SetMaxPriority(){ -+#ifndef __HAIKU__ - #ifdef __APPLE__ - int prio=NET_SERVICE_TYPE_VO; - int res=setsockopt(fd, SOL_SOCKET, SO_NET_SERVICE_TYPE, &prio, sizeof(prio)); -@@ -57,6 +58,7 @@ void NetworkSocketPosix::SetMaxPriority(){ - LOGE("error setting ip tos: %d / %s", errno, strerror(errno)); - } - #endif -+#endif - } - - void NetworkSocketPosix::Send(NetworkPacket *packet){ -@@ -295,6 +297,10 @@ void NetworkSocketPosix::OnActiveInterfaceChanged(){ - } - - std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6Address *v6addr){ -+#ifdef __HAIKU__ -+ std::string name=""; -+ return name; -+#else - struct ifconf ifc; - struct ifreq* ifr; - char buf[16384]; -@@ -344,6 +350,7 @@ std::string NetworkSocketPosix::GetLocalInterfaceInfo(IPv4Address *v4addr, IPv6A - } - close(sd); - return name; -+#endif - } - - uint16_t NetworkSocketPosix::GetLocalPort(){ -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/threading.h b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/threading.h -index 8a6f438..c45d3fb 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/threading.h -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/threading.h -@@ -7,7 +7,7 @@ - #ifndef __THREADING_H - #define __THREADING_H - --#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) -+#if defined(_POSIX_THREADS) || defined(_POSIX_VERSION) || defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) || defined(__HAIKU__) - - #include - #include -@@ -19,7 +19,7 @@ typedef pthread_cond_t tgvoip_lock_t; - - #define start_thread(ref, entry, arg) pthread_create(&ref, NULL, entry, arg) - #define join_thread(thread) pthread_join(thread, NULL) --#ifndef __APPLE__ -+#if !defined(__APPLE__) && !defined(__HAIKU__) - #define set_thread_name(thread, name) pthread_setname_np(thread, name) - #else - #define set_thread_name(thread, name) -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c -index c9c4e65..9d93596 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/webrtc_dsp/webrtc/common_audio/signal_processing/spl_init.c -@@ -99,7 +99,12 @@ static void once(void (*func)(void)) { - static pthread_once_t lock = PTHREAD_ONCE_INIT; - pthread_once(&lock, func); - } -- -+#elif defined(__HAIKU__) -+#include -+static void once(void (*func)(void)) { -+ static pthread_once_t lock = PTHREAD_ONCE_INIT; -+ pthread_once(&lock, func); -+} - #elif defined(_WIN32) - #include - -- -2.13.1 +2.16.2 -From 7e861e2b3c0d02e0fabdab46b9e5f88b56585716 Mon Sep 17 00:00:00 2001 +From 6eccbdda41ac648e2dcb6efc851e35a78cb86e5f Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Mon, 18 Sep 2017 22:05:53 +1000 +Date: Mon, 21 May 2018 20:20:37 +1000 Subject: Fix for crash when calls -diff --git a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/VoIPController.cpp b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/VoIPController.cpp -index 78e9e4b..a9c34b7 100644 ---- a/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/VoIPController.cpp -+++ b/libtgvoip-757a5d8ec31aadcf387ac3cb135256152c18de1c/VoIPController.cpp -@@ -276,6 +276,7 @@ VoIPController::~VoIPController(){ +diff --git a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/VoIPController.cpp b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/VoIPController.cpp +index 2f793f3..7c2b523 100644 +--- a/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/VoIPController.cpp ++++ b/libtgvoip-ed3a899bbe26c56dc25e40730ca6d0e95f59717d/VoIPController.cpp +@@ -291,6 +291,7 @@ VoIPController::~VoIPController(){ sendQueue->Put(PendingOutgoingPacket{0}); if(openingTcpSocket) openingTcpSocket->Close(); @@ -439,7 +449,7 @@ index 78e9e4b..a9c34b7 100644 LOGD("before join sendThread"); join_thread(sendThread); LOGD("before join recvThread"); -@@ -284,6 +285,7 @@ VoIPController::~VoIPController(){ +@@ -299,6 +300,7 @@ VoIPController::~VoIPController(){ join_thread(tickThread); free_mutex(sendBufferMutex); LOGD("before close socket"); @@ -448,5 +458,5 @@ index 78e9e4b..a9c34b7 100644 delete udpSocket; if(udpSocket!=realUdpSocket) -- -2.13.1 +2.16.2 diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.2.21-systemqt.patch b/net-im/telegram-desktop/patches/telegram_desktop-1.2.21-systemqt.patch new file mode 100644 index 000000000..abcc4ae7b --- /dev/null +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.2.21-systemqt.patch @@ -0,0 +1,556 @@ +diff --git a/Telegram/Resources/qrc/telegram_linux.qrc b/Telegram/Resources/qrc/telegram_linux.qrc +index 0554fa17..3ea02740 100644 +--- a/Telegram/Resources/qrc/telegram_linux.qrc ++++ b/Telegram/Resources/qrc/telegram_linux.qrc +@@ -1,5 +1,4 @@ + + +- ../etc/qt_linux.conf + + +diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp +index bf21d14d..6b63016e 100644 +--- a/Telegram/SourceFiles/core/launcher.cpp ++++ b/Telegram/SourceFiles/core/launcher.cpp +@@ -44,9 +44,10 @@ void Launcher::init() { + + QCoreApplication::setApplicationName(qsl("TelegramDesktop")); + +-#ifndef OS_MAC_OLD ++#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) ++ // Retina display support is working fine, others are not. + QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); +-#endif // OS_MAC_OLD ++#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0 + + initHook(); + } +@@ -64,6 +65,13 @@ int Launcher::exec() { + Logs::start(this); // must be started before Platform is started + Platform::start(); // must be started before QApplication is created + ++ // I don't know why path is not in QT_PLUGIN_PATH by default ++ QCoreApplication::addLibraryPath("/usr/lib/qt/plugins"); ++ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors ++ setenv("QT_STYLE_OVERRIDE", "qwerty", false); ++ // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943 ++ unsetenv("QT_QPA_PLATFORMTHEME"); ++ + auto result = executeApplication(); + + DEBUG_LOG(("Telegram finished, result: %1").arg(result)); +diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h +index e9e349be..d82963fa 100644 +--- a/Telegram/SourceFiles/platform/linux/linux_libs.h ++++ b/Telegram/SourceFiles/platform/linux/linux_libs.h +@@ -30,7 +30,7 @@ extern "C" { + } // extern "C" + + #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION +-#include ++typedef void UnityLauncherEntry; + #endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION + #endif // !TDESKTOP_DISABLE_GTK_INTEGRATION + +diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp +new file mode 100644 +index 00000000..4a722b8d +--- /dev/null ++++ b/Telegram/SourceFiles/qt_functions.cpp +@@ -0,0 +1,94 @@ ++/**************************************************************************** ++** ++** Copyright (C) 2015 The Qt Company Ltd. ++** Contact: http://www.qt.io/licensing/ ++** ++** This file contains some parts of the Qt Toolkit. ++** ++** $QT_BEGIN_LICENSE:LGPL21$ ++** Commercial License Usage ++** Licensees holding valid commercial Qt licenses may use this file in ++** accordance with the commercial license agreement provided with the ++** Software or, alternatively, in accordance with the terms contained in ++** a written agreement between you and The Qt Company. For licensing terms ++** and conditions see http://www.qt.io/terms-conditions. For further ++** information use the contact form at http://www.qt.io/contact-us. ++** ++** GNU Lesser General Public License Usage ++** Alternatively, this file may be used under the terms of the GNU Lesser ++** General Public License version 2.1 or version 3 as published by the Free ++** Software Foundation and appearing in the file LICENSE.LGPLv21 and ++** LICENSE.LGPLv3 included in the packaging of this file. Please review the ++** following information to ensure the GNU Lesser General Public License ++** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ++** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ++** ++** As a special exception, The Qt Company gives you certain additional ++** rights. These rights are described in The Qt Company LGPL Exception ++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ++** ++** $QT_END_LICENSE$ ++** ++****************************************************************************/ ++ ++/* TODO: find a dynamic library with these symbols. */ ++ ++/* Debian maintainer: this function is taken from qfiledialog.cpp */ ++/* ++ Makes a list of filters from ;;-separated text. ++ Used by the mac and windows implementations ++*/ ++QStringList qt_make_filter_list(const QString &filter) ++{ ++ QString f(filter); ++ ++ if (f.isEmpty()) ++ return QStringList(); ++ ++ QString sep(QLatin1String(";;")); ++ int i = f.indexOf(sep, 0); ++ if (i == -1) { ++ if (f.indexOf(QLatin1Char('\n'), 0) != -1) { ++ sep = QLatin1Char('\n'); ++ i = f.indexOf(sep, 0); ++ } ++ } ++ ++ return f.split(sep); ++} ++ ++/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */ ++QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) ++ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), ++ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) ++{ ++} ++ ++/* Debian maintainer: this method is also taken from qtextengine.cpp */ ++// Fix up flags and underlineStyle with given info ++void QTextItemInt::initWithScriptItem(const QScriptItem &si) ++{ ++ // explicitly initialize flags so that initFontAttributes can be called ++ // multiple times on the same TextItem ++ flags = 0; ++ if (si.analysis.bidiLevel %2) ++ flags |= QTextItem::RightToLeft; ++ ascent = si.ascent; ++ descent = si.descent; ++ ++ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) { ++ underlineStyle = charFormat.underlineStyle(); ++ } else if (charFormat.boolProperty(QTextFormat::FontUnderline) ++ || f->d->underline) { ++ underlineStyle = QTextCharFormat::SingleUnderline; ++ } ++ ++ // compat ++ if (underlineStyle == QTextCharFormat::SingleUnderline) ++ flags |= QTextItem::Underline; ++ ++ if (f->d->overline || charFormat.fontOverline()) ++ flags |= QTextItem::Overline; ++ if (f->d->strikeOut || charFormat.fontStrikeOut()) ++ flags |= QTextItem::StrikeOut; ++} +diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp +index b975c7a8..f2f876b3 100644 +--- a/Telegram/SourceFiles/qt_static_plugins.cpp ++++ b/Telegram/SourceFiles/qt_static_plugins.cpp +@@ -28,13 +28,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin) + Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) + Q_IMPORT_PLUGIN(QGenericEnginePlugin) + #elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC +-Q_IMPORT_PLUGIN(QWebpPlugin) +-Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) +-Q_IMPORT_PLUGIN(QConnmanEnginePlugin) +-Q_IMPORT_PLUGIN(QGenericEnginePlugin) +-Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) +-Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) +-Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) +-Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) +-Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) + #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX +diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp +index 7d34a19b..a4b3d31a 100644 +--- a/Telegram/SourceFiles/ui/text/text.cpp ++++ b/Telegram/SourceFiles/ui/text/text.cpp +@@ -1707,11 +1707,11 @@ private: + if (item == -1) + return; + +-#ifdef OS_MAC_OLD ++#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0) + auto end = _e->findItem(line.from + line.length - 1); +-#else // OS_MAC_OLD ++#else + auto end = _e->findItem(line.from + line.length - 1, item); +-#endif // OS_MAC_OLD ++#endif + + auto blockIndex = _lineStartBlock; + auto currentBlock = _t->_blocks[blockIndex].get(); +diff --git a/Telegram/SourceFiles/ui/text/text_block.cpp b/Telegram/SourceFiles/ui/text/text_block.cpp +index a10b5393..4e1eb62d 100644 +--- a/Telegram/SourceFiles/ui/text/text_block.cpp ++++ b/Telegram/SourceFiles/ui/text/text_block.cpp +@@ -333,6 +333,9 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi + + QStackTextEngine engine(part, blockFont->f); + BlockParser parser(&engine, this, minResizeWidth, _from, part); ++ QTextLayout layout(part, blockFont->f); ++ layout.beginLayout(); ++ layout.createLine(); + + CrashReports::ClearAnnotationRef("CrashString"); + } +diff --git a/Telegram/SourceFiles/ui/twidget.cpp b/Telegram/SourceFiles/ui/twidget.cpp +index dacb848a..f64c9b66 100644 +--- a/Telegram/SourceFiles/ui/twidget.cpp ++++ b/Telegram/SourceFiles/ui/twidget.cpp +@@ -248,9 +248,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton + , button + , QGuiApplication::mouseButtons() | button + , QGuiApplication::keyboardModifiers() +-#ifndef OS_MAC_OLD ++#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) + , Qt::MouseEventSynthesizedByApplication +-#endif // OS_MAC_OLD ++#endif + ); + ev.setTimestamp(getms()); + QGuiApplication::sendEvent(windowHandle, &ev); +diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake +index 5d6830e9..c3f08d3f 100644 +--- a/Telegram/gyp/PrecompiledHeader.cmake ++++ b/Telegram/gyp/PrecompiledHeader.cmake +@@ -112,7 +112,7 @@ function(add_precompiled_header _target _input) + set(_compiler_FLAGS "@${_pch_c_flags_file}") + add_custom_command( + OUTPUT "${_output_c}" +- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" ++ COMMAND "${CMAKE_C_COMPILER}" "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}" + DEPENDS "${_pchfile}" "${_pch_c_flags_file}" + IMPLICIT_DEPENDS C "${_pch_header}" + COMMENT "Precompiling ${_name} for ${_target} (C)") +@@ -123,7 +123,7 @@ function(add_precompiled_header _target _input) + set(_compiler_FLAGS "@${_pch_cpp_flags_file}") + add_custom_command( + OUTPUT "${_output_cxx}" +- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" ++ COMMAND "${CMAKE_CXX_COMPILER}" "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}" + DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" + IMPLICIT_DEPENDS CXX "${_pch_header}" + COMMENT "Precompiling ${_name} for ${_target} (C++)") +diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp +index 84a06153..fd7ca47f 100644 +--- a/Telegram/gyp/Telegram.gyp ++++ b/Telegram/gyp/Telegram.gyp +@@ -82,13 +82,11 @@ + 'codegen.gyp:codegen_numbers', + 'codegen.gyp:codegen_style', + 'tests/tests.gyp:tests', +- 'utils.gyp:Updater', + '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', + 'crl.gyp:crl', + ], + + 'defines': [ +- 'AL_LIBTYPE_STATIC', + 'AL_ALEXT_PROTOTYPES', + 'TGVOIP_USE_CXX11_LIB', + ' /dev/null --libs <@(pkgconfig_libs))', + ], + 'cflags_cc': [ +@@ -99,7 +91,7 @@ + }, + }, + 'conditions': [ +- [ '" /dev/null --cflags appindicator-0.1)', +- ' /dev/null --cflags gtk+-2.0)', +- ' /dev/null --cflags glib-2.0)', +- ' /dev/null --cflags dee-1.0)', ++ ' /dev/null --cflags appindicator3-0.1)', ++ ' /dev/null --cflags gtk+-3.0)', + ], + }] + ], +diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt +index 5d2f627e..defd475d 100644 +--- a/Telegram/gyp/telegram_sources.txt ++++ b/Telegram/gyp/telegram_sources.txt +@@ -713,14 +713,7 @@ + <(emoji_suggestions_loc)/emoji_suggestions.cpp + <(emoji_suggestions_loc)/emoji_suggestions.h + +-platforms: !win +-<(minizip_loc)/crypt.h +-<(minizip_loc)/ioapi.c +-<(minizip_loc)/ioapi.h +-<(minizip_loc)/zip.c +-<(minizip_loc)/zip.h +-<(minizip_loc)/unzip.c +-<(minizip_loc)/unzip.h ++<(src_loc)/qt_functions.cpp + + platforms: mac + <(sp_media_key_tap_loc)/SPMediaKeyTap.m diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.1.23.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.2.21.patchset similarity index 61% rename from net-im/telegram-desktop/patches/telegram_desktop-1.1.23.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-1.2.21.patchset index f4ce3c67c..a1a8dd556 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-1.1.23.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.2.21.patchset @@ -1,31 +1,84 @@ -From 25b87f354e86f94ed023534b7c3e0591f9ee2201 Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Sat, 9 Sep 2017 02:14:52 +0300 -Subject: Haiku fixes +From 80505fb50b88d21bfa48423eee6e755d6cbdefa0 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 22 May 2018 23:50:00 +1000 +Subject: Add haiku support -diff --git a/Telegram/SourceFiles/autoupdater.cpp b/Telegram/SourceFiles/autoupdater.cpp -index a6aa4c2..45ba0ed 100644 ---- a/Telegram/SourceFiles/autoupdater.cpp -+++ b/Telegram/SourceFiles/autoupdater.cpp -@@ -534,7 +534,7 @@ bool checkReadyUpdate() { - #elif defined Q_OS_MAC // Q_OS_WIN - QString curUpdater = (cExeDir() + cExeName() + qsl("/Contents/Frameworks/Updater")); - QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Telegram.app/Contents/Frameworks/Updater")); --#elif defined Q_OS_LINUX // Q_OS_MAC -+#elif defined Q_OS_LINUX || defined Q_OS_HAIKU // Q_OS_MAC - QString curUpdater = (cExeDir() + qsl("Updater")); - QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater")); - #endif // Q_OS_LINUX +diff --git a/Telegram/Resources/etc/qt_haiku.conf b/Telegram/Resources/etc/qt_haiku.conf +new file mode 100644 +index 0000000..6d80862 +--- /dev/null ++++ b/Telegram/Resources/etc/qt_haiku.conf +@@ -0,0 +1,2 @@ ++[Paths] ++Libraries=:/gui/art +diff --git a/Telegram/Resources/qrc/telegram_emoji.qrc b/Telegram/Resources/qrc/telegram_emoji.qrc +index bb9ce0a..47a0c05 100644 +--- a/Telegram/Resources/qrc/telegram_emoji.qrc ++++ b/Telegram/Resources/qrc/telegram_emoji.qrc +@@ -2,7 +2,5 @@ + + ../art/emoji.webp + ../art/emoji_125x.webp +- ../art/emoji_150x.webp +- ../art/emoji_200x.webp + + +diff --git a/Telegram/Resources/qrc/telegram_emoji2.qrc b/Telegram/Resources/qrc/telegram_emoji2.qrc +new file mode 100644 +index 0000000..e1ddb8d +--- /dev/null ++++ b/Telegram/Resources/qrc/telegram_emoji2.qrc +@@ -0,0 +1,6 @@ ++ ++ ++ ../art/emoji_150x.webp ++ ../art/emoji_200x.webp ++ ++ +diff --git a/Telegram/Resources/qrc/telegram_haiku.qrc b/Telegram/Resources/qrc/telegram_haiku.qrc +new file mode 100644 +index 0000000..33115f9 +--- /dev/null ++++ b/Telegram/Resources/qrc/telegram_haiku.qrc +@@ -0,0 +1,5 @@ ++ ++ ++ ../etc/qt_haiku.conf ++ ++ +diff --git a/Telegram/SourceFiles/base/algorithm_tests.cpp b/Telegram/SourceFiles/base/algorithm_tests.cpp +index 9e3df82..3092663 100644 +--- a/Telegram/SourceFiles/base/algorithm_tests.cpp ++++ b/Telegram/SourceFiles/base/algorithm_tests.cpp +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include "base/index_based_iterator.h" + +@@ -47,4 +51,4 @@ TEST_CASE("index_based_iterator tests", "[base::algorithm]") { + auto expected = std::vector { 5 }; + REQUIRE(v == expected); + } +-} +\ No newline at end of file ++} diff --git a/Telegram/SourceFiles/base/build_config.h b/Telegram/SourceFiles/base/build_config.h -index 1731630..3a93c27 100644 +index 4640bce..20c3088 100644 --- a/Telegram/SourceFiles/base/build_config.h +++ b/Telegram/SourceFiles/base/build_config.h -@@ -30,13 +30,15 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +@@ -17,13 +17,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #define OS_LINUX 1 #elif defined(_WIN32) // __APPLE__ || __linux__ #define OS_WIN 1 -+#elif defined(__HAIKU__) // __APPLE__ || __linux__ ++#elif defined(__HAIKU__) +#define OS_HAIKU 1 #else // __APPLE__ || __linux__ || _WIN32 #error Please add support for your platform in base/build_config.h @@ -39,64 +92,75 @@ index 1731630..3a93c27 100644 #endif // OS_MAC || OS_LINUX diff --git a/Telegram/SourceFiles/base/flags_tests.cpp b/Telegram/SourceFiles/base/flags_tests.cpp -index f2da24d..d19add1 100644 +index 786dc49..b1ed887 100644 --- a/Telegram/SourceFiles/base/flags_tests.cpp +++ b/Telegram/SourceFiles/base/flags_tests.cpp -@@ -18,7 +18,7 @@ to link the code of portions of this program with the OpenSSL library. - Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE - Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ --#include "catch.hpp" ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else +#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif #include "base/flags.h" diff --git a/Telegram/SourceFiles/base/flat_map_tests.cpp b/Telegram/SourceFiles/base/flat_map_tests.cpp -index 88a83a2..6551667 100644 +index 8f1ddb1..e4f0a4e 100644 --- a/Telegram/SourceFiles/base/flat_map_tests.cpp +++ b/Telegram/SourceFiles/base/flat_map_tests.cpp -@@ -18,7 +18,7 @@ to link the code of portions of this program with the OpenSSL library. - Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE - Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ --#include "catch.hpp" ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else +#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif #include "base/flat_map.h" #include diff --git a/Telegram/SourceFiles/base/flat_set_tests.cpp b/Telegram/SourceFiles/base/flat_set_tests.cpp -index 675b0bd..735ab1b 100644 +index a73f1d2..77d98a6 100644 --- a/Telegram/SourceFiles/base/flat_set_tests.cpp +++ b/Telegram/SourceFiles/base/flat_set_tests.cpp -@@ -18,7 +18,7 @@ to link the code of portions of this program with the OpenSSL library. - Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE - Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ --#include "catch.hpp" -+#include "../../ThirdParty/variant/test/include/catch.hpp" ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif #include "base/flat_set.h" diff --git a/Telegram/SourceFiles/base/tests_main.cpp b/Telegram/SourceFiles/base/tests_main.cpp -index 0696e47..02bf016 100644 +index dfc7fa0..38c6308 100644 --- a/Telegram/SourceFiles/base/tests_main.cpp +++ b/Telegram/SourceFiles/base/tests_main.cpp -@@ -19,8 +19,8 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE - Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org +@@ -6,8 +6,12 @@ For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #define CATCH_CONFIG_RUNNER --#include "catch.hpp" --#include "reporters/catch_reporter_compact.hpp" ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" + #include "reporters/catch_reporter_compact.hpp" ++#else +#include "../ThirdParty/variant/test/include/catch.hpp" -+//#include "reporters/catch_reporter_compact.hpp" ++#endif #include - namespace Catch { + namespace base { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h -index 633c4e4..0d09e7d 100644 +index 386801a..9d856c8 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h -@@ -272,6 +272,8 @@ inline const char *cApiDeviceModel() { +@@ -229,6 +229,8 @@ inline const char *cApiDeviceModel() { return "Mac"; #elif defined Q_OS_LINUX return "PC"; @@ -105,900 +169,57 @@ index 633c4e4..0d09e7d 100644 #endif } inline const char *cApiSystemVersion() { -@@ -281,6 +283,8 @@ inline const char *cApiSystemVersion() { +@@ -238,6 +240,8 @@ inline const char *cApiSystemVersion() { return "OS X"; #elif defined Q_OS_LINUX return "Linux"; -+#elif defined Q_OS_Haiku ++#elif defined Q_OS_HAIKU + return "Haiku"; #endif } -diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp -index 6e85f27..4684e2a 100644 ---- a/Telegram/SourceFiles/main.cpp -+++ b/Telegram/SourceFiles/main.cpp -@@ -23,9 +23,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org - #include "storage/localstorage.h" +diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp +index a773f37..9ca86b7 100644 +--- a/Telegram/SourceFiles/core/launcher.cpp ++++ b/Telegram/SourceFiles/core/launcher.cpp +@@ -54,6 +54,10 @@ int Launcher::exec() { - int main(int argc, char *argv[]) { --#ifndef Q_OS_MAC // Retina display support is working fine, others are not. -+#if !defined(Q_OS_MAC) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) -+ // Retina display support is working fine, others are not. - QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); --#endif // Q_OS_MAC -+#endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0 - QCoreApplication::setApplicationName(qsl("TelegramDesktop")); - - InitFromCommandLine(argc, argv); -@@ -39,6 +40,11 @@ int main(int argc, char *argv[]) { - Logs::start(); // must be started before Platform is started - Platform::start(); // must be started before QApplication is created - -+ // I don't know why path is not in QT_PLUGIN_PATH by default -+ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt"); -+ // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors -+ setenv("QT_STYLE_OVERRIDE", "qwerty", false); -+ - int result = 0; - { - Application app(argc, argv); -diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h -index a8bf969..7559354 100644 ---- a/Telegram/SourceFiles/platform/linux/linux_libs.h -+++ b/Telegram/SourceFiles/platform/linux/linux_libs.h -@@ -29,7 +29,7 @@ extern "C" { - } // extern "C" - - #ifndef TDESKTOP_DISABLE_UNITY_INTEGRATION --#include -+typedef void UnityLauncherEntry; - #endif // !TDESKTOP_DISABLE_UNITY_INTEGRATION - - namespace Platform { -diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h -index 593ab28..c08f759 100644 ---- a/Telegram/SourceFiles/platform/platform_file_utilities.h -+++ b/Telegram/SourceFiles/platform/platform_file_utilities.h -@@ -51,8 +51,8 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, - - #ifdef Q_OS_MAC - #include "platform/mac/file_utilities_mac.h" --#elif defined Q_OS_LINUX // Q_OS_MAC --#include "platform/linux/file_utilities_linux.h" -+//#elif defined Q_OS_LINUX // Q_OS_MAC -+//#include "platform/linux/file_utilities_linux.h" - #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX - #include "platform/win/file_utilities_win.h" - #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN -diff --git a/Telegram/SourceFiles/platform/platform_main_window.h b/Telegram/SourceFiles/platform/platform_main_window.h -index b7b5334..66af0cd 100644 ---- a/Telegram/SourceFiles/platform/platform_main_window.h -+++ b/Telegram/SourceFiles/platform/platform_main_window.h -@@ -34,6 +34,8 @@ class MainWindow; - #include "platform/mac/main_window_mac.h" - #elif defined Q_OS_LINUX // Q_OS_MAC - #include "platform/linux/main_window_linux.h" --#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX -+#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX -+#include "platform/haiku/main_window_haiku.h" -+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU - #include "platform/win/main_window_win.h" - #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN -diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h -index 359b047..dca0c7e 100644 ---- a/Telegram/SourceFiles/platform/platform_specific.h -+++ b/Telegram/SourceFiles/platform/platform_specific.h -@@ -47,6 +47,8 @@ void finish(); - #include "platform/mac/specific_mac.h" - #elif defined Q_OS_LINUX // Q_OS_MAC - #include "platform/linux/specific_linux.h" --#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX -+#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX -+#include "platform/haiku/specific_haiku.h" -+#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU - #include "platform/win/specific_win.h" - #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN -diff --git a/Telegram/SourceFiles/platform/platform_window_title.h b/Telegram/SourceFiles/platform/platform_window_title.h -index 1d0d892..285568c 100644 ---- a/Telegram/SourceFiles/platform/platform_window_title.h -+++ b/Telegram/SourceFiles/platform/platform_window_title.h -@@ -38,7 +38,7 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe - #include "platform/mac/window_title_mac.h" - #elif defined Q_OS_WIN // Q_OS_MAC - #include "platform/win/window_title_win.h" --#elif defined Q_OS_WINRT || defined Q_OS_LINUX // Q_OS_MAC || Q_OS_WIN -+#elif defined Q_OS_WINRT || defined Q_OS_LINUX || defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_WIN - - namespace Platform { - -diff --git a/Telegram/SourceFiles/qt_functions.cpp b/Telegram/SourceFiles/qt_functions.cpp -new file mode 100644 -index 0000000..4a722b8 ---- /dev/null -+++ b/Telegram/SourceFiles/qt_functions.cpp -@@ -0,0 +1,94 @@ -+/**************************************************************************** -+** -+** Copyright (C) 2015 The Qt Company Ltd. -+** Contact: http://www.qt.io/licensing/ -+** -+** This file contains some parts of the Qt Toolkit. -+** -+** $QT_BEGIN_LICENSE:LGPL21$ -+** Commercial License Usage -+** Licensees holding valid commercial Qt licenses may use this file in -+** accordance with the commercial license agreement provided with the -+** Software or, alternatively, in accordance with the terms contained in -+** a written agreement between you and The Qt Company. For licensing terms -+** and conditions see http://www.qt.io/terms-conditions. For further -+** information use the contact form at http://www.qt.io/contact-us. -+** -+** GNU Lesser General Public License Usage -+** Alternatively, this file may be used under the terms of the GNU Lesser -+** General Public License version 2.1 or version 3 as published by the Free -+** Software Foundation and appearing in the file LICENSE.LGPLv21 and -+** LICENSE.LGPLv3 included in the packaging of this file. Please review the -+** following information to ensure the GNU Lesser General Public License -+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -+** -+** As a special exception, The Qt Company gives you certain additional -+** rights. These rights are described in The Qt Company LGPL Exception -+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -+** -+** $QT_END_LICENSE$ -+** -+****************************************************************************/ -+ -+/* TODO: find a dynamic library with these symbols. */ -+ -+/* Debian maintainer: this function is taken from qfiledialog.cpp */ -+/* -+ Makes a list of filters from ;;-separated text. -+ Used by the mac and windows implementations -+*/ -+QStringList qt_make_filter_list(const QString &filter) -+{ -+ QString f(filter); -+ -+ if (f.isEmpty()) -+ return QStringList(); -+ -+ QString sep(QLatin1String(";;")); -+ int i = f.indexOf(sep, 0); -+ if (i == -1) { -+ if (f.indexOf(QLatin1Char('\n'), 0) != -1) { -+ sep = QLatin1Char('\n'); -+ i = f.indexOf(sep, 0); -+ } -+ } -+ -+ return f.split(sep); -+} -+ -+/* Debian maintainer: this constructor is taken from qtextengine.cpp for TextPainter::drawLine */ -+QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe, const QTextCharFormat &format) -+ : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), charFormat(format), -+ num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) -+{ -+} -+ -+/* Debian maintainer: this method is also taken from qtextengine.cpp */ -+// Fix up flags and underlineStyle with given info -+void QTextItemInt::initWithScriptItem(const QScriptItem &si) -+{ -+ // explicitly initialize flags so that initFontAttributes can be called -+ // multiple times on the same TextItem -+ flags = 0; -+ if (si.analysis.bidiLevel %2) -+ flags |= QTextItem::RightToLeft; -+ ascent = si.ascent; -+ descent = si.descent; -+ -+ if (charFormat.hasProperty(QTextFormat::TextUnderlineStyle)) { -+ underlineStyle = charFormat.underlineStyle(); -+ } else if (charFormat.boolProperty(QTextFormat::FontUnderline) -+ || f->d->underline) { -+ underlineStyle = QTextCharFormat::SingleUnderline; -+ } -+ -+ // compat -+ if (underlineStyle == QTextCharFormat::SingleUnderline) -+ flags |= QTextItem::Underline; -+ -+ if (f->d->overline || charFormat.fontOverline()) -+ flags |= QTextItem::Overline; -+ if (f->d->strikeOut || charFormat.fontStrikeOut()) -+ flags |= QTextItem::StrikeOut; -+} -diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp -index b975c7a..f2f876b 100644 ---- a/Telegram/SourceFiles/qt_static_plugins.cpp -+++ b/Telegram/SourceFiles/qt_static_plugins.cpp -@@ -28,13 +28,4 @@ Q_IMPORT_PLUGIN(QWebpPlugin) - Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) - Q_IMPORT_PLUGIN(QGenericEnginePlugin) - #elif defined Q_OS_LINUX // Q_OS_WIN | Q_OS_MAC --Q_IMPORT_PLUGIN(QWebpPlugin) --Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) --Q_IMPORT_PLUGIN(QConnmanEnginePlugin) --Q_IMPORT_PLUGIN(QGenericEnginePlugin) --Q_IMPORT_PLUGIN(QNetworkManagerEnginePlugin) --Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) --Q_IMPORT_PLUGIN(QHimePlatformInputContextPlugin) - #endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX -diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp -index d18a8ea..2c58287 100644 ---- a/Telegram/SourceFiles/ui/text/text.cpp -+++ b/Telegram/SourceFiles/ui/text/text.cpp -@@ -1689,11 +1689,11 @@ private: - if (item == -1) - return; - --#ifdef OS_MAC_OLD -+#if defined(OS_MAC_OLD) || QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - auto end = _e->findItem(line.from + line.length - 1); --#else // OS_MAC_OLD -+#else - auto end = _e->findItem(line.from + line.length - 1, item); --#endif // OS_MAC_OLD + // I don't know why path is not in QT_PLUGIN_PATH by default + QCoreApplication::addLibraryPath("/usr/lib/qt/plugins"); ++#if defined(Q_OS_HAIKU) ++ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5"); ++ QCoreApplication::addLibraryPath("/boot/system/add-ons/x86/Qt5"); +#endif - - auto blockIndex = _lineStartBlock; - auto currentBlock = _t->_blocks[blockIndex].get(); -diff --git a/Telegram/SourceFiles/ui/text/text_block.cpp b/Telegram/SourceFiles/ui/text/text_block.cpp -index f89644e..35230cf 100644 ---- a/Telegram/SourceFiles/ui/text/text_block.cpp -+++ b/Telegram/SourceFiles/ui/text/text_block.cpp -@@ -330,7 +330,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi - SignalHandlers::setCrashAnnotationRef("CrashString", &part); - - QStackTextEngine engine(part, blockFont->f); -- QTextLayout layout(&engine); -+ QTextLayout layout(part, blockFont->f); - layout.beginLayout(); - layout.createLine(); - -diff --git a/Telegram/SourceFiles/ui/twidget.cpp b/Telegram/SourceFiles/ui/twidget.cpp -index e9848ef..dcee47e 100644 ---- a/Telegram/SourceFiles/ui/twidget.cpp -+++ b/Telegram/SourceFiles/ui/twidget.cpp -@@ -191,9 +191,9 @@ void sendSynteticMouseEvent(QWidget *widget, QEvent::Type type, Qt::MouseButton - , button - , QGuiApplication::mouseButtons() | button - , QGuiApplication::keyboardModifiers() --#ifndef OS_MAC_OLD -+#if !defined(OS_MAC_OLD) && QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - , Qt::MouseEventSynthesizedByApplication --#endif // OS_MAC_OLD -+#endif - ); - ev.setTimestamp(getms()); - QGuiApplication::sendEvent(windowHandle, &ev); -diff --git a/Telegram/ThirdParty/minizip/ioapi.c b/Telegram/ThirdParty/minizip/ioapi.c -index 7f5c191..649255c 100644 ---- a/Telegram/ThirdParty/minizip/ioapi.c -+++ b/Telegram/ThirdParty/minizip/ioapi.c -@@ -14,7 +14,7 @@ - #define _CRT_SECURE_NO_WARNINGS - #endif - --#if defined(__APPLE__) || defined(IOAPI_NO_64) -+#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) - // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions - #define FOPEN_FUNC(filename, mode) fopen(filename, mode) - #define FTELLO_FUNC(stream) ftello(stream) -diff --git a/Telegram/gyp/PrecompiledHeader.cmake b/Telegram/gyp/PrecompiledHeader.cmake -index 5d6830e..c3f08d3 100644 ---- a/Telegram/gyp/PrecompiledHeader.cmake -+++ b/Telegram/gyp/PrecompiledHeader.cmake -@@ -112,7 +112,7 @@ function(add_precompiled_header _target _input) - set(_compiler_FLAGS "@${_pch_c_flags_file}") - add_custom_command( - OUTPUT "${_output_c}" -- COMMAND "${CMAKE_C_COMPILER}" ${_compiler_FLAGS} -x c-header -o "${_output_c}" -c "${_pchfile}" -+ COMMAND "${CMAKE_C_COMPILER}" "$(C_DEFINES)" "$(C_INCLUDES)" "$(C_FLAGS)" -x c-header -o "${_output_c}" -c "${_pchfile}" - DEPENDS "${_pchfile}" "${_pch_c_flags_file}" - IMPLICIT_DEPENDS C "${_pch_header}" - COMMENT "Precompiling ${_name} for ${_target} (C)") -@@ -123,7 +123,7 @@ function(add_precompiled_header _target _input) - set(_compiler_FLAGS "@${_pch_cpp_flags_file}") - add_custom_command( - OUTPUT "${_output_cxx}" -- COMMAND "${CMAKE_CXX_COMPILER}" ${_compiler_FLAGS} -x c++-header -o "${_output_cxx}" -c "${_pchfile}" -+ COMMAND "${CMAKE_CXX_COMPILER}" "$(CXX_DEFINES)" "$(CXX_INCLUDES)" "$(CXX_FLAGS)" -x c++-header -o "${_output_cxx}" -c "${_pchfile}" - DEPENDS "${_pchfile}" "${_pch_cpp_flags_file}" - IMPLICIT_DEPENDS CXX "${_pch_header}" - COMMENT "Precompiling ${_name} for ${_target} (C++)") -diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp -index 0d1f38a..e716483 100644 ---- a/Telegram/gyp/Telegram.gyp -+++ b/Telegram/gyp/Telegram.gyp -@@ -69,6 +69,7 @@ - 'telegram_win.gypi', - 'telegram_mac.gypi', - 'telegram_linux.gypi', -+ 'telegram_haiku.gypi', - 'qt.gypi', - 'qt_rcc.gypi', - 'codegen_rules.gypi', -@@ -80,12 +81,10 @@ - 'codegen.gyp:codegen_numbers', - 'codegen.gyp:codegen_style', - 'tests/tests.gyp:tests', -- 'utils.gyp:Updater', -- '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', -+# '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', - ], - - 'defines': [ -- 'AL_LIBTYPE_STATIC', - 'AL_ALEXT_PROTOTYPES', - 'TGVOIP_USE_CXX11_LIB', - ' /dev/null --libs <@(pkgconfig_libs))', -+ ], -+ 'configurations': { -+ 'Release': { -+ 'cflags': [ -+ '-Ofast', -+ '-flto', -+ '-fno-strict-aliasing', -+ ], -+ 'cflags_cc': [ -+ '-Ofast', -+ '-flto', -+ '-fno-strict-aliasing', -+ ], -+ 'ldflags': [ -+ '-Ofast', -+ '-flto', -+ ], -+ }, -+ }, -+ 'cmake_precompiled_header': '<(src_loc)/stdafx.h', -+ 'cmake_precompiled_header_script': 'PrecompiledHeader.cmake', -+ }]], -+} -diff --git a/Telegram/gyp/telegram_qrc.gypi b/Telegram/gyp/telegram_qrc.gypi -index 4bf4033..8fdd119 100644 ---- a/Telegram/gyp/telegram_qrc.gypi -+++ b/Telegram/gyp/telegram_qrc.gypi -@@ -34,6 +34,13 @@ - ], - } - }], -+ [ 'build_haiku', { -+ 'variables': { -+ 'qrc_files': [ -+ '<(res_loc)/qrc/telegram_haiku.qrc', -+ ], -+ } -+ }], - [ 'build_mac', { - 'variables': { - 'qrc_files': [ -diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt -index ef66965..58f2789 100644 ---- a/Telegram/gyp/telegram_sources.txt -+++ b/Telegram/gyp/telegram_sources.txt -@@ -302,6 +302,10 @@ - <(src_loc)/mtproto/type_utils.h - <(src_loc)/overview/overview_layout.cpp - <(src_loc)/overview/overview_layout.h -+<(src_loc)/platform/haiku/main_window_haiku.cpp -+<(src_loc)/platform/haiku/main_window_haiku.h -+<(src_loc)/platform/haiku/specific_haiku.cpp -+<(src_loc)/platform/haiku/specific_haiku.h - <(src_loc)/platform/linux/linux_desktop_environment.cpp - <(src_loc)/platform/linux/linux_desktop_environment.h - <(src_loc)/platform/linux/linux_gdk_helper.cpp -@@ -599,13 +603,7 @@ - <(emoji_suggestions_loc)/emoji_suggestions.h - - platforms: !win --<(minizip_loc)/crypt.h --<(minizip_loc)/ioapi.c --<(minizip_loc)/ioapi.h --<(minizip_loc)/zip.c --<(minizip_loc)/zip.h --<(minizip_loc)/unzip.c --<(minizip_loc)/unzip.h -+<(src_loc)/qt_functions.cpp - - platforms: mac - <(sp_media_key_tap_loc)/SPMediaKeyTap.m -diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp -index 209c737..07d7438 100644 ---- a/Telegram/gyp/utils.gyp -+++ b/Telegram/gyp/utils.gyp -@@ -91,6 +91,13 @@ - 'lzma', - ], - }], -+ [ 'build_haiku', { -+ 'libraries': [ -+ 'ssl', -+ 'crypto', -+ 'lzma', -+ ], -+ }], - [ 'build_mac', { - 'include_dirs': [ - '<(libs_loc)/openssl-xcode/include' --- -2.16.2 - - -From 83d1bc6fa3e20e39f856296b7c9c9ad5c5c4b779 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:01:57 +1000 -Subject: Fix typo - - -diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h -index 0d09e7d..793310e 100644 ---- a/Telegram/SourceFiles/config.h -+++ b/Telegram/SourceFiles/config.h -@@ -283,7 +283,7 @@ inline const char *cApiSystemVersion() { - return "OS X"; - #elif defined Q_OS_LINUX - return "Linux"; --#elif defined Q_OS_Haiku -+#elif defined Q_OS_HAIKU - return "Haiku"; - #endif - } --- -2.16.2 - - -From 33a0eadf8e61bbd13833e70dde93b161a1ba1b4f Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:05:59 +1000 -Subject: Add haiku platform modules - - -diff --git a/Telegram/Resources/etc/qt_haiku.conf b/Telegram/Resources/etc/qt_haiku.conf -new file mode 100644 -index 0000000..6d80862 ---- /dev/null -+++ b/Telegram/Resources/etc/qt_haiku.conf -@@ -0,0 +1,2 @@ -+[Paths] -+Libraries=:/gui/art -diff --git a/Telegram/Resources/qrc/telegram_haiku.qrc b/Telegram/Resources/qrc/telegram_haiku.qrc -new file mode 100644 -index 0000000..33115f9 ---- /dev/null -+++ b/Telegram/Resources/qrc/telegram_haiku.qrc -@@ -0,0 +1,5 @@ -+ -+ -+ ../etc/qt_haiku.conf -+ -+ + // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors + setenv("QT_STYLE_OVERRIDE", "qwerty", false); + // Telegram doesn't start when extraordinary theme is set, see launchpad.net/bugs/1680943 +@@ -133,6 +137,9 @@ void Launcher::prepareSettings() { + case dbipMacOld: + gPlatformString = qsl("MacOSold"); + break; ++ case dbipHaiku: ++ gPlatformString = qsl("HaikuDepot"); ++ break; + case dbipLinux64: + gPlatformString = qsl("Linux64bit"); + break; +diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp +index 722e02e..4d876ce 100644 +--- a/Telegram/SourceFiles/core/update_checker.cpp ++++ b/Telegram/SourceFiles/core/update_checker.cpp +@@ -311,6 +311,7 @@ bool Updater::checkResponse(const QByteArray &response) { + case dbipWindows: return "win"; + case dbipMac: return "mac"; + case dbipMacOld: return "mac32"; ++ case dbipHaiku: return "haiku"; + case dbipLinux64: return "linux"; + case dbipLinux32: return "linux32"; + } diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h -index 3c46326..dc5f1fe 100644 +index 08f6f65..3a730de 100644 --- a/Telegram/SourceFiles/core/utils.h +++ b/Telegram/SourceFiles/core/utils.h -@@ -496,6 +496,7 @@ enum DBIPlatform { +@@ -468,6 +468,7 @@ enum DBIPlatform { dbipLinux64 = 2, dbipLinux32 = 3, dbipMacOld = 4, @@ -1006,12 +227,46 @@ index 3c46326..dc5f1fe 100644 }; enum DBIPeerReportSpamStatus { +diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp +index 5ecf2b7..218b91b 100644 +--- a/Telegram/SourceFiles/logs.cpp ++++ b/Telegram/SourceFiles/logs.cpp +@@ -321,7 +321,7 @@ void start(not_null launcher) { + if (cBetaVersion()) { + cSetDebug(true); + workingDirChosen = true; +-#if defined Q_OS_MAC || defined Q_OS_LINUX ++#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_HAIKU + } else { + #ifdef _DEBUG + cForceWorkingDir(cExeDir()); +diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp +index 38aa7b1..9d11a1c 100644 +--- a/Telegram/SourceFiles/media/media_audio.cpp ++++ b/Telegram/SourceFiles/media/media_audio.cpp +@@ -86,6 +86,7 @@ void EnumeratePlaybackDevices() { + void EnumerateCaptureDevices() { + auto deviceNames = QStringList(); + auto devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER); ++#ifndef __HAIKU__ + Assert(devices != nullptr); + while (*devices != 0) { + auto deviceName8Bit = QByteArray(devices); +@@ -94,7 +95,7 @@ void EnumerateCaptureDevices() { + devices += deviceName8Bit.size() + 1; + } + LOG(("Audio Capture Devices: %1").arg(deviceNames.join(';'))); +- ++#endif + if (auto device = alcGetString(nullptr, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) { + LOG(("Audio Capture Default Device: %1").arg(QString::fromLocal8Bit(device))); + } else { diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp new file mode 100644 -index 0000000..1a8afbd +index 0000000..5777c2c --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -@@ -0,0 +1,121 @@ +@@ -0,0 +1,137 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org @@ -1071,17 +326,33 @@ index 0000000..1a8afbd +} // namespace internal + +void UnsafeShowInFolder(const QString &filepath) { -+ Ui::hideLayer(true); // Hide mediaview to make other apps visible. ++ Ui::hideLayer(anim::type::instant); // Hide mediaview to make other apps visible. + auto absolutePath = QFileInfo(filepath).absoluteFilePath(); + QProcess process; + auto command = qsl("open"); + auto arguments = QStringList(); + arguments << QFileInfo(filepath).absoluteDir().absolutePath(); ++ + if (!process.startDetached(command, arguments)) { + LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' '))); + } +} + ++bool UnsafeShowOpenWith(const QString &filepath) { ++ auto absolutePath = QFileInfo(filepath).absoluteFilePath(); ++ ++ QProcess process; ++ auto command = qsl("open"); ++ auto arguments = QStringList(); ++ arguments << absolutePath; ++ ++ if (!process.startDetached(command, arguments)) { ++ LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' '))); ++ return false; ++ } ++ return true; ++} ++ +} // namespace File + +namespace FileDialog { @@ -1135,10 +406,10 @@ index 0000000..1a8afbd +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h new file mode 100644 -index 0000000..103ccb6 +index 0000000..23e4a1f --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -@@ -0,0 +1,75 @@ +@@ -0,0 +1,71 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org @@ -1188,10 +459,6 @@ index 0000000..103ccb6 + return false; +} + -+inline bool UnsafeShowOpenWith(const QString &filepath) { -+ return false; -+} -+ +inline void UnsafeLaunch(const QString &filepath) { + return ::File::internal::UnsafeLaunchDefault(filepath); +} @@ -1334,12 +601,94 @@ index 0000000..e76c8fe + +} // namespace DesktopEnvironment +} // namespace Platform +diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp +new file mode 100644 +index 0000000..6a38373 +--- /dev/null ++++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp +@@ -0,0 +1,47 @@ ++/* ++This file is part of Telegram Desktop, ++the official desktop application for the Telegram messaging service. ++ ++For license and copyright information please follow this link: ++https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL ++*/ ++#include "platform/haiku/launcher_haiku.h" ++ ++#include "core/crash_reports.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace Platform { ++namespace { ++ ++class Arguments { ++public: ++ void push(QByteArray argument) { ++ argument.append(char(0)); ++ _argumentValues.push_back(argument); ++ _arguments.push_back(_argumentValues.back().data()); ++ } ++ ++ char **result() { ++ _arguments.push_back(nullptr); ++ return _arguments.data(); ++ } ++ ++private: ++ std::vector _argumentValues; ++ std::vector _arguments; ++ ++}; ++ ++} // namespace ++ ++bool Launcher::launchUpdater(UpdaterLaunch action) { ++ return false; ++} ++ ++} // namespace +diff --git a/Telegram/SourceFiles/platform/haiku/launcher_haiku.h b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h +new file mode 100644 +index 0000000..db1de28 +--- /dev/null ++++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h +@@ -0,0 +1,23 @@ ++/* ++This file is part of Telegram Desktop, ++the official desktop application for the Telegram messaging service. ++ ++For license and copyright information please follow this link: ++https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL ++*/ ++#pragma once ++ ++#include "core/launcher.h" ++ ++namespace Platform { ++ ++class Launcher : public Core::Launcher { ++public: ++ using Core::Launcher::Launcher; ++ ++private: ++ bool launchUpdater(UpdaterLaunch action) override; ++ ++}; ++ ++} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp new file mode 100644 -index 0000000..dd3c644 +index 0000000..a1ef5d8 --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp -@@ -0,0 +1,135 @@ +@@ -0,0 +1,136 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org @@ -1364,6 +713,7 @@ index 0000000..dd3c644 + +#include "styles/style_window.h" +#include "platform/haiku/haiku_desktop_environment.h" ++#include "history/history.h" +#include "mainwindow.h" +#include "messenger.h" +#include "application.h" @@ -1435,7 +785,7 @@ index 0000000..dd3c644 +} + +void MainWindow::updateIconCounters() { -+ auto counter = App::histories().unreadBadge(); ++ auto counter = App::histories().unreadBadge(); + auto muted = App::histories().unreadOnlyMuted(); + auto iconSizeSmall = QSize(16, 16); + auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg); @@ -1562,7 +912,7 @@ index 0000000..56cc497 +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp new file mode 100644 -index 0000000..dc54c57 +index 0000000..b3d186a --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp @@ -0,0 +1,82 @@ @@ -1590,7 +940,7 @@ index 0000000..dc54c57 + +#include "window/notifications_utilities.h" +#include "lang/lang_keys.h" -+#include "base/task_queue.h" ++#include "history/history.h" + +namespace Platform { +namespace Notifications { @@ -1719,10 +1069,10 @@ index 0000000..d70bcff +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp new file mode 100644 -index 0000000..ce9091a +index 0000000..b303e1d --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -@@ -0,0 +1,416 @@ +@@ -0,0 +1,397 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org @@ -2010,28 +1360,9 @@ index 0000000..ce9091a +// objc_activateProgram(); +} + -+namespace { -+ -+QString getHomeDir() { -+ struct passwd *pw = getpwuid(getuid()); -+ return (pw && pw->pw_dir && strlen(pw->pw_dir)) ? (QFile::decodeName(pw->pw_dir) + '/') : QString(); -+} -+ -+} // namespace + +QString psAppDataPath() { -+ // Previously we used ~/.TelegramDesktop, so look there first. -+ // If we find data there, we should still use it. -+ auto home = getHomeDir(); -+ if (!home.isEmpty()) { -+ auto oldPath = home + qsl(".TelegramDesktop/"); -+ auto oldSettingsBase = oldPath + qsl("tdata/settings"); -+ if (QFile(oldSettingsBase + '0').exists() || QFile(oldSettingsBase + '1').exists()) { -+ return oldPath; -+ } -+ } -+ -+ return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/'; ++ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/'; +} + +QString psDownloadPath() { @@ -2266,10 +1597,10 @@ index 0000000..99d13d5 + +bool psLaunchMaps(const LocationCoords &coords); diff --git a/Telegram/SourceFiles/platform/platform_audio.h b/Telegram/SourceFiles/platform/platform_audio.h -index 516398a..3511402 100644 +index 7705b2e..cfc1fc9 100644 --- a/Telegram/SourceFiles/platform/platform_audio.h +++ b/Telegram/SourceFiles/platform/platform_audio.h -@@ -32,7 +32,7 @@ void DeInit(); +@@ -19,7 +19,7 @@ void DeInit(); // Platform dependent implementations. @@ -2279,27 +1610,50 @@ index 516398a..3511402 100644 namespace Audio { diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h -index c08f759..50d7418 100644 +index b595362..f109c91 100644 --- a/Telegram/SourceFiles/platform/platform_file_utilities.h +++ b/Telegram/SourceFiles/platform/platform_file_utilities.h -@@ -51,8 +51,10 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, - - #ifdef Q_OS_MAC +@@ -40,6 +40,8 @@ bool Get(QStringList &files, QByteArray &remoteContent, const QString &caption, #include "platform/mac/file_utilities_mac.h" --//#elif defined Q_OS_LINUX // Q_OS_MAC --//#include "platform/linux/file_utilities_linux.h" -+#elif defined Q_OS_LINUX // Q_OS_MAC -+#include "platform/linux/file_utilities_linux.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/file_utilities_linux.h" +#elif defined Q_OS_HAIKU // Q_OS_LINUX +#include "platform/haiku/file_utilities_haiku.h" #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX #include "platform/win/file_utilities_win.h" #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_launcher.h b/Telegram/SourceFiles/platform/platform_launcher.h +index 08ef909..e26f07e 100644 +--- a/Telegram/SourceFiles/platform/platform_launcher.h ++++ b/Telegram/SourceFiles/platform/platform_launcher.h +@@ -25,6 +25,8 @@ namespace Platform { + #include "platform/mac/launcher_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/launcher_linux.h" ++#elif defined Q_OS_HAIKU ++#include "platform/haiku/launcher_haiku.h" + #elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX + #include "platform/win/launcher_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_main_window.h b/Telegram/SourceFiles/platform/platform_main_window.h +index 33277c9..4e28b24 100644 +--- a/Telegram/SourceFiles/platform/platform_main_window.h ++++ b/Telegram/SourceFiles/platform/platform_main_window.h +@@ -21,6 +21,8 @@ class MainWindow; + #include "platform/mac/main_window_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/main_window_linux.h" +-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX ++#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX ++#include "platform/haiku/main_window_haiku.h" ++#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU + #include "platform/win/main_window_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h -index e303272..1bd4c74 100644 +index 692f4b4..a40f830 100644 --- a/Telegram/SourceFiles/platform/platform_notifications_manager.h +++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h -@@ -41,6 +41,8 @@ void FlashBounce(); +@@ -28,6 +28,8 @@ void FlashBounce(); #include "platform/mac/notifications_manager_mac.h" #elif defined Q_OS_LINUX // Q_OS_MAC #include "platform/linux/notifications_manager_linux.h" @@ -2308,22 +1662,87 @@ index e303272..1bd4c74 100644 #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX #include "platform/win/notifications_manager_win.h" #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN --- -2.16.2 - - -From 214ce9e63a7a86d28a8223ac573af504dd5ccbd2 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:09:06 +1000 -Subject: Add haiku platform for settings - - +diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h +index c2b1664..3a1cace 100644 +--- a/Telegram/SourceFiles/platform/platform_specific.h ++++ b/Telegram/SourceFiles/platform/platform_specific.h +@@ -34,6 +34,8 @@ void finish(); + #include "platform/mac/specific_mac.h" + #elif defined Q_OS_LINUX // Q_OS_MAC + #include "platform/linux/specific_linux.h" +-#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX ++#elif defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_LINUX ++#include "platform/haiku/specific_haiku.h" ++#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX || Q_OS_HAIKU + #include "platform/win/specific_win.h" + #endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN +diff --git a/Telegram/SourceFiles/platform/platform_window_title.h b/Telegram/SourceFiles/platform/platform_window_title.h +index 7aed20b..dc0212c 100644 +--- a/Telegram/SourceFiles/platform/platform_window_title.h ++++ b/Telegram/SourceFiles/platform/platform_window_title.h +@@ -25,7 +25,7 @@ void PreviewWindowFramePaint(QImage &preview, const style::palette &palette, QRe + #include "platform/mac/window_title_mac.h" + #elif defined Q_OS_WIN // Q_OS_MAC + #include "platform/win/window_title_win.h" +-#elif defined Q_OS_WINRT || defined Q_OS_LINUX // Q_OS_MAC || Q_OS_WIN ++#elif defined Q_OS_WINRT || defined Q_OS_LINUX || defined Q_OS_HAIKU // Q_OS_MAC || Q_OS_WIN + + namespace Platform { + +diff --git a/Telegram/SourceFiles/rpl/operators_tests.cpp b/Telegram/SourceFiles/rpl/operators_tests.cpp +index 704c447..9024600 100644 +--- a/Telegram/SourceFiles/rpl/operators_tests.cpp ++++ b/Telegram/SourceFiles/rpl/operators_tests.cpp +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include + #include +diff --git a/Telegram/SourceFiles/rpl/producer_tests.cpp b/Telegram/SourceFiles/rpl/producer_tests.cpp +index 42fc603..96acb8d 100644 +--- a/Telegram/SourceFiles/rpl/producer_tests.cpp ++++ b/Telegram/SourceFiles/rpl/producer_tests.cpp +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include + #include +diff --git a/Telegram/SourceFiles/rpl/variable_tests.cpp b/Telegram/SourceFiles/rpl/variable_tests.cpp +index 9c697fc..36ddf56 100644 +--- a/Telegram/SourceFiles/rpl/variable_tests.cpp ++++ b/Telegram/SourceFiles/rpl/variable_tests.cpp +@@ -5,7 +5,11 @@ the official desktop application for the Telegram messaging service. + For license and copyright information please follow this link: + https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + */ ++#if !defined(Q_OS_HAIKU) + #include "catch.hpp" ++#else ++#include "../ThirdParty/variant/test/include/catch.hpp" ++#endif + + #include + #include diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp -index 4306551..df713a3 100644 +index 1623698..89452b4 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp -@@ -96,6 +96,8 @@ int32 gIntRetinaFactor = 1; - DBIPlatform gPlatform = dbipWindows; +@@ -78,6 +78,8 @@ DBIPlatform gPlatform = dbipWindows; + DBIPlatform gPlatform = dbipMacOld; #elif defined Q_OS_MAC DBIPlatform gPlatform = dbipMac; +#elif defined Q_OS_HAIKU @@ -2331,298 +1750,397 @@ index 4306551..df713a3 100644 #elif defined Q_OS_LINUX64 DBIPlatform gPlatform = dbipLinux64; #elif defined Q_OS_LINUX32 -@@ -230,6 +232,10 @@ void InitFromCommandLine(int argc, char *argv[]) { - gUpdateURL = QUrl(qsl("http://tdesktop.com/linux32/tupdates/current")); - gPlatformString = qsl("Linux32bit"); - break; -+ case dbipHaiku: -+ gUpdateURL = QUrl(); -+ gPlatformString = qsl("HaikuDepot"); -+ break; - } +diff --git a/Telegram/ThirdParty/minizip/ioapi.c b/Telegram/ThirdParty/minizip/ioapi.c +index 7f5c191..649255c 100644 +--- a/Telegram/ThirdParty/minizip/ioapi.c ++++ b/Telegram/ThirdParty/minizip/ioapi.c +@@ -14,7 +14,7 @@ + #define _CRT_SECURE_NO_WARNINGS + #endif - auto path = Platform::CurrentExecutablePath(argc, argv); --- -2.16.2 - - -From a1340f3a185ebcf9c7f867d9ed1e7c8cca35b072 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:09:59 +1000 -Subject: Fix Qt plugins path - - -diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp -index 4684e2a..c65879b 100644 ---- a/Telegram/SourceFiles/main.cpp -+++ b/Telegram/SourceFiles/main.cpp -@@ -41,9 +41,7 @@ int main(int argc, char *argv[]) { - Platform::start(); // must be started before QApplication is created - - // I don't know why path is not in QT_PLUGIN_PATH by default -- QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt"); -- // without this Telegram doesn't start on Ubuntu 17.04 due GTK errors -- setenv("QT_STYLE_OVERRIDE", "qwerty", false); -+ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5"); - - int result = 0; - { --- -2.16.2 - - -From 1d02c12b4441c881bd7e56c7ed3ad9cf0e672e33 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:10:59 +1000 -Subject: Fix crash - - -diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp -index b0a1ade..9c84a34 100644 ---- a/Telegram/SourceFiles/media/media_audio.cpp -+++ b/Telegram/SourceFiles/media/media_audio.cpp -@@ -98,6 +98,7 @@ void EnumeratePlaybackDevices() { - void EnumerateCaptureDevices() { - auto deviceNames = QStringList(); - auto devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER); -+#ifndef __HAIKU__ - Assert(devices != nullptr); - while (*devices != 0) { - auto deviceName8Bit = QByteArray(devices); -@@ -106,7 +107,7 @@ void EnumerateCaptureDevices() { - devices += deviceName8Bit.size() + 1; - } - LOG(("Audio Capture Devices: %1").arg(deviceNames.join(';'))); -- -+#endif - if (auto device = alcGetString(nullptr, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)) { - LOG(("Audio Capture Default Device: %1").arg(QString::fromLocal8Bit(device))); - } else { --- -2.16.2 - - -From 38d9f402a28afabdfd7b56921f7fb646564cc96e Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 15 Sep 2017 22:14:32 +1000 -Subject: Add haiku platform files to build - - +-#if defined(__APPLE__) || defined(IOAPI_NO_64) ++#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__HAIKU__) + // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions + #define FOPEN_FUNC(filename, mode) fopen(filename, mode) + #define FTELLO_FUNC(stream) ftello(stream) diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp -index e716483..05f88e1 100644 +index aef8683..f44dc40 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp -@@ -81,7 +81,7 @@ - 'codegen.gyp:codegen_numbers', - 'codegen.gyp:codegen_style', - 'tests/tests.gyp:tests', --# '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', -+ '../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip', +@@ -57,6 +57,7 @@ + 'telegram_win.gypi', + 'telegram_mac.gypi', + 'telegram_linux.gypi', ++ 'telegram_haiku.gypi', + 'qt.gypi', + 'qt_moc.gypi', + 'qt_rcc.gypi', +@@ -82,11 +83,12 @@ + 'include_dirs': [ + '<(src_loc)', + '<(SHARED_INTERMEDIATE_DIR)', +- '/usr/include/minizip', ++ '<(minizip_loc)', + '<(emoji_suggestions_loc)', + '<(submodules_loc)/GSL/include', + '<(submodules_loc)/variant/include', + '<(submodules_loc)/crl/src', ++ '<(submodules_loc)/range/include', ], + 'sources': [ + '<@(qrc_files)', +diff --git a/Telegram/gyp/common.gypi b/Telegram/gyp/common.gypi +index 8b453a9..9a5866b 100644 +--- a/Telegram/gyp/common.gypi ++++ b/Telegram/gyp/common.gypi +@@ -8,6 +8,7 @@ + 'includes': [ + 'settings_win.gypi', + 'settings_mac.gypi', ++ 'settings_haiku.gypi', + 'settings_linux.gypi', + ], + 'variables': { +@@ -29,6 +30,11 @@ + }, { + 'build_mac': 0, + }], ++ [ 'build_os == "haiku"', { ++ 'build_haiku': 1, ++ }, { ++ 'build_haiku': 0, ++ }], + [ 'build_os == "linux"', { + 'build_linux': 1, + }, { +@@ -40,11 +46,13 @@ + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', ++ 'build_haiku%': '<(build_haiku)', + }, + 'build_os%': '<(build_os)', + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', ++ 'build_haiku%': '<(build_haiku)', - 'defines': [ -diff --git a/Telegram/gyp/settings_haiku.gypi b/Telegram/gyp/settings_haiku.gypi -index 7b5161e..3e5f508 100644 ---- a/Telegram/gyp/settings_haiku.gypi -+++ b/Telegram/gyp/settings_haiku.gypi -@@ -41,6 +41,10 @@ - [ '" /dev/null --libs <@(pkgconfig_libs))', - ], -diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt -index 58f2789..f86e6e6 100644 ---- a/Telegram/gyp/telegram_sources.txt -+++ b/Telegram/gyp/telegram_sources.txt -@@ -302,6 +302,10 @@ - <(src_loc)/mtproto/type_utils.h - <(src_loc)/overview/overview_layout.cpp - <(src_loc)/overview/overview_layout.h -+<(src_loc)/platform/haiku/file_utilities_haiku.cpp -+<(src_loc)/platform/haiku/file_utilities_haiku.h -+<(src_loc)/platform/haiku/notifications_manager_haiku.cpp -+<(src_loc)/platform/haiku/notifications_manager_haiku.h - <(src_loc)/platform/haiku/main_window_haiku.cpp - <(src_loc)/platform/haiku/main_window_haiku.h - <(src_loc)/platform/haiku/specific_haiku.cpp --- -2.16.2 - - -From ae174c17ba3577fcb2aa1a3574690d19358a9f5d Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sat, 16 Sep 2017 23:06:27 +1000 -Subject: Move working dir to user settings - - -diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp -index d916756..3d61a91 100644 ---- a/Telegram/SourceFiles/logs.cpp -+++ b/Telegram/SourceFiles/logs.cpp -@@ -311,7 +311,7 @@ namespace Logs { - QString initialWorkingDir = QDir(cWorkingDir()).absolutePath() + '/', moveOldDataFrom; - if (cBetaVersion()) { - cSetDebug(true); --#if defined Q_OS_MAC || defined Q_OS_LINUX -+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined Q_OS_HAIKU - } else { - #ifdef _DEBUG - cForceWorkingDir(cExeDir()); -diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -index ce9091a..b303e1d 100644 ---- a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -@@ -285,28 +285,9 @@ void psActivateProcess(uint64 pid) { - // objc_activateProgram(); - } + 'official_build_target%': '', + }, +@@ -52,6 +60,7 @@ + 'build_win%': '<(build_win)', + 'build_mac%': '<(build_mac)', + 'build_linux%': '<(build_linux)', ++ 'build_haiku%': '<(build_haiku)', + 'official_build_target%': '<(official_build_target)', --namespace { -- --QString getHomeDir() { -- struct passwd *pw = getpwuid(getuid()); -- return (pw && pw->pw_dir && strlen(pw->pw_dir)) ? (QFile::decodeName(pw->pw_dir) + '/') : QString(); --} -- --} // namespace + # GYP does not support per-configuration libraries :( +diff --git a/Telegram/gyp/list_sources.py b/Telegram/gyp/list_sources.py +index 9efee62..d978ed6 100644 +--- a/Telegram/gyp/list_sources.py ++++ b/Telegram/gyp/list_sources.py +@@ -113,6 +113,8 @@ if input_path != '': + platform_rules[file_path] = [ 'mac' ] + elif '/platform/linux/' in file_path: + platform_rules[file_path] = [ 'linux' ] ++ elif '/platform/haiku/' in file_path: ++ platform_rules[file_path] = [ 'haiku' ] - QString psAppDataPath() { -- // Previously we used ~/.TelegramDesktop, so look there first. -- // If we find data there, we should still use it. -- auto home = getHomeDir(); -- if (!home.isEmpty()) { -- auto oldPath = home + qsl(".TelegramDesktop/"); -- auto oldSettingsBase = oldPath + qsl("tdata/settings"); -- if (QFile(oldSettingsBase + '0').exists() || QFile(oldSettingsBase + '1').exists()) { -- return oldPath; -- } -- } -- -- return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + '/'; -+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/'; - } - - QString psDownloadPath() { --- -2.16.2 - - -From 507355cb8f1d8b55de4de5cfef3934b880a1b5fe Mon Sep 17 00:00:00 2001 -From: Sergei Reznikov -Date: Tue, 12 Dec 2017 14:37:08 +0300 -Subject: Fix Qt search paths - - + for replace in replaces: + replace_parts = replace.split('=', 1) diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi -index b9e1d5a..a592932 100644 +index 3f91776..a9f6881 100644 --- a/Telegram/gyp/qt.gypi +++ b/Telegram/gyp/qt.gypi -@@ -27,7 +27,7 @@ +@@ -14,7 +14,7 @@ [ 'build_macold', { 'qt_version%': '5.3.2', }, { -- 'qt_version%': '5.9.2', +- 'qt_version%': ' -Date: Sat, 31 Mar 2018 20:13:20 +0200 -Subject: Split large resource file. - -Avoids gcc running out of memory on 32bit systems. - -diff --git a/Telegram/Resources/qrc/telegram_emoji.qrc b/Telegram/Resources/qrc/telegram_emoji.qrc -index bb9ce0a..47a0c05 100644 ---- a/Telegram/Resources/qrc/telegram_emoji.qrc -+++ b/Telegram/Resources/qrc/telegram_emoji.qrc -@@ -2,7 +2,5 @@ - - ../art/emoji.webp - ../art/emoji_125x.webp -- ../art/emoji_150x.webp -- ../art/emoji_200x.webp - - -diff --git a/Telegram/Resources/qrc/telegram_emoji2.qrc b/Telegram/Resources/qrc/telegram_emoji2.qrc +@@ -199,6 +207,24 @@ + '-rdynamic', + ], + }], ++ [ 'build_haiku', { ++ 'library_dirs': [ ++ '<(qt_loc)/plugins/platforminputcontexts', ++ ], ++ 'libraries': [ ++ '<@(qt_libs_release)', ++ '-lcrypto', ++ '-lgthread-2.0', ++ '-lglib-2.0', ++ '-lroot', ++ ], ++ 'include_dirs': [ ++ '<(qt_loc)/mkspecs/haiku-g++', ++ ], ++ 'ldflags': [ ++ '-g', ++ ], ++ }], + [ 'build_mac', { + 'xcode_settings': { + 'OTHER_LDFLAGS': [ +diff --git a/Telegram/gyp/qt_moc.gypi b/Telegram/gyp/qt_moc.gypi +index f350da8..f84a2d2 100644 +--- a/Telegram/gyp/qt_moc.gypi ++++ b/Telegram/gyp/qt_moc.gypi +@@ -12,7 +12,7 @@ + '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp', + ], + 'action': [ +- '/usr/bin/moc', ++ 'moc', + + # Silence "Note: No relevant classes found. No output generated." + '--no-notes', +diff --git a/Telegram/gyp/qt_rcc.gypi b/Telegram/gyp/qt_rcc.gypi +index 1129a95..fd1e3bd 100644 +--- a/Telegram/gyp/qt_rcc.gypi ++++ b/Telegram/gyp/qt_rcc.gypi +@@ -15,7 +15,7 @@ + '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp', + ], + 'action': [ +- '/usr/bin/rcc', ++ 'rcc', + '-name', '<(RULE_INPUT_ROOT)', + '-no-compress', + '<(RULE_INPUT_PATH)', +diff --git a/Telegram/gyp/refresh.sh b/Telegram/gyp/refresh.sh +index 348eda4..46d8fc2 100755 +--- a/Telegram/gyp/refresh.sh ++++ b/Telegram/gyp/refresh.sh +@@ -23,6 +23,14 @@ if [ "$MySystem" == "Linux" ]; then + cd ../Release + cmake . + cd ../../Telegram/gyp ++elif [ "$MySystem" == "Haiku" ]; then ++ gyp --depth=. --generator-output=.. -Goutput_dir=../out \ ++ -Dofficial_build_target=$BuildTarget Telegram.gyp --format=cmake ++ cd ../../out/Debug ++ cmake . ++ cd ../Release ++ cmake . ++ cd ../../Telegram/gyp + else + #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=ninja + #gyp --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=xcode-ninja +diff --git a/Telegram/gyp/settings_haiku.gypi b/Telegram/gyp/settings_haiku.gypi new file mode 100644 -index 0000000..14c9d39 +index 0000000..a1fe2c9 --- /dev/null -+++ b/Telegram/Resources/qrc/telegram_emoji2.qrc -@@ -0,0 +1,7 @@ -+ -+ -+ ../art/emoji_150x.webp -+ ../art/emoji_200x.webp -+ -+ ++++ b/Telegram/gyp/settings_haiku.gypi +@@ -0,0 +1,87 @@ ++# This file is part of Telegram Desktop, ++# the official desktop version of Telegram messaging app, see https://telegram.org ++# ++# Telegram Desktop is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++# ++# It is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# In addition, as a special exception, the copyright holders give permission ++# to link the code of portions of this program with the OpenSSL library. ++# ++# Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE ++# Copyright (c) 2014 John Preston, https://desktop.telegram.org + ++{ ++ 'conditions': [ ++ [ 'build_haiku', { ++ 'variables': { ++ 'haiku_common_flags': [ ++ '-pipe', ++ '-Wall', ++ '-W', ++ '-fPIC', ++ '-Wno-unused-variable', ++ '-Wno-unused-parameter', ++ '-Wno-unused-function', ++ '-Wno-switch', ++ '-Wno-comment', ++ '-Wno-unused-but-set-variable', ++ '-Wno-missing-field-initializers', ++ '-Wno-sign-compare', ++ ], ++ }, ++ 'conditions': [ ++ [ '" /dev/null --libs <@(pkgconfig_libs))', ++ ], ++ 'configurations': { ++ 'Release': { ++ 'cflags': [ ++ '-Ofast', ++ '-fno-strict-aliasing', ++ ], ++ 'cflags_cc': [ ++ '-Ofast', ++ '-fno-strict-aliasing', ++ ], ++ 'ldflags': [ ++ '-Ofast', ++ ], ++ }, ++ }, ++ 'cmake_precompiled_header': '<(src_loc)/stdafx.h', ++ 'cmake_precompiled_header_script': 'PrecompiledHeader.cmake', ++ }]], ++} diff --git a/Telegram/gyp/telegram_qrc.gypi b/Telegram/gyp/telegram_qrc.gypi -index 8fdd119..a10225b 100644 +index 77b126d..6c27563 100644 --- a/Telegram/gyp/telegram_qrc.gypi +++ b/Telegram/gyp/telegram_qrc.gypi -@@ -22,6 +22,7 @@ +@@ -9,6 +9,7 @@ 'qrc_files': [ '<(res_loc)/qrc/telegram.qrc', '<(res_loc)/qrc/telegram_emoji.qrc', @@ -2630,218 +2148,61 @@ index 8fdd119..a10225b 100644 '<(res_loc)/qrc/telegram_emoji_large.qrc', '<(res_loc)/qrc/telegram_sounds.qrc', ], --- -2.16.2 - - -From 535be8d00088ffbfb6977336222be719d4a143d7 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 13 May 2018 23:30:34 +1000 -Subject: gypi files templating - - -diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi -index a592932..504af0d 100644 ---- a/Telegram/gyp/qt.gypi -+++ b/Telegram/gyp/qt.gypi -@@ -90,6 +90,7 @@ - ], - }], - [ 'build_haiku', { -+ 'haiku_path_include': '@HAIKU_HEADERS@', - 'qt_lib_prefix': '', - 'qt_lib_debug_postfix': '', - 'qt_lib_release_postfix': '', -@@ -173,20 +174,13 @@ - }, - - 'include_dirs': [ -- '/system/develop/headers', -- '/system/develop/headers/x86', -- '/system/develop/headers/QtCore', -- '/system/develop/headers/x86/QtCore', -- '/system/develop/headers/QtGui', -- '/system/develop/headers/x86/QtGui', -- '/system/develop/headers/QtCore/<(qt_version)', -- '/system/develop/headers/x86/QtCore/<(qt_version)', -- '/system/develop/headers/QtGui/<(qt_version)', -- '/system/develop/headers/x86/QtGui/<(qt_version)', -- '/system/develop/headers/QtCore/<(qt_version)/QtCore', -- '/system/develop/headers/x86/QtCore/<(qt_version)/QtCore', -- '/system/develop/headers/QtGui/<(qt_version)/QtGui', -- '/system/develop/headers/x86/QtGui/<(qt_version)/QtGui', -+ '<(haiku_path_include)', -+ '<(haiku_path_include)/QtCore', -+ '<(haiku_path_include)/QtGui', -+ '<(haiku_path_include)/QtCore/<(qt_version)', -+ '<(haiku_path_include)/QtGui/<(qt_version)', -+ '<(haiku_path_include)/QtCore/<(qt_version)/QtCore', -+ '<(haiku_path_include)/QtGui/<(qt_version)/QtGui', - ], - 'library_dirs': [ - '<(qt_loc)/lib', -diff --git a/Telegram/gyp/telegram_haiku.gypi b/Telegram/gyp/telegram_haiku.gypi -index eec9f5b..9a7846c 100644 ---- a/Telegram/gyp/telegram_haiku.gypi -+++ b/Telegram/gyp/telegram_haiku.gypi -@@ -20,24 +20,19 @@ - { - 'conditions': [[ 'build_haiku', { - 'variables': { -- 'haiku_path_ffmpeg%': '/system/develop/headers/libavcodec', -- 'haiku_path_openal%': '/system/develop/headers/AL', -- 'haiku_path_libexif_lib%': '/system/develop/lib', -- 'haiku_path_breakpad%': '/system/develop/lib', -- 'haiku_path_opus_include%': '/system/develop/headers/opus', -+ 'haiku_path_include%': '@HAIKU_HEADERS@', -+ 'haiku_path_lib%': '@HAIKU_LIBS@', - }, - 'include_dirs': [ -- '/system/develop/headers/openssl', -- '<(haiku_path_ffmpeg)/include', -- '<(haiku_path_openal)/include', -- '<(haiku_path_breakpad)/include/breakpad', -- '<(haiku_path_opus_include)', -+ '<(haiku_path_include)', -+ '<(haiku_path_include)/openssl', -+ '<(haiku_path_include)/libavcodec', -+ '<(haiku_path_include)/AL', -+ '<(haiku_path_include)/breakpad', -+ '<(haiku_path_include)/opus', - ], - 'library_dirs': [ -- '/system/develop/lib', -- '<(haiku_path_ffmpeg)/lib', -- '<(haiku_path_openal)/lib', -- '<(haiku_path_libexif_lib)', -+ '<(haiku_path_lib)', - ], - 'libraries': [ - 'openal', --- -2.16.2 - - -From fa09ff02074f808ba19a17d0520f2c1a7c430f39 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 13 May 2018 23:42:48 +1000 -Subject: Fix qt headers variable for qt.gypi - - -diff --git a/Telegram/gyp/qt.gypi b/Telegram/gyp/qt.gypi -index 504af0d..6029935 100644 ---- a/Telegram/gyp/qt.gypi -+++ b/Telegram/gyp/qt.gypi -@@ -90,7 +90,6 @@ - ], - }], - [ 'build_haiku', { -- 'haiku_path_include': '@HAIKU_HEADERS@', - 'qt_lib_prefix': '', - 'qt_lib_debug_postfix': '', - 'qt_lib_release_postfix': '', -@@ -174,13 +173,13 @@ - }, - - 'include_dirs': [ -- '<(haiku_path_include)', -- '<(haiku_path_include)/QtCore', -- '<(haiku_path_include)/QtGui', -- '<(haiku_path_include)/QtCore/<(qt_version)', -- '<(haiku_path_include)/QtGui/<(qt_version)', -- '<(haiku_path_include)/QtCore/<(qt_version)/QtCore', -- '<(haiku_path_include)/QtGui/<(qt_version)/QtGui', -+ '@HAIKU_HEADERS@', -+ '@HAIKU_HEADERS@/QtCore', -+ '@HAIKU_HEADERS@/QtGui', -+ '@HAIKU_HEADERS@/QtCore/<(qt_version)', -+ '@HAIKU_HEADERS@/QtGui/<(qt_version)', -+ '@HAIKU_HEADERS@/QtCore/<(qt_version)/QtCore', -+ '@HAIKU_HEADERS@/QtGui/<(qt_version)/QtGui', - ], - 'library_dirs': [ - '<(qt_loc)/lib', --- -2.16.2 - - -From 04bb1da88bdb593540cd235143617aa44161b245 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Mon, 14 May 2018 19:00:42 +1000 -Subject: Fix Qt add-ons path for secondary arch - - -diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp -index c65879b..1e6fd20 100644 ---- a/Telegram/SourceFiles/main.cpp -+++ b/Telegram/SourceFiles/main.cpp -@@ -41,7 +41,10 @@ int main(int argc, char *argv[]) { - Platform::start(); // must be started before QApplication is created - - // I don't know why path is not in QT_PLUGIN_PATH by default -- QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5"); -+#if defined(Q_OS_HAIKU) -+ QCoreApplication::addLibraryPath("/system/add-ons/Qt5"); -+ QCoreApplication::addLibraryPath("/system/add-ons/x86/Qt5"); -+#endif - - int result = 0; - { --- -2.16.2 - - -From 937c4a8dd5b3355923127cdd08eb6efdd83df4c6 Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Mon, 14 May 2018 22:53:07 +1000 -Subject: Add OpenWith function for Haiku platform - - -diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -index 1a8afbd..5faf1a9 100644 ---- a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp -@@ -63,9 +63,25 @@ void UnsafeShowInFolder(const QString &filepath) { - auto command = qsl("open"); - auto arguments = QStringList(); - arguments << QFileInfo(filepath).absoluteDir().absolutePath(); -+ -+ if (!process.startDetached(command, arguments)) { -+ LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' '))); -+ } -+} -+ -+bool UnsafeShowOpenWith(const QString &filepath) { -+ auto absolutePath = QFileInfo(filepath).absoluteFilePath(); -+ -+ QProcess process; -+ auto command = qsl("open"); -+ auto arguments = QStringList(); -+ arguments << absolutePath; -+ - if (!process.startDetached(command, arguments)) { - LOG(("Failed to launch '%1 %2'").arg(command).arg(arguments.join(' '))); -+ return false; - } -+ return true; - } - - } // namespace File -diff --git a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -index 103ccb6..23e4a1f 100644 ---- a/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h -@@ -47,10 +47,6 @@ inline bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosit - return false; - } - --inline bool UnsafeShowOpenWith(const QString &filepath) { -- return false; --} -- - inline void UnsafeLaunch(const QString &filepath) { - return ::File::internal::UnsafeLaunchDefault(filepath); - } +@@ -21,6 +22,13 @@ + ], + } + }], ++ [ 'build_haiku', { ++ 'variables': { ++ 'qrc_files': [ ++ '<(res_loc)/qrc/telegram_haiku.qrc', ++ ], ++ } ++ }], + [ 'build_mac', { + 'variables': { + 'qrc_files': [ +diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt +index 08ee606..ecebed3 100644 +--- a/Telegram/gyp/telegram_sources.txt ++++ b/Telegram/gyp/telegram_sources.txt +@@ -454,6 +454,18 @@ + <(src_loc)/mtproto/type_utils.h + <(src_loc)/overview/overview_layout.cpp + <(src_loc)/overview/overview_layout.h ++<(src_loc)/platform/haiku/file_utilities_haiku.cpp ++<(src_loc)/platform/haiku/file_utilities_haiku.h ++<(src_loc)/platform/haiku/haiku_desktop_environment.cpp ++<(src_loc)/platform/haiku/haiku_desktop_environment.h ++<(src_loc)/platform/haiku/launcher_haiku.cpp ++<(src_loc)/platform/haiku/launcher_haiku.h ++<(src_loc)/platform/haiku/notifications_manager_haiku.cpp ++<(src_loc)/platform/haiku/notifications_manager_haiku.h ++<(src_loc)/platform/haiku/main_window_haiku.cpp ++<(src_loc)/platform/haiku/main_window_haiku.h ++<(src_loc)/platform/haiku/specific_haiku.cpp ++<(src_loc)/platform/haiku/specific_haiku.h + <(src_loc)/platform/linux/linux_desktop_environment.cpp + <(src_loc)/platform/linux/linux_desktop_environment.h + <(src_loc)/platform/linux/linux_gdk_helper.cpp +diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp +index 622462e..e3ba800 100644 +--- a/Telegram/gyp/utils.gyp ++++ b/Telegram/gyp/utils.gyp +@@ -82,6 +82,13 @@ + 'lzma', + ], + }], ++ [ 'build_haiku', { ++ 'libraries': [ ++ 'ssl', ++ 'crypto', ++ 'lzma', ++ ], ++ }], + [ 'build_mac', { + 'include_dirs': [ + '<(libs_loc)/openssl/include' -- 2.16.2 diff --git a/net-im/telegram-desktop/telegram_desktop-1.1.23.recipe b/net-im/telegram-desktop/telegram_desktop-1.2.21.recipe similarity index 73% rename from net-im/telegram-desktop/telegram_desktop-1.1.23.recipe rename to net-im/telegram-desktop/telegram_desktop-1.2.21.recipe index 59b94e4b6..a159df28c 100644 --- a/net-im/telegram-desktop/telegram_desktop-1.1.23.recipe +++ b/net-im/telegram-desktop/telegram_desktop-1.2.21.recipe @@ -1,28 +1,47 @@ SUMMARY="Telegram Desktop Messenger" DESCRIPTION="Official desktop version of Telegram messaging app." HOMEPAGE="https://www.telegram.org/" -COPYRIGHT="2013-2017 Telegram" +COPYRIGHT="2013-2018 Telegram" LICENSE="GNU GPL v3" -REVISION="14" +REVISION="1" + SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz" SOURCE_DIR="tdesktop-$portVersion" -CHECKSUM_SHA256="56b7fce84adf85a4af1c3174353169f32d0b0c052a4e7a284fc741fa96b04030" -COMMIT_2="757a5d8ec31aadcf387ac3cb135256152c18de1c" +CHECKSUM_SHA256="8baf4287f4f86acb83f199a69ff417c18d18ac56371f5bf8f6c0c27fdcf4e05e" + +COMMIT_2="ed3a899bbe26c56dc25e40730ca6d0e95f59717d" SOURCE_URI_2="https://github.com/telegramdesktop/libtgvoip/archive/$COMMIT_2.zip" -CHECKSUM_SHA256_2="afd82dde02fb43c0e66e462a3da1d9e84ae76aa3e71d37e696c261aa151d3cdd" +CHECKSUM_SHA256_2="d9f5a2b462c0d3a6ae25004cbedf363df0d105b17c54f8e00351c034d027156b" + COMMIT_3="550ac2f159ca883d360c196149b466955c77a573" SOURCE_URI_3="https://github.com/mapbox/variant/archive/$COMMIT_3.zip" CHECKSUM_SHA256_3="3676117c49db1ef1ff2818f6f70713c3a4469f0da8ecb5c98c157499322501fc" -COMMIT_4="c5851a8161938798c5594a66420cb814fea92711" + +COMMIT_4="9d65e74400976b3509833f49b16d401600c7317d" SOURCE_URI_4="https://github.com/Microsoft/GSL/archive/$COMMIT_4.zip" -CHECKSUM_SHA256_4="2fe4befdd1cd69de435797c8c50cd7ce749d140982f2260eead90f31721d2c95" +CHECKSUM_SHA256_4="210a39a9d1f9636843dc8b2b8fac2cfcac7226c79d6748a956f7a27c686202d2" + COMMIT_5="5ca44b68721833ae3731802ed99af67c6f38a53a" SOURCE_URI_5="https://github.com/philsquared/Catch/archive/$COMMIT_5.zip" CHECKSUM_SHA256_5="bec93e64dea2dd0c6662a75a81cdd1747a753ccd86025ef436b7d2fac3b408d2" +COMMIT_6="344cbde9ae8d89a6530408d3176d2754ae0ff0e2" +SOURCE_URI_6="https://github.com/telegramdesktop/crl/archive/$COMMIT_6.zip" +CHECKSUM_SHA256_6="3709a6707cfbe2654c2c5ea3edc5c338391d678b0bd44221997b32f19f848140" + +COMMIT_7="b10e6803c6fb3ebb1fa5bdc48e6724e0f7476ac9" +SOURCE_URI_7="https://github.com/ericniebler/range-v3/archive/$COMMIT_7.zip" +CHECKSUM_SHA256_7="3b5faa6833eb501a98c8dc9d87f7cc41cf00f116b7faf28e7ce6bbbbc9375a46" + +PATCHES=" + telegram_desktop-$portVersion-systemqt.patch + telegram_desktop-$portVersion.patchset + " +PATCHES_2=" + telegram_desktop-$portVersion-libtgvoip.patchset + " + ADDITIONAL_FILES="telegram_desktop.rdef.in" -PATCHES="telegram_desktop-$portVersion.patchset" -PATCHES_2="telegram_desktop-$portVersion-libtgvoip.patchset" ARCHITECTURES="!x86_gcc2 x86_64" SECONDARY_ARCHITECTURES="x86" @@ -79,27 +98,16 @@ BUILD_PREREQUIRES=" cmd:pkg_config$secondaryArchSuffix " -PATCH() -{ - if [ -n "$secondaryArchSuffix" ]; then - sed -i "s|@HAIKU_HEADERS@|/system/develop/headers/x86|" Telegram/gyp/telegram_haiku.gypi - sed -i "s|@HAIKU_HEADERS@|/system/develop/headers/x86|" Telegram/gyp/qt.gypi - sed -i "s|@HAIKU_LIBS@|/system/develop/lib/x86|" Telegram/gyp/telegram_haiku.gypi - else - sed -i "s|@HAIKU_HEADERS@|/system/develop/headers|" Telegram/gyp/telegram_haiku.gypi - sed -i "s|@HAIKU_HEADERS@|/system/develop/headers|" Telegram/gyp/qt.gypi - sed -i "s|@HAIKU_LIBS@|/system/develop/lib|" Telegram/gyp/telegram_haiku.gypi - fi -} - BUILD() { # link submodules - rm -rf Telegram/ThirdParty/{libtgvoip,variant,GSL,Catch} + rm -rf Telegram/ThirdParty/{libtgvoip,variant,GSL,Catch,crl,range} ln -sfn $sourceDir2/libtgvoip-$COMMIT_2 Telegram/ThirdParty/libtgvoip ln -sfn $sourceDir3/variant-$COMMIT_3 Telegram/ThirdParty/variant ln -sfn $sourceDir4/GSL-$COMMIT_4 Telegram/ThirdParty/GSL - ln -sfn $sourceDir5/Catch-$COMMIT_5 Telegram/ThirdParty/Catch + ln -sfn $sourceDir5/Catch2-$COMMIT_5 Telegram/ThirdParty/Catch + ln -sfn $sourceDir6/crl-$COMMIT_6 Telegram/ThirdParty/crl + ln -sfn $sourceDir7/range-v3-$COMMIT_7 Telegram/ThirdParty/range Telegram/gyp/refresh.sh ; cd out/Release # multi-job takes too much memory