mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Slightly improved style of admin log section.
This commit is contained in:
@@ -6063,7 +6063,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
"lng_admin_log_title_all" = "All actions";
|
||||
"lng_admin_log_title_selected" = "Selected actions";
|
||||
"lng_admin_log_filter" = "Filter";
|
||||
"lng_admin_log_filter_title" = "Filter";
|
||||
"lng_admin_log_filter_all_actions" = "All actions";
|
||||
"lng_admin_log_filter_actions_type_subtitle" = "Filter actions by type";
|
||||
@@ -6091,7 +6090,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_filter_all_admins" = "All users and admins";
|
||||
"lng_admin_log_filter_actions_admins_subtitle" = "Filter actions by admins";
|
||||
"lng_admin_log_filter_actions_admins_section" = "Show Actions by All Admins";
|
||||
"lng_admin_log_about" = "What is this?";
|
||||
"lng_admin_log_about_text" = "This is a list of all notable actions by group members and admins in the last 48 hours.";
|
||||
"lng_admin_log_about_text_channel" = "This is a list of all service actions taken by the channel's admins in the last 48 hours.";
|
||||
"lng_admin_log_no_results_title" = "No actions found";
|
||||
|
||||
@@ -44,7 +44,6 @@ public:
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<ChannelData*> channel);
|
||||
|
||||
[[nodiscard]] rpl::producer<> showFilterRequests() const;
|
||||
[[nodiscard]] rpl::producer<> searchCancelRequests() const;
|
||||
[[nodiscard]] rpl::producer<QString> searchRequests() const;
|
||||
|
||||
@@ -81,7 +80,6 @@ private:
|
||||
object_ptr<Profile::BackButton> _backButton;
|
||||
object_ptr<Ui::IconButton> _search;
|
||||
object_ptr<Ui::CrossButton> _cancel;
|
||||
object_ptr<Ui::RoundButton> _filter;
|
||||
|
||||
Ui::Animations::Simple _searchShownAnimation;
|
||||
bool _searchShown = false;
|
||||
@@ -120,14 +118,12 @@ FixedBar::FixedBar(
|
||||
tr::lng_admin_log_title_all(tr::now),
|
||||
controller->adaptive().oneColumnValue())
|
||||
, _search(this, st::topBarSearch)
|
||||
, _cancel(this, st::historyAdminLogCancelSearch)
|
||||
, _filter(this, tr::lng_admin_log_filter(), st::topBarButton) {
|
||||
, _cancel(this, st::historyAdminLogCancelSearch) {
|
||||
_backButton->moveToLeft(0, 0);
|
||||
_backButton->setClickedCallback([=] { goBack(); });
|
||||
_search->setClickedCallback([=] { showSearch(); });
|
||||
_cancel->setClickedCallback([=] { cancelSearch(); });
|
||||
_field->hide();
|
||||
_filter->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
_field->cancelled(
|
||||
) | rpl::on_next([=] {
|
||||
cancelSearch();
|
||||
@@ -216,20 +212,18 @@ void FixedBar::applySearch() {
|
||||
}
|
||||
|
||||
int FixedBar::resizeGetHeight(int newWidth) {
|
||||
auto filterLeft = newWidth - _filter->width();
|
||||
_filter->moveToLeft(filterLeft, 0);
|
||||
|
||||
auto cancelLeft = filterLeft - _cancel->width();
|
||||
_cancel->moveToLeft(cancelLeft, 0);
|
||||
|
||||
const auto offset = st::historySendRight + st::lineWidth;
|
||||
auto searchShownLeft = st::topBarArrowPadding.left();
|
||||
auto searchHiddenLeft = filterLeft - _search->width();
|
||||
auto searchHiddenLeft = newWidth - _search->width() - offset;
|
||||
auto searchShown = _searchShownAnimation.value(_searchShown ? 1. : 0.);
|
||||
auto searchCurrentLeft = anim::interpolate(searchHiddenLeft, searchShownLeft, searchShown);
|
||||
_search->moveToLeft(searchCurrentLeft, 0);
|
||||
_backButton->resizeToWidth(searchCurrentLeft);
|
||||
_backButton->moveToLeft(0, 0);
|
||||
|
||||
auto cancelLeft = newWidth - _cancel->width() - offset;
|
||||
_cancel->moveToLeft(cancelLeft, 0);
|
||||
|
||||
auto newHeight = _backButton->height();
|
||||
auto fieldLeft = searchShownLeft + _search->width();
|
||||
_field->setGeometryToLeft(fieldLeft, st::historyAdminLogSearchTop, cancelLeft - fieldLeft, _field->height());
|
||||
@@ -237,10 +231,6 @@ int FixedBar::resizeGetHeight(int newWidth) {
|
||||
return newHeight;
|
||||
}
|
||||
|
||||
rpl::producer<> FixedBar::showFilterRequests() const {
|
||||
return _filter->clicks() | rpl::to_empty;
|
||||
}
|
||||
|
||||
rpl::producer<> FixedBar::searchCancelRequests() const {
|
||||
return _searchCancelRequests.events();
|
||||
}
|
||||
@@ -289,16 +279,13 @@ Widget::Widget(
|
||||
, _scroll(this, st::historyScroll, false)
|
||||
, _fixedBar(this, controller, channel)
|
||||
, _fixedBarShadow(this)
|
||||
, _whatIsThis(
|
||||
this,
|
||||
tr::lng_admin_log_about(tr::now),
|
||||
st::historyComposeButton) {
|
||||
, _settingsFilter(
|
||||
this,
|
||||
tr::lng_menu_settings(tr::now),
|
||||
st::historyComposeButton)
|
||||
, _whatIsThis(this, st::historyAdminLogWhatIsThis) {
|
||||
_fixedBar->move(0, 0);
|
||||
_fixedBar->resizeToWidth(width());
|
||||
_fixedBar->showFilterRequests(
|
||||
) | rpl::on_next([=] {
|
||||
showFilter();
|
||||
}, lifetime());
|
||||
_fixedBar->searchCancelRequests(
|
||||
) | rpl::on_next([=] {
|
||||
setInnerFocus();
|
||||
@@ -309,6 +296,7 @@ Widget::Widget(
|
||||
}, lifetime());
|
||||
_fixedBar->show();
|
||||
|
||||
_whatIsThis->raise();
|
||||
_fixedBarShadow->raise();
|
||||
|
||||
controller->adaptive().value(
|
||||
@@ -337,6 +325,9 @@ Widget::Widget(
|
||||
onScroll();
|
||||
}, lifetime());
|
||||
|
||||
_settingsFilter->setClickedCallback([=] {
|
||||
showFilter();
|
||||
});
|
||||
_whatIsThis->setClickedCallback([=] {
|
||||
controller->show(Ui::MakeInformBox(channel->isMegagroup()
|
||||
? tr::lng_admin_log_about_text()
|
||||
@@ -488,7 +479,7 @@ void Widget::resizeEvent(QResizeEvent *e) {
|
||||
_fixedBarShadow->resize(contentWidth, st::lineWidth);
|
||||
|
||||
auto bottom = height();
|
||||
auto scrollHeight = bottom - _fixedBar->height() - _whatIsThis->height();
|
||||
auto scrollHeight = bottom - _fixedBar->height() - _settingsFilter->height();
|
||||
auto scrollSize = QSize(contentWidth, scrollHeight);
|
||||
if (_scroll->size() != scrollSize) {
|
||||
_scroll->resize(scrollSize);
|
||||
@@ -503,8 +494,11 @@ void Widget::resizeEvent(QResizeEvent *e) {
|
||||
auto scrollTop = _scroll->scrollTop();
|
||||
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
||||
}
|
||||
auto fullWidthButtonRect = myrtlrect(0, bottom - _whatIsThis->height(), contentWidth, _whatIsThis->height());
|
||||
_whatIsThis->setGeometry(fullWidthButtonRect);
|
||||
auto fullWidthButtonRect = myrtlrect(0, bottom - _settingsFilter->height(), contentWidth, _settingsFilter->height());
|
||||
_settingsFilter->setGeometry(fullWidthButtonRect);
|
||||
_whatIsThis->moveToRight(
|
||||
st::historySendRight,
|
||||
bottom - _whatIsThis->height());
|
||||
}
|
||||
|
||||
void Widget::paintEvent(QPaintEvent *e) {
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Ui {
|
||||
class ScrollArea;
|
||||
class PlainShadow;
|
||||
class FlatButton;
|
||||
class IconButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Profile {
|
||||
@@ -81,7 +82,8 @@ private:
|
||||
QPointer<InnerWidget> _inner;
|
||||
object_ptr<FixedBar> _fixedBar;
|
||||
object_ptr<Ui::PlainShadow> _fixedBarShadow;
|
||||
object_ptr<Ui::FlatButton> _whatIsThis;
|
||||
object_ptr<Ui::FlatButton> _settingsFilter;
|
||||
object_ptr<Ui::IconButton> _whatIsThis;
|
||||
|
||||
Ui::Controls::SwipeBackResult _swipeBackData;
|
||||
|
||||
|
||||
@@ -582,6 +582,10 @@ historyAdminLogCancelSearch: CrossButton {
|
||||
}
|
||||
historyAdminLogSearchTop: 11px;
|
||||
historyAdminLogSearchSlideDuration: 150;
|
||||
historyAdminLogWhatIsThis: IconButton(historyAttach) {
|
||||
icon: icon {{ "menu/faq", windowActiveTextFg }};
|
||||
iconOver: icon {{ "menu/faq", windowActiveTextFg }};
|
||||
}
|
||||
|
||||
historyFastShareSize: 31px;
|
||||
historyFastShareLeft: 13px;
|
||||
|
||||
Reference in New Issue
Block a user