Skip to content

Commit

Permalink
Merge branch 'main' into l10n-patch
Browse files Browse the repository at this point in the history
  • Loading branch information
osy authored Aug 30, 2022
2 parents 86ae99c + 27cfdad commit fb118d5
Show file tree
Hide file tree
Showing 75 changed files with 4,050 additions and 1,516 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ jobs:
run: |
[[ "$(xcode-select -p)" == "${{ env.BUILD_XCODE_PATH }}"* ]] || sudo xcode-select -s "${{ env.BUILD_XCODE_PATH }}"
- name: Cache Sysroot
if: github.event.inputs.rebuild_sysroot != 'true'
id: cache-sysroot
uses: actions/cache@v3
with:
Expand All @@ -61,17 +60,15 @@ jobs:
run: |
echo "/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin" >> $GITHUB_PATH
- name: Install Requirements
if: steps.cache-sysroot.outputs.cache-hit != 'true' && env.INSTALL_REQUIREMENTS == 'true'
if: (steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true') && env.INSTALL_REQUIREMENTS == 'true'
run: |
brew uninstall cmake
brew install bison pkg-config gettext glib-utils libgpg-error nasm make meson
pip3 install --user six pyparsing
rm -f /usr/local/lib/pkgconfig/*.pc
- name: Build Sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true'
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event.inputs.rebuild_sysroot == 'true'
run: ./scripts/build_dependencies.sh -p ${{ matrix.platform }} -a ${{ matrix.arch }}
env:
NCPU: ${{ matrix.platform == 'ios-tci' && '1' || '0' }} # limit 1 CPU for TCI build due to memory issues, 0 = unlimited for other builds
- name: Compress Sysroot
if: steps.cache-sysroot.outputs.cache-hit != 'true' || github.event_name == 'release' || github.event.inputs.test_release == 'true'
run: tar -acf sysroot.tgz sysroot*
Expand All @@ -89,7 +86,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Sysroot (Universal Mac)
if: github.event.inputs.rebuild_sysroot != 'true'
id: cache-sysroot-universal
uses: actions/cache@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@

NS_ASSUME_NONNULL_BEGIN

@interface UTMViewState : NSObject
@interface UTMLegacyViewState : NSObject

@property (nonatomic, weak, readonly) NSDictionary *dictRepresentation;

@property (nonatomic, assign) double displayScale;
@property (nonatomic, assign) double displayOriginX;
@property (nonatomic, assign) double displayOriginY;
@property (nonatomic, assign) BOOL hasSaveState;
@property (nonatomic, copy, nullable) NSData *sharedDirectory;
@property (nonatomic, copy, nullable) NSString *sharedDirectoryPath;
@property (nonatomic, copy, nullable) NSData *shortcutBookmark;
@property (nonatomic, copy, nullable) NSString *shortcutBookmarkPath;

- (instancetype)init NS_DESIGNATED_INITIALIZER;
@property (nonatomic, readonly) CGFloat displayScale;
@property (nonatomic, readonly) CGFloat displayOriginX;
@property (nonatomic, readonly) CGFloat displayOriginY;
@property (nonatomic, readonly) BOOL isKeyboardShown;
@property (nonatomic, readonly) BOOL isToolbarShown;
@property (nonatomic, readonly) BOOL hasSaveState;
@property (nonatomic, readonly, nullable) NSData *sharedDirectory;
@property (nonatomic, readonly, nullable) NSString *sharedDirectoryPath;
@property (nonatomic, readonly, nullable) NSData *shortcutBookmark;
@property (nonatomic, readonly, nullable) NSString *shortcutBookmarkPath;

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithDictionary:(NSDictionary *)dictionary NS_DESIGNATED_INITIALIZER;

- (void)setBookmark:(NSData *)bookmark path:(NSString *)path forRemovableDrive:(NSString *)drive persistent:(BOOL)persistent;
- (void)removeBookmarkForRemovableDrive:(NSString *)drive;
- (nullable NSData *)bookmarkForRemovableDrive:(NSString *)drive persistent:(out BOOL *)persistent;
- (NSArray<NSString *> *)allDrives;
- (nullable NSData *)bookmarkForRemovableDrive:(NSString *)drive;
- (nullable NSString *)pathForRemovableDrive:(NSString *)drive;

@end
Expand Down
118 changes: 118 additions & 0 deletions Configuration/Legacy/UTMLegacyViewState.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//
// Copyright © 2020 osy. 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 "UTMLegacyViewState.h"

const NSString *const kUTMViewStateDisplayScaleKey = @"DisplayScale";
const NSString *const kUTMViewStateDisplayOriginXKey = @"DisplayOriginX";
const NSString *const kUTMViewStateDisplayOriginYKey = @"DisplayOriginY";
const NSString *const kUTMViewStateShowToolbarKey = @"ShowToolbar";
const NSString *const kUTMViewStateShowKeyboardKey = @"ShowKeyboard";
const NSString *const kUTMViewStateSuspendedKey = @"Suspended";
const NSString *const kUTMViewStateSharedDirectoryKey = @"SharedDirectory";
const NSString *const kUTMViewStateSharedDirectoryPathKey = @"SharedDirectoryPath";
const NSString *const kUTMViewStateShortcutBookmarkKey = @"ShortcutBookmark";
const NSString *const kUTMViewStateShortcutBookmarkPathKey = @"ShortcutBookmarkPath";
const NSString *const kUTMViewStateRemovableDrivesKey = @"RemovableDrives";
const NSString *const kUTMViewStateRemovableDrivesPathKey = @"RemovableDrivesPath";

@implementation UTMLegacyViewState {
NSMutableDictionary *_rootDict;
NSMutableDictionary<NSString *, NSData *> *_removableDrives;
NSMutableDictionary<NSString *, NSString *> *_removableDrivesPath;
}

#pragma mark - Properties

- (NSDictionary *)dictRepresentation {
return (NSDictionary *)_rootDict;
}

- (CGFloat)displayScale {
return [_rootDict[kUTMViewStateDisplayScaleKey] floatValue];
}

- (CGFloat)displayOriginX {
return [_rootDict[kUTMViewStateDisplayOriginXKey] floatValue];
}

- (CGFloat)displayOriginY {
return [_rootDict[kUTMViewStateDisplayOriginYKey] floatValue];
}

- (BOOL)isKeyboardShown {
return [_rootDict[kUTMViewStateShowToolbarKey] boolValue];
}

- (BOOL)isToolbarShown {
return [_rootDict[kUTMViewStateShowToolbarKey] boolValue];
}

- (BOOL)hasSaveState {
return [_rootDict[kUTMViewStateSuspendedKey] boolValue];
}

- (NSData *)sharedDirectory {
return _rootDict[kUTMViewStateSharedDirectoryKey];
}

- (NSString *)sharedDirectoryPath {
return _rootDict[kUTMViewStateSharedDirectoryPathKey];
}

- (NSData *)shortcutBookmark {
return _rootDict[kUTMViewStateShortcutBookmarkKey];
}

- (NSString *)shortcutBookmarkPath {
return _rootDict[kUTMViewStateShortcutBookmarkPathKey];
}

#pragma mark - Removable drives

- (NSArray<NSString *> *)allDrives {
return [_removableDrives allKeys];
}

- (nullable NSData *)bookmarkForRemovableDrive:(NSString *)drive {
return _removableDrives[drive];
}

- (nullable NSString *)pathForRemovableDrive:(NSString *)drive {
return _removableDrivesPath[drive];
}

#pragma mark - Init

- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
self = [super init];
if (self) {
_rootDict = CFBridgingRelease(CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (__bridge CFDictionaryRef)dictionary, kCFPropertyListMutableContainers));
_removableDrives = _rootDict[kUTMViewStateRemovableDrivesKey];
_removableDrivesPath = _rootDict[kUTMViewStateRemovableDrivesPathKey];
if (!_removableDrives) {
_removableDrives = [NSMutableDictionary dictionary];
_rootDict[kUTMViewStateRemovableDrivesKey] = _removableDrives;
}
if (!_removableDrivesPath) {
_removableDrivesPath = [NSMutableDictionary dictionary];
_rootDict[kUTMViewStateRemovableDrivesPathKey] = _removableDrivesPath;
}
}
return self;
}

@end
4 changes: 2 additions & 2 deletions Configuration/QEMUConstant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ enum QEMUFileShareMode: String, CaseIterable, QEMUConstant {
var prettyValue: String {
switch self {
case .none: return NSLocalizedString("None", comment: "UTMQemuConstants")
case .webdav: return NSLocalizedString("SPICE WebDAV (Legacy)", comment: "UTMQemuConstants")
case .virtfs: return NSLocalizedString("VirtFS (Recommended)", comment: "UTMQemuConstants")
case .webdav: return NSLocalizedString("SPICE WebDAV", comment: "UTMQemuConstants")
case .virtfs: return NSLocalizedString("VirtFS", comment: "UTMQemuConstants")
}
}
}
Expand Down
Loading

0 comments on commit fb118d5

Please sign in to comment.