Compare commits

..

11 Commits

Author SHA1 Message Date
John Preston
86362875dd Beta version 3.0.3.
- Try fixing crashes in allocator on Linux.
2021-09-12 01:53:04 +03:00
John Preston
0a4a96d4cd Fix action build on Linux. 2021-09-12 01:39:28 +03:00
John Preston
1c33eee80a Update hime to 0.9.11. 2021-09-12 00:33:35 +03:00
Ilya Fedin
4f5558d28c Move new dependencies to the beginning of Dockerfile, update patches
The reason was to not to do a full rebuild, but looks like the cache is already cleaned
2021-09-12 00:25:01 +03:00
Ilya Fedin
3fbd68cff9 Don't link glib with DESKTOP_APP_DISABLE_DBUS_INTEGRATION 2021-09-12 00:12:13 +03:00
Ilya Fedin
ee8c6f68d7 Use clang to build jemalloc since it crashes with gcc 2021-09-12 00:11:47 +03:00
John Preston
8d4174afb5 Fix macOS build in GitHub Actions. 2021-09-11 20:13:18 +03:00
John Preston
9150cc77f9 Improve colorizing of custom themes. 2021-09-11 12:26:35 +03:00
John Preston
8d31769846 Fix build with Xcode. 2021-09-11 00:02:15 +03:00
John Preston
13c00949ed Add a simple way of testing color themes. 2021-09-10 22:29:30 +03:00
John Preston
c4d822ba02 Fix action build on Windows. 2021-09-10 16:19:07 +03:00
33 changed files with 335 additions and 112 deletions

View File

@@ -53,7 +53,7 @@ jobs:
defaults:
run:
shell: scl enable devtoolset-9 -- bash --noprofile --norc -eo pipefail {0}
shell: scl enable llvm-toolset-7.0 -- scl enable devtoolset-9 -- bash --noprofile --norc -eo pipefail {0}
strategy:
matrix:

View File

@@ -96,7 +96,7 @@ jobs:
echo "$PWD/Libraries/depot_tools" >> $GITHUB_PATH
mkdir -p Libraries
mkdir -p Libraries/local
cd Libraries
echo "LibrariesPath=`pwd`" >> $GITHUB_ENV
echo "PREFIX=`pwd`/local" >> $GITHUB_ENV
@@ -194,13 +194,13 @@ jobs:
cd opus
git checkout v1.3
./autogen.sh
CFLAGS="$MIN_MAC $UNGUARDED" CPPFLAGS="$MIN_MAC $UNGUARDED" LDFLAGS="$MIN_MAC" ./configure --prefix=$PREFIX
CFLAGS="$MIN_MAC $UNGUARDED" CPPFLAGS="$MIN_MAC $UNGUARDED" LDFLAGS="$MIN_MAC" ./configure --prefix=$LibrariesPath/opus-cache
make -j$(nproc)
make DESTDIR="$LibrariesPath/opus-cache" install
make install
- name: Opus install.
run: |
cd $LibrariesPath
cp -R opus-cache/. /
cp -R opus-cache/. local/
- name: Rnnoise.
run: |
@@ -226,13 +226,13 @@ jobs:
wget https://ftp.gnu.org/pub/gnu/libiconv/"$LIBICONV_VER".tar.gz
tar -xvzf "$LIBICONV_VER".tar.gz
cd $LIBICONV_VER
CFLAGS="$MIN_MAC $UNGUARDED" CPPFLAGS="$MIN_MAC $UNGUARDED" LDFLAGS="$MIN_MAC" ./configure --enable-static --prefix=$PREFIX
CFLAGS="$MIN_MAC $UNGUARDED" CPPFLAGS="$MIN_MAC $UNGUARDED" LDFLAGS="$MIN_MAC" ./configure --enable-static --prefix=$LibrariesPath/libiconv-cache
make -j$(nproc)
make DESTDIR="$LibrariesPath/libiconv-cache" install
make install
- name: Libiconv install.
run: |
cd $LibrariesPath
cp -R libiconv-cache/. /
cp -R libiconv-cache/. local/
- name: FFmpeg cache.
id: cache-ffmpeg
@@ -256,7 +256,6 @@ jobs:
--extra-cflags="$MIN_MAC $UNGUARDED" \
--extra-cxxflags="$MIN_MAC $UNGUARDED" \
--extra-ldflags="$MIN_MAC" \
--x86asmexe=`pwd`/macos_yasm_wrap.sh \
--enable-protocol=file \
--enable-libopus \
--disable-programs \

View File

