Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Settings: the interface language as the launcher's own list, drawn like the buttons beside it

v0lumehi3ea8b0b64c80
diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swift
index fb96ad89..04956f61 100644
--- a/frontend/Sources/NSPortBuilder/ContentView.swift
+++ b/frontend/Sources/NSPortBuilder/ContentView.swift
@@ -1848,18 +1848,17 @@ struct BuilderView: View {
row(m.t("settings.language"),
detail: Lang.saved.map { $0 == .zh ? m.t("settings.language.zh") : m.t("settings.language.en") }
?? m.t("settings.language.system"), dot: LauncherPalette.ready, help: "") {
- Picker("", selection: Binding(
- get: { Lang.saved.map { $0.rawValue } ?? "" },
- set: { v in
- Lang.saved = v.isEmpty ? nil : Lang(rawValue: v)
- m.lang = Lang.initial()
- })) {
- Text(m.t("settings.language.system")).tag("")
- Text(m.t("settings.language.zh")).tag("zh")
- Text(m.t("settings.language.en")).tag("en")
+ // The launcher's own list (as in Launch options), drawn like the buttons beside it and as wide
+ LauncherMenuPicker(options: [(value: "", label: m.t("settings.language.system")),
+ (value: "zh", label: m.t("settings.language.zh")),
+ (value: "en", label: m.t("settings.language.en"))],
+ selection: Lang.saved.map { $0.rawValue } ?? "", fill: true, buttonLike: true) { v in
+ Lang.saved = v.isEmpty ? nil : Lang(rawValue: v)
+ m.lang = Lang.initial()
}
- .pickerStyle(.menu).labelsHidden().frame(width: 150)
+ .frame(width: Self.settingsButtonWidth)
}
+ divider
row("NX2Apple", detail: String(format: m.t("app.version"), BuildModel.appVersion)) {
if let u = m.appUpdate {
Button(String(format: m.t("app.updateBtn"), u.tag)) { m.performAppUpdate() }.disabled(m.appBusy)
diff --git a/frontend/Sources/NSPortBuilder/LauncherStyles.swift b/frontend/Sources/NSPortBuilder/LauncherStyles.swift
index f152a093..e674880b 100644
--- a/frontend/Sources/NSPortBuilder/LauncherStyles.swift
+++ b/frontend/Sources/NSPortBuilder/LauncherStyles.swift
@@ -92,25 +92,27 @@ struct LauncherSegmented: View {
}
/// A longer list of choices: a pill with the current one that opens the list. With `fill` it takes the width it is
-/// given, the chevron at its right end.
+/// given, the chevron at its right end; `buttonLike` draws it as LauncherSecondaryButtonStyle draws a button (Settings).
struct LauncherMenuPicker: View {
let options: [(value: String, label: String)]
let selection: String
var fill = false
+ var buttonLike = false
let choose: (String) -> Void
@State private var open = false
var body: some View {
Button { open.toggle() } label: {
HStack(spacing: 8) {
- Text(options.first { $0.value == selection }?.label ?? selection).font(.manrope(12.5, .semibold)).lineLimit(1)
+ Text(options.first { $0.value == selection }?.label ?? selection).font(.manrope(buttonLike ? 13 : 12.5, .semibold)).lineLimit(1)
if fill { Spacer(minLength: 0) }
Image(systemName: "chevron.down").font(.system(size: 9, weight: .bold)).foregroundStyle(.secondary)
}
- .padding(.horizontal, 14).padding(.vertical, 7)
+ .padding(.horizontal, buttonLike ? 15 : 14).padding(.vertical, buttonLike ? 9 : 7)
.frame(maxWidth: fill ? .infinity : nil)
- .background(Color.white.opacity(0.06), in: Capsule())
- .overlay(Capsule().strokeBorder(Color.white.opacity(0.10)))
- .contentShape(Capsule())
+ .background(Color.white.opacity(buttonLike ? 0.055 : 0.06), in: RoundedRectangle(cornerRadius: buttonLike ? 9 : 99))
+ .overlay(RoundedRectangle(cornerRadius: buttonLike ? 9 : 99).strokeBorder(Color.white.opacity(0.10)))
+ .foregroundStyle(Color.white.opacity(0.92))
+ .contentShape(RoundedRectangle(cornerRadius: buttonLike ? 9 : 99))
}
.buttonStyle(.plain)
.popover(isPresented: $open, arrowEdge: .bottom) {