diff --git a/Sources/Demo/AboutDialogDemo.swift b/Sources/Demo/AboutDialogDemo.swift new file mode 100644 index 0000000..ef0a5ee --- /dev/null +++ b/Sources/Demo/AboutDialogDemo.swift @@ -0,0 +1,115 @@ +// +// AboutDialogDemo.swift +// Adwaita +// +// Created by lambdaclan on 24.01.26. +// + +// swiftlint:disable missing_docs + +import Adwaita +import Foundation + +enum AboutDialogDemo { + + static var sample: (inout AdwaitaAboutDialogConfig) -> Void { + { cfg in + applyDemoConfig(&cfg) + } + } + + private static let demoReleaseNotes = """ +

This template supports three structures: paragraphs using <p>, ordered lists using + <ol>, and unordered lists using <ul>. + Both list types must contain list items marked with <li>.

+

Within paragraphs and list items, you may use <em> to apply + emphasis(italic text) and <code> to mark inline code + for monospaced text. + These inline styles are supported only inside those elements.

+

Any text placed outside <p>, <ol>, + <ul>, or <li> tags is ignored by the template + processor.

+
    +
  1. Ordered list items represent numbered content and may + include <em> for emphasis or <code> for inline code.
  2. +
  3. They follow the same rules as paragraphs regarding allowed inline styles.
  4. +
+ + """ + + private static let demoComments = """ + This text demonstrates basic Pango markup along with helpful documentation links. + + Comments shown in an Adwaita AboutDialog will appear on the Details page. + They can be long and detailed, and they may include links and Pango markup for + formatting. + + Pango markup supports tags like: + • bold + • italic + • colored text + + Full reference: Pango Markup + Reference + + Example markup: + Demo Title + Highlighted text + Underlined text + + Useful links: + • Adwaita‑Swift Documentation + + You can embed these links directly in your UI using Pango markup. + """ + + private static func applyDemoConfig(_ cfg: inout AdwaitaAboutDialogConfig) { + cfg.appName = "Demo" + cfg.developer = "david-swift" + cfg.version = "Test" + cfg.icon = .default(icon: .applicationXExecutable) + + cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/tutorials/table-of-contents") + cfg.issues = URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift/issues") + cfg.support = URL(string: "https://adwaita-swift.aparoksha.dev/") + + cfg.links = [ + .init(title: "Source Code", url: URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift")), + .init(title: "Donate", url: URL(string: "https://ko-fi.com/david_swift")) + ] + + cfg.copyright = "© 2026 david-swift" + cfg.license = "MIT" + cfg.releaseNotes = demoReleaseNotes + cfg.comments = demoComments + + cfg.credits = [ + .init(role: .developer, name: "Jane Doe"), + .init(role: .developer, name: "John Roe"), + .init(role: .designer, name: "Mika Sato"), + .init(role: .artist, name: "Leo Martins"), + .init(role: .translator, name: "Yuki Nakamura"), + .init(role: .translator, name: "Tod Brown") + ] + + cfg.acknowledgements = [ + .init(title: "Special Thanks", name: "GNOME Project"), + .init(title: "Special Thanks", name: "Swift Programming Language"), + .init(title: "Additional Support", name: "LibAdwaita Contributors") + ] + + cfg.otherApps = [ + .init( + appID: "io.github.david_swift.Flashcards", + name: "Memorize", + summary: "An app for creating, studying, and importing flashcard sets with a built‑in test mode." + ) + ] + } + +} + +// swiftlint:enable missing_docs diff --git a/Sources/Demo/Demo.swift b/Sources/Demo/Demo.swift index ea0783c..9ecc73f 100644 --- a/Sources/Demo/Demo.swift +++ b/Sources/Demo/Demo.swift @@ -150,36 +150,7 @@ struct Demo: App { } .collapsed(!wide) .breakpoint(minWidth: 550, matches: $wide) - .aboutDialog(visible: $about) { cfg in - cfg.appName = "Demo" - cfg.developer = "david-swift" - cfg.version = "Test" - cfg.icon = .default(icon: .applicationXExecutable) - cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/tutorials/table-of-contents") - cfg.issues = URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift/issues") - cfg.support = URL(string: "https://adwaita-swift.aparoksha.dev/") - cfg.links = [ - .init(title: "Source Code", url: URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift")), - .init(title: "Donate", url: URL(string: "https://ko-fi.com/david_swift")) - ] - cfg.copyright = "© 2026 david-swift" - cfg.license = "MIT" - cfg.releaseNotes = AdwaitaAboutDialogConfig.demoReleaseNotes - cfg.comments = AdwaitaAboutDialogConfig.demoComments - cfg.credits = [ - .init(role: .developer, name: "Jane Doe"), - .init(role: .developer, name: "John Roe"), - .init(role: .designer, name: "Mika Sato"), - .init(role: .artist, name: "Leo Martins"), - .init(role: .translator, name: "Yuki Nakamura"), - .init(role: .translator, name: "Tod Brown") - ] - cfg.acknowledgements = [ - .init(title: "Special Thanks", name: "GNOME Project"), - .init(title: "Special Thanks", name: "Swift Programming Language"), - .init(title: "Additional Support", name: "LibAdwaita Contributors") - ] - } + .aboutDialog(visible: $about, configure: AboutDialogDemo.sample) .preferencesDialog(visible: $preferences) .preferencesPage("Page 1", icon: .default(icon: .audioHeadset)) { page in page