diff --git a/Telegram/SourceFiles/_other/packer.cpp b/Telegram/SourceFiles/_other/packer.cpp index f238038a5..156ba726a 100644 --- a/Telegram/SourceFiles/_other/packer.cpp +++ b/Telegram/SourceFiles/_other/packer.cpp @@ -281,7 +281,7 @@ int main(int argc, char *argv[]) cout << "Compression start, size: " << resultSize << "\n"; QByteArray compressed, resultCheck; -#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win +#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header compressed.resize(hSize + resultSize + 1024 * 1024); // rsa signature + sha1 + lzma props + max compressed size diff --git a/Telegram/SourceFiles/_other/packer.h b/Telegram/SourceFiles/_other/packer.h index d099ef0e3..4e5fbfc7a 100644 --- a/Telegram/SourceFiles/_other/packer.h +++ b/Telegram/SourceFiles/_other/packer.h @@ -27,7 +27,7 @@ extern "C" { #include } // extern "C" -#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win +#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win #include #else #include diff --git a/Telegram/SourceFiles/core/crash_reports.cpp b/Telegram/SourceFiles/core/crash_reports.cpp index efcad014f..6f4e2d466 100644 --- a/Telegram/SourceFiles/core/crash_reports.cpp +++ b/Telegram/SourceFiles/core/crash_reports.cpp @@ -15,7 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS #ifdef Q_OS_WIN #include @@ -48,7 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #endif // Q_OS_MAC #endif // Q_OS_WIN -#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS namespace CrashReports { namespace { @@ -59,7 +59,7 @@ using AnnotationRefs = std::map; Annotations ProcessAnnotations; AnnotationRefs ProcessAnnotationRefs; -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS QString ReportPath; FILE *ReportFile = nullptr; @@ -290,7 +290,7 @@ bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, } #endif // !Q_OS_MAC || MAC_USE_BREAKPAD -#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } // namespace @@ -314,7 +314,7 @@ QString PlatformString() { } void StartCatching() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData(); ProcessAnnotations["Version"] = (cAlphaVersion() @@ -380,21 +380,21 @@ void StartCatching() { -1 ); #endif // else for Q_OS_WIN || Q_OS_MAC -#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } void FinishCatching() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS #if !defined Q_OS_MAC || defined MAC_USE_BREAKPAD delete base::take(BreakpadExceptionHandler); #endif // !Q_OS_MAC || MAC_USE_BREAKPAD -#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } StartResult Start() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS ReportPath = cWorkingDir() + u"tdata/working"_q; #ifdef Q_OS_WIN @@ -420,12 +420,12 @@ StartResult Start() { return lastdump; } -#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS return Restart(); } Status Restart() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS if (ReportFile) { return Started; } @@ -470,13 +470,13 @@ Status Restart() { LOG(("FATAL: Could not open '%1' for writing!").arg(ReportPath)); return CantOpen; -#else // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#else // !TDESKTOP_DISABLE_CRASH_REPORTS return Started; -#endif // else for !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // else for !TDESKTOP_DISABLE_CRASH_REPORTS } void Finish() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS FinishCatching(); if (ReportFile) { @@ -489,7 +489,7 @@ void Finish() { unlink(ReportPath.toUtf8().constData()); #endif // else for Q_OS_WIN } -#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } void SetAnnotation(const std::string &key, const QString &value) { @@ -539,7 +539,7 @@ void SetAnnotationRef(const std::string &key, const QString *valuePtr) { } } -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS dump::~dump() { if (ReportFile) { @@ -604,6 +604,6 @@ const dump &operator<<(const dump &stream, double num) { return stream; } -#endif // DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // TDESKTOP_DISABLE_CRASH_REPORTS } // namespace CrashReports diff --git a/Telegram/SourceFiles/core/crash_reports.h b/Telegram/SourceFiles/core/crash_reports.h index 6a1f0e1d4..bfe09e240 100644 --- a/Telegram/SourceFiles/core/crash_reports.h +++ b/Telegram/SourceFiles/core/crash_reports.h @@ -11,7 +11,7 @@ namespace CrashReports { QString PlatformString(); -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS struct dump { ~dump(); @@ -24,7 +24,7 @@ const dump &operator<<(const dump &stream, unsigned long num); const dump &operator<<(const dump &stream, unsigned long long num); const dump &operator<<(const dump &stream, double num); -#endif // DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // TDESKTOP_DISABLE_CRASH_REPORTS enum Status { CantOpen, diff --git a/Telegram/SourceFiles/core/update_checker.cpp b/Telegram/SourceFiles/core/update_checker.cpp index f80fd3eb2..43cbbdaeb 100644 --- a/Telegram/SourceFiles/core/update_checker.cpp +++ b/Telegram/SourceFiles/core/update_checker.cpp @@ -42,11 +42,11 @@ extern "C" { } // extern "C" #ifndef TDESKTOP_DISABLE_AUTOUPDATE -#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win +#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win #include -#else // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED +#else // Q_OS_WIN && !TDESKTOP_USE_PACKAGED #include -#endif // else of Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED +#endif // else of Q_OS_WIN && !TDESKTOP_USE_PACKAGED #endif // !TDESKTOP_DISABLE_AUTOUPDATE #ifndef Q_OS_WIN @@ -275,11 +275,11 @@ bool UnpackUpdate(const QString &filepath) { return false; } -#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win +#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win const int32 hSigLen = 128, hShaLen = 20, hPropsLen = LZMA_PROPS_SIZE, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hPropsLen + hOriginalSizeLen; // header -#else // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED +#else // Q_OS_WIN && !TDESKTOP_USE_PACKAGED const int32 hSigLen = 128, hShaLen = 20, hPropsLen = 0, hOriginalSizeLen = sizeof(int32), hSize = hSigLen + hShaLen + hOriginalSizeLen; // header -#endif // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED +#endif // Q_OS_WIN && !TDESKTOP_USE_PACKAGED QByteArray compressed = input.readAll(); int32 compressedLen = compressed.size() - hSize; @@ -350,14 +350,14 @@ bool UnpackUpdate(const QString &filepath) { uncompressed.resize(uncompressedLen); size_t resultLen = uncompressed.size(); -#if defined Q_OS_WIN && !defined DESKTOP_APP_USE_PACKAGED // use Lzma SDK for win +#if defined Q_OS_WIN && !defined TDESKTOP_USE_PACKAGED // use Lzma SDK for win SizeT srcLen = compressedLen; int uncompressRes = LzmaUncompress((uchar*)uncompressed.data(), &resultLen, (const uchar*)(compressed.constData() + hSize), &srcLen, (const uchar*)(compressed.constData() + hSigLen + hShaLen), LZMA_PROPS_SIZE); if (uncompressRes != SZ_OK) { LOG(("Update Error: could not uncompress lzma, code: %1").arg(uncompressRes)); return false; } -#else // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED +#else // Q_OS_WIN && !TDESKTOP_USE_PACKAGED lzma_stream stream = LZMA_STREAM_INIT; lzma_ret ret = lzma_stream_decoder(&stream, UINT64_MAX, LZMA_CONCATENATED); @@ -400,7 +400,7 @@ bool UnpackUpdate(const QString &filepath) { LOG(("Error in decompression: %1 (error code %2)").arg(msg).arg(res)); return false; } -#endif // Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED +#endif // Q_OS_WIN && !TDESKTOP_USE_PACKAGED tempDir.mkdir(tempDir.absolutePath()); diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp index 9e1d0a0d5..b59bf86ba 100644 --- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp +++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp @@ -10,10 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/algorithm.h" #include "logs.h" -#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC +#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC #include "base/platform/linux/base_linux_library.h" #include -#endif // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC +#endif // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC #include @@ -90,7 +90,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) { #endif // LIB_FFMPEG_USE_QT_PRIVATE_API } -#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC +#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC [[nodiscard]] auto CheckHwLibs() { auto list = std::deque{ AV_PIX_FMT_CUDA, @@ -116,7 +116,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) { } return list; } -#endif // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC +#endif // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC [[nodiscard]] bool InitHw(AVCodecContext *context, AVHWDeviceType type) { AVCodecContext *parent = static_cast(context->opaque); @@ -158,9 +158,9 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) { } return false; }; -#if !defined DESKTOP_APP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC +#if !defined TDESKTOP_USE_PACKAGED && !defined Q_OS_WIN && !defined Q_OS_MAC static const auto list = CheckHwLibs(); -#else // !DESKTOP_APP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC +#else // !TDESKTOP_USE_PACKAGED && !Q_OS_WIN && !Q_OS_MAC const auto list = std::array{ #ifdef Q_OS_WIN AV_PIX_FMT_D3D11, @@ -174,7 +174,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) { AV_PIX_FMT_CUDA, #endif // Q_OS_WIN || Q_OS_MAC }; -#endif // DESKTOP_APP_USE_PACKAGED || Q_OS_WIN || Q_OS_MAC +#endif // TDESKTOP_USE_PACKAGED || Q_OS_WIN || Q_OS_MAC for (const auto format : list) { if (!has(format)) { continue; diff --git a/Telegram/SourceFiles/platform/mac/specific_mac.mm b/Telegram/SourceFiles/platform/mac/specific_mac.mm index d795a1c24..8a7e3c713 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac.mm @@ -155,10 +155,10 @@ std::optional IsDarkMode() { #endif // Qt < 6.5.0 void WriteCrashDumpDetails() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS double v = objc_appkitVersion(); CrashReports::dump() << "OS-Version: " << v; -#endif // DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // TDESKTOP_DISABLE_CRASH_REPORTS } // I do check for availability, just not in the exact way clang is content with diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index 056741ffb..290f44495 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -482,7 +482,7 @@ bool AutostartSkip() { } void WriteCrashDumpDetails() { -#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS PROCESS_MEMORY_COUNTERS data = { 0 }; if (Dlls::GetProcessMemoryInfo && Dlls::GetProcessMemoryInfo( @@ -503,7 +503,7 @@ void WriteCrashDumpDetails() { << (data.PagefileUsage / mb) << " MB (current)\n"; } -#endif // DESKTOP_APP_DISABLE_CRASH_REPORTS +#endif // TDESKTOP_DISABLE_CRASH_REPORTS } void SetWindowPriority(not_null window, uint32 priority) { diff --git a/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp b/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp index 2ad527ce2..69c38d049 100644 --- a/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp +++ b/Telegram/SourceFiles/ui/controls/window_outdated_bar.cpp @@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { namespace { -#ifdef DESKTOP_APP_SPECIAL_TARGET constexpr auto kMinimalSkip = 7; constexpr auto kSoonSkip = 30; constexpr auto kNowSkip = 90; @@ -148,14 +147,12 @@ void Closed(const QString &workingDir) { reinterpret_cast(&value), sizeof(qint32))); } -#endif // DESKTOP_APP_SPECIAL_TARGET } // namespace object_ptr CreateOutdatedBar( not_null parent, const QString &workingPath) { -#ifdef DESKTOP_APP_SPECIAL_TARGET const auto date = Platform::WhenSystemBecomesOutdated(); if (date.isNull()) { return { nullptr }; @@ -178,9 +175,6 @@ object_ptr CreateOutdatedBar( wrap->show(anim::type::instant); return result; -#else // DESKTOP_APP_SPECIAL_TARGET - return { nullptr }; -#endif // DESKTOP_APP_SPECIAL_TARGET } } // namespace Ui diff --git a/Telegram/SourceFiles/ui/controls/window_outdated_bar_dummy.cpp b/Telegram/SourceFiles/ui/controls/window_outdated_bar_dummy.cpp new file mode 100644 index 000000000..a584271df --- /dev/null +++ b/Telegram/SourceFiles/ui/controls/window_outdated_bar_dummy.cpp @@ -0,0 +1,18 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "ui/controls/window_outdated_bar.h" + +namespace Ui { + +object_ptr CreateOutdatedBar( + not_null parent, + const QString &workingPath) { + return { nullptr }; +} + +} // namespace Ui diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index d75465473..d7816d5d0 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -261,6 +261,7 @@ PRIVATE ui/controls/who_reacted_context_action.cpp ui/controls/who_reacted_context_action.h ui/controls/window_outdated_bar.cpp + ui/controls/window_outdated_bar_dummy.cpp ui/controls/window_outdated_bar.h ui/effects/fireworks_animation.cpp ui/effects/fireworks_animation.h @@ -331,6 +332,16 @@ PRIVATE ui/ui_pch.h ) +if (DESKTOP_APP_SPECIAL_TARGET) + remove_target_sources(td_ui ${src_loc} + ui/controls/window_outdated_bar_dummy.cpp + ) +else() + remove_target_sources(td_ui ${src_loc} + ui/controls/window_outdated_bar.cpp + ) +endif() + target_include_directories(td_ui PUBLIC ${src_loc} diff --git a/Telegram/cmake/telegram_options.cmake b/Telegram/cmake/telegram_options.cmake index a5a6d9405..18fa73671 100644 --- a/Telegram/cmake/telegram_options.cmake +++ b/Telegram/cmake/telegram_options.cmake @@ -40,6 +40,14 @@ if (DESKTOP_APP_DISABLE_AUTOUPDATE) target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_AUTOUPDATE) endif() +if (DESKTOP_APP_DISABLE_CRASH_REPORTS) + target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_CRASH_REPORTS) +endif() + +if (DESKTOP_APP_USE_PACKAGED) + target_compile_definitions(Telegram PRIVATE TDESKTOP_USE_PACKAGED) +endif() + if (DESKTOP_APP_SPECIAL_TARGET) target_compile_definitions(Telegram PRIVATE TDESKTOP_ALLOW_CLOSED_ALPHA) endif() diff --git a/Telegram/lib_base b/Telegram/lib_base index 28db382a7..6de11e6ab 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 28db382a7471854fea4d41133becdcc6c161d907 +Subproject commit 6de11e6ab705f27158f338e3e17c8b0767750721 diff --git a/Telegram/lib_lottie b/Telegram/lib_lottie index e240a2de8..1a700e5a0 160000 --- a/Telegram/lib_lottie +++ b/Telegram/lib_lottie @@ -1 +1 @@ -Subproject commit e240a2de8e67c806894caf04ee32797e75c6ea38 +Subproject commit 1a700e5a0d7c3e2f617530354ff2a47c5c72bb4a diff --git a/Telegram/lib_ui b/Telegram/lib_ui index a33bd4e0a..d3ac9dcf9 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit a33bd4e0a590fb08f0055b6e859ce84db11eb843 +Subproject commit d3ac9dcf97494aa1acfbfd8b6c0a3f57950e4962 diff --git a/cmake b/cmake index 18d4aae26..0ae4e78a1 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 18d4aae269c51d5b24e96957abbdb389a1270122 +Subproject commit 0ae4e78a12d7fdea687ca52647465b9cf9ef95ee