mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-03 13:38:52 +02:00
2929 lines
89 KiB
Plaintext
2929 lines
89 KiB
Plaintext
From 5a510ef350b1bd0f244c9c673701b4f581c86897 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 6 Oct 2019 20:25:00 +1000
|
|
Subject: Add Haiku support
|
|
|
|
|
|
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/haiku.qrc b/Telegram/Resources/qrc/haiku.qrc
|
|
new file mode 100644
|
|
index 0000000..33115f9
|
|
--- /dev/null
|
|
+++ b/Telegram/Resources/qrc/haiku.qrc
|
|
@@ -0,0 +1,5 @@
|
|
+<RCC>
|
|
+ <qresource prefix="/qt">
|
|
+ <file alias="etc/qt.conf">../etc/qt_haiku.conf</file>
|
|
+ </qresource>
|
|
+</RCC>
|
|
diff --git a/Telegram/SourceFiles/base/build_config.h b/Telegram/SourceFiles/base/build_config.h
|
|
index 3bcb595..b97d66a 100644
|
|
--- a/Telegram/SourceFiles/base/build_config.h
|
|
+++ b/Telegram/SourceFiles/base/build_config.h
|
|
@@ -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__)
|
|
+#define OS_HAIKU 1
|
|
#else // __APPLE__ || __linux__ || _WIN32
|
|
#error Please add support for your platform in base/build_config.h
|
|
#endif // else for __APPLE__ || __linux__ || _WIN32
|
|
|
|
// For access to standard POSIXish features, use OS_POSIX instead of a
|
|
// more specific macro.
|
|
-#if defined(OS_MAC) || defined(OS_LINUX)
|
|
+#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_HAIKU)
|
|
#define OS_POSIX 1
|
|
#endif // OS_MAC || OS_LINUX
|
|
|
|
diff --git a/Telegram/SourceFiles/core/crash_reports.cpp b/Telegram/SourceFiles/core/crash_reports.cpp
|
|
index ce938a3..02066c7 100644
|
|
--- a/Telegram/SourceFiles/core/crash_reports.cpp
|
|
+++ b/Telegram/SourceFiles/core/crash_reports.cpp
|
|
@@ -332,6 +332,8 @@ QString PlatformString() {
|
|
return qsl("MacOSold");
|
|
} else if (Platform::IsMac()) {
|
|
return qsl("MacOS");
|
|
+ } else if (Platform::IsHaiku()) {
|
|
+ return qsl("Haiku");
|
|
} else if (Platform::IsLinux32Bit()) {
|
|
return qsl("Linux32Bit");
|
|
} else if (Platform::IsLinux64Bit()) {
|
|
diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp
|
|
index 3ba2830..faa982b 100644
|
|
--- a/Telegram/SourceFiles/core/launcher.cpp
|
|
+++ b/Telegram/SourceFiles/core/launcher.cpp
|
|
@@ -17,6 +17,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
#include "base/concurrent_timer.h"
|
|
#include "facades.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <signal.h>
|
|
+#include <unistd.h>
|
|
+#endif
|
|
+
|
|
namespace Core {
|
|
namespace {
|
|
|
|
@@ -272,6 +277,13 @@ int Launcher::exec() {
|
|
Logs::start(this); // must be started before Platform is started
|
|
Platform::start(); // must be started before Sandbox is created
|
|
|
|
+#if defined(Q_OS_HAIKU)
|
|
+ QCoreApplication::addLibraryPath("/boot/system/add-ons/Qt5");
|
|
+ QCoreApplication::addLibraryPath("/boot/system/add-ons/x86/Qt5");
|
|
+ setenv("QT_STYLE_OVERRIDE", "qwerty", false);
|
|
+ unsetenv("QT_QPA_PLATFORMTHEME");
|
|
+#endif
|
|
+
|
|
auto result = executeApplication();
|
|
|
|
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
|
|
@@ -456,7 +468,16 @@ int Launcher::executeApplication() {
|
|
Sandbox sandbox(this, arguments.count(), arguments.values());
|
|
Ui::MainQueueProcessor processor;
|
|
base::ConcurrentTimerEnvironment environment;
|
|
+#ifdef __HAIKU__
|
|
+ int res = sandbox.start();
|
|
+ CrashReports::Finish();
|
|
+ Platform::finish();
|
|
+ Logs::finish();
|
|
+ kill(::getpid(), SIGKILL);
|
|
+ return res;
|
|
+#else
|
|
return sandbox.start();
|
|
+#endif
|
|
}
|
|
|
|
} // namespace Core
|
|
diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp
|
|
index 338d1f1..b0199cb 100644
|
|
--- a/Telegram/SourceFiles/core/update_checker.cpp
|
|
+++ b/Telegram/SourceFiles/core/update_checker.cpp
|
|
@@ -1511,6 +1511,9 @@ bool checkReadyUpdate() {
|
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
|
QString curUpdater = (cExeDir() + qsl("Updater"));
|
|
QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater"));
|
|
+#elif defined Q_OS_HAIKU // Q_OS_LINUX
|
|
+ QString curUpdater = (cExeDir() + qsl("Updater"));
|
|
+ QFileInfo updater(cWorkingDir() + qsl("tupdates/temp/Updater"));
|
|
#endif // Q_OS_LINUX
|
|
if (!updater.exists()) {
|
|
QFileInfo current(curUpdater);
|
|
diff --git a/Telegram/SourceFiles/media/audio/media_audio.cpp b/Telegram/SourceFiles/media/audio/media_audio.cpp
|
|
index c1234c4..c53a191 100644
|
|
--- a/Telegram/SourceFiles/media/audio/media_audio.cpp
|
|
+++ b/Telegram/SourceFiles/media/audio/media_audio.cpp
|
|
@@ -102,6 +102,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);
|
|
@@ -110,7 +111,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..fc9b389
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.cpp
|
|
@@ -0,0 +1,138 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "platform/haiku/file_utilities_haiku.h"
|
|
+
|
|
+#include "core/application.h"
|
|
+#include "mainwindow.h"
|
|
+#include "boxes/abstract_box.h"
|
|
+#include "storage/localstorage.h"
|
|
+#include "facades.h"
|
|
+
|
|
+#include <QtCore/QProcess>
|
|
+
|
|
+namespace Platform {
|
|
+namespace File {
|
|
+namespace internal {
|
|
+
|
|
+QByteArray EscapeShell(const QByteArray &content) {
|
|
+ auto result = QByteArray();
|
|
+
|
|
+ auto b = content.constData(), e = content.constEnd();
|
|
+ for (auto ch = b; ch != e; ++ch) {
|
|
+ if (*ch == ' ' || *ch == '"' || *ch == '\'' || *ch == '\\') {
|
|
+ if (result.isEmpty()) {
|
|
+ result.reserve(content.size() * 2);
|
|
+ }
|
|
+ if (ch > b) {
|
|
+ result.append(b, ch - b);
|
|
+ }
|
|
+ result.append('\\');
|
|
+ b = ch;
|
|
+ }
|
|
+ }
|
|
+ if (result.isEmpty()) {
|
|
+ return content;
|
|
+ }
|
|
+
|
|
+ if (e > b) {
|
|
+ result.append(b, e - b);
|
|
+ }
|
|
+ return result;
|
|
+}
|
|
+
|
|
+} // namespace internal
|
|
+
|
|
+void UnsafeShowInFolder(const QString &filepath) {
|
|
+ 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 {
|
|
+namespace {
|
|
+
|
|
+using Type = ::FileDialog::internal::Type;
|
|
+
|
|
+bool NativeSupported() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+bool PreviewSupported() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+
|
|
+
|
|
+} // namespace
|
|
+
|
|
+bool Get(QPointer<QWidget> parent, QStringList &files, QByteArray &remoteContent, const QString &caption, \
|
|
+ const QString &filter, Type type, QString startFile) {
|
|
+ return ::FileDialog::internal::GetDefault(parent, files, remoteContent, caption, filter, type, startFile);
|
|
+}
|
|
+
|
|
+namespace internal {
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+namespace {
|
|
+
|
|
+const char *filterRegExp =
|
|
+"^(.*)\\(([a-zA-Z0-9_.,*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
|
|
+
|
|
+// Makes a list of filters from a normal filter string "Image Files (*.png *.jpg)"
|
|
+QStringList cleanFilterList(const QString &filter) {
|
|
+ QRegExp regexp(QString::fromLatin1(filterRegExp));
|
|
+ Q_ASSERT(regexp.isValid());
|
|
+ QString f = filter;
|
|
+ int i = regexp.indexIn(f);
|
|
+ if (i >= 0)
|
|
+ f = regexp.cap(2);
|
|
+ return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+
|
|
+
|
|
+} // namespace internal
|
|
+} // namespace FileDialog
|
|
+} // 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..a61342c
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/file_utilities_haiku.h
|
|
@@ -0,0 +1,67 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "platform/platform_file_utilities.h"
|
|
+
|
|
+extern "C" {
|
|
+#undef signals
|
|
+#define signals public
|
|
+} // extern "C"
|
|
+
|
|
+namespace Platform {
|
|
+namespace File {
|
|
+namespace internal {
|
|
+
|
|
+QByteArray EscapeShell(const QByteArray &content);
|
|
+
|
|
+} // namespace internal
|
|
+
|
|
+inline QString UrlToLocal(const QUrl &url) {
|
|
+ return ::File::internal::UrlToLocalDefault(url);
|
|
+}
|
|
+
|
|
+inline void UnsafeOpenEmailLink(const QString &email) {
|
|
+ return ::File::internal::UnsafeOpenEmailLinkDefault(email);
|
|
+}
|
|
+
|
|
+inline bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosition) {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+inline void UnsafeLaunch(const QString &filepath) {
|
|
+ return ::File::internal::UnsafeLaunchDefault(filepath);
|
|
+}
|
|
+
|
|
+inline void PostprocessDownloaded(const QString &filepath) {
|
|
+}
|
|
+
|
|
+} // namespace File
|
|
+
|
|
+namespace FileDialog {
|
|
+
|
|
+inline void InitLastPath() {
|
|
+ ::FileDialog::internal::InitLastPathDefault();
|
|
+}
|
|
+
|
|
+namespace internal {
|
|
+
|
|
+
|
|
+
|
|
+} // namespace internal
|
|
+} // namespace FileDialog
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp
|
|
new file mode 100644
|
|
index 0000000..5fe1b94
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.cpp
|
|
@@ -0,0 +1,67 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "platform/haiku/haiku_desktop_environment.h"
|
|
+
|
|
+namespace Platform {
|
|
+namespace DesktopEnvironment {
|
|
+namespace {
|
|
+
|
|
+QString GetEnv(const char *name) {
|
|
+ auto result = getenv(name);
|
|
+ auto value = result ? QString::fromLatin1(result) : QString();
|
|
+ LOG(("Getting DE, %1: '%2'").arg(name).arg(value));
|
|
+ return value;
|
|
+}
|
|
+
|
|
+Type Compute() {
|
|
+ return Type::Other;
|
|
+}
|
|
+
|
|
+Type ComputeAndLog() {
|
|
+ auto result = Compute();
|
|
+ auto name = [result]() -> QString {
|
|
+ switch (result) {
|
|
+ case Type::Other: return "Other";
|
|
+ }
|
|
+ return QString::number(static_cast<int>(result));
|
|
+ };
|
|
+ LOG(("DE: %1").arg(name()));
|
|
+ return result;
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+// Thanks Chromium.
|
|
+Type Get() {
|
|
+ static const auto result = ComputeAndLog();
|
|
+ return result;
|
|
+}
|
|
+
|
|
+bool TryQtTrayIcon() {
|
|
+ return true;
|
|
+}
|
|
+
|
|
+bool PreferAppIndicatorTrayIcon() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+bool TryUnityCounter() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+} // namespace DesktopEnvironment
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h
|
|
new file mode 100644
|
|
index 0000000..248d8a8
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/haiku_desktop_environment.h
|
|
@@ -0,0 +1,33 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+namespace Platform {
|
|
+namespace DesktopEnvironment {
|
|
+
|
|
+enum class Type {
|
|
+ Other
|
|
+};
|
|
+
|
|
+Type Get();
|
|
+
|
|
+bool TryQtTrayIcon();
|
|
+bool PreferAppIndicatorTrayIcon();
|
|
+bool TryUnityCounter();
|
|
+
|
|
+} // namespace DesktopEnvironment
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/info_haiku.cpp b/Telegram/SourceFiles/platform/haiku/info_haiku.cpp
|
|
new file mode 100644
|
|
index 0000000..a9e79ac
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/info_haiku.cpp
|
|
@@ -0,0 +1,49 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "platform/haiku/info_haiku.h"
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+QString DeviceModelPretty() {
|
|
+ return "PC";
|
|
+}
|
|
+
|
|
+QString SystemVersionPretty() {
|
|
+ return "Haiku";
|
|
+}
|
|
+
|
|
+QString SystemCountry() {
|
|
+ return QString();
|
|
+}
|
|
+
|
|
+QString SystemLanguage() {
|
|
+ return QString();
|
|
+}
|
|
+
|
|
+QDate WhenSystemBecomesOutdated() {
|
|
+ return QDate();
|
|
+}
|
|
+
|
|
+int AutoUpdateVersion() {
|
|
+ return 2;
|
|
+}
|
|
+
|
|
+QString AutoUpdateKey() {
|
|
+ return "haiku";
|
|
+}
|
|
+
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/info_haiku.h b/Telegram/SourceFiles/platform/haiku/info_haiku.h
|
|
new file mode 100644
|
|
index 0000000..32f2da5
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/info_haiku.h
|
|
@@ -0,0 +1,51 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "platform/platform_info.h"
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+inline constexpr bool IsHaiku() {
|
|
+ return true;
|
|
+}
|
|
+
|
|
+inline constexpr bool IsWindows() { return false; }
|
|
+inline constexpr bool IsWindowsStoreBuild() { return false; }
|
|
+inline bool IsWindowsXPOrGreater() { return false; }
|
|
+inline bool IsWindowsVistaOrGreater() { return false; }
|
|
+inline bool IsWindows7OrGreater() { return false; }
|
|
+inline bool IsWindows8OrGreater() { return false; }
|
|
+inline bool IsWindows8Point1OrGreater() { return false; }
|
|
+inline bool IsWindows10OrGreater() { return false; }
|
|
+inline constexpr bool IsMac() { return false; }
|
|
+inline constexpr bool IsMacOldBuild() { return false; }
|
|
+inline constexpr bool IsMacStoreBuild() { return false; }
|
|
+inline bool IsMac10_6OrGreater() { return false; }
|
|
+inline bool IsMac10_7OrGreater() { return false; }
|
|
+inline bool IsMac10_8OrGreater() { return false; }
|
|
+inline bool IsMac10_9OrGreater() { return false; }
|
|
+inline bool IsMac10_10OrGreater() { return false; }
|
|
+inline bool IsMac10_11OrGreater() { return false; }
|
|
+inline bool IsMac10_12OrGreater() { return false; }
|
|
+inline bool IsMac10_13OrGreater() { return false; }
|
|
+inline bool IsMac10_14OrGreater() { return false; }
|
|
+inline constexpr bool IsLinux() { return false; }
|
|
+inline constexpr bool IsLinux32Bit() { return false; }
|
|
+inline constexpr bool IsLinux64Bit() { return false; }
|
|
+
|
|
+} // 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..7cae4cc
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.cpp
|
|
@@ -0,0 +1,68 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "platform/haiku/launcher_haiku.h"
|
|
+
|
|
+#include "core/crash_reports.h"
|
|
+
|
|
+#include <sys/stat.h>
|
|
+#include <sys/types.h>
|
|
+#include <cstdlib>
|
|
+#include <unistd.h>
|
|
+#include <dirent.h>
|
|
+#include <pwd.h>
|
|
+
|
|
+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<QByteArray> _argumentValues;
|
|
+ std::vector<char*> _arguments;
|
|
+
|
|
+};
|
|
+
|
|
+QString DeviceModel() {
|
|
+ return "PC";
|
|
+}
|
|
+
|
|
+QString SystemVersion() {
|
|
+ return "Haiku";
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+Launcher::Launcher(int argc, char *argv[])
|
|
+: Core::Launcher(argc, argv, DeviceModel(), SystemVersion()) {
|
|
+}
|
|
+
|
|
+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..54073f5
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/launcher_haiku.h
|
|
@@ -0,0 +1,32 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "core/launcher.h"
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+class Launcher : public Core::Launcher {
|
|
+public:
|
|
+ Launcher(int argc, char *argv[]);
|
|
+
|
|
+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..b0689e4
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.cpp
|
|
@@ -0,0 +1,141 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "platform/haiku/main_window_haiku.h"
|
|
+
|
|
+#include "styles/style_window.h"
|
|
+#include "platform/platform_notifications_manager.h"
|
|
+#include "window/notifications_manager.h"
|
|
+#include "mainwindow.h"
|
|
+#include "base/crc32hash.h"
|
|
+#include "core/application.h"
|
|
+#include "lang/lang_keys.h"
|
|
+#include "storage/localstorage.h"
|
|
+#include "ui/widgets/popup_menu.h"
|
|
+#include "window/themes/window_theme.h"
|
|
+#include "history/history.h"
|
|
+#include "facades.h"
|
|
+#include "app.h"
|
|
+
|
|
+#include <QtWidgets/QDesktopWidget>
|
|
+#include <QtWidgets/QStyleFactory>
|
|
+#include <QtWidgets/QApplication>
|
|
+#include <QtGui/QWindow>
|
|
+#include <qpa/qplatformnativeinterface.h>
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
|
+: Window::MainWindow(controller) {
|
|
+ connect(&_psCheckStatusIconTimer, SIGNAL(timeout()), this, SLOT(psStatusIconCheck()));
|
|
+ _psCheckStatusIconTimer.setSingleShot(false);
|
|
+
|
|
+ connect(&_psUpdateIndicatorTimer, SIGNAL(timeout()), this, SLOT(psUpdateIndicator()));
|
|
+ _psUpdateIndicatorTimer.setSingleShot(true);
|
|
+}
|
|
+
|
|
+bool MainWindow::hasTrayIcon() const {
|
|
+ return true;
|
|
+}
|
|
+
|
|
+void MainWindow::psStatusIconCheck() {
|
|
+ if (cSupportTray() || !--_psCheckStatusIconLeft) {
|
|
+ _psCheckStatusIconTimer.stop();
|
|
+ return;
|
|
+ }
|
|
+}
|
|
+
|
|
+void MainWindow::psShowTrayMenu() {
|
|
+}
|
|
+
|
|
+void MainWindow::psTrayMenuUpdated() {
|
|
+}
|
|
+
|
|
+void MainWindow::psSetupTrayIcon() {
|
|
+ if (!trayIcon) {
|
|
+ trayIcon = new QSystemTrayIcon(this);
|
|
+
|
|
+ auto icon = QIcon(App::pixmapFromImageInPlace(Core::App().logoNoMargin()));
|
|
+
|
|
+ trayIcon->setIcon(icon);
|
|
+ trayIcon->setToolTip(str_const_toString(AppName));
|
|
+ connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray()));
|
|
+ attachToTrayIcon(trayIcon);
|
|
+ App::wnd()->updateTrayMenu();
|
|
+ }
|
|
+ updateIconCounters();
|
|
+
|
|
+ trayIcon->show();
|
|
+}
|
|
+
|
|
+void MainWindow::workmodeUpdated(DBIWorkMode mode) {
|
|
+ psSetupTrayIcon();
|
|
+ if (mode == dbiwmWindowOnly) {
|
|
+ if (trayIcon) {
|
|
+ trayIcon->setContextMenu(0);
|
|
+ delete trayIcon;
|
|
+ trayIcon = nullptr;
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+
|
|
+void MainWindow::psUpdateIndicator() {
|
|
+}
|
|
+
|
|
+void MainWindow::unreadCounterChangedHook() {
|
|
+ setWindowTitle(titleText());
|
|
+ updateIconCounters();
|
|
+}
|
|
+
|
|
+void MainWindow::updateIconCounters() {
|
|
+ const auto counter = Core::App().unreadBadge();
|
|
+ const auto muted = Core::App().unreadBadgeMuted();
|
|
+ auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
|
+ auto &fg = st::trayCounterFg;
|
|
+ if (trayIcon) {
|
|
+ QIcon icon;
|
|
+ icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(16, counter, bg, fg, true)));
|
|
+ icon.addPixmap(App::pixmapFromImageInPlace(iconWithCounter(32, counter, bg, fg, true)));
|
|
+ trayIcon->setIcon(icon);
|
|
+ }
|
|
+}
|
|
+
|
|
+void MainWindow::LibsLoaded() {
|
|
+}
|
|
+
|
|
+void MainWindow::psCreateTrayIcon() {
|
|
+
|
|
+}
|
|
+
|
|
+void MainWindow::psFirstShow() {
|
|
+ psCreateTrayIcon();
|
|
+ psUpdateMargins();
|
|
+ bool showShadows = true;
|
|
+ show();
|
|
+ setPositionInited();
|
|
+}
|
|
+
|
|
+void MainWindow::psInitSysMenu() {
|
|
+}
|
|
+
|
|
+void MainWindow::psUpdateMargins() {
|
|
+}
|
|
+
|
|
+MainWindow::~MainWindow() {
|
|
+}
|
|
+
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/main_window_haiku.h b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h
|
|
new file mode 100644
|
|
index 0000000..234283f
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/main_window_haiku.h
|
|
@@ -0,0 +1,76 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "platform/platform_main_window.h"
|
|
+#include "base/flags.h"
|
|
+
|
|
+#include <QtCore/QTimer>
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+class MainWindow : public Window::MainWindow {
|
|
+ Q_OBJECT
|
|
+
|
|
+public:
|
|
+ explicit MainWindow(not_null<Window::Controller*> controller);
|
|
+
|
|
+ void psFirstShow();
|
|
+ void psInitSysMenu();
|
|
+ void psUpdateMargins();
|
|
+
|
|
+ void psRefreshTaskbarIcon() {
|
|
+ }
|
|
+
|
|
+ virtual QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) = 0;
|
|
+
|
|
+ static void LibsLoaded();
|
|
+
|
|
+ ~MainWindow();
|
|
+
|
|
+public slots:
|
|
+ void psShowTrayMenu();
|
|
+
|
|
+ void psStatusIconCheck();
|
|
+ void psUpdateIndicator();
|
|
+
|
|
+protected:
|
|
+ void unreadCounterChangedHook() override;
|
|
+
|
|
+ bool hasTrayIcon() const override;
|
|
+
|
|
+ void workmodeUpdated(DBIWorkMode mode) override;
|
|
+
|
|
+ QSystemTrayIcon *trayIcon = nullptr;
|
|
+ QMenu *trayIconMenu = nullptr;
|
|
+
|
|
+ void psTrayMenuUpdated();
|
|
+ void psSetupTrayIcon();
|
|
+
|
|
+ virtual void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) = 0;
|
|
+
|
|
+private:
|
|
+ void updateIconCounters();
|
|
+ void psCreateTrayIcon();
|
|
+
|
|
+ QTimer _psCheckStatusIconTimer;
|
|
+ int _psCheckStatusIconLeft = 100;
|
|
+
|
|
+ QTimer _psUpdateIndicatorTimer;
|
|
+};
|
|
+
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp
|
|
new file mode 100644
|
|
index 0000000..9709580
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp
|
|
@@ -0,0 +1,70 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include <Application.h>
|
|
+#include <OS.h>
|
|
+
|
|
+#include <stdlib.h>
|
|
+#include <stdio.h>
|
|
+
|
|
+#define APPSIGNATURE "application/x-vnd.tg-notify-gate"
|
|
+#define NOTIFY_PORT_NAME "tg_notify"
|
|
+#define NOTIFY_MESSAGE 'TGNF'
|
|
+
|
|
+typedef struct notify_msg
|
|
+{
|
|
+ uint64 peerId;
|
|
+ int32 msgId;
|
|
+} notify_msg;
|
|
+
|
|
+class SimpleLauncherApp : public BApplication {
|
|
+ public:
|
|
+ SimpleLauncherApp(int argc, char **argv);
|
|
+ void ArgvReceived(int32 argc, char **argv);
|
|
+ virtual void ReadyToRun();
|
|
+};
|
|
+
|
|
+SimpleLauncherApp::SimpleLauncherApp(int argc, char **argv) : BApplication(APPSIGNATURE)
|
|
+{
|
|
+}
|
|
+
|
|
+void
|
|
+SimpleLauncherApp::ArgvReceived(int32 argc, char **argv)
|
|
+{
|
|
+ if (argc==2) {
|
|
+ notify_msg message;
|
|
+ sscanf(argv[1], "%lld %d", &message.peerId, &message.msgId);
|
|
+ if (message.peerId != 0 && message.msgId != 0) {
|
|
+ port_id portId = find_port(NOTIFY_PORT_NAME);
|
|
+ if (portId > 0) {
|
|
+ write_port(portId, NOTIFY_MESSAGE, &message, sizeof(message));
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+void
|
|
+SimpleLauncherApp::ReadyToRun()
|
|
+{
|
|
+ Quit();
|
|
+}
|
|
+
|
|
+int main(int argc, char **argv)
|
|
+{
|
|
+ SimpleLauncherApp application(argc, argv);
|
|
+ application.Run();
|
|
+ return 0;
|
|
+}
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
|
|
new file mode 100644
|
|
index 0000000..b6f3490
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
|
|
@@ -0,0 +1,13 @@
|
|
+resource app_flags B_MULTIPLE_LAUNCH | B_BACKGROUND_APP;
|
|
+
|
|
+resource app_version {
|
|
+ major = 0,
|
|
+ middle = 0,
|
|
+ minor = 1,
|
|
+ variety = B_APPV_FINAL,
|
|
+ internal = 0,
|
|
+ short_info = "tg-notify-gate",
|
|
+ long_info = "Telegram native notifications gate"
|
|
+};
|
|
+
|
|
+resource app_signature "application/x-vnd.tg-notify-gate";
|
|
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..2e59207
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.cpp
|
|
@@ -0,0 +1,229 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#ifdef __x86_64__
|
|
+#define int64 XXX
|
|
+#define uint64 YYY
|
|
+#else
|
|
+#define int32 XXX
|
|
+#define uint32 YYY
|
|
+#endif
|
|
+
|
|
+#include <stdio.h>
|
|
+#include <unistd.h>
|
|
+#include <sys/stat.h>
|
|
+#include <fcntl.h>
|
|
+
|
|
+#include <SupportDefs.h>
|
|
+#include <Notification.h>
|
|
+#include <Bitmap.h>
|
|
+#include <TranslationUtils.h>
|
|
+#include <Entry.h>
|
|
+#include <OS.h>
|
|
+
|
|
+#include "platform/haiku/notifications_manager_haiku.h"
|
|
+
|
|
+#include "window/notifications_utilities.h"
|
|
+#include "history/history.h"
|
|
+#include "lang/lang_keys.h"
|
|
+
|
|
+#define DeclareReadOnlyVar(Type, Name) const Type &Name();
|
|
+#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \
|
|
+ Type &Ref##Name();
|
|
+#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \
|
|
+ void Set##Name(const Type &Name);
|
|
+
|
|
+namespace Global {
|
|
+ DeclareVar(bool, NativeNotifications);
|
|
+}
|
|
+
|
|
+#include <QProcess>
|
|
+#include <QThread>
|
|
+#include <QObject>
|
|
+#include <QString>
|
|
+#include <QStringList>
|
|
+
|
|
+namespace Platform {
|
|
+namespace Notifications {
|
|
+namespace {
|
|
+
|
|
+} // namespace
|
|
+
|
|
+bool Supported() {
|
|
+ return true;
|
|
+}
|
|
+
|
|
+std::unique_ptr<Window::Notifications::Manager> Create(Window::Notifications::System *system) {
|
|
+ if (Global::NativeNotifications() && Supported()) {
|
|
+ auto result = std::make_unique<Manager>(system);
|
|
+ if (result->init()) {
|
|
+ return std::move(result);
|
|
+ }
|
|
+ }
|
|
+ return nullptr;
|
|
+}
|
|
+
|
|
+void Finish() {
|
|
+}
|
|
+
|
|
+NotifyReader::NotifyReader()
|
|
+{
|
|
+ portId = create_port(NOTIFY_MESSAGE_DEEP, NOTIFY_PORT_NAME);
|
|
+}
|
|
+
|
|
+NotifyReader::~NotifyReader()
|
|
+{
|
|
+ if (portId >= B_OK)
|
|
+ delete_port(portId);
|
|
+}
|
|
+
|
|
+void NotifyReader::run()
|
|
+{
|
|
+ notify_msg message;
|
|
+ int32 code;
|
|
+
|
|
+ while (true) {
|
|
+ ssize_t bytesRead = read_port(portId, &code, &message, sizeof(message));
|
|
+ if (bytesRead == B_BAD_PORT_ID)
|
|
+ break;
|
|
+ if (bytesRead < (ssize_t)sizeof(message) || code != NOTIFY_MESSAGE)
|
|
+ continue;
|
|
+ if (message.peerId != 0 && message.msgId != 0)
|
|
+ notificationActivated(message.peerId, message.msgId);
|
|
+ }
|
|
+}
|
|
+
|
|
+Manager::Private::Private(Manager *instance, Type type)
|
|
+: _guarded(std::make_shared<Manager*>(instance))
|
|
+, _cachedUserpics(type) {
|
|
+ _weak = _guarded;
|
|
+}
|
|
+
|
|
+bool Manager::Private::init() {
|
|
+ portReaderThread = new QThread;
|
|
+ portReader = new NotifyReader();
|
|
+ portReader->moveToThread(portReaderThread);
|
|
+ connect(portReaderThread, SIGNAL(started()), portReader, SLOT(run()));
|
|
+ qRegisterMetaType<PeerId>("PeerId");
|
|
+ qRegisterMetaType<MsgId>("MsgId");
|
|
+ connect(portReader, SIGNAL(notificationActivated(PeerId, MsgId)), \
|
|
+ this, SLOT(notificationActivatedSlot(PeerId, MsgId)));
|
|
+ portReaderThread->start();
|
|
+ return true;
|
|
+}
|
|
+
|
|
+Manager::Private::~Private() {
|
|
+ clearAll();
|
|
+}
|
|
+
|
|
+void Manager::Private::clearAll() {
|
|
+}
|
|
+
|
|
+void Manager::Private::clearFromHistory(History *history) {
|
|
+}
|
|
+
|
|
+void Manager::Private::beforeNotificationActivated(PeerId peerId, MsgId msgId) {
|
|
+}
|
|
+
|
|
+void Manager::Private::afterNotificationActivated(PeerId peerId, MsgId msgId) {
|
|
+}
|
|
+
|
|
+void Manager::Private::clearNotification(PeerId peerId, MsgId msgId) {
|
|
+}
|
|
+
|
|
+bool Manager::Private::showNotification(PeerData *peer, MsgId msgId, const QString &title, \
|
|
+ const QString &subtitle, const QString &msg, bool hideNameAndPhoto, bool hideReplyButton) {
|
|
+ auto titleText = title;
|
|
+ auto subtitleText = subtitle;
|
|
+ auto msgText = msg;
|
|
+
|
|
+ const auto key = hideNameAndPhoto
|
|
+ ? InMemoryKey()
|
|
+ : peer->userpicUniqueKey();
|
|
+
|
|
+ auto userpicPath = _cachedUserpics.get(key, peer);
|
|
+ BBitmap *icon = BTranslationUtils::GetBitmapFile(userpicPath.toUtf8().data());
|
|
+ QString args = QString("%1 %2").arg(peer->id).arg(msgId);
|
|
+ BNotification notify(B_INFORMATION_NOTIFICATION);
|
|
+ if (icon)
|
|
+ notify.SetIcon(icon);
|
|
+ notify.SetGroup("Telegram");
|
|
+ notify.SetTitle(titleText.toUtf8().data());
|
|
+ notify.SetContent(msgText.toUtf8().data());
|
|
+ entry_ref ref;
|
|
+ BEntry entry(NOTIFY_GATE_NAME);
|
|
+ entry.GetRef(&ref);
|
|
+ notify.SetOnClickFile(&ref);
|
|
+ notify.AddOnClickArg(BString(args.toUtf8().data()));
|
|
+ notify.Send();
|
|
+
|
|
+ return true;
|
|
+}
|
|
+
|
|
+void Manager::Private::notificationActivatedSlot(PeerId _peerId, MsgId _msgId)
|
|
+{
|
|
+ qDebug() << _peerId << _msgId;
|
|
+ performOnMainQueue([peerId = _peerId, msgId = _msgId](Manager *manager) {
|
|
+ manager->notificationActivated(peerId, msgId);
|
|
+ });
|
|
+}
|
|
+
|
|
+Manager::Manager(Window::Notifications::System *system) : NativeManager(system)
|
|
+, _private(std::make_unique<Private>(this, Private::Type::Rounded)) {
|
|
+}
|
|
+
|
|
+bool Manager::init() {
|
|
+ return _private->init();
|
|
+}
|
|
+
|
|
+void Manager::clearNotification(PeerId peerId, MsgId msgId) {
|
|
+ _private->clearNotification(peerId, msgId);
|
|
+}
|
|
+
|
|
+Manager::~Manager() = default;
|
|
+
|
|
+void Manager::doShowNativeNotification(
|
|
+ not_null<PeerData*> peer,
|
|
+ MsgId msgId,
|
|
+ const QString &title,
|
|
+ const QString &subtitle,
|
|
+ const QString &msg,
|
|
+ bool hideNameAndPhoto,
|
|
+ bool hideReplyButton) {
|
|
+ _private->showNotification(
|
|
+ peer,
|
|
+ msgId,
|
|
+ title,
|
|
+ subtitle,
|
|
+ msg,
|
|
+ hideNameAndPhoto,
|
|
+ hideReplyButton);
|
|
+}
|
|
+
|
|
+void Manager::doClearAllFast() {
|
|
+ _private->clearAll();
|
|
+}
|
|
+
|
|
+void Manager::doClearFromHistory(not_null<History*> history) {
|
|
+ _private->clearFromHistory(history);
|
|
+}
|
|
+
|
|
+bool Manager::hasActionsSupport() const {
|
|
+ return _private->hasActionsSupport();
|
|
+}
|
|
+
|
|
+} // namespace Notifications
|
|
+} // namespace Platform
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h
|
|
new file mode 100644
|
|
index 0000000..d905787
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/notifications_manager_haiku.h
|
|
@@ -0,0 +1,134 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include "platform/platform_notifications_manager.h"
|
|
+#include "window/notifications_utilities.h"
|
|
+
|
|
+#include <QProcess>
|
|
+#include <QThread>
|
|
+#include <QObject>
|
|
+
|
|
+#define NOTIFY_MESSAGE_DEEP 16
|
|
+#define NOTIFY_PORT_NAME "tg_notify"
|
|
+#define NOTIFY_GATE_NAME "/bin/tg-notify-gate"
|
|
+#define NOTIFY_MESSAGE 'TGNF'
|
|
+
|
|
+typedef struct notify_msg
|
|
+{
|
|
+ uint64 peerId;
|
|
+ int32 msgId;
|
|
+} notify_msg;
|
|
+
|
|
+namespace Platform {
|
|
+namespace Notifications {
|
|
+
|
|
+inline bool SkipAudio() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+inline bool SkipToast() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+inline void FlashBounce() {
|
|
+}
|
|
+
|
|
+void Finish();
|
|
+
|
|
+class NotifyReader:public QObject {
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ NotifyReader();
|
|
+ ~NotifyReader();
|
|
+public slots:
|
|
+ void run();
|
|
+signals:
|
|
+ void notificationActivated(PeerId peerId, MsgId msgId);
|
|
+private:
|
|
+ int32 portId;
|
|
+};
|
|
+
|
|
+
|
|
+class Manager : public Window::Notifications::NativeManager {
|
|
+public:
|
|
+ Manager(Window::Notifications::System *system);
|
|
+
|
|
+ bool init();
|
|
+
|
|
+ void clearNotification(PeerId peerId, MsgId msgId);
|
|
+
|
|
+ ~Manager();
|
|
+
|
|
+protected:
|
|
+ void doShowNativeNotification(
|
|
+ not_null<PeerData*> peer,
|
|
+ MsgId msgId,
|
|
+ const QString &title,
|
|
+ const QString &subtitle,
|
|
+ const QString &msg,
|
|
+ bool hideNameAndPhoto,
|
|
+ bool hideReplyButton) override;
|
|
+ void doClearAllFast() override;
|
|
+ void doClearFromHistory(not_null<History*> history) override;
|
|
+
|
|
+ bool hasActionsSupport() const;
|
|
+
|
|
+private:
|
|
+ class Private;
|
|
+ const std::unique_ptr<Private> _private;
|
|
+};
|
|
+
|
|
+class Manager::Private : public QObject {
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ using Type = Window::Notifications::CachedUserpics::Type;
|
|
+ explicit Private(Manager *instance, Type type);
|
|
+ bool init();
|
|
+
|
|
+ bool showNotification(PeerData *peer, MsgId msgId, const QString &title, const QString &subtitle, \
|
|
+ const QString &msg, bool hideNameAndPhoto, bool hideReplyButton);
|
|
+ void clearAll();
|
|
+ void clearFromHistory(History *history);
|
|
+ void beforeNotificationActivated(PeerId peerId, MsgId msgId);
|
|
+ void afterNotificationActivated(PeerId peerId, MsgId msgId);
|
|
+ void clearNotification(PeerId peerId, MsgId msgId);
|
|
+
|
|
+ bool hasActionsSupport() const {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ void performOnMainQueue(FnMut<void(Manager *manager)> task) {
|
|
+ const auto weak = _weak;
|
|
+ crl::on_main(weak, [=, task = std::move(task)]() mutable {
|
|
+ task(*weak.lock());
|
|
+ });
|
|
+ }
|
|
+
|
|
+ ~Private();
|
|
+public slots:
|
|
+ void notificationActivatedSlot(PeerId peerId, MsgId msgId);
|
|
+private:
|
|
+ Window::Notifications::CachedUserpics _cachedUserpics;
|
|
+ std::shared_ptr<Manager*> _guarded;
|
|
+ std::weak_ptr<Manager*> _weak;
|
|
+ QThread *portReaderThread;
|
|
+ NotifyReader *portReader;
|
|
+};
|
|
+
|
|
+} // namespace Notifications
|
|
+} // 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..a3ad1b8
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp
|
|
@@ -0,0 +1,256 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "platform/haiku/specific_haiku.h"
|
|
+
|
|
+#include "lang/lang_keys.h"
|
|
+#include "mainwidget.h"
|
|
+#include "mainwindow.h"
|
|
+#include "storage/localstorage.h"
|
|
+#include "platform/haiku/file_utilities_haiku.h"
|
|
+
|
|
+#include <QtWidgets/QApplication>
|
|
+#include <QtWidgets/QDesktopWidget>
|
|
+#include <QtCore/QStandardPaths>
|
|
+#include <QtCore/QProcess>
|
|
+#include <QtCore/QVersionNumber>
|
|
+#include <qpa/qplatformnativeinterface.h>
|
|
+
|
|
+#include <sys/stat.h>
|
|
+#include <sys/types.h>
|
|
+#include <cstdlib>
|
|
+#include <unistd.h>
|
|
+#include <dirent.h>
|
|
+#include <pwd.h>
|
|
+
|
|
+#include <iostream>
|
|
+
|
|
+#include <qpa/qplatformnativeinterface.h>
|
|
+
|
|
+using namespace Platform;
|
|
+
|
|
+using Platform::File::internal::EscapeShell;
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+QString CurrentExecutablePath(int argc, char *argv[]) {
|
|
+ return argc ? QFile::decodeName(argv[0]) : QString();
|
|
+}
|
|
+
|
|
+} // namespace Platform
|
|
+
|
|
+namespace {
|
|
+
|
|
+QRect _monitorRect;
|
|
+auto _monitorLastGot = 0LL;
|
|
+
|
|
+} // namespace
|
|
+
|
|
+QRect psDesktopRect() {
|
|
+ auto tnow = crl::now();
|
|
+ if (tnow > _monitorLastGot + 1000LL || tnow < _monitorLastGot) {
|
|
+ _monitorLastGot = tnow;
|
|
+ _monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
|
|
+ }
|
|
+ return _monitorRect;
|
|
+}
|
|
+
|
|
+void psShowOverAll(QWidget *w, bool canFocus) {
|
|
+ w->show();
|
|
+}
|
|
+
|
|
+void psBringToBack(QWidget *w) {
|
|
+ w->hide();
|
|
+}
|
|
+
|
|
+void psWriteDump() {
|
|
+}
|
|
+
|
|
+bool _removeDirectory(const QString &path) { // from http://stackoverflow.com/questions/2256945/removing-a-non-empty-directory-programmatically-in-c-or-c
|
|
+ QByteArray pathRaw = QFile::encodeName(path);
|
|
+ DIR *d = opendir(pathRaw.constData());
|
|
+ if (!d) return false;
|
|
+
|
|
+ while (struct dirent *p = readdir(d)) {
|
|
+ /* Skip the names "." and ".." as we don't want to recurse on them. */
|
|
+ if (!strcmp(p->d_name, ".") || !strcmp(p->d_name, "..")) continue;
|
|
+
|
|
+ QString fname = path + '/' + p->d_name;
|
|
+ QByteArray fnameRaw = QFile::encodeName(fname);
|
|
+ struct stat statbuf;
|
|
+ if (!stat(fnameRaw.constData(), &statbuf)) {
|
|
+ if (S_ISDIR(statbuf.st_mode)) {
|
|
+ if (!_removeDirectory(fname)) {
|
|
+ closedir(d);
|
|
+ return false;
|
|
+ }
|
|
+ } else {
|
|
+ if (unlink(fnameRaw.constData())) {
|
|
+ closedir(d);
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ closedir(d);
|
|
+
|
|
+ return !rmdir(pathRaw.constData());
|
|
+}
|
|
+
|
|
+void psDeleteDir(const QString &dir) {
|
|
+ _removeDirectory(dir);
|
|
+}
|
|
+
|
|
+namespace {
|
|
+
|
|
+auto _lastUserAction = 0LL;
|
|
+
|
|
+} // namespace
|
|
+
|
|
+void psActivateProcess(uint64 pid) {
|
|
+// objc_activateProgram();
|
|
+}
|
|
+
|
|
+
|
|
+QString psAppDataPath() {
|
|
+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + '/';
|
|
+}
|
|
+
|
|
+QString psDownloadPath() {
|
|
+ return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + '/' + str_const_toString(AppName) + '/';
|
|
+}
|
|
+
|
|
+void psDoCleanup() {
|
|
+ try {
|
|
+ psAutoStart(false, true);
|
|
+ psSendToMenu(false, true);
|
|
+ } catch (...) {
|
|
+ }
|
|
+}
|
|
+
|
|
+int psCleanup() {
|
|
+ psDoCleanup();
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+void psDoFixPrevious() {
|
|
+}
|
|
+
|
|
+int psFixPrevious() {
|
|
+ psDoFixPrevious();
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+void start() {
|
|
+}
|
|
+
|
|
+void finish() {
|
|
+}
|
|
+
|
|
+void SetApplicationIcon(const QIcon &icon) {
|
|
+ qApp->setWindowIcon(icon);
|
|
+}
|
|
+
|
|
+void RegisterCustomScheme() {
|
|
+}
|
|
+
|
|
+PermissionStatus GetPermissionStatus(PermissionType type){
|
|
+ return PermissionStatus::Granted;
|
|
+}
|
|
+
|
|
+void RequestPermission(PermissionType type, Fn<void(PermissionStatus)> resultCallback){
|
|
+ resultCallback(PermissionStatus::Granted);
|
|
+}
|
|
+
|
|
+void OpenSystemSettingsForPermission(PermissionType type){
|
|
+}
|
|
+
|
|
+bool OpenSystemSettings(SystemSettingsType type) {
|
|
+ if (type == SystemSettingsType::Audio) {
|
|
+ auto options = std::vector<QString>();
|
|
+ const auto add = [&](const char *option) {
|
|
+ options.emplace_back(option);
|
|
+ };
|
|
+ add("Media");
|
|
+ return ranges::find_if(options, [](const QString &command) {
|
|
+ return QProcess::startDetached(command);
|
|
+ }) != end(options);
|
|
+ }
|
|
+ return true;
|
|
+}
|
|
+
|
|
+namespace ThirdParty {
|
|
+
|
|
+void start() {
|
|
+}
|
|
+
|
|
+void finish() {
|
|
+}
|
|
+
|
|
+} // namespace ThirdParty
|
|
+
|
|
+} // namespace Platform
|
|
+
|
|
+namespace {
|
|
+
|
|
+bool _psRunCommand(const QByteArray &command) {
|
|
+ auto result = system(command.constData());
|
|
+ if (result) {
|
|
+ DEBUG_LOG(("App Error: command failed, code: %1, command (in utf8): %2").arg(result).arg(command.constData()));
|
|
+ return false;
|
|
+ }
|
|
+ DEBUG_LOG(("App Info: command succeeded, command (in utf8): %1").arg(command.constData()));
|
|
+ return true;
|
|
+}
|
|
+
|
|
+} // namespace
|
|
+
|
|
+void psRegisterCustomScheme() {
|
|
+}
|
|
+
|
|
+void psNewVersion() {
|
|
+ Platform::RegisterCustomScheme();
|
|
+}
|
|
+
|
|
+bool _execUpdater(bool update = true, const QString &crashreport = QString()) {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+void psExecUpdater() {
|
|
+}
|
|
+
|
|
+void psExecTelegram(const QString &crashreport) {
|
|
+ _execUpdater(false, crashreport);
|
|
+}
|
|
+
|
|
+bool psShowOpenWithMenu(int x, int y, const QString &file) {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+void psAutoStart(bool start, bool silent) {
|
|
+}
|
|
+
|
|
+void psSendToMenu(bool send, bool silent) {
|
|
+}
|
|
+
|
|
+void psUpdateOverlayed(QWidget *widget) {
|
|
+}
|
|
+
|
|
+bool psLaunchMaps(const Data::LocationPoint &point) {
|
|
+ return false;
|
|
+}
|
|
diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.h b/Telegram/SourceFiles/platform/haiku/specific_haiku.h
|
|
new file mode 100644
|
|
index 0000000..68d31bd
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.h
|
|
@@ -0,0 +1,122 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+#include <signal.h>
|
|
+
|
|
+namespace Data {
|
|
+class LocationPoint;
|
|
+} // namespace Data
|
|
+
|
|
+namespace Platform {
|
|
+
|
|
+inline void SetWatchingMediaKeys(bool watching) {
|
|
+}
|
|
+
|
|
+inline void IgnoreApplicationActivationRightNow() {
|
|
+}
|
|
+
|
|
+inline void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
|
|
+}
|
|
+
|
|
+inline void InitOnTopPanel(QWidget *panel) {
|
|
+}
|
|
+
|
|
+inline void DeInitOnTopPanel(QWidget *panel) {
|
|
+}
|
|
+
|
|
+inline void ReInitOnTopPanel(QWidget *panel) {
|
|
+}
|
|
+
|
|
+QString CurrentExecutablePath(int argc, char *argv[]);
|
|
+
|
|
+inline std::optional<crl::time> LastUserInputTime() {
|
|
+ return std::nullopt;
|
|
+}
|
|
+
|
|
+} // namespace Platform
|
|
+
|
|
+inline QString psServerPrefix() {
|
|
+ return qsl("/tmp/");
|
|
+}
|
|
+inline void psCheckLocalSocket(const QString &serverName) {
|
|
+ QFile address(serverName);
|
|
+ if (address.exists()) {
|
|
+ address.remove();
|
|
+ }
|
|
+}
|
|
+
|
|
+void psWriteDump();
|
|
+
|
|
+void psDeleteDir(const QString &dir);
|
|
+
|
|
+QStringList psInitLogs();
|
|
+void psClearInitLogs();
|
|
+
|
|
+void psActivateProcess(uint64 pid = 0);
|
|
+QString psLocalServerPrefix();
|
|
+QString psAppDataPath();
|
|
+QString psDownloadPath();
|
|
+void psAutoStart(bool start, bool silent = false);
|
|
+void psSendToMenu(bool send, bool silent = false);
|
|
+
|
|
+QRect psDesktopRect();
|
|
+void psShowOverAll(QWidget *w, bool canFocus = true);
|
|
+void psBringToBack(QWidget *w);
|
|
+
|
|
+int psCleanup();
|
|
+int psFixPrevious();
|
|
+
|
|
+void psExecUpdater();
|
|
+void psExecTelegram(const QString &arg = QString());
|
|
+
|
|
+void psNewVersion();
|
|
+
|
|
+void psUpdateOverlayed(QWidget *widget);
|
|
+inline QByteArray psDownloadPathBookmark(const QString &path) {
|
|
+ return QByteArray();
|
|
+}
|
|
+inline QByteArray psPathBookmark(const QString &path) {
|
|
+ return QByteArray();
|
|
+}
|
|
+inline void psDownloadPathEnableAccess() {
|
|
+}
|
|
+
|
|
+class PsFileBookmark {
|
|
+public:
|
|
+ PsFileBookmark(const QByteArray &bookmark) {
|
|
+ }
|
|
+ bool check() const {
|
|
+ return true;
|
|
+ }
|
|
+ bool enable() const {
|
|
+ return true;
|
|
+ }
|
|
+ void disable() const {
|
|
+ }
|
|
+ const QString &name(const QString &original) const {
|
|
+ return original;
|
|
+ }
|
|
+ QByteArray bookmark() const {
|
|
+ return QByteArray();
|
|
+ }
|
|
+
|
|
+};
|
|
+
|
|
+//ool linuxMoveFile(const char *from, const char *to);
|
|
+
|
|
+bool psLaunchMaps(const Data::LocationPoint &point);
|
|
diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h
|
|
index f40204a..847471f 100644
|
|
--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h
|
|
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.h
|
|
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
#pragma once
|
|
|
|
#include "platform/platform_notifications_manager.h"
|
|
+#include "window/notifications_utilities.h"
|
|
|
|
namespace Platform {
|
|
namespace Notifications {
|
|
diff --git a/Telegram/SourceFiles/platform/platform_audio.h b/Telegram/SourceFiles/platform/platform_audio.h
|
|
index 7705b2e..cfc1fc9 100644
|
|
--- a/Telegram/SourceFiles/platform/platform_audio.h
|
|
+++ b/Telegram/SourceFiles/platform/platform_audio.h
|
|
@@ -19,7 +19,7 @@ void DeInit();
|
|
|
|
// Platform dependent implementations.
|
|
|
|
-#if defined Q_OS_MAC || defined Q_OS_LINUX
|
|
+#if defined Q_OS_MAC || defined Q_OS_LINUX || defined(Q_OS_HAIKU)
|
|
namespace Platform {
|
|
namespace Audio {
|
|
|
|
diff --git a/Telegram/SourceFiles/platform/platform_file_utilities.h b/Telegram/SourceFiles/platform/platform_file_utilities.h
|
|
index 68b1058..2839790 100644
|
|
--- a/Telegram/SourceFiles/platform/platform_file_utilities.h
|
|
+++ b/Telegram/SourceFiles/platform/platform_file_utilities.h
|
|
@@ -47,6 +47,8 @@ bool Get(
|
|
#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_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_info.h b/Telegram/SourceFiles/platform/platform_info.h
|
|
index 3fe92ea..e06b16c 100644
|
|
--- a/Telegram/SourceFiles/platform/platform_info.h
|
|
+++ b/Telegram/SourceFiles/platform/platform_info.h
|
|
@@ -39,6 +39,8 @@ namespace Platform {
|
|
[[nodiscard]] bool IsMac10_13OrGreater();
|
|
[[nodiscard]] bool IsMac10_14OrGreater();
|
|
|
|
+[[nodiscard]] constexpr bool IsHaiku();
|
|
+
|
|
[[nodiscard]] constexpr bool IsLinux();
|
|
[[nodiscard]] constexpr bool IsLinux32Bit();
|
|
[[nodiscard]] constexpr bool IsLinux64Bit();
|
|
@@ -49,6 +51,8 @@ namespace Platform {
|
|
#include "platform/mac/info_mac.h"
|
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
|
#include "platform/linux/info_linux.h"
|
|
+#elif defined Q_OS_HAIKU // Q_OS_HAIKU
|
|
+#include "platform/haiku/info_haiku.h"
|
|
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
|
#include "platform/win/info_win.h"
|
|
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WIN
|
|
diff --git a/Telegram/SourceFiles/platform/platform_launcher.h b/Telegram/SourceFiles/platform/platform_launcher.h
|
|
index 27180d0..cdcd223 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 // Q_OS_LINUX
|
|
+#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 692f4b4..a40f830 100644
|
|
--- a/Telegram/SourceFiles/platform/platform_notifications_manager.h
|
|
+++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h
|
|
@@ -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"
|
|
+#elif defined Q_OS_HAIKU // Q_OS_LINUX
|
|
+#include "platform/haiku/notifications_manager_haiku.h"
|
|
#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
|
|
diff --git a/Telegram/SourceFiles/platform/platform_specific.h b/Telegram/SourceFiles/platform/platform_specific.h
|
|
index f5650f9..5cd34e5 100644
|
|
--- a/Telegram/SourceFiles/platform/platform_specific.h
|
|
+++ b/Telegram/SourceFiles/platform/platform_specific.h
|
|
@@ -53,6 +53,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 6aea663..8b67814 100644
|
|
--- a/Telegram/SourceFiles/platform/platform_window_title.h
|
|
+++ b/Telegram/SourceFiles/platform/platform_window_title.h
|
|
@@ -26,7 +26,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..e987503
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/qt_functions.cpp
|
|
@@ -0,0 +1,96 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** 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$
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include <private/qtextengine_p.h>
|
|
+
|
|
+/* 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 a757d08..122ff0f 100644
|
|
--- a/Telegram/SourceFiles/qt_static_plugins.cpp
|
|
+++ b/Telegram/SourceFiles/qt_static_plugins.cpp
|
|
@@ -15,14 +15,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)
|
|
-Q_IMPORT_PLUGIN(NimfInputContextPlugin)
|
|
#endif // Q_OS_WIN | Q_OS_MAC | Q_OS_LINUX
|
|
diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp
|
|
index ea7c4a8..e19ed0f 100644
|
|
--- a/Telegram/SourceFiles/settings/settings_notifications.cpp
|
|
+++ b/Telegram/SourceFiles/settings/settings_notifications.cpp
|
|
@@ -623,7 +623,7 @@ void SetupNotificationsContent(
|
|
return QString();
|
|
} else if (Platform::IsWindows()) {
|
|
return tr::lng_settings_use_windows(tr::now);
|
|
- } else if (Platform::IsLinux()) {
|
|
+ } else if (Platform::IsLinux() || Platform::IsHaiku()) {
|
|
return tr::lng_settings_use_native_notifications(tr::now);
|
|
}
|
|
return QString();
|
|
diff --git a/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp b/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp
|
|
index 4d522a9..1ca7dd0 100644
|
|
--- a/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp
|
|
+++ b/Telegram/SourceFiles/storage/storage_encrypted_file_tests.cpp
|
|
@@ -188,6 +188,7 @@ TEST_CASE("two process encrypted file", "[storage_encrypted_file]") {
|
|
constexpr auto kMaxPath = 1024;
|
|
char result[kMaxPath] = { 0 };
|
|
uint32_t size = kMaxPath;
|
|
+#ifndef Q_OS_HAIKU
|
|
#ifdef Q_OS_MAC
|
|
if (_NSGetExecutablePath(result, &size) == 0) {
|
|
return result;
|
|
@@ -198,6 +199,7 @@ TEST_CASE("two process encrypted file", "[storage_encrypted_file]") {
|
|
return result;
|
|
}
|
|
#endif // Q_OS_MAC
|
|
+#endif // Q_OS_HAIKU
|
|
return "tests_storage";
|
|
#endif // Q_OS_WIN
|
|
}();
|
|
diff --git a/Telegram/SourceFiles/ui/painter.h b/Telegram/SourceFiles/ui/painter.h
|
|
index 627c88e..2534f1d 100644
|
|
--- a/Telegram/SourceFiles/ui/painter.h
|
|
+++ b/Telegram/SourceFiles/ui/painter.h
|
|
@@ -19,12 +19,12 @@ public:
|
|
|
|
void drawTextLeft(int x, int y, int outerw, const QString &text, int textWidth = -1) {
|
|
QFontMetrics m(fontMetrics());
|
|
- if (style::RightToLeft() && textWidth < 0) textWidth = m.width(text);
|
|
+ if (style::RightToLeft() && textWidth < 0) textWidth = m.horizontalAdvance(text);
|
|
drawText(style::RightToLeft() ? (outerw - x - textWidth) : x, y + m.ascent(), text);
|
|
}
|
|
void drawTextRight(int x, int y, int outerw, const QString &text, int textWidth = -1) {
|
|
QFontMetrics m(fontMetrics());
|
|
- if (!style::RightToLeft() && textWidth < 0) textWidth = m.width(text);
|
|
+ if (!style::RightToLeft() && textWidth < 0) textWidth = m.horizontalAdvance(text);
|
|
drawText(style::RightToLeft() ? x : (outerw - x - textWidth), y + m.ascent(), text);
|
|
}
|
|
void drawPixmapLeft(int x, int y, int outerw, const QPixmap &pix, const QRect &from) {
|
|
diff --git a/Telegram/SourceFiles/ui/platform/haiku/ui_platform_utility_haiku.cpp b/Telegram/SourceFiles/ui/platform/haiku/ui_platform_utility_haiku.cpp
|
|
new file mode 100644
|
|
index 0000000..40b75e9
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/ui/platform/haiku/ui_platform_utility_haiku.cpp
|
|
@@ -0,0 +1,39 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2018 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#include "ui/platform/haiku/ui_platform_utility_haiku.h"
|
|
+
|
|
+#include "base/flat_set.h"
|
|
+#include "ui/ui_log.h"
|
|
+
|
|
+#include <QtCore/QPoint>
|
|
+#include <QtWidgets/QApplication>
|
|
+#include <QtWidgets/QDesktopWidget>
|
|
+#include <qpa/qplatformnativeinterface.h>
|
|
+
|
|
+namespace Ui {
|
|
+namespace Platform {
|
|
+
|
|
+bool IsApplicationActive() {
|
|
+ return static_cast<QApplication*>(QApplication::instance())->activeWindow() != nullptr;
|
|
+}
|
|
+
|
|
+bool TranslucentWindowsSupported(QPoint globalPosition) {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+} // namespace Platform
|
|
+} // namespace Ui
|
|
diff --git a/Telegram/SourceFiles/ui/platform/haiku/ui_platform_utility_haiku.h b/Telegram/SourceFiles/ui/platform/haiku/ui_platform_utility_haiku.h
|
|
new file mode 100644
|
|
index 0000000..0b12104
|
|
--- /dev/null
|
|
+++ b/Telegram/SourceFiles/ui/platform/haiku/ui_platform_utility_haiku.h
|
|
@@ -0,0 +1,51 @@
|
|
+/*
|
|
+This file is part of Telegram Desktop for Haiku,
|
|
+
|
|
+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.
|
|
+
|
|
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
|
+Copyright (c) 2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+*/
|
|
+
|
|
+#pragma once
|
|
+
|
|
+class QPainter;
|
|
+class QPaintEvent;
|
|
+
|
|
+namespace Ui {
|
|
+namespace Platform {
|
|
+
|
|
+inline void StartTranslucentPaint(QPainter &p, QPaintEvent *e) {
|
|
+}
|
|
+
|
|
+inline void InitOnTopPanel(not_null<QWidget*> panel) {
|
|
+}
|
|
+
|
|
+inline void DeInitOnTopPanel(not_null<QWidget*> panel) {
|
|
+}
|
|
+
|
|
+inline void ReInitOnTopPanel(not_null<QWidget*> panel) {
|
|
+}
|
|
+
|
|
+inline void UpdateOverlayed(not_null<QWidget*> widget) {
|
|
+}
|
|
+
|
|
+inline void ShowOverAll(not_null<QWidget*> widget, bool canFocus) {
|
|
+}
|
|
+
|
|
+inline void BringToBack(not_null<QWidget*> widget) {
|
|
+}
|
|
+
|
|
+inline constexpr bool UseMainQueueGeneric() {
|
|
+ return true;
|
|
+}
|
|
+
|
|
+} // namespace Platform
|
|
+} // namespace Ui
|
|
diff --git a/Telegram/SourceFiles/ui/platform/ui_platform_utility.h b/Telegram/SourceFiles/ui/platform/ui_platform_utility.h
|
|
index 62c2fdf..0b4e851 100644
|
|
--- a/Telegram/SourceFiles/ui/platform/ui_platform_utility.h
|
|
+++ b/Telegram/SourceFiles/ui/platform/ui_platform_utility.h
|
|
@@ -39,6 +39,8 @@ void DrainMainQueue(); // Needed only if UseMainQueueGeneric() is false.
|
|
#include "ui/platform/mac/ui_platform_utility_mac.h"
|
|
#elif defined Q_OS_LINUX // Q_OS_MAC
|
|
#include "ui/platform/linux/ui_platform_utility_linux.h"
|
|
+#elif defined Q_OS_HAIKU // Q_OS_LINUX
|
|
+#include "ui/platform/haiku/ui_platform_utility_haiku.h"
|
|
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_LINUX
|
|
#include "ui/platform/win/ui_platform_utility_win.h"
|
|
#endif // Q_OS_MAC || Q_OS_LINUX || Q_OS_WINRT || Q_OS_WIN
|
|
diff --git a/Telegram/SourceFiles/ui/style/style_core_font.cpp b/Telegram/SourceFiles/ui/style/style_core_font.cpp
|
|
index 653dbff..1e10a9c 100644
|
|
--- a/Telegram/SourceFiles/ui/style/style_core_font.cpp
|
|
+++ b/Telegram/SourceFiles/ui/style/style_core_font.cpp
|
|
@@ -162,8 +162,8 @@ FontData::FontData(int size, uint32 flags, int family, Font *other)
|
|
f.setPixelSize(size);
|
|
if (_flags & FontBold) {
|
|
f.setBold(true);
|
|
- //} else if (fontFamilies[family] == "Open Sans Semibold") {
|
|
- // f.setWeight(QFont::DemiBold);
|
|
+ } else if (fontFamilies[family] == "Open Sans Semibold") {
|
|
+ f.setWeight(QFont::DemiBold);
|
|
}
|
|
f.setItalic(_flags & FontItalic);
|
|
f.setUnderline(_flags & FontUnderline);
|
|
diff --git a/Telegram/SourceFiles/ui/style/style_core_font.h b/Telegram/SourceFiles/ui/style/style_core_font.h
|
|
index a9cd5b1..f3ca2d9 100644
|
|
--- a/Telegram/SourceFiles/ui/style/style_core_font.h
|
|
+++ b/Telegram/SourceFiles/ui/style/style_core_font.h
|
|
@@ -73,13 +73,13 @@ class FontData {
|
|
public:
|
|
|
|
int32 width(const QString &str) const {
|
|
- return m.width(str);
|
|
+ return m.horizontalAdvance(str);
|
|
}
|
|
int32 width(const QString &str, int32 from, int32 to) const {
|
|
return width(str.mid(from, to));
|
|
}
|
|
int32 width(QChar ch) const {
|
|
- return m.width(ch);
|
|
+ return m.horizontalAdvance(ch);
|
|
}
|
|
QString elided(const QString &str, int32 width, Qt::TextElideMode mode = Qt::ElideRight) const {
|
|
return m.elidedText(str, mode, width);
|
|
diff --git a/Telegram/SourceFiles/ui/text/text.cpp b/Telegram/SourceFiles/ui/text/text.cpp
|
|
index 7891995..eaeb52b 100644
|
|
--- a/Telegram/SourceFiles/ui/text/text.cpp
|
|
+++ b/Telegram/SourceFiles/ui/text/text.cpp
|
|
@@ -1968,11 +1968,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 29173c5..b47a53d 100644
|
|
--- a/Telegram/SourceFiles/ui/text/text_block.cpp
|
|
+++ b/Telegram/SourceFiles/ui/text/text_block.cpp
|
|
@@ -334,6 +334,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();
|
|
}
|
|
}
|
|
|
|
diff --git a/Telegram/SourceFiles/ui/ui_utility.cpp b/Telegram/SourceFiles/ui/ui_utility.cpp
|
|
index 878d591..f7c4a47 100644
|
|
--- a/Telegram/SourceFiles/ui/ui_utility.cpp
|
|
+++ b/Telegram/SourceFiles/ui/ui_utility.cpp
|
|
@@ -167,9 +167,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(crl::now());
|
|
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 dfe1193..0b13fc0 100644
|
|
--- a/Telegram/gyp/PrecompiledHeader.cmake
|
|
+++ b/Telegram/gyp/PrecompiledHeader.cmake
|
|
@@ -114,7 +114,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}" ${_compiler_FLAGS} "$(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)")
|
|
@@ -125,7 +125,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}" ${_compiler_FLAGS} "$(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 header ${_name} for ${_target} (C++)")
|
|
diff --git a/Telegram/gyp/common/common.gypi b/Telegram/gyp/common/common.gypi
|
|
index 6531a7a..242f869 100644
|
|
--- a/Telegram/gyp/common/common.gypi
|
|
+++ b/Telegram/gyp/common/common.gypi
|
|
@@ -9,6 +9,7 @@
|
|
'win.gypi',
|
|
'mac.gypi',
|
|
'linux.gypi',
|
|
+ 'haiku.gypi',
|
|
],
|
|
'variables': {
|
|
'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)',
|
|
|
|
'official_build_target%': '',
|
|
'build_standard_win%': 'c++17',
|
|
@@ -54,6 +62,7 @@
|
|
'build_win%': '<(build_win)',
|
|
'build_mac%': '<(build_mac)',
|
|
'build_linux%': '<(build_linux)',
|
|
+ 'build_haiku%': '<(build_haiku)',
|
|
'official_build_target%': '<(official_build_target)',
|
|
'build_standard_win%': '<(build_standard_win)',
|
|
'libs_loc%': '<(libs_loc)',
|
|
diff --git a/Telegram/gyp/common/haiku.gypi b/Telegram/gyp/common/haiku.gypi
|
|
new file mode 100644
|
|
index 0000000..dbc6dce
|
|
--- /dev/null
|
|
+++ b/Telegram/gyp/common/haiku.gypi
|
|
@@ -0,0 +1,62 @@
|
|
+# 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) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+
|
|
+{
|
|
+ 'conditions': [
|
|
+ [ 'build_haiku', {
|
|
+ 'variables': {
|
|
+ 'haiku_common_flags': [
|
|
+ '-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',
|
|
+ ],
|
|
+ },
|
|
+ 'defines': [
|
|
+ '_REENTRANT',
|
|
+ 'QT_PLUGIN',
|
|
+ 'Q_OS_HAIKU',
|
|
+ 'TDESKTOP_DISABLE_CRASH_REPORTS',
|
|
+ 'TDESKTOP_DISABLE_AUTOUPDATE',
|
|
+ 'TDESKTOP_DISABLE_UNITY_INTEGRATION',
|
|
+ 'TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION',
|
|
+ ],
|
|
+ 'cflags_c': [
|
|
+ '<@(haiku_common_flags)',
|
|
+ '-std=gnu11',
|
|
+ ],
|
|
+ 'cflags_cc': [
|
|
+ '<@(haiku_common_flags)',
|
|
+ '-std=c++1z',
|
|
+ '-Wno-register',
|
|
+ ],
|
|
+ 'configurations': {
|
|
+ 'Debug': {
|
|
+ },
|
|
+ },
|
|
+ }],
|
|
+ ],
|
|
+}
|
|
diff --git a/Telegram/gyp/generate.py b/Telegram/gyp/generate.py
|
|
index 4194e16..c2fd3c8 100644
|
|
--- a/Telegram/gyp/generate.py
|
|
+++ b/Telegram/gyp/generate.py
|
|
@@ -98,6 +98,11 @@ elif sys.platform == 'darwin':
|
|
gypScript = '../../../Libraries/gyp/gyp'
|
|
gypArguments.append('-Gxcode_upgrade_check_project_version=1030')
|
|
gypFormats.append('xcode')
|
|
+elif sys.platform == 'haiku1':
|
|
+ gypScript = 'gyp'
|
|
+ gypFormats.append('cmake')
|
|
+ cmakeConfigurations.append('Debug')
|
|
+ cmakeConfigurations.append('Release')
|
|
else:
|
|
gypScript = '../../../Libraries/gyp/gyp'
|
|
gypFormats.append('cmake')
|
|
diff --git a/Telegram/gyp/lib_base.gyp b/Telegram/gyp/lib_base.gyp
|
|
index 98c0d88..d2aa3a6 100644
|
|
--- a/Telegram/gyp/lib_base.gyp
|
|
+++ b/Telegram/gyp/lib_base.gyp
|
|
@@ -33,9 +33,10 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
'<(submodules_loc)/xxHash',
|
|
],
|
|
diff --git a/Telegram/gyp/lib_export.gyp b/Telegram/gyp/lib_export.gyp
|
|
index 140ea6b..51e0624 100644
|
|
--- a/Telegram/gyp/lib_export.gyp
|
|
+++ b/Telegram/gyp/lib_export.gyp
|
|
@@ -44,9 +44,10 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
],
|
|
'sources': [
|
|
diff --git a/Telegram/gyp/lib_ffmpeg.gyp b/Telegram/gyp/lib_ffmpeg.gyp
|
|
index 22a2a96..241f21c 100644
|
|
--- a/Telegram/gyp/lib_ffmpeg.gyp
|
|
+++ b/Telegram/gyp/lib_ffmpeg.gyp
|
|
@@ -34,9 +34,10 @@
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
'<(libs_loc)/ffmpeg',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
],
|
|
'sources': [
|
|
diff --git a/Telegram/gyp/lib_lottie.gyp b/Telegram/gyp/lib_lottie.gyp
|
|
index ee2bb0f..d14c75b 100644
|
|
--- a/Telegram/gyp/lib_lottie.gyp
|
|
+++ b/Telegram/gyp/lib_lottie.gyp
|
|
@@ -43,13 +43,14 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(libs_loc)/zlib',
|
|
'<(libs_loc)/ffmpeg',
|
|
'<(rlottie_loc)',
|
|
'<(lz4_loc)',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
],
|
|
'sources': [
|
|
diff --git a/Telegram/gyp/lib_mtproto.gyp b/Telegram/gyp/lib_mtproto.gyp
|
|
index 6adcd34..c9109b0 100644
|
|
--- a/Telegram/gyp/lib_mtproto.gyp
|
|
+++ b/Telegram/gyp/lib_mtproto.gyp
|
|
@@ -44,9 +44,10 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
],
|
|
'sources': [
|
|
diff --git a/Telegram/gyp/lib_storage.gyp b/Telegram/gyp/lib_storage.gyp
|
|
index cd3b6d3..b16a472 100644
|
|
--- a/Telegram/gyp/lib_storage.gyp
|
|
+++ b/Telegram/gyp/lib_storage.gyp
|
|
@@ -38,9 +38,10 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
'<(submodules_loc)/xxHash',
|
|
],
|
|
diff --git a/Telegram/gyp/lib_ui.gyp b/Telegram/gyp/lib_ui.gyp
|
|
index fa6bd4e..9876b75 100644
|
|
--- a/Telegram/gyp/lib_ui.gyp
|
|
+++ b/Telegram/gyp/lib_ui.gyp
|
|
@@ -56,9 +56,10 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
'<(emoji_suggestions_loc)',
|
|
],
|
|
diff --git a/Telegram/gyp/lib_ui/sources.txt b/Telegram/gyp/lib_ui/sources.txt
|
|
index 2a64c1a..310aa51 100644
|
|
--- a/Telegram/gyp/lib_ui/sources.txt
|
|
+++ b/Telegram/gyp/lib_ui/sources.txt
|
|
@@ -15,6 +15,8 @@
|
|
<(src_loc)/ui/platform/ui_platform_utility.h
|
|
<(src_loc)/ui/platform/linux/ui_platform_utility_linux.cpp
|
|
<(src_loc)/ui/platform/linux/ui_platform_utility_linux.h
|
|
+<(src_loc)/ui/platform/haiku/ui_platform_utility_haiku.cpp
|
|
+<(src_loc)/ui/platform/haiku/ui_platform_utility_haiku.h
|
|
<(src_loc)/ui/platform/mac/ui_platform_utility_mac.h
|
|
<(src_loc)/ui/platform/mac/ui_platform_utility_mac.mm
|
|
<(src_loc)/ui/platform/win/ui_platform_utility_win.cpp
|
|
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' ]
|
|
|
|
for replace in replaces:
|
|
replace_parts = replace.split('=', 1)
|
|
diff --git a/Telegram/gyp/modules/qt.gypi b/Telegram/gyp/modules/qt.gypi
|
|
index 0b783ec..eac3792 100644
|
|
--- a/Telegram/gyp/modules/qt.gypi
|
|
+++ b/Telegram/gyp/modules/qt.gypi
|
|
@@ -14,18 +14,14 @@
|
|
[ 'build_macold', {
|
|
'qt_version%': '5.3.2',
|
|
}, {
|
|
- 'qt_version%': '5.6.2',
|
|
+ 'qt_version%': '<!(pkg-config --modversion Qt5Core)',
|
|
}]
|
|
],
|
|
},
|
|
'qt_libs': [
|
|
- 'qwebp',
|
|
- 'Qt5PrintSupport',
|
|
- 'Qt5PlatformSupport',
|
|
'Qt5Network',
|
|
'Qt5Widgets',
|
|
'Qt5Gui',
|
|
- 'qtharfbuzzng',
|
|
],
|
|
'qt_version%': '<(qt_version)',
|
|
'conditions': [
|
|
@@ -100,6 +96,15 @@
|
|
'xcb-static',
|
|
],
|
|
}],
|
|
+ [ 'build_haiku', {
|
|
+ 'qt_lib_prefix': '',
|
|
+ 'qt_lib_debug_postfix': '',
|
|
+ 'qt_lib_release_postfix': '',
|
|
+ 'qt_libs': [
|
|
+ '<@(qt_libs)',
|
|
+ 'Qt5Core',
|
|
+ ],
|
|
+ }],
|
|
],
|
|
},
|
|
'qt_version%': '<(qt_version)',
|
|
@@ -180,14 +185,13 @@
|
|
},
|
|
|
|
'include_dirs': [
|
|
- '<(qt_loc)/include',
|
|
- '<(qt_loc)/include/QtCore',
|
|
- '<(qt_loc)/include/QtGui',
|
|
- '<(qt_loc)/include/QtDBus',
|
|
- '<(qt_loc)/include/QtCore/<(qt_version)',
|
|
- '<(qt_loc)/include/QtGui/<(qt_version)',
|
|
- '<(qt_loc)/include/QtCore/<(qt_version)/QtCore',
|
|
- '<(qt_loc)/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',
|
|
@@ -235,6 +239,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/modules/qt_moc.gypi b/Telegram/gyp/modules/qt_moc.gypi
|
|
index ebee90a..436e9b5 100644
|
|
--- a/Telegram/gyp/modules/qt_moc.gypi
|
|
+++ b/Telegram/gyp/modules/qt_moc.gypi
|
|
@@ -15,7 +15,7 @@
|
|
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/moc/moc_<(RULE_INPUT_ROOT).cpp',
|
|
],
|
|
'action': [
|
|
- '<(qt_loc)/bin/moc<(exe_ext)',
|
|
+ 'moc',
|
|
|
|
# Silence "Note: No relevant classes found. No output generated."
|
|
'--no-notes',
|
|
diff --git a/Telegram/gyp/modules/qt_rcc.gypi b/Telegram/gyp/modules/qt_rcc.gypi
|
|
index f5624a8..fd1e3bd 100644
|
|
--- a/Telegram/gyp/modules/qt_rcc.gypi
|
|
+++ b/Telegram/gyp/modules/qt_rcc.gypi
|
|
@@ -15,7 +15,7 @@
|
|
'<(SHARED_INTERMEDIATE_DIR)/<(_target_name)/qrc/qrc_<(RULE_INPUT_ROOT).cpp',
|
|
],
|
|
'action': [
|
|
- '<(qt_loc)/bin/rcc<(exe_ext)',
|
|
+ 'rcc',
|
|
'-name', '<(RULE_INPUT_ROOT)',
|
|
'-no-compress',
|
|
'<(RULE_INPUT_PATH)',
|
|
diff --git a/Telegram/gyp/telegram/haiku.gypi b/Telegram/gyp/telegram/haiku.gypi
|
|
new file mode 100644
|
|
index 0000000..76a08fa
|
|
--- /dev/null
|
|
+++ b/Telegram/gyp/telegram/haiku.gypi
|
|
@@ -0,0 +1,75 @@
|
|
+# 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) 2018-2019 Gerasim Troeglazov, 3dEyes@gmail.com
|
|
+
|
|
+{
|
|
+ 'conditions': [[ 'build_haiku', {
|
|
+ 'variables': {
|
|
+ 'haiku_path_include%': '@HAIKU_HEADERS@',
|
|
+ 'haiku_path_lib%': '@HAIKU_LIBS@',
|
|
+ },
|
|
+ 'include_dirs': [
|
|
+ '<(haiku_path_include)',
|
|
+ '<(haiku_path_include)/openssl',
|
|
+ '<(haiku_path_include)/libavcodec',
|
|
+ '<(haiku_path_include)/AL',
|
|
+ '<(haiku_path_include)/breakpad',
|
|
+ '<(haiku_path_include)/opus',
|
|
+ '<(submodules_loc)/range/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
+ ],
|
|
+ 'libraries': [
|
|
+ '-lopenal',
|
|
+ '-lavformat',
|
|
+ '-lavcodec',
|
|
+ '-lswresample',
|
|
+ '-lswscale',
|
|
+ '-lavutil',
|
|
+ '-lmedia',
|
|
+ '-lminizip',
|
|
+ '-lopus',
|
|
+ '-lnetwork',
|
|
+ '-ltranslation',
|
|
+ '-lbe',
|
|
+ '-llzma',
|
|
+ '-lz',
|
|
+# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
|
|
+ ],
|
|
+ 'cflags_cc': [
|
|
+ '-Wno-strict-overflow',
|
|
+ '-Wno-maybe-uninitialized',
|
|
+ ],
|
|
+ '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 389ca8c..dbad7f4 100644
|
|
--- a/Telegram/gyp/telegram/qrc.gypi
|
|
+++ b/Telegram/gyp/telegram/qrc.gypi
|
|
@@ -26,6 +26,13 @@
|
|
],
|
|
}
|
|
}],
|
|
+ [ 'build_haiku', {
|
|
+ 'variables': {
|
|
+ 'qrc_files': [
|
|
+ '<(res_loc)/qrc/haiku.qrc',
|
|
+ ],
|
|
+ }
|
|
+ }],
|
|
[ 'build_mac', {
|
|
'variables': {
|
|
'qrc_files': [
|
|
diff --git a/Telegram/gyp/telegram/sources.txt b/Telegram/gyp/telegram/sources.txt
|
|
index 38d9d0e..fd8fd85 100644
|
|
--- a/Telegram/gyp/telegram/sources.txt
|
|
+++ b/Telegram/gyp/telegram/sources.txt
|
|
@@ -620,6 +620,20 @@
|
|
<(src_loc)/platform/linux/notifications_manager_linux.h
|
|
<(src_loc)/platform/linux/specific_linux.cpp
|
|
<(src_loc)/platform/linux/specific_linux.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/haiku/info_haiku.cpp
|
|
+<(src_loc)/platform/haiku/info_haiku.h
|
|
<(src_loc)/platform/mac/file_utilities_mac.mm
|
|
<(src_loc)/platform/mac/file_utilities_mac.h
|
|
<(src_loc)/platform/mac/info_mac.mm
|
|
@@ -863,14 +877,7 @@
|
|
<(src_loc)/settings.cpp
|
|
<(src_loc)/settings.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: win
|
|
<(res_loc)/winrc/Telegram.rc
|
|
diff --git a/Telegram/gyp/telegram/telegram.gypi b/Telegram/gyp/telegram/telegram.gypi
|
|
index c207db6..7123cbc 100644
|
|
--- a/Telegram/gyp/telegram/telegram.gypi
|
|
+++ b/Telegram/gyp/telegram/telegram.gypi
|
|
@@ -57,6 +57,7 @@
|
|
'win.gypi',
|
|
'mac.gypi',
|
|
'linux.gypi',
|
|
+ 'haiku.gypi',
|
|
'../modules/openssl.gypi',
|
|
'../modules/qt.gypi',
|
|
'../modules/qt_moc.gypi',
|
|
@@ -72,7 +73,6 @@
|
|
'codegen.gyp:codegen_numbers',
|
|
'codegen.gyp:codegen_style',
|
|
'tests/tests.gyp:tests',
|
|
- 'utils.gyp:Updater',
|
|
'../ThirdParty/libtgvoip/libtgvoip.gyp:libtgvoip',
|
|
'crl.gyp:crl',
|
|
'lib_base.gyp:lib_base',
|
|
@@ -85,7 +85,6 @@
|
|
],
|
|
|
|
'defines': [
|
|
- 'AL_LIBTYPE_STATIC',
|
|
'AL_ALEXT_PROTOTYPES',
|
|
'TGVOIP_USE_CXX11_LIB',
|
|
'XXH_INLINE_ALL',
|
|
@@ -97,18 +96,11 @@
|
|
'include_dirs': [
|
|
'<(src_loc)',
|
|
'<(SHARED_INTERMEDIATE_DIR)',
|
|
- '<(libs_loc)/breakpad/src',
|
|
- '<(libs_loc)/lzma/C',
|
|
- '<(libs_loc)/zlib',
|
|
- '<(libs_loc)/ffmpeg',
|
|
- '<(libs_loc)/openal-soft/include',
|
|
- '<(libs_loc)/opus/include',
|
|
- '<(libs_loc)/range-v3/include',
|
|
- '<(minizip_loc)',
|
|
- '<(sp_media_key_tap_loc)',
|
|
'<(emoji_suggestions_loc)',
|
|
+ '<(submodules_loc)/minizip',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/crl/src',
|
|
'<(submodules_loc)/xxHash',
|
|
],
|
|
diff --git a/Telegram/gyp/tests/common_test.gypi b/Telegram/gyp/tests/common_test.gypi
|
|
index 70f9653..99cc76a 100644
|
|
--- a/Telegram/gyp/tests/common_test.gypi
|
|
+++ b/Telegram/gyp/tests/common_test.gypi
|
|
@@ -13,9 +13,10 @@
|
|
'<(src_loc)',
|
|
'<(submodules_loc)/GSL/include',
|
|
'<(submodules_loc)/variant/include',
|
|
+ '<(submodules_loc)/variant/test/include',
|
|
'<(submodules_loc)/Catch/include',
|
|
'<(submodules_loc)/crl/src',
|
|
- '<(libs_loc)/range-v3/include',
|
|
+ '<(submodules_loc)/range/include',
|
|
],
|
|
'sources': [
|
|
'<(src_loc)/base/tests_main.cpp',
|
|
diff --git a/Telegram/gyp/utils.gyp b/Telegram/gyp/utils.gyp
|
|
index 63c0fa6..0ab02f5 100644
|
|
--- a/Telegram/gyp/utils.gyp
|
|
+++ b/Telegram/gyp/utils.gyp
|
|
@@ -33,6 +33,13 @@
|
|
'<(res_loc)/winrc/Updater.rc',
|
|
],
|
|
}],
|
|
+ [ 'build_haiku', {
|
|
+ 'libraries': [
|
|
+ 'ssl',
|
|
+ 'crypto',
|
|
+ 'lzma',
|
|
+ ],
|
|
+ }],
|
|
[ '"<(build_linux)" != "1"', {
|
|
'sources!': [
|
|
'<(src_loc)/_other/updater_linux.cpp',
|
|
--
|
|
2.23.0
|
|
|