@@ -58,7 +58,7 @@ jobs:
UPLOAD_ARTIFACT: "false"
ONLY_CACHE: "false"
MANUAL_CACHING: "0"
DOC_PATH: "docs/building-win.md"
PREPARE_PATH: "Telegram/build/prepare/prepare.py"
AUTO_CACHING: "1"
defaults:
@@ -132,24 +132,12 @@ jobs:
working-directory: ${{ github.workspace }}
run: |
echo "Find necessary commit from doc."
checkoutCommit=$(grep -A 1 "cd patches" $REPO_NAME/$DOC_PATH | sed -n 2p)
checkoutCommit=$(grep -A 1 "cd patches" $REPO_NAME/$PREPARE_PATH | sed -n 2p)
cd $LibrariesPath
git clone $GIT/desktop-app/patches.git
cd Patches
cd patches
eval $checkoutCommit
- name: Find any version of Python 2.
shell: bash
run: |
echo "Find any version of Python 2."
p=`ls /c/hostedtoolcache/windows/python | grep "^2" | tail -1`
if [ -z "$p" ]; then
echo "Python 2 is not found."
exit 1
fi
echo "PY2=C:\\hostedtoolcache\\windows\\Python\\$p\\x64" >> $GITHUB_ENV
echo "Found $p."
- name: LZMA.
run: |
git clone %GIT%/telegramdesktop/lzma.git
@@ -161,28 +149,27 @@ jobs:
id: cache-openssl
uses: actions/cache@v2
with:
path: ${{ env.LibrariesPath }}/openssl_${{ env.OPENSSL_VER }}
path: ${{ env.LibrariesPath }}/openssl
key: ${{ runner.OS }}-${{ env.CACHE_KEY }}-${{ env.OPENSSL_VER }}
- name: OpenSSL.
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: |
git clone %GIT%/openssl/openssl.git openssl_%OPENSSL_VER%
cd openssl_%OPENSSL_VER%
git checkout OpenSSL_%OPENSSL_VER%-stable
git clone -b OpenSSL_%OPENSSL_VER%-stable %GIT%/openssl/openssl.git
cd openssl
perl Configure no-shared no-tests debug-VC-WIN32
nmake
mkdir out32.dbg
move libcrypto.lib out32.dbg
move libssl.lib out32.dbg
move ossl_static.pdb out32.dbg\ossl_static
mkdir out.dbg
move libcrypto.lib out.dbg
move libssl.lib out.dbg
move ossl_static.pdb out.dbg\ossl_static
nmake clean
move out32.dbg\ossl_static out32.dbg\ossl_static.pdb
move out.dbg\ossl_static out.dbg\ossl_static.pdb
perl Configure no-shared no-tests VC-WIN32
nmake
mkdir out32
move libcrypto.lib out32
move libssl.lib out32
move ossl_static.pdb out32
mkdir out
move libcrypto.lib out
move libssl.lib out
move ossl_static.pdb out
rmdir /S /Q test
rmdir /S /Q .git
@@ -239,16 +226,17 @@ jobs:
GYP_MSVS_VERSION: 2019
if: steps.cache-breakpad.outputs.cache-hit != 'true'
run: |
git clone %GIT%/telegramdesktop/gyp.git
git clone https://chromium.googlesource.com/external/gyp
cd gyp
SET PATH=%PY2%;%cd%;%PATH%
git checkout tdesktop
SET PATH=%cd%;%PATH%
git checkout d6c5dd51dc
git apply ../patches/gyp.diff
cd %LibrariesPath%
git clone %GIT%/google/breakpad
git clone https://chromium.googlesource.com/breakpad/breakpad
cd breakpad
git checkout a1dbcdcb43
git checkout bc8fb886
git apply ../patches/breakpad.diff
cd src
git clone %GIT%/google/googletest testing
@@ -258,10 +246,9 @@ jobs:
ninja -C out/Debug common crash_generation_client exception_handler
ninja -C out/Release common crash_generation_client exception_handler
cd tools\windows\dump_syms
call gyp dump_syms.gyp
call vcvars32.bat
msbuild -m dump_syms.vcxproj /property:Configuration=Release
call gyp dump_syms.gyp --format=ninja
cd ..\..\..
ninja -C out/Release dump_syms
- name: Opus cache.
id: cache-opus
@@ -352,7 +339,7 @@ jobs:
for /r %%i in (..\..\patches\qtbase_%QT%\*) do git apply %%i
cd ..
SET SSL=%LibrariesPath%\openssl_%OPENSSL_VER%
SET SSL=%LibrariesPath%\openssl
SET SSL_LIBS=libcrypto.lib Ws2_32.lib Gdi32.lib Advapi32.lib Crypt32.lib User32.lib
SET ANGLE=%LibrariesPath%\tg_angle
@@ -380,8 +367,8 @@ jobs:
QMAKE_LIBS_EGL_RELEASE="%ANGLE%\out\Release\tg_angle.lib %ZLIB%\ZlibStatReleaseWithoutAsm\zlibstat.lib %ANGLE_LIBS% Gdi32.lib User32.lib" ^
-openssl-linked ^
-I "%SSL%\include" ^
OPENSSL_LIBS_DEBUG="%SSL%\out32.dbg\libssl.lib %SSL%\out32.dbg\%SSL_LIBS%" ^
OPENSSL_LIBS_RELEASE="%SSL%\out32\libssl.lib %SSL%\out32\%SSL_LIBS%" ^
OPENSSL_LIBS_DEBUG="%SSL%\out.dbg\libssl.lib %SSL%\out.dbg\%SSL_LIBS%" ^
OPENSSL_LIBS_RELEASE="%SSL%\out\libssl.lib %SSL%\out\%SSL_LIBS%" ^
-I "%LibrariesPath%\mozjpeg" ^
LIBJPEG_LIBS_DEBUG="%LibrariesPath%\mozjpeg\Debug\jpeg-static.lib" ^
LIBJPEG_LIBS_RELEASE="%LibrariesPath%\mozjpeg\Release\jpeg-static.lib" ^
@@ -418,7 +405,7 @@ jobs:
-DTG_OWT_SPECIAL_TARGET=win ^
-DTG_OWT_BUILD_AUDIO_BACKENDS=OFF ^
-DTG_OWT_LIBJPEG_INCLUDE_PATH=%cd%/../../../mozjpeg ^
-DTG_OWT_OPENSSL_INCLUDE_PATH=%cd%/../../../openssl_%OPENSSL_VER%/include ^
-DTG_OWT_OPENSSL_INCLUDE_PATH=%cd%/../../../openssl/include ^
-DTG_OWT_OPUS_INCLUDE_PATH=%cd%/../../../opus/include ^
-DTG_OWT_FFMPEG_INCLUDE_PATH=%cd%/../../../ffmpeg ^
../..

