Add preference section navigation
This commit is contained in:
@@ -81,6 +81,7 @@ impl App {
|
||||
}
|
||||
|
||||
let model_group = preference_group(
|
||||
PreferenceSection::Model,
|
||||
"MODEL & LIFECYCLE",
|
||||
column![
|
||||
hint(
|
||||
@@ -129,6 +130,7 @@ impl App {
|
||||
.spacing(10),
|
||||
);
|
||||
let endpoint_group = preference_group(
|
||||
PreferenceSection::Endpoint,
|
||||
"LOCAL ENDPOINT",
|
||||
column![
|
||||
hint(
|
||||
@@ -155,6 +157,7 @@ impl App {
|
||||
.spacing(10),
|
||||
);
|
||||
let generation_group = preference_group(
|
||||
PreferenceSection::Generation,
|
||||
"GENERATION",
|
||||
column![
|
||||
preference_input_row(
|
||||
@@ -239,6 +242,7 @@ impl App {
|
||||
.spacing(10),
|
||||
);
|
||||
let execution_group = preference_group(
|
||||
PreferenceSection::Execution,
|
||||
"EXECUTION",
|
||||
column![
|
||||
preference_input_row(
|
||||
@@ -295,6 +299,7 @@ impl App {
|
||||
.spacing(10),
|
||||
);
|
||||
let acceleration_group = preference_group(
|
||||
PreferenceSection::Acceleration,
|
||||
"ACCELERATION & MEMORY",
|
||||
column![
|
||||
text("SPECULATIVE DECODING").size(11).color(muted_text()),
|
||||
@@ -424,6 +429,7 @@ impl App {
|
||||
.spacing(10),
|
||||
);
|
||||
let steering_group = preference_group(
|
||||
PreferenceSection::Steering,
|
||||
"STEERING & DIAGNOSTICS",
|
||||
column![
|
||||
text("DIRECTIONAL STEERING").size(11).color(muted_text()),
|
||||
@@ -493,6 +499,7 @@ impl App {
|
||||
.spacing(10),
|
||||
);
|
||||
let kv_cache_group = preference_group(
|
||||
PreferenceSection::KvCache,
|
||||
"KV CACHE",
|
||||
column![
|
||||
preference_input_row(
|
||||
@@ -556,45 +563,60 @@ impl App {
|
||||
if let Some(error) = &self.preference_error {
|
||||
fields = fields.push(text(error).style(iced::widget::text::danger));
|
||||
}
|
||||
let header = row![
|
||||
icon(ICON_SETTINGS, 22),
|
||||
text("Preferences").size(24),
|
||||
Space::new().width(Length::Fill),
|
||||
text("⌘,").size(12),
|
||||
]
|
||||
.spacing(10)
|
||||
.align_y(Alignment::Center);
|
||||
let navigation = PreferenceSection::ALL.iter().fold(
|
||||
column![
|
||||
row![icon(ICON_SETTINGS, 20), text("Preferences").size(20)]
|
||||
.spacing(9)
|
||||
.align_y(Alignment::Center),
|
||||
text("Jump to section").size(12).color(muted_text()),
|
||||
rule::horizontal(1),
|
||||
]
|
||||
.spacing(8),
|
||||
|navigation, section| {
|
||||
navigation.push(
|
||||
button(text(section.label()).size(13))
|
||||
.on_press(Message::ScrollPreferences(*section))
|
||||
.width(Length::Fill)
|
||||
.padding([8, 10])
|
||||
.style(button::text),
|
||||
)
|
||||
},
|
||||
);
|
||||
let footer = row![
|
||||
action_button("Reset DS4 defaults").on_press(Message::ResetPreferences),
|
||||
Space::new().width(Length::Fill),
|
||||
action_button("Cancel").on_press(Message::DismissPanel),
|
||||
action_button("Cancel").on_press(Message::ClosePreferences),
|
||||
action_button("Save").on_press(Message::SavePreferences),
|
||||
]
|
||||
.spacing(8);
|
||||
|
||||
let panel = container(
|
||||
column![
|
||||
header,
|
||||
scrollable(container(fields).padding(iced::Padding::ZERO.right(18)))
|
||||
.id(preferences_scroll_id())
|
||||
.height(Length::Fill),
|
||||
footer
|
||||
]
|
||||
.spacing(16),
|
||||
)
|
||||
.padding(24)
|
||||
.width(700)
|
||||
container(row![
|
||||
container(navigation)
|
||||
.width(210)
|
||||
.height(Length::Fill)
|
||||
.padding(20)
|
||||
.style(sidebar_style),
|
||||
container(
|
||||
column![
|
||||
row![
|
||||
text("Settings").size(24),
|
||||
Space::new().width(Length::Fill),
|
||||
text("⌘,").size(12).color(muted_text()),
|
||||
]
|
||||
.align_y(Alignment::Center),
|
||||
scrollable(container(fields).padding(iced::Padding::ZERO.right(18)))
|
||||
.id(preferences_scroll_id())
|
||||
.height(Length::Fill),
|
||||
footer,
|
||||
]
|
||||
.spacing(16),
|
||||
)
|
||||
.padding(24)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill),
|
||||
])
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.max_height(660)
|
||||
.style(overview_style);
|
||||
opaque(
|
||||
container(panel)
|
||||
.padding(24)
|
||||
.center_x(Length::Fill)
|
||||
.center_y(Length::Fill)
|
||||
.style(|_| {
|
||||
container::Style::default().background(Color::from_rgba8(0, 0, 0, 0.68))
|
||||
}),
|
||||
)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user