commit 7c8ea57607df627c836622a6d0dacde4e952bc49 Author: osy Date: Fri Apr 12 09:06:41 2019 -0700 UTM: implemented main view and configuration views diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..a08e98cc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ConfigurationViews/StaticDataTableViewController"] + path = ConfigurationViews/StaticDataTableViewController + url = https://github.com/peterpaulis/StaticDataTableViewController.git diff --git a/Configuration/UTMConfiguration.h b/Configuration/UTMConfiguration.h new file mode 100644 index 00000000..2f597880 --- /dev/null +++ b/Configuration/UTMConfiguration.h @@ -0,0 +1,86 @@ +// +// Copyright © 2019 Halts. 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 + +NS_ASSUME_NONNULL_BEGIN + +@interface UTMNewDrive : NSObject + +@property (nonatomic, assign) BOOL valid; +@property (nonatomic, nullable, strong) NSNumber *sizeMB; +@property (nonatomic, assign) BOOL isQcow2; + +@end + +@interface UTMConfiguration : NSObject + +@property (nonatomic, weak, readonly) NSDictionary *dictRepresentation; + ++ (NSArray*)supportedArchitecturesPretty; ++ (NSArray*)supportedArchitectures; ++ (NSArray*)supportedBootDevices; ++ (NSArray*)supportedTargetsForArchitecture:(NSString *)architecture; ++ (NSArray*)supportedResolutions; ++ (NSArray*)supportedDriveInterfaces; + +@property (nonatomic, nullable, strong) NSString *name; +@property (nonatomic, nullable, strong) NSString *changeName; + +@property (nonatomic, nullable, strong) NSString *systemArchitecture; +@property (nonatomic, nullable, strong) NSNumber *systemMemory; +@property (nonatomic, nullable, strong) NSNumber *systemCPUCount; +@property (nonatomic, nullable, strong) NSString *systemTarget; +@property (nonatomic, nullable, strong) NSString *systemBootDevice; +@property (nonatomic, nullable, strong) NSString *systemAddArgs; + +@property (nonatomic, assign) BOOL displayConsoleOnly; +@property (nonatomic, assign) BOOL displayFixedResolution; +@property (nonatomic, nullable, strong) NSNumber *displayFixedResolutionWidth; +@property (nonatomic, nullable, strong) NSNumber *displayFixedResolutionHeight; +@property (nonatomic, assign) BOOL displayZoomScale; +@property (nonatomic, assign) BOOL displayZoomLetterBox; + +@property (nonatomic, assign) BOOL inputTouchscreenMode; +@property (nonatomic, assign) BOOL inputDirect; + +@property (nonatomic, assign) BOOL networkEnabled; +@property (nonatomic, assign) BOOL networkLocalhostOnly; +@property (nonatomic, nullable, strong) NSString *networkIPSubnet; +@property (nonatomic, nullable, strong) NSString *networkDHCPStart; + +@property (nonatomic, assign) BOOL printEnabled; + +@property (nonatomic, assign) BOOL soundEnabled; + +@property (nonatomic, assign) BOOL sharingClipboardEnabled; + +- (id)initWithDefaults; +- (NSUInteger)countDrives; +- (NSUInteger)newDefaultDrive; +- (nullable NSString *)driveImagePathForIndex:(NSUInteger)index; +- (void)setImagePath:(NSString *)path forIndex:(NSUInteger)index; +- (nullable NSString *)driveInterfaceTypeForIndex:(NSUInteger)index; +- (void)setDriveInterfaceType:(NSString *)interfaceType forIndex:(NSUInteger)index; +- (BOOL)driveIsCdromForIndex:(NSUInteger)index; +- (void)setDriveIsCdrom:(BOOL)isCdrom forIndex:(NSUInteger)index; +- (void)moveDriveIndex:(NSUInteger)index to:(NSUInteger)newIndex; +- (nullable UTMNewDrive *)driveNewParamsAtIndex:(NSUInteger)index; +- (void)removeDriveAtIndex:(NSUInteger)index; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Configuration/UTMConfiguration.m b/Configuration/UTMConfiguration.m new file mode 100644 index 00000000..0494fa03 --- /dev/null +++ b/Configuration/UTMConfiguration.m @@ -0,0 +1,482 @@ +// +// Copyright © 2019 Halts. 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 "UTMConfiguration.h" + +const NSString *const kUTMConfigSystemKey = @"System"; +const NSString *const kUTMConfigDisplayKey = @"Display"; +const NSString *const kUTMConfigInputKey = @"Input"; +const NSString *const kUTMConfigNetworkingKey = @"Networking"; +const NSString *const kUTMConfigPrintingKey = @"Printing"; +const NSString *const kUTMConfigSoundKey = @"Sound"; +const NSString *const kUTMConfigSharingKey = @"Sharing"; +const NSString *const kUTMConfigDrivesKey = @"Drives"; + +const NSString *const kUTMConfigArchitectureKey = @"Architecture"; +const NSString *const kUTMConfigMemoryKey = @"Memory"; +const NSString *const kUTMConfigCPUCountKey = @"CPUCount"; +const NSString *const kUTMConfigTargetKey = @"Target"; +const NSString *const kUTMConfigBootDeviceKey = @"BootDevice"; +const NSString *const kUTMConfigAddArgsKey = @"AddArgs"; + +const NSString *const kUTMConfigConsoleOnlyKey = @"ConsoleOnly"; +const NSString *const kUTMConfigFixedResolutionKey = @"FixedResolution"; +const NSString *const kUTMConfigFixedResolutionWidthKey = @"FixedResolutionWidth"; +const NSString *const kUTMConfigFixedResolutionHeightKey = @"FixedResolutionHeight"; +const NSString *const kUTMConfigZoomScaleKey = @"ZoomScale"; +const NSString *const kUTMConfigZoomLetterboxKey = @"ZoomLetterbox"; + +const NSString *const kUTMConfigTouchscreenModeKey = @"TouchscreenMode"; +const NSString *const kUTMConfigDirectInputKey = @"DirectInput"; + +const NSString *const kUTMConfigNetworkEnabledKey = @"NetworkEnabled"; +const NSString *const kUTMConfigLocalhostOnlyKey = @"LocalhostOnly"; +const NSString *const kUTMConfigIPSubnetKey = @"IPSubnet"; +const NSString *const kUTMConfigDHCPStartKey = @"DHCPStart"; + +const NSString *const kUTMConfigPrintEnabledKey = @"PrintEnabled"; + +const NSString *const kUTMConfigSoundEnabledKey = @"SoundEnabled"; + +const NSString *const kUTMConfigChipboardSharingKey = @"ClipboardSharing"; + +const NSString *const kUTMConfigImagePathKey = @"ImagePath"; +const NSString *const kUTMConfigInterfaceTypeKey = @"InterfaceType"; +const NSString *const kUTMConfigCdromKey = @"Cdrom"; + +@implementation UTMNewDrive + +@end + +@interface UTMConfiguration () + +@end + +@implementation UTMConfiguration { + NSMutableDictionary *_rootDict; + NSMutableDictionary *_systemDict; + NSMutableDictionary *_displayDict; + NSMutableDictionary *_inputDict; + NSMutableDictionary *_networkingDict; + NSMutableDictionary *_printingDict; + NSMutableDictionary *_soundDict; + NSMutableDictionary *_sharingDict; + NSMutableArray *_drivesDicts; + NSMutableArray *_newDrivesDict; +} + +#pragma mark - Constant supported values + ++ (NSArray*)supportedArchitecturesPretty { + return @[ + @"Alpha", + @"ARM (aarch32)", + @"ARM64 (aarch64)", + @"CRIS", + @"HPPA", + @"i386 (x86)", + @"LatticeMico32 (lm32)", + @"m68k", + @"Microblaze", + @"Microblaze (Little Endian)", + @"MIPS", + @"MIPS (Little Endian)", + @"MIPS64", + @"MIPS64 (Little Endian)", + @"Moxie", + @"NIOS2", + @"OpenRISC", + @"PowerPC", + @"PowerPC64", + @"RISC-V32", + @"RISC-V64", + @"S390x (zSeries)", + @"SH4", + @"SH4 (Big Endian)", + @"SPARC", + @"SPARC64", + @"TriCore", + @"Unicore32", + @"x86_64", + @"Xtensa", + @"Xtensa (Big Endian)" + ]; +} + ++ (NSArray*)supportedArchitectures { + return @[ + @"alpha", + @"arm", + @"aarch64", + @"cris", + @"hppa", + @"i386", + @"lm32", + @"m68k", + @"microblaze", + @"microblazeel", + @"mips", + @"mipsel", + @"mips64", + @"mips64el", + @"moxie", + @"nios2", + @"or1k", + @"ppc", + @"ppc64", + @"riscv32", + @"riscv64", + @"s390x", + @"sh4", + @"sh4eb", + @"sparc", + @"sparc64", + @"tricore", + @"unicore32", + @"x86_64", + @"xtensa", + @"xtensaeb" + ]; +} + ++ (NSArray*)supportedBootDevices { + return @[ + @"Hard Disk", + @"CD/DVD", + @"Floppy" + ]; +} + ++ (NSArray*)supportedTargetsForArchitecture:(NSString *)architecture { + return @[]; +} + ++ (NSArray*)supportedResolutions { + return @[ + @"320x240", + @"640x480", + @"800x600", + @"1024x600", + @"1136x640", + @"1280x720", + @"1334x750", + @"1280x800", + @"1280x1024", + @"1920x1080", + @"2436x1125", + @"2048x1536", + @"2560x1440", + @"2732x2048" + ]; +} + ++ (NSArray*)supportedDriveInterfaces { + return @[ + @"ide", + @"scsi", + @"sd", + @"mtd", + @"floppy", + @"pflash", + @"virtio", + @"none" + ]; +} + +#pragma mark - Initialization + +- (id)init { + self = [super init]; + if (self) { + _rootDict = [[NSMutableDictionary alloc] initWithCapacity:8]; + _systemDict = [[NSMutableDictionary alloc] init]; + _displayDict = [[NSMutableDictionary alloc] init]; + _inputDict = [[NSMutableDictionary alloc] init]; + _networkingDict = [[NSMutableDictionary alloc] init]; + _printingDict = [[NSMutableDictionary alloc] init]; + _soundDict = [[NSMutableDictionary alloc] init]; + _sharingDict = [[NSMutableDictionary alloc] init]; + _drivesDicts = [[NSMutableArray alloc] init]; + _rootDict[kUTMConfigSystemKey] = _systemDict; + _rootDict[kUTMConfigDisplayKey] = _displayDict; + _rootDict[kUTMConfigInputKey] = _inputDict; + _rootDict[kUTMConfigNetworkingKey] = _networkingDict; + _rootDict[kUTMConfigPrintingKey] = _printingDict; + _rootDict[kUTMConfigSoundKey] = _soundDict; + _rootDict[kUTMConfigSharingKey] = _sharingDict; + _rootDict[kUTMConfigDrivesKey] = _drivesDicts; + _newDrivesDict = [[NSMutableArray alloc] init]; + } + return self; +} + +- (id)initWithDefaults { + self = [self init]; + self.systemArchitecture = @"x86_64"; + self.systemMemory = @512; + self.systemCPUCount = @2; + self.systemBootDevice = @"CD/DVD"; + self.displayFixedResolutionWidth = @800; + self.displayFixedResolutionHeight = @600; + self.displayFixedResolution = NO; + self.networkEnabled = YES; + self.printEnabled = YES; + self.soundEnabled = YES; + self.sharingClipboardEnabled = YES; + return self; +} + +#pragma mark - Properties + +- (void)setSystemArchitecture:(NSString *)systemArchitecture { + _rootDict[kUTMConfigSystemKey][kUTMConfigArchitectureKey] = systemArchitecture; +} + +- (NSString *)systemArchitecture { + return _rootDict[kUTMConfigSystemKey][kUTMConfigArchitectureKey]; +} + +- (void)setSystemMemory:(NSNumber *)systemMemory { + _rootDict[kUTMConfigSystemKey][kUTMConfigMemoryKey] = systemMemory; +} + +- (NSNumber *)systemMemory { + return _rootDict[kUTMConfigSystemKey][kUTMConfigMemoryKey]; +} + +- (void)setSystemCPUCount:(NSNumber *)systemCPUCount { + _rootDict[kUTMConfigSystemKey][kUTMConfigCPUCountKey] = systemCPUCount; +} + +- (NSNumber *)systemCPUCount { + return _rootDict[kUTMConfigSystemKey][kUTMConfigCPUCountKey]; +} + +- (void)setSystemTarget:(NSString *)systemTarget { + _rootDict[kUTMConfigSystemKey][kUTMConfigTargetKey] = systemTarget; +} + +- (NSString *)systemTarget { + return _rootDict[kUTMConfigSystemKey][kUTMConfigTargetKey]; +} + +- (void)setSystemBootDevice:(NSString *)systemBootDevice { + _rootDict[kUTMConfigSystemKey][kUTMConfigBootDeviceKey] = systemBootDevice; +} + +- (NSString *)systemBootDevice { + return _rootDict[kUTMConfigSystemKey][kUTMConfigBootDeviceKey]; +} + +- (void)setSystemAddArgs:(NSString *)systemAddArgs { + _rootDict[kUTMConfigSystemKey][kUTMConfigAddArgsKey] = systemAddArgs; +} + +- (NSString *)systemAddArgs { + return _rootDict[kUTMConfigSystemKey][kUTMConfigAddArgsKey]; +} + +- (void)setDisplayConsoleOnly:(BOOL)displayConsoleOnly { + _rootDict[kUTMConfigDisplayKey][kUTMConfigConsoleOnlyKey] = [NSNumber numberWithBool:displayConsoleOnly]; +} + +- (BOOL)displayConsoleOnly { + return [_rootDict[kUTMConfigDisplayKey][kUTMConfigConsoleOnlyKey] boolValue]; +} + +- (void)setDisplayFixedResolution:(BOOL)displayFixedResolution { + _rootDict[kUTMConfigDisplayKey][kUTMConfigFixedResolutionKey] = [NSNumber numberWithBool:displayFixedResolution]; +} + +- (BOOL)displayFixedResolution { + return [_rootDict[kUTMConfigDisplayKey][kUTMConfigFixedResolutionKey] boolValue]; +} + +- (void)setDisplayFixedResolutionWidth:(NSNumber *)displayFixedResolutionWidth { + _rootDict[kUTMConfigDisplayKey][kUTMConfigFixedResolutionWidthKey] = displayFixedResolutionWidth; +} + +- (NSNumber *)displayFixedResolutionWidth { + return _rootDict[kUTMConfigDisplayKey][kUTMConfigFixedResolutionWidthKey]; +} + +- (void)setDisplayFixedResolutionHeight:(NSNumber *)displayFixedResolutionHeight { + _rootDict[kUTMConfigDisplayKey][kUTMConfigFixedResolutionHeightKey] = displayFixedResolutionHeight; +} + +- (NSNumber *)displayFixedResolutionHeight { + return _rootDict[kUTMConfigDisplayKey][kUTMConfigFixedResolutionHeightKey]; +} + +- (void)setDisplayZoomScale:(BOOL)displayZoomScale { + _rootDict[kUTMConfigDisplayKey][kUTMConfigZoomScaleKey] = [NSNumber numberWithBool:displayZoomScale]; +} + +- (BOOL)displayZoomScale { + return [_rootDict[kUTMConfigDisplayKey][kUTMConfigZoomScaleKey] boolValue]; +} + +- (void)setDisplayZoomLetterBox:(BOOL)displayZoomLetterBox { + _rootDict[kUTMConfigDisplayKey][kUTMConfigZoomLetterboxKey] = [NSNumber numberWithBool:displayZoomLetterBox]; +} + +- (BOOL)displayZoomLetterBox { + return [_rootDict[kUTMConfigDisplayKey][kUTMConfigZoomLetterboxKey] boolValue]; +} + +- (void)setInputTouchscreenMode:(BOOL)inputTouchscreenMode { + _rootDict[kUTMConfigInputKey][kUTMConfigTouchscreenModeKey] = [NSNumber numberWithBool:inputTouchscreenMode]; +} + +- (BOOL)inputTouchscreenMode { + return [_rootDict[kUTMConfigInputKey][kUTMConfigTouchscreenModeKey] boolValue]; +} + +- (void)setInputDirect:(BOOL)inputDirect { + _rootDict[kUTMConfigInputKey][kUTMConfigDirectInputKey] = [NSNumber numberWithBool:inputDirect]; +} + +- (BOOL)inputDirect { + return [_rootDict[kUTMConfigInputKey][kUTMConfigDirectInputKey] boolValue]; +} + +- (void)setNetworkEnabled:(BOOL)networkEnabled { + _rootDict[kUTMConfigNetworkingKey][kUTMConfigNetworkEnabledKey] = [NSNumber numberWithBool:networkEnabled]; +} + +- (BOOL)networkEnabled { + return [_rootDict[kUTMConfigNetworkingKey][kUTMConfigNetworkEnabledKey] boolValue]; +} + +- (void)setNetworkLocalhostOnly:(BOOL)networkLocalhostOnly { + _rootDict[kUTMConfigNetworkingKey][kUTMConfigLocalhostOnlyKey] = [NSNumber numberWithBool:networkLocalhostOnly]; +} + +- (BOOL)networkLocalhostOnly { + return [_rootDict[kUTMConfigNetworkingKey][kUTMConfigLocalhostOnlyKey] boolValue]; +} + +- (void)setNetworkIPSubnet:(NSString *)networkIPSubnet { + _rootDict[kUTMConfigNetworkingKey][kUTMConfigIPSubnetKey] = networkIPSubnet; +} + +- (NSString *)networkIPSubnet { + return _rootDict[kUTMConfigNetworkingKey][kUTMConfigIPSubnetKey]; +} + +- (void)setNetworkDHCPStart:(NSString *)networkDHCPStart { + _rootDict[kUTMConfigNetworkingKey][kUTMConfigDHCPStartKey] = networkDHCPStart; +} + +- (NSString *)networkDHCPStart { + return _rootDict[kUTMConfigNetworkingKey][kUTMConfigDHCPStartKey]; +} + +- (void)setPrintEnabled:(BOOL)printEnabled { + _rootDict[kUTMConfigPrintingKey][kUTMConfigPrintEnabledKey] = [NSNumber numberWithBool:printEnabled]; +} + +- (BOOL)printEnabled { + return [_rootDict[kUTMConfigPrintingKey][kUTMConfigPrintEnabledKey] boolValue]; +} + +- (void)setSoundEnabled:(BOOL)soundEnabled { + _rootDict[kUTMConfigSoundKey][kUTMConfigSoundEnabledKey] = [NSNumber numberWithBool:soundEnabled]; +} + +- (BOOL)soundEnabled { + return [_rootDict[kUTMConfigSoundKey][kUTMConfigSoundEnabledKey] boolValue]; +} + +- (void)setSharingClipboardEnabled:(BOOL)sharingClipboardEnabled { + _rootDict[kUTMConfigSharingKey][kUTMConfigChipboardSharingKey] = [NSNumber numberWithBool:sharingClipboardEnabled]; +} + +- (BOOL)sharingClipboardEnabled { + return [_rootDict[kUTMConfigSharingKey][kUTMConfigChipboardSharingKey] boolValue]; +} + +#pragma mark - Dictionary representation + +- (NSDictionary *)dictRepresentation { + return (NSDictionary *)_rootDict; +} + +#pragma mark - Drives array handling + +- (NSUInteger)countDrives { + return [_rootDict[kUTMConfigDrivesKey] count]; +} + +- (NSUInteger)newDefaultDrive { + NSUInteger index = [self countDrives]; + NSMutableDictionary *drive = [[NSMutableDictionary alloc] initWithDictionary:@{ + kUTMConfigImagePathKey: [NSString stringWithFormat:@"disk-%lu.img", (unsigned long)index], + kUTMConfigInterfaceTypeKey: @"ide", + kUTMConfigCdromKey: @NO + }]; + [_rootDict[kUTMConfigDrivesKey] addObject:drive]; + UTMNewDrive *driveParams = [[UTMNewDrive alloc] init]; + driveParams.valid = YES; + driveParams.sizeMB = @1024; + driveParams.isQcow2 = YES; + [_newDrivesDict addObject:driveParams]; + return index; +} + +- (nullable NSString *)driveImagePathForIndex:(NSUInteger)index { + return _rootDict[kUTMConfigDrivesKey][index][kUTMConfigImagePathKey]; +} + +- (void)setImagePath:(NSString *)path forIndex:(NSUInteger)index { + _rootDict[kUTMConfigDrivesKey][index][kUTMConfigImagePathKey] = path; +} + +- (nullable NSString *)driveInterfaceTypeForIndex:(NSUInteger)index { + return _rootDict[kUTMConfigDrivesKey][index][kUTMConfigInterfaceTypeKey]; +} + +- (void)setDriveInterfaceType:(NSString *)interfaceType forIndex:(NSUInteger)index { + _rootDict[kUTMConfigDrivesKey][index][kUTMConfigInterfaceTypeKey] = interfaceType; +} + +- (BOOL)driveIsCdromForIndex:(NSUInteger)index { + return [_rootDict[kUTMConfigDrivesKey][index][kUTMConfigCdromKey] boolValue]; +} + +- (void)setDriveIsCdrom:(BOOL)isCdrom forIndex:(NSUInteger)index { + _rootDict[kUTMConfigDrivesKey][index][kUTMConfigCdromKey] = [NSNumber numberWithBool:isCdrom]; +} + +- (void)moveDriveIndex:(NSUInteger)index to:(NSUInteger)newIndex { + NSMutableDictionary *drive = _rootDict[kUTMConfigDrivesKey][index]; + [_rootDict[kUTMConfigDrivesKey] removeObjectAtIndex:index]; + [_rootDict[kUTMConfigDrivesKey] insertObject:drive atIndex:newIndex]; + UTMNewDrive *driveParams = _newDrivesDict[index]; + [_newDrivesDict removeObjectAtIndex:index]; + [_newDrivesDict insertObject:driveParams atIndex:newIndex]; +} + +- (void)removeDriveAtIndex:(NSUInteger)index { + [_rootDict[kUTMConfigDrivesKey] removeObjectAtIndex:index]; + [_newDrivesDict removeObjectAtIndex:index]; +} + +- (nullable UTMNewDrive *)driveNewParamsAtIndex:(NSUInteger)index { + return _newDrivesDict[index]; +} + +@end diff --git a/Configuration/UTMConfigurationDelegate.h b/Configuration/UTMConfigurationDelegate.h new file mode 100644 index 00000000..42553f89 --- /dev/null +++ b/Configuration/UTMConfigurationDelegate.h @@ -0,0 +1,32 @@ +// +// Copyright © 2019 Halts. 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 +#import "UTMConfiguration.h" + +NS_ASSUME_NONNULL_BEGIN + +@protocol UTMConfigurationDelegate + +@required + +@property (nonatomic, nonnull, strong) UTMConfiguration *configuration; + +- (void)refreshViewFromConfiguration; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/StaticDataTableViewController b/ConfigurationViews/StaticDataTableViewController new file mode 160000 index 00000000..818eb911 --- /dev/null +++ b/ConfigurationViews/StaticDataTableViewController @@ -0,0 +1 @@ +Subproject commit 818eb911db2f4165cb9be14a16f7bd27d8a0da14 diff --git a/ConfigurationViews/VMConfigCreateViewController.h b/ConfigurationViews/VMConfigCreateViewController.h new file mode 100644 index 00000000..7b892f54 --- /dev/null +++ b/ConfigurationViews/VMConfigCreateViewController.h @@ -0,0 +1,33 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigSystemViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigCreateViewController : VMConfigSystemViewController + +@property (weak, nonatomic) IBOutlet UITextField *nameField; +@property (nonatomic, assign) BOOL advancedConfiguration; + +- (IBAction)cancelPressed:(id)sender; +- (IBAction)savePressed:(id)sender; +- (IBAction)nameFieldEdited:(UITextField *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigCreateViewController.m b/ConfigurationViews/VMConfigCreateViewController.m new file mode 100644 index 00000000..f5dfed69 --- /dev/null +++ b/ConfigurationViews/VMConfigCreateViewController.m @@ -0,0 +1,50 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigCreateViewController.h" + +@interface VMConfigCreateViewController () + +@end + +@implementation VMConfigCreateViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.advancedConfiguration = NO; + self.nameField.text = self.configuration.name; +} + +#pragma mark - Event handlers + +- (IBAction)cancelPressed:(id)sender { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (IBAction)savePressed:(id)sender { +} + +- (IBAction)nameFieldEdited:(UITextField *)sender { + NSAssert(sender == self.nameField, @"Invalid sender"); + // TODO: validate input + self.configuration.name = sender.text; +} + +@end diff --git a/ConfigurationViews/VMConfigDisplayViewController.h b/ConfigurationViews/VMConfigDisplayViewController.h new file mode 100644 index 00000000..eb738bf8 --- /dev/null +++ b/ConfigurationViews/VMConfigDisplayViewController.h @@ -0,0 +1,47 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigDisplayViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UITableViewCell *graphicsTypeFullCell; +@property (weak, nonatomic) IBOutlet UITableViewCell *graphicsTypeConsoleCell; +@property (weak, nonatomic) IBOutlet UISwitch *resolutionFixedSwitch; +@property (weak, nonatomic) IBOutlet UITableViewCell *maxResolutionCell; +@property (weak, nonatomic) IBOutlet UILabel *maxResolutionLabel; +@property (weak, nonatomic) IBOutlet UITableViewCell *maxResolutionPickerCell; +@property (weak, nonatomic) IBOutlet UIPickerView *maxResolutionPicker; +@property (nonatomic, assign) BOOL maxResolutionPickerActive; +@property (weak, nonatomic) IBOutlet UISwitch *zoomScaleFitSwitch; +@property (weak, nonatomic) IBOutlet UISwitch *zoomLetterboxSwitch; +@property (strong, nonatomic) IBOutletCollection(UITableViewCell) NSArray *displayTypeCells; +@property (strong, nonatomic) IBOutletCollection(UITableViewCell) NSArray *displayTypeCellsWithoutPicker; +@property (strong, nonatomic) IBOutletCollection(UITableViewCell) NSArray *consoleTypeCells; + +@property (nonatomic, assign) BOOL consoleOnly; +@property (nonatomic, nullable, strong) NSString *maxResolution; + +- (IBAction)resolutionFixedSwitchChanged:(UISwitch *)sender; +- (IBAction)zoomScaleFitSwitchChanged:(UISwitch *)sender; +- (IBAction)zoomLetterboxSwitchChanged:(UISwitch *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigDisplayViewController.m b/ConfigurationViews/VMConfigDisplayViewController.m new file mode 100644 index 00000000..21c9c23b --- /dev/null +++ b/ConfigurationViews/VMConfigDisplayViewController.m @@ -0,0 +1,161 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigDisplayViewController.h" +#import "UTMConfiguration.h" + +@interface VMConfigDisplayViewController () + +@end + +@implementation VMConfigDisplayViewController + +@synthesize configuration; + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.consoleOnly = self.configuration.displayConsoleOnly; + self.maxResolutionPickerActive = NO; + self.maxResolutionLabel.text = self.maxResolution; + self.resolutionFixedSwitch.on = self.configuration.displayFixedResolution; + self.zoomScaleFitSwitch.on = self.configuration.displayZoomScale; + self.zoomLetterboxSwitch.on = self.configuration.displayZoomLetterBox; +} + +#pragma mark - Properties + +- (void)setMaxResolutionPickerActive:(BOOL)maxResolutionPickerActive { + _maxResolutionPickerActive = maxResolutionPickerActive; + if (maxResolutionPickerActive) { + NSUInteger index = [[UTMConfiguration supportedResolutions] indexOfObject:self.maxResolution]; + if (index != NSNotFound) { + [self.maxResolutionPicker selectRow:index inComponent:0 animated:NO]; + } + } + [self pickerCell:self.maxResolutionPickerCell setActive:maxResolutionPickerActive]; +} + +- (void)setConsoleOnly:(BOOL)consoleOnly { + _consoleOnly = consoleOnly; + self.configuration.displayConsoleOnly = consoleOnly; + if (consoleOnly) { + [self cells:self.displayTypeCells setHidden:YES]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self cells:self.consoleTypeCells setHidden:NO]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self.graphicsTypeFullCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.graphicsTypeConsoleCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + } else { + [self cells:self.consoleTypeCells setHidden:YES]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self cells:self.displayTypeCellsWithoutPicker setHidden:NO]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + _maxResolutionPickerActive = NO; // reset picker + [self.graphicsTypeFullCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.graphicsTypeConsoleCell setAccessoryType:UITableViewCellAccessoryNone]; + } +} + +- (void)setMaxResolution:(NSString *)maxResolution { + NSArray *parts = [maxResolution componentsSeparatedByString:@"x"]; + self.configuration.displayFixedResolutionWidth = [NSNumber numberWithLong:[parts[0] integerValue]]; + self.configuration.displayFixedResolutionHeight = [NSNumber numberWithLong:[parts[1] integerValue]]; +} + +- (NSString *)maxResolution { + return [NSString stringWithFormat:@"%@x%@", self.configuration.displayFixedResolutionWidth, self.configuration.displayFixedResolutionHeight]; +} + +#pragma mark - Table delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([tableView cellForRowAtIndexPath:indexPath] == self.graphicsTypeFullCell) { + self.consoleOnly = NO; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.graphicsTypeConsoleCell) { + self.consoleOnly = YES; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.maxResolutionCell) { + self.maxResolutionPickerActive = !self.maxResolutionPickerActive; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } +} + +#pragma mark - Picker delegate + +- (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { + if (pickerView == self.maxResolutionPicker) { + return 1; + } else { + NSAssert(0, @"Invalid picker"); + } + return 0; +} + +- (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.maxResolutionPicker) { + return [UTMConfiguration supportedResolutions].count; + } else { + NSAssert(0, @"Invalid picker"); + } + return 0; +} + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.maxResolutionPicker) { + return [UTMConfiguration supportedResolutions][row]; + } else { + NSAssert(0, @"Invalid picker"); + } + return nil; +} + +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.maxResolutionPicker) { + self.maxResolutionLabel.text = [UTMConfiguration supportedResolutions][row]; + self.maxResolution = self.maxResolutionLabel.text; + } else { + NSAssert(0, @"Invalid picker"); + } +} + +#pragma mark - Event handlers + +- (IBAction)resolutionFixedSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.resolutionFixedSwitch, @"Invalid sender"); + self.configuration.displayFixedResolution = sender.on; +} + +- (IBAction)zoomScaleFitSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.zoomScaleFitSwitch, @"Invalid sender"); + self.configuration.displayZoomScale = sender.on; +} + +- (IBAction)zoomLetterboxSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.zoomLetterboxSwitch, @"Invalid sender"); + self.configuration.displayZoomLetterBox = sender.on; +} + +@end diff --git a/ConfigurationViews/VMConfigDriveDetailViewController.h b/ConfigurationViews/VMConfigDriveDetailViewController.h new file mode 100644 index 00000000..e3b5405f --- /dev/null +++ b/ConfigurationViews/VMConfigDriveDetailViewController.h @@ -0,0 +1,52 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigDriveDetailViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UITableViewCell *driveTypeExistingCell; +@property (weak, nonatomic) IBOutlet UITableViewCell *driveTypeNewCell; +@property (weak, nonatomic) IBOutlet UILabel *existingPathLabel; +@property (weak, nonatomic) IBOutlet UILabel *driveLocationLabel; +@property (weak, nonatomic) IBOutlet UITableViewCell *driveLocationPickerCell; +@property (weak, nonatomic) IBOutlet UIPickerView *driveLocationPicker; +@property (weak, nonatomic) IBOutlet UITableViewCell *driveLocationCell; +@property (nonatomic, assign) BOOL driveLocationPickerActive; +@property (strong, nonatomic) IBOutletCollection(UITableViewCell) NSArray *existingImageCells; +@property (strong, nonatomic) IBOutletCollection(UITableViewCell) NSArray *nonexistingImageCells; +@property (weak, nonatomic) IBOutlet UITextField *nonexistingImageSizeField; +@property (weak, nonatomic) IBOutlet UISwitch *nonexistingImageExpandingSwitch; +@property (weak, nonatomic) IBOutlet UISwitch *existingImageMakeCopySwitch; +@property (weak, nonatomic) IBOutlet UITextField *nonexistingPathName; +@property (weak, nonatomic) IBOutlet UISwitch *isCdromSwitch; +@property (nonatomic, assign) NSUInteger driveIndex; +@property (nonatomic, assign) BOOL driveImageExisting; +@property (nonatomic, nullable, strong) NSString *driveInterfaceType; +@property (nonatomic) NSNumber *nonexistingImageSize; + +- (IBAction)nonexistingImageExpandingSwitchChanged:(UISwitch *)sender; +- (IBAction)existingImageMakeCopySwitchChanged:(UISwitch *)sender; +- (IBAction)nonexistingPathNameChanged:(UITextField *)sender; +- (IBAction)nonexistingImageSizeChanged:(UITextField *)sender; +- (IBAction)isCdromSwitchChanged:(UISwitch *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigDriveDetailViewController.m b/ConfigurationViews/VMConfigDriveDetailViewController.m new file mode 100644 index 00000000..08286eb3 --- /dev/null +++ b/ConfigurationViews/VMConfigDriveDetailViewController.m @@ -0,0 +1,168 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigDriveDetailViewController.h" + +@interface VMConfigDriveDetailViewController () + +@end + +@implementation VMConfigDriveDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.driveLocationPickerActive = NO; + UTMNewDrive *driveParams = [self.configuration driveNewParamsAtIndex:self.driveIndex]; + self.driveImageExisting = !driveParams.valid; + self.nonexistingImageSize = driveParams.sizeMB; + self.nonexistingImageExpandingSwitch.on = driveParams.isQcow2; + self.nonexistingPathName.text = [self.configuration driveImagePathForIndex:self.driveIndex]; + self.existingPathLabel.text = [self.configuration driveImagePathForIndex:self.driveIndex]; + self.isCdromSwitch.on = [self.configuration driveIsCdromForIndex:self.driveIndex]; + self.driveInterfaceType = [self.configuration driveInterfaceTypeForIndex:self.driveIndex]; +} + +#pragma mark - Properties + +- (void)setDriveLocationPickerActive:(BOOL)driveLocationPickerActive { + _driveLocationPickerActive = driveLocationPickerActive; + [self pickerCell:self.driveLocationPickerCell setActive:driveLocationPickerActive]; +} + +- (void)setDriveImageExisting:(BOOL)driveImageExisting { + _driveImageExisting = driveImageExisting; + if (driveImageExisting) { + [self cells:self.nonexistingImageCells setHidden:YES]; + [self cells:self.existingImageCells setHidden:NO]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self.driveTypeExistingCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.driveTypeNewCell setAccessoryType:UITableViewCellAccessoryNone]; + } else { + [self cells:self.existingImageCells setHidden:YES]; + [self cells:self.nonexistingImageCells setHidden:NO]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self.driveTypeExistingCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.driveTypeNewCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + } +} + +- (void)setDriveInterfaceType:(NSString *)driveInterfaceType { + _driveInterfaceType = driveInterfaceType; + [self.configuration setDriveInterfaceType:driveInterfaceType forIndex:self.driveIndex]; + self.driveLocationLabel.text = driveInterfaceType; +} + +- (NSNumber *)nonexistingImageSize { + return [NSNumber numberWithLong:[self.nonexistingImageSizeField.text intValue]]; +} + +- (void)setNonexistingImageSize:(NSNumber *)nonexistingImageSize { + self.nonexistingImageSizeField.text = [nonexistingImageSize stringValue]; +} + +#pragma mark - Table delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([tableView cellForRowAtIndexPath:indexPath] == self.driveLocationCell) { + self.driveLocationPickerActive = !self.driveLocationPickerActive; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.driveTypeExistingCell) { + UTMNewDrive *driveParams = [self.configuration driveNewParamsAtIndex:self.driveIndex]; + self.driveImageExisting = YES; + driveParams.valid = NO; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.driveTypeNewCell) { + UTMNewDrive *driveParams = [self.configuration driveNewParamsAtIndex:self.driveIndex]; + self.driveImageExisting = NO; + driveParams.valid = YES; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } +} + +#pragma mark - Picker delegate + +- (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { + if (pickerView == self.driveLocationPicker) { + return 1; + } else { + NSAssert(0, @"Invalid picker"); + } + return 0; +} + +- (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.driveLocationPicker) { + return [UTMConfiguration supportedDriveInterfaces].count; + } else { + NSAssert(0, @"Invalid picker"); + } + return 0; +} + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.driveLocationPicker) { + return [UTMConfiguration supportedDriveInterfaces][row]; + } else { + NSAssert(0, @"Invalid picker"); + } + return nil; +} + +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.driveLocationPicker) { + self.driveInterfaceType = [UTMConfiguration supportedDriveInterfaces][row]; + } else { + NSAssert(0, @"Invalid picker"); + } +} + +#pragma mark - Event handlers + +- (IBAction)nonexistingImageExpandingSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.nonexistingImageExpandingSwitch, @"Invalid sender"); + [self.configuration driveNewParamsAtIndex:self.driveIndex].isQcow2 = sender.on; +} + +- (IBAction)existingImageMakeCopySwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.existingImageMakeCopySwitch, @"Invalid sender"); + // TODO: implement me +} + +- (IBAction)nonexistingPathNameChanged:(UITextField *)sender { + NSAssert(sender == self.nonexistingPathName, @"Invalid sender"); + [self.configuration setImagePath:sender.text forIndex:self.driveIndex]; +} + +- (IBAction)nonexistingImageSizeChanged:(UITextField *)sender { + NSAssert(sender == self.nonexistingImageSizeField, @"Invalid sender"); + [self.configuration driveNewParamsAtIndex:self.driveIndex].sizeMB = self.nonexistingImageSize; +} + +- (IBAction)isCdromSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.isCdromSwitch, @"Invalid sender"); + [self.configuration setDriveIsCdrom:sender.on forIndex:self.driveIndex]; +} + +@end diff --git a/ConfigurationViews/VMConfigDrivesViewController.h b/ConfigurationViews/VMConfigDrivesViewController.h new file mode 100644 index 00000000..875ddc00 --- /dev/null +++ b/ConfigurationViews/VMConfigDrivesViewController.h @@ -0,0 +1,28 @@ +// +// Copyright © 2019 Halts. 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 +#import "UTMConfigurationDelegate.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigDrivesViewController : UITableViewController + +@property (weak, nonatomic) IBOutlet UIBarButtonItem *addButtonItem; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigDrivesViewController.m b/ConfigurationViews/VMConfigDrivesViewController.m new file mode 100644 index 00000000..2d67bd49 --- /dev/null +++ b/ConfigurationViews/VMConfigDrivesViewController.m @@ -0,0 +1,113 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigDrivesViewController.h" +#import "VMConfigDriveDetailViewController.h" + +@interface VMConfigDrivesViewController () + +@end + +@implementation VMConfigDrivesViewController + +@synthesize configuration; + +- (void)viewDidLoad { + [super viewDidLoad]; + self.navigationItem.rightBarButtonItems = @[ self.addButtonItem, self.editButtonItem ]; +} + +- (void)viewDidAppear:(BOOL)animated { + [self refreshViewFromConfiguration]; +} + +- (void)refreshViewFromConfiguration { + [self.tableView reloadData]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + NSAssert(section == 0, @"Invalid section."); + return self.configuration.countDrives; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"existingDrive" forIndexPath:indexPath]; + NSAssert(indexPath.section == 0, @"Invalid section"); + NSAssert(cell, @"Invalid cell"); + + cell.textLabel.text = [self.configuration driveImagePathForIndex:indexPath.row]; + cell.detailTextLabel.text = [self.configuration driveInterfaceTypeForIndex:indexPath.row]; + if ([self.configuration driveIsCdromForIndex:indexPath.row]) { + cell.imageView.image = [UIImage imageNamed:@"Media Icon"]; + } else { + cell.imageView.image = [UIImage imageNamed:@"HDD Icon"]; + } + + return cell; +} + +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + NSAssert(indexPath.section == 0, @"Invalid section"); + return YES; +} + +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + NSAssert(indexPath.section == 0, @"Invalid section"); + if (editingStyle == UITableViewCellEditingStyleDelete) { + [self.configuration removeDriveAtIndex:indexPath.row]; + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } +} + +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { + NSAssert(fromIndexPath.section == 0, @"Invalid section"); + NSAssert(toIndexPath.section == 0, @"Invalid section"); + [self.configuration moveDriveIndex:fromIndexPath.row to:toIndexPath.row]; +} + +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + NSAssert(indexPath.section == 0, @"Invalid section"); + return YES; +} + +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.identifier isEqualToString:@"existingDrive"]) { + NSIndexPath *idxPath = [self.tableView indexPathForCell:sender]; + NSAssert(idxPath, @"No index path for this segue"); + NSAssert(idxPath.section == 0, @"Bad index path section"); + NSAssert(idxPath.row < configuration.countDrives, @"Index row exceeds number of drives."); + NSAssert([segue.destinationViewController isKindOfClass:[VMConfigDriveDetailViewController class]], @"Invalid segue destination"); + VMConfigDriveDetailViewController *view = (VMConfigDriveDetailViewController *)segue.destinationViewController; + view.configuration = self.configuration; + view.driveIndex = idxPath.row; + } else if ([segue.identifier isEqualToString:@"newDrive"]) { + NSAssert([segue.destinationViewController isKindOfClass:[VMConfigDriveDetailViewController class]], @"Invalid segue destination"); + VMConfigDriveDetailViewController *view = (VMConfigDriveDetailViewController *)segue.destinationViewController; + view.configuration = self.configuration; + view.driveIndex = [self.configuration newDefaultDrive]; + } +} + +@end diff --git a/ConfigurationViews/VMConfigExistingViewController.h b/ConfigurationViews/VMConfigExistingViewController.h new file mode 100644 index 00000000..e7b7a421 --- /dev/null +++ b/ConfigurationViews/VMConfigExistingViewController.h @@ -0,0 +1,32 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigExistingViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UITextField *nameField; + +- (IBAction)nameFieldEdited:(UITextField *)sender; +- (IBAction)cancelPressed:(id)sender; +- (IBAction)donePressed:(id)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigExistingViewController.m b/ConfigurationViews/VMConfigExistingViewController.m new file mode 100644 index 00000000..d5acc9e0 --- /dev/null +++ b/ConfigurationViews/VMConfigExistingViewController.m @@ -0,0 +1,115 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigExistingViewController.h" +#import "UTMConfigurationDelegate.h" + +@interface VMConfigExistingViewController () + +@end + +@implementation VMConfigExistingViewController + +@synthesize configuration; + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + if (!self.configuration.changeName) { + self.configuration.changeName = self.configuration.name; + } + self.nameField.text = self.configuration.changeName; +} + +/* +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:<#@"reuseIdentifier"#> forIndexPath:indexPath]; + + // Configure the cell... + + return cell; +} +*/ + +/* +// Override to support conditional editing of the table view. +- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the specified item to be editable. + return YES; +} +*/ + +/* +// Override to support editing the table view. +- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + if (editingStyle == UITableViewCellEditingStyleDelete) { + // Delete the row from the data source + [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; + } else if (editingStyle == UITableViewCellEditingStyleInsert) { + // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view + } +} +*/ + +/* +// Override to support rearranging the table view. +- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { +} +*/ + +/* +// Override to support conditional rearranging of the table view. +- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { + // Return NO if you do not want the item to be re-orderable. + return YES; +} +*/ + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +#pragma mark - Event handlers + +- (IBAction)nameFieldEdited:(UITextField *)sender { + NSAssert(sender == self.nameField, @"Invalid sender"); + // TODO: input validation + configuration.changeName = sender.text; +} + +- (IBAction)cancelPressed:(id)sender { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (IBAction)donePressed:(id)sender { +} + +@end diff --git a/ConfigurationViews/VMConfigInputViewController.h b/ConfigurationViews/VMConfigInputViewController.h new file mode 100644 index 00000000..0b78bca2 --- /dev/null +++ b/ConfigurationViews/VMConfigInputViewController.h @@ -0,0 +1,34 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigInputViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UITableViewCell *pointerStyleTouchscreenCell; +@property (weak, nonatomic) IBOutlet UITableViewCell *pointerStyleTrackpadCell; +@property (weak, nonatomic) IBOutlet UITableViewCell *inputReceiverDirectCell; +@property (weak, nonatomic) IBOutlet UITableViewCell *inputReceiverServerCell; + +@property (nonatomic, assign) BOOL inputTouchscreenMode; +@property (nonatomic, assign) BOOL inputDirect; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigInputViewController.m b/ConfigurationViews/VMConfigInputViewController.m new file mode 100644 index 00000000..131fa678 --- /dev/null +++ b/ConfigurationViews/VMConfigInputViewController.m @@ -0,0 +1,82 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigInputViewController.h" + +@interface VMConfigInputViewController () + +@end + +@implementation VMConfigInputViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.inputTouchscreenMode = self.configuration.inputTouchscreenMode; + self.inputDirect = self.configuration.inputDirect; +} + +#pragma mark - Properties + +- (void)setInputTouchscreenMode:(BOOL)inputTouchscreenMode { + _inputTouchscreenMode = inputTouchscreenMode; + self.configuration.inputTouchscreenMode = inputTouchscreenMode; + if (inputTouchscreenMode) { + [self.pointerStyleTouchscreenCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.pointerStyleTrackpadCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.pointerStyleTouchscreenCell setSelected:NO animated:YES]; + } else { + [self.pointerStyleTouchscreenCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.pointerStyleTrackpadCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.pointerStyleTrackpadCell setSelected:NO animated:YES]; + } +} + +- (void)setInputDirect:(BOOL)inputDirect { + _inputDirect = inputDirect; + self.configuration.inputDirect = inputDirect; + if (inputDirect) { + [self.inputReceiverDirectCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.inputReceiverServerCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.inputReceiverDirectCell setSelected:NO animated:YES]; + } else { + [self.inputReceiverDirectCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.inputReceiverServerCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.inputReceiverServerCell setSelected:NO animated:YES]; + } +} + +#pragma mark - Table delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([tableView cellForRowAtIndexPath:indexPath] == self.pointerStyleTouchscreenCell) { + self.inputTouchscreenMode = YES; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.pointerStyleTrackpadCell) { + self.inputTouchscreenMode = NO; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.inputReceiverDirectCell) { + self.inputDirect = YES; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.inputReceiverServerCell) { + self.inputDirect = NO; + } +} + +@end diff --git a/ConfigurationViews/VMConfigNetworkingViewController.h b/ConfigurationViews/VMConfigNetworkingViewController.h new file mode 100644 index 00000000..34373a73 --- /dev/null +++ b/ConfigurationViews/VMConfigNetworkingViewController.h @@ -0,0 +1,36 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigNetworkingViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UISwitch *networkingEnabledSwitch; +@property (weak, nonatomic) IBOutlet UISwitch *localAccessOnlySwitch; +@property (weak, nonatomic) IBOutlet UITextField *networkAddressField; +@property (weak, nonatomic) IBOutlet UITextField *dhcpStartField; + +- (IBAction)networkingEnabledSwitchChanged:(UISwitch *)sender; +- (IBAction)localAccessOnlySwitchChanged:(UISwitch *)sender; +- (IBAction)networkAddressFieldEdited:(UITextField *)sender; +- (IBAction)dhcpStartFieldEdited:(UITextField *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigNetworkingViewController.m b/ConfigurationViews/VMConfigNetworkingViewController.m new file mode 100644 index 00000000..77b3b1db --- /dev/null +++ b/ConfigurationViews/VMConfigNetworkingViewController.m @@ -0,0 +1,59 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigNetworkingViewController.h" + +@interface VMConfigNetworkingViewController () + +@end + +@implementation VMConfigNetworkingViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.networkingEnabledSwitch.on = self.configuration.networkEnabled; + self.localAccessOnlySwitch.on = self.configuration.networkLocalhostOnly; + self.networkAddressField.text = self.configuration.networkIPSubnet; + self.dhcpStartField.text = self.configuration.networkDHCPStart; +} + +#pragma mark - Event handlers + +- (IBAction)networkingEnabledSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.networkingEnabledSwitch, @"Invalid sender"); + self.configuration.networkEnabled = sender.on; +} + +- (IBAction)localAccessOnlySwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.localAccessOnlySwitch, @"Invalid sender"); + self.configuration.networkLocalhostOnly = sender.on; +} + +- (IBAction)networkAddressFieldEdited:(UITextField *)sender { + NSAssert(sender == self.networkAddressField, @"Invalid sender"); + self.configuration.networkIPSubnet = sender.text; // TODO: input validation +} + +- (IBAction)dhcpStartFieldEdited:(UITextField *)sender { + NSAssert(sender == self.dhcpStartField, @"Invalid sender"); + self.configuration.networkDHCPStart = sender.text; // TODO: input validation +} + +@end diff --git a/ConfigurationViews/VMConfigNewStorageViewController.m b/ConfigurationViews/VMConfigNewStorageViewController.m new file mode 100644 index 00000000..55a559d5 --- /dev/null +++ b/ConfigurationViews/VMConfigNewStorageViewController.m @@ -0,0 +1,160 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigDriveDetailViewController.h" + +@interface VMConfigDriveDetailViewController () + +@end + +@implementation VMConfigDriveDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + UTMNewDrive *driveParams = [self.configuration driveNewParamsAtIndex:self.driveIndex]; + if (driveParams) { + self.driveImageExisting = YES; + self.nonexistingPathName.text = driveParams.name; + self.nonexistingImageSize = driveParams.sizeMB; + self.nonexistingImageExpandingSwitch.on = driveParams.isQcow2; + } else { + self.driveImageExisting = NO; + self.existingPathLabel.text = [self.configuration driveImagePathForIndex:self.driveIndex]; + self.isCdromSwitch.on = [self.configuration driveIsCdromForIndex:self.driveIndex]; + self.driveInterfaceType = [self.configuration driveInterfaceTypeForIndex:self.driveIndex]; + } + +} + +#pragma mark - Properties + +- (void)setDriveLocationPickerActive:(BOOL)driveLocationPickerActive { + _driveLocationPickerActive = driveLocationPickerActive; + [self pickerCell:self.driveLocationPickerCell setActive:driveLocationPickerActive]; +} + +- (void)setDriveImageExisting:(BOOL)driveImageExisting { + _driveImageExisting = driveImageExisting; + if (driveImageExisting) { + [self.configuration prepareNewDriveAtIndex:self.driveIndex]; + [self cells:self.nonexistingImageCells setHidden:YES]; + [self cells:self.existingImageCells setHidden:NO]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self.driveTypeExistingCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + [self.driveTypeNewCell setAccessoryType:UITableViewCellAccessoryNone]; + } else { + [self.configuration discardNewDriveAtIndex:self.driveIndex]; + [self cells:self.existingImageCells setHidden:YES]; + [self cells:self.nonexistingImageCells setHidden:NO]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; + [self.driveTypeExistingCell setAccessoryType:UITableViewCellAccessoryNone]; + [self.driveTypeNewCell setAccessoryType:UITableViewCellAccessoryCheckmark]; + } +} + +- (void)setDriveInterfaceType:(NSString *)driveInterfaceType { + _driveInterfaceType = driveInterfaceType; + [self.configuration setDriveInterfaceType:driveInterfaceType forIndex:self.driveIndex]; + self.driveLocationLabel.text = driveInterfaceType; +} + +- (NSNumber *)nonexistingImageSize { + return [NSNumber numberWithLong:[self.nonexistingImageSizeField.text intValue]]; +} + +- (void)setNonexistingImageSize:(NSNumber *)nonexistingImageSize { + self.nonexistingImageSizeField.text = [nonexistingImageSize stringValue]; +} + +#pragma mark - Table delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([tableView cellForRowAtIndexPath:indexPath] == self.driveLocationCell) { + self.driveLocationPickerActive = !self.driveLocationPickerActive; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.driveTypeExistingCell) { + self.driveImageExisting = YES; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.driveTypeNewCell) { + self.driveImageExisting = NO; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } +} + +#pragma mark - Picker delegate + +- (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { + if (pickerView == self.driveLocationPicker) { + return 1; + } + return 0; +} + +- (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + if (component == 0) { + if (pickerView == self.driveLocationPicker) { + return [UTMConfiguration supportedDriveInterfaces].count; + } + } + return 0; +} + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + if (component == 0) { + if (pickerView == self.driveLocationPicker) { + return [UTMConfiguration supportedDriveInterfaces][row]; + } + } + return nil; +} + +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + if (component == 0) { + if (pickerView == self.driveLocationPicker) { + self.driveInterfaceType = [UTMConfiguration supportedDriveInterfaces][row]; + } + } +} + +#pragma mark - Event handlers + +- (IBAction)nonexistingImageExpandingSwitchChanged:(UISwitch *)sender { + [self.configuration driveNewParamsAtIndex:self.driveIndex].isQcow2 = sender.on; +} + +- (IBAction)existingImageMakeCopySwitchChanged:(UISwitch *)sender { + // TODO: implement me +} + +- (IBAction)nonexistingPathNameChanged:(UITextField *)sender { + [self.configuration driveNewParamsAtIndex:self.driveIndex].name = sender.text; +} + +- (IBAction)nonexistingImageSizeChanged:(UITextField *)sender { + [self.configuration driveNewParamsAtIndex:self.driveIndex].sizeMB = self.nonexistingImageSize; +} + +- (IBAction)isCdromSwitchChanged:(UISwitch *)sender { + [self.configuration setDriveIsCdrom:sender.on forIndex:self.driveIndex]; +} + +@end diff --git a/ConfigurationViews/VMConfigPrintingViewController.h b/ConfigurationViews/VMConfigPrintingViewController.h new file mode 100644 index 00000000..959a7f8e --- /dev/null +++ b/ConfigurationViews/VMConfigPrintingViewController.h @@ -0,0 +1,30 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigPrintingViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UISwitch *printingEnabledSwitch; + +- (IBAction)printingEnabledSwitchChanged:(UISwitch *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigPrintingViewController.m b/ConfigurationViews/VMConfigPrintingViewController.m new file mode 100644 index 00000000..36d2ce13 --- /dev/null +++ b/ConfigurationViews/VMConfigPrintingViewController.m @@ -0,0 +1,41 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigPrintingViewController.h" + +@interface VMConfigPrintingViewController () + +@end + +@implementation VMConfigPrintingViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.printingEnabledSwitch.on = self.configuration.printEnabled; +} + +#pragma mark - Event handlers + +- (IBAction)printingEnabledSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.printingEnabledSwitch, @"Invalid sender"); + self.configuration.printEnabled = sender.on; +} + +@end diff --git a/ConfigurationViews/VMConfigSharingViewController.h b/ConfigurationViews/VMConfigSharingViewController.h new file mode 100644 index 00000000..681bf077 --- /dev/null +++ b/ConfigurationViews/VMConfigSharingViewController.h @@ -0,0 +1,30 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigSharingViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UISwitch *clipboardSharingEnabledSwitch; + +- (IBAction)clipboardSharingEnabledSwitchChanged:(UISwitch *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigSharingViewController.m b/ConfigurationViews/VMConfigSharingViewController.m new file mode 100644 index 00000000..7787e77b --- /dev/null +++ b/ConfigurationViews/VMConfigSharingViewController.m @@ -0,0 +1,41 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigSharingViewController.h" + +@interface VMConfigSharingViewController () + +@end + +@implementation VMConfigSharingViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.clipboardSharingEnabledSwitch.on = self.configuration.sharingClipboardEnabled; +} + +#pragma mark - Event handlers + +- (IBAction)clipboardSharingEnabledSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.clipboardSharingEnabledSwitch, @"Invalid sender"); + self.configuration.sharingClipboardEnabled = sender.on; +} + +@end diff --git a/ConfigurationViews/VMConfigSoundViewController.h b/ConfigurationViews/VMConfigSoundViewController.h new file mode 100644 index 00000000..f9b86a48 --- /dev/null +++ b/ConfigurationViews/VMConfigSoundViewController.h @@ -0,0 +1,30 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigSoundViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UISwitch *soundEnabledSwitch; + +- (IBAction)soundEnabledSwitchChanged:(UISwitch *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigSoundViewController.m b/ConfigurationViews/VMConfigSoundViewController.m new file mode 100644 index 00000000..fc2ea831 --- /dev/null +++ b/ConfigurationViews/VMConfigSoundViewController.m @@ -0,0 +1,41 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigSoundViewController.h" + +@interface VMConfigSoundViewController () + +@end + +@implementation VMConfigSoundViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.soundEnabledSwitch.on = self.configuration.soundEnabled; +} + +#pragma mark - Event handlers + +- (IBAction)soundEnabledSwitchChanged:(UISwitch *)sender { + NSAssert(sender == self.soundEnabledSwitch, @"Invalid sender"); + self.configuration.soundEnabled = sender.on; +} + +@end diff --git a/ConfigurationViews/VMConfigSystemViewController.h b/ConfigurationViews/VMConfigSystemViewController.h new file mode 100644 index 00000000..1ae80ef9 --- /dev/null +++ b/ConfigurationViews/VMConfigSystemViewController.h @@ -0,0 +1,55 @@ +// +// Copyright © 2019 Halts. 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 +#import "VMConfigViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigSystemViewController : VMConfigViewController + +@property (weak, nonatomic) IBOutlet UITableViewCell *architectureCell; +@property (weak, nonatomic) IBOutlet UILabel *architectureLabel; +@property (weak, nonatomic) IBOutlet UITableViewCell *architecturePickerCell; +@property (weak, nonatomic) IBOutlet UIPickerView *architecturePicker; +@property (nonatomic, assign) BOOL architecturePickerActive; + +@property (weak, nonatomic) IBOutlet UITextField *memorySizeField; +@property (weak, nonatomic) IBOutlet UITextField *cpuCountField; + +@property (weak, nonatomic) IBOutlet UITableViewCell *bootCell; +@property (weak, nonatomic) IBOutlet UILabel *bootLabel; +@property (weak, nonatomic) IBOutlet UITableViewCell *bootPickerCell; +@property (weak, nonatomic) IBOutlet UIPickerView *bootPicker; +@property (nonatomic, assign) BOOL bootPickerActive; + +@property (weak, nonatomic) IBOutlet UITableViewCell *systemCell; +@property (weak, nonatomic) IBOutlet UILabel *systemLabel; +@property (weak, nonatomic) IBOutlet UITableViewCell *systemPickerCell; +@property (weak, nonatomic) IBOutlet UIPickerView *systemPicker; +@property (nonatomic, assign) BOOL systemPickerActive; +@property (weak, nonatomic) IBOutlet UITextField *additionalArgsField; + +@property (nonatomic) NSNumber *memorySize; +@property (nonatomic) NSNumber *cpuCount; + +- (IBAction)memorySizeFieldEdited:(UITextField *)sender; +- (IBAction)cpuCountFieldEdited:(UITextField *)sender; +- (IBAction)additionalArgsFieldEdited:(UITextField *)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigSystemViewController.m b/ConfigurationViews/VMConfigSystemViewController.m new file mode 100644 index 00000000..ab556df4 --- /dev/null +++ b/ConfigurationViews/VMConfigSystemViewController.m @@ -0,0 +1,197 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigSystemViewController.h" +#import "UTMConfiguration.h" + +@interface VMConfigSystemViewController () + +@end + +@implementation VMConfigSystemViewController + +- (void)viewDidLoad { + [super viewDidLoad]; +} + +- (void)refreshViewFromConfiguration { + [super refreshViewFromConfiguration]; + self.architecturePickerActive = NO; + self.bootPickerActive = NO; + self.systemPickerActive = NO; + self.architectureLabel.text = self.configuration.systemArchitecture; + self.bootLabel.text = self.configuration.systemBootDevice; + self.systemLabel.text = self.configuration.systemTarget; + self.additionalArgsField.text = self.configuration.systemAddArgs; + self.memorySize = self.configuration.systemMemory; + self.cpuCount = self.configuration.systemCPUCount; +} + +#pragma mark - Properties + +- (void)setArchitecturePickerActive:(BOOL)architecturePickerActive { + _architecturePickerActive = architecturePickerActive; + if (architecturePickerActive) { + NSUInteger index = [[UTMConfiguration supportedArchitectures] indexOfObject:self.architectureLabel.text]; + if (index != NSNotFound) { + [self.architecturePicker selectRow:index inComponent:0 animated:NO]; + } + } + [self pickerCell:self.architecturePickerCell setActive:architecturePickerActive]; +} + +- (void)setBootPickerActive:(BOOL)bootPickerActive { + _bootPickerActive = bootPickerActive; + if (bootPickerActive) { + NSUInteger index = [[UTMConfiguration supportedBootDevices] indexOfObject:self.bootLabel.text]; + if (index != NSNotFound) { + [self.bootPicker selectRow:index inComponent:0 animated:NO]; + } + } + [self pickerCell:self.bootPickerCell setActive:bootPickerActive]; +} + +- (void)setSystemPickerActive:(BOOL)systemPickerActive { + _systemPickerActive = systemPickerActive; + if (systemPickerActive) { + NSUInteger index = [[UTMConfiguration supportedTargetsForArchitecture:@"FIXME: arch here"] indexOfObject:self.systemLabel.text]; + if (index != NSNotFound) { + [self.systemPicker selectRow:index inComponent:0 animated:NO]; + } + } + [self pickerCell:self.systemPickerCell setActive:systemPickerActive]; +} + +- (void)setMemorySize:(NSNumber *)memorySize { + self.memorySizeField.text = [memorySize stringValue]; +} + +- (NSNumber *)memorySize { + return [NSNumber numberWithLong:[self.memorySizeField.text integerValue]]; +} + +- (void)setCpuCount:(NSNumber *)cpuCount { + self.cpuCountField.text = [cpuCount stringValue]; +} + +- (NSNumber *)cpuCount { + return [NSNumber numberWithLong:[self.cpuCountField.text integerValue]]; +} + +#pragma mark - Table delegate + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if ([tableView cellForRowAtIndexPath:indexPath] == self.architectureCell) { + self.architecturePickerActive = !self.architecturePickerActive; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.bootCell) { + self.bootPickerActive = !self.bootPickerActive; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } + if ([tableView cellForRowAtIndexPath:indexPath] == self.systemCell) { + self.systemPickerActive = !self.systemPickerActive; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; + } +} + +- (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView { + if (pickerView == self.architecturePicker) { + return 1; + } else if (pickerView == self.bootPicker) { + return 1; + } else if (pickerView == self.systemPicker) { + return 1; + } else { + NSAssert(0, @"Invalid picker"); + } + return 0; +} + +#pragma mark - Picker delegate + +- (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.architecturePicker) { + return [UTMConfiguration supportedArchitecturesPretty].count; + } else if (pickerView == self.bootPicker) { + return [UTMConfiguration supportedBootDevices].count; + } else if (pickerView == self.systemPicker) { + return [UTMConfiguration supportedTargetsForArchitecture:@"FIXME: arch here"].count; + } else { + NSAssert(0, @"Invalid picker"); + } + return 0; +} + +- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.architecturePicker) { + return [UTMConfiguration supportedArchitecturesPretty][row]; + } else if (pickerView == self.bootPicker) { + return [UTMConfiguration supportedBootDevices][row]; + } else if (pickerView == self.systemPicker) { + return [UTMConfiguration supportedTargetsForArchitecture:@"FIXME: arch here"][row]; + } else { + NSAssert(0, @"Invalid picker"); + } + return nil; +} + +- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { + NSAssert(component == 0, @"Invalid component"); + if (pickerView == self.architecturePicker) { + self.architectureLabel.text = [UTMConfiguration supportedArchitecturesPretty][row]; + self.configuration.systemArchitecture = self.architectureLabel.text; + } else if (pickerView == self.bootPicker) { + self.bootLabel.text = [UTMConfiguration supportedBootDevices][row]; + self.configuration.systemBootDevice = self.bootLabel.text; + } else if (pickerView == self.systemPicker) { + self.systemLabel.text = [UTMConfiguration supportedTargetsForArchitecture:@"FIXME: arch here"][row]; + self.configuration.systemTarget = self.systemLabel.text; + } else { + NSAssert(0, @"Invalid picker"); + } +} + +#pragma mark - Event handlers + +- (void)memorySizeFieldEdited:(UITextField *)sender { + NSAssert(sender == self.memorySizeField, @"Invalid sender"); + NSNumber *memorySize = self.memorySize; + if (memorySize.intValue > 0) { + self.configuration.systemMemory = memorySize; + } else { + // TODO: error handler + } +} + +- (void)cpuCountFieldEdited:(UITextField *)sender { + NSAssert(sender == self.cpuCountField, @"Invalid sender"); + NSNumber *num = self.cpuCount; + if (num.intValue > 0) { + self.configuration.systemCPUCount = num; + } else { + // TODO: error handler + } +} + +- (IBAction)additionalArgsFieldEdited:(UITextField *)sender { + NSAssert(sender == self.additionalArgsField, @"Invalid sender"); + self.configuration.systemAddArgs = sender.text; +} + +@end diff --git a/ConfigurationViews/VMConfigViewController.h b/ConfigurationViews/VMConfigViewController.h new file mode 100644 index 00000000..b25bbe46 --- /dev/null +++ b/ConfigurationViews/VMConfigViewController.h @@ -0,0 +1,31 @@ +// +// Copyright © 2019 Halts. 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 +#import "StaticDataTableViewController.h" +#import "UTMConfigurationDelegate.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface VMConfigViewController : StaticDataTableViewController + +@property (nonatomic, assign) BOOL doneLoadingConfiguration; + +- (void)pickerCell:(nonnull UITableViewCell *)pickerCell setActive:(BOOL)active; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ConfigurationViews/VMConfigViewController.m b/ConfigurationViews/VMConfigViewController.m new file mode 100644 index 00000000..a2412e77 --- /dev/null +++ b/ConfigurationViews/VMConfigViewController.m @@ -0,0 +1,63 @@ +// +// Copyright © 2019 Halts. 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 "VMConfigViewController.h" + +@interface VMConfigViewController () + +@end + +@implementation VMConfigViewController + +@synthesize configuration; + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.insertTableViewRowAnimation = UITableViewRowAnimationMiddle; + self.deleteTableViewRowAnimation = UITableViewRowAnimationMiddle; + self.reloadTableViewRowAnimation = UITableViewRowAnimationMiddle; + [self refreshViewFromConfiguration]; + self.doneLoadingConfiguration = YES; +} + +- (void)refreshViewFromConfiguration { + NSAssert(self.configuration, @"Configuration is nil!"); +} + +#pragma mark - Picker helpers + +- (void)pickerCell:(nonnull UITableViewCell *)pickerCell setActive:(BOOL)active { + [self cell:pickerCell setHidden:!active]; + [self reloadDataAnimated:self.doneLoadingConfiguration]; +} + +#pragma mark - Text field helpers +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + [textField resignFirstResponder]; + return YES; +} + +#pragma mark - Navigation + +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if ([segue.destinationViewController conformsToProtocol:@protocol(UTMConfigurationDelegate)]) { + id dst = (id)segue.destinationViewController; + dst.configuration = self.configuration; + } +} + +@end diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/UTM.xcodeproj/project.pbxproj b/UTM.xcodeproj/project.pbxproj new file mode 100644 index 00000000..17ba83bd --- /dev/null +++ b/UTM.xcodeproj/project.pbxproj @@ -0,0 +1,468 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + CE31C245225E555600A965DD /* UTMConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CE31C244225E555600A965DD /* UTMConfiguration.m */; }; + CE31C24B225EA37400A965DD /* VMConfigViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE31C24A225EA37400A965DD /* VMConfigViewController.m */; }; + CE31C24D225EA4A200A965DD /* VMConfigCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE31C24C225EA4A200A965DD /* VMConfigCreateViewController.m */; }; + CE550BCE225947990063E575 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CE550BCD225947990063E575 /* AppDelegate.m */; }; + CE550BD1225947990063E575 /* VMListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE550BD0225947990063E575 /* VMListViewController.m */; }; + CE550BD4225947990063E575 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE550BD2225947990063E575 /* Main.storyboard */; }; + CE550BD62259479D0063E575 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CE550BD52259479D0063E575 /* Assets.xcassets */; }; + CE550BD92259479D0063E575 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CE550BD72259479D0063E575 /* LaunchScreen.storyboard */; }; + CE550BDC2259479D0063E575 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CE550BDB2259479D0063E575 /* main.m */; }; + CE550BE422596E790063E575 /* VMListViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = CE550BE322596E790063E575 /* VMListViewCell.m */; }; + CE5E4958225C5A4400148CEF /* VMConfigExistingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE5E4957225C5A4400148CEF /* VMConfigExistingViewController.m */; }; + CE74C288225D88ED004E4FF1 /* VMConfigNetworkingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C276225D88EC004E4FF1 /* VMConfigNetworkingViewController.m */; }; + CE74C28A225D88ED004E4FF1 /* VMConfigPrintingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C279225D88EC004E4FF1 /* VMConfigPrintingViewController.m */; }; + CE74C28B225D88ED004E4FF1 /* VMConfigDisplayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C27D225D88EC004E4FF1 /* VMConfigDisplayViewController.m */; }; + CE74C28C225D88ED004E4FF1 /* VMConfigDriveDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C27E225D88EC004E4FF1 /* VMConfigDriveDetailViewController.m */; }; + CE74C28D225D88ED004E4FF1 /* VMConfigInputViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C27F225D88EC004E4FF1 /* VMConfigInputViewController.m */; }; + CE74C28E225D88ED004E4FF1 /* VMConfigSharingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C280225D88EC004E4FF1 /* VMConfigSharingViewController.m */; }; + CE74C28F225D88ED004E4FF1 /* VMConfigSoundViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C284225D88ED004E4FF1 /* VMConfigSoundViewController.m */; }; + CE74C290225D88ED004E4FF1 /* VMConfigSystemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE74C285225D88ED004E4FF1 /* VMConfigSystemViewController.m */; }; + CE7BED4C225FBB8600A1E1B6 /* VMConfigDrivesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE7BED4B225FBB8600A1E1B6 /* VMConfigDrivesViewController.m */; }; + CEDC1DF22260EE4B008D9A6D /* StaticDataTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CEDC1DF12260EE4B008D9A6D /* StaticDataTableViewController.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + CE31C243225E553500A965DD /* UTMConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTMConfiguration.h; sourceTree = ""; }; + CE31C244225E555600A965DD /* UTMConfiguration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UTMConfiguration.m; sourceTree = ""; }; + CE31C246225E9FED00A965DD /* UTMConfigurationDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTMConfigurationDelegate.h; sourceTree = ""; }; + CE31C249225EA37400A965DD /* VMConfigViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMConfigViewController.h; sourceTree = ""; }; + CE31C24A225EA37400A965DD /* VMConfigViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VMConfigViewController.m; sourceTree = ""; }; + CE31C24C225EA4A200A965DD /* VMConfigCreateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigCreateViewController.m; sourceTree = ""; }; + CE550BC9225947990063E575 /* UTM.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UTM.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CE550BCC225947990063E575 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + CE550BCD225947990063E575 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + CE550BCF225947990063E575 /* VMListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMListViewController.h; sourceTree = ""; }; + CE550BD0225947990063E575 /* VMListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VMListViewController.m; sourceTree = ""; }; + CE550BD3225947990063E575 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + CE550BD52259479D0063E575 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + CE550BD82259479D0063E575 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + CE550BDA2259479D0063E575 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CE550BDB2259479D0063E575 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + CE550BE222596E790063E575 /* VMListViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMListViewCell.h; sourceTree = ""; }; + CE550BE322596E790063E575 /* VMListViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VMListViewCell.m; sourceTree = ""; }; + CE5E4956225C5A4400148CEF /* VMConfigExistingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMConfigExistingViewController.h; sourceTree = ""; }; + CE5E4957225C5A4400148CEF /* VMConfigExistingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VMConfigExistingViewController.m; sourceTree = ""; }; + CE74C276225D88EC004E4FF1 /* VMConfigNetworkingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigNetworkingViewController.m; sourceTree = ""; }; + CE74C277225D88EC004E4FF1 /* VMConfigSystemViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigSystemViewController.h; sourceTree = ""; }; + CE74C279225D88EC004E4FF1 /* VMConfigPrintingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigPrintingViewController.m; sourceTree = ""; }; + CE74C27A225D88EC004E4FF1 /* VMConfigPrintingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigPrintingViewController.h; sourceTree = ""; }; + CE74C27B225D88EC004E4FF1 /* VMConfigCreateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigCreateViewController.h; sourceTree = ""; }; + CE74C27C225D88EC004E4FF1 /* VMConfigNetworkingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigNetworkingViewController.h; sourceTree = ""; }; + CE74C27D225D88EC004E4FF1 /* VMConfigDisplayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigDisplayViewController.m; sourceTree = ""; }; + CE74C27E225D88EC004E4FF1 /* VMConfigDriveDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigDriveDetailViewController.m; sourceTree = ""; }; + CE74C27F225D88EC004E4FF1 /* VMConfigInputViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigInputViewController.m; sourceTree = ""; }; + CE74C280225D88EC004E4FF1 /* VMConfigSharingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigSharingViewController.m; sourceTree = ""; }; + CE74C281225D88EC004E4FF1 /* VMConfigDisplayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigDisplayViewController.h; sourceTree = ""; }; + CE74C282225D88ED004E4FF1 /* VMConfigInputViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigInputViewController.h; sourceTree = ""; }; + CE74C283225D88ED004E4FF1 /* VMConfigSoundViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigSoundViewController.h; sourceTree = ""; }; + CE74C284225D88ED004E4FF1 /* VMConfigSoundViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigSoundViewController.m; sourceTree = ""; }; + CE74C285225D88ED004E4FF1 /* VMConfigSystemViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VMConfigSystemViewController.m; sourceTree = ""; }; + CE74C286225D88ED004E4FF1 /* VMConfigSharingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigSharingViewController.h; sourceTree = ""; }; + CE74C287225D88ED004E4FF1 /* VMConfigDriveDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMConfigDriveDetailViewController.h; sourceTree = ""; }; + CE7BED4A225FBB8600A1E1B6 /* VMConfigDrivesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VMConfigDrivesViewController.h; sourceTree = ""; }; + CE7BED4B225FBB8600A1E1B6 /* VMConfigDrivesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VMConfigDrivesViewController.m; sourceTree = ""; }; + CEDC1DF02260EE4B008D9A6D /* StaticDataTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticDataTableViewController.h; sourceTree = ""; }; + CEDC1DF12260EE4B008D9A6D /* StaticDataTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StaticDataTableViewController.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + CE550BC6225947990063E575 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + CE31C242225E543A00A965DD /* Configuration */ = { + isa = PBXGroup; + children = ( + CE31C243225E553500A965DD /* UTMConfiguration.h */, + CE31C244225E555600A965DD /* UTMConfiguration.m */, + CE31C246225E9FED00A965DD /* UTMConfigurationDelegate.h */, + ); + path = Configuration; + sourceTree = ""; + }; + CE550BC0225947990063E575 = { + isa = PBXGroup; + children = ( + CE31C242225E543A00A965DD /* Configuration */, + CE5E4954225C593C00148CEF /* ConfigurationViews */, + CE7BED4D22600F5000A1E1B6 /* Views */, + CE550BCB225947990063E575 /* UTM */, + CE550BCA225947990063E575 /* Products */, + ); + sourceTree = ""; + }; + CE550BCA225947990063E575 /* Products */ = { + isa = PBXGroup; + children = ( + CE550BC9225947990063E575 /* UTM.app */, + ); + name = Products; + sourceTree = ""; + }; + CE550BCB225947990063E575 /* UTM */ = { + isa = PBXGroup; + children = ( + CE550BCC225947990063E575 /* AppDelegate.h */, + CE550BCD225947990063E575 /* AppDelegate.m */, + CE550BD2225947990063E575 /* Main.storyboard */, + CE550BD52259479D0063E575 /* Assets.xcassets */, + CE550BD72259479D0063E575 /* LaunchScreen.storyboard */, + CE550BDA2259479D0063E575 /* Info.plist */, + CE550BDB2259479D0063E575 /* main.m */, + ); + path = UTM; + sourceTree = ""; + }; + CE5E4954225C593C00148CEF /* ConfigurationViews */ = { + isa = PBXGroup; + children = ( + CEDC1DEF2260EE34008D9A6D /* StaticDataTableViewController */, + CE31C249225EA37400A965DD /* VMConfigViewController.h */, + CE31C24A225EA37400A965DD /* VMConfigViewController.m */, + CE74C27B225D88EC004E4FF1 /* VMConfigCreateViewController.h */, + CE31C24C225EA4A200A965DD /* VMConfigCreateViewController.m */, + CE74C281225D88EC004E4FF1 /* VMConfigDisplayViewController.h */, + CE74C27D225D88EC004E4FF1 /* VMConfigDisplayViewController.m */, + CE74C287225D88ED004E4FF1 /* VMConfigDriveDetailViewController.h */, + CE74C27E225D88EC004E4FF1 /* VMConfigDriveDetailViewController.m */, + CE7BED4A225FBB8600A1E1B6 /* VMConfigDrivesViewController.h */, + CE7BED4B225FBB8600A1E1B6 /* VMConfigDrivesViewController.m */, + CE5E4956225C5A4400148CEF /* VMConfigExistingViewController.h */, + CE5E4957225C5A4400148CEF /* VMConfigExistingViewController.m */, + CE74C282225D88ED004E4FF1 /* VMConfigInputViewController.h */, + CE74C27F225D88EC004E4FF1 /* VMConfigInputViewController.m */, + CE74C27C225D88EC004E4FF1 /* VMConfigNetworkingViewController.h */, + CE74C276225D88EC004E4FF1 /* VMConfigNetworkingViewController.m */, + CE74C27A225D88EC004E4FF1 /* VMConfigPrintingViewController.h */, + CE74C279225D88EC004E4FF1 /* VMConfigPrintingViewController.m */, + CE74C286225D88ED004E4FF1 /* VMConfigSharingViewController.h */, + CE74C280225D88EC004E4FF1 /* VMConfigSharingViewController.m */, + CE74C283225D88ED004E4FF1 /* VMConfigSoundViewController.h */, + CE74C284225D88ED004E4FF1 /* VMConfigSoundViewController.m */, + CE74C277225D88EC004E4FF1 /* VMConfigSystemViewController.h */, + CE74C285225D88ED004E4FF1 /* VMConfigSystemViewController.m */, + ); + path = ConfigurationViews; + sourceTree = ""; + }; + CE7BED4D22600F5000A1E1B6 /* Views */ = { + isa = PBXGroup; + children = ( + CE550BCF225947990063E575 /* VMListViewController.h */, + CE550BD0225947990063E575 /* VMListViewController.m */, + CE550BE222596E790063E575 /* VMListViewCell.h */, + CE550BE322596E790063E575 /* VMListViewCell.m */, + ); + path = Views; + sourceTree = ""; + }; + CEDC1DEF2260EE34008D9A6D /* StaticDataTableViewController */ = { + isa = PBXGroup; + children = ( + CEDC1DF02260EE4B008D9A6D /* StaticDataTableViewController.h */, + CEDC1DF12260EE4B008D9A6D /* StaticDataTableViewController.m */, + ); + path = StaticDataTableViewController; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + CE550BC8225947990063E575 /* UTM */ = { + isa = PBXNativeTarget; + buildConfigurationList = CE550BDF2259479D0063E575 /* Build configuration list for PBXNativeTarget "UTM" */; + buildPhases = ( + CE550BC5225947990063E575 /* Sources */, + CE550BC6225947990063E575 /* Frameworks */, + CE550BC7225947990063E575 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = UTM; + productName = UTM; + productReference = CE550BC9225947990063E575 /* UTM.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + CE550BC1225947990063E575 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + ORGANIZATIONNAME = Halts; + TargetAttributes = { + CE550BC8225947990063E575 = { + CreatedOnToolsVersion = 10.2; + }; + }; + }; + buildConfigurationList = CE550BC4225947990063E575 /* Build configuration list for PBXProject "UTM" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = CE550BC0225947990063E575; + productRefGroup = CE550BCA225947990063E575 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + CE550BC8225947990063E575 /* UTM */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + CE550BC7225947990063E575 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CE550BD92259479D0063E575 /* LaunchScreen.storyboard in Resources */, + CE550BD62259479D0063E575 /* Assets.xcassets in Resources */, + CE550BD4225947990063E575 /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + CE550BC5225947990063E575 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CE550BD1225947990063E575 /* VMListViewController.m in Sources */, + CE31C24D225EA4A200A965DD /* VMConfigCreateViewController.m in Sources */, + CE74C288225D88ED004E4FF1 /* VMConfigNetworkingViewController.m in Sources */, + CE74C28E225D88ED004E4FF1 /* VMConfigSharingViewController.m in Sources */, + CE74C28F225D88ED004E4FF1 /* VMConfigSoundViewController.m in Sources */, + CE5E4958225C5A4400148CEF /* VMConfigExistingViewController.m in Sources */, + CE550BE422596E790063E575 /* VMListViewCell.m in Sources */, + CE74C28A225D88ED004E4FF1 /* VMConfigPrintingViewController.m in Sources */, + CE550BDC2259479D0063E575 /* main.m in Sources */, + CEDC1DF22260EE4B008D9A6D /* StaticDataTableViewController.m in Sources */, + CE550BCE225947990063E575 /* AppDelegate.m in Sources */, + CE74C290225D88ED004E4FF1 /* VMConfigSystemViewController.m in Sources */, + CE31C24B225EA37400A965DD /* VMConfigViewController.m in Sources */, + CE74C28C225D88ED004E4FF1 /* VMConfigDriveDetailViewController.m in Sources */, + CE31C245225E555600A965DD /* UTMConfiguration.m in Sources */, + CE7BED4C225FBB8600A1E1B6 /* VMConfigDrivesViewController.m in Sources */, + CE74C28D225D88ED004E4FF1 /* VMConfigInputViewController.m in Sources */, + CE74C28B225D88ED004E4FF1 /* VMConfigDisplayViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + CE550BD2225947990063E575 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CE550BD3225947990063E575 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + CE550BD72259479D0063E575 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + CE550BD82259479D0063E575 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + CE550BDD2259479D0063E575 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + CE550BDE2259479D0063E575 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + CE550BE02259479D0063E575 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = UTM/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.halts.UTM; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + CE550BE12259479D0063E575 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; + INFOPLIST_FILE = UTM/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.halts.UTM; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + CE550BC4225947990063E575 /* Build configuration list for PBXProject "UTM" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CE550BDD2259479D0063E575 /* Debug */, + CE550BDE2259479D0063E575 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CE550BDF2259479D0063E575 /* Build configuration list for PBXNativeTarget "UTM" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + CE550BE02259479D0063E575 /* Debug */, + CE550BE12259479D0063E575 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = CE550BC1225947990063E575 /* Project object */; +} diff --git a/UTM.xcodeproj/xcshareddata/IDETemplateMacros.plist b/UTM.xcodeproj/xcshareddata/IDETemplateMacros.plist new file mode 100644 index 00000000..23f69af5 --- /dev/null +++ b/UTM.xcodeproj/xcshareddata/IDETemplateMacros.plist @@ -0,0 +1,22 @@ + + + + + FILEHEADER + +// ___COPYRIGHT___ +// +// 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. +// + + diff --git a/UTM/AppDelegate.h b/UTM/AppDelegate.h new file mode 100644 index 00000000..217ee3fe --- /dev/null +++ b/UTM/AppDelegate.h @@ -0,0 +1,25 @@ +// +// Copyright © 2019 Halts. 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 + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/UTM/AppDelegate.m b/UTM/AppDelegate.m new file mode 100644 index 00000000..d1ff658e --- /dev/null +++ b/UTM/AppDelegate.m @@ -0,0 +1,59 @@ +// +// Copyright © 2019 Halts. 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 "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. +} + + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. +} + + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + + +@end diff --git a/UTM/Assets.xcassets/AppIcon.appiconset/Contents.json b/UTM/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..d8db8d65 --- /dev/null +++ b/UTM/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/CPU Icon.imageset/Contents.json b/UTM/Assets.xcassets/CPU Icon.imageset/Contents.json new file mode 100644 index 00000000..f3dce52c --- /dev/null +++ b/UTM/Assets.xcassets/CPU Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "cpu-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "cpu-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "cpu-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@1x.png b/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@1x.png new file mode 100644 index 00000000..58a390d4 Binary files /dev/null and b/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@1x.png differ diff --git a/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@2x.png b/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@2x.png new file mode 100644 index 00000000..fa19767c Binary files /dev/null and b/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@2x.png differ diff --git a/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@3x.png b/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@3x.png new file mode 100644 index 00000000..1a02d934 Binary files /dev/null and b/UTM/Assets.xcassets/CPU Icon.imageset/cpu-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Contents.json b/UTM/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/UTM/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Display Icon.imageset/Contents.json b/UTM/Assets.xcassets/Display Icon.imageset/Contents.json new file mode 100644 index 00000000..72d2c2c9 --- /dev/null +++ b/UTM/Assets.xcassets/Display Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "display-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "display-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "display-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Display Icon.imageset/display-icon@1x.png b/UTM/Assets.xcassets/Display Icon.imageset/display-icon@1x.png new file mode 100644 index 00000000..1cf294bd Binary files /dev/null and b/UTM/Assets.xcassets/Display Icon.imageset/display-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Display Icon.imageset/display-icon@2x.png b/UTM/Assets.xcassets/Display Icon.imageset/display-icon@2x.png new file mode 100644 index 00000000..aa982371 Binary files /dev/null and b/UTM/Assets.xcassets/Display Icon.imageset/display-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Display Icon.imageset/display-icon@3x.png b/UTM/Assets.xcassets/Display Icon.imageset/display-icon@3x.png new file mode 100644 index 00000000..eaee4274 Binary files /dev/null and b/UTM/Assets.xcassets/Display Icon.imageset/display-icon@3x.png differ diff --git a/UTM/Assets.xcassets/HDD Icon.imageset/Contents.json b/UTM/Assets.xcassets/HDD Icon.imageset/Contents.json new file mode 100644 index 00000000..dc59ddee --- /dev/null +++ b/UTM/Assets.xcassets/HDD Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "hdd-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "hdd-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "hdd-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@1x.png b/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@1x.png new file mode 100644 index 00000000..85fe8f50 Binary files /dev/null and b/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@1x.png differ diff --git a/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@2x.png b/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@2x.png new file mode 100644 index 00000000..d2ee1e95 Binary files /dev/null and b/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@2x.png differ diff --git a/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@3x.png b/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@3x.png new file mode 100644 index 00000000..a3d12689 Binary files /dev/null and b/UTM/Assets.xcassets/HDD Icon.imageset/hdd-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Input Icon.imageset/Contents.json b/UTM/Assets.xcassets/Input Icon.imageset/Contents.json new file mode 100644 index 00000000..93b6b52c --- /dev/null +++ b/UTM/Assets.xcassets/Input Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "input-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "input-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "input-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Input Icon.imageset/input-icon@1x.png b/UTM/Assets.xcassets/Input Icon.imageset/input-icon@1x.png new file mode 100644 index 00000000..ad80ea92 Binary files /dev/null and b/UTM/Assets.xcassets/Input Icon.imageset/input-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Input Icon.imageset/input-icon@2x.png b/UTM/Assets.xcassets/Input Icon.imageset/input-icon@2x.png new file mode 100644 index 00000000..cc4bf018 Binary files /dev/null and b/UTM/Assets.xcassets/Input Icon.imageset/input-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Input Icon.imageset/input-icon@3x.png b/UTM/Assets.xcassets/Input Icon.imageset/input-icon@3x.png new file mode 100644 index 00000000..15792d0f Binary files /dev/null and b/UTM/Assets.xcassets/Input Icon.imageset/input-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Media Icon.imageset/Contents.json b/UTM/Assets.xcassets/Media Icon.imageset/Contents.json new file mode 100644 index 00000000..ecf032c8 --- /dev/null +++ b/UTM/Assets.xcassets/Media Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "media-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "media-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "media-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Media Icon.imageset/media-icon@1x.png b/UTM/Assets.xcassets/Media Icon.imageset/media-icon@1x.png new file mode 100644 index 00000000..bb8d70c0 Binary files /dev/null and b/UTM/Assets.xcassets/Media Icon.imageset/media-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Media Icon.imageset/media-icon@2x.png b/UTM/Assets.xcassets/Media Icon.imageset/media-icon@2x.png new file mode 100644 index 00000000..93250296 Binary files /dev/null and b/UTM/Assets.xcassets/Media Icon.imageset/media-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Media Icon.imageset/media-icon@3x.png b/UTM/Assets.xcassets/Media Icon.imageset/media-icon@3x.png new file mode 100644 index 00000000..95524933 Binary files /dev/null and b/UTM/Assets.xcassets/Media Icon.imageset/media-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Networking Icon.imageset/Contents.json b/UTM/Assets.xcassets/Networking Icon.imageset/Contents.json new file mode 100644 index 00000000..0f5d55b2 --- /dev/null +++ b/UTM/Assets.xcassets/Networking Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "network-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "network-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "network-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@1x.png b/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@1x.png new file mode 100644 index 00000000..ba9fe536 Binary files /dev/null and b/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@2x.png b/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@2x.png new file mode 100644 index 00000000..0c71aae8 Binary files /dev/null and b/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@3x.png b/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@3x.png new file mode 100644 index 00000000..a958f0a8 Binary files /dev/null and b/UTM/Assets.xcassets/Networking Icon.imageset/network-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Play Icon.imageset/Contents.json b/UTM/Assets.xcassets/Play Icon.imageset/Contents.json new file mode 100644 index 00000000..f5b7a36f --- /dev/null +++ b/UTM/Assets.xcassets/Play Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "play-button@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "play-button@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "play-button@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Play Icon.imageset/play-button@1x.png b/UTM/Assets.xcassets/Play Icon.imageset/play-button@1x.png new file mode 100644 index 00000000..8eddcaf2 Binary files /dev/null and b/UTM/Assets.xcassets/Play Icon.imageset/play-button@1x.png differ diff --git a/UTM/Assets.xcassets/Play Icon.imageset/play-button@2x.png b/UTM/Assets.xcassets/Play Icon.imageset/play-button@2x.png new file mode 100644 index 00000000..5acab92e Binary files /dev/null and b/UTM/Assets.xcassets/Play Icon.imageset/play-button@2x.png differ diff --git a/UTM/Assets.xcassets/Play Icon.imageset/play-button@3x.png b/UTM/Assets.xcassets/Play Icon.imageset/play-button@3x.png new file mode 100644 index 00000000..d2c65eb1 Binary files /dev/null and b/UTM/Assets.xcassets/Play Icon.imageset/play-button@3x.png differ diff --git a/UTM/Assets.xcassets/Printer Icon.imageset/Contents.json b/UTM/Assets.xcassets/Printer Icon.imageset/Contents.json new file mode 100644 index 00000000..3ba05ba8 --- /dev/null +++ b/UTM/Assets.xcassets/Printer Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "printer-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "printer-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "printer-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@1x.png b/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@1x.png new file mode 100644 index 00000000..53f8216c Binary files /dev/null and b/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@2x.png b/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@2x.png new file mode 100644 index 00000000..f8ce585c Binary files /dev/null and b/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@3x.png b/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@3x.png new file mode 100644 index 00000000..8b6a0f25 Binary files /dev/null and b/UTM/Assets.xcassets/Printer Icon.imageset/printer-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Resume Icon.imageset/Contents.json b/UTM/Assets.xcassets/Resume Icon.imageset/Contents.json new file mode 100644 index 00000000..4e6f96df --- /dev/null +++ b/UTM/Assets.xcassets/Resume Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "pauseandresume@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "pauseandresume@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "pauseandresume@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@1x.png b/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@1x.png new file mode 100644 index 00000000..bd9e4433 Binary files /dev/null and b/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@1x.png differ diff --git a/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@2x.png b/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@2x.png new file mode 100644 index 00000000..ddcfdc4f Binary files /dev/null and b/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@2x.png differ diff --git a/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@3x.png b/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@3x.png new file mode 100644 index 00000000..9fdabd20 Binary files /dev/null and b/UTM/Assets.xcassets/Resume Icon.imageset/pauseandresume@3x.png differ diff --git a/UTM/Assets.xcassets/Share Icon.imageset/Contents.json b/UTM/Assets.xcassets/Share Icon.imageset/Contents.json new file mode 100644 index 00000000..3b6bf93a --- /dev/null +++ b/UTM/Assets.xcassets/Share Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "share-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "share-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "share-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Share Icon.imageset/share-icon@1x.png b/UTM/Assets.xcassets/Share Icon.imageset/share-icon@1x.png new file mode 100644 index 00000000..a20e7606 Binary files /dev/null and b/UTM/Assets.xcassets/Share Icon.imageset/share-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Share Icon.imageset/share-icon@2x.png b/UTM/Assets.xcassets/Share Icon.imageset/share-icon@2x.png new file mode 100644 index 00000000..dffa4d1d Binary files /dev/null and b/UTM/Assets.xcassets/Share Icon.imageset/share-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Share Icon.imageset/share-icon@3x.png b/UTM/Assets.xcassets/Share Icon.imageset/share-icon@3x.png new file mode 100644 index 00000000..477e1efc Binary files /dev/null and b/UTM/Assets.xcassets/Share Icon.imageset/share-icon@3x.png differ diff --git a/UTM/Assets.xcassets/Sound Icon.imageset/Contents.json b/UTM/Assets.xcassets/Sound Icon.imageset/Contents.json new file mode 100644 index 00000000..6897b8be --- /dev/null +++ b/UTM/Assets.xcassets/Sound Icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "sound-icon@1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "sound-icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "sound-icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@1x.png b/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@1x.png new file mode 100644 index 00000000..95a7f097 Binary files /dev/null and b/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@1x.png differ diff --git a/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@2x.png b/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@2x.png new file mode 100644 index 00000000..d3649d60 Binary files /dev/null and b/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@2x.png differ diff --git a/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@3x.png b/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@3x.png new file mode 100644 index 00000000..c4910f6f Binary files /dev/null and b/UTM/Assets.xcassets/Sound Icon.imageset/sound-icon@3x.png differ diff --git a/UTM/Base.lproj/LaunchScreen.storyboard b/UTM/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000..bfa36129 --- /dev/null +++ b/UTM/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UTM/Base.lproj/Main.storyboard b/UTM/Base.lproj/Main.storyboard new file mode 100644 index 00000000..1cdac3af --- /dev/null +++ b/UTM/Base.lproj/Main.storyboard @@ -0,0 +1,2176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Touchscreen: press anywhere on the screen to click there. Trackpad: move cursor by swipping on the screen and click with a tap. Right click with a two finger tap. + + + + + + + + + + + + + + + + + + + + + + + + + + + Direct: input sent to emulator directly. Can appear to be out of sync with display. Server: input sent to display server. Can have more latency but appear more responsive. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UTM/Info.plist b/UTM/Info.plist new file mode 100644 index 00000000..d4859016 --- /dev/null +++ b/UTM/Info.plist @@ -0,0 +1,88 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDocumentTypes + + + CFBundleTypeIconFiles + + CFBundleTypeName + UTM virtual machine + CFBundleTypeRole + Editor + LSHandlerRank + Owner + LSItemContentTypes + + com.halts.utm + + + + + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UTExportedTypeDeclarations + + + UTTypeConformsTo + + com.apple.package + + UTTypeDescription + UTM virtual machine + UTTypeIconFiles + + UTTypeIdentifier + com.halts.utm + UTTypeTagSpecification + + public.filename-extension + + utm + + + + + + UISupportsDocumentBrowser + + + diff --git a/UTM/main.m b/UTM/main.m new file mode 100644 index 00000000..259a2688 --- /dev/null +++ b/UTM/main.m @@ -0,0 +1,24 @@ +// +// Copyright © 2019 Halts. 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 +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/Views/VMListViewCell.h b/Views/VMListViewCell.h new file mode 100644 index 00000000..dcd824a0 --- /dev/null +++ b/Views/VMListViewCell.h @@ -0,0 +1,50 @@ +// +// Copyright © 2019 Halts. 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 + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, VMState) { + kStopped, + kStarting, + kStarted, + kPausing, + kPaused, + kResuming, + kResumed, + kStopping +}; + +@interface VMListViewCell : UICollectionViewCell + +@property (weak, nonatomic) IBOutlet UILabel *nameLabel; +@property (weak, nonatomic) IBOutlet UIVisualEffectView *screenBlurEffect; +@property (weak, nonatomic) IBOutlet UIButton *playButton; +@property (weak, nonatomic) IBOutlet UIButton *screenButton; +@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *statusIndicator; +@property (weak, nonatomic) IBOutlet UIButton *editButton; + +- (void)changeState:(VMState)state withScreen:(nullable UIImage *)image; +- (void)changeState:(VMState)state; +- (void)setName:(NSString *)name; +- (IBAction)playButtonAction:(id)sender; +- (IBAction)screenButtonAction:(id)sender; +- (IBAction)editAction:(id)sender; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Views/VMListViewCell.m b/Views/VMListViewCell.m new file mode 100644 index 00000000..2c4c581c --- /dev/null +++ b/Views/VMListViewCell.m @@ -0,0 +1,76 @@ +// +// Copyright © 2019 Halts. 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 "VMListViewCell.h" + +@implementation VMListViewCell + +- (void)changeState:(VMState)state withScreen:(nullable UIImage *)image { + [[self screenButton] setImage:image forState:UIControlStateNormal]; + switch (state) { + case kStopped: + default: { + [[self statusIndicator] stopAnimating]; + [[self screenBlurEffect] setHidden:NO]; + [[self playButton] setImage:[UIImage imageNamed:@"Play Icon"] forState:UIControlStateNormal]; + break; + } + case kStarting: + case kPausing: + case kResuming: + case kStopping: { + [[self screenBlurEffect] setHidden:NO]; + [[self statusIndicator] startAnimating]; + [[self playButton] setImage:nil forState:UIControlStateNormal]; + break; + } + case kStarted: + case kResumed: { + [[self screenBlurEffect] setHidden:YES]; + [[self statusIndicator] stopAnimating]; + [[self playButton] setImage:nil forState:UIControlStateNormal]; + break; + } + case kPaused: { + [[self statusIndicator] stopAnimating]; + [[self screenBlurEffect] setHidden:NO]; + [[self playButton] setImage:[UIImage imageNamed:@"Resume Icon"] forState:UIControlStateNormal]; + break; + } + } +} + +- (void)changeState:(VMState)state { + [self changeState:state withScreen:nil]; +} + +- (void)setName:(NSString *)name { + [[self nameLabel] setText:name]; +} + +- (IBAction)playButtonAction:(id)sender { + NSLog(@"button clicked!\n"); +} + +- (IBAction)screenButtonAction:(id)sender { + NSLog(@"button 2 clicked!\n"); +} + +- (IBAction)editAction:(id)sender { + NSLog(@"edit clicked!\n"); +} + +@end diff --git a/Views/VMListViewController.h b/Views/VMListViewController.h new file mode 100644 index 00000000..4bca8a55 --- /dev/null +++ b/Views/VMListViewController.h @@ -0,0 +1,28 @@ +// +// Copyright © 2019 Halts. 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 + +NS_ASSUME_NONNULL_BEGIN + +@interface VMListViewController : UICollectionViewController + +@property (strong, nonatomic) IBOutlet UICollectionView *vmCollection; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/Views/VMListViewController.m b/Views/VMListViewController.m new file mode 100644 index 00000000..cf946745 --- /dev/null +++ b/Views/VMListViewController.m @@ -0,0 +1,127 @@ +// +// Copyright © 2019 Halts. 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 "VMListViewController.h" +#import "VMListViewCell.h" +#import "UTMConfigurationDelegate.h" +#import "UTMConfiguration.h" + +@interface VMListViewController () + +@end + +@implementation VMListViewController + +static NSString * const reuseIdentifier = @"vmListCell"; + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations + // self.clearsSelectionOnViewWillAppear = NO; + + // Do any additional setup after loading the view. + [[self vmCollection] setDragInteractionEnabled:YES]; +} + +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + if([segue.identifier isEqualToString:@"editVMConfig"]){ + UINavigationController *navController = (UINavigationController *)segue.destinationViewController; + id controller = (id)navController.topViewController; + controller.configuration = [[UTMConfiguration alloc] initWithDefaults]; + } +} + +#pragma mark + +- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { +#warning Incomplete implementation, return the number of sections + return 1; +} + + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of items + return 5; +} + +VMListViewCell *test_cell; +VMState test_state; + +- (VMListViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + VMListViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; + + // Configure the cell + [cell setName:@"Test VM"]; + [cell changeState:kStopped]; + test_state = kStopped; + test_cell = cell; + + return cell; +} + +#pragma mark + +/* + // Uncomment this method to specify if the specified item should be highlighted during tracking + - (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath { + return YES; + } +*/ + +/* + // Uncomment this method to specify if the specified item should be selected + - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath { + return YES; + } +*/ + +/* + // Uncomment these methods to specify if an action menu should be displayed for the specified item, and react to actions performed on the item + - (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath { + return NO; + } + + - (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { + return NO; + } + + - (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender { + + } + */ + +- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(nonnull NSIndexPath *)indexPath { + return YES; +} + +#pragma mark + +- (nonnull NSArray *)collectionView:(nonnull UICollectionView *)collectionView itemsForBeginningDragSession:(nonnull id)session atIndexPath:(nonnull NSIndexPath *)indexPath { + NSItemProvider *provider = [[NSItemProvider alloc] init]; + UIDragItem *drag = [[UIDragItem alloc] initWithItemProvider:provider]; + return @[drag]; +} + +#pragma mark + +- (void)collectionView:(nonnull UICollectionView *)collectionView performDropWithCoordinator:(nonnull id)coordinator { +} + +@end