mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Enter selects from-row in reply-in-another-chat.
This commit is contained in:
parent
0045eb4598
commit
d157eb0b6e
3 changed files with 33 additions and 4 deletions
|
@ -474,7 +474,7 @@ void PeerListBox::addSelectItem(
|
||||||
void PeerListBox::addSelectItem(
|
void PeerListBox::addSelectItem(
|
||||||
uint64 itemId,
|
uint64 itemId,
|
||||||
const QString &text,
|
const QString &text,
|
||||||
Ui::MultiSelect::PaintRoundImage paintUserpic,
|
PaintRoundImageCallback paintUserpic,
|
||||||
anim::type animated) {
|
anim::type animated) {
|
||||||
if (!_select) {
|
if (!_select) {
|
||||||
createMultiSelect();
|
createMultiSelect();
|
||||||
|
@ -549,6 +549,10 @@ rpl::producer<int> PeerListBox::multiSelectHeightValue() const {
|
||||||
return _select ? _select->heightValue() : rpl::single(0);
|
return _select ? _select->heightValue() : rpl::single(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rpl::producer<> PeerListBox::noSearchSubmits() const {
|
||||||
|
return content()->noSearchSubmits();
|
||||||
|
}
|
||||||
|
|
||||||
PeerListRow::PeerListRow(not_null<PeerData*> peer)
|
PeerListRow::PeerListRow(not_null<PeerData*> peer)
|
||||||
: PeerListRow(peer, peer->id.value) {
|
: PeerListRow(peer, peer->id.value) {
|
||||||
}
|
}
|
||||||
|
@ -2189,6 +2193,9 @@ bool PeerListContent::submitted() {
|
||||||
_controller->rowClicked(row);
|
_controller->rowClicked(row);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
_noSearchSubmits.fire({});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -712,7 +712,7 @@ public:
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListState> saveState() const;
|
[[nodiscard]] std::unique_ptr<PeerListState> saveState() const;
|
||||||
void restoreState(std::unique_ptr<PeerListState> state);
|
void restoreState(std::unique_ptr<PeerListState> state);
|
||||||
|
|
||||||
void showRowMenu(
|
void showRowMenu(
|
||||||
|
@ -720,10 +720,14 @@ public:
|
||||||
bool highlightRow,
|
bool highlightRow,
|
||||||
Fn<void(not_null<Ui::PopupMenu*>)> destroyed);
|
Fn<void(not_null<Ui::PopupMenu*>)> destroyed);
|
||||||
|
|
||||||
auto scrollToRequests() const {
|
[[nodiscard]] auto scrollToRequests() const {
|
||||||
return _scrollToRequests.events();
|
return _scrollToRequests.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] auto noSearchSubmits() const {
|
||||||
|
return _noSearchSubmits.events();
|
||||||
|
}
|
||||||
|
|
||||||
~PeerListContent();
|
~PeerListContent();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -890,6 +894,8 @@ private:
|
||||||
object_ptr<Ui::FlatLabel> _searchLoading = { nullptr };
|
object_ptr<Ui::FlatLabel> _searchLoading = { nullptr };
|
||||||
object_ptr<Ui::RpWidget> _loadingAnimation = { nullptr };
|
object_ptr<Ui::RpWidget> _loadingAnimation = { nullptr };
|
||||||
|
|
||||||
|
rpl::event_stream<> _noSearchSubmits;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<PeerListRow>> _searchRows;
|
std::vector<std::unique_ptr<PeerListRow>> _searchRows;
|
||||||
base::Timer _repaintByStatus;
|
base::Timer _repaintByStatus;
|
||||||
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
base::unique_qptr<Ui::PopupMenu> _contextMenu;
|
||||||
|
@ -1106,6 +1112,7 @@ public:
|
||||||
[[nodiscard]] std::vector<PeerListRowId> collectSelectedIds();
|
[[nodiscard]] std::vector<PeerListRowId> collectSelectedIds();
|
||||||
[[nodiscard]] std::vector<not_null<PeerData*>> collectSelectedRows();
|
[[nodiscard]] std::vector<not_null<PeerData*>> collectSelectedRows();
|
||||||
[[nodiscard]] rpl::producer<int> multiSelectHeightValue() const;
|
[[nodiscard]] rpl::producer<int> multiSelectHeightValue() const;
|
||||||
|
[[nodiscard]] rpl::producer<> noSearchSubmits() const;
|
||||||
|
|
||||||
void peerListSetTitle(rpl::producer<QString> title) override {
|
void peerListSetTitle(rpl::producer<QString> title) override {
|
||||||
setTitle(std::move(title));
|
setTitle(std::move(title));
|
||||||
|
|
|
@ -917,6 +917,7 @@ void DraftOptionsBox(
|
||||||
struct AuthorSelector {
|
struct AuthorSelector {
|
||||||
object_ptr<Ui::RpWidget> content = { nullptr };
|
object_ptr<Ui::RpWidget> content = { nullptr };
|
||||||
Fn<bool(int, int, int)> overrideKey;
|
Fn<bool(int, int, int)> overrideKey;
|
||||||
|
Fn<void()> activate;
|
||||||
};
|
};
|
||||||
[[nodiscard]] AuthorSelector AuthorRowSelector(
|
[[nodiscard]] AuthorSelector AuthorRowSelector(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
|
@ -975,12 +976,15 @@ struct AuthorSelector {
|
||||||
tr::lng_reply_in_author()));
|
tr::lng_reply_in_author()));
|
||||||
Ui::AddSkip(container);
|
Ui::AddSkip(container);
|
||||||
|
|
||||||
|
const auto activate = [=] {
|
||||||
|
chosen(from->owner().history(from));
|
||||||
|
};
|
||||||
const auto delegate = container->lifetime().make_state<
|
const auto delegate = container->lifetime().make_state<
|
||||||
PeerListContentDelegateSimple
|
PeerListContentDelegateSimple
|
||||||
>();
|
>();
|
||||||
const auto controller = container->lifetime().make_state<
|
const auto controller = container->lifetime().make_state<
|
||||||
AuthorController
|
AuthorController
|
||||||
>(from, [=] { chosen(from->owner().history(from)); });
|
>(from, activate);
|
||||||
controller->setStyleOverrides(&st::peerListSingleRow);
|
controller->setStyleOverrides(&st::peerListSingleRow);
|
||||||
const auto content = container->add(object_ptr<PeerListContent>(
|
const auto content = container->add(object_ptr<PeerListContent>(
|
||||||
container,
|
container,
|
||||||
|
@ -1021,6 +1025,7 @@ struct AuthorSelector {
|
||||||
return {
|
return {
|
||||||
.content = std::move(result),
|
.content = std::move(result),
|
||||||
.overrideKey = overrideKey,
|
.overrideKey = overrideKey,
|
||||||
|
.activate = activate,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,6 +1056,12 @@ void ShowReplyToChatBox(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void noSearchSubmit() {
|
||||||
|
if (const auto onstack = _authorRow.activate) {
|
||||||
|
onstack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<Chosen> singleChosen() const {
|
[[nodiscard]] rpl::producer<Chosen> singleChosen() const {
|
||||||
return _singleChosen.events();
|
return _singleChosen.events();
|
||||||
}
|
}
|
||||||
|
@ -1094,6 +1105,10 @@ void ShowReplyToChatBox(
|
||||||
auto box = Box<PeerListBox>(std::move(controller), [=](
|
auto box = Box<PeerListBox>(std::move(controller), [=](
|
||||||
not_null<PeerListBox*> box) {
|
not_null<PeerListBox*> box) {
|
||||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||||
|
|
||||||
|
box->noSearchSubmits() | rpl::start_with_next([=] {
|
||||||
|
controllerRaw->noSearchSubmit();
|
||||||
|
}, box->lifetime());
|
||||||
});
|
});
|
||||||
const auto boxRaw = box.data();
|
const auto boxRaw = box.data();
|
||||||
show->show(std::move(box));
|
show->show(std::move(box));
|
||||||
|
|
Loading…
Add table
Reference in a new issue