Skip to content

Commit

Permalink
iOS+macOS: disable share settings when display console is set
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed Feb 1, 2021
1 parent 59bd833 commit bd1153f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Platform/Shared/VMConfigDisplayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ struct VMConfigDisplayView: View {
Text("Full Graphics").tag(false)
Text("Console Only").tag(true)
}.pickerStyle(displayTypePickerStyle)
.onChange(of: config.displayConsoleOnly) { newConsoleOnly in
if newConsoleOnly {
if config.shareClipboardEnabled {
config.shareClipboardEnabled = false
}
if config.shareDirectoryEnabled {
config.shareDirectoryEnabled = false
}
}
}
if config.displayConsoleOnly {
let fontSizeObserver = Binding<Int> {
Int(truncating: config.consoleFontSize ?? 1)
Expand Down
6 changes: 5 additions & 1 deletion Platform/Shared/VMConfigSharingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ struct VMConfigSharingView: View {
var body: some View {
VStack {
Form {
if config.displayConsoleOnly {
Text("These settings are unavailable in console display mode.")
}

Section(header: Text("Clipboard Sharing"), footer: Text("Requires SPICE guest agent tools to be installed.").padding(.bottom)) {
Toggle(isOn: $config.shareClipboardEnabled, label: {
Text("Enable Clipboard Sharing")
Expand All @@ -41,7 +45,7 @@ struct VMConfigSharingView: View {
})
Text("Note: select the path to share from the main screen.")
}
}
}.disabled(config.displayConsoleOnly)
}
}
}
Expand Down

0 comments on commit bd1153f

Please sign in to comment.