Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

Whole-app review, batch 3: Settings shows progress; targeting fixed

Gauthier Piarrette7640b542b0e2
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 582891e..425819b 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -268,12 +268,12 @@ final class AppState {
/// The environment a dropped program runs in: the page it was dropped on, else the default.
var pendingRunBottle: String?
- func chooseProgramToRun() {
+ func chooseProgramToRun(in bottle: String? = nil) {
let panel = NSOpenPanel()
panel.title = L("Choose a Windows program")
panel.allowedContentTypes = [.exe, .msi, .bat].compactMap { $0 }
panel.allowsMultipleSelection = false
- if panel.runModal() == .OK, let url = panel.url { pendingRun = url }
+ if panel.runModal() == .OK, let url = panel.url { pendingRunBottle = bottle; pendingRun = url }
}
let paths = HighballPaths()
@@ -626,7 +626,9 @@ final class AppState {
/// The environment new games go into: the one named Games, else the first.
var defaultBottle: Bottle? {
- bottles.first { $0.name == Self.defaultEnvironmentName } ?? bottles.first
+ bottles.first { $0.name == Self.defaultEnvironmentName }
+ ?? bottles.first { steamInstalled(in: $0) }
+ ?? bottles.first
}
/// Makes the default environment for a Mac that has the engine but no bottle yet.
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index b920ec4..99f46ff 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -53,7 +53,7 @@ struct BottleView: View {
launchersSection
if !customPins.isEmpty { programsSection }
HStack(spacing: 6) {
- Button { state.chooseProgramToRun() } label: {
+ Button { state.chooseProgramToRun(in: bottle.name) } label: {
Label(L("Run a Windows program…"), systemImage: "folder")
}.buttonStyle(.link)
Text(L("— or drop any .exe or .msi on this window")).font(.caption).foregroundStyle(.secondary)
@@ -303,6 +303,7 @@ struct BottleSettingsSheet: View {
.font(.caption).foregroundStyle(.secondary)
Button(L("Review license…")) {
Task { @MainActor in
+ state.licenseEngine = engine
state.loadGPTKLicense()
state.showGPTKLicense = true
}
diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swift
index 20af709..8a418b6 100644
--- a/Sources/HighballApp/LibraryView.swift
+++ b/Sources/HighballApp/LibraryView.swift
@@ -129,7 +129,7 @@ struct LibraryView: View {
HStack(alignment: .top, spacing: 14) {
sourceCard(symbol: "gamecontroller.fill", accent: true, title: L("Steam"),
text: L("Install Steam and sign in. Your Steam library shows up here. Its first start takes 15 to 25 minutes."),
- button: L("Install Steam")) { state.installSteam() }
+ button: state.defaultBottle.map(state.steamInstalled) == true ? L("Open Steam") : L("Install Steam")) { state.installSteam() }
sourceCard(symbol: "bag.fill", accent: false, title: L("Epic Games"),
text: L("Connect your Epic account. Your games install straight into Highball."),
button: L("Connect Epic")) { state.showEpicSignIn = true }
diff --git a/Sources/HighballApp/SettingsView.swift b/Sources/HighballApp/SettingsView.swift
index f618c4d..9415771 100644
--- a/Sources/HighballApp/SettingsView.swift
+++ b/Sources/HighballApp/SettingsView.swift
@@ -7,12 +7,38 @@ struct SettingsView: View {
@Environment(AppState.self) private var state
var body: some View {
- TabView {
- EnvironmentsPane().tabItem { Label(L("Environments"), systemImage: "cylinder.split.1x2") }
- EnginePane().tabItem { Label(L("Engine"), systemImage: "gearshape.2") }
- TroubleshootingPane().tabItem { Label(L("Troubleshooting"), systemImage: "wrench.and.screwdriver") }
+ @Bindable var state = state
+ VStack(spacing: 0) {
+ TabView {
+ EnvironmentsPane().tabItem { Label(L("Environments"), systemImage: "cylinder.split.1x2") }
+ EnginePane().tabItem { Label(L("Engine"), systemImage: "gearshape.2") }
+ TroubleshootingPane().tabItem { Label(L("Troubleshooting"), systemImage: "wrench.and.screwdriver") }
+ }
+ // The strip lives on the main window; a compact echo here so a repair or a new
+ // environment started from Settings is not silent (review #14).
+ if state.busy {
+ Divider()
+ HStack(spacing: 10) {
+ ProgressView().controlSize(.small)
+ Text(state.busyTitle).font(.callout).lineLimit(1)
+ if !state.stage.isEmpty { Text(state.stage).font(.caption).foregroundStyle(.secondary).lineLimit(1) }
+ Spacer()
+ if let stop = state.busyStop { Button(stop.label) { state.stopBusy() }.controlSize(.small) }
+ }
+ .padding(.horizontal, 16).padding(.vertical, 8)
+ } else if let done = state.doneState {
+ Divider()
+ HStack(spacing: 10) {
+ Image(systemName: "checkmark.circle.fill").foregroundStyle(HB.good)
+ Text(done.title).font(.callout).lineLimit(1)
+ Spacer()
+ Button(L("Dismiss")) { state.doneState = nil }.controlSize(.small)
+ }
+ .padding(.horizontal, 16).padding(.vertical, 8)
+ }
}
- .frame(minWidth: 760, minHeight: 520)
+ .frame(minWidth: 820, minHeight: 560)
+ .sheet(isPresented: $state.showGPTKLicense) { GPTKLicenseSheet() }
}
}
@@ -73,7 +99,7 @@ struct EnvironmentsPane: View {
BottleView(bottle: bottle)
.toolbar { ToolbarItem(placement: .cancellationAction) { Button(L("Done")) { openName = nil } } }
}
- .frame(minWidth: 820, minHeight: 620)
+ .frame(minWidth: 780, minHeight: 560)
}
}
.sheet(isPresented: $showCreate) { CreateBottleSheet() }