mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Move system versions to platform/platform_info.
This commit is contained in:
35
Telegram/SourceFiles/platform/linux/info_linux.cpp
Normal file
35
Telegram/SourceFiles/platform/linux/info_linux.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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 "platform/linux/info_linux.h"
|
||||
|
||||
namespace Platform {
|
||||
|
||||
QString DeviceModelPretty() {
|
||||
#ifdef Q_OS_LINUX64
|
||||
return "PC 64bit";
|
||||
#else // Q_OS_LINUX64
|
||||
return "PC 32bit";
|
||||
#endif // Q_OS_LINUX64
|
||||
}
|
||||
|
||||
QString SystemVersionPretty() {
|
||||
const auto result = getenv("XDG_CURRENT_DESKTOP");
|
||||
const auto value = result ? QString::fromLatin1(result) : QString();
|
||||
const auto list = value.split(':', QString::SkipEmptyParts);
|
||||
return list.isEmpty() ? "Linux" : "Linux " + list[0];
|
||||
}
|
||||
|
||||
QString SystemCountry() {
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString SystemLanguage() {
|
||||
return QString();
|
||||
}
|
||||
|
||||
} // namespace Platform
|
53
Telegram/SourceFiles/platform/linux/info_linux.h
Normal file
53
Telegram/SourceFiles/platform/linux/info_linux.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Platform {
|
||||
|
||||
inline constexpr bool IsLinux() {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline constexpr bool IsLinux32Bit() {
|
||||
#ifdef Q_OS_LINUX32
|
||||
return true;
|
||||
#else // Q_OS_LINUX32
|
||||
return false;
|
||||
#endif // Q_OS_LINUX32
|
||||
}
|
||||
|
||||
inline constexpr bool IsLinux64Bit() {
|
||||
#ifdef Q_OS_LINUX64
|
||||
return true;
|
||||
#else // Q_OS_LINUX64
|
||||
return false;
|
||||
#endif // Q_OS_LINUX64
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
} // namespace Platform
|
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "platform/linux/launcher_linux.h"
|
||||
|
||||
#include "platform/platform_info.h"
|
||||
#include "core/crash_reports.h"
|
||||
#include "core/update_checker.h"
|
||||
|
||||
@@ -39,25 +40,10 @@ private:
|
||||
|
||||
};
|
||||
|
||||
QString DeviceModel() {
|
||||
#ifdef Q_OS_LINUX64
|
||||
return "PC 64bit";
|
||||
#else // Q_OS_LINUX64
|
||||
return "PC 32bit";
|
||||
#endif // Q_OS_LINUX64
|
||||
}
|
||||
|
||||
QString SystemVersion() {
|
||||
const auto result = getenv("XDG_CURRENT_DESKTOP");
|
||||
const auto value = result ? QString::fromLatin1(result) : QString();
|
||||
const auto list = value.split(':', QString::SkipEmptyParts);
|
||||
return list.isEmpty() ? "Linux" : "Linux " + list[0];
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Launcher::Launcher(int argc, char *argv[])
|
||||
: Core::Launcher(argc, argv, DeviceModel(), SystemVersion()) {
|
||||
: Core::Launcher(argc, argv, DeviceModelPretty(), SystemVersionPretty()) {
|
||||
}
|
||||
|
||||
bool Launcher::launchUpdater(UpdaterLaunch action) {
|
||||
|
@@ -283,14 +283,6 @@ bool TranslucentWindowsSupported(QPoint globalPosition) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QString SystemCountry() {
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString SystemLanguage() {
|
||||
return QString();
|
||||
}
|
||||
|
||||
void RegisterCustomScheme() {
|
||||
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
|
||||
auto home = getHomeDir();
|
||||
|
Reference in New Issue
Block a user