VMConfigAppleVirtualizationView.swift 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // Copyright © 2022 osy. All rights reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. import SwiftUI
  17. struct VMConfigAppleVirtualizationView: View {
  18. @Binding var config: UTMAppleConfigurationVirtualization
  19. let operatingSystem: UTMAppleConfigurationBoot.OperatingSystem
  20. var body: some View {
  21. Form {
  22. if operatingSystem == .linux {
  23. Toggle("Enable Balloon Device", isOn: $config.hasBalloon)
  24. }
  25. Toggle("Enable Entropy Device", isOn: $config.hasEntropy)
  26. if #available(macOS 12, *) {
  27. Toggle("Enable Sound", isOn: $config.hasAudio)
  28. VMConfigConstantPicker("Keyboard", selection: $config.keyboard)
  29. VMConfigConstantPicker("Pointer", selection: $config.pointer)
  30. }
  31. if #available(macOS 13, *), operatingSystem == .linux {
  32. #if arch(arm64)
  33. Toggle("Enable Rosetta on Linux (x86_64 Emulation)", isOn: $config.hasRosetta.bound)
  34. .help("If enabled, a virtiofs share tagged 'rosetta' will be available on the Linux guest for installing Rosetta for emulating x86_64 on ARM64.")
  35. #endif
  36. }
  37. if #available(macOS 13, *) {
  38. Toggle("Enable Clipboard Sharing", isOn: $config.hasClipboardSharing)
  39. .help("Requires SPICE guest agent tools to be installed.")
  40. }
  41. }
  42. }
  43. }
  44. struct VMConfigAppleDevicesView_Previews: PreviewProvider {
  45. @State static private var config = UTMAppleConfigurationVirtualization()
  46. static var previews: some View {
  47. VMConfigAppleVirtualizationView(config: $config, operatingSystem: .linux)
  48. }
  49. }