settings: support updating of interface version

This commit is contained in:
osy 2023-07-02 21:46:14 -05:00
parent 44973db9dd
commit 3356e187d1
2 changed files with 9 additions and 1 deletions

View File

@ -18,7 +18,7 @@ import Foundation
/// Settings for single QEMU disk device
struct UTMQemuConfigurationDrive: UTMConfigurationDrive {
private static let latestInterfaceVersion = 1
static let latestInterfaceVersion = 1
/// If not removable, this is the name of the file in the bundle.
var imageName: String?

View File

@ -83,11 +83,19 @@ struct VMConfigDriveDetailsView: View {
if config.imageType == .disk || config.imageType == .cd {
VMConfigConstantPicker("Interface", selection: $config.interface)
.onChange(of: config.interface) { interface in
config.interfaceVersion = UTMQemuConfigurationDrive.latestInterfaceVersion
if interface == .floppy && config.imageType == .cd {
config.imageType = .disk
}
}
}
if config.interface == .ide && config.interfaceVersion != UTMQemuConfigurationDrive.latestInterfaceVersion {
Button {
config.interfaceVersion = UTMQemuConfigurationDrive.latestInterfaceVersion
} label: {
Text("Update Interface")
}.help("Older versions of UTM added each IDE device to a separate bus. Check this to change the configuration to place two units on each bus.")
}
if let imageUrl = config.imageURL {
let fileSize = data.computeSize(for: imageUrl)