2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 23:55:12 +00:00

Move some style code to lib_ui.

This commit is contained in:
John Preston
2019-09-13 13:24:06 +03:00
parent 5a1c8e6a0a
commit e2f54eb3e9
69 changed files with 1119 additions and 856 deletions

View File

@@ -124,7 +124,7 @@ void SetupInterfaceScale(
const auto toggled = Ui::CreateChild<rpl::event_stream<bool>>(
container.get());
const auto switched = (cConfigScale() == kInterfaceScaleAuto);
const auto switched = (cConfigScale() == style::kScaleAuto);
const auto button = AddButton(
container,
tr::lng_settings_default_scale(),
@@ -140,7 +140,7 @@ void SetupInterfaceScale(
auto values = (cIntRetinaFactor() > 1)
? std::vector<int>{ 100, 110, 120, 130, 140, 150 }
: std::vector<int>{ 100, 125, 150, 200, 250, 300 };
if (cConfigScale() == kInterfaceScaleAuto) {
if (cConfigScale() == style::kScaleAuto) {
return values;
}
if (ranges::find(values, cConfigScale()) == end(values)) {
@@ -167,7 +167,7 @@ void SetupInterfaceScale(
*inSetScale = true;
const auto guard = gsl::finally([=] { *inSetScale = false; });
toggled->fire(scale == kInterfaceScaleAuto);
toggled->fire(scale == style::kScaleAuto);
slider->setActiveSection(sectionFromScale(scale));
if (cEvalScale(scale) != cEvalScale(cConfigScale())) {
const auto confirmed = crl::guard(button, [=] {
@@ -208,13 +208,13 @@ void SetupInterfaceScale(
return scaleByIndex(section);
}) | rpl::start_with_next([=](int scale) {
(*setScale)((scale == cScreenScale())
? kInterfaceScaleAuto
? style::kScaleAuto
: scale);
}, slider->lifetime());
button->toggledValue(
) | rpl::map([](bool checked) {
return checked ? kInterfaceScaleAuto : cEvalScale(cConfigScale());
return checked ? style::kScaleAuto : cEvalScale(cConfigScale());
}) | rpl::start_with_next([=](int scale) {
(*setScale)(scale);
}, button->lifetime());