-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5b4223
commit 8290f37
Showing
4 changed files
with
123 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// | ||
// SettingsView+Extension.swift | ||
// ControlRoom | ||
// | ||
// Created by Elliot Knight on 06/05/2024. | ||
// Copyright © 2024 Paul Hudson. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import KeyboardShortcuts | ||
|
||
// MARK: - Extracted Views | ||
|
||
extension SettingsView { | ||
func makeTogglesForm() -> some View { | ||
Form { | ||
Toggle("Keep window on top", isOn: $preferences.wantsFloatingWindow) | ||
Toggle("Show Default simulator", isOn: $preferences.showDefaultSimulator) | ||
Toggle("Show booted devices first", isOn: $preferences.showBootedDevicesFirst) | ||
Toggle("Show icon in menu bar", isOn: $preferences.wantsMenuBarIcon) | ||
} | ||
} | ||
|
||
func makeNotificationsForm() -> some View { | ||
Form { | ||
HStack { | ||
Text("Resend last push notification") | ||
KeyboardShortcuts.Recorder(for: .resendLastPushNotification) | ||
} | ||
|
||
HStack { | ||
Text("Restart last selected app") | ||
KeyboardShortcuts.Recorder(for: .restartLastSelectedApp) | ||
} | ||
|
||
HStack { | ||
Text("Reopen last URL") | ||
KeyboardShortcuts.Recorder(for: .reopenLastURL) | ||
} | ||
} | ||
} | ||
|
||
func makePickersForm() -> some View { | ||
Form { | ||
Picker("Screenshot Format:", selection: $captureSettings.imageFormat) { | ||
ForEach(SimCtl.IO.ImageFormat.allCases, id: \.self) { type in | ||
Text(type.rawValue.uppercased()).tag(type) | ||
} | ||
} | ||
|
||
Picker("Video Format:", selection: $captureSettings.videoFormat) { | ||
ForEach(SimCtl.IO.VideoFormat.all, id: \.self) { item in | ||
if item == .divider { | ||
Divider() | ||
} else { | ||
Text(item.name).tag(item) | ||
} | ||
} | ||
} | ||
|
||
Picker("Display:", selection: $captureSettings.display) { | ||
ForEach(SimCtl.IO.Display.allCases, id: \.self) { display in | ||
Text(display.rawValue.capitalized).tag(display) | ||
} | ||
} | ||
|
||
Picker("Mask:", selection: $captureSettings.mask) { | ||
ForEach(SimCtl.IO.Mask.allCases, id: \.self) { mask in | ||
Text(mask.rawValue.capitalized).tag(mask) | ||
} | ||
} | ||
.disabled(renderChrome) | ||
|
||
Toggle(isOn: $renderChrome.onChange(updateChromeSettings)) { | ||
VStack(alignment: .leading) { | ||
Text("Add device chrome to screenshots") | ||
Text("This is an experimental feature and may not function properly yet.") | ||
.font(.caption) | ||
} | ||
} | ||
} | ||
} | ||
|
||
func makeColorPicker() -> some View { | ||
VStack { | ||
Toggle("Uppercase Hex Strings", isOn: $uppercaseHex) | ||
.padding(.bottom) | ||
|
||
Text("Set the maximum number of decimal places to use when generating code for picked simulator colors. The default is 2.") | ||
Stepper("Decimal Places: \(colorPickerAccuracy)", value: $colorPickerAccuracy, in: 0...5) | ||
.pickerStyle(.segmented) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters