Compare commits

...

3 Commits

Author SHA1 Message Date
Dandaedre d41b8ab614 Organize preferences into tabs
Gitea/Deckstride/pipeline/head This commit looks good Details
2026-11-21 15:28:20 +01:00
Dandaedre aad895bc61 Shorten presenter menu 2026-11-21 15:23:45 +01:00
Dandaedre 2f98df4674 Configure releases for Gitea and GitHub 2026-11-21 15:11:56 +01:00
7 changed files with 319 additions and 247 deletions

2
Cargo.lock generated
View File

@ -670,7 +670,7 @@ dependencies = [
[[package]]
name = "deckstride"
version = "0.1.96"
version = "0.1.99"
dependencies = [
"bytemuck",
"chrono",

View File

@ -4,7 +4,7 @@ default-members = ["crates/deckstride"]
resolver = "3"
[workspace.package]
version = "0.1.96"
version = "0.1.99"
edition = "2024"
license = "MIT"
repository = "https://proxy.dandaedre.com/gitea/idle-org/deckstride"

View File

@ -1267,8 +1267,7 @@ fn presenter_view(
.show(|ui| {
egui::ScrollArea::vertical()
.max_height(
(screen.bottom() - trigger.rect.bottom() - 16.)
.clamp(80., 720.),
(screen.bottom() - trigger.rect.bottom() - 16.).max(80.),
)
.show(ui, |ui| menu(ui, s, &mut view.preferences_open));
});
@ -2406,6 +2405,219 @@ pub fn browser(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
quit_confirmation(ui.ctx(), s);
}
fn appearance_preferences(ui: &mut Ui, s: &mut Studio) {
let locale = ui.ctx().clone();
layout_section(ui, tr(&locale, "Appearance"), |ui| {
let mut changed = false;
egui::Grid::new("preferences-appearance-grid")
.num_columns(2)
.spacing(Vec2::new(12., 8.))
.show(ui, |ui| {
ui.label(tr(&locale, "Theme"));
egui::ComboBox::from_id_salt("preferences-theme")
.selected_text(s.settings.theme.name())
.show_ui(ui, |ui| {
for theme in crate::theme::Theme::ALL {
changed |= ui
.selectable_value(&mut s.settings.theme, theme, theme.name())
.changed();
}
});
ui.end_row();
ui.label(tr(&locale, "Language"));
egui::ComboBox::from_id_salt("preferences-language")
.selected_text(s.settings.language.name())
.show_ui(ui, |ui| {
for language in crate::localization::Language::ALL {
changed |= ui
.selectable_value(
&mut s.settings.language,
language,
language.name(),
)
.changed();
}
});
ui.end_row();
});
ui.separator();
for (label, color) in [
(
"Page background",
&mut s.settings.slide_colors.page_background,
),
(
"Fit padding color",
&mut s.settings.slide_colors.fit_padding,
),
] {
ui.horizontal(|ui| {
ui.label(tr(&locale, label));
changed |= ui.color_edit_button_srgb(color).changed();
});
}
ui.small(tr(
&locale,
"Page background fills transparency; fit padding fills space around the slide.",
));
if changed {
s.new_output = true;
s.save_preferences();
ui.ctx().request_repaint();
}
});
}
#[derive(Clone, Copy, Default, PartialEq, Eq)]
enum PreferencesTab {
#[default]
General,
Performance,
Storage,
}
fn general_preferences(ui: &mut Ui, s: &mut Studio) {
let locale = ui.ctx().clone();
appearance_preferences(ui, s);
ui.add_space(8.);
layout_section(ui, tr(&locale, "Blank Slides image"), |ui| {
ui.label(if s.settings.blank_picture {
tr(&locale, "Custom picture selected")
} else {
tr(&locale, "Solid black")
});
ui.horizontal_wrapped(|ui| {
if ui
.add_enabled(
s.initialized && !s.dialog_busy && !s.blank_busy,
egui::Button::new(tr(&locale, "Choose picture…")),
)
.clicked()
{
s.actions.push(Action::PickBlankPicture);
}
if ui
.add_enabled(
s.initialized && !s.dialog_busy && (s.settings.blank_picture || s.blank_busy),
egui::Button::new(tr(&locale, "Use solid black")),
)
.clicked()
{
s.actions.push(Action::ClearBlankPicture);
}
if s.blank_busy {
ui.spinner();
}
});
ui.small(tr(
&locale,
"A copy is saved and fitted to all Slides screens against a black background.",
));
});
#[cfg(target_os = "windows")]
{
ui.add_space(8.);
layout_section(ui, tr(&locale, "Default PDF application"), |ui| {
ui.label(tr(
&locale,
"Register Deckstride and its icon for PDF files in your Windows account.",
));
if ui.button(tr(&locale, "Set as default PDF app…")).clicked() {
s.actions.push(Action::RegisterPdfAssociation);
}
ui.small(tr(
&locale,
"Windows will open Default Apps; select Deckstride for .pdf to confirm.",
));
});
}
}
fn performance_preferences(ui: &mut Ui, s: &mut Studio) {
let locale = ui.ctx().clone();
layout_section(ui, tr(&locale, "Memory and cache"), |ui| {
ui.label(tr(
&locale,
"RAM budget per process (presenter + output each use this allowance):",
));
if ui
.add(egui::Slider::new(&mut s.settings.buffer_mib, 64..=16384).text("MiB"))
.changed()
{
s.remember_buffer_budget();
}
ui.small(tr(
&locale,
"Raise only within available RAM; OS paging can cause delays. Screen rendering is capped at 4096 px.",
));
ui.separator();
let mut changed = false;
ui.horizontal_wrapped(|ui| {
ui.label(tr(&locale, "Maximum total size (MiB)"));
changed |= ui
.add(
egui::DragValue::new(&mut s.settings.disk_cache.max_mib)
.range(64..=1048576)
.speed(64),
)
.changed();
});
ui.horizontal_wrapped(|ui| {
ui.label(tr(&locale, "Expire after (days since rendering)"));
changed |= ui
.add(egui::DragValue::new(&mut s.settings.disk_cache.max_days).range(1..=3650))
.changed();
});
if changed {
s.remember_cache_policy();
}
ui.small(tr(
&locale,
"Oldest files are removed first. Active decks are protected and may exceed the limit. Automatic cleanup runs once at startup, after loading and preparation finish.",
));
if ui
.add_enabled(
!s.cache_busy && !s.loading && s.initialized,
egui::Button::new(tr(&locale, "Expunge unused cache now")),
)
.clicked()
{
s.clean_cache(true);
}
if s.cache_busy {
ui.spinner();
}
ui.small(&s.cache_status);
});
}
fn storage_preferences(ui: &mut Ui, s: &Studio) {
let locale = ui.ctx().clone();
layout_section(ui, tr(&locale, "Storage and preparation"), |ui| {
ui.label(s.preparation_status());
ui.separator();
ui.label(egui::RichText::new(tr(&locale, "Application executable")).strong());
let executable = s.executable_path().display().to_string();
ui.add(
egui::Label::new(egui::RichText::new(&executable).monospace())
.selectable(true)
.wrap(),
)
.on_hover_text(&executable);
ui.small(tr(
&locale,
"This is the running portable executable. Use its containing folder to find or remove the application.",
));
ui.separator();
ui.label(format!(
"{}: {}",
tr(&locale, "Processed slides"),
s.cache_path.display()
));
ui.label(format!("Configuration: {}", s.settings_path.display()));
});
}
fn preferences_window(ctx: &egui::Context, s: &mut Studio, open: &mut bool) {
let locale = ctx.clone();
let mut window_open = true;
@ -2416,168 +2628,38 @@ fn preferences_window(ctx: &egui::Context, s: &mut Studio, open: &mut bool) {
.open(&mut window_open)
.collapsible(false)
.resizable(true)
.default_size(Vec2::new(620., 640.).min(screen - Vec2::splat(32.)))
.default_size(Vec2::new(620., 760.).min(screen - Vec2::splat(32.)))
.min_size(Vec2::new(360., 320.))
.max_size((screen - Vec2::splat(24.)).max(Vec2::splat(1.)))
.show(ctx, |ui| {
ui.spacing_mut().item_spacing = Vec2::new(8., 8.);
let tab_id = egui::Id::new("preferences-tab");
let mut tab = ctx
.data(|data| data.get_temp::<PreferencesTab>(tab_id))
.unwrap_or_default();
ui.horizontal(|ui| {
ui.selectable_value(&mut tab, PreferencesTab::General, tr(&locale, "General"));
ui.selectable_value(
&mut tab,
PreferencesTab::Performance,
tr(&locale, "Performance"),
);
ui.selectable_value(&mut tab, PreferencesTab::Storage, tr(&locale, "Storage"));
});
ctx.data_mut(|data| data.insert_temp(tab_id, tab));
ui.separator();
let scroll_height = (ui.available_height() - 52.).max(180.);
egui::ScrollArea::vertical()
.id_salt("preferences-scroll")
.id_salt(("preferences-scroll", tab as u8))
.auto_shrink([false, false])
.max_height(scroll_height)
.show(ui, |ui| {
layout_section(
ui,
tr(&locale, "Blank Slides image"),
|ui| {
ui.label(if s.settings.blank_picture {
tr(&locale, "Custom picture selected")
} else {
tr(&locale, "Solid black")
});
ui.horizontal_wrapped(|ui| {
if ui
.add_enabled(
s.initialized && !s.dialog_busy && !s.blank_busy,
egui::Button::new(tr(&locale, "Choose picture…")),
)
.clicked()
{
s.actions.push(Action::PickBlankPicture);
}
if ui
.add_enabled(
s.initialized
&& !s.dialog_busy
&& (s.settings.blank_picture || s.blank_busy),
egui::Button::new(tr(&locale, "Use solid black")),
)
.clicked()
{
s.actions.push(Action::ClearBlankPicture);
}
if s.blank_busy {
ui.spinner();
}
});
ui.small(tr(
&locale,
"A copy is saved and fitted to all Slides screens against a black background.",
));
},
);
#[cfg(target_os = "windows")]
{
ui.add_space(8.);
layout_section(
ui,
tr(&locale, "Default PDF application"),
|ui| {
ui.label(tr(
&locale,
"Register Deckstride and its icon for PDF files in your Windows account.",
));
if ui
.button(tr(&locale, "Set as default PDF app…"))
.clicked()
{
s.actions.push(Action::RegisterPdfAssociation);
}
ui.small(tr(
&locale,
"Windows will open Default Apps; select Deckstride for .pdf to confirm.",
));
},
);
ui.set_width(ui.available_width());
match tab {
PreferencesTab::General => general_preferences(ui, s),
PreferencesTab::Performance => performance_preferences(ui, s),
PreferencesTab::Storage => storage_preferences(ui, s),
}
ui.add_space(8.);
layout_section(ui, tr(&locale, "Memory and cache"), |ui| {
ui.label(tr(
&locale,
"RAM budget per process (presenter + output each use this allowance):",
));
if ui
.add(
egui::Slider::new(&mut s.settings.buffer_mib, 64..=16384)
.text("MiB"),
)
.changed()
{
s.remember_buffer_budget();
}
ui.small(tr(
&locale,
"Raise only within available RAM; OS paging can cause delays. Screen rendering is capped at 4096 px.",
));
ui.separator();
let mut changed = false;
ui.horizontal_wrapped(|ui| {
ui.label(tr(&locale, "Maximum total size (MiB)"));
changed |= ui
.add(
egui::DragValue::new(&mut s.settings.disk_cache.max_mib)
.range(64..=1048576)
.speed(64),
)
.changed();
});
ui.horizontal_wrapped(|ui| {
ui.label(tr(&locale, "Expire after (days since rendering)"));
changed |= ui
.add(
egui::DragValue::new(&mut s.settings.disk_cache.max_days)
.range(1..=3650),
)
.changed();
});
if changed {
s.remember_cache_policy();
}
ui.small(tr(
&locale,
"Oldest files are removed first. Active decks are protected and may exceed the limit. Automatic cleanup runs once at startup, after loading and preparation finish.",
));
if ui
.add_enabled(
!s.cache_busy && !s.loading && s.initialized,
egui::Button::new(tr(&locale, "Expunge unused cache now")),
)
.clicked()
{
s.clean_cache(true);
}
if s.cache_busy {
ui.spinner();
}
ui.small(&s.cache_status);
});
ui.add_space(8.);
layout_section(ui, tr(&locale, "Storage and preparation"), |ui| {
ui.label(s.preparation_status());
ui.separator();
ui.label(
egui::RichText::new(tr(&locale, "Application executable")).strong(),
);
let executable = s.executable_path().display().to_string();
ui.add(
egui::Label::new(egui::RichText::new(&executable).monospace())
.selectable(true)
.wrap(),
)
.on_hover_text(&executable);
ui.small(tr(
&locale,
"This is the running portable executable. Use its containing folder to find or remove the application.",
));
ui.separator();
ui.label(format!(
"{}: {}",
tr(&locale, "Processed slides"),
s.cache_path.display()
));
ui.label(format!("Configuration: {}", s.settings_path.display()));
});
});
ui.separator();
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
@ -2626,12 +2708,6 @@ fn menu(ui: &mut Ui, s: &mut Studio, preferences_open: &mut bool) {
},
);
ui.separator();
button(
ui,
tr(&locale, "All slides"),
Action::OpenBrowser,
&mut s.actions,
);
ui.menu_button(tr(&locale, "Autoplay"), |ui| {
ui.set_min_width(250.);
let mut changed = ui
@ -2661,67 +2737,6 @@ fn menu(ui: &mut Ui, s: &mut Studio, preferences_open: &mut bool) {
ui.ctx().request_repaint();
}
});
ui.menu_button(tr(&locale, "Appearance"), |ui| {
ui.with_layout(egui::Layout::top_down(egui::Align::Min), |ui| {
ui.set_min_width(250.);
let mut changed = false;
ui.label(
egui::RichText::new(tr(&locale, "Theme"))
.small()
.strong()
.color(ui.visuals().weak_text_color()),
);
ui.menu_button(s.settings.theme.name(), |ui| {
for theme in crate::theme::Theme::ALL {
let name = theme.name();
changed |= ui
.selectable_value(&mut s.settings.theme, theme, name)
.changed();
}
});
ui.add_space(6.);
ui.separator();
ui.add_space(4.);
ui.label(
egui::RichText::new(tr(&locale, "Language"))
.small()
.strong()
.color(ui.visuals().weak_text_color()),
);
ui.menu_button(s.settings.language.name(), |ui| {
for language in crate::localization::Language::ALL {
changed |= ui
.selectable_value(&mut s.settings.language, language, language.name())
.changed();
}
});
ui.separator();
for (label, color) in [
(
"Page background",
&mut s.settings.slide_colors.page_background,
),
(
"Fit padding color",
&mut s.settings.slide_colors.fit_padding,
),
] {
ui.horizontal(|ui| {
ui.label(tr(&locale, label));
changed |= ui.color_edit_button_srgb(color).changed();
});
}
ui.small(tr(
&locale,
"Page background fills transparency; fit padding fills space around the slide.",
));
if changed {
s.new_output = true;
s.save_preferences();
ui.ctx().request_repaint();
}
});
});
ui.separator();
ui.label(
egui::RichText::new(tr(&locale, "Quick settings"))

View File

@ -505,6 +505,16 @@ fn quick_settings_and_preferences_window_remain_interactive() {
}
};
click(&mut s, "Menu");
click(&mut s, "Quit");
assert!(
s.actions
.iter()
.any(|action| matches!(action, Action::Exit)),
"Quit should be directly reachable without scrolling at 1080p"
);
assert!(!s.menu_open);
s.actions.clear();
click(&mut s, "Menu");
click(&mut s, "Autoplay");
click(&mut s, "Play automatically");
assert!(s.settings.autoplay_enabled);
@ -514,22 +524,16 @@ fn quick_settings_and_preferences_window_remain_interactive() {
assert!(s.menu_open);
click(&mut s, "Menu");
click(&mut s, "Menu");
click(&mut s, "Appearance");
click(&mut s, "Preferences…");
assert!(s.preferences_open);
assert!(!s.menu_open);
click(&mut s, "Midra Dark");
assert!(
s.menu_open,
"Opening a theme selector must keep its parents open"
);
click(&mut s, "High Contrast");
assert_eq!(s.settings.theme, deckstride::theme::Theme::HighContrast);
assert!(s.menu_open);
click(&mut s, "English");
click(&mut s, "System language");
assert_eq!(
s.settings.language,
deckstride::localization::Language::System
);
assert!(s.menu_open);
assert!(s.preferences_open);
click(&mut s, "Close");
assert!(!s.preferences_open);
click(&mut s, "Menu");
let zoom_enabled = s.settings.zoom_enabled;
click(&mut s, "Enable page zoom");
assert_eq!(s.settings.zoom_enabled, !zoom_enabled);
@ -545,6 +549,7 @@ fn quick_settings_and_preferences_window_remain_interactive() {
click(&mut s, "Preferences…");
assert!(s.preferences_open);
assert!(!s.menu_open);
click(&mut s, "Performance");
click(&mut s, "Expunge unused cache now");
assert!(s.cache_busy, "The Preferences window must submit cleanup");
assert!(s.preferences_open);
@ -1797,7 +1802,7 @@ fn preferences_window_stays_on_the_presenter_that_opened_it() {
output
.shapes
.iter()
.any(|shape| contains(&shape.shape, "Memory and cache"))
.any(|shape| contains(&shape.shape, "Appearance"))
};
assert!(render(0, "one"));
assert!(!render(1, "two"));
@ -1805,11 +1810,13 @@ fn preferences_window_stays_on_the_presenter_that_opened_it() {
#[test]
fn preferences_show_the_running_executable_path() {
fn contains(shape: &egui::Shape, text: &str) -> bool {
fn find(shape: &egui::Shape, text: &str) -> Option<Pos2> {
match shape {
egui::Shape::Text(label) => label.galley.text() == text,
egui::Shape::Vec(shapes) => shapes.iter().any(|shape| contains(shape, text)),
_ => false,
egui::Shape::Text(label) if label.galley.text() == text => {
Some(label.pos + label.galley.size() * 0.5)
}
egui::Shape::Vec(shapes) => shapes.iter().find_map(|shape| find(shape, text)),
_ => None,
}
}
let ctx = Context::default();
@ -1825,17 +1832,35 @@ fn preferences_show_the_running_executable_path() {
presenter_ui::presenter(root, &mut s, &mut ui)
});
}
let storage = output
.shapes
.iter()
.find_map(|shape| find(&shape.shape, "Storage"))
.expect("Preferences should expose a Storage tab");
for pressed in [true, false] {
let mut raw = input(Vec2::new(1280., 900.));
raw.events = vec![
egui::Event::PointerMoved(storage),
egui::Event::PointerButton {
pos: storage,
button: egui::PointerButton::Primary,
pressed,
modifiers: Default::default(),
},
];
output = ctx.run_ui(raw, |root| presenter_ui::presenter(root, &mut s, &mut ui));
}
assert!(
output
.shapes
.iter()
.any(|shape| contains(&shape.shape, "Application executable"))
.any(|shape| find(&shape.shape, "Application executable").is_some())
);
assert!(
output
.shapes
.iter()
.any(|shape| contains(&shape.shape, &expected))
.any(|shape| find(&shape.shape, &expected).is_some())
);
}

View File

@ -2,6 +2,24 @@
## Unreleased
### 0.1.99
- Organize Preferences into General, Performance and Storage tabs. Each tab has its
own small-screen scroll position, and every Presenter remembers its selected tab.
### 0.1.98
- Shorten the Presenter menu by removing its duplicate All slides command and moving
theme, language and slide colors into the Preferences window. Keep zoom, fitted
zoom behavior, automatic Slides output and Autoplay available directly.
- Keep the menu vertically scrollable on small screens while leaving Quit visible
without scrolling at ordinary Presenter window sizes.
### 0.1.97
- Publish future release assets to both Gitea and GitHub from one reviewed build,
using a separate named token for each service.
### 0.1.96
- Rename the application, crate, executable, repository links, desktop identity,

View File

@ -39,9 +39,14 @@ commit, push that commit/tag, then run:
```sh
rust_realease . --package deckstride \
--message-file docs/development/release-notes/vVERSION.md \
--token-file ../gitea-token.txt
--token-file ../release-tokens.json
```
`release-tokens.json` is an untracked JSON object with `gitea` and `github`
keys. The matching tokens need repository read and release write access. As an
alternative, set `GITEA_TOKEN` and `GITHUB_TOKEN` in the release environment.
The publisher uploads and verifies the same artifacts on both services.
`--dry-run` previews without remote mutation. Before tagging, its missing-tag
prerequisite is expected. Do not use automatic tag/push options as part of local
preparation. Never put credentials in configuration, artifacts or Git.

View File

@ -1,6 +1,18 @@
[release]
tag-prefix = "v"
[[release.endpoints]]
name = "gitea"
provider = "gitea"
repository = "https://proxy.dandaedre.com/gitea/idle-org/deckstride"
token-env = "GITEA_TOKEN"
[[release.endpoints]]
name = "github"
provider = "github"
repository = "https://github.com/idle-org/Deckstride"
token-env = "GITHUB_TOKEN"
[build]
targets = [
"x86_64-unknown-linux-gnu",
@ -43,6 +55,3 @@ files = [
[[repository.fallbacks]]
origin = "https://git.dandaedre.com/idle-org/deckstride"
fallback-url = "https://proxy.dandaedre.com/gitea/idle-org/deckstride"
[gitea]
token-env = "GITEA_TOKEN"