diff --git a/crates/cr-app/src/action.rs b/crates/cr-app/src/action.rs index 53cf7f2..c9120e8 100644 --- a/crates/cr-app/src/action.rs +++ b/crates/cr-app/src/action.rs @@ -114,7 +114,7 @@ pub const NOT_YET_ON_WINDOWS: &[Action] = &[]; /// The actions the Mac app does not have yet. An action comes off as the /// Mac app gets it, and the release with macOS waits until the list is /// empty. -pub const NOT_YET_ON_MACOS: &[Action] = &[EXTRACT_DATA]; +pub const NOT_YET_ON_MACOS: &[Action] = &[]; #[cfg(test)] mod tests { diff --git a/crates/cr-i18n/po/corerules.pot b/crates/cr-i18n/po/corerules.pot index b28cc09..642c442 100644 --- a/crates/cr-i18n/po/corerules.pot +++ b/crates/cr-i18n/po/corerules.pot @@ -5269,8 +5269,8 @@ msgid "Help" msgstr "" #: crates/cr-gtk/src/help.rs:284 -#: crates/cr-mac-ffi/src/lib.rs:855 -#: crates/cr-mac-ffi/src/lib.rs:901 +#: crates/cr-mac-ffi/src/lib.rs:892 +#: crates/cr-mac-ffi/src/lib.rs:938 #: crates/cr-win/src/app.rs:1834 #: crates/cr-win/src/app.rs:1843 #: crates/cr-win/src/app.rs:3522 @@ -5441,7 +5441,7 @@ msgid "Character created" msgstr "" #: crates/cr-gtk/src/main.rs:906 -#: crates/cr-mac-ffi/src/lib.rs:934 +#: crates/cr-mac-ffi/src/lib.rs:971 #: crates/cr-win/src/app.rs:2763 msgid "Converted to a character" msgstr "" @@ -5665,7 +5665,7 @@ msgid "Show a Party" msgstr "" #: crates/cr-gtk/src/main.rs:1589 -#: crates/cr-mac-ffi/src/lib.rs:629 +#: crates/cr-mac-ffi/src/lib.rs:666 #: crates/cr-win/src/app/library.rs:337 msgid "All Types" msgstr "" @@ -5714,7 +5714,7 @@ msgstr "" #: crates/cr-mac-ffi/src/encounter.rs:225 #: crates/cr-mac-ffi/src/encounter.rs:526 #: crates/cr-mac-ffi/src/encounter.rs:962 -#: crates/cr-mac-ffi/src/lib.rs:1109 +#: crates/cr-mac-ffi/src/lib.rs:1146 #: crates/cr-mac-ffi/src/sheet.rs:85 #: crates/cr-win/src/app/library.rs:261 #: crates/cr-win/src/app.rs:402 @@ -6380,19 +6380,19 @@ msgid "Choose Picture" msgstr "" #: crates/cr-gtk/src/picture.rs:282 -#: crates/cr-mac-ffi/src/lib.rs:984 +#: crates/cr-mac-ffi/src/lib.rs:1021 #: crates/cr-win/src/app/portrait.rs:120 msgid "Portraits" msgstr "" #: crates/cr-gtk/src/picture.rs:285 -#: crates/cr-mac-ffi/src/lib.rs:987 +#: crates/cr-mac-ffi/src/lib.rs:1024 #: crates/cr-win/src/app/portrait.rs:122 msgid "Portraits for {race}" msgstr "" #: crates/cr-gtk/src/picture.rs:286 -#: crates/cr-mac-ffi/src/lib.rs:988 +#: crates/cr-mac-ffi/src/lib.rs:1025 #: crates/cr-win/src/app/portrait.rs:123 msgid "Other Portraits" msgstr "" @@ -7950,6 +7950,10 @@ msgstr "" msgid "Rank" msgstr "" +#: crates/cr-mac-ffi/src/lib.rs:523 +msgid "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 or Expansion CD into the app's data folder. Choose the CD's ISO image, or a folder the CD's files were copied into." +msgstr "" + #: crates/cr-mac-ffi/src/parties.rs:269 #: crates/cr-win/src/app/parties.rs:177 msgid "Empty parties are removed when you leave this page." diff --git a/crates/cr-i18n/po/de.po b/crates/cr-i18n/po/de.po index 2a171e0..d3f42de 100644 --- a/crates/cr-i18n/po/de.po +++ b/crates/cr-i18n/po/de.po @@ -5269,8 +5269,8 @@ msgid "Help" msgstr "Hilfe" #: crates/cr-gtk/src/help.rs:284 -#: crates/cr-mac-ffi/src/lib.rs:855 -#: crates/cr-mac-ffi/src/lib.rs:901 +#: crates/cr-mac-ffi/src/lib.rs:892 +#: crates/cr-mac-ffi/src/lib.rs:938 #: crates/cr-win/src/app.rs:1834 #: crates/cr-win/src/app.rs:1843 #: crates/cr-win/src/app.rs:3522 @@ -5441,7 +5441,7 @@ msgid "Character created" msgstr "Charakter erstellt" #: crates/cr-gtk/src/main.rs:906 -#: crates/cr-mac-ffi/src/lib.rs:934 +#: crates/cr-mac-ffi/src/lib.rs:971 #: crates/cr-win/src/app.rs:2763 msgid "Converted to a character" msgstr "In einen Charakter umgewandelt" @@ -5665,7 +5665,7 @@ msgid "Show a Party" msgstr "Eine Gruppe anzeigen" #: crates/cr-gtk/src/main.rs:1589 -#: crates/cr-mac-ffi/src/lib.rs:629 +#: crates/cr-mac-ffi/src/lib.rs:666 #: crates/cr-win/src/app/library.rs:337 msgid "All Types" msgstr "Alle Typen" @@ -5714,7 +5714,7 @@ msgstr "Einträge" #: crates/cr-mac-ffi/src/encounter.rs:225 #: crates/cr-mac-ffi/src/encounter.rs:526 #: crates/cr-mac-ffi/src/encounter.rs:962 -#: crates/cr-mac-ffi/src/lib.rs:1109 +#: crates/cr-mac-ffi/src/lib.rs:1146 #: crates/cr-mac-ffi/src/sheet.rs:85 #: crates/cr-win/src/app/library.rs:261 #: crates/cr-win/src/app.rs:402 @@ -6380,19 +6380,19 @@ msgid "Choose Picture" msgstr "Bild wählen" #: crates/cr-gtk/src/picture.rs:282 -#: crates/cr-mac-ffi/src/lib.rs:984 +#: crates/cr-mac-ffi/src/lib.rs:1021 #: crates/cr-win/src/app/portrait.rs:120 msgid "Portraits" msgstr "Porträts" #: crates/cr-gtk/src/picture.rs:285 -#: crates/cr-mac-ffi/src/lib.rs:987 +#: crates/cr-mac-ffi/src/lib.rs:1024 #: crates/cr-win/src/app/portrait.rs:122 msgid "Portraits for {race}" msgstr "Porträts für {race}" #: crates/cr-gtk/src/picture.rs:286 -#: crates/cr-mac-ffi/src/lib.rs:988 +#: crates/cr-mac-ffi/src/lib.rs:1025 #: crates/cr-win/src/app/portrait.rs:123 msgid "Other Portraits" msgstr "Weitere Porträts" @@ -7950,6 +7950,10 @@ msgstr "{shown} von {count} angezeigt; suche, um die Liste einzugrenzen" msgid "Rank" msgstr "Rang" +#: crates/cr-mac-ffi/src/lib.rs:523 +msgid "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 or Expansion CD into the app's data folder. Choose the CD's ISO image, or a folder the CD's files were copied into." +msgstr "Kopiert die Regeldatenbanken, Bücher und Tabellen, die die App verwendet, von einer CD von Core Rules 2.0 oder der Expansion in den Datenordner der App. Wählen Sie das ISO-Abbild der CD oder einen Ordner, in den die Dateien der CD kopiert wurden." + #: crates/cr-mac-ffi/src/parties.rs:269 #: crates/cr-win/src/app/parties.rs:177 msgid "Empty parties are removed when you leave this page." diff --git a/crates/cr-i18n/po/es.po b/crates/cr-i18n/po/es.po index 3f3baaf..48497ed 100644 --- a/crates/cr-i18n/po/es.po +++ b/crates/cr-i18n/po/es.po @@ -5269,8 +5269,8 @@ msgid "Help" msgstr "Ayuda" #: crates/cr-gtk/src/help.rs:284 -#: crates/cr-mac-ffi/src/lib.rs:855 -#: crates/cr-mac-ffi/src/lib.rs:901 +#: crates/cr-mac-ffi/src/lib.rs:892 +#: crates/cr-mac-ffi/src/lib.rs:938 #: crates/cr-win/src/app.rs:1834 #: crates/cr-win/src/app.rs:1843 #: crates/cr-win/src/app.rs:3522 @@ -5441,7 +5441,7 @@ msgid "Character created" msgstr "Personaje creado" #: crates/cr-gtk/src/main.rs:906 -#: crates/cr-mac-ffi/src/lib.rs:934 +#: crates/cr-mac-ffi/src/lib.rs:971 #: crates/cr-win/src/app.rs:2763 msgid "Converted to a character" msgstr "Convertido en personaje" @@ -5665,7 +5665,7 @@ msgid "Show a Party" msgstr "Mostrar una compañía" #: crates/cr-gtk/src/main.rs:1589 -#: crates/cr-mac-ffi/src/lib.rs:629 +#: crates/cr-mac-ffi/src/lib.rs:666 #: crates/cr-win/src/app/library.rs:337 msgid "All Types" msgstr "Todos los tipos" @@ -5714,7 +5714,7 @@ msgstr "Entradas" #: crates/cr-mac-ffi/src/encounter.rs:225 #: crates/cr-mac-ffi/src/encounter.rs:526 #: crates/cr-mac-ffi/src/encounter.rs:962 -#: crates/cr-mac-ffi/src/lib.rs:1109 +#: crates/cr-mac-ffi/src/lib.rs:1146 #: crates/cr-mac-ffi/src/sheet.rs:85 #: crates/cr-win/src/app/library.rs:261 #: crates/cr-win/src/app.rs:402 @@ -6380,19 +6380,19 @@ msgid "Choose Picture" msgstr "Elegir imagen" #: crates/cr-gtk/src/picture.rs:282 -#: crates/cr-mac-ffi/src/lib.rs:984 +#: crates/cr-mac-ffi/src/lib.rs:1021 #: crates/cr-win/src/app/portrait.rs:120 msgid "Portraits" msgstr "Retratos" #: crates/cr-gtk/src/picture.rs:285 -#: crates/cr-mac-ffi/src/lib.rs:987 +#: crates/cr-mac-ffi/src/lib.rs:1024 #: crates/cr-win/src/app/portrait.rs:122 msgid "Portraits for {race}" msgstr "Retratos de {race}" #: crates/cr-gtk/src/picture.rs:286 -#: crates/cr-mac-ffi/src/lib.rs:988 +#: crates/cr-mac-ffi/src/lib.rs:1025 #: crates/cr-win/src/app/portrait.rs:123 msgid "Other Portraits" msgstr "Otros retratos" @@ -7950,6 +7950,10 @@ msgstr "Se muestran {shown} de {count}; busca para acotar la lista" msgid "Rank" msgstr "Rango" +#: crates/cr-mac-ffi/src/lib.rs:523 +msgid "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 or Expansion CD into the app's data folder. Choose the CD's ISO image, or a folder the CD's files were copied into." +msgstr "Copia las bases de datos de reglas, los libros y las tablas que usa la aplicación desde un CD de Core Rules 2.0 o de la Expansion a la carpeta de datos de la aplicación. Elija la imagen ISO del CD, o una carpeta a la que se copiaron los archivos del CD." + #: crates/cr-mac-ffi/src/parties.rs:269 #: crates/cr-win/src/app/parties.rs:177 msgid "Empty parties are removed when you leave this page." diff --git a/crates/cr-i18n/po/fr.po b/crates/cr-i18n/po/fr.po index 94b3a87..613d1bd 100644 --- a/crates/cr-i18n/po/fr.po +++ b/crates/cr-i18n/po/fr.po @@ -5269,8 +5269,8 @@ msgid "Help" msgstr "Aide" #: crates/cr-gtk/src/help.rs:284 -#: crates/cr-mac-ffi/src/lib.rs:855 -#: crates/cr-mac-ffi/src/lib.rs:901 +#: crates/cr-mac-ffi/src/lib.rs:892 +#: crates/cr-mac-ffi/src/lib.rs:938 #: crates/cr-win/src/app.rs:1834 #: crates/cr-win/src/app.rs:1843 #: crates/cr-win/src/app.rs:3522 @@ -5441,7 +5441,7 @@ msgid "Character created" msgstr "Personnage créé" #: crates/cr-gtk/src/main.rs:906 -#: crates/cr-mac-ffi/src/lib.rs:934 +#: crates/cr-mac-ffi/src/lib.rs:971 #: crates/cr-win/src/app.rs:2763 msgid "Converted to a character" msgstr "Converti en personnage" @@ -5665,7 +5665,7 @@ msgid "Show a Party" msgstr "Afficher une équipe" #: crates/cr-gtk/src/main.rs:1589 -#: crates/cr-mac-ffi/src/lib.rs:629 +#: crates/cr-mac-ffi/src/lib.rs:666 #: crates/cr-win/src/app/library.rs:337 msgid "All Types" msgstr "Tous les types" @@ -5714,7 +5714,7 @@ msgstr "Entrées" #: crates/cr-mac-ffi/src/encounter.rs:225 #: crates/cr-mac-ffi/src/encounter.rs:526 #: crates/cr-mac-ffi/src/encounter.rs:962 -#: crates/cr-mac-ffi/src/lib.rs:1109 +#: crates/cr-mac-ffi/src/lib.rs:1146 #: crates/cr-mac-ffi/src/sheet.rs:85 #: crates/cr-win/src/app/library.rs:261 #: crates/cr-win/src/app.rs:402 @@ -6380,19 +6380,19 @@ msgid "Choose Picture" msgstr "Choisir une image" #: crates/cr-gtk/src/picture.rs:282 -#: crates/cr-mac-ffi/src/lib.rs:984 +#: crates/cr-mac-ffi/src/lib.rs:1021 #: crates/cr-win/src/app/portrait.rs:120 msgid "Portraits" msgstr "Portraits" #: crates/cr-gtk/src/picture.rs:285 -#: crates/cr-mac-ffi/src/lib.rs:987 +#: crates/cr-mac-ffi/src/lib.rs:1024 #: crates/cr-win/src/app/portrait.rs:122 msgid "Portraits for {race}" msgstr "Portraits de {race}" #: crates/cr-gtk/src/picture.rs:286 -#: crates/cr-mac-ffi/src/lib.rs:988 +#: crates/cr-mac-ffi/src/lib.rs:1025 #: crates/cr-win/src/app/portrait.rs:123 msgid "Other Portraits" msgstr "Autres portraits" @@ -7950,6 +7950,10 @@ msgstr "{shown} sur {count} affichés ; recherchez pour réduire la liste" msgid "Rank" msgstr "Rang" +#: crates/cr-mac-ffi/src/lib.rs:523 +msgid "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 or Expansion CD into the app's data folder. Choose the CD's ISO image, or a folder the CD's files were copied into." +msgstr "Copie les bases de règles, les livres et les tables que l’application utilise depuis un CD de Core Rules 2.0 ou de l’Expansion dans le dossier de données de l’application. Choisissez l’image ISO du CD, ou un dossier dans lequel les fichiers du CD ont été copiés." + #: crates/cr-mac-ffi/src/parties.rs:269 #: crates/cr-win/src/app/parties.rs:177 msgid "Empty parties are removed when you leave this page." diff --git a/crates/cr-i18n/po/it.po b/crates/cr-i18n/po/it.po index fb2cec8..41590a5 100644 --- a/crates/cr-i18n/po/it.po +++ b/crates/cr-i18n/po/it.po @@ -5269,8 +5269,8 @@ msgid "Help" msgstr "Aiuto" #: crates/cr-gtk/src/help.rs:284 -#: crates/cr-mac-ffi/src/lib.rs:855 -#: crates/cr-mac-ffi/src/lib.rs:901 +#: crates/cr-mac-ffi/src/lib.rs:892 +#: crates/cr-mac-ffi/src/lib.rs:938 #: crates/cr-win/src/app.rs:1834 #: crates/cr-win/src/app.rs:1843 #: crates/cr-win/src/app.rs:3522 @@ -5441,7 +5441,7 @@ msgid "Character created" msgstr "Personaggio creato" #: crates/cr-gtk/src/main.rs:906 -#: crates/cr-mac-ffi/src/lib.rs:934 +#: crates/cr-mac-ffi/src/lib.rs:971 #: crates/cr-win/src/app.rs:2763 msgid "Converted to a character" msgstr "Convertito in personaggio" @@ -5665,7 +5665,7 @@ msgid "Show a Party" msgstr "Mostra una compagnia" #: crates/cr-gtk/src/main.rs:1589 -#: crates/cr-mac-ffi/src/lib.rs:629 +#: crates/cr-mac-ffi/src/lib.rs:666 #: crates/cr-win/src/app/library.rs:337 msgid "All Types" msgstr "Tutti i tipi" @@ -5714,7 +5714,7 @@ msgstr "Voci" #: crates/cr-mac-ffi/src/encounter.rs:225 #: crates/cr-mac-ffi/src/encounter.rs:526 #: crates/cr-mac-ffi/src/encounter.rs:962 -#: crates/cr-mac-ffi/src/lib.rs:1109 +#: crates/cr-mac-ffi/src/lib.rs:1146 #: crates/cr-mac-ffi/src/sheet.rs:85 #: crates/cr-win/src/app/library.rs:261 #: crates/cr-win/src/app.rs:402 @@ -6380,19 +6380,19 @@ msgid "Choose Picture" msgstr "Scegli immagine" #: crates/cr-gtk/src/picture.rs:282 -#: crates/cr-mac-ffi/src/lib.rs:984 +#: crates/cr-mac-ffi/src/lib.rs:1021 #: crates/cr-win/src/app/portrait.rs:120 msgid "Portraits" msgstr "Ritratti" #: crates/cr-gtk/src/picture.rs:285 -#: crates/cr-mac-ffi/src/lib.rs:987 +#: crates/cr-mac-ffi/src/lib.rs:1024 #: crates/cr-win/src/app/portrait.rs:122 msgid "Portraits for {race}" msgstr "Ritratti per {race}" #: crates/cr-gtk/src/picture.rs:286 -#: crates/cr-mac-ffi/src/lib.rs:988 +#: crates/cr-mac-ffi/src/lib.rs:1025 #: crates/cr-win/src/app/portrait.rs:123 msgid "Other Portraits" msgstr "Altri ritratti" @@ -7950,6 +7950,10 @@ msgstr "Mostrati {shown} di {count}; cerca per restringere l’elenco" msgid "Rank" msgstr "Grado" +#: crates/cr-mac-ffi/src/lib.rs:523 +msgid "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 or Expansion CD into the app's data folder. Choose the CD's ISO image, or a folder the CD's files were copied into." +msgstr "Copia i database delle regole, i libri e le tabelle che l'app usa da un CD di Core Rules 2.0 o dell'Expansion nella cartella dei dati dell'app. Scegli l'immagine ISO del CD, oppure una cartella in cui sono stati copiati i file del CD." + #: crates/cr-mac-ffi/src/parties.rs:269 #: crates/cr-win/src/app/parties.rs:177 msgid "Empty parties are removed when you leave this page." diff --git a/crates/cr-i18n/po/pt_BR.po b/crates/cr-i18n/po/pt_BR.po index 58f353e..932272a 100644 --- a/crates/cr-i18n/po/pt_BR.po +++ b/crates/cr-i18n/po/pt_BR.po @@ -5269,8 +5269,8 @@ msgid "Help" msgstr "Ajuda" #: crates/cr-gtk/src/help.rs:284 -#: crates/cr-mac-ffi/src/lib.rs:855 -#: crates/cr-mac-ffi/src/lib.rs:901 +#: crates/cr-mac-ffi/src/lib.rs:892 +#: crates/cr-mac-ffi/src/lib.rs:938 #: crates/cr-win/src/app.rs:1834 #: crates/cr-win/src/app.rs:1843 #: crates/cr-win/src/app.rs:3522 @@ -5441,7 +5441,7 @@ msgid "Character created" msgstr "Personagem criado" #: crates/cr-gtk/src/main.rs:906 -#: crates/cr-mac-ffi/src/lib.rs:934 +#: crates/cr-mac-ffi/src/lib.rs:971 #: crates/cr-win/src/app.rs:2763 msgid "Converted to a character" msgstr "Convertido em personagem" @@ -5665,7 +5665,7 @@ msgid "Show a Party" msgstr "Mostrar uma companhia" #: crates/cr-gtk/src/main.rs:1589 -#: crates/cr-mac-ffi/src/lib.rs:629 +#: crates/cr-mac-ffi/src/lib.rs:666 #: crates/cr-win/src/app/library.rs:337 msgid "All Types" msgstr "Todos os tipos" @@ -5714,7 +5714,7 @@ msgstr "Entradas" #: crates/cr-mac-ffi/src/encounter.rs:225 #: crates/cr-mac-ffi/src/encounter.rs:526 #: crates/cr-mac-ffi/src/encounter.rs:962 -#: crates/cr-mac-ffi/src/lib.rs:1109 +#: crates/cr-mac-ffi/src/lib.rs:1146 #: crates/cr-mac-ffi/src/sheet.rs:85 #: crates/cr-win/src/app/library.rs:261 #: crates/cr-win/src/app.rs:402 @@ -6380,19 +6380,19 @@ msgid "Choose Picture" msgstr "Escolher imagem" #: crates/cr-gtk/src/picture.rs:282 -#: crates/cr-mac-ffi/src/lib.rs:984 +#: crates/cr-mac-ffi/src/lib.rs:1021 #: crates/cr-win/src/app/portrait.rs:120 msgid "Portraits" msgstr "Retratos" #: crates/cr-gtk/src/picture.rs:285 -#: crates/cr-mac-ffi/src/lib.rs:987 +#: crates/cr-mac-ffi/src/lib.rs:1024 #: crates/cr-win/src/app/portrait.rs:122 msgid "Portraits for {race}" msgstr "Retratos de {race}" #: crates/cr-gtk/src/picture.rs:286 -#: crates/cr-mac-ffi/src/lib.rs:988 +#: crates/cr-mac-ffi/src/lib.rs:1025 #: crates/cr-win/src/app/portrait.rs:123 msgid "Other Portraits" msgstr "Outros retratos" @@ -7950,6 +7950,10 @@ msgstr "Mostrando {shown} de {count}; pesquise para reduzir a lista" msgid "Rank" msgstr "Grau" +#: crates/cr-mac-ffi/src/lib.rs:523 +msgid "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 or Expansion CD into the app's data folder. Choose the CD's ISO image, or a folder the CD's files were copied into." +msgstr "Copia os bancos de regras, os livros e as tabelas que o app usa de um CD do Core Rules 2.0 ou da Expansion para a pasta de dados do app. Escolha a imagem ISO do CD, ou uma pasta para a qual os arquivos do CD foram copiados." + #: crates/cr-mac-ffi/src/parties.rs:269 #: crates/cr-win/src/app/parties.rs:177 msgid "Empty parties are removed when you leave this page." diff --git a/crates/cr-mac-ffi/src/lib.rs b/crates/cr-mac-ffi/src/lib.rs index d7635ce..9c2355d 100644 --- a/crates/cr-mac-ffi/src/lib.rs +++ b/crates/cr-mac-ffi/src/lib.rs @@ -503,6 +503,43 @@ pub fn screen_help(screen: HelpScreen) -> u32 { } } +/// What Extract Data from CD… did. +#[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)] +pub struct Extracted { + /// The folder the data went into. + pub path: String, + pub said: String, + /// Whether it is the app's data folder, which the app opens on start; + /// else that holds a package already (usually the other CD's) and + /// the copy is only offered to open. + pub data_folder: bool, +} + +/// What Extract Data from CD… does, asked before the source is chosen. +/// A Mac has no CD drive: the data comes from the CD's ISO image or a +/// folder its files were copied into. +#[uniffi::export] +pub fn extract_intro() -> String { + cr_i18n::tr( + "Copies the rules databases, books and tables the app uses from a Core Rules 2.0 \ + or Expansion CD into the app's data folder. Choose the CD's ISO image, or a \ + folder the CD's files were copied into.", + ) + .to_owned() +} + +/// Extract Data from CD… from the ISO image or folder `source`. Takes a +/// while; the app calls it off the main thread. +#[uniffi::export] +pub fn extract_data(source: String) -> Result { + let dest = cr_app::extract::extract(std::path::Path::new(&source)).map_err(CoreError::new)?; + Ok(Extracted { + path: dest.path.display().to_string(), + said: cr_app::extract::extracted(&dest), + data_folder: dest.is_data_folder, + }) +} + /// What About shows of the app. #[derive(Debug, Clone, PartialEq, Eq, uniffi::Record)] pub struct AboutInfo { diff --git a/docs/roadmap.md b/docs/roadmap.md index 9dd3bb6..066e974 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -509,8 +509,8 @@ The phases run in order: `macos/scripts/make-app.sh` builds `Core Rules.app` with `swiftc` (no Xcode project), signs it ad hoc and packs the `.dmg`, which CI uploads on every pull request. -4. **Porting the screens (in progress)**, in the stages of the Windows - port, one pull request each, until `NOT_YET_ON_MACOS` is empty. +4. **Porting the screens (done)**, in the stages of the Windows + port, one pull request each, until `NOT_YET_ON_MACOS` was empty. Wagner Brahm approved the prototype on a MacBook Pro M4 Pro on 2026-10-29; its test found Open Anyway not offered, so the `.dmg`'s notes lead with removing the quarantine in Terminal, and the weapons @@ -614,7 +614,15 @@ The phases run in order: checked by category, New Package… and Edit Package… in a sheet with the items by category, Remove, Add Items and Save, and Import Core Rules 2.0… from the folder of a Core Rules 2.0 installation, through - the Import… sheet; all in the File menu. + the Import… sheet; all in the File menu (#133). + - **Extract Data from CD (done).** A Mac has had no CD drive for + years, so the Mac app takes only the CD's ISO image or a folder its + files were copied into, with its own wording of the question, and + extracts off the main thread under a progress sheet; the copy opens + at once when it is the data folder's, or is offered to open when + that folder already holds the other CD's. It is in the File menu + and on the No Installation screen. With it `NOT_YET_ON_MACOS` is + empty. 5. **Beta and release** on the three systems with the same tag, with an install page on the website and in the README that shows the Open Anyway steps. diff --git a/macos/CoreRules/Action.swift b/macos/CoreRules/Action.swift index 3dbb428..85a0a86 100644 --- a/macos/CoreRules/Action.swift +++ b/macos/CoreRules/Action.swift @@ -43,6 +43,7 @@ struct Action: Hashable { static let TRAP_COPY = Action("TRAP_COPY") static let TRAP_DELETE = Action("TRAP_DELETE") static let IMPORT = Action("IMPORT") + static let EXTRACT_DATA = Action("EXTRACT_DATA") static let IMPORT_CORE20 = Action("IMPORT_CORE20") static let EXPORT = Action("EXPORT") static let NEW_PACKAGE = Action("NEW_PACKAGE") diff --git a/macos/CoreRules/ContentView.swift b/macos/CoreRules/ContentView.swift index 01a74cc..af672b6 100644 --- a/macos/CoreRules/ContentView.swift +++ b/macos/CoreRules/ContentView.swift @@ -33,6 +33,16 @@ struct ContentView: View { } .modifier(NoticeAlert()) .modifier(ConfirmAlert()) + .sheet(isPresented: working) { + WorkingView(text: model.working ?? "") + } + } + + /// Whether something runs under the progress sheet. + private var working: Binding { + Binding( + get: { model.working != nil }, + set: { (_: Bool) in }) } @ViewBuilder @@ -62,6 +72,7 @@ struct NoInstallation: View { } description: { Text(model.noInstallation) } actions: { + Button(more(tr("Extract Data from _CD…"))) { model.perform(Action.EXTRACT_DATA) } Button(more(tr("_Open Folder…"))) { model.perform(Action.OPEN) } } } @@ -166,6 +177,7 @@ struct ConfirmAlert: ViewModifier { case .toNpc: return tr("Convert to NPC?") case .deleteRecord(_, _, let title, _): return title case .restoreTable(_, let title, _): return title + case .extractSource, .openExtracted: return tr("Extract Data from CD") case nil: return "" } } @@ -177,6 +189,8 @@ struct ConfirmAlert: ViewModifier { return tr("This will move the selected Player Character to the NPC List in the DM Toolkit.") case .deleteRecord(_, _, _, let text): return text case .restoreTable(_, _, let text): return text + case .extractSource: return extractIntro() + case .openExtracted(_, let text): return text case nil: return "" } } @@ -184,6 +198,7 @@ struct ConfirmAlert: ViewModifier { private var yes: String { if case .toNpc = model.confirm { return tr("_Convert") } if case .restoreTable = model.confirm { return tr("_Restore") } + if case .openExtracted = model.confirm { return tr("_Open") } return tr("_Delete") } @@ -196,14 +211,36 @@ struct ConfirmAlert: ViewModifier { func body(content: Content) -> some View { content.alert(title, isPresented: shown) { - Button(yes, role: destructive ? .destructive : nil) { model.answer(true) } - Button(tr("_Cancel"), role: .cancel) { model.answer(false) } + if case .extractSource = model.confirm { + Button(more(tr("_ISO Image…"))) { model.extractFrom(folder: false) } + Button(more(tr("_Folder…"))) { model.extractFrom(folder: true) } + Button(tr("_Cancel"), role: .cancel) { model.answer(false) } + } else { + Button(yes, role: destructive ? .destructive : nil) { model.answer(true) } + Button(tr("_Cancel"), role: .cancel) { model.answer(false) } + } } message: { Text(text) } } } +/// What runs, under a sheet that cannot be closed until it is done. +struct WorkingView: View { + let text: String + + var body: some View { + HStack(spacing: 12) { + ProgressView() + .controlSize(.small) + Text(text) + } + .padding(24) + .frame(minWidth: 320) + .interactiveDismissDisabled() + } +} + struct EntryList: View { @EnvironmentObject var model: AppModel diff --git a/macos/CoreRules/CoreRulesApp.swift b/macos/CoreRules/CoreRulesApp.swift index 6692529..68861bc 100644 --- a/macos/CoreRules/CoreRulesApp.swift +++ b/macos/CoreRules/CoreRulesApp.swift @@ -117,6 +117,7 @@ struct MenuCommands: Commands { item(tr("E_nter Character…"), Action.ENTER_CHARACTER) item(more(model.newRecordLabel ?? tr("New")), Action.UDB_NEW) item(more(tr("_Open Folder…")), Action.OPEN) + item(more(tr("Extract Data from _CD…")), Action.EXTRACT_DATA) .keyboardShortcut("o") Divider() item(more(tr("_Import…")), Action.IMPORT) diff --git a/macos/CoreRules/Model.swift b/macos/CoreRules/Model.swift index 590189e..aab76ca 100644 --- a/macos/CoreRules/Model.swift +++ b/macos/CoreRules/Model.swift @@ -49,6 +49,11 @@ enum Confirm { case deleteRecord(section: String, name: String, title: String, text: String) /// Restore on a shipped treasure table. case restoreTable(name: String, title: String, text: String) + /// Extract Data from CD…: from the CD's ISO image or a folder. + case extractSource + /// The data extracted went beside the package already in the data + /// folder: open it? + case openExtracted(path: String, text: String) } @MainActor @@ -87,6 +92,8 @@ final class AppModel: ObservableObject { @Published var modal: Modal? @Published var notice: Notice? @Published var confirm: Confirm? + /// What runs under a progress sheet, said in it. + @Published var working: String? static let noFilter = ListFilter( search: "", origins: 0, party: nil, partType: nil, magicOnly: false) @@ -235,6 +242,8 @@ final class AppModel: ObservableObject { return writable && modal == nil case Action.ROLL_TABLE: return library != nil + case Action.EXTRACT_DATA: + return modal == nil && working == nil case Action.ROLL_TREASURE, Action.NEW_ENCOUNTER, Action.NEW_TABLE: return writable case Action.SHEET_PRINT: @@ -280,6 +289,7 @@ final class AppModel: ObservableObject { case Action.PREFERENCES: openSettings() case Action.ABOUT: openAbout() case Action.OPEN: chooseFolder() + case Action.EXTRACT_DATA: confirm = .extractSource case Action.NEW_CHARACTER: newCharacter(entering: false) case Action.ENTER_CHARACTER: newCharacter(entering: true) case Action.IMPORT: chooseImport() @@ -323,6 +333,61 @@ final class AppModel: ObservableObject { } } + /// Opens the installation in `path`, and opens it on start. + private func openLibrary(at path: String) { + do { + let library = try Library.open(path: path) + Prefs.folder = path + section = nil + show(library) + } catch { + fail(tr("No Core Rules Installation"), error) + } + } + + /// Extract Data from CD…'s ISO Image… or Folder…: a Mac has no CD + /// drive, so the data comes from the CD's image or a copy of its + /// files. + func extractFrom(folder: Bool) { + confirm = nil + let panel = NSOpenPanel() + panel.allowsMultipleSelection = false + if folder { + panel.canChooseFiles = false + panel.canChooseDirectories = true + panel.message = tr("Choose the Core Rules CD or Installation") + } else { + panel.allowedContentTypes = [UTType(filenameExtension: "iso")].compactMap { $0 } + panel.message = tr("Choose the Core Rules CD Image") + } + guard panel.runModal() == .OK, let url = panel.url else { return } + working = tr("Extracting the Core Rules data…") + let source = url.path + Task { [weak self] in + let result = await Task.detached { + Result { try extractData(source: source) } + }.value + self?.extracted(result) + } + } + + private func extracted(_ result: Result) { + working = nil + switch result { + case .success(let done): + if done.dataFolder { + openLibrary(at: done.path) + notice = Notice(title: done.said, text: "") + } else { + // The data folder already holds a package (usually the + // other CD's), which stays the one opened on start. + confirm = .openExtracted(path: done.path, text: done.said) + } + case .failure(let error): + fail(tr("Could Not Extract the Data"), error) + } + } + func chooseFolder() { let panel = NSOpenPanel() panel.canChooseFiles = false @@ -867,6 +932,10 @@ final class AppModel: ObservableObject { func answer(_ yes: Bool) { guard let asked = confirm else { return } confirm = nil + if case .openExtracted(let path, _) = asked { + if yes { openLibrary(at: path) } + return + } guard yes, let library else { return } do { switch asked { @@ -884,6 +953,8 @@ final class AppModel: ObservableObject { library.forgetRules() reload(select: done.key) notice = Notice(title: done.said, text: "") + case .extractSource, .openExtracted: + break } } catch { fail(tr("Not Saved"), error)