Hide UI preference keys behind adapter

This commit is contained in:
2026-06-12 17:53:57 +02:00
parent 9f1a52401a
commit 058997bd78
6 changed files with 105 additions and 21 deletions

View File

@@ -1107,7 +1107,9 @@ void App::init_menu_tools()
if (auto btn = popup_time->find<NodeButtonCustom>("tools-timelapse"))
{
NodeCheckBox* cb = btn->find<NodeCheckBox>("tools-timelapse-check");
cb->set_value(pp::panopainter::legacy_boolean_preference_or("auto-timelapse", true), false);
cb->set_value(
pp::panopainter::read_legacy_startup_preferences(vr_controllers_enabled).auto_timelapse,
false);
btn->on_click = [this, btn](Node* b)
{
@@ -1127,7 +1129,7 @@ void App::init_menu_tools()
if (auto mode = popup_time->find<NodeComboBox>("tools-show-cursor"))
{
mode->set_index(pp::panopainter::legacy_integer_preference_or("show-cursor", 0));
mode->set_index(pp::panopainter::read_legacy_canvas_preferences().cursor_mode);
mode->on_select = [mode](Node* target, int index)
{
@@ -1539,7 +1541,7 @@ void App::set_ui_scale(float scale)
const auto plan = pp::app::plan_ui_scale(scale, display_density);
zoom = plan.scale;
FontManager::change_scale(plan.font_scale);
pp::panopainter::save_legacy_float_preference("ui-scale", plan.scale);
pp::panopainter::save_legacy_ui_scale_preference(plan.scale);
App::I->title_update();
}
@@ -1604,8 +1606,7 @@ void App::ui_save()
}
d.set("drop-right", list_drop_right);
pp::panopainter::set_legacy_descriptor_preference("ui", d);
pp::panopainter::set_legacy_boolean_preference("ui-rtl", ui_rtl);
pp::panopainter::set_legacy_ui_state_preferences(d, ui_rtl);
save_platform_ui_state();
pp::panopainter::save_legacy_preferences();
@@ -1613,16 +1614,17 @@ void App::ui_save()
void App::ui_restore()
{
if (pp::panopainter::has_legacy_preference("ui-rtl"))
set_ui_rtl(pp::panopainter::legacy_integer_preference("ui-rtl"));
const auto preferences = pp::panopainter::read_legacy_ui_preferences();
if (preferences.has_rtl)
set_ui_rtl(preferences.rtl);
if (!pp::panopainter::has_legacy_preference("ui"))
if (!preferences.state)
return;
auto floatings = layout[main_id]->find_ref("floatings");
auto drop_left = layout[main_id]->find_ref("drop-left");
auto drop_right = layout[main_id]->find_ref("drop-right");
auto d = pp::panopainter::get_legacy_descriptor_preference("ui");
auto d = preferences.state;
for (auto const& l : d->get<Serializer::List>("floatings")->items)
{
auto ld = std::static_pointer_cast<Serializer::Descriptor>(l);