From c057f2842568c72d14fb443cb3fd003b25ae887f Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 13 Sep 2019 19:45:48 +0300 Subject: [PATCH] Move standard buttons to lib_ui. --- Telegram/SourceFiles/base/base_integration.h | 18 +++++++++ .../{core => base}/qt_signal_producer.h | 20 +++++----- .../SourceFiles/chat_helpers/tabbed_panel.cpp | 1 - Telegram/SourceFiles/core/application.cpp | 21 +++++++++- Telegram/SourceFiles/core/application.h | 4 +- Telegram/SourceFiles/core/sandbox.cpp | 8 ++++ .../dialogs/dialogs_inner_widget.cpp | 2 +- .../view/history_view_compose_controls.cpp | 4 +- .../inline_bots/inline_results_widget.cpp | 2 +- Telegram/SourceFiles/intro/introcode.cpp | 2 +- Telegram/SourceFiles/intro/intropwdcheck.cpp | 4 +- .../media/view/media_view_overlay_widget.cpp | 6 +-- Telegram/SourceFiles/mtproto/facade.h | 26 +------------ .../profile/profile_back_button.cpp | 2 +- .../profile/profile_block_widget.h | 2 - Telegram/SourceFiles/ui/abstract_button.cpp | 33 +++++++++------- Telegram/SourceFiles/ui/abstract_button.h | 7 +--- .../ui/effects/animation_value.cpp | 4 ++ .../SourceFiles/ui/effects/animation_value.h | 4 ++ .../SourceFiles/ui/effects/animations.cpp | 33 ++++++++++++++-- Telegram/SourceFiles/ui/effects/animations.h | 38 +++++++++++++++++-- .../ui/effects/cross_animation.cpp | 1 + .../SourceFiles/ui/effects/cross_animation.h | 2 + .../SourceFiles/ui/effects/ripple_animation.h | 2 + Telegram/SourceFiles/ui/rp_widget.cpp | 5 ++- Telegram/SourceFiles/ui/rp_widget.h | 19 +++++----- Telegram/SourceFiles/ui/style/style_core.cpp | 36 ++++++++++++++---- Telegram/SourceFiles/ui/style/style_core.h | 13 +++++-- .../ui/style/style_core_direction.cpp | 25 ++++++++++++ Telegram/SourceFiles/ui/ui_integration.h | 20 ++++++++++ Telegram/SourceFiles/ui/ui_pch.h | 3 ++ Telegram/SourceFiles/ui/ui_utility.h | 6 +-- Telegram/SourceFiles/ui/widgets/buttons.cpp | 23 +++++------ Telegram/SourceFiles/ui/widgets/buttons.h | 2 +- .../SourceFiles/ui/widgets/dropdown_menu.cpp | 2 +- .../SourceFiles/ui/widgets/inner_dropdown.cpp | 16 ++++++-- .../SourceFiles/ui/widgets/inner_dropdown.h | 5 +-- Telegram/SourceFiles/ui/widgets/menu.cpp | 10 +++-- Telegram/SourceFiles/ui/widgets/menu.h | 8 +--- Telegram/SourceFiles/ui/widgets/tooltip.cpp | 3 +- .../window/themes/window_theme.cpp | 6 +++ .../SourceFiles/window/window_main_menu.cpp | 8 ++-- Telegram/gyp/lib_base.gyp | 2 + Telegram/gyp/lib_ui.gyp | 13 ++++++- Telegram/gyp/telegram_sources.txt | 9 ----- 45 files changed, 330 insertions(+), 150 deletions(-) create mode 100644 Telegram/SourceFiles/base/base_integration.h rename Telegram/SourceFiles/{core => base}/qt_signal_producer.h (81%) create mode 100644 Telegram/SourceFiles/ui/style/style_core_direction.cpp create mode 100644 Telegram/SourceFiles/ui/ui_integration.h diff --git a/Telegram/SourceFiles/base/base_integration.h b/Telegram/SourceFiles/base/base_integration.h new file mode 100644 index 000000000..397e4736c --- /dev/null +++ b/Telegram/SourceFiles/base/base_integration.h @@ -0,0 +1,18 @@ +/* +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 + +#include "base/basic_types.h" + +// Methods that must be implemented outside lib_base. + +namespace base { + +void EnterFromEventLoop(FnMut &&method); + +} // namespace diff --git a/Telegram/SourceFiles/core/qt_signal_producer.h b/Telegram/SourceFiles/base/qt_signal_producer.h similarity index 81% rename from Telegram/SourceFiles/core/qt_signal_producer.h rename to Telegram/SourceFiles/base/qt_signal_producer.h index e9655ac72..29a12a016 100644 --- a/Telegram/SourceFiles/core/qt_signal_producer.h +++ b/Telegram/SourceFiles/base/qt_signal_producer.h @@ -7,9 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "core/sandbox.h" +#include "base/base_integration.h" -namespace Core { +namespace base { // This method allows to create an rpl::producer from a Qt object // and a signal with none or one reported value. @@ -20,28 +20,28 @@ namespace Core { // This means that all postponeCall's will be invoked right after // the value processing by the current consumer finishes. template -auto QtSignalProducer(Object *object, Signal signal); +auto qt_signal_producer(Object *object, Signal signal); namespace details { template -struct QtSignalArgument; +struct qt_signal_argument; template -struct QtSignalArgument { +struct qt_signal_argument { using type = Value; }; template -struct QtSignalArgument { +struct qt_signal_argument { using type = void; }; } // namespace details template -auto QtSignalProducer(Object *object, Signal signal) { - using Value = typename details::QtSignalArgument::type; +auto qt_signal_producer(Object *object, Signal signal) { + using Value = typename details::qt_signal_argument::type; static constexpr auto NoArgument = std::is_same_v; using Produced = std::conditional_t< NoArgument, @@ -67,7 +67,7 @@ auto QtSignalProducer(Object *object, Signal signal) { }); }; auto put = [=](const Produced &value) { - Sandbox::Instance().customEnterFromEventLoop([&] { + EnterFromEventLoop([&] { consumer.put_next_copy(value); }); }; @@ -79,4 +79,4 @@ auto QtSignalProducer(Object *object, Signal signal) { }); } -} // namespace Core +} // namespace base diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp index a655905d0..6b6e5f7ca 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp @@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "mainwindow.h" #include "core/application.h" -#include "core/qt_signal_producer.h" #include "app.h" #include "styles/style_chat_helpers.h" diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 2d14bb639..7739c2be0 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -184,6 +184,15 @@ void Application::run() { Ui::Emoji::Init(); Media::Player::start(_audio.get()); + style::ShortAnimationPlaying( + ) | rpl::start_with_next([=](bool playing) { + if (playing) { + MTP::internal::pause(); + } else { + MTP::internal::unpause(); + } + }, _lifetime); + DEBUG_LOG(("Application Info: inited...")); cChangeTimeFormat(QLocale::system().timeFormat(QLocale::ShortFormat)); @@ -732,7 +741,7 @@ QPoint Application::getPointForCallPanelCenter() const { } // macOS Qt bug workaround, sometimes no leaveEvent() gets to the nested widgets. -void Application::registerLeaveSubscription(QWidget *widget) { +void Application::registerLeaveSubscription(not_null widget) { #ifdef Q_OS_MAC if (const auto topLevel = widget->window()) { if (topLevel == _window->widget()) { @@ -750,7 +759,7 @@ void Application::registerLeaveSubscription(QWidget *widget) { #endif // Q_OS_MAC } -void Application::unregisterLeaveSubscription(QWidget *widget) { +void Application::unregisterLeaveSubscription(not_null widget) { #ifdef Q_OS_MAC _leaveSubscriptions = std::move( _leaveSubscriptions @@ -869,4 +878,12 @@ void PostponeCall(FnMut &&callable) { Core::App().postponeCall(std::move(callable)); } +void RegisterLeaveSubscription(not_null widget) { + Core::App().registerLeaveSubscription(widget); +} + +void UnregisterLeaveSubscription(not_null widget) { + Core::App().unregisterLeaveSubscription(widget); +} + } // namespace Ui diff --git a/Telegram/SourceFiles/core/application.h b/Telegram/SourceFiles/core/application.h index adc7f139e..0435af5aa 100644 --- a/Telegram/SourceFiles/core/application.h +++ b/Telegram/SourceFiles/core/application.h @@ -199,8 +199,8 @@ public: [[nodiscard]] crl::time lastNonIdleTime() const; void updateNonIdle(); - void registerLeaveSubscription(QWidget *widget); - void unregisterLeaveSubscription(QWidget *widget); + void registerLeaveSubscription(not_null widget); + void unregisterLeaveSubscription(not_null widget); // Sandbox interface. void postponeCall(FnMut &&callable); diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index fd40494a6..5d9a4e303 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -613,3 +613,11 @@ rpl::producer<> on_main_update_requests() { } } // namespace crl + +namespace base { + +void EnterFromEventLoop(FnMut &&method) { + Core::Sandbox::Instance().customEnterFromEventLoop(std::move(method)); +} + +} // namespace base diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 8d6a4697b..6f71c940a 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -121,7 +121,7 @@ InnerWidget::InnerWidget( ? Global::DialogsMode() : Dialogs::Mode::All; - connect(_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact())); + _addContactLnk->addClickHandler([] { App::wnd()->onShowAddContact(); }); _cancelSearchInChat->setClickedCallback([=] { cancelSearchInChat(); }); _cancelSearchInChat->hide(); _cancelSearchFromUser->setClickedCallback([=] { diff --git a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp index f6dc27d8b..41e8e143e 100644 --- a/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/history_view_compose_controls.cpp @@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/ui_utility.h" #include "lang/lang_keys.h" #include "core/event_filter.h" -#include "core/qt_signal_producer.h" +#include "base/qt_signal_producer.h" #include "history/history.h" #include "chat_helpers/tabbed_panel.h" #include "chat_helpers/tabbed_section.h" @@ -94,7 +94,7 @@ rpl::producer<> ComposeControls::cancelRequests() const { rpl::producer<> ComposeControls::sendRequests() const { auto toEmpty = rpl::map([] { return rpl::empty_value(); }); - auto submits = Core::QtSignalProducer( + auto submits = base::qt_signal_producer( _field.get(), &Ui::InputField::submitted); return rpl::merge( diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index 6b1d32e45..4c6d5c540 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -447,7 +447,7 @@ void Inner::refreshSwitchPmButton(const CacheEntry *entry) { _switchPmButton.create(this, nullptr, st::switchPmButton); _switchPmButton->show(); _switchPmButton->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); - connect(_switchPmButton, SIGNAL(clicked()), this, SLOT(onSwitchPm())); + _switchPmButton->addClickHandler([=] { onSwitchPm(); }); } _switchPmButton->setText(rpl::single(entry->switchPmText)); _switchPmStartToken = entry->switchPmStartToken; diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp index dae73e530..2558f7969 100644 --- a/Telegram/SourceFiles/intro/introcode.cpp +++ b/Telegram/SourceFiles/intro/introcode.cpp @@ -91,7 +91,7 @@ CodeWidget::CodeWidget( connect(_code, SIGNAL(changed()), this, SLOT(onInputChange())); connect(_callTimer, SIGNAL(timeout()), this, SLOT(onSendCall())); connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest())); - connect(_noTelegramCode, SIGNAL(clicked()), this, SLOT(onNoTelegramCode())); + _noTelegramCode->addClickHandler([=] { onNoTelegramCode(); }); _code->setDigitsCountMax(getData()->codeLength); setErrorBelowLink(true); diff --git a/Telegram/SourceFiles/intro/intropwdcheck.cpp b/Telegram/SourceFiles/intro/intropwdcheck.cpp index f6d1728a6..801f207cb 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.cpp +++ b/Telegram/SourceFiles/intro/intropwdcheck.cpp @@ -41,8 +41,8 @@ PwdCheckWidget::PwdCheckWidget( subscribe(Lang::Current().updated(), [this] { refreshLang(); }); connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest())); - connect(_toRecover, SIGNAL(clicked()), this, SLOT(onToRecover())); - connect(_toPassword, SIGNAL(clicked()), this, SLOT(onToPassword())); + _toRecover->addClickHandler([=] { onToRecover(); }); + _toPassword->addClickHandler([=] { onToPassword(); }); connect(_pwdField, SIGNAL(changed()), this, SLOT(onInputChange())); connect(_codeField, SIGNAL(changed()), this, SLOT(onInputChange())); diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index 82638a84a..b94dd770a 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -313,9 +313,9 @@ OverlayWidget::OverlayWidget() _controlsHideTimer.setSingleShot(true); connect(&_controlsHideTimer, SIGNAL(timeout()), this, SLOT(onHideControls())); - connect(_docDownload, SIGNAL(clicked()), this, SLOT(onDownload())); - connect(_docSaveAs, SIGNAL(clicked()), this, SLOT(onSaveAs())); - connect(_docCancel, SIGNAL(clicked()), this, SLOT(onSaveCancel())); + _docDownload->addClickHandler([=] { onDownload(); }); + _docSaveAs->addClickHandler([=] { onSaveAs(); }); + _docCancel->addClickHandler([=] { onSaveCancel(); }); _dropdown->setHiddenCallback([this] { dropdownHidden(); }); _dropdownShowTimer->setSingleShot(true); diff --git a/Telegram/SourceFiles/mtproto/facade.h b/Telegram/SourceFiles/mtproto/facade.h index 6e7ca6e2f..cffb33584 100644 --- a/Telegram/SourceFiles/mtproto/facade.h +++ b/Telegram/SourceFiles/mtproto/facade.h @@ -13,36 +13,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace MTP { namespace internal { -bool paused(); +[[nodiscard]] bool paused(); void pause(); void unpause(); } // namespace internal -class PauseHolder { -public: - PauseHolder() { - restart(); - } - void restart() { - if (!std::exchange(_paused, true)) { - internal::pause(); - } - } - void release() { - if (std::exchange(_paused, false)) { - internal::unpause(); - } - } - ~PauseHolder() { - release(); - } - -private: - bool _paused = false; - -}; - // send(MTPhelp_GetConfig(), MTP::configDcId(dc)) - for dc enumeration constexpr ShiftedDcId configDcId(DcId dcId) { return ShiftDcId(dcId, kConfigDcShift); diff --git a/Telegram/SourceFiles/profile/profile_back_button.cpp b/Telegram/SourceFiles/profile/profile_back_button.cpp index d18bf5f95..709026c6f 100644 --- a/Telegram/SourceFiles/profile/profile_back_button.cpp +++ b/Telegram/SourceFiles/profile/profile_back_button.cpp @@ -46,7 +46,7 @@ void BackButton::paintEvent(QPaintEvent *e) { void BackButton::onStateChanged(State was, StateChangeSource source) { if (isDown() && !(was & StateFlag::Down)) { - emit clicked(); + clicked(Qt::KeyboardModifiers(), Qt::LeftButton); } } diff --git a/Telegram/SourceFiles/profile/profile_block_widget.h b/Telegram/SourceFiles/profile/profile_block_widget.h index 1d86bda52..ec593cac0 100644 --- a/Telegram/SourceFiles/profile/profile_block_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_widget.h @@ -38,9 +38,7 @@ protected: int resizeGetHeight(int newWidth) override = 0; void contentSizeUpdated() { - auto oldHeight = height(); resizeToWidth(width()); - emit heightUpdated(); } PeerData *peer() const { diff --git a/Telegram/SourceFiles/ui/abstract_button.cpp b/Telegram/SourceFiles/ui/abstract_button.cpp index 165b1a9ea..a2505c103 100644 --- a/Telegram/SourceFiles/ui/abstract_button.cpp +++ b/Telegram/SourceFiles/ui/abstract_button.cpp @@ -7,8 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "ui/abstract_button.h" -#include "core/application.h" #include "ui/ui_utility.h" +#include "ui/ui_integration.h" + +#include #include #include @@ -71,28 +73,33 @@ void AbstractButton::mouseReleaseEvent(QMouseEvent *e) { const auto was = _state; _state &= ~State(StateFlag::Down); - auto weak = MakeWeak(this); + const auto weak = MakeWeak(this); onStateChanged(was, StateChangeSource::ByPress); if (!weak) { return; } if (was & StateFlag::Over) { - _modifiers = e->modifiers(); - if (const auto callback = _clickedCallback) { - callback(); - } else { - emit clicked(); - } - if (weak) { - _clicks.fire(e->button()); - } + clicked(e->modifiers(), e->button()); } else { setOver(false, StateChangeSource::ByHover); } } } +void AbstractButton::clicked( + Qt::KeyboardModifiers modifiers, + Qt::MouseButton button) { + _modifiers = modifiers; + const auto weak = MakeWeak(this); + if (const auto callback = _clickedCallback) { + callback(); + } + if (weak) { + _clicks.fire_copy(button); + } +} + void AbstractButton::setPointerCursor(bool enablePointerCursor) { if (_enablePointerCursor != enablePointerCursor) { _enablePointerCursor = enablePointerCursor; @@ -104,12 +111,12 @@ void AbstractButton::setOver(bool over, StateChangeSource source) { if (over && !(_state & StateFlag::Over)) { auto was = _state; _state |= StateFlag::Over; - Core::App().registerLeaveSubscription(this); + RegisterLeaveSubscription(this); onStateChanged(was, source); } else if (!over && (_state & StateFlag::Over)) { auto was = _state; _state &= ~State(StateFlag::Over); - Core::App().unregisterLeaveSubscription(this); + UnregisterLeaveSubscription(this); onStateChanged(was, source); } updateCursor(); diff --git a/Telegram/SourceFiles/ui/abstract_button.h b/Telegram/SourceFiles/ui/abstract_button.h index 5ad37964d..0bc7236d7 100644 --- a/Telegram/SourceFiles/ui/abstract_button.h +++ b/Telegram/SourceFiles/ui/abstract_button.h @@ -14,8 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { class AbstractButton : public RpWidget { - Q_OBJECT - public: AbstractButton(QWidget *parent); @@ -61,9 +59,6 @@ protected: void mouseMoveEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; -signals: - void clicked(); - protected: enum class StateFlag { None = 0, @@ -88,6 +83,8 @@ protected: virtual void onStateChanged(State was, StateChangeSource source) { } + void clicked(Qt::KeyboardModifiers modifiers, Qt::MouseButton button); + private: void updateCursor(); void checkIfOver(QPoint localPos); diff --git a/Telegram/SourceFiles/ui/effects/animation_value.cpp b/Telegram/SourceFiles/ui/effects/animation_value.cpp index 2cdebadd3..aa45cc0a8 100644 --- a/Telegram/SourceFiles/ui/effects/animation_value.cpp +++ b/Telegram/SourceFiles/ui/effects/animation_value.cpp @@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "ui/effects/animation_value.h" +#include "ui/painter.h" + +#include // M_PI + namespace anim { namespace { diff --git a/Telegram/SourceFiles/ui/effects/animation_value.h b/Telegram/SourceFiles/ui/effects/animation_value.h index 93eaf9b08..2d822eb33 100644 --- a/Telegram/SourceFiles/ui/effects/animation_value.h +++ b/Telegram/SourceFiles/ui/effects/animation_value.h @@ -7,6 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once +#include "base/basic_types.h" + +#include "ui/style/style_core.h" + namespace anim { enum class type { diff --git a/Telegram/SourceFiles/ui/effects/animations.cpp b/Telegram/SourceFiles/ui/effects/animations.cpp index c493aadfc..262c70ae2 100644 --- a/Telegram/SourceFiles/ui/effects/animations.cpp +++ b/Telegram/SourceFiles/ui/effects/animations.cpp @@ -8,7 +8,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animations.h" #include "ui/ui_utility.h" -#include "core/application.h" +#include "base/invoke_queued.h" + +#include + +#include +#include +#include +#include +#include +#include namespace Ui { namespace Animations { @@ -17,19 +26,25 @@ namespace { constexpr auto kAnimationTick = crl::time(1000) / 120; constexpr auto kIgnoreUpdatesTimeout = crl::time(4); +Manager *ManagerInstance = nullptr; + } // namespace void Basic::start() { + Expects(ManagerInstance != nullptr); + if (animating()) { restart(); } else { - Core::App().animationManager().start(this); + ManagerInstance->start(this); } } void Basic::stop() { + Expects(ManagerInstance != nullptr); + if (animating()) { - Core::App().animationManager().stop(this); + ManagerInstance->stop(this); } } @@ -56,6 +71,10 @@ void Basic::markStopped() { } Manager::Manager() { + Expects(ManagerInstance == nullptr); + + ManagerInstance = this; + crl::on_main_update_requests( ) | rpl::filter([=] { return (_lastUpdateTime + kIgnoreUpdatesTimeout < crl::now()); @@ -64,6 +83,14 @@ Manager::Manager() { }, _lifetime); } +Manager::~Manager() { + Expects(ManagerInstance == this); + Expects(_active.empty()); + Expects(_starting.empty()); + + ManagerInstance = nullptr; +} + void Manager::start(not_null animation) { _forceImmediateUpdate = true; if (_updating) { diff --git a/Telegram/SourceFiles/ui/effects/animations.h b/Telegram/SourceFiles/ui/effects/animations.h index 2b7e14750..6c9b16336 100644 --- a/Telegram/SourceFiles/ui/effects/animations.h +++ b/Telegram/SourceFiles/ui/effects/animations.h @@ -9,6 +9,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animation_value.h" +#include +#include + namespace Ui { namespace Animations { @@ -69,6 +72,32 @@ public: [[nodiscard]] float64 value(float64 final) const; private: + class ShortTracker { + public: + ShortTracker() { + restart(); + } + ShortTracker(const ShortTracker &other) = delete; + ShortTracker &operator=(const ShortTracker &other) = delete; + ~ShortTracker() { + release(); + } + void restart() { + if (!std::exchange(_paused, true)) { + style::internal::StartShortAnimation(); + } + } + void release() { + if (std::exchange(_paused, false)) { + style::internal::StopShortAnimation(); + } + } + + private: + bool _paused = false; + + }; + struct Data { explicit Data(float64 initial) : value(initial) { } @@ -85,7 +114,7 @@ private: float64 value = 0.; float64 duration = 0.; bool *markOnDelete = nullptr; - MTP::PauseHolder pause; + ShortTracker tracker; }; template @@ -106,6 +135,7 @@ private: class Manager final : private QObject { public: Manager(); + ~Manager(); void update(); @@ -326,7 +356,7 @@ inline void Simple::start( if (!deleted) { that->markOnDelete = nullptr; if (!result) { - that->pause.release(); + that->tracker.release(); } } return result; @@ -349,10 +379,10 @@ inline void Simple::prepare(float64 from, crl::time duration) { if (!_data) { _data = std::make_unique(from); } else if (!isLong) { - _data->pause.restart(); + _data->tracker.restart(); } if (isLong) { - _data->pause.release(); + _data->tracker.release(); } } diff --git a/Telegram/SourceFiles/ui/effects/cross_animation.cpp b/Telegram/SourceFiles/ui/effects/cross_animation.cpp index 07c6a3693..7affa71ab 100644 --- a/Telegram/SourceFiles/ui/effects/cross_animation.cpp +++ b/Telegram/SourceFiles/ui/effects/cross_animation.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/cross_animation.h" #include "ui/effects/animation_value.h" +#include "ui/painter.h" namespace Ui { namespace { diff --git a/Telegram/SourceFiles/ui/effects/cross_animation.h b/Telegram/SourceFiles/ui/effects/cross_animation.h index 3492a7646..b2b5eb069 100644 --- a/Telegram/SourceFiles/ui/effects/cross_animation.h +++ b/Telegram/SourceFiles/ui/effects/cross_animation.h @@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_widgets.h" +class Painter; + namespace Ui { class CrossAnimation { diff --git a/Telegram/SourceFiles/ui/effects/ripple_animation.h b/Telegram/SourceFiles/ui/effects/ripple_animation.h index 5734efecf..f7e0403e2 100644 --- a/Telegram/SourceFiles/ui/effects/ripple_animation.h +++ b/Telegram/SourceFiles/ui/effects/ripple_animation.h @@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_widgets.h" +#include + namespace Ui { class RippleAnimation { diff --git a/Telegram/SourceFiles/ui/rp_widget.cpp b/Telegram/SourceFiles/ui/rp_widget.cpp index 650f80c04..7ec4b423a 100644 --- a/Telegram/SourceFiles/ui/rp_widget.cpp +++ b/Telegram/SourceFiles/ui/rp_widget.cpp @@ -7,9 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "ui/rp_widget.h" -#include "core/qt_signal_producer.h" +#include "base/qt_signal_producer.h" #include +#include namespace Ui { @@ -89,7 +90,7 @@ rpl::producer<> RpWidgetMethods::windowDeactivateEvents() const { const auto window = callGetWidget()->window()->windowHandle(); Assert(window != nullptr); - return Core::QtSignalProducer( + return base::qt_signal_producer( window, &QWindow::activeChanged ) | rpl::filter([=] { diff --git a/Telegram/SourceFiles/ui/rp_widget.h b/Telegram/SourceFiles/ui/rp_widget.h index 6109e4baf..147f74a07 100644 --- a/Telegram/SourceFiles/ui/rp_widget.h +++ b/Telegram/SourceFiles/ui/rp_widget.h @@ -15,6 +15,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include +#include + class TWidget; template @@ -49,13 +52,13 @@ public: auto margins = getMargins(); x -= margins.left(); y -= margins.top(); - Base::move(rtl() ? ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - Base::width()) : x, y); + Base::move(style::RightToLeft() ? ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - Base::width()) : x, y); } void moveToRight(int x, int y, int outerw = 0) { auto margins = getMargins(); x -= margins.right(); y -= margins.top(); - Base::move(rtl() ? x : ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - Base::width()), y); + Base::move(style::RightToLeft() ? x : ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - Base::width()), y); } void setGeometryToLeft(int x, int y, int w, int h, int outerw = 0) { auto margins = getMargins(); @@ -63,7 +66,7 @@ public: y -= margins.top(); w -= margins.left() - margins.right(); h -= margins.top() - margins.bottom(); - Base::setGeometry(rtl() ? ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - w) : x, y, w, h); + Base::setGeometry(style::RightToLeft() ? ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - w) : x, y, w, h); } void setGeometryToRight(int x, int y, int w, int h, int outerw = 0) { auto margins = getMargins(); @@ -71,7 +74,7 @@ public: y -= margins.top(); w -= margins.left() - margins.right(); h -= margins.top() - margins.bottom(); - Base::setGeometry(rtl() ? x : ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - w), y, w, h); + Base::setGeometry(style::RightToLeft() ? x : ((outerw > 0 ? outerw : Base::parentWidget()->width()) - x - w), y, w, h); } QPoint myrtlpoint(int x, int y) const { return style::rtlpoint(x, y, Base::width()); @@ -204,14 +207,10 @@ public: void setVisibleTopBottom(int visibleTop, int visibleBottom) { auto max = height(); visibleTopBottomUpdated( - snap(visibleTop, 0, max), - snap(visibleBottom, 0, max)); + std::clamp(visibleTop, 0, max), + std::clamp(visibleBottom, 0, max)); } -signals: - // Child widget is responsible for emitting this signal. - void heightUpdated(); - protected: void setChildVisibleTopBottom( TWidget *child, diff --git a/Telegram/SourceFiles/ui/style/style_core.cpp b/Telegram/SourceFiles/ui/style/style_core.cpp index 3ee7635ed..bb46cffb4 100644 --- a/Telegram/SourceFiles/ui/style/style_core.cpp +++ b/Telegram/SourceFiles/ui/style/style_core.cpp @@ -14,6 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include +#include +#include + namespace style { namespace internal { namespace { @@ -22,8 +25,9 @@ constexpr auto kMinContrastAlpha = 64; constexpr auto kMinContrastDistance = 64 * 64 * 4; constexpr auto kContrastDeltaL = 64; -int DevicePixelRatioValue = 1; -bool RightToLeftValue = false; +auto PaletteChanges = rpl::event_stream<>(); +auto ShortAnimationRunning = rpl::variable(false); +auto RunningShortAnimations = 0; std::vector &StyleModules() { static auto result = std::vector(); @@ -42,14 +46,30 @@ void registerModule(ModuleBase *module) { StyleModules().push_back(module); } -} // namespace internal - -bool RightToLeft() { - return internal::RightToLeftValue; +void StartShortAnimation() { + if (++RunningShortAnimations == 1) { + ShortAnimationRunning = true; + } } -void SetRightToLeft(bool rtl) { - internal::RightToLeftValue = rtl; +void StopShortAnimation() { + if (--RunningShortAnimations == 0) { + ShortAnimationRunning = false; + } +} + +} // namespace internal + +rpl::producer<> PaletteChanged() { + return internal::PaletteChanges.events(); +} + +void NotifyPaletteChanged() { + internal::PaletteChanges.fire({}); +} + +rpl::producer ShortAnimationPlaying() { + return internal::ShortAnimationRunning.value(); } void startManager(int scale) { diff --git a/Telegram/SourceFiles/ui/style/style_core.h b/Telegram/SourceFiles/ui/style/style_core.h index 506376f27..6503fa72c 100644 --- a/Telegram/SourceFiles/ui/style/style_core.h +++ b/Telegram/SourceFiles/ui/style/style_core.h @@ -11,6 +11,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/style/style_core_types.h" #include "ui/style/style_core_direction.h" +#include + namespace style { namespace internal { @@ -26,17 +28,22 @@ public: void registerModule(ModuleBase *module); -// This method is implemented in palette.cpp (codegen). -bool setPaletteColor(QLatin1String name, uchar r, uchar g, uchar b, uchar a); - [[nodiscard]] QColor EnsureContrast(const QColor &over, const QColor &under); void EnsureContrast(ColorData &over, const ColorData &under); +void StartShortAnimation(); +void StopShortAnimation(); + } // namespace internal void startManager(int scale); void stopManager(); +[[nodiscard]] rpl::producer<> PaletteChanged(); +void NotifyPaletteChanged(); + +[[nodiscard]] rpl::producer ShortAnimationPlaying(); + // *outResult must be r.width() x r.height(), ARGB32_Premultiplied. // QRect(0, 0, src.width(), src.height()) must contain r. void colorizeImage(const QImage &src, QColor c, QImage *outResult, QRect srcRect = QRect(), QPoint dstPoint = QPoint(0, 0)); diff --git a/Telegram/SourceFiles/ui/style/style_core_direction.cpp b/Telegram/SourceFiles/ui/style/style_core_direction.cpp new file mode 100644 index 000000000..8627f7e30 --- /dev/null +++ b/Telegram/SourceFiles/ui/style/style_core_direction.cpp @@ -0,0 +1,25 @@ +/* +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 "ui/style/style_core_direction.h" + +namespace style { +namespace { + +bool RightToLeftValue = false; + +} // namespace + +bool RightToLeft() { + return RightToLeftValue; +} + +void SetRightToLeft(bool rtl) { + RightToLeftValue = rtl; +} + +} // namespace style diff --git a/Telegram/SourceFiles/ui/ui_integration.h b/Telegram/SourceFiles/ui/ui_integration.h new file mode 100644 index 000000000..8a3c33b74 --- /dev/null +++ b/Telegram/SourceFiles/ui/ui_integration.h @@ -0,0 +1,20 @@ +/* +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 + +#include "base/basic_types.h" + +// Methods that must be implemented outside lib_ui. + +namespace Ui { + +void PostponeCall(FnMut &&callable); +void RegisterLeaveSubscription(not_null widget); +void UnregisterLeaveSubscription(not_null widget); + +} // namespace Ui diff --git a/Telegram/SourceFiles/ui/ui_pch.h b/Telegram/SourceFiles/ui/ui_pch.h index 6e9250541..5210fd835 100644 --- a/Telegram/SourceFiles/ui/ui_pch.h +++ b/Telegram/SourceFiles/ui/ui_pch.h @@ -19,3 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include + +#include +#include diff --git a/Telegram/SourceFiles/ui/ui_utility.h b/Telegram/SourceFiles/ui/ui_utility.h index c1c613de3..18f47e23b 100644 --- a/Telegram/SourceFiles/ui/ui_utility.h +++ b/Telegram/SourceFiles/ui/ui_utility.h @@ -8,6 +8,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "base/unique_qptr.h" +#include "ui/ui_integration.h" + +#include template class object_ptr; @@ -134,9 +137,6 @@ void RenderWidget( void ForceFullRepaint(not_null widget); -// Must be implemented outside lib_ui. -void PostponeCall(FnMut &&callable); - template < typename Guard, typename Callable, diff --git a/Telegram/SourceFiles/ui/widgets/buttons.cpp b/Telegram/SourceFiles/ui/widgets/buttons.cpp index 440651159..5768f4314 100644 --- a/Telegram/SourceFiles/ui/widgets/buttons.cpp +++ b/Telegram/SourceFiles/ui/widgets/buttons.cpp @@ -11,9 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/cross_animation.h" #include "ui/effects/numbers_animation.h" #include "ui/image/image_prepare.h" -#include "window/themes/window_theme.h" -#include "lang/lang_instance.h" -#include "app.h" +#include "ui/painter.h" namespace Ui { @@ -91,13 +89,11 @@ void RippleButton::setForceRippled( if (_forceRippled != rippled) { _forceRippled = rippled; if (_forceRippled) { - _forceRippledSubscription = base::ObservableViewer( - *Window::Theme::Background() - ) | rpl::start_with_next([=]( - const Window::Theme::BackgroundUpdate &update) { - if (update.paletteChanged() && _ripple) { - _ripple->forceRepaint(); - } + _forceRippledSubscription = style::PaletteChanged( + ) | rpl::filter([=] { + return _ripple != nullptr; + }) | rpl::start_with_next([=] { + _ripple->forceRepaint(); }); ensureRipple(); if (_ripple->empty()) { @@ -350,7 +346,12 @@ void RoundButton::paintEvent(QPaintEvent *e) { p.setBrush(color); p.drawRoundedRect(fill, radius, radius); } else { - App::roundRect(p, fill, color, ImageRoundRadius::Small); + PainterHighQualityEnabler hq(p); + p.setPen(Qt::NoPen); + p.setBrush(color); + p.drawRoundedRect(fill, st::buttonRadius, st::buttonRadius); + // #TODO ui + //App::roundRect(p, fill, color, ImageRoundRadius::Small); } }; drawRect(_st.textBg); diff --git a/Telegram/SourceFiles/ui/widgets/buttons.h b/Telegram/SourceFiles/ui/widgets/buttons.h index 337187529..6b148917b 100644 --- a/Telegram/SourceFiles/ui/widgets/buttons.h +++ b/Telegram/SourceFiles/ui/widgets/buttons.h @@ -101,7 +101,7 @@ private: }; -class RoundButton : public RippleButton, private base::Subscriber { +class RoundButton : public RippleButton { public: RoundButton( QWidget *parent, diff --git a/Telegram/SourceFiles/ui/widgets/dropdown_menu.cpp b/Telegram/SourceFiles/ui/widgets/dropdown_menu.cpp index 46cf75c1e..28404ed0f 100644 --- a/Telegram/SourceFiles/ui/widgets/dropdown_menu.cpp +++ b/Telegram/SourceFiles/ui/widgets/dropdown_menu.cpp @@ -13,7 +13,7 @@ namespace Ui { DropdownMenu::DropdownMenu(QWidget *parent, const style::DropdownMenu &st) : InnerDropdown(parent, st.wrap) , _st(st) { - _menu = setOwnedWidget(object_ptr(this, _st.menu)); + _menu = setOwnedWidget(object_ptr(this, _st.menu)); init(); } diff --git a/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp b/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp index 5848d6e9f..0a49428a7 100644 --- a/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp +++ b/Telegram/SourceFiles/ui/widgets/inner_dropdown.cpp @@ -52,10 +52,18 @@ InnerDropdown::InnerDropdown( }, lifetime()); } -QPointer InnerDropdown::doSetOwnedWidget(object_ptr widget) { - auto result = QPointer(widget); - connect(widget, SIGNAL(heightUpdated()), this, SLOT(onWidgetHeightUpdated())); - auto container = _scroll->setOwnedWidget(object_ptr(_scroll, std::move(widget), _st)); +QPointer InnerDropdown::doSetOwnedWidget( + object_ptr widget) { + auto result = QPointer(widget); + widget->heightValue( + ) | rpl::skip(1) | rpl::start_with_next([=] { + resizeToContent(); + }, widget->lifetime()); + auto container = _scroll->setOwnedWidget( + object_ptr( + _scroll, + std::move(widget), + _st)); container->resizeToWidth(_scroll->width()); container->moveToLeft(0, 0); container->show(); diff --git a/Telegram/SourceFiles/ui/widgets/inner_dropdown.h b/Telegram/SourceFiles/ui/widgets/inner_dropdown.h index e57d29d21..9c6fffccc 100644 --- a/Telegram/SourceFiles/ui/widgets/inner_dropdown.h +++ b/Telegram/SourceFiles/ui/widgets/inner_dropdown.h @@ -86,12 +86,9 @@ private slots: hideAnimated(); } void onScroll(); - void onWidgetHeightUpdated() { - resizeToContent(); - } private: - QPointer doSetOwnedWidget(object_ptr widget); + QPointer doSetOwnedWidget(object_ptr widget); QImage grabForPanelAnimation(); void startShowAnimation(); void startOpacityAnimation(bool hiding); diff --git a/Telegram/SourceFiles/ui/widgets/menu.cpp b/Telegram/SourceFiles/ui/widgets/menu.cpp index 69f317338..f658f039f 100644 --- a/Telegram/SourceFiles/ui/widgets/menu.cpp +++ b/Telegram/SourceFiles/ui/widgets/menu.cpp @@ -24,14 +24,16 @@ struct Menu::ActionData { bool hasSubmenu = false; }; -Menu::Menu(QWidget *parent, const style::Menu &st) : TWidget(parent) +Menu::Menu(QWidget *parent, const style::Menu &st) +: RpWidget(parent) , _st(st) , _itemHeight(_st.itemPadding.top() + _st.itemStyle.font->height + _st.itemPadding.bottom()) , _separatorHeight(_st.separatorPadding.top() + _st.separatorWidth + _st.separatorPadding.bottom()) { init(); } -Menu::Menu(QWidget *parent, QMenu *menu, const style::Menu &st) : TWidget(parent) +Menu::Menu(QWidget *parent, QMenu *menu, const style::Menu &st) +: RpWidget(parent) , _st(st) , _wappedMenu(menu) , _itemHeight(_st.itemPadding.top() + _st.itemStyle.font->height + _st.itemPadding.bottom()) @@ -68,7 +70,9 @@ not_null Menu::addAction(const QString &text, Fn callback, con } not_null Menu::addAction(not_null action, const style::icon *icon, const style::icon *iconOver) { - connect(action, SIGNAL(changed()), this, SLOT(actionChanged())); + connect(action, &QAction::changed, this, [=] { + actionChanged(); + }); _actions.emplace_back(action); _actionsData.push_back([&] { auto data = ActionData(); diff --git a/Telegram/SourceFiles/ui/widgets/menu.h b/Telegram/SourceFiles/ui/widgets/menu.h index aa845547f..1b47bc71e 100644 --- a/Telegram/SourceFiles/ui/widgets/menu.h +++ b/Telegram/SourceFiles/ui/widgets/menu.h @@ -17,9 +17,7 @@ namespace Ui { class ToggleView; class RippleAnimation; -class Menu : public TWidget { - Q_OBJECT - +class Menu : public RpWidget { public: Menu(QWidget *parent, const style::Menu &st = st::defaultMenu); Menu(QWidget *parent, QMenu *menu, const style::Menu &st = st::defaultMenu); @@ -85,13 +83,11 @@ protected: void enterEventHook(QEvent *e) override; void leaveEventHook(QEvent *e) override; -private slots: - void actionChanged(); - private: struct ActionData; void updateSelected(QPoint globalPosition); + void actionChanged(); void init(); // Returns the new width. diff --git a/Telegram/SourceFiles/ui/widgets/tooltip.cpp b/Telegram/SourceFiles/ui/widgets/tooltip.cpp index c12a48181..df65d32b6 100644 --- a/Telegram/SourceFiles/ui/widgets/tooltip.cpp +++ b/Telegram/SourceFiles/ui/widgets/tooltip.cpp @@ -9,12 +9,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "platform/platform_specific.h" -#include "core/qt_signal_producer.h" #include "ui/ui_utility.h" #include "app.h" #include "styles/style_widgets.h" -#include +#include #include namespace Ui { diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 46846aac1..dd7942825 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -519,6 +519,12 @@ ChatBackground::ChatBackground() : _adjustableColors({ st::historyScrollBarBg, st::historyScrollBarBgOver }) { saveAdjustableColors(); + + subscribe(this, [=](const BackgroundUpdate &update) { + if (update.paletteChanged()) { + style::NotifyPaletteChanged(); + } + }); } void ChatBackground::setThemeData(QImage &&themeImage, bool themeTile) { diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index 03cf569b3..9638ee822 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/localstorage.h" #include "support/support_templates.h" #include "settings/settings_common.h" -#include "core/qt_signal_producer.h" +#include "base/qt_signal_producer.h" #include "boxes/about_box.h" #include "boxes/peer_list_controllers.h" #include "calls/calls_box_controller.h" @@ -469,7 +469,7 @@ void MainMenu::initResetScaleButton() { rpl::single( handle->screen() ) | rpl::then( - Core::QtSignalProducer(handle, &QWindow::screenChanged) + base::qt_signal_producer(handle, &QWindow::screenChanged) ) | rpl::filter([](QScreen *screen) { return screen != nullptr; }) | rpl::map([](QScreen * screen) { @@ -477,9 +477,9 @@ void MainMenu::initResetScaleButton() { screen->availableGeometry() ) | rpl::then( #ifdef OS_MAC_OLD - Core::QtSignalProducer(screen, &QScreen::virtualGeometryChanged) + base::qt_signal_producer(screen, &QScreen::virtualGeometryChanged) #else // OS_MAC_OLD - Core::QtSignalProducer(screen, &QScreen::availableGeometryChanged) + base::qt_signal_producer(screen, &QScreen::availableGeometryChanged) #endif // OS_MAC_OLD ); }) | rpl::flatten_latest( diff --git a/Telegram/gyp/lib_base.gyp b/Telegram/gyp/lib_base.gyp index 30a3289ee..8e27be40c 100644 --- a/Telegram/gyp/lib_base.gyp +++ b/Telegram/gyp/lib_base.gyp @@ -45,6 +45,7 @@ 'sources': [ '<(src_loc)/base/algorithm.h', '<(src_loc)/base/assertion.h', + '<(src_loc)/base/base_integration.h', '<(src_loc)/base/basic_types.h', '<(src_loc)/base/binary_guard.h', '<(src_loc)/base/build_config.h', @@ -72,6 +73,7 @@ '<(src_loc)/base/qthelp_regex.h', '<(src_loc)/base/qthelp_url.cpp', '<(src_loc)/base/qthelp_url.h', + '<(src_loc)/base/qt_signal_producer.h', '<(src_loc)/base/runtime_composer.cpp', '<(src_loc)/base/runtime_composer.h', '<(src_loc)/base/thread_safe_wrap.h', diff --git a/Telegram/gyp/lib_ui.gyp b/Telegram/gyp/lib_ui.gyp index 375b86cb8..baea31c78 100644 --- a/Telegram/gyp/lib_ui.gyp +++ b/Telegram/gyp/lib_ui.gyp @@ -15,7 +15,6 @@ 'includes': [ 'common.gypi', 'qt.gypi', - 'qt_moc.gypi', 'codegen_styles_rule.gypi', 'codegen_rules_ui.gypi', 'pch.gypi', @@ -59,10 +58,16 @@ ], 'sources': [ '<@(style_files)', + '<(src_loc)/ui/effects/animation_value.cpp', + '<(src_loc)/ui/effects/animation_value.h', + '<(src_loc)/ui/effects/animations.cpp', + '<(src_loc)/ui/effects/animations.h', '<(src_loc)/ui/style/style_core.cpp', '<(src_loc)/ui/style/style_core.h', '<(src_loc)/ui/style/style_core_color.cpp', '<(src_loc)/ui/style/style_core_color.h', + '<(src_loc)/ui/style/style_core_direction.cpp', + '<(src_loc)/ui/style/style_core_direction.h', '<(src_loc)/ui/style/style_core_font.cpp', '<(src_loc)/ui/style/style_core_font.h', '<(src_loc)/ui/style/style_core_icon.cpp', @@ -71,7 +76,13 @@ '<(src_loc)/ui/style/style_core_scale.h', '<(src_loc)/ui/style/style_core_types.cpp', '<(src_loc)/ui/style/style_core_types.h', + '<(src_loc)/ui/widgets/buttons.cpp', + '<(src_loc)/ui/widgets/buttons.h', + '<(src_loc)/ui/abstract_button.cpp', + '<(src_loc)/ui/abstract_button.h', '<(src_loc)/ui/painter.h', + '<(src_loc)/ui/ui_integration.h', + '<(src_loc)/ui/ui_utility.h', '<(emoji_suggestions_loc)/emoji_suggestions.cpp', '<(emoji_suggestions_loc)/emoji_suggestions.h', ], diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt index f025fc642..071ce4ead 100644 --- a/Telegram/gyp/telegram_sources.txt +++ b/Telegram/gyp/telegram_sources.txt @@ -164,7 +164,6 @@ <(src_loc)/core/media_active_cache.h <(src_loc)/core/mime_type.cpp <(src_loc)/core/mime_type.h -<(src_loc)/core/qt_signal_producer.h <(src_loc)/core/sandbox.cpp <(src_loc)/core/sandbox.h <(src_loc)/core/shortcuts.cpp @@ -736,10 +735,6 @@ <(src_loc)/support/support_helper.h <(src_loc)/support/support_templates.cpp <(src_loc)/support/support_templates.h -<(src_loc)/ui/effects/animation_value.cpp -<(src_loc)/ui/effects/animation_value.h -<(src_loc)/ui/effects/animations.cpp -<(src_loc)/ui/effects/animations.h <(src_loc)/ui/effects/cross_animation.cpp <(src_loc)/ui/effects/cross_animation.h <(src_loc)/ui/effects/fade_animation.cpp @@ -781,8 +776,6 @@ <(src_loc)/ui/toast/toast_manager.h <(src_loc)/ui/toast/toast_widget.cpp <(src_loc)/ui/toast/toast_widget.h -<(src_loc)/ui/widgets/buttons.cpp -<(src_loc)/ui/widgets/buttons.h <(src_loc)/ui/widgets/checkbox.cpp <(src_loc)/ui/widgets/checkbox.h <(src_loc)/ui/widgets/continuous_sliders.cpp @@ -822,8 +815,6 @@ <(src_loc)/ui/wrap/vertical_layout.cpp <(src_loc)/ui/wrap/vertical_layout.h <(src_loc)/ui/wrap/wrap.h -<(src_loc)/ui/abstract_button.cpp -<(src_loc)/ui/abstract_button.h <(src_loc)/ui/countryinput.cpp <(src_loc)/ui/countryinput.h <(src_loc)/ui/emoji_config.cpp