Change #if-ery to be more in line with cmake logic (LINUX = NOT WIN32 AND NOT APPLE)

This commit is contained in:
Ilya Fedin 2023-09-15 09:51:42 +04:00 committed by John Preston
parent c12743925e
commit 7906be37b6
19 changed files with 93 additions and 93 deletions

View File

@ -267,7 +267,7 @@ int main(int argc, char *argv[])
}
QByteArray inner = f.readAll();
stream << name << quint32(inner.size()) << inner;
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
stream << (QFileInfo(fullName).isExecutable() ? true : false);
#endif
}
@ -496,7 +496,7 @@ int main(int argc, char *argv[])
QString outName((targetwin64 ? QString("tx64upd%1") : QString("tupdate%1")).arg(AlphaVersion ? AlphaVersion : version));
#elif defined Q_OS_MAC
QString outName((targetarmac ? QString("tarmacupd%1") : QString("tmacupd%1")).arg(AlphaVersion ? AlphaVersion : version));
#elif defined Q_OS_UNIX
#else
QString outName(QString("tlinuxupd%1").arg(AlphaVersion ? AlphaVersion : version));
#else
#error Unknown platform!

View File

@ -25,7 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <client/windows/handler/exception_handler.h>
#pragma warning(pop)
#elif defined Q_OS_UNIX // Q_OS_WIN
#else // Q_OS_WIN
#include <execinfo.h>
#include <sys/syscall.h>
@ -197,13 +197,15 @@ const int HandledSignals[] = {
SIGABRT,
SIGFPE,
SIGILL,
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
SIGBUS,
SIGTRAP,
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
};
#ifdef Q_OS_UNIX
#ifdef Q_OS_WIN
void SignalHandler(int signum) {
#else // Q_OS_WIN
struct sigaction OldSigActions[32]/* = { 0 }*/;
void RestoreSignalHandlers() {
@ -229,9 +231,7 @@ void InvokeOldSignalHandler(int signum, siginfo_t *info, void *ucontext) {
void SignalHandler(int signum, siginfo_t *info, void *ucontext) {
RestoreSignalHandlers();
#else // Q_OS_UNIX
void SignalHandler(int signum) {
#endif // else for Q_OS_UNIX
#endif // else for Q_OS_WIN
const char* name = 0;
switch (signum) {
@ -253,9 +253,9 @@ void SignalHandler(int signum) {
ReportingThreadId = nullptr;
}
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
InvokeOldSignalHandler(signum, info, ucontext);
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
}
bool SetSignalHandlers = true;
@ -267,9 +267,9 @@ google_breakpad::ExceptionHandler* BreakpadExceptionHandler = 0;
bool DumpCallback(const wchar_t* _dump_dir, const wchar_t* _minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool success)
#elif defined Q_OS_MAC // Q_OS_WIN
bool DumpCallback(const char* _dump_dir, const char* _minidump_id, void *context, bool success)
#elif defined Q_OS_UNIX // Q_OS_MAC
#else // Q_OS_MAC
bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, bool success)
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
{
if (CrashLogged) return success;
CrashLogged = true;
@ -370,7 +370,7 @@ void StartCatching() {
false)) { // asynchronous_start
}
#endif // else for MAC_USE_BREAKPAD
#elif defined Q_OS_UNIX
#else
BreakpadExceptionHandler = new google_breakpad::ExceptionHandler(
google_breakpad::MinidumpDescriptor(QFile::encodeName(dumpspath).toStdString()),
/*FilterCallback*/ 0,
@ -379,7 +379,7 @@ void StartCatching() {
true,
-1
);
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
#endif // !DESKTOP_APP_DISABLE_CRASH_REPORTS
}

View File

@ -49,9 +49,9 @@ extern "C" {
#endif // else of Q_OS_WIN && !DESKTOP_APP_USE_PACKAGED
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
#include <unistd.h>
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
namespace Core {
namespace {
@ -448,9 +448,9 @@ bool UnpackUpdate(const QString &filepath) {
bool executable = false;
stream >> relativeName >> fileSize >> fileInnerData;
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
stream >> executable;
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
if (stream.status() != QDataStream::Ok) {
LOG(("Update Error: cant read file from downloaded stream, status: %1").arg(stream.status()));
return false;
@ -1554,10 +1554,10 @@ bool checkReadyUpdate() {
#elif defined Q_OS_MAC // Q_OS_WIN
QString curUpdater = (cExeDir() + cExeName() + u"/Contents/Frameworks/Updater"_q);
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Telegram.app/Contents/Frameworks/Updater"_q);
#elif defined Q_OS_UNIX // Q_OS_MAC
#else // Q_OS_MAC
QString curUpdater = (cExeDir() + u"Updater"_q);
QFileInfo updater(cWorkingDir() + u"tupdates/temp/Updater"_q);
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
if (!updater.exists()) {
QFileInfo current(curUpdater);
if (!current.exists()) {
@ -1591,7 +1591,7 @@ bool checkReadyUpdate() {
ClearAll();
return false;
}
#elif defined Q_OS_UNIX // Q_OS_MAC
#else // Q_OS_MAC
// if the files in the directory are owned by user, while the directory is not,
// update will still fail since it's not possible to remove files
if (QFile::exists(curUpdater)
@ -1619,7 +1619,7 @@ bool checkReadyUpdate() {
return false;
}
}
#endif // Q_OS_UNIX
#endif // else for Q_OS_WIN || Q_OS_MAC
#ifdef Q_OS_MAC
base::Platform::RemoveQuarantine(QFileInfo(curUpdater).absolutePath());

View File

@ -159,14 +159,7 @@ wv xm xml ym yuv").split(' ');
bool IsExecutableName(const QString &filepath) {
static const auto kExtensions = [] {
const auto joined =
#ifdef Q_OS_MAC
u"\
applescript action app bin command csh osx workflow terminal url caction \
mpkg pkg scpt scptd xhtm webarchive"_q;
#elif defined Q_OS_UNIX // Q_OS_MAC
u"bin csh deb desktop ksh out pet pkg pup rpm run sh shar \
slp zsh"_q;
#else // Q_OS_MAC || Q_OS_UNIX
#ifdef Q_OS_WIN
u"\
ad ade adp app application appref-ms asp asx bas bat bin cab cdxml cer cfg \
chi chm cmd cnt com cpl crt csh der diagcab dll drv eml exe fon fxp gadget \
@ -179,7 +172,14 @@ psd1 psm1 pssc pst py py3 pyc pyd pyi pyo pyw pywz pyz rb reg rgs scf scr \
sct search-ms settingcontent-ms sh shb shs slk sys t tmp u3p url vb vbe vbp \
vbs vbscript vdx vsmacros vsd vsdm vsdx vss vssm vssx vst vstm vstx vsw vsx \
vtx website ws wsc wsf wsh xbap xll xnk xs"_q;
#endif // !Q_OS_MAC && !Q_OS_UNIX
#elif defined Q_OS_MAC // Q_OS_MAC
u"\
applescript action app bin command csh osx workflow terminal url caction \
mpkg pkg scpt scptd xhtm webarchive"_q;
#else // Q_OS_WIN || Q_OS_MAC
u"bin csh deb desktop ksh out pet pkg pup rpm run sh shar \
slp zsh"_q;
#endif // !Q_OS_WIN && !Q_OS_MAC
const auto list = joined.split(' ');
return base::flat_set<QString>(list.begin(), list.end());
}();

View File

@ -560,7 +560,7 @@ void writeDebug(const QString &v) {
//OutputDebugString(reinterpret_cast<const wchar_t *>(msg.utf16()));
#elif defined Q_OS_MAC
//objc_outputDebugString(msg);
#elif defined Q_OS_UNIX && defined _DEBUG
#elif defined _DEBUG
//std::cout << msg.toUtf8().constData();
#endif
}

View File

@ -43,10 +43,10 @@ bool Get(
// Platform dependent implementations.
#ifdef Q_OS_MAC
#include "platform/mac/file_utilities_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/file_utilities_linux.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#if defined Q_OS_WINRT || defined Q_OS_WIN
#include "platform/win/file_utilities_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WINRT || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
#include "platform/mac/file_utilities_mac.h"
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
#include "platform/linux/file_utilities_linux.h"
#endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC

View File

@ -7,13 +7,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "platform/platform_integration.h"
#ifdef Q_OS_MAC
#include "platform/mac/integration_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/integration_linux.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#if defined Q_OS_WINRT || defined Q_OS_WIN
#include "platform/win/integration_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WINRT || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
#include "platform/mac/integration_mac.h"
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
#include "platform/linux/integration_linux.h"
#endif // else Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
namespace Platform {
namespace {

View File

@ -21,10 +21,10 @@ namespace Platform {
// Platform dependent implementations.
#ifdef Q_OS_MAC
#include "platform/mac/launcher_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/launcher_linux.h"
#elif defined Q_OS_WINRT || defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#if defined Q_OS_WINRT || defined Q_OS_WIN
#include "platform/win/launcher_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WINRT || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
#include "platform/mac/launcher_mac.h"
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
#include "platform/linux/launcher_linux.h"
#endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC

View File

@ -17,10 +17,10 @@ class MainWindow;
// Platform dependent implementations.
#ifdef Q_OS_MAC
#include "platform/mac/main_window_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/main_window_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#ifdef Q_OS_WIN
#include "platform/win/main_window_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/main_window_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/main_window_linux.h"
#endif // else Q_OS_WIN || Q_OS_MAC

View File

@ -27,10 +27,10 @@ void Create(Window::Notifications::System *system);
// Platform dependent implementations.
#ifdef Q_OS_MAC
#include "platform/mac/notifications_manager_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/notifications_manager_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#ifdef Q_OS_WIN
#include "platform/win/notifications_manager_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_MAC
#include "platform/mac/notifications_manager_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/notifications_manager_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -95,10 +95,10 @@ private:
// Platform dependent implementations.
#ifdef Q_OS_MAC
#include "platform/mac/overlay_widget_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/overlay_widget_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#ifdef Q_OS_WIN
#include "platform/win/overlay_widget_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/overlay_widget_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/overlay_widget_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -63,10 +63,10 @@ void finish();
} // namespace ThirdParty
} // namespace Platform
#ifdef Q_OS_MAC
#include "platform/mac/specific_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/specific_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#ifdef Q_OS_WIN
#include "platform/win/specific_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/specific_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/specific_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -15,10 +15,10 @@ class Tray;
// Platform dependent implementations.
#ifdef Q_OS_MAC
#include "platform/mac/tray_mac.h"
#elif defined Q_OS_UNIX // Q_OS_MAC
#include "platform/linux/tray_linux.h"
#elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX
#ifdef Q_OS_WIN
#include "platform/win/tray_win.h"
#endif // Q_OS_MAC || Q_OS_UNIX || Q_OS_WIN
#elif defined Q_OS_MAC // Q_OS_WIN
#include "platform/mac/tray_mac.h"
#else // Q_OS_WIN || Q_OS_MAC
#include "platform/linux/tray_linux.h"
#endif // else for Q_OS_WIN || Q_OS_MAC

View File

@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_specific.h"
#include "platform/platform_notifications_manager.h"
#include "base/platform/base_platform_info.h"
#include "base/call_delayed.h"
#include "mainwindow.h"
#include "core/application.h"
#include "main/main_session.h"
@ -49,7 +50,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_dialogs.h"
#include <QSvgRenderer>
#include <QTimer>
namespace Settings {
namespace {
@ -675,11 +675,11 @@ void NotificationsCount::SampleWidget::destroyDelayed() {
_deleted = true;
// Ubuntu has a lag if deleteLater() called immediately.
#if defined Q_OS_UNIX && !defined Q_OS_MAC
QTimer::singleShot(1000, [this] { delete this; });
#else // Q_OS_UNIX && !Q_OS_MAC
deleteLater();
#endif // Q_OS_UNIX && !Q_OS_MAC
if constexpr (Platform::IsLinux()) {
base::call_delayed(1000, this, [this] { delete this; });
} else {
deleteLater();
}
}
class NotifyPreview final {

View File

@ -76,9 +76,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QOpenGLWidget>
// Fix Google Breakpad build for Mac App Store and Linux version
#ifdef Q_OS_UNIX
#ifndef Q_OS_WIN
#define __STDC_FORMAT_MACROS
#endif // Q_OS_UNIX
#endif // !Q_OS_WIN
// Remove 'small' macro definition.
#ifdef Q_OS_WIN

@ -1 +1 @@
Subproject commit 07d3c631d45f2ce50e8373dc934827350ed20758
Subproject commit ed2134a980be19258b2e7c557367c12b94fda35d

@ -1 +1 @@
Subproject commit dfc42b20ce602b105e5400e03eed626fd5bab7df
Subproject commit 135cb95b1606b9051b3a150a99b9db9c20bb1c11

@ -1 +1 @@
Subproject commit 839609369d04615475cb1518636de3619106a917
Subproject commit 1dfd1c186dd67e8de5f0721e6fae487a05f3ea94

@ -1 +1 @@
Subproject commit 8f7fe24ac49e5644749770f54e81fb5290c354d5
Subproject commit 8d005bc820ac2653d15c07d974ede1e17a6ce0fa