2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Display feed channels list in feed info.

This commit is contained in:
John Preston
2018-02-07 15:40:37 +03:00
parent a144e35f84
commit 99c686e3e1
11 changed files with 310 additions and 40 deletions

View File

@@ -164,6 +164,37 @@ private:
};
class FeedDetailsFiller {
public:
FeedDetailsFiller(
not_null<Controller*> controller,
not_null<Ui::RpWidget*> parent,
not_null<Data::Feed*> feed);
object_ptr<Ui::RpWidget> fill();
private:
object_ptr<Ui::RpWidget> setupDefaultToggle();
template <
typename Widget,
typename = std::enable_if_t<
std::is_base_of_v<Ui::RpWidget, Widget>>>
Widget *add(
object_ptr<Widget> &&child,
const style::margins &margin = style::margins()) {
return _wrap->add(
std::move(child),
margin);
}
not_null<Controller*> _controller;
not_null<Ui::RpWidget*> _parent;
not_null<Data::Feed*> _feed;
object_ptr<Ui::VerticalLayout> _wrap;
};
DetailsFiller::DetailsFiller(
not_null<Controller*> controller,
not_null<Ui::RpWidget*> parent,
@@ -650,6 +681,42 @@ object_ptr<Ui::RpWidget> ActionsFiller::fill() {
return { nullptr };
}
FeedDetailsFiller::FeedDetailsFiller(
not_null<Controller*> controller,
not_null<Ui::RpWidget*> parent,
not_null<Data::Feed*> feed)
: _controller(controller)
, _parent(parent)
, _feed(feed)
, _wrap(_parent) {
}
object_ptr<Ui::RpWidget> FeedDetailsFiller::fill() {
add(object_ptr<BoxContentDivider>(_wrap));
add(CreateSkipWidget(_wrap));
add(setupDefaultToggle());
add(CreateSkipWidget(_wrap));
return std::move(_wrap);
}
object_ptr<Ui::RpWidget> FeedDetailsFiller::setupDefaultToggle() {
const auto feed = _feed;
auto result = object_ptr<Button>(
_wrap,
Lang::Viewer(lng_info_feed_is_default),
st::infoNotificationsButton);
result->toggleOn(
rpl::single(false)// #TODO default
)->addClickHandler([=] {
});
object_ptr<FloatingIcon>(
result,
st::infoIconNotifications,
st::infoNotificationsIconPosition);
return std::move(result);
}
} // namespace
object_ptr<Ui::RpWidget> SetupDetails(
@@ -746,5 +813,13 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
return std::move(result);
}
object_ptr<Ui::RpWidget> SetupFeedDetails(
not_null<Controller*> controller,
not_null<Ui::RpWidget*> parent,
not_null<Data::Feed*> feed) {
FeedDetailsFiller filler(controller, parent, feed);
return filler.fill();
}
} // namespace Profile
} // namespace Info