Allow selecting between docs pages

This commit is contained in:
Connor Slade
2025-02-15 13:58:37 -05:00
parent dbd87b6829
commit 9de65805ef
5 changed files with 49 additions and 11 deletions

View File

@@ -1,5 +1,3 @@
# Getting Started
Welcome to mslicer!
Currently, mslicer can only output `.goo` files, which is a format spsific to [ELEGOO](https://www.elegoo.com) resin printers. In the future I plan to add support for other formats, but in the meantime you can use [UVTools](https://github.com/sn4k3/UVtools) to convert between formats.

5
docs/readme.md Normal file
View File

@@ -0,0 +1,5 @@
# mslicer Documentation
This pages can also be viewed directly in mslcier on the `About` panel.
- [Getting Started](getting_started.md)

View File

@@ -13,6 +13,9 @@ pub struct UiState {
pub working_filename: String,
pub send_print_completion: bool,
pub remote_print_connecting: RemotePrintConnectStatus,
// documentation
pub docs_page: DocsPage,
}
#[derive(Default, PartialEq, Eq)]
@@ -22,3 +25,10 @@ pub enum RemotePrintConnectStatus {
Connecting,
Scanning,
}
#[derive(Default, PartialEq)]
pub enum DocsPage {
#[default]
GettingStarted,
AnotherPage,
}

View File

@@ -1,9 +1,13 @@
use egui::{Context, Ui};
use crate::{app::App, ui::markdown::CompiledMarkdown};
use crate::{
app::App,
ui::{markdown::CompiledMarkdown, state::DocsPage},
};
const DESCRIPTION: &str = "A work in progress FOSS slicer for resin printers, created by Connor Slade. Source code is available on Github at ";
const GITHUB_LINK: &str = "https://github.com/connorslade/mslicer";
const DOCS_LINK: &str = "https://github.com/connorslade/mslicer/tree/main/docs";
pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) {
ui.monospace(concat!("mslicer v", env!("CARGO_PKG_VERSION")));
@@ -17,13 +21,26 @@ pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) {
ui.add_space(16.0);
CompiledMarkdown::compile(include_str!("../../../docs/getting_started.md")).render(ui);
ui.heading("Documentation");
ui.horizontal_wrapped(|ui| {
ui.spacing_mut().item_spacing.x = 0.0;
ui.label("This documentation is also available online ");
ui.hyperlink_to("here", DOCS_LINK).on_hover_text(DOCS_LINK);
ui.label(".");
});
ui.add_space(16.0);
ui.heading("Stats");
ui.label(format!(
"Frame Time: {:.2}ms",
app.fps.frame_time() * 1000.0
));
ui.label(format!("FPS: {:.2}", 1.0 / app.fps.frame_time()));
ui.horizontal(|ui| {
ui.selectable_value(
&mut app.state.docs_page,
DocsPage::GettingStarted,
"Getting Started",
);
ui.selectable_value(
&mut app.state.docs_page,
DocsPage::AnotherPage,
"Another Page",
);
});
CompiledMarkdown::compile(include_str!("../../../docs/getting_started.md")).render(ui);
}

View File

@@ -90,4 +90,12 @@ pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) {
ui.end_row();
});
});
ui.collapsing("Stats", |ui| {
ui.label(format!(
"Frame Time: {:.2}ms",
app.fps.frame_time() * 1000.0
));
ui.label(format!("FPS: {:.2}", 1.0 / app.fps.frame_time()));
});
}