Get rid of redudant cmake options

This commit is contained in:
Ilya Fedin 2020-08-31 12:26:16 +04:00 committed by John Preston
parent f128665f6b
commit 70c993774a
9 changed files with 6 additions and 44 deletions

View file

@ -446,7 +446,6 @@ void Sandbox::checkForQuit() {
} }
void Sandbox::refreshGlobalProxy() { void Sandbox::refreshGlobalProxy() {
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
const auto proxy = !Global::started() const auto proxy = !Global::started()
? _sandboxProxy ? _sandboxProxy
: (Global::ProxySettings() == MTP::ProxyData::Settings::Enabled) : (Global::ProxySettings() == MTP::ProxyData::Settings::Enabled)
@ -462,7 +461,6 @@ void Sandbox::refreshGlobalProxy() {
} else { } else {
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy); QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
} }
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
} }
uint64 Sandbox::installationTag() const { uint64 Sandbox::installationTag() const {

View file

@ -1461,7 +1461,6 @@ void InstallMainDesktopFile() {
} }
void RegisterCustomScheme(bool force) { void RegisterCustomScheme(bool force) {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
if (cExeName().isEmpty()) { if (cExeName().isEmpty()) {
return; return;
} }
@ -1510,7 +1509,6 @@ void RegisterCustomScheme(bool force) {
LOG(("App Error: %1").arg(error->message)); LOG(("App Error: %1").arg(error->message));
g_error_free(error); g_error_free(error);
} }
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
} }
PermissionStatus GetPermissionStatus(PermissionType type) { PermissionStatus GetPermissionStatus(PermissionType type) {

View file

@ -158,10 +158,8 @@ std::optional<bool> IsDarkMode() {
} }
void RegisterCustomScheme(bool force) { void RegisterCustomScheme(bool force) {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]); OSStatus result = LSSetDefaultHandlerForURLScheme(CFSTR("tg"), (CFStringRef)[[NSBundle mainBundle] bundleIdentifier]);
DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result)); DEBUG_LOG(("App Info: set default handler for 'tg' scheme result: %1").arg(result));
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
} }
// I do check for availability, just not in the exact way clang is content with // I do check for availability, just not in the exact way clang is content with

View file

