Skip to content

Commit b80889d

Browse files
authored
Merge pull request #33 from ohaiibuzzle/feat/wine-update-button
feat: button to update/reset Wine runtime libraries
2 parents 84a8bc7 + 0eb0477 commit b80889d

File tree

3 files changed

+58
-56
lines changed

3 files changed

+58
-56
lines changed

Harbor/Localizable.xcstrings

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -196,28 +196,6 @@
196196
}
197197
}
198198
},
199-
"envEditor.key" : {
200-
"extractionState" : "stale",
201-
"localizations" : {
202-
"en" : {
203-
"stringUnit" : {
204-
"state" : "translated",
205-
"value" : "Key"
206-
}
207-
}
208-
}
209-
},
210-
"envEditor.value" : {
211-
"extractionState" : "stale",
212-
"localizations" : {
213-
"en" : {
214-
"stringUnit" : {
215-
"state" : "translated",
216-
"value" : "Value"
217-
}
218-
}
219-
}
220-
},
221199
"harbor.errorAlert" : {
222200
"localizations" : {
223201
"en" : {
@@ -777,6 +755,16 @@
777755
}
778756
}
779757
},
758+
"sheet.advConf.update" : {
759+
"localizations" : {
760+
"en" : {
761+
"stringUnit" : {
762+
"state" : "translated",
763+
"value" : "Update"
764+
}
765+
}
766+
}
767+
},
780768
"sheet.advConf.winecfgBtn" : {
781769
"localizations" : {
782770
"en" : {

Harbor/UIElements/BottleManagement/BottleCardListView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ struct BottleCardDetailedView: View {
240240
.formStyle(.grouped)
241241
HStack {
242242
Spacer()
243+
Button {
244+
bottle.directLaunchApplication("wineboot", arguments: ["-u"])
245+
} label: {
246+
Label("sheet.advConf.update", systemImage: "arrow.clockwise")
247+
}
243248
Button {
244249
// ALARM
245250
let alert = NSAlert()

Harbor/UIElements/BottleManagement/BottleConfigDropdown.swift

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,56 @@ struct BottleConfigDropdown: View {
2020
.font(.title)
2121
.padding()
2222
Spacer()
23-
VStack(alignment: .leading) {
24-
Toggle("sheet.advConf.hudToggle", isOn: $bottle.enableHUD)
25-
Toggle("sheet.advConf.eSyncToggle", isOn: $bottle.enableESync)
26-
Toggle("sheet.advConf.stdOutToggle", isOn: $bottle.pleaseShutUp)
27-
if canSetDXVK {
28-
Toggle("sheet.advConf.dxvkToggle", isOn: $bottleDXVKStatus)
29-
.disabled(!DXVKUtils.shared.isDXVKAvailable() || !canSetDXVK)
30-
.onChange(of: bottleDXVKStatus) { _, newValue in
31-
canSetDXVK = false
32-
Task.detached {
33-
if newValue {
34-
BottleDXVK.shared.installDXVKToBottle(bottle: bottle)
35-
} else {
36-
BottleDXVK.shared.removeDXVKFromBottle(bottle: bottle)
37-
}
38-
Task { @MainActor in
39-
canSetDXVK = true
23+
Form {
24+
Section {
25+
Toggle("sheet.advConf.hudToggle", isOn: $bottle.enableHUD)
26+
Toggle("sheet.advConf.eSyncToggle", isOn: $bottle.enableESync)
27+
Toggle("sheet.advConf.stdOutToggle", isOn: $bottle.pleaseShutUp)
28+
if canSetDXVK {
29+
Toggle("sheet.advConf.dxvkToggle", isOn: $bottleDXVKStatus)
30+
.disabled(!DXVKUtils.shared.isDXVKAvailable() || !canSetDXVK)
31+
.onChange(of: bottleDXVKStatus) { _, newValue in
32+
canSetDXVK = false
33+
Task.detached {
34+
if newValue {
35+
BottleDXVK.shared.installDXVKToBottle(bottle: bottle)
36+
} else {
37+
BottleDXVK.shared.removeDXVKFromBottle(bottle: bottle)
38+
}
39+
Task { @MainActor in
40+
canSetDXVK = true
41+
}
4042
}
4143
}
44+
} else {
45+
HStack {
46+
Text("sheet.advConf.dxvkToggle")
47+
Spacer()
48+
ProgressView()
49+
.progressViewStyle(.circular)
50+
.controlSize(.small)
4251
}
43-
} else {
44-
HStack {
45-
ProgressView()
46-
.progressViewStyle(.circular)
47-
.controlSize(.small)
48-
Text("sheet.advConf.dxvkToggle")
4952
}
5053
}
51-
}
52-
Spacer()
53-
HStack {
54-
Button("sheet.advConf.winecfgBtn") {
55-
bottle.launchApplication("winecfg")
56-
}
57-
Button("sheet.advConf.explorerBtn") {
58-
bottle.launchApplication("explorer")
59-
}
60-
Button("sheet.advConf.regeditBtn") {
61-
bottle.launchApplication("regedit")
54+
Section {
55+
HStack {
56+
Button("sheet.advConf.winecfgBtn") {
57+
bottle.launchApplication("winecfg")
58+
}
59+
Button("sheet.advConf.explorerBtn") {
60+
bottle.launchApplication("explorer")
61+
}
62+
Button("sheet.advConf.regeditBtn") {
63+
bottle.launchApplication("regedit")
64+
}
65+
Spacer()
66+
Button("sheet.advConf.update") {
67+
bottle.directLaunchApplication("wineboot", arguments: ["-b"])
68+
}
69+
}
6270
}
6371
}
72+
.formStyle(.grouped)
6473
Spacer()
6574
Button("btn.OK") {
6675
if let bottleIndex = BottleLoader.shared.bottles.firstIndex(where: { $0.id == bottle.id }) {

0 commit comments

Comments
 (0)