View File

@@ -1245,17 +1245,13 @@ elseif (APPLE)
endif()
endif()
else()
target_link_libraries(Telegram
PRIVATE
desktop-app::external_glibmm
desktop-app::external_glib
)
if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
target_link_libraries(Telegram
PRIVATE
desktop-app::external_statusnotifieritem
desktop-app::external_dbusmenu_qt
desktop-app::external_glibmm
desktop-app::external_glib
)
endif()

View File

@@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="3.0.2.0" />
Version="3.0.3.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,2,0
PRODUCTVERSION 3,0,2,0
FILEVERSION 3,0,3,0
PRODUCTVERSION 3,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "3.0.2.0"
VALUE "FileVersion", "3.0.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.0.2.0"
VALUE "ProductVersion", "3.0.3.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,0,2,0
PRODUCTVERSION 3,0,2,0
FILEVERSION 3,0,3,0
PRODUCTVERSION 3,0,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "3.0.2.0"
VALUE "FileVersion", "3.0.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.0.2.0"
VALUE "ProductVersion", "3.0.3.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -130,7 +130,6 @@ struct State {
not_null<HistoryItem*> item,
not_null<QWidget*> context) {
auto weak = QPointer<QWidget>(context.get());
const auto fullId = item->fullId();
const auto session = &item->history()->session();
return [=](auto consumer) {
if (!weak) {

View File

@@ -39,6 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h"
#include "main/main_session.h"
#include "main/main_session_settings.h"
#include "history/history.h"
#include "apiwrap.h"
#include <QtGui/QGuiApplication>
@@ -464,6 +465,29 @@ bool ShowInviteLink(
return true;
}
bool ResolveTestChatTheme(
Window::SessionController *controller,
const Match &match,
const QVariant &context) {
if (!controller) {
return false;
}
const auto params = url_parse_params(
match->captured(1),
qthelp::UrlParamNameTransform::ToLower);
if (const auto history = controller->activeChatCurrent().history()) {
controller->clearCachedChatThemes();
const auto theme = history->owner().cloudThemes().updateThemeFromLink(
history->peer->themeEmoji(),
params);
if (theme) {
[[maybe_unused]] auto value = controller->cachedChatThemeValue(
*theme);
}
}
return true;
}
} // namespace
const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
@@ -524,6 +548,10 @@ const std::vector<LocalUrlHandler> &LocalUrlHandlers() {
qsl("^settings(/folders|/devices|/language)?$"),
ResolveSettings
},
{
qsl("^test_chat_theme/?\\?(.+)(#|$)"),
ResolveTestChatTheme,
},
{
qsl("^([^\\?]+)(\\?|#|$)"),
HandleUnknown

View File

@@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
constexpr auto AppName = "Telegram Desktop"_cs;
constexpr auto AppFile = "Telegram"_cs;
constexpr auto AppVersion = 3000002;
constexpr auto AppVersionStr = "3.0.2";
constexpr auto AppVersion = 3000003;
constexpr auto AppVersionStr = "3.0.3";
constexpr auto AppBetaVersion = true;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -27,6 +27,8 @@ namespace {
constexpr auto kFirstReloadTimeout = 10 * crl::time(1000);
constexpr auto kReloadTimeout = 3600 * crl::time(1000);
bool IsTestingColors/* = false*/;
} // namespace
CloudTheme CloudTheme::Parse(
@@ -395,12 +397,24 @@ std::optional<ChatTheme> CloudThemes::themeForEmoji(
rpl::producer<std::optional<ChatTheme>> CloudThemes::themeForEmojiValue(
const QString &emoji) {
const auto testing = TestingColors();
if (emoji.isEmpty()) {
return rpl::single<std::optional<ChatTheme>>(std::nullopt);
} else if (auto result = themeForEmoji(emoji)) {
if (testing) {
return rpl::single(
std::move(result)
) | rpl::then(chatThemesUpdated(
) | rpl::map([=] {
return themeForEmoji(emoji);
}) | rpl::filter([](const std::optional<ChatTheme> &theme) {
return theme.has_value();
}));
}
return rpl::single(std::move(result));
}
refreshChatThemes();
const auto limit = testing ? (1 << 20) : 1;
return rpl::single<std::optional<ChatTheme>>(
std::nullopt
) | rpl::then(chatThemesUpdated(
@@ -408,7 +422,112 @@ rpl::producer<std::optional<ChatTheme>> CloudThemes::themeForEmojiValue(
return themeForEmoji(emoji);
}) | rpl::filter([](const std::optional<ChatTheme> &theme) {
return theme.has_value();
}) | rpl::take(1));
}) | rpl::take(limit));
}
bool CloudThemes::TestingColors() {
return IsTestingColors;
}
void CloudThemes::SetTestingColors(bool testing) {
IsTestingColors = testing;
}
QString CloudThemes::PrepareTestingLink(const CloudTheme &theme) {
const auto hex = [](int value) {
return QChar((value < 10) ? ('0' + value) : ('a' + (value - 10)));
};
const auto hex2 = [&](int value) {
return QString() + hex(value / 16) + hex(value % 16);
};
const auto color = [&](const QColor &color) {
return hex2(color.red()) + hex2(color.green()) + hex2(color.blue());
};
const auto colors = [&](const std::vector<QColor> &colors) {
auto list = QStringList();
for (const auto &c : colors) {
list.push_back(color(c));
}
return list.join(",");
};
auto arguments = QStringList();
if (theme.basedOnDark) {
arguments.push_back("dark=1");
}
if (theme.accentColor) {
arguments.push_back("accent=" + color(*theme.accentColor));
}
if (theme.paper && !theme.paper->backgroundColors().empty()) {
arguments.push_back("bg=" + colors(theme.paper->backgroundColors()));
}
if (theme.outgoingAccentColor) {
arguments.push_back("out_accent" + color(*theme.outgoingAccentColor));
}
if (!theme.outgoingMessagesColors.empty()) {
arguments.push_back("out_bg=" + colors(theme.outgoingMessagesColors));
}
return arguments.isEmpty()
? QString()
: ("tg://test_chat_theme?" + arguments.join("&"));
}
std::optional<CloudTheme> CloudThemes::updateThemeFromLink(
const QString &emoji,
const QMap<QString, QString> &params) {
if (!TestingColors()) {
return std::nullopt;
}
const auto i = ranges::find(_chatThemes, emoji, &ChatTheme::emoji);
if (i == end(_chatThemes)) {
return std::nullopt;
}
const auto hex = [](const QString &value) {
return (value.size() != 1)
? std::nullopt
: (value[0] >= 'a' && value[0] <= 'f')
? std::make_optional(10 + int(value[0].unicode() - 'a'))
: (value[0] >= '0' && value[0] <= '9')
? std::make_optional(int(value[0].unicode() - '0'))
: std::nullopt;
};
const auto hex2 = [&](const QString &value) {
const auto first = hex(value.mid(0, 1));
const auto second = hex(value.mid(1, 1));
return (first && second)
? std::make_optional((*first) * 16 + (*second))
: std::nullopt;
};
const auto color = [&](const QString &value) {
const auto red = hex2(value.mid(0, 2));
const auto green = hex2(value.mid(2, 2));
const auto blue = hex2(value.mid(4, 2));
return (red && green && blue)
? std::make_optional(QColor(*red, *green, *blue))
: std::nullopt;
};
const auto colors = [&](const QString &value) {
auto list = value.split(",");
auto result = std::vector<QColor>();
for (const auto &single : list) {
if (const auto c = color(single)) {
result.push_back(*c);
} else {
return std::vector<QColor>();
}
}
return (result.size() > 4) ? std::vector<QColor>() : result;
};
auto &applyTo = params["dark"].isEmpty() ? i->light : i->dark;
applyTo.accentColor = color(params["accent"]);
const auto bg = colors(params["bg"]);
applyTo.paper = (applyTo.paper && !bg.empty())
? std::make_optional(applyTo.paper->withBackgroundColors(bg))
: std::nullopt;
applyTo.outgoingAccentColor = color(params["out_accent"]);
applyTo.outgoingMessagesColors = colors(params["out_bg"]);
_chatThemesUpdates.fire({});
return applyTo;
}
void CloudThemes::parseChatThemes(const QVector<MTPChatTheme> &list) {

View File

@@ -75,6 +75,13 @@ public:
[[nodiscard]] rpl::producer<std::optional<ChatTheme>> themeForEmojiValue(
const QString &emoji);
[[nodiscard]] static bool TestingColors();
static void SetTestingColors(bool testing);
[[nodiscard]] static QString PrepareTestingLink(const CloudTheme &theme);
[[nodiscard]] std::optional<CloudTheme> updateThemeFromLink(
const QString &emoji,
const QMap<QString, QString> &params);
void applyUpdate(const MTPTheme &theme);
void resolve(

View File

@@ -632,6 +632,7 @@ HistoryWidget::HistoryWidget(
| PeerUpdateFlag::Slowmode
| PeerUpdateFlag::BotStartToken
| PeerUpdateFlag::MessagesTTL
| PeerUpdateFlag::ChatThemeEmoji
) | rpl::filter([=](const Data::PeerUpdate &update) {
return (update.peer.get() == _peer);
}) | rpl::map([](const Data::PeerUpdate &update) {
@@ -675,6 +676,31 @@ HistoryWidget::HistoryWidget(
if (flags & PeerUpdateFlag::MessagesTTL) {
checkMessagesTTL();
}
if ((flags & PeerUpdateFlag::ChatThemeEmoji) && _list) {
const auto emoji = _peer->themeEmoji();
if (Data::CloudThemes::TestingColors() && !emoji.isEmpty()) {
_peer->owner().cloudThemes().themeForEmojiValue(
emoji
) | rpl::filter_optional(
) | rpl::take(
1
) | rpl::start_with_next([=](const Data::ChatTheme &theme) {
auto text = QStringList();
const auto push = [&](QString label, const auto &theme) {
using namespace Data;
const auto l = CloudThemes::PrepareTestingLink(theme);
if (!l.isEmpty()) {
text.push_back(label + ": " + l);
}
};
push("Light", theme.light);
push("Dark", theme.dark);
if (!text.isEmpty()) {
_field->setText(text.join("\n\n"));
}
}, _list->lifetime());
}
}
}, lifetime());
rpl::merge(

View File

@@ -15,13 +15,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QProcess>
#include <QtGui/QDesktopServices>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>
#include <giomm.h>
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
namespace Platform {
namespace File {
void UnsafeOpenUrl(const QString &url) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
try {
if (Gio::AppInfo::launch_default_for_uri(url.toStdString())) {
return;
@@ -29,6 +32,7 @@ void UnsafeOpenUrl(const QString &url) {
} catch (const Glib::Error &e) {
LOG(("App Error: %1").arg(QString::fromStdString(e.what())));
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
if (QDesktopServices::openUrl(url)) {
return;
@@ -52,6 +56,7 @@ bool UnsafeShowOpenWith(const QString &filepath) {
}
void UnsafeLaunch(const QString &filepath) {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
try {
if (Gio::AppInfo::launch_default_for_uri(
Glib::filename_to_uri(filepath.toStdString()))) {
@@ -64,6 +69,7 @@ void UnsafeLaunch(const QString &filepath) {
if (UnsafeShowOpenWith(filepath)) {
return;
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
const auto qUrlPath = QUrl::fromLocalFile(filepath);
if (QDesktopServices::openUrl(qUrlPath)) {

View File

@@ -16,8 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtWidgets/QApplication>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>
#include <giomm.h>
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <sys/stat.h>
#include <sys/types.h>
@@ -57,8 +59,10 @@ Launcher::Launcher(int argc, char *argv[])
}
int Launcher::exec() {
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Glib::init();
Gio::init();
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
for (auto i = begin(_arguments), e = end(_arguments); i != e; ++i) {

View File

@@ -9,7 +9,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/openssl_help.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "ui/platform/linux/ui_linux_wayland_integration.h"
#include "platform/linux/linux_desktop_environment.h"
#include "platform/linux/linux_wayland_integration.h"
@@ -24,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/window_controller.h"
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include "base/platform/linux/base_linux_glibmm_helper.h"
#include "base/platform/linux/base_linux_dbus_utilities.h"
#include "base/platform/linux/base_linux_xdp_utilities.h"
#include "platform/linux/linux_xdp_file_dialog.h"
@@ -46,9 +46,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QWindow>
#include <private/qguiapplication_p.h>
#include <jemalloc/jemalloc.h>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>
#include <giomm.h>
#include <jemalloc/jemalloc.h>
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <sys/stat.h>
#include <sys/types.h>
@@ -577,23 +580,14 @@ void psActivateProcess(uint64 pid) {
namespace {
QString GetHomeDir() {
const auto home = QString::fromStdString(Glib::get_home_dir());
if (!home.isEmpty() && !home.endsWith('/')) {
return home + '/';
}
return home;
}
#ifdef __HAIKU__
void HaikuAutostart(bool start) {
const auto home = GetHomeDir();
const auto home = QDir::homePath();
if (home.isEmpty()) {
return;
}
QFile file(home + "config/settings/boot/launch/telegram-desktop");
QFile file(home + "/config/settings/boot/launch/telegram-desktop");
if (start) {
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&file);
@@ -618,9 +612,9 @@ void HaikuAutostart(bool start) {
QString psAppDataPath() {
// Previously we used ~/.TelegramDesktop, so look there first.
// If we find data there, we should still use it.
auto home = GetHomeDir();
auto home = QDir::homePath();
if (!home.isEmpty()) {
auto oldPath = home + qsl(".TelegramDesktop/");
auto oldPath = home + qsl("/.TelegramDesktop/");
auto oldSettingsBase = oldPath + qsl("tdata/settings");
if (QFile::exists(oldSettingsBase + '0')
|| QFile::exists(oldSettingsBase + '1')
@@ -671,18 +665,10 @@ void start() {
qputenv("PULSE_PROP_application.name", AppName.utf8());
qputenv("PULSE_PROP_application.icon_name", GetIconName().toLatin1());
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
Glib::set_prgname(cExeName().toStdString());
Glib::set_application_name(std::string(AppName));
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
char h[33] = { 0 };
hashMd5Hex(d.constData(), d.size(), h);
Webview::WebKit2Gtk::SetServiceName(
kWebviewService.utf16().arg(h).arg("%1").toStdString());
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
#ifdef DESKTOP_APP_USE_PACKAGED_RLOTTIE
g_warning(
"Application has been built with foreign rlottie, "
@@ -695,7 +681,6 @@ void start() {
"this may lead to font issues.");
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
// IBus has changed its socket path several times
// and each change should be synchronized with Qt.
// Moreover, the last time Qt changed the path,
@@ -709,6 +694,15 @@ void start() {
qputenv("IBUS_USE_PORTAL", "1");
}
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#ifndef DESKTOP_APP_DISABLE_WEBKITGTK
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
char h[33] = { 0 };
hashMd5Hex(d.constData(), d.size(), h);
Webview::WebKit2Gtk::SetServiceName(
kWebviewService.utf16().arg(h).arg("%1").toStdString());
#endif // !DESKTOP_APP_DISABLE_WEBKITGTK
}
void finish() {

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwidget.h"
#include "mainwindow.h"
#include "data/data_session.h"
#include "data/data_cloud_themes.h"
#include "main/main_session.h"
#include "main/main_account.h"
#include "main/main_domain.h"
@@ -274,6 +275,11 @@ auto GenerateCodes() {
});
});
});
codes.emplace(qsl("testchatcolors"), [](SessionController *window) {
const auto now = !Data::CloudThemes::TestingColors();
Data::CloudThemes::SetTestingColors(now);
Ui::Toast::Show(now ? "Testing chat theme colors!" : "Not testing..");
});
return codes;
}

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/chat/message_bubble.h"
#include "ui/chat/chat_style.h"
#include "ui/style/style_core_palette.h"
#include "ui/style/style_palette_colorizer.h"
#include <crl/crl_async.h>
#include <QtGui/QGuiApplication>
@@ -247,6 +248,7 @@ void ChatTheme::adjustPalette(const ChatThemeDescriptor &descriptor) {
CountAverageColor(descriptor.bubblesData.colors))
: std::optional<QColor>();
if (bubblesAccent) {
// First set hue/saturation the same for all those colors from accent.
const auto by = *bubblesAccent;
if (!overrideOutBg) {
adjust(p.msgOutBg(), by);
@@ -269,6 +271,18 @@ void ChatTheme::adjustPalette(const ChatThemeDescriptor &descriptor) {
adjust(p.historyOutIconFg(), by);
adjust(p.historyCallArrowOutFg(), by);
adjust(p.historyFileOutIconFg(), by);
// After make msgFileOutBg exact accent and adjust some others.
const auto colorizer = bubblesAccentColorizer(by);
adjust(p.msgOutServiceFg(), colorizer);
adjust(p.msgOutDateFg(), colorizer);
adjust(p.msgFileThumbLinkOutFg(), colorizer);
adjust(p.msgFileOutBg(), colorizer);
adjust(p.msgOutReplyBarColor(), colorizer);
adjust(p.msgWaveformOutActive(), colorizer);
adjust(p.msgWaveformOutInactive(), colorizer);
adjust(p.mediaOutFg(), colorizer);
adjust(p.historyLinkOutFg(), colorizer);
}
auto outBgColors = descriptor.bubblesData.colors;
if (outBgColors.empty()) {
@@ -321,6 +335,22 @@ void ChatTheme::adjustPalette(const ChatThemeDescriptor &descriptor) {
}
}
style::colorizer ChatTheme::bubblesAccentColorizer(
const QColor &accent) const {
const auto color = [](const QColor &value) {
auto hue = 0;
auto saturation = 0;
auto lightness = 0;
value.getHsv(&hue, &saturation, &lightness);
return style::colorizer::Color{ hue, saturation, lightness };
};
return {
.hueThreshold = 255,
.was = color(_palette->msgFileOutBg()->c),
.now = color(accent),
};
}
void ChatTheme::set(const style::color &my, const QColor &color) {
auto r = 0, g = 0, b = 0, a = 0;
color.getRgb(&r, &g, &b, &a);
@@ -331,6 +361,12 @@ void ChatTheme::adjust(const style::color &my, const QColor &by) {
set(my, ThemeAdjustedColor(my->c, by));
}
void ChatTheme::adjust(const style::color &my, const style::colorizer &by) {
if (const auto adjusted = style::colorize(my->c, by)) {
set(my, *adjusted);
}
}
void ChatTheme::setBackground(ChatThemeBackground &&background) {
_mutableBackground = std::move(background);
_backgroundState = {};

View File

@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace style {
class palette;
struct colorizer;
} // namespace style
namespace Ui {
@@ -150,9 +151,12 @@ private:
[[nodiscard]] bool readyForBackgroundRotation() const;
void generateNextBackgroundRotation();
[[nodiscard]] style::colorizer bubblesAccentColorizer(
const QColor &accent) const;
void adjustPalette(const ChatThemeDescriptor &descriptor);
void set(const style::color &my, const QColor &color);
void adjust(const style::color &my, const QColor &by);
void adjust(const style::color &my, const style::colorizer &by);
uint64 _id = 0;
std::unique_ptr<style::palette> _palette;

View File

@@ -1399,13 +1399,14 @@ auto SessionController::cachedChatThemeValue(
if (i == end(_customChatThemes)) {
cacheChatTheme(data);
}
const auto limit = Data::CloudThemes::TestingColors() ? (1 << 20) : 1;
using namespace rpl::mappers;
return rpl::single(
_defaultChatTheme
) | rpl::then(_cachedThemesStream.events(
) | rpl::filter([=](const std::shared_ptr<Ui::ChatTheme> &theme) {
return (theme->key() == key);
}) | rpl::take(1));
}) | rpl::take(limit));
}
void SessionController::setChatStyleTheme(
@@ -1417,6 +1418,10 @@ void SessionController::setChatStyleTheme(
_chatStyle->apply(theme.get());
}
void SessionController::clearCachedChatThemes() {
_customChatThemes.clear();
}
void SessionController::pushDefaultChatBackground() {
const auto background = Theme::Background();
const auto &paper = background->paper();

View File

@@ -407,6 +407,7 @@ public:
const Data::CloudTheme &data)
-> rpl::producer<std::shared_ptr<Ui::ChatTheme>>;
void setChatStyleTheme(const std::shared_ptr<Ui::ChatTheme> &theme);
void clearCachedChatThemes();
struct PaintContextArgs {
not_null<Ui::ChatTheme*> theme;

View File

@@ -16,7 +16,7 @@ if [ ! -d "$FullScriptPath/../../../../DesktopPrivate" ]; then
fi
Run () {
scl enable devtoolset-9 -- "$@"
scl enable llvm-toolset-7.0 -- scl enable devtoolset-9 -- "$@"
}
HomePath="$FullScriptPath/../.."

View File

@@ -19,7 +19,8 @@ RUN yum -y install git cmake3 meson ninja-build autoconf automake libtool \
pulseaudio-libs-devel mesa-libGL-devel mesa-libEGL-devel libudev-devel \
webkitgtk4-devel pkgconfig bison yasm file which xorg-x11-util-macros \
devtoolset-9-make devtoolset-9-gcc devtoolset-9-gcc-c++ \
devtoolset-9-binutils
devtoolset-9-binutils llvm-toolset-7.0 llvm-toolset-7.0-clang-devel \
llvm-toolset-7.0-llvm-devel
SHELL [ "scl", "enable", "devtoolset-9", "--", "bash", "-c" ]
RUN ln -s cmake3 /usr/bin/cmake
@@ -28,7 +29,7 @@ ENV LibrariesPath /usr/src/Libraries
WORKDIR $LibrariesPath
FROM builder AS patches
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout 1a51e396bb
RUN git clone $GIT/desktop-app/patches.git && cd patches && git checkout 3e8b68dfdf
FROM builder AS extra-cmake-modules

View File

@@ -1,10 +1,10 @@
#!/bin/bash
#!/usr/bin/scl enable llvm-toolset-7.0 -- scl enable devtoolset-9 -- bash
cd Telegram
scl enable devtoolset-9 -- ./configure.sh "$@"
./configure.sh "$@"
if [ -n "$DEBUG" ]; then
scl enable devtoolset-9 -- cmake3 --build ../out/Debug -j$(nproc)
cmake3 --build ../out/Debug -j$(nproc)
else
scl enable devtoolset-9 -- cmake3 --build ../out/Release -j$(nproc)
cmake3 --build ../out/Release -j$(nproc)
fi

View File

@@ -15,7 +15,7 @@ fi
Command="$1"
if [ "$Command" == "" ]; then
Command="scl enable devtoolset-9 -- bash"
Command="scl enable llvm-toolset-7.0 -- scl enable devtoolset-9 -- bash"
fi
docker run -it --rm --cpus=8 --memory=22g -v $HOME/Telegram/DesktopPrivate:/usr/src/DesktopPrivate -v $HOME/Telegram/tdesktop:/usr/src/tdesktop tdesktop:centos_env $Command

View File

@@ -274,7 +274,7 @@ def runStages():
stage('patches', """
git clone https://github.com/desktop-app/patches.git
cd patches
git checkout 1e7de78121
git checkout 3cd971a0ed
""")
stage('depot_tools', """

View File

@@ -1,7 +1,7 @@
AppVersion 3000002
AppVersion 3000003
AppVersionStrMajor 3.0
AppVersionStrSmall 3.0.2
AppVersionStr 3.0.2
AppVersionStrSmall 3.0.3
AppVersionStr 3.0.3
BetaChannel 1
AlphaVersion 0
AppVersionOriginal 3.0.2.beta
AppVersionOriginal 3.0.3.beta

View File

@@ -1,3 +1,7 @@
3.0.3 beta (12.09.21)
- Try fixing crashes in allocator on Linux.
3.0.2 beta (10.09.21)
- Check who've seen your message in small groups from the context menu.

2
cmake

Submodule cmake updated: 750861b4ab...2827dd851e

View File

@@ -85,6 +85,7 @@ parts:
build-environment:
- LD_LIBRARY_PATH: $SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH
build-packages:
- clang
- python
- libasound2-dev
- libglib2.0-dev