@ -509,7 +509,6 @@ void RegisterCustomScheme(bool force) {
if (cExeName().isEmpty()) { if (cExeName().isEmpty()) {
return; return;
} }
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
DEBUG_LOG(("App Info: Checking custom scheme 'tg'...")); DEBUG_LOG(("App Info: Checking custom scheme 'tg'..."));
HKEY rkey; HKEY rkey;
@ -547,7 +546,6 @@ void RegisterCustomScheme(bool force) {
if (!_psOpenRegKey(L"Software\\RegisteredApplications", &rkey)) return; if (!_psOpenRegKey(L"Software\\RegisteredApplications", &rkey)) return;
if (!_psSetKeyValue(rkey, L"Telegram Desktop", qsl("SOFTWARE\\TelegramDesktop\\Capabilities"))) return; if (!_psSetKeyValue(rkey, L"Telegram Desktop", qsl("SOFTWARE\\TelegramDesktop\\Capabilities"))) return;
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
} }
PermissionStatus GetPermissionStatus(PermissionType type) { PermissionStatus GetPermissionStatus(PermissionType type) {

View file

@ -43,20 +43,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Settings { namespace Settings {
bool HasConnectionType() {
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
return true;
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
return false;
}
void SetupConnectionType( void SetupConnectionType(
not_null<Main::Account*> account, not_null<Main::Account*> account,
not_null<Ui::VerticalLayout*> container) { not_null<Ui::VerticalLayout*> container) {
if (!HasConnectionType()) {
return;
}
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
const auto connectionType = [=] { const auto connectionType = [=] {
const auto transport = account->mtp().dctransport(); const auto transport = account->mtp().dctransport();
if (Global::ProxySettings() != MTP::ProxyData::Settings::Enabled) { if (Global::ProxySettings() != MTP::ProxyData::Settings::Enabled) {
@ -81,7 +70,6 @@ void SetupConnectionType(
button->addClickHandler([=] { button->addClickHandler([=] {
Ui::show(ProxiesBoxController::CreateOwningBox(account)); Ui::show(ProxiesBoxController::CreateOwningBox(account));
}); });
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
} }
bool HasUpdate() { bool HasUpdate() {
@ -571,13 +559,11 @@ void Advanced::setupContent(not_null<Window::SessionController*> controller) {
if (!cAutoUpdate()) { if (!cAutoUpdate()) {
addUpdate(); addUpdate();
} }
if (HasConnectionType()) { addDivider();
addDivider(); AddSkip(content);
AddSkip(content); AddSubsectionTitle(content, tr::lng_settings_network_proxy());
AddSubsectionTitle(content, tr::lng_settings_network_proxy()); SetupConnectionType(&controller->session().account(), content);
SetupConnectionType(&controller->session().account(), content); AddSkip(content);
AddSkip(content);
}
SetupDataStorage(controller, content); SetupDataStorage(controller, content);
SetupAutoDownload(controller, content); SetupAutoDownload(controller, content);
SetupSystemIntegration(content, [=](Type type) { SetupSystemIntegration(content, [=](Type type) {

View file

@ -15,7 +15,6 @@ class Account;
namespace Settings { namespace Settings {
bool HasConnectionType();
void SetupConnectionType( void SetupConnectionType(
not_null<Main::Account*> account, not_null<Main::Account*> account,
not_null<Ui::VerticalLayout*> container); not_null<Ui::VerticalLayout*> container);

View file

@ -128,13 +128,10 @@ auto GenerateCodes() {
Ui::hideLayer(); Ui::hideLayer();
})); }));
}); });
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
codes.emplace(qsl("registertg"), [](SessionController *window) { codes.emplace(qsl("registertg"), [](SessionController *window) {
Platform::RegisterCustomScheme(true); Platform::RegisterCustomScheme(true);
Ui::Toast::Show("Forced custom scheme register."); Ui::Toast::Show("Forced custom scheme register.");
}); });
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
#if defined Q_OS_WIN || defined Q_OS_MAC #if defined Q_OS_WIN || defined Q_OS_MAC
codes.emplace(qsl("freetype"), [](SessionController *window) { codes.emplace(qsl("freetype"), [](SessionController *window) {

View file

@ -65,9 +65,7 @@ object_ptr<Ui::RpWidget> CreateIntroSettings(
AddDivider(result); AddDivider(result);
AddSkip(result); AddSkip(result);
SetupLanguageButton(result, false); SetupLanguageButton(result, false);
if (HasConnectionType()) { SetupConnectionType(&window->account(), result);
SetupConnectionType(&window->account(), result);
}
AddSkip(result); AddSkip(result);
if (HasUpdate()) { if (HasUpdate()) {
AddDivider(result); AddDivider(result);

View file

@ -4,8 +4,6 @@
# For license and copyright information please follow this link: # For license and copyright information please follow this link:
# https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL # https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
option(TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME "Disable automatic 'tg://' URL scheme handler registration." OFF)
option(TDESKTOP_DISABLE_NETWORK_PROXY "Disable all code for working through Socks5 or MTProxy." OFF)
option(TDESKTOP_DISABLE_GTK_INTEGRATION "Disable all code for GTK integration (Linux only)." OFF) option(TDESKTOP_DISABLE_GTK_INTEGRATION "Disable all code for GTK integration (Linux only)." OFF)
option(TDESKTOP_API_TEST "Use test API credentials." OFF) option(TDESKTOP_API_TEST "Use test API credentials." OFF)
set(TDESKTOP_API_ID "0" CACHE STRING "Provide 'api_id' for the Telegram API access.") set(TDESKTOP_API_ID "0" CACHE STRING "Provide 'api_id' for the Telegram API access.")
@ -54,14 +52,6 @@ if (DESKTOP_APP_SPECIAL_TARGET)
target_compile_definitions(Telegram PRIVATE TDESKTOP_ALLOW_CLOSED_ALPHA) target_compile_definitions(Telegram PRIVATE TDESKTOP_ALLOW_CLOSED_ALPHA)
endif() endif()
if (TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME)
endif()
if (TDESKTOP_DISABLE_NETWORK_PROXY)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_NETWORK_PROXY)
endif()
if (TDESKTOP_DISABLE_GTK_INTEGRATION) if (TDESKTOP_DISABLE_GTK_INTEGRATION)
target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_GTK_INTEGRATION) target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_GTK_INTEGRATION)
endif() endif()