Abandoned: macOS: support QuickLook preview #107014
|
@ -68,7 +68,7 @@ if(APPLE)
|
|||
|
||||
set(SRC_CMD
|
||||
src/ThumbnailProvider.mm
|
||||
src/ThumbnailProvider.h
|
||||
src/ThumbnailProvider.hh
|
||||
src/Info.plist
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
lsregister and its listing and detection
|
||||
|
||||
more logs in lldb
|
||||
|
||||
more logs in console: look for anything qlmanage
|
||||
|
||||
must sign the appex bundle with sandbox
|
||||
|
||||
must launch the app
|
||||
|
||||
appex cannot write at all : inferred from
|
||||
|
||||
error 17:53:57.863578+0530 kernel Sandbox: qlmanage(37213) deny(1) file-write-data /dev/dtracehelper
|
||||
error 17:53:58.033957+0530 kernel Sandbox: qlmanage(37213) deny(1) mach-register com.apple.axserver (per-pid)
|
||||
error 17:53:58.071424+0530 kernel Sandbox: qlmanage(37213) deny(1) mach-register com.apple.tsm.portname (per-pid)
|
||||
error 17:53:58.164827+0530 kernel Sandbox: qlmanage(37213) deny(1) user-preference-read com.apple.HIToolbox
|
||||
error 17:54:00.837220+0530 kernel Sandbox: qlmanage(37213) deny(1) file-write-data /dev/dtracehelper
|
||||
error 17:54:00.904484+0530 kernel Sandbox: qlmanage(37213) deny(1) file-write-create /Users/ankitkumar/Library/Saved Application State/com.apple.quicklook.qlmanage.savedState
|
||||
|
||||
https://eclecticlight.co/2018/04/05/inside-quicklook-previews-with-qlmanage/
|
|
@ -1,4 +1,4 @@
|
|||
#include <AppKit/AppKit.h>
|
||||
#pragma once
|
||||
|
||||
#import <Quartz/Quartz.h>
|
||||
#import <QuickLookThumbnailing/QuickLookThumbnailing.h>
|
||||
|
@ -9,8 +9,4 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@end
|
||||
|
||||
@interface PreviewViewController : NSViewController <QLPreviewingController>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -6,7 +6,7 @@
|
|||
#import <QuickLook/QLBase.h>
|
||||
#import <QuickLook/QuickLook.h>
|
||||
|
||||
#import "ThumbnailProvider.h"
|
||||
#import "ThumbnailProvider.hh"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_filereader.h"
|
||||
|
@ -71,7 +71,6 @@ static eThumbStatus creator_impl(const char *src_blend_path)
|
|||
// the Info.plist of the
|
||||
// extension.
|
||||
|
||||
std::cout << "Hello World from blender Blender thumbnailer" << std::endl;
|
||||
NSLog(@"hello world from blender");
|
||||
NSURL *foo = [[NSURL alloc]
|
||||
initFileURLWithFileSystemRepresentation:"/Users/ankitkumar/Pictures/IMG_3158.JPG"
|
||||
|
@ -84,60 +83,3 @@ static eThumbStatus creator_impl(const char *src_blend_path)
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation PreviewViewController
|
||||
|
||||
- (NSString *)nibName
|
||||
{
|
||||
return @"PreviewViewController";
|
||||
}
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
/*
|
||||
* Implement this method and set QLSupportsSearchableItems to YES in the Info.plist of the
|
||||
extension if you support CoreSpotlight.
|
||||
*
|
||||
- (void)preparePreviewOfSearchableItemWithIdentifier:(NSString *)identifier queryString:(NSString
|
||||
*)queryString completionHandler:(void (^)(NSError * _Nullable))handler {
|
||||
|
||||
// Perform any setup necessary in order to prepare the view.
|
||||
|
||||
// Call the completion handler so Quick Look knows that the preview is fully loaded.
|
||||
// Quick Look will display a loading spinner while the completion handler is not called.
|
||||
|
||||
handler(nil);
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)preparePreviewOfFileAtURL:(NSURL *)url
|
||||
completionHandler:(void (^)(NSError *_Nullable))handler
|
||||
{
|
||||
|
||||
// Add the supported content types to the QLSupportedContentTypes array in the Info.plist of the
|
||||
// extension.
|
||||
|
||||
// Perform any setup necessary in order to prepare the view.
|
||||
|
||||
// Call the completion handler so Quick Look knows that the preview is fully loaded.
|
||||
// Quick Look will display a loading spinner while the completion handler is not called.
|
||||
|
||||
NSLog(@"blender preparePreviewOfFileAtURL: %@", url);
|
||||
std::ofstream file("/Users/ankitkumar/blender-build/build_darwin_debug_lite/foobar.txt",
|
||||
std::ios::out | std::ios::trunc | std::ios::binary);
|
||||
file << "Hello World";
|
||||
file.close();
|
||||
std::cout << "Hello World" << std::endl;
|
||||
// set image to file path /Users/ankit.kumar/Desktop/Screenshot 2021-09-02 at 1.59.47 PM.png
|
||||
[[[self view] imageRepresentation]
|
||||
setFileURL:[NSURL fileURLWithPath:@"/Users/ankitkumar/Pictures/IMG_3158.JPG"
|
||||
isDirectory:NO]];
|
||||
[[self view] display];
|
||||
handler(nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -1356,10 +1356,11 @@ elseif(APPLE)
|
|||
)
|
||||
get_target_property(BL_CODESIGN_ENTITLEMENTS blender-thumbnailer BL_CODESIGN_ENTITLEMENTS)
|
||||
install(CODE
|
||||
"message(STATUS \"Codesigning thumbnailer with entitlements: ${BL_CODESIGN_ENTITLEMENTS}\")")
|
||||
install(CODE
|
||||
"execute_process(
|
||||
COMMAND codesign --entitlements \"${BL_CODESIGN_ENTITLEMENTS}\" --force --deep --sign - \"${EXECUTABLE_OUTPUT_PATH}/Blender.app/Contents/Plugins/blender-thumbnailer.appex\"
|
||||
COMMAND codesign
|
||||
--entitlements \"${BL_CODESIGN_ENTITLEMENTS}\"
|
||||
--force --deep --sign -
|
||||
\"${EXECUTABLE_OUTPUT_PATH}/Blender.app/Contents/Plugins/blender-thumbnailer.appex\"
|
||||
)")
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Reference in New Issue