Centralize legacy app preferences

This commit is contained in:
2026-06-04 14:18:18 +02:00
parent ca5b94b044
commit f8243566c4
9 changed files with 352 additions and 22 deletions

View File

@@ -17,6 +17,7 @@
#include "app_core/app_status.h"
#include "app_core/main_toolbar.h"
#include "app_core/tools_menu.h"
#include "legacy_app_preference_services.h"
#include "legacy_app_shell_services.h"
#include "legacy_brush_ui_services.h"
#include "legacy_canvas_tool_services.h"
@@ -1095,7 +1096,11 @@ void App::init_menu_tools()
ui_scale->on_select = [ui_scale](Node* target, int index)
{
App::I->set_ui_scale(ui_scale->get_float(index));
const auto status = pp::panopainter::execute_legacy_ui_scale_preference(
*App::I,
ui_scale->get_float(index));
if (!status.ok())
LOG("UI scale preference failed: %s", status.message);
};
}
@@ -1112,10 +1117,11 @@ void App::init_menu_tools()
vp_scale->on_select = [vp_scale](Node* target, int index)
{
const auto plan = pp::app::plan_viewport_scale(vp_scale->get_float(index));
App::I->canvas->set_density(plan.scale);
Settings::set("vp-scale", Serializer::Float(plan.scale));
Settings::save();
const auto status = pp::panopainter::execute_legacy_viewport_scale_preference(
*App::I,
vp_scale->get_float(index));
if (!status.ok())
LOG("Viewport scale preference failed: %s", status.message);
};
}
@@ -1132,7 +1138,11 @@ void App::init_menu_tools()
rtl_btn->find<NodeCheckBox>("tools-rtl-check")->on_value_changed = [this, main](Node*, bool checked)
{
set_ui_rtl(checked);
const auto status = pp::panopainter::execute_legacy_interface_direction_preference(
*this,
checked);
if (!status.ok())
LOG("Interface direction preference failed: %s", status.message);
};
}
@@ -1178,10 +1188,11 @@ void App::init_menu_tools()
vr_btn->find<NodeCheckBox>("tools-vr-controllers-check")->on_value_changed = [this, main](Node* target, bool checked)
{
const auto plan = pp::app::plan_vr_controllers_preference(checked);
vr_controllers_enabled = plan.value;
Settings::set("vr-controllers-enabled", Serializer::Boolean(plan.value));
Settings::save();
const auto status = pp::panopainter::execute_legacy_vr_controllers_preference(
*this,
checked);
if (!status.ok())
LOG("VR controllers preference failed: %s", status.message);
};
}
@@ -1198,13 +1209,11 @@ void App::init_menu_tools()
btn->find<NodeCheckBox>("tools-timelapse-check")->on_value_changed = [this, main](Node*, bool checked)
{
const auto plan = pp::app::plan_timelapse_preference(checked, App::I->rec_running);
if (plan.recording_action == pp::app::TimelapseRecordingAction::stop_recording)
App::I->rec_stop();
else if (plan.recording_action == pp::app::TimelapseRecordingAction::start_recording)
App::I->rec_start();
Settings::set("auto-timelapse", Serializer::Boolean(plan.enabled));
Settings::save();
const auto status = pp::panopainter::execute_legacy_timelapse_preference(
*this,
checked);
if (!status.ok())
LOG("Timelapse preference failed: %s", status.message);
};
}
@@ -1214,10 +1223,11 @@ void App::init_menu_tools()
mode->on_select = [mode](Node* target, int index)
{
const auto plan = pp::app::plan_canvas_cursor_mode(index);
App::I->canvas->set_cursor_visibility((NodeCanvas::kCursorVisibility)plan.value);
Settings::set("show-cursor", Serializer::Integer(plan.value));
Settings::save();
const auto status = pp::panopainter::execute_legacy_canvas_cursor_mode_preference(
*App::I,
index);
if (!status.ok())
LOG("Cursor mode preference failed: %s", status.message);
};
}
};