Merge tag 'v4.16.0' into dev

# Conflicts:
#	README.md
#	Telegram/Resources/winrc/Telegram.rc
#	Telegram/Resources/winrc/Updater.rc
#	Telegram/SourceFiles/calls/calls_call.cpp
#	Telegram/SourceFiles/core/local_url_handlers.cpp
#	Telegram/SourceFiles/core/version.h
#	Telegram/SourceFiles/history/view/media/history_view_giveaway.cpp
#	Telegram/SourceFiles/history/view/media/history_view_sticker.cpp
#	Telegram/lib_ui
#	snap/snapcraft.yaml
This commit is contained in:
AlexeyZavar
2024-04-01 23:56:12 +03:00
511 changed files with 21299 additions and 4877 deletions
@@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include "base/platform/linux/base_linux_xdp_utilities.h"
#include "ui/platform/ui_platform_window_title.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/linux_wayland_integration.h"
#include "lang/lang_keys.h"
#include "mainwindow.h"
@@ -35,9 +34,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <kshell.h>
#include <ksandbox.h>
#include <glibmm.h>
#include <giomm.h>
#include <xdgdbus/xdgdbus.hpp>
#include <xdpbackground/xdpbackground.hpp>
#include <xdprequest/xdprequest.hpp>
@@ -55,7 +51,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
using namespace gi::repository;
namespace Gio = gi::repository::Gio;
namespace GObject = gi::repository::GObject;
using namespace Platform;
using Platform::internal::WaylandIntegration;
@@ -79,8 +75,9 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
if (!proxy) {
if (done) {
Gio::DBusErrorNS_::strip_remote_error(proxy.error());
LOG(("Portal Autostart Error: %1").arg(
proxy.error().what()));
proxy.error().message_().c_str()));
done(false);
}
return;
@@ -117,8 +114,10 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
if (!requestProxy) {
if (done) {
Gio::DBusErrorNS_::strip_remote_error(
requestProxy.error());
LOG(("Portal Autostart Error: %1").arg(
requestProxy.error().what()));
requestProxy.error().message_().c_str()));
done(false);
}
return;
@@ -158,7 +157,7 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
commandline.push_back("-autostart");
interface.call_request_background(
std::string(base::Platform::XDP::ParentWindowID()),
base::Platform::XDP::ParentWindowID(),
GLib::Variant::new_array({
GLib::Variant::new_dict_entry(
GLib::Variant::new_string("handle_token"),
@@ -192,8 +191,11 @@ void PortalAutostart(bool enabled, Fn<void(bool)> done) {
if (!result) {
if (done) {
LOG(("Portal Autostart Error: %1")
.arg(result.error().what()));
const auto &error = result.error();
Gio::DBusErrorNS_::strip_remote_error(
error);
LOG(("Portal Autostart Error: %1").arg(
error.message_().c_str()));
done(false);
}
@@ -247,7 +249,7 @@ bool GenerateDesktopFile(
if (!loaded) {
if (!silent) {
LOG(("App Error: %1").arg(loaded.error().what()));
LOG(("App Error: %1").arg(loaded.error().message_().c_str()));
}
return false;
}
@@ -257,7 +259,8 @@ bool GenerateDesktopFile(
const auto removed = target.remove_group(group);
if (!removed) {
if (!silent) {
LOG(("App Error: %1").arg(removed.error().what()));
LOG(("App Error: %1").arg(
removed.error().message_().c_str()));
}
return false;
}
@@ -320,7 +323,7 @@ bool GenerateDesktopFile(
const auto saved = target.save_to_file(targetFile.toStdString());
if (!saved) {
if (!silent) {
LOG(("App Error: %1").arg(saved.error().what()));
LOG(("App Error: %1").arg(saved.error().message_().c_str()));
}
return false;
}
@@ -411,7 +414,7 @@ bool GenerateServiceFile(bool silent = false) {
const auto saved = target.save_to_file(targetFile.toStdString());
if (!saved) {
if (!silent) {
LOG(("App Error: %1").arg(saved.error().what()));
LOG(("App Error: %1").arg(saved.error().message_().c_str()));
}
return false;
}
@@ -507,12 +510,12 @@ QString SingleInstanceLocalServerName(const QString &hash) {
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
std::optional<bool> IsDarkMode() {
const auto result = base::Platform::XDP::ReadSetting<uint>(
const auto result = base::Platform::XDP::ReadSetting(
"org.freedesktop.appearance",
"color-scheme");
return result.has_value()
? std::make_optional(*result == 1)
? std::make_optional(result->get_uint32() == 1)
: std::nullopt;
}
#endif // Qt < 6.5.0
@@ -687,9 +690,6 @@ void start() {
GLib::set_prgname(cExeName().toStdString());
GLib::set_application_name(AppName.data());
Glib::init();
::Gio::init();
Webview::WebKitGTK::SetSocketPath(u"%1/%2-%3-webview-%4"_q.arg(
QDir::tempPath(),
h,
@@ -727,21 +727,13 @@ bool OpenSystemSettings(SystemSettingsType type) {
}
options.push_back(std::move(command));
};
for (const auto &type : DesktopEnvironment::Get()) {
using DesktopEnvironment::Type;
if (type == Type::Unity) {
add("unity-control-center", "sound");
} else if (type == Type::KDE) {
add("kcmshell5", "kcm_pulseaudio");
add("kcmshell4", "phonon");
} else if (type == Type::Gnome) {
add("gnome-control-center", "sound");
} else if (type == Type::Cinnamon) {
add("cinnamon-settings", "sound");
} else if (type == Type::MATE) {
add("mate-volume-control");
}
}
add("unity-control-center", "sound");
add("kcmshell6", "kcm_pulseaudio");
add("kcmshell5", "kcm_pulseaudio");
add("kcmshell4", "phonon");
add("gnome-control-center", "sound");
add("cinnamon-settings", "sound");
add("mate-volume-control");
add("pavucontrol-qt");
add("pavucontrol");
add("alsamixergui");