mirror of
https://github.com/utmapp/UTM.git
synced 2026-10-12 02:24:01 +00:00
The QEMU settings page listed UTM's generated arguments next to the editable custom ones in a single list, which made users think the generated arguments could be changed and invited pasting options found online that do not apply to UTM's build of QEMU. Move custom arguments to their own page, edited through a popover on macOS and a pushed page on iOS like port forwarding, instead of inline text fields that needed SwiftUI workarounds. On macOS the page is hidden behind a checkbox on the QEMU page that is only on while the settings sheet is open unless the VM already has custom arguments; a short disclaimer sits under the checkbox and under the iOS row. The complete command line is shown as read-only selectable text, so the export command feature is removed. Assisted-by: Claude:claude-fable-5-1
56 lines
1.6 KiB
Swift
56 lines
1.6 KiB
Swift
//
|
|
// Copyright © 2020 osy. All rights reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct VMShareItemModifier: ViewModifier {
|
|
@Binding var isPresented: Bool
|
|
let shareItem: ShareItem?
|
|
|
|
#if os(macOS)
|
|
func body(content: Content) -> some View {
|
|
ZStack {
|
|
SavePanel(isPresented: $isPresented, shareItem: shareItem)
|
|
content
|
|
}
|
|
}
|
|
#else
|
|
func body(content: Content) -> some View {
|
|
content.popover(isPresented: $isPresented) {
|
|
if let shareItem = shareItem?.toActivityItem() {
|
|
ActivityView(activityItems: [shareItem as Any])
|
|
.ignoresSafeArea()
|
|
}
|
|
}
|
|
}
|
|
#endif
|
|
|
|
enum ShareItem {
|
|
case debugLog(URL)
|
|
case utmCopy(VMData)
|
|
case utmMove(VMData)
|
|
|
|
@MainActor func toActivityItem() -> Any {
|
|
switch self {
|
|
case .debugLog(let url):
|
|
return url
|
|
case .utmCopy(let vm), .utmMove(let vm):
|
|
return vm.pathUrl
|
|
}
|
|
}
|
|
}
|
|
}
|