mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Completely removed Global namespace.
This commit is contained in:
parent
6d08542afa
commit
4db5624beb
5 changed files with 2 additions and 88 deletions
|
@ -75,7 +75,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/confirm_phone_box.h"
|
#include "boxes/confirm_phone_box.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
#include "facades.h"
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
#include <QtWidgets/QDesktopWidget>
|
#include <QtWidgets/QDesktopWidget>
|
||||||
|
@ -177,7 +176,6 @@ Application::~Application() {
|
||||||
Media::Player::finish(_audio.get());
|
Media::Player::finish(_audio.get());
|
||||||
style::stopManager();
|
style::stopManager();
|
||||||
|
|
||||||
Global::finish();
|
|
||||||
ThirdParty::finish();
|
ThirdParty::finish();
|
||||||
|
|
||||||
Instance = nullptr;
|
Instance = nullptr;
|
||||||
|
@ -187,8 +185,7 @@ void Application::run() {
|
||||||
style::internal::StartFonts();
|
style::internal::StartFonts();
|
||||||
|
|
||||||
ThirdParty::start();
|
ThirdParty::start();
|
||||||
Global::start();
|
refreshGlobalProxy(); // Depends on Core::IsAppLaunched().
|
||||||
refreshGlobalProxy(); // Depends on Global::start().
|
|
||||||
|
|
||||||
// Depends on OpenSSL on macOS, so on ThirdParty::start().
|
// Depends on OpenSSL on macOS, so on ThirdParty::start().
|
||||||
// Depends on notifications settings.
|
// Depends on notifications settings.
|
||||||
|
|
|
@ -15,7 +15,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "base/parse_helper.h"
|
#include "base/parse_helper.h"
|
||||||
#include "facades.h"
|
|
||||||
|
|
||||||
#include <QtWidgets/QShortcut>
|
#include <QtWidgets/QShortcut>
|
||||||
#include <QtCore/QJsonDocument>
|
#include <QtCore/QJsonDocument>
|
||||||
|
@ -553,8 +552,6 @@ rpl::producer<not_null<Request*>> Requests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start() {
|
void Start() {
|
||||||
Assert(Global::started());
|
|
||||||
|
|
||||||
Data.fill();
|
Data.fill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,59 +318,3 @@ bool switchInlineBotButtonReceived(
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Notify
|
} // namespace Notify
|
||||||
|
|
||||||
#define DefineReadOnlyVar(Namespace, Type, Name) const Type &Name() { \
|
|
||||||
AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::" #Name); \
|
|
||||||
return Namespace##Data->Name; \
|
|
||||||
}
|
|
||||||
#define DefineRefVar(Namespace, Type, Name) DefineReadOnlyVar(Namespace, Type, Name) \
|
|
||||||
Type &Ref##Name() { \
|
|
||||||
AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::Ref" #Name); \
|
|
||||||
return Namespace##Data->Name; \
|
|
||||||
}
|
|
||||||
#define DefineVar(Namespace, Type, Name) DefineRefVar(Namespace, Type, Name) \
|
|
||||||
void Set##Name(const Type &Name) { \
|
|
||||||
AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::Set" #Name); \
|
|
||||||
Namespace##Data->Name = Name; \
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Global {
|
|
||||||
namespace internal {
|
|
||||||
|
|
||||||
struct Data {
|
|
||||||
bool TryIPv6 = !Platform::IsWindows();
|
|
||||||
std::vector<MTP::ProxyData> ProxiesList;
|
|
||||||
MTP::ProxyData SelectedProxy;
|
|
||||||
MTP::ProxyData::Settings ProxySettings = MTP::ProxyData::Settings::System;
|
|
||||||
bool UseProxyForCalls = false;
|
|
||||||
base::Observable<void> ConnectionTypeChanged;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
} // namespace Global
|
|
||||||
|
|
||||||
Global::internal::Data *GlobalData = nullptr;
|
|
||||||
|
|
||||||
namespace Global {
|
|
||||||
|
|
||||||
bool started() {
|
|
||||||
return GlobalData != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void start() {
|
|
||||||
GlobalData = new internal::Data();
|
|
||||||
}
|
|
||||||
|
|
||||||
void finish() {
|
|
||||||
delete GlobalData;
|
|
||||||
GlobalData = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
DefineVar(Global, bool, TryIPv6);
|
|
||||||
DefineVar(Global, std::vector<MTP::ProxyData>, ProxiesList);
|
|
||||||
DefineVar(Global, MTP::ProxyData, SelectedProxy);
|
|
||||||
DefineVar(Global, MTP::ProxyData::Settings, ProxySettings);
|
|
||||||
DefineVar(Global, bool, UseProxyForCalls);
|
|
||||||
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
|
||||||
|
|
||||||
} // namespace Global
|
|
||||||
|
|
|
@ -82,24 +82,3 @@ bool switchInlineBotButtonReceived(
|
||||||
MsgId samePeerReplyTo = 0);
|
MsgId samePeerReplyTo = 0);
|
||||||
|
|
||||||
} // namespace Notify
|
} // namespace Notify
|
||||||
|
|
||||||
#define DeclareReadOnlyVar(Type, Name) const Type &Name();
|
|
||||||
#define DeclareRefVar(Type, Name) DeclareReadOnlyVar(Type, Name) \
|
|
||||||
Type &Ref##Name();
|
|
||||||
#define DeclareVar(Type, Name) DeclareRefVar(Type, Name) \
|
|
||||||
void Set##Name(const Type &Name);
|
|
||||||
|
|
||||||
namespace Global {
|
|
||||||
|
|
||||||
bool started();
|
|
||||||
void start();
|
|
||||||
void finish();
|
|
||||||
|
|
||||||
DeclareVar(bool, TryIPv6);
|
|
||||||
DeclareVar(std::vector<MTP::ProxyData>, ProxiesList);
|
|
||||||
DeclareVar(MTP::ProxyData, SelectedProxy);
|
|
||||||
DeclareVar(MTP::ProxyData::Settings, ProxySettings);
|
|
||||||
DeclareVar(bool, UseProxyForCalls);
|
|
||||||
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
|
||||||
|
|
||||||
} // namespace Global
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "ui/inactive_press.h"
|
#include "ui/inactive_press.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "facades.h"
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
@ -255,9 +254,7 @@ bool EventFilter::mainWindowEvent(
|
||||||
} else {
|
} else {
|
||||||
_window->shadowsDeactivate();
|
_window->shadowsDeactivate();
|
||||||
}
|
}
|
||||||
if (Global::started()) {
|
_window->update();
|
||||||
_window->update();
|
|
||||||
}
|
|
||||||
} return false;
|
} return false;
|
||||||
|
|
||||||
case WM_WINDOWPOSCHANGING:
|
case WM_WINDOWPOSCHANGING:
|
||||||
|
|
Loading…
Add table
Reference in a new issue