From e6e8f951cd9ab0cd3cd27ed11a7ac8efd7d965ef Mon Sep 17 00:00:00 2001 From: Diskyeth Date: Fri, 22 Aug 2025 16:14:54 +0200 Subject: [PATCH] Making it work on Mac OS 15.5 --- Font Converter/Controller/AppDelegate.hh | 3 ++- Font Converter/Controller/AppDelegate.mm | 11 +++++++++-- Font Converter/Controller/FileController.hh | 3 ++- .../Controller/PreferencesViewController.hh | 3 ++- Font Converter/Controller/ViewController.hh | 9 +++++---- Font Converter/Controller/ViewController.mm | 11 +++++++---- Font Converter/Controller/WindowController.hh | 1 + Font Converter/Model/ConvertedFont.hh | 7 ++++--- Font Converter/Model/Font.hh | 5 +++-- Font Converter/Model/Preferences.hh | 3 ++- Font Converter/Model/TableRow.hh | 3 ++- Font Converter/Model/WOFF2Converter.hh | 1 + Font Converter/Model/WOFFConverter.hh | 1 + Font Converter/Support/main.m | 1 + 14 files changed, 42 insertions(+), 20 deletions(-) diff --git a/Font Converter/Controller/AppDelegate.hh b/Font Converter/Controller/AppDelegate.hh index b07246a..8ffe053 100644 --- a/Font Converter/Controller/AppDelegate.hh +++ b/Font Converter/Controller/AppDelegate.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -24,7 +25,7 @@ @interface AppDelegate : NSObject -@property(retain) FileController *fileController; +@property(strong) FileController *fileController; - (void)openPaths:(NSArray *)paths; diff --git a/Font Converter/Controller/AppDelegate.mm b/Font Converter/Controller/AppDelegate.mm index d9a9115..30cc037 100644 --- a/Font Converter/Controller/AppDelegate.mm +++ b/Font Converter/Controller/AppDelegate.mm @@ -70,7 +70,14 @@ - (void)application:(NSApplication *)sender openFiles:(NSArray *)paths { // handles files received from Services menu - (void)handleService:(NSPasteboard *)pasteboard userData:(NSString *)userData error:(NSString **)error { - [self openPaths:[pasteboard propertyListForType:NSFilenamesPboardType]]; + NSArray *fileURLs = [pasteboard readObjectsForClasses:@[[NSURL class]] options:@{NSPasteboardURLReadingFileURLsOnlyKey: @YES}]; + NSMutableArray *filePaths = [NSMutableArray array]; + + for (NSURL *url in fileURLs) { + [filePaths addObject:[url path]]; + } + + [self openPaths:filePaths]; [NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; } @@ -84,4 +91,4 @@ - (void)openPaths:(NSArray *)paths { [self.fileController addFilesToQueue:files]; } -@end +@end \ No newline at end of file diff --git a/Font Converter/Controller/FileController.hh b/Font Converter/Controller/FileController.hh index 810160d..e7c1ca0 100644 --- a/Font Converter/Controller/FileController.hh +++ b/Font Converter/Controller/FileController.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN @interface FileController : NSObject -@property(retain) NSMutableArray *fonts; +@property(strong) NSMutableArray *fonts; - (void)addFilesToQueue:(NSArray *)files; - (void)addFontToQueue:(Font *)font row:(NSUInteger)row; diff --git a/Font Converter/Controller/PreferencesViewController.hh b/Font Converter/Controller/PreferencesViewController.hh index 9a862ff..05550bd 100644 --- a/Font Converter/Controller/PreferencesViewController.hh +++ b/Font Converter/Controller/PreferencesViewController.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN @interface PreferencesViewController : NSViewController -@property(retain) Preferences *preferences; +@property(strong) Preferences *preferences; @property(weak) IBOutlet NSPopUpButton *outputFormatPopUp; @property(weak) IBOutlet NSButtonCell *moveToTrashCheckbox; diff --git a/Font Converter/Controller/ViewController.hh b/Font Converter/Controller/ViewController.hh index 6801cf7..49c8700 100644 --- a/Font Converter/Controller/ViewController.hh +++ b/Font Converter/Controller/ViewController.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -26,10 +27,10 @@ @interface ViewController : NSViewController -@property(retain) FileController *fileController; -@property(retain) NSMutableArray *rows; -@property(nonatomic, retain) NSIndexSet *selectedIndexes; -@property(nonatomic, retain) NSArray *selectedItems; +@property(strong) FileController *fileController; +@property(strong) NSMutableArray *rows; +@property(nonatomic, strong) NSIndexSet *selectedIndexes; +@property(nonatomic, strong) NSArray *selectedItems; @property(weak) IBOutlet NSArrayController *arrayController; @property(weak) IBOutlet NSTableView *tableView; diff --git a/Font Converter/Controller/ViewController.mm b/Font Converter/Controller/ViewController.mm index a17222d..da61998 100644 --- a/Font Converter/Controller/ViewController.mm +++ b/Font Converter/Controller/ViewController.mm @@ -52,7 +52,7 @@ - (void)viewDidLoad { tableColumn.sortDescriptorPrototype = sortDescriptor; } - [self.tableView registerForDraggedTypes:@[NSFilenamesPboardType]]; + [self.tableView registerForDraggedTypes:@[NSPasteboardTypeFileURL]]; [self.tableView setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; self.tableView.allowsMultipleSelection = YES; } @@ -93,7 +93,10 @@ - (void)receiveNotification:(NSNotification *)notification { } - (void)processQueue { - for (Font *font in [self.fileController fonts]) { + // Create a snapshot of fonts to avoid race conditions + NSArray *fontsSnapshot = [[self.fileController fonts] copy]; + + for (Font *font in fontsSnapshot) { // processes queue items asynchronously dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ if ([font status] == kStatusIncomplete) { @@ -101,7 +104,7 @@ - (void)processQueue { } // reloads table data after processing done - dispatch_sync(dispatch_get_main_queue(), ^{ + dispatch_async(dispatch_get_main_queue(), ^{ [self reloadData]; [self validateToolbar]; }); @@ -339,4 +342,4 @@ - (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray *)s [tableView reloadData]; } -@end +@end \ No newline at end of file diff --git a/Font Converter/Controller/WindowController.hh b/Font Converter/Controller/WindowController.hh index 1e2e46f..5ba6be1 100644 --- a/Font Converter/Controller/WindowController.hh +++ b/Font Converter/Controller/WindowController.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with diff --git a/Font Converter/Model/ConvertedFont.hh b/Font Converter/Model/ConvertedFont.hh index 584ff0e..40065e4 100644 --- a/Font Converter/Model/ConvertedFont.hh +++ b/Font Converter/Model/ConvertedFont.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -25,10 +26,10 @@ NS_ASSUME_NONNULL_BEGIN @interface ConvertedFont : NSObject -@property(retain) NSURL *originalURL; -@property(retain) NSURL *convertedURL; +@property(strong) NSURL *originalURL; +@property(strong) NSURL *convertedURL; @property(assign) NSUInteger convertedSize; -@property(retain) NSData *contents; +@property(strong) NSData *contents; @property(assign) NSUInteger format; - (instancetype)initWithURL:(NSURL *)URL contents:(NSData *)contents format:(NSUInteger)format; diff --git a/Font Converter/Model/Font.hh b/Font Converter/Model/Font.hh index 72a455f..2d0288a 100644 --- a/Font Converter/Model/Font.hh +++ b/Font Converter/Model/Font.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -51,14 +52,14 @@ FOUNDATION_EXPORT NSArray *const kFileFormats; @interface Font : NSObject -@property(retain) NSURL *URL; +@property(strong) NSURL *URL; @property(assign) NSUInteger size; @property(assign) float ratio; @property(assign) NSUInteger format; @property(assign) NSUInteger status; @property(copy) NSString *familyName; @property(assign) NSUInteger traits; -@property(retain) NSMutableArray *products; +@property(strong) NSMutableArray *products; - (instancetype)initWithURL:(NSURL *)URL; - (BOOL)convertFormat; diff --git a/Font Converter/Model/Preferences.hh b/Font Converter/Model/Preferences.hh index ca86e7e..7f382f6 100644 --- a/Font Converter/Model/Preferences.hh +++ b/Font Converter/Model/Preferences.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN @interface Preferences : NSObject -@property(retain) NSUserDefaults *defaults; +@property(strong) NSUserDefaults *defaults; @property(assign) NSUInteger outputFormat; @property(assign) BOOL moveToTrash; @property(assign) BOOL useTabs; diff --git a/Font Converter/Model/TableRow.hh b/Font Converter/Model/TableRow.hh index 2e84dd9..d7a30b8 100644 --- a/Font Converter/Model/TableRow.hh +++ b/Font Converter/Model/TableRow.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with @@ -25,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN @interface TableRow : NSObject -@property(retain) Font *font; +@property(strong) Font *font; @property(weak, readonly) NSString *name; @property(assign, readonly) NSUInteger size; @property(weak, readonly) NSString *format; diff --git a/Font Converter/Model/WOFF2Converter.hh b/Font Converter/Model/WOFF2Converter.hh index da6b37a..fe01559 100644 --- a/Font Converter/Model/WOFF2Converter.hh +++ b/Font Converter/Model/WOFF2Converter.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with diff --git a/Font Converter/Model/WOFFConverter.hh b/Font Converter/Model/WOFFConverter.hh index 291b635..3b2f484 100644 --- a/Font Converter/Model/WOFFConverter.hh +++ b/Font Converter/Model/WOFFConverter.hh @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with diff --git a/Font Converter/Support/main.m b/Font Converter/Support/main.m index 6d93948..b7b880f 100644 --- a/Font Converter/Support/main.m +++ b/Font Converter/Support/main.m @@ -1,5 +1,6 @@ /* * Copyright (C) 2020 J.C. Fields (jcfields@jcfields.dev). + * Updated Augsut 2025 by Disky_eth (https://github.com/Diskyeth) * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with