diff --git a/Telegram/Resources/basic.style b/Telegram/Resources/basic.style index 0724ccd9a..9bcfcb0c6 100644 --- a/Telegram/Resources/basic.style +++ b/Telegram/Resources/basic.style @@ -79,6 +79,7 @@ slideShift: 100px; slideShadow: icon {{ "slide_shadow", slideFadeOutShadowFg }}; slideWrapDuration: 150; +fadeWrapDuration: 200; linkCropLimit: 360px; linkFont: normalFont; diff --git a/Telegram/SourceFiles/auth_session.h b/Telegram/SourceFiles/auth_session.h index e6228a536..39236e8c6 100644 --- a/Telegram/SourceFiles/auth_session.h +++ b/Telegram/SourceFiles/auth_session.h @@ -240,7 +240,7 @@ public: AuthSessionData &data() { return _data; } - void saveDataDelayed(TimeMs delay); + void saveDataDelayed(TimeMs delay = kDefaultSaveDelay); ApiWrap &api() { return *_api; @@ -259,6 +259,8 @@ public: ~AuthSession(); private: + static constexpr auto kDefaultSaveDelay = TimeMs(1000); + const UserId _userId = 0; AuthSessionData _data; base::Timer _saveDataTimer; diff --git a/Telegram/SourceFiles/boxes/abstract_box.cpp b/Telegram/SourceFiles/boxes/abstract_box.cpp index e90ce2ee6..16918e381 100644 --- a/Telegram/SourceFiles/boxes/abstract_box.cpp +++ b/Telegram/SourceFiles/boxes/abstract_box.cpp @@ -24,10 +24,11 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "styles/style_profile.h" #include "storage/localstorage.h" #include "lang/lang_keys.h" -#include "ui/effects/widget_fade_wrap.h" #include "ui/widgets/buttons.h" #include "ui/widgets/scroll_area.h" #include "ui/widgets/labels.h" +#include "ui/widgets/shadow.h" +#include "ui/wrap/fade_wrap.h" #include "mainwidget.h" #include "mainwindow.h" @@ -53,8 +54,8 @@ void BoxContent::setInner(object_ptr inner, const style::ScrollArea &st _topShadow->raise(); _bottomShadow->raise(); } else { - _topShadow.create(this, object_ptr(this)); - _bottomShadow.create(this, object_ptr(this)); + _topShadow.create(this); + _bottomShadow.create(this); } if (!_preparing) { // We didn't set dimensions yet, this will be called from finishPrepare(); @@ -421,9 +422,6 @@ void AbstractBox::keyPressEvent(QKeyEvent *e) { } } -BoxLayerTitleShadow::BoxLayerTitleShadow(QWidget *parent) : Ui::PlainShadow(parent, st::boxLayerTitleShadow) { -} - BoxContentDivider::BoxContentDivider(QWidget *parent) : RpWidget(parent) { } diff --git a/Telegram/SourceFiles/boxes/abstract_box.h b/Telegram/SourceFiles/boxes/abstract_box.h index 3ea435e8d..07d0fb7c3 100644 --- a/Telegram/SourceFiles/boxes/abstract_box.h +++ b/Telegram/SourceFiles/boxes/abstract_box.h @@ -20,25 +20,26 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #pragma once -#include "layerwidget.h" +#include "window/layer_widget.h" #include "ui/rp_widget.h" -#include "ui/widgets/shadow.h" + +namespace style { +struct RoundButton; +struct ScrollArea; +} // namespace style namespace Ui { class RoundButton; class IconButton; class ScrollArea; class FlatLabel; -template -class WidgetFadeWrap; +class FadeShadow; } // namespace Ui namespace Window { class Controller; } // namespace Window -class BoxLayerTitleShadow; - class BoxContentDelegate { public: virtual Window::Controller *controller() const = 0; @@ -194,15 +195,18 @@ private: bool _noContentMargin = false; int _innerTopSkip = 0; object_ptr _scroll = { nullptr }; - object_ptr> _topShadow = { nullptr }; - object_ptr> _bottomShadow = { nullptr }; + object_ptr _topShadow = { nullptr }; + object_ptr _bottomShadow = { nullptr }; object_ptr _draggingScrollTimer = { nullptr }; int _draggingScrollDelta = 0; }; -class AbstractBox : public LayerWidget, public BoxContentDelegate, protected base::Subscriber { +class AbstractBox + : public Window::LayerWidget + , public BoxContentDelegate + , protected base::Subscriber { public: AbstractBox(QWidget *parent, Window::Controller *controller, object_ptr content); @@ -284,12 +288,6 @@ private: }; -class BoxLayerTitleShadow : public Ui::PlainShadow { -public: - BoxLayerTitleShadow(QWidget *parent); - -}; - class BoxContentDivider : public Ui::RpWidget { public: BoxContentDivider(QWidget *parent); diff --git a/Telegram/SourceFiles/boxes/add_contact_box.h b/Telegram/SourceFiles/boxes/add_contact_box.h index c49e8f14f..b4f8f0ca3 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.h +++ b/Telegram/SourceFiles/boxes/add_contact_box.h @@ -22,6 +22,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "boxes/abstract_box.h" #include "mtproto/sender.h" +#include "styles/style_widgets.h" class ConfirmBox; class PeerListBox; diff --git a/Telegram/SourceFiles/boxes/boxes.style b/Telegram/SourceFiles/boxes/boxes.style index dde60abd4..2fef37d8e 100644 --- a/Telegram/SourceFiles/boxes/boxes.style +++ b/Telegram/SourceFiles/boxes/boxes.style @@ -88,7 +88,6 @@ boxLayerTitlePosition: point(23px, 16px); boxLayerTitleHeight: 56px; boxLayerTitleAdditionalSkip: 9px; boxLayerTitleAdditionalFont: normalFont; -boxLayerTitleShadow: shadowFg; boxLayerScroll: defaultSolidScroll; boxTopMargin: 6px; diff --git a/Telegram/SourceFiles/boxes/change_phone_box.cpp b/Telegram/SourceFiles/boxes/change_phone_box.cpp index 60d79194a..3a97b8988 100644 --- a/Telegram/SourceFiles/boxes/change_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/change_phone_box.cpp @@ -24,25 +24,37 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "styles/style_boxes.h" #include "ui/widgets/labels.h" #include "ui/widgets/input_fields.h" -#include "ui/effects/widget_fade_wrap.h" +#include "ui/wrap/fade_wrap.h" #include "boxes/confirm_phone_box.h" #include "ui/toast/toast.h" #include "boxes/confirm_box.h" namespace { -void createErrorLabel(QWidget *parent, object_ptr> &label, const QString &text, int x, int y) { +void createErrorLabel( + QWidget *parent, + object_ptr> &label, + const QString &text, + int x, + int y) { if (label) { - auto errorFadeOut = std::move(label); - errorFadeOut->setUpdateCallback([label = errorFadeOut.data()] { - if (label->isHidden() || !label->animating()) { - label->deleteLater(); - } - }); - errorFadeOut->hideAnimated(); + label->hideAnimated(); + auto context = label.data(); + App::CallDelayed( + st::fadeWrapDuration, + context, + [old = std::move(label)]() mutable { + old.destroy(); + }); } if (!text.isEmpty()) { - label.create(parent, object_ptr(parent, text, Ui::FlatLabel::InitType::Simple, st::changePhoneError)); + label.create( + parent, + object_ptr( + parent, + text, + Ui::FlatLabel::InitType::Simple, + st::changePhoneError)); label->hideFast(); label->moveToLeft(x, y); label->showAnimated(); @@ -73,7 +85,7 @@ private: } object_ptr _phone = { nullptr }; - object_ptr> _error = { nullptr }; + object_ptr> _error = { nullptr }; mtpRequestId _requestId = 0; }; @@ -105,7 +117,7 @@ private: int _codeLength = 0; int _callTimeout = 0; object_ptr _code = { nullptr }; - object_ptr> _error = { nullptr }; + object_ptr> _error = { nullptr }; object_ptr _callLabel = { nullptr }; mtpRequestId _requestId = 0; SentCodeCall _call; diff --git a/Telegram/SourceFiles/boxes/peer_list_box.h b/Telegram/SourceFiles/boxes/peer_list_box.h index 79e432677..397749c52 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.h +++ b/Telegram/SourceFiles/boxes/peer_list_box.h @@ -28,6 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace style { struct PeerList; +struct PeerListItem; } // namespace style namespace Ui { diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index b35792391..ccb720251 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -34,6 +34,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "ui/widgets/buttons.h" #include "ui/widgets/labels.h" #include "ui/widgets/scroll_area.h" +#include "ui/widgets/shadow.h" #include "ui/effects/ripple_animation.h" #include "ui/effects/slide_animation.h" #include "ui/widgets/discrete_sliders.h" diff --git a/Telegram/SourceFiles/boxes/stickers_box.h b/Telegram/SourceFiles/boxes/stickers_box.h index 010517303..31685deea 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.h +++ b/Telegram/SourceFiles/boxes/stickers_box.h @@ -126,7 +126,7 @@ private: ChannelData *_megagroupSet = nullptr; std::unique_ptr _slideAnimation; - object_ptr _titleShadow = { nullptr }; + object_ptr _titleShadow = { nullptr }; mtpRequestId _archivedRequestId = 0; bool _archivedLoaded = false; @@ -303,7 +303,7 @@ private: MTPInputStickerSet _megagroupSetInput = MTP_inputStickerSetEmpty(); std::unique_ptr _megagroupSelectedSet; object_ptr _megagroupSetField = { nullptr }; - object_ptr _megagroupSelectedShadow = { nullptr }; + object_ptr _megagroupSelectedShadow = { nullptr }; object_ptr _megagroupSelectedRemove = { nullptr }; object_ptr _megagroupDivider = { nullptr }; object_ptr _megagroupSubTitle = { nullptr }; diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 507ba7d03..d4fa8f6ee 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -28,7 +28,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "ui/widgets/labels.h" #include "ui/widgets/shadow.h" #include "ui/effects/ripple_animation.h" -#include "ui/effects/widget_fade_wrap.h" +#include "ui/wrap/fade_wrap.h" #include "messenger.h" #include "mainwindow.h" #include "lang/lang_keys.h" @@ -245,11 +245,14 @@ Panel::Panel(not_null call) : _call(call) , _user(call->user()) , _answerHangupRedial(this, st::callAnswer, &st::callHangup) -, _decline(this, object_ptr