mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Remove Q_OBJECT dependency from ApiWrap.
Also remove it from SingleDelayedCall -> SingleQueuedInvocation.
This commit is contained in:
@@ -28,6 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
#include "layerwidget.h"
|
||||
#include "lang.h"
|
||||
#include "base/observer.h"
|
||||
#include "base/task_queue.h"
|
||||
|
||||
Q_DECLARE_METATYPE(ClickHandlerPtr);
|
||||
Q_DECLARE_METATYPE(Qt::MouseButton);
|
||||
@@ -410,7 +411,7 @@ struct Data {
|
||||
} // namespace internal
|
||||
} // namespace Sandbox
|
||||
|
||||
Sandbox::internal::Data *SandboxData = nullptr;
|
||||
std::unique_ptr<Sandbox::internal::Data> SandboxData;
|
||||
uint64 SandboxUserTag = 0;
|
||||
|
||||
namespace Sandbox {
|
||||
@@ -496,7 +497,7 @@ void WorkingDirReady() {
|
||||
}
|
||||
}
|
||||
|
||||
object_ptr<SingleDelayedCall> MainThreadTaskHandler = { nullptr };
|
||||
object_ptr<SingleQueuedInvokation> MainThreadTaskHandler = { nullptr };
|
||||
|
||||
void MainThreadTaskAdded() {
|
||||
if (!started()) {
|
||||
@@ -507,8 +508,10 @@ void MainThreadTaskAdded() {
|
||||
}
|
||||
|
||||
void start() {
|
||||
MainThreadTaskHandler.create(QCoreApplication::instance(), "onMainThreadTask");
|
||||
SandboxData = new internal::Data();
|
||||
MainThreadTaskHandler.create([] {
|
||||
base::TaskQueue::ProcessMainTasks();
|
||||
});
|
||||
SandboxData = std::make_unique<internal::Data>();
|
||||
|
||||
SandboxData->LangSystemISO = psCurrentLanguage();
|
||||
if (SandboxData->LangSystemISO.isEmpty()) SandboxData->LangSystemISO = qstr("en");
|
||||
@@ -526,8 +529,7 @@ bool started() {
|
||||
}
|
||||
|
||||
void finish() {
|
||||
delete SandboxData;
|
||||
SandboxData = nullptr;
|
||||
SandboxData.reset();
|
||||
MainThreadTaskHandler.destroy();
|
||||
}
|
||||
|
||||
@@ -586,10 +588,10 @@ namespace internal {
|
||||
|
||||
struct Data {
|
||||
uint64 LaunchId = 0;
|
||||
SingleDelayedCall HandleHistoryUpdate = { App::app(), "call_handleHistoryUpdate" };
|
||||
SingleDelayedCall HandleUnreadCounterUpdate = { App::app(), "call_handleUnreadCounterUpdate" };
|
||||
SingleDelayedCall HandleDelayedPeerUpdates = { App::app(), "call_handleDelayedPeerUpdates" };
|
||||
SingleDelayedCall HandleObservables = { App::app(), "call_handleObservables" };
|
||||
SingleQueuedInvokation HandleHistoryUpdate = { [] { App::app()->call_handleHistoryUpdate(); } };
|
||||
SingleQueuedInvokation HandleUnreadCounterUpdate = { [] { App::app()->call_handleUnreadCounterUpdate(); } };
|
||||
SingleQueuedInvokation HandleDelayedPeerUpdates = { [] { App::app()->call_handleDelayedPeerUpdates(); } };
|
||||
SingleQueuedInvokation HandleObservables = { [] { App::app()->call_handleObservables(); } };
|
||||
|
||||
Adaptive::WindowLayout AdaptiveWindowLayout = Adaptive::WindowLayout::Normal;
|
||||
Adaptive::ChatLayout AdaptiveChatLayout = Adaptive::ChatLayout::Normal;
|
||||
@@ -709,10 +711,10 @@ void finish() {
|
||||
}
|
||||
|
||||
DefineReadOnlyVar(Global, uint64, LaunchId);
|
||||
DefineRefVar(Global, SingleDelayedCall, HandleHistoryUpdate);
|
||||
DefineRefVar(Global, SingleDelayedCall, HandleUnreadCounterUpdate);
|
||||
DefineRefVar(Global, SingleDelayedCall, HandleDelayedPeerUpdates);
|
||||
DefineRefVar(Global, SingleDelayedCall, HandleObservables);
|
||||
DefineRefVar(Global, SingleQueuedInvokation, HandleHistoryUpdate);
|
||||
DefineRefVar(Global, SingleQueuedInvokation, HandleUnreadCounterUpdate);
|
||||
DefineRefVar(Global, SingleQueuedInvokation, HandleDelayedPeerUpdates);
|
||||
DefineRefVar(Global, SingleQueuedInvokation, HandleObservables);
|
||||
|
||||
DefineVar(Global, Adaptive::WindowLayout, AdaptiveWindowLayout);
|
||||
DefineVar(Global, Adaptive::ChatLayout, AdaptiveChatLayout);
|
||||
|
Reference in New Issue
Block a user