From 30a1bd7ba2370f68e42d2dfc17b96433fa35d243 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 26 Sep 2019 13:55:35 +0300 Subject: [PATCH] Use base::call_delayed. --- Telegram/SourceFiles/apiwrap.cpp | 5 ++-- Telegram/SourceFiles/boxes/boxes.style | 4 ++-- Telegram/SourceFiles/boxes/connection_box.cpp | 3 ++- .../SourceFiles/boxes/create_poll_box.cpp | 4 ++-- .../chat_helpers/stickers_emoji_pack.cpp | 4 ++-- Telegram/SourceFiles/core/application.h | 5 ---- Telegram/SourceFiles/data/data_session.cpp | 5 ++-- Telegram/SourceFiles/facades.cpp | 7 ------ Telegram/SourceFiles/facades.h | 24 ++----------------- .../SourceFiles/history/history_widget.cpp | 3 ++- .../view/history_view_compose_controls.cpp | 3 ++- .../view/history_view_scheduled_section.cpp | 3 ++- Telegram/SourceFiles/info/info.style | 4 ++-- Telegram/SourceFiles/intro/intro.style | 4 ++-- Telegram/SourceFiles/main/main_app_config.cpp | 4 ++-- Telegram/SourceFiles/mainwindow.cpp | 3 ++- .../mtproto/dedicated_file_loader.cpp | 6 ++--- Telegram/SourceFiles/mtproto/mtp_instance.cpp | 5 ++-- .../mtproto/special_config_request.cpp | 5 ++-- .../passport/passport_form_controller.cpp | 6 ++--- .../platform/linux/file_utilities_linux.cpp | 5 ++-- .../SourceFiles/settings/settings_chat.cpp | 3 ++- .../settings/settings_information.cpp | 4 ++-- .../SourceFiles/settings/settings_main.cpp | 3 ++- .../support/support_autocomplete.cpp | 4 ++-- Telegram/SourceFiles/window/main_window.cpp | 5 ++-- .../window/notifications_manager_default.cpp | 5 ++-- .../window/themes/window_theme_editor.cpp | 11 +++++---- .../themes/window_theme_editor_block.cpp | 4 ++-- 29 files changed, 68 insertions(+), 83 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index f2f8bd648..b33afa76a 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "base/openssl_help.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "observer_peer.h" #include "lang/lang_keys.h" #include "mainwindow.h" @@ -361,7 +362,7 @@ void ApiWrap::requestTermsUpdate() { } const auto now = crl::now(); if (_termsUpdateSendAt && now < _termsUpdateSendAt) { - App::CallDelayed(_termsUpdateSendAt - now, _session, [=] { + base::call_delayed(_termsUpdateSendAt - now, _session, [=] { requestTermsUpdate(); }); return; @@ -1283,7 +1284,7 @@ void ApiWrap::gotUserFull( const auto &d = result.c_userFull(); if (user == _session->user() && !_session->validateSelf(d.vuser())) { constexpr auto kRequestUserAgainTimeout = crl::time(10000); - App::CallDelayed(kRequestUserAgainTimeout, _session, [=] { + base::call_delayed(kRequestUserAgainTimeout, _session, [=] { requestFullPeer(user); }); return; diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index 69b46a1d7..14d65894a 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -780,8 +780,8 @@ themesMenuToggle: IconButton(defaultIconButton) { width: 44px; height: 44px; - icon: icon {{ "title_menu_dots", menuIconFg }}; - iconOver: icon {{ "title_menu_dots", menuIconFgOver }}; + icon: menuToggleIcon; + iconOver: menuToggleIconOver; iconPosition: point(-1px, -1px); rippleAreaPosition: point(4px, 4px); diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 316caefd3..a4873f019 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "storage/localstorage.h" #include "base/qthelp_url.h" +#include "base/call_delayed.h" #include "core/application.h" #include "main/main_account.h" #include "ui/widgets/checkbox.h" @@ -1437,7 +1438,7 @@ void ProxiesBoxController::share(const ProxyData &proxy) { ProxiesBoxController::~ProxiesBoxController() { if (_saveTimer.isActive()) { - App::CallDelayed( + base::call_delayed( kSaveSettingsDelayedTimeout, QCoreApplication::instance(), [] { Local::writeSettings(); }); diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index e93824ba2..ad9a1db47 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_common.h" #include "base/unique_qptr.h" #include "base/event_filter.h" -#include "facades.h" +#include "base/call_delayed.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" #include "styles/style_settings.h" @@ -400,7 +400,7 @@ void Options::Option::destroy(FnMut done) { return; } _field->hide(anim::type::normal); - App::CallDelayed( + base::call_delayed( st::slideWrapDuration * 2, _field.get(), std::move(done)); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp index 8a7128c99..b583c61bf 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp @@ -16,9 +16,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_origin.h" #include "data/data_session.h" #include "data/data_document.h" +#include "base/call_delayed.h" #include "apiwrap.h" #include "app.h" -#include "facades.h" #include "styles/style_history.h" #include @@ -601,7 +601,7 @@ base::flat_map> EmojiPack::collectStickers( } void EmojiPack::refreshDelayed() { - App::CallDelayed(details::kRefreshTimeout, _session, [=] { + base::call_delayed(details::kRefreshTimeout, _session, [=] { refresh(); }); } diff --git a/Telegram/SourceFiles/core/application.h b/Telegram/SourceFiles/core/application.h index e9c284414..6129e71bd 100644 --- a/Telegram/SourceFiles/core/application.h +++ b/Telegram/SourceFiles/core/application.h @@ -220,10 +220,6 @@ public: void call_handleDelayedPeerUpdates(); void call_handleObservables(); - void callDelayed(int duration, FnMut &&lambda) { - _callDelayedTimer.call(duration, std::move(lambda)); - } - protected: bool eventFilter(QObject *object, QEvent *event) override; @@ -283,7 +279,6 @@ private: rpl::event_stream _termsLockChanges; std::unique_ptr _termsLock; - base::DelayedCallTimer _callDelayedTimer; base::Timer _saveSettingsTimer; struct LeaveSubscription { diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 1d1c27f06..540979331 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -49,6 +49,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_cloud_themes.h" #include "base/platform/base_platform_info.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "facades.h" #include "app.h" #include "styles/style_boxes.h" // st::backgroundSize @@ -933,7 +934,7 @@ void Session::suggestStartExport() { ? 0 : (_exportAvailableAt - now); if (left) { - App::CallDelayed( + base::call_delayed( std::min(left + 5, 3600) * crl::time(1000), _session, [=] { suggestStartExport(); }); @@ -991,7 +992,7 @@ void Session::rememberPassportCredentials( _passportCredentials = std::make_unique( std::move(data), ++generation); - App::CallDelayed(rememberFor, _session, [=, check = generation] { + base::call_delayed(rememberFor, _session, [=, check = generation] { if (_passportCredentials && _passportCredentials->second == check) { forgetPassportCredentials(); } diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index cb8cd9262..19419045a 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -33,13 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" namespace App { -namespace internal { - -void CallDelayed(int duration, FnMut &&lambda) { - Core::App().callDelayed(duration, std::move(lambda)); -} - -} // namespace internal void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) { if (auto m = App::main()) { diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index 42c8f1c28..951764a2a 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/type_traits.h" #include "base/observer.h" +#include "base/call_delayed.h" #include "ui/effects/animation_value.h" class History; @@ -28,27 +29,6 @@ class ItemBase; } // namespace InlineBots namespace App { -namespace internal { - -void CallDelayed(int duration, FnMut &&lambda); - -} // namespace internal - -template -inline void CallDelayed( - int duration, - crl::guarded_wrap &&guarded) { - return internal::CallDelayed( - duration, - std::move(guarded)); -} - -template -inline void CallDelayed(int duration, Guard &&object, Lambda &&lambda) { - return internal::CallDelayed(duration, crl::guard( - std::forward(object), - std::forward(lambda))); -} template [[nodiscard]] inline auto LambdaDelayed(int duration, Guard &&object, Lambda &&lambda) { @@ -57,7 +37,7 @@ template std::forward(lambda)); return [saved = std::move(guarded), duration] { auto copy = saved; - internal::CallDelayed(duration, std::move(copy)); + base::call_delayed(duration, std::move(copy)); }; } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 20fbd79a0..af5bf73b7 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "inline_bots/inline_bot_result.h" #include "base/event_filter.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "data/data_drafts.h" #include "data/data_session.h" #include "data/data_web_page.h" @@ -3755,7 +3756,7 @@ void HistoryWidget::updateSendButtonType() { && (type == Type::Send || type == Type::Record)); if (delay != 0) { - App::CallDelayed( + base::call_delayed( kRefreshSlowmodeLabelTimeout, this, [=] { updateSendButtonType(); }); diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp index 7bb12d966..b6c27a34e 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/ui_utility.h" #include "lang/lang_keys.h" #include "base/event_filter.h" +#include "base/call_delayed.h" #include "base/qt_signal_producer.h" #include "history/history.h" #include "chat_helpers/tabbed_panel.h" @@ -281,7 +282,7 @@ void ComposeControls::updateSendButtonType() { // && (type == Type::Send || type == Type::Record)); //if (delay != 0) { - // App::CallDelayed( + // base::call_delayed( // kRefreshSlowmodeLabelTimeout, // this, // [=] { updateSendButtonType(); }); diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index 6b9d7fbd3..93e61fa71 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "window/window_peer_menu.h" #include "base/event_filter.h" +#include "base/call_delayed.h" #include "core/file_utilities.h" #include "main/main_session.h" #include "data/data_session.h" @@ -143,7 +144,7 @@ void ScheduledWidget::setupComposeControls() { return !_choosingAttach; }) | rpl::start_with_next([=] { _choosingAttach = true; - App::CallDelayed( + base::call_delayed( st::historyAttach.ripple.hideDuration, this, [=] { _choosingAttach = false; chooseAttach(); }); diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index fdee4ebae..9867eaa2b 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -753,8 +753,8 @@ topBarCallSkip: -1px; topBarMenuToggle: IconButton(topBarSearch) { width: 44px; - icon: icon {{ "title_menu_dots", menuIconFg }}; - iconOver: icon {{ "title_menu_dots", menuIconFgOver }}; + icon: menuToggleIcon; + iconOver: menuToggleIconOver; iconPosition: point(16px, 17px); rippleAreaPosition: point(0px, 7px); diff --git a/Telegram/SourceFiles/intro/intro.style b/Telegram/SourceFiles/intro/intro.style index be68680a9..fdae237d7 100644 --- a/Telegram/SourceFiles/intro/intro.style +++ b/Telegram/SourceFiles/intro/intro.style @@ -150,8 +150,8 @@ introBackButton: IconButton(defaultIconButton) { width: 56px; height: 56px; - icon: icon {{ "box_button_back", menuIconFg }}; - iconOver: icon {{ "box_button_back", menuIconFgOver }}; + icon: backButtonIcon; + iconOver: backButtonIconOver; rippleAreaPosition: point(8px, 8px); rippleAreaSize: 40px; diff --git a/Telegram/SourceFiles/main/main_app_config.cpp b/Telegram/SourceFiles/main/main_app_config.cpp index d6684a6a7..2f6d76bb1 100644 --- a/Telegram/SourceFiles/main/main_app_config.cpp +++ b/Telegram/SourceFiles/main/main_app_config.cpp @@ -8,8 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_app_config.h" #include "main/main_session.h" +#include "base/call_delayed.h" #include "apiwrap.h" -#include "facades.h" namespace Main { namespace { @@ -44,7 +44,7 @@ void AppConfig::refresh() { } void AppConfig::refreshDelayed() { - App::CallDelayed(kRefreshTimeout, _session, [=] { + base::call_delayed(kRefreshTimeout, _session, [=] { refresh(); }); } diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index ae1af98e0..b6d9734de 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_intro.h" #include "platform/platform_notifications_manager.h" #include "base/platform/base_platform_info.h" +#include "base/call_delayed.h" #include "window/notifications_manager.h" #include "window/themes/window_theme.h" #include "window/themes/window_theme_warning.h" @@ -689,7 +690,7 @@ void MainWindow::fixOrder() { void MainWindow::showFromTray(QSystemTrayIcon::ActivationReason reason) { if (reason != QSystemTrayIcon::Context) { - App::CallDelayed(1, this, [this] { + base::call_delayed(1, this, [this] { updateTrayMenu(); updateGlobalMenu(); }); diff --git a/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp b/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp index b66eb6f44..543418a20 100644 --- a/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp +++ b/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp @@ -8,9 +8,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/dedicated_file_loader.h" #include "main/main_session.h" -#include "core/application.h" #include "main/main_account.h" // Account::sessionChanges. -#include "facades.h" +#include "core/application.h" +#include "base/call_delayed.h" namespace MTP { namespace { @@ -321,7 +321,7 @@ void DedicatedLoader::sendRequest() { _offset += kChunkSize; if (_requests.size() < kRequestsCount) { - App::CallDelayed(kNextRequestDelay, this, [=] { sendRequest(); }); + base::call_delayed(kNextRequestDelay, this, [=] { sendRequest(); }); } } diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index c51ea664b..87f5b4f88 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -21,9 +21,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "apiwrap.h" #include "core/application.h" -#include "base/unixtime.h" #include "lang/lang_instance.h" #include "lang/lang_cloud_manager.h" +#include "base/unixtime.h" +#include "base/call_delayed.h" #include "base/timer.h" #include "facades.h" @@ -450,7 +451,7 @@ void Instance::Private::requestConfigIfOld() { void Instance::Private::requestConfigIfExpired() { const auto requestIn = (_configExpiresAt - crl::now()); if (requestIn > 0) { - App::CallDelayed( + base::call_delayed( std::min(requestIn, 3600 * crl::time(1000)), _instance, [=] { requestConfigIfExpired(); }); diff --git a/Telegram/SourceFiles/mtproto/special_config_request.cpp b/Telegram/SourceFiles/mtproto/special_config_request.cpp index 264fa8fa7..362a21d7a 100644 --- a/Telegram/SourceFiles/mtproto/special_config_request.cpp +++ b/Telegram/SourceFiles/mtproto/special_config_request.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mtproto/auth_key.h" #include "base/unixtime.h" #include "base/openssl_help.h" +#include "base/call_delayed.h" #include "facades.h" #include @@ -415,7 +416,7 @@ void SpecialConfigRequest::sendNextRequest() { const auto attempt = _attempts.back(); _attempts.pop_back(); if (!_attempts.empty()) { - App::CallDelayed(kSendNextTimeout, this, [=] { + base::call_delayed(kSendNextTimeout, this, [=] { sendNextRequest(); }); } @@ -778,7 +779,7 @@ void DomainResolver::sendNextRequest(const AttemptKey &key) { list.pop_back(); if (!list.empty()) { - App::CallDelayed(kSendNextTimeout, &attempts.guard, [=] { + base::call_delayed(kSendNextTimeout, &attempts.guard, [=] { sendNextRequest(key); }); } diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index 1cb9206e4..d43349366 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/openssl_help.h" #include "base/qthelp_url.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "data/data_session.h" #include "data/data_user.h" #include "mainwindow.h" @@ -28,7 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "storage/file_upload.h" #include "storage/file_download.h" -#include "facades.h" #include "app.h" #include @@ -756,7 +756,7 @@ std::vector> FormController::submitGetErrors() { _view->showToast(tr::lng_passport_success(tr::now)); - App::CallDelayed( + base::call_delayed( (st::toastFadeInDuration + Ui::Toast::kDefaultDuration + st::toastFadeOutDuration), @@ -2669,7 +2669,7 @@ void FormController::cancelSure() { UrlClickHandler::Open(url); } const auto timeout = _view->closeGetDuration(); - App::CallDelayed(timeout, this, [=] { + base::call_delayed(timeout, this, [=] { _controller->clearPassportForm(); }); } diff --git a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp index 9a2fbb2e0..a09aff7ce 100644 --- a/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/file_utilities_linux.cpp @@ -7,16 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "platform/linux/file_utilities_linux.h" -#include #include "platform/linux/linux_libs.h" #include "platform/linux/linux_gdk_helper.h" #include "core/application.h" #include "mainwindow.h" #include "boxes/abstract_box.h" #include "storage/localstorage.h" +#include "base/call_delayed.h" #include "facades.h" #include +#include QStringList qt_make_filter_list(const QString &filter); @@ -419,7 +420,7 @@ int GtkFileDialog::exec() { show(); if (const auto parent = parentWidget()) { - App::CallDelayed(200, parent, [=] { + base::call_delayed(200, parent, [=] { parent->activateWindow(); }); } diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index 29c5fbbed..9b9518d70 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -42,6 +42,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_cloud_themes.h" #include "chat_helpers/emoji_sets_manager.h" #include "base/platform/base_platform_info.h" +#include "base/call_delayed.h" #include "support/support_common.h" #include "support/support_templates.h" #include "main/main_session.h" @@ -809,7 +810,7 @@ void SetupExport( )->addClickHandler([=] { const auto session = &controller->session(); Ui::hideSettingsAndLayer(); - App::CallDelayed( + base::call_delayed( st::boxDuration, session, [=] { session->data().startExport(); }); diff --git a/Telegram/SourceFiles/settings/settings_information.cpp b/Telegram/SourceFiles/settings/settings_information.cpp index dc8342008..bffb3c547 100644 --- a/Telegram/SourceFiles/settings/settings_information.cpp +++ b/Telegram/SourceFiles/settings/settings_information.cpp @@ -30,7 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "apiwrap.h" #include "core/file_utilities.h" -#include "facades.h" +#include "base/call_delayed.h" #include "app.h" #include "styles/style_layers.h" #include "styles/style_settings.h" @@ -367,7 +367,7 @@ BioManager SetupBio( ) | rpl::start_with_next([=](bool changed) { if (changed) { const auto saved = *generation = std::abs(*generation) + 1; - App::CallDelayed(kSaveBioTimeout, bio, [=] { + base::call_delayed(kSaveBioTimeout, bio, [=] { if (*generation == saved) { save(nullptr); *generation = 0; diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 331a1ac16..685ee62ed 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "window/window_session_controller.h" #include "core/file_utilities.h" +#include "base/call_delayed.h" #include "facades.h" #include "app.h" #include "styles/style_settings.h" @@ -176,7 +177,7 @@ void SetupInterfaceScale( App::restart(); }); const auto cancelled = crl::guard(button, [=] { - App::CallDelayed( + base::call_delayed( st::defaultSettingsSlider.duration, button, [=] { (*setScale)(cConfigScale()); }); diff --git a/Telegram/SourceFiles/support/support_autocomplete.cpp b/Telegram/SourceFiles/support/support_autocomplete.cpp index 844b02593..ddc65146d 100644 --- a/Telegram/SourceFiles/support/support_autocomplete.cpp +++ b/Telegram/SourceFiles/support/support_autocomplete.cpp @@ -19,9 +19,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "data/data_session.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "main/main_session.h" #include "apiwrap.h" -#include "facades.h" #include "styles/style_chat_helpers.h" #include "styles/style_window.h" #include "styles/style_layers.h" @@ -426,7 +426,7 @@ void Autocomplete::setupContent() { inner->activated() | rpl::start_with_next(submit, lifetime()); connect(input, &Ui::InputField::blurred, [=] { - App::CallDelayed(10, this, [=] { + base::call_delayed(10, this, [=] { if (!input->hasFocus()) { deactivate(); } diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index a984b487a..c4d4802f8 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "main/main_session.h" #include "base/crc32hash.h" +#include "base/call_delayed.h" #include "ui/toast/toast.h" #include "ui/ui_utility.h" #include "apiwrap.h" @@ -348,7 +349,7 @@ void MainWindow::handleActiveChanged() { if (isActiveWindow()) { Core::App().checkMediaViewActivation(); } - App::CallDelayed(1, this, [this] { + base::call_delayed(1, this, [this] { updateTrayMenu(); handleActiveChangedHook(); }); @@ -590,7 +591,7 @@ void MainWindow::reActivateWindow() { } }; crl::on_main(this, reActivate); - App::CallDelayed(200, this, reActivate); + base::call_delayed(200, this, reActivate); #endif // Q_OS_LINUX32 || Q_OS_LINUX64 } diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index e0ba399a1..5d4239515 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history.h" #include "history/history_item.h" #include "platform/platform_specific.h" +#include "base/call_delayed.h" #include "facades.h" #include "app.h" #include "styles/style_dialogs.h" @@ -402,7 +403,7 @@ void Widget::destroyDelayed() { _deleted = true; // Ubuntu has a lag if a fully transparent widget is destroyed immediately. - App::CallDelayed(1000, this, [this] { + base::call_delayed(1000, this, [this] { manager()->removeWidget(this); }); } @@ -433,7 +434,7 @@ bool Widget::shiftAnimationCallback(crl::time now) { void Widget::hideSlow() { if (anim::Disabled()) { _hiding = true; - App::CallDelayed( + base::call_delayed( st::notifySlowHide, this, [=, guard = _hidingDelayed.make_guard()] { diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index 769698566..c9f2f332b 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/ui_utility.h" #include "base/parse_helper.h" #include "base/zlib_help.h" +#include "base/call_delayed.h" #include "core/file_utilities.h" #include "core/application.h" #include "boxes/edit_color_box.h" @@ -419,7 +420,7 @@ Editor::Inner::Inner(QWidget *parent, const QString &path) : TWidget(parent) if (update.type == BackgroundUpdate::Type::TestingTheme) { Revert(); - App::CallDelayed(st::slideDuration, this, [] { + base::call_delayed(st::slideDuration, this, [] { Ui::show(Box( tr::lng_theme_editor_cant_change_theme(tr::now))); }); @@ -674,7 +675,9 @@ Editor::Editor( }); }); _inner->setFocusCallback([this] { - App::CallDelayed(2 * st::boxDuration, this, [this] { _select->setInnerFocus(); }); + base::call_delayed(2 * st::boxDuration, this, [this] { + _select->setInnerFocus(); + }); }); _inner->setScrollCallback([this](int top, int bottom) { _scroll->scrollToY(top, bottom); @@ -720,12 +723,12 @@ void Editor::showMenu() { _menuToggle->installEventFilter(_menu); _menu->addAction(tr::lng_theme_editor_menu_export(tr::now), [=] { - App::CallDelayed(st::defaultRippleAnimation.hideDuration, this, [=] { + base::call_delayed(st::defaultRippleAnimation.hideDuration, this, [=] { exportTheme(); }); }); _menu->addAction(tr::lng_theme_editor_menu_import(tr::now), [=] { - App::CallDelayed(st::defaultRippleAnimation.hideDuration, this, [=] { + base::call_delayed(st::defaultRippleAnimation.hideDuration, this, [=] { importTheme(); }); }); diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp index 5922ddb7e..9995ae4f9 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/shadow.h" #include "boxes/edit_color_box.h" #include "lang/lang_keys.h" -#include "facades.h" +#include "base/call_delayed.h" namespace Window { namespace Theme { @@ -522,7 +522,7 @@ void EditorBlock::mouseReleaseEvent(QMouseEvent *e) { if (_context->box) { chooseRow(); } else if (_selected >= 0) { - App::CallDelayed(st::defaultRippleAnimation.hideDuration, this, [this, index = findRowIndex(&rowAtIndex(_selected))] { + base::call_delayed(st::defaultRippleAnimation.hideDuration, this, [this, index = findRowIndex(&rowAtIndex(_selected))] { if (index >= 0 && index < _data.size()) { activateRow(_data[index]); }