feat(settings): add settings view

This commit is contained in:
Fernando López Guevara
2025-07-23 15:33:17 -03:00
parent 2b48a20ccd
commit da6ede5f69
21 changed files with 746 additions and 34 deletions

View File

@@ -46,6 +46,9 @@ impl<'a, 'd> NoteContents<'a, 'd> {
impl egui::Widget for &mut NoteContents<'_, '_> {
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
if self.options.contains(NoteOptions::ShowNoteClientTop) {
render_client(ui, self.note_context.note_cache, self.note);
}
let result = render_note_contents(
ui,
self.note_context,
@@ -54,7 +57,7 @@ impl egui::Widget for &mut NoteContents<'_, '_> {
self.options,
self.jobs,
);
if self.options.contains(NoteOptions::ShowNoteClient) {
if self.options.contains(NoteOptions::ShowNoteClientBottom) {
render_client(ui, self.note_context.note_cache, self.note);
}
self.action = result.action;

View File

@@ -235,11 +235,24 @@ fn get_selected_index(ui: &egui::Ui, selection_id: egui::Id) -> usize {
/// Checks to see if we have any left/right key presses and updates the carousel index
fn update_selected_image_index(ui: &mut egui::Ui, carousel_id: egui::Id, num_urls: i32) -> usize {
if num_urls > 1 {
if ui.input(|i| i.key_pressed(egui::Key::ArrowRight) || i.key_pressed(egui::Key::L)) {
let (next_image, prev_image) = ui.data(|data| {
(
data.get_temp(carousel_id.with("next_image"))
.unwrap_or_default(),
data.get_temp(carousel_id.with("prev_image"))
.unwrap_or_default(),
)
});
if next_image
|| ui.input(|i| i.key_pressed(egui::Key::ArrowRight) || i.key_pressed(egui::Key::L))
{
let ind = select_next_media(ui, carousel_id, num_urls, 1);
tracing::debug!("carousel selecting right {}/{}", ind + 1, num_urls);
ind
} else if ui.input(|i| i.key_pressed(egui::Key::ArrowLeft) || i.key_pressed(egui::Key::H)) {
} else if prev_image
|| ui.input(|i| i.key_pressed(egui::Key::ArrowLeft) || i.key_pressed(egui::Key::H))
{
let ind = select_next_media(ui, carousel_id, num_urls, -1);
tracing::debug!("carousel selecting left {}/{}", ind + 1, num_urls);
ind

View File

@@ -23,7 +23,8 @@ bitflags! {
/// will end with a ... and a "Show more" button.
const Truncate = 1 << 11;
/// Show note's client in the note header
const ShowNoteClient = 1 << 12;
const ShowNoteClientTop = 1 << 12;
const ShowNoteClientBottom = 1 << 13;
}
}