mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Moved out down arrow icon of "Show More" button to single place.
This commit is contained in:
parent
5eb59a1a43
commit
f7ca8212aa
4 changed files with 32 additions and 44 deletions
|
@ -119,27 +119,6 @@ void ShowMenu(not_null<Ui::GenericBox*> box, const QString &text) {
|
|||
});
|
||||
}
|
||||
|
||||
void AddArrow(not_null<Ui::RpWidget*> parent) {
|
||||
const auto arrow = Ui::CreateChild<Ui::RpWidget>(parent.get());
|
||||
arrow->paintRequest(
|
||||
) | rpl::start_with_next([=](const QRect &r) {
|
||||
auto p = QPainter(arrow);
|
||||
|
||||
const auto path = Ui::ToggleUpDownArrowPath(
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::mainMenuToggleFourStrokes,
|
||||
0.);
|
||||
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.fillPath(path, st::lightButtonFg);
|
||||
}, arrow->lifetime());
|
||||
arrow->resize(Size(st::statisticsShowMoreButtonArrowSize * 2));
|
||||
arrow->move(st::statisticsShowMoreButtonArrowPosition);
|
||||
arrow->show();
|
||||
}
|
||||
|
||||
void AddHeader(
|
||||
not_null<Ui::VerticalLayout*> content,
|
||||
tr::phrase<> text) {
|
||||
|
@ -1372,7 +1351,7 @@ void InnerWidget::fill() {
|
|||
) | tr::to_count()),
|
||||
st::statisticsShowMoreButton)));
|
||||
const auto button = wrap->entity();
|
||||
AddArrow(button);
|
||||
Ui::AddToggleUpDownArrowToMoreButton(button);
|
||||
|
||||
wrap->toggle(true, anim::type::instant);
|
||||
const auto handleReceived = [=](
|
||||
|
|
|
@ -60,27 +60,6 @@ constexpr auto kColorIndexPending = int(4);
|
|||
+ (entry.in ? '1' : '0'));
|
||||
}
|
||||
|
||||
void AddArrow(not_null<Ui::RpWidget*> parent) {
|
||||
const auto arrow = Ui::CreateChild<Ui::RpWidget>(parent.get());
|
||||
arrow->paintRequest(
|
||||
) | rpl::start_with_next([=](const QRect &r) {
|
||||
auto p = QPainter(arrow);
|
||||
|
||||
const auto path = Ui::ToggleUpDownArrowPath(
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::mainMenuToggleFourStrokes,
|
||||
0.);
|
||||
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.fillPath(path, st::lightButtonFg);
|
||||
}, arrow->lifetime());
|
||||
arrow->resize(Size(st::statisticsShowMoreButtonArrowSize * 2));
|
||||
arrow->move(st::statisticsShowMoreButtonArrowPosition);
|
||||
arrow->show();
|
||||
}
|
||||
|
||||
void AddSubtitle(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> title) {
|
||||
|
@ -1308,7 +1287,7 @@ not_null<Ui::SlideWrap<Ui::SettingsButton>*> AddShowMoreButton(
|
|||
std::move(title),
|
||||
st::statisticsShowMoreButton)),
|
||||
{ 0, -st::settingsButton.padding.top(), 0, 0 });
|
||||
AddArrow(wrap->entity());
|
||||
Ui::AddToggleUpDownArrowToMoreButton(wrap->entity());
|
||||
return wrap;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "ui/effects/toggle_arrow.h"
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/rect.h"
|
||||
#include "styles/style_statistics.h"
|
||||
#include "styles/style_window.h"
|
||||
|
||||
#include <QtCore/QtMath>
|
||||
|
||||
namespace Ui {
|
||||
|
@ -50,4 +56,24 @@ namespace Ui {
|
|||
return path;
|
||||
}
|
||||
|
||||
void AddToggleUpDownArrowToMoreButton(not_null<Ui::RpWidget*> parent) {
|
||||
const auto arrow = Ui::CreateChild<Ui::RpWidget>(parent.get());
|
||||
arrow->paintRequest() | rpl::start_with_next([=](const QRect &r) {
|
||||
auto p = QPainter(arrow);
|
||||
|
||||
const auto path = ToggleUpDownArrowPath(
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::statisticsShowMoreButtonArrowSize,
|
||||
st::mainMenuToggleFourStrokes,
|
||||
0.);
|
||||
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.fillPath(path, st::lightButtonFg);
|
||||
}, arrow->lifetime());
|
||||
arrow->resize(Size(st::statisticsShowMoreButtonArrowSize * 2));
|
||||
arrow->move(st::statisticsShowMoreButtonArrowPosition);
|
||||
arrow->show();
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Ui {
|
||||
|
||||
class RpWidget;
|
||||
|
||||
[[nodiscard]] QPainterPath ToggleUpDownArrowPath(
|
||||
float64 x,
|
||||
float64 y,
|
||||
|
@ -16,4 +18,6 @@ namespace Ui {
|
|||
float64 fourStrokes,
|
||||
float64 progress);
|
||||
|
||||
void AddToggleUpDownArrowToMoreButton(not_null<Ui::RpWidget*> parent);
|
||||
|
||||
} // namespace Ui
|
||||
|
|
Loading…
Add table
Reference in a new issue