mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-02 02:36:14 -06:00
Merge branch 'port/deckcraft/look/app-2' into port/deckcraft/area/app
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use craft::ui::dialog::{DialogHost, DialogId};
|
||||
use craft::ui::patterns::form_dialogs::{AboutImage, AboutInfo, AboutLink, AboutTab, HostedAbout};
|
||||
use craft::ui::patterns::form_dialogs::{AboutImage, AboutInfo, AboutLayout, AboutLink, AboutTab, HostedAbout};
|
||||
use deckcraft_engine::links;
|
||||
use serde_json::Value;
|
||||
|
||||
@@ -13,7 +13,7 @@ fn about_info() -> AboutInfo {
|
||||
"Presentations and slide shows, rebuilt from scratch in pure Rust.\n",
|
||||
"An open-source, clean-room project. Not affiliated with Microsoft."
|
||||
),
|
||||
version_line(),
|
||||
build_version(),
|
||||
)
|
||||
.mark(AboutImage::svg(crate::flavor::app_name(), include_bytes!("../../../../assets/app-icon/deckcraft-mark.svg")))
|
||||
.community(AboutLink::new("Join our community on Discord", links::DISCORD))
|
||||
@@ -21,11 +21,16 @@ fn about_info() -> AboutInfo {
|
||||
.built_with("MIT OR Apache-2.0 · © 2026 ArtCraft Team and the DeckCraft contributors")
|
||||
}
|
||||
|
||||
/// "Version X.Y.Z" plus, for release builds, the short commit and build date. The version comes
|
||||
/// from `[workspace.package] version` (the single source of truth, `cargo xtask version`); the
|
||||
/// release workflow sets `DECKCRAFT_BUILD_SHA` / `DECKCRAFT_BUILD_DATE` at build time.
|
||||
/// "Version X.Y.Z", with the build of [`build_version`].
|
||||
pub fn version_line() -> String {
|
||||
let mut s = format!("Version {}", crate::flavor::version());
|
||||
format!("Version {}", build_version())
|
||||
}
|
||||
|
||||
/// "X.Y.Z" plus, for release builds, the short commit and build date. The version comes from
|
||||
/// `[workspace.package] version` (the single source of truth, `cargo xtask version`); the release
|
||||
/// workflow sets `DECKCRAFT_BUILD_SHA` / `DECKCRAFT_BUILD_DATE` at build time.
|
||||
fn build_version() -> String {
|
||||
let mut s = crate::flavor::version().to_string();
|
||||
let sha = option_env!("DECKCRAFT_BUILD_SHA").map(|s| s.get(..9).unwrap_or(s)).filter(|s| !s.is_empty());
|
||||
let date = option_env!("DECKCRAFT_BUILD_DATE").filter(|s| !s.is_empty());
|
||||
match (sha, date) {
|
||||
@@ -43,7 +48,7 @@ pub(crate) fn open(_app: &mut SlideApp, _ctx: &egui::Context, host: &mut DialogH
|
||||
Some("models") => AboutTab::Models,
|
||||
_ => AboutTab::About,
|
||||
};
|
||||
Ok(Some(host.open(HostedAbout::new(about_info(), super::credits::credits()).tab(tab))))
|
||||
Ok(Some(host.open(HostedAbout::new(about_info(), super::credits::credits()).layout(AboutLayout::Column).tab(tab))))
|
||||
}
|
||||
|
||||
/// Opens each activated product or contributor link once, including across passes of a frame.
|
||||
|
||||
@@ -136,6 +136,8 @@ pub(crate) fn write(app: &mut SlideApp, draft: &PrefDraft) {
|
||||
}
|
||||
|
||||
struct AutoCorrectForm {
|
||||
/// Each opening of the form is its own: the dialog's session open state would keep the last close.
|
||||
open: bool,
|
||||
flags: [bool; 8],
|
||||
from: String,
|
||||
to: String,
|
||||
@@ -145,12 +147,13 @@ struct AutoCorrectForm {
|
||||
impl AutoCorrectForm {
|
||||
fn new(draft: &PrefDraft, actions: &mut Vec<Value>) -> Self {
|
||||
actions.push(json!({}));
|
||||
Self { flags: draft.flags(), from: String::new(), to: String::new(), entries: Vec::new() }
|
||||
Self { open: true, flags: draft.flags(), from: String::new(), to: String::new(), entries: Vec::new() }
|
||||
}
|
||||
|
||||
fn show(&mut self, ui: &mut Ui, actions: &mut Vec<Value>) -> Option<Option<[bool; 8]>> {
|
||||
let Self { flags, from, to, entries } = self;
|
||||
let shown = FormDialog::new(Word::plain("AutoCorrect"), Bind::bound(flags)).buttons(FormButtons::OkCancel).show(ui, |ui, _, flags| {
|
||||
let Self { open, flags, from, to, entries } = self;
|
||||
let form = FormDialog::new(Word::plain("AutoCorrect"), Bind::bound(flags)).opened(Bind::bound(open)).buttons(FormButtons::OkCancel);
|
||||
let shown = form.show(ui, |ui, _, flags| {
|
||||
for ((_, label), flag) in FLAG_FIELDS.iter().zip(flags.iter_mut()) {
|
||||
Checkbox::new(Bind::bound(flag)).label(Word::plain(label)).show(ui);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user