tweak functional tab of widget picker view

This commit is contained in:
True Zhuanjia committed 2026-05-27 10:59:11 +08:00
1 parent 90116e7ff6
commit 3575e84165
2 files changed
+266 -32

No files matched your search

+233 -1
View File
@@ -750,6 +750,35 @@
} }
} }
}, },
"=enterPiP" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enter PiP"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "画中画"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "子母畫面"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "子母畫面"
}
}
}
},
"=EnableTouch" : { "=EnableTouch" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -1272,6 +1301,122 @@
} }
} }
}, },
"=absoluteTouchDrag" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Absolute touch drag"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "单点鼠标触控拖拽"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "單點滑鼠觸控拖曳"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "單點滑鼠觸控拖曳"
}
}
}
},
"=brushShortcut" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Brush shortcut"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "笔刷快捷键"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "筆刷快速鍵"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "筆刷快速鍵"
}
}
}
},
"=disableSinglePointTouch" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Disable single point touch"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "禁用单点触控"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "停用單點觸控"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "停用單點觸控"
}
}
}
},
"=eraserShortcut" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Eraser shortcut"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "橡皮擦快捷键"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "橡皮擦快速鍵"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "橡皮擦快速鍵"
}
}
}
},
"=pencilHover" : { "=pencilHover" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -1301,6 +1446,64 @@
} }
} }
}, },
"=gamepadOverlaySwitch" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "🎮 overlay switch"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "🎮 叠加 开关"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "🎮 疊加 開關"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "🎮 疊加 開關"
}
}
}
},
"=magnifier" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Magnifier"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "放大镜"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "放大鏡"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "放大鏡"
}
}
}
},
"=pickProfile" : { "=pickProfile" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -1330,6 +1533,35 @@
} }
} }
}, },
"=profiles" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Profiles"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "布局清单"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "版面清單"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "版面清單"
}
}
}
},
"=pickup" : { "=pickup" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -15039,4 +15271,4 @@
} }
}, },
"version" : "1.1" "version" : "1.1"
} }
+33 -31
View File
@@ -273,7 +273,7 @@ struct GyroButtonOption: Identifiable {
@available(iOS 13.0, *) @available(iOS 13.0, *)
struct FunctionalButtonOption: Identifiable { struct FunctionalButtonOption: Identifiable {
let id = UUID() let id = UUID()
let label: String let localizationKey: String
let cmd: String let cmd: String
let tip: String let tip: String
let allowsKeyboardCombination: Bool let allowsKeyboardCombination: Bool
@@ -563,7 +563,7 @@ struct WidgetPickerView: View {
private let functionalButtonOptions: [FunctionalButtonOption] = [ private let functionalButtonOptions: [FunctionalButtonOption] = [
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Settings"), localizationKey: "=settings",
cmd: "SETTINGS", cmd: "SETTINGS",
tip: LocalizationHelper.localizedString(forKey: "Expands setting menu during streaming"), tip: LocalizationHelper.localizedString(forKey: "Expands setting menu during streaming"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -573,7 +573,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Disconnect"), localizationKey: "=disconnect",
cmd: "DISCONNECT", cmd: "DISCONNECT",
tip: LocalizationHelper.localizedString(forKey: "Disconnect current connection"), tip: LocalizationHelper.localizedString(forKey: "Disconnect current connection"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -583,7 +583,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Quit app"), localizationKey: "=quitApp",
cmd: "QUITAPP", cmd: "QUITAPP",
tip: LocalizationHelper.localizedString(forKey: "Disconnect and quit current app"), tip: LocalizationHelper.localizedString(forKey: "Disconnect and quit current app"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -593,7 +593,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Enter PiP"), localizationKey: "=enterPiP",
cmd: "PIP", cmd: "PIP",
tip: LocalizationHelper.localizedString(forKey: "Enter picture-in-picture mode"), tip: LocalizationHelper.localizedString(forKey: "Enter picture-in-picture mode"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -603,7 +603,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Folder"), localizationKey: "=Folder",
cmd: "FOLDER", cmd: "FOLDER",
tip: LocalizationHelper.localizedString(forKey: "Collect other widgets or subfolders. Button-combo available."), tip: LocalizationHelper.localizedString(forKey: "Collect other widgets or subfolders. Button-combo available."),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
@@ -613,7 +613,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Toolbox"), localizationKey: "=toolbox",
cmd: "TOOLBOX", cmd: "TOOLBOX",
tip: LocalizationHelper.localizedString(forKey: "Activate toolbox menu during streaming"), tip: LocalizationHelper.localizedString(forKey: "Activate toolbox menu during streaming"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -623,7 +623,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Edit layout"), localizationKey: "=widgetTool",
cmd: "WIDGETTOOL", cmd: "WIDGETTOOL",
tip: LocalizationHelper.localizedString(forKey: "Open on-screen widget layout tool"), tip: LocalizationHelper.localizedString(forKey: "Open on-screen widget layout tool"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -633,7 +633,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Pick profile"), localizationKey: "=pickProfile",
cmd: "PICKPRFL", cmd: "PICKPRFL",
tip: LocalizationHelper.localizedString(forKey: "Pick a game/on-screen-widget profile"), tip: LocalizationHelper.localizedString(forKey: "Pick a game/on-screen-widget profile"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -643,7 +643,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Profiles"), localizationKey: "=profiles",
cmd: "PROFILES", cmd: "PROFILES",
tip: LocalizationHelper.localizedString(forKey: "Select a game/on-screen-widget profile"), tip: LocalizationHelper.localizedString(forKey: "Select a game/on-screen-widget profile"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -653,7 +653,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "SoftKeyboard"), localizationKey: "=softkeyboard",
cmd: "SOFTKEYBOARD", cmd: "SOFTKEYBOARD",
tip: LocalizationHelper.localizedString(forKey: "Bring up softkeyboard"), tip: LocalizationHelper.localizedString(forKey: "Bring up softkeyboard"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -664,7 +664,7 @@ struct WidgetPickerView: View {
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Disable touch"), localizationKey: "=DisableTouch",
cmd: "DISABLETOUCH", cmd: "DISABLETOUCH",
tip: LocalizationHelper.localizedString(forKey: "Temporarily disable touch input for stream view"), tip: LocalizationHelper.localizedString(forKey: "Temporarily disable touch input for stream view"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -674,7 +674,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "🎮 overlay switch"), localizationKey: "=gamepadOverlaySwitch",
cmd: "GAMEPADOVERLAY", cmd: "GAMEPADOVERLAY",
tip: LocalizationHelper.localizedString(forKey: "Switch on/off a floating gamepad overlay with live input feedback"), tip: LocalizationHelper.localizedString(forKey: "Switch on/off a floating gamepad overlay with live input feedback"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -684,7 +684,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Pressure curve"), localizationKey: "=pressureCurve",
cmd: "PRESSURECURVE", cmd: "PRESSURECURVE",
tip: LocalizationHelper.localizedString(forKey: "Opens pencil pressure curve tool"), tip: LocalizationHelper.localizedString(forKey: "Opens pencil pressure curve tool"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -694,7 +694,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Pencil hover"), localizationKey: "=pencilHover",
cmd: "PENCILHOVER", cmd: "PENCILHOVER",
tip: LocalizationHelper.localizedString(forKey: "Force pencil entering hovering on host"), tip: LocalizationHelper.localizedString(forKey: "Force pencil entering hovering on host"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -704,7 +704,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Brush shortcut"), localizationKey: "=brushShortcut",
cmd: "BRUSH", cmd: "BRUSH",
tip: LocalizationHelper.localizedString(forKey: "Combine this with a brush keyboard shortcut for PC software"), tip: LocalizationHelper.localizedString(forKey: "Combine this with a brush keyboard shortcut for PC software"),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
@@ -714,7 +714,7 @@ struct WidgetPickerView: View {
forcedComboMode: .shortcut forcedComboMode: .shortcut
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Eraser shortcut"), localizationKey: "=eraserShortcut",
cmd: "ERASER", cmd: "ERASER",
tip: LocalizationHelper.localizedString(forKey: "Combine this with a eraser keyboard shortcut for PC software"), tip: LocalizationHelper.localizedString(forKey: "Combine this with a eraser keyboard shortcut for PC software"),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
@@ -724,7 +724,7 @@ struct WidgetPickerView: View {
forcedComboMode: .shortcut forcedComboMode: .shortcut
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Disable single point touch"), localizationKey: "=disableSinglePointTouch",
cmd: "NOSINGLETOUCH", cmd: "NOSINGLETOUCH",
tip: LocalizationHelper.localizedString(forKey: "Disable single finger touch for stream view"), tip: LocalizationHelper.localizedString(forKey: "Disable single finger touch for stream view"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -734,7 +734,7 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Absolute touch drag"), localizationKey: "=absoluteTouchDrag",
cmd: "ABSTCHDRAG", cmd: "ABSTCHDRAG",
tip: LocalizationHelper.localizedString(forKey: "Replace mouse button action in single point touch mode with another button temporarily"), tip: LocalizationHelper.localizedString(forKey: "Replace mouse button action in single point touch mode with another button temporarily"),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
@@ -744,7 +744,7 @@ struct WidgetPickerView: View {
forcedComboMode: .skill forcedComboMode: .skill
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: LocalizationHelper.localizedString(forKey: "Magnifier"), localizationKey: "=magnifier",
cmd: "MAGNIFIER", cmd: "MAGNIFIER",
tip: LocalizationHelper.localizedString(forKey: "magnifierTip"), tip: LocalizationHelper.localizedString(forKey: "magnifierTip"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
@@ -2225,6 +2225,10 @@ struct WidgetPickerView: View {
functionalButtonOptions.first(where: { $0.cmd == cmd }) functionalButtonOptions.first(where: { $0.cmd == cmd })
} }
private func localizedFunctionalButtonLabel(for option: FunctionalButtonOption) -> String {
LocalizationHelper.localizedString(forKey: option.localizationKey)
}
private var occupiedSlots: Int { private var occupiedSlots: Int {
poolItems.reduce(0) { $0 + $1.span } poolItems.reduce(0) { $0 + $1.span }
} }
@@ -3019,7 +3023,7 @@ struct WidgetPickerView: View {
widgetButtonLabel = initialButtonLabel widgetButtonLabel = initialButtonLabel
} else if targetWidgetKind == .button, } else if targetWidgetKind == .button,
let selectedFunctionalButtonOption { let selectedFunctionalButtonOption {
widgetButtonLabel = selectedFunctionalButtonOption.cmd == "FOLDER" ? LocalizationHelper.localizedString(forKey: "=Folder") : selectedFunctionalButtonOption.label widgetButtonLabel = localizedFunctionalButtonLabel(for: selectedFunctionalButtonOption)
} else { } else {
widgetButtonLabel = "" widgetButtonLabel = ""
} }
@@ -3132,6 +3136,10 @@ struct WidgetPickerView: View {
private func resolvedWidgetButtonLabel() -> String { private func resolvedWidgetButtonLabel() -> String {
let trimmedManualLabel = widgetButtonLabel let trimmedManualLabel = widgetButtonLabel
if !trimmedManualLabel.isEmpty { if !trimmedManualLabel.isEmpty {
if let selectedFunctionalButtonOption,
trimmedManualLabel == localizedFunctionalButtonLabel(for: selectedFunctionalButtonOption) {
return selectedFunctionalButtonOption.localizationKey
}
return trimmedManualLabel return trimmedManualLabel
} }
return defaultWidgetButtonLabel() return defaultWidgetButtonLabel()
@@ -3139,9 +3147,7 @@ struct WidgetPickerView: View {
private func defaultWidgetButtonLabel() -> String { private func defaultWidgetButtonLabel() -> String {
if let selectedFunctionalButtonOption { if let selectedFunctionalButtonOption {
return selectedFunctionalButtonOption.cmd == "FOLDER" return selectedFunctionalButtonOption.localizationKey
? LocalizationHelper.localizedString(forKey: "=Folder")
: selectedFunctionalButtonOption.label
} }
let labelParts = poolItems.compactMap(defaultLabelPart(for:)) let labelParts = poolItems.compactMap(defaultLabelPart(for:))
@@ -3172,9 +3178,7 @@ struct WidgetPickerView: View {
return sanitizedAutoButtonLabel(label) return sanitizedAutoButtonLabel(label)
case .functional: case .functional:
if let option = functionalButtonOption(for: item.cmd) { if let option = functionalButtonOption(for: item.cmd) {
return option.cmd == "FOLDER" return option.localizationKey
? LocalizationHelper.localizedString(forKey: "=Folder")
: option.label
} }
let label = item.displayCmd.trimmingCharacters(in: .whitespacesAndNewlines) let label = item.displayCmd.trimmingCharacters(in: .whitespacesAndNewlines)
return label.isEmpty ? nil : sanitizedAutoButtonLabel(label) return label.isEmpty ? nil : sanitizedAutoButtonLabel(label)
@@ -3396,9 +3400,7 @@ struct WidgetPickerView: View {
return cmd return cmd
case .functional: case .functional:
if let option = functionalButtonOption(for: cmd) { if let option = functionalButtonOption(for: cmd) {
return option.cmd == "FOLDER" return localizedFunctionalButtonLabel(for: option)
? LocalizationHelper.localizedString(forKey: "=Folder")
: option.label
} }
return cmd return cmd
case .interval: case .interval:
@@ -3623,7 +3625,7 @@ struct FunctionalCollectionButton: View {
var body: some View { var body: some View {
Button(action: action) { Button(action: action) {
Text(item.label) Text(LocalizationHelper.localizedString(forKey: item.localizationKey))
.font(.system(size: labelFontSize, weight: .bold, design: .rounded)) .font(.system(size: labelFontSize, weight: .bold, design: .rounded))
.foregroundColor(Color.black.opacity(0.70)) .foregroundColor(Color.black.opacity(0.70))
.minimumScaleFactor(0.7) .minimumScaleFactor(0.7)