From b983a3ba5c878a1683ccd602c5647c56aade8b6a Mon Sep 17 00:00:00 2001 From: SweetPPro Date: Sun, 19 Jun 2022 08:00:16 +0200 Subject: [PATCH] macOS fix quicklook in the Torrent Inspector files view (#3321) --- macosx/InfoFileViewController.mm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/macosx/InfoFileViewController.mm b/macosx/InfoFileViewController.mm index c5f7fbdbf..508e93932 100644 --- a/macosx/InfoFileViewController.mm +++ b/macosx/InfoFileViewController.mm @@ -125,6 +125,32 @@ [self.fFileController uncheckAll]; } +- (void)keyDown:(NSEvent*)event +{ + unichar const firstChar = [event.charactersIgnoringModifiers characterAtIndex:0]; + + if (firstChar == ' ') + { + [self toggleQuickLook:nil]; + } + else + { + [super keyDown:event]; + } +} + +- (void)toggleQuickLook:(id)sender +{ + if ([QLPreviewPanel sharedPreviewPanel].visible) + { + [[QLPreviewPanel sharedPreviewPanel] orderOut:nil]; + } + else + { + [[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil]; + } +} + - (NSArray*)quickLookURLs { FileOutlineView* fileOutlineView = self.fFileController.outlineView;