diff --git a/Telegram/SourceFiles/boxes/create_poll_box.cpp b/Telegram/SourceFiles/boxes/create_poll_box.cpp index 3db3ab6b92..cdde0fc90e 100644 --- a/Telegram/SourceFiles/boxes/create_poll_box.cpp +++ b/Telegram/SourceFiles/boxes/create_poll_box.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_poll.h" #include "ui/toast/toast.h" #include "ui/wrap/vertical_layout.h" +#include "ui/wrap/slide_wrap.h" #include "ui/widgets/input_fields.h" #include "ui/widgets/shadow.h" #include "ui/widgets/labels.h" @@ -56,6 +57,9 @@ private: void toggleRemoveAlways(bool toggled); + void show(anim::type animated); + void destroy(FnMut done); + //[[nodisacrd]] bool hasShadow() const; //void destroyShadow(); @@ -75,6 +79,21 @@ private: [[nodiscard]] rpl::producer removeClicks() const; + inline bool operator<(const Option &other) const { + return field() < other.field(); + } + + friend inline bool operator<( + const Option &option, + Ui::InputField *field) { + return option.field() < field; + } + friend inline bool operator<( + Ui::InputField *field, + const Option &option) { + return field < option.field(); + } + private: Option() = default; @@ -82,7 +101,7 @@ private: void createRemove(); void createWarning(); - base::unique_qptr _field; + base::unique_qptr> _field; base::unique_qptr _shadow; base::unique_qptr _remove; rpl::variable *_removeAlways = nullptr; @@ -97,12 +116,15 @@ private: void checkLastOption(); void validateState(); void fixAfterErase(); + void destroy(Option &&option); + void removeDestroyed(not_null field); int findField(not_null field) const; not_null _outer; not_null _container; int _position = 0; std::vector