main: hide UUP-Dump under advanced options

This commit is contained in:
osy 2024-03-28 15:36:31 -07:00
parent 7e51b9b419
commit 38f64ea283
2 changed files with 12 additions and 5 deletions

View file

@ -19,7 +19,8 @@ import SwiftUI
@main @main
struct Main: App { struct Main: App {
@StateObject private var worker = Worker() @StateObject private var worker = Worker()
@AppStorage("ShowAdvancedOptions") private var showAdvancedOptions: Bool = false
var body: some Scene { var body: some Scene {
WindowGroup(id: "ESDConvert") { WindowGroup(id: "ESDConvert") {
SimpleContentView().environmentObject(worker) SimpleContentView().environmentObject(worker)
@ -31,6 +32,9 @@ struct Main: App {
.frame(minWidth: 800, minHeight: 400) .frame(minWidth: 800, minHeight: 400)
}.commands { }.commands {
SidebarCommands() SidebarCommands()
CommandGroup(after: .sidebar) {
Toggle("Show Advanced Options", isOn: $showAdvancedOptions)
}
}.handlesExternalEvents(matching: Set(["UUPDump"])) }.handlesExternalEvents(matching: Set(["UUPDump"]))
} }
} }

View file

@ -18,6 +18,7 @@ import SwiftUI
struct SimpleContentView: View { struct SimpleContentView: View {
@EnvironmentObject private var worker: Worker @EnvironmentObject private var worker: Worker
@AppStorage("ShowAdvancedOptions") private var showAdvancedOptions: Bool = false
@State private var isConfirmCancelShown: Bool = false @State private var isConfirmCancelShown: Bool = false
@State private var isDownloadCompleted: Bool = false @State private var isDownloadCompleted: Bool = false
@ -88,10 +89,12 @@ struct SimpleContentView: View {
} }
} }
HStack { HStack {
ShowWindowButtonView(id: "UUPDump") { if showAdvancedOptions {
Text("All builds…") ShowWindowButtonView(id: "UUPDump") {
}.disabled(worker.isBusy) Text("All builds…")
.help("Build custom installation for any build through UUP Dump.") }.disabled(worker.isBusy)
.help("Build custom installation for any build through UUP Dump.")
}
Spacer() Spacer()
if worker.isBusy { if worker.isBusy {
Button(role: .cancel) { Button(role: .cancel) {