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

Replaced EditColorBox with Ui::GenericBox.

This commit is contained in:
23rd
2023-01-15 05:25:41 +03:00
parent 58ed30d30e
commit e3334f7a87
7 changed files with 176 additions and 145 deletions

View File

@@ -341,17 +341,30 @@ void ColorsPalette::selectCustom(not_null<const Scheme*> scheme) {
const auto colorizer = Window::Theme::ColorizerFrom(
*scheme,
scheme->accentColor);
auto box = Box<EditColorBox>(
tr::lng_settings_theme_accent_title(tr::now),
EditColorBox::Mode::HSL,
(*selected)->color());
box->setLightnessLimits(
colorizer.lightnessMin,
colorizer.lightnessMax);
box->setSaveCallback(crl::guard(_outer, [=](QColor result) {
_selected.fire_copy(result);
Ui::show(Box([=](not_null<Ui::GenericBox*> box) {
const auto editor = box->addRow(object_ptr<ColorEditor>(
box,
ColorEditor::Mode::HSL,
(*selected)->color()));
const auto save = crl::guard(_outer, [=] {
_selected.fire_copy(editor->color());
box->closeBox();
});
editor->submitRequests(
) | rpl::start_with_next(save, editor->lifetime());
editor->setLightnessLimits(
colorizer.lightnessMin,
colorizer.lightnessMax);
box->setFocusCallback([=] {
editor->setInnerFocus();
});
box->addButton(tr::lng_settings_save(), save);
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
box->setTitle(tr::lng_settings_theme_accent_title());
box->setWidth(editor->width());
}));
Ui::show(std::move(box));
}
rpl::producer<QColor> ColorsPalette::selected() const {