2
0
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:
John Preston
2019-06-03 17:41:23 +03:00
parent 0467401635
commit 9c613fe2f7
56 changed files with 784 additions and 488 deletions

View 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

View 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

View File

@@ -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) {

View File

@@ -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();