Skip to content

Commit

Permalink
new themes imgs
Browse files Browse the repository at this point in the history
  • Loading branch information
tattali committed Aug 3, 2020
1 parent 04dda83 commit 3863352
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 125 deletions.
4 changes: 2 additions & 2 deletions QuickLookAddict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 51;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -121,7 +121,7 @@
};
};
buildConfigurationList = 0CE3C7FB1E8ABFB8006BA7CB /* Build configuration list for PBXProject "QuickLookAddict" */;
compatibilityVersion = "Xcode 3.2";
compatibilityVersion = "Xcode 10.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
Expand Down
10 changes: 5 additions & 5 deletions QuickLookAddict/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleShortVersionString</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>CFBundleVersion</key>
<string>1.2.2</string>
<string>1.3.0</string>
<key>CFPlugInDynamicRegisterFunction</key>
<string></string>
<key>CFPlugInDynamicRegistration</key>
Expand All @@ -54,16 +54,16 @@
<key>CFPlugInUnloadFunction</key>
<string></string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017-2019 Théo Attali. All rights reserved.</string>
<string>Copyright © 2017-2020 Théo Attali. All rights reserved.</string>
<key>QLNeedsToBeRunInMainThread</key>
<true/>
<key>QLPreviewHeight</key>
<real>600</real>
<integer>600</integer>
<key>QLPreviewWidth</key>
<real>800</real>
<key>QLSupportsConcurrentRequests</key>
<true/>
<key>QLThumbnailMinimumSize</key>
<real>17</real>
<integer>17</integer>
</dict>
</plist>
220 changes: 105 additions & 115 deletions QuickLookAddict/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
//
//==============================================================================






#include <CoreFoundation/CoreFoundation.h>
#include <CoreFoundation/CFPlugInCOM.h>
#include <CoreFoundation/CoreFoundation.h>
#include <CoreServices/CoreServices.h>
#include <QuickLook/QuickLook.h>

Expand All @@ -31,25 +26,25 @@
// names if you decide to change the names defined in the Info.plist
//


// -----------------------------------------------------------------------------
// typedefs
// -----------------------------------------------------------------------------

// The thumbnail generation function to be implemented in GenerateThumbnailForURL.c
OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize);
void CancelThumbnailGeneration(void* thisInterface, QLThumbnailRequestRef thumbnail);
OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url,
CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize);
void CancelThumbnailGeneration(void *thisInterface, QLThumbnailRequestRef thumbnail);

// The preview generation function to be implemented in GeneratePreviewForURL.c
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options);
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url,
CFStringRef contentTypeUTI, CFDictionaryRef options);
void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview);

// The layout for an instance of QuickLookGeneratorPlugIn
typedef struct __QuickLookGeneratorPluginType
{
void *conduitInterface;
CFUUIDRef factoryID;
UInt32 refCount;
typedef struct __QuickLookGeneratorPluginType {
void *conduitInterface;
CFUUIDRef factoryID;
UInt32 refCount;
} QuickLookGeneratorPluginType;

// -----------------------------------------------------------------------------
Expand All @@ -58,29 +53,26 @@ typedef struct __QuickLookGeneratorPluginType
// Forward declaration for the IUnknown implementation.
//

QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID);
void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance);
HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv);
void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID);
ULONG QuickLookGeneratorPluginAddRef(void *thisInstance);
ULONG QuickLookGeneratorPluginRelease(void *thisInstance);
QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID);
void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance);
HRESULT QuickLookGeneratorQueryInterface(void *thisInstance, REFIID iid, LPVOID *ppv);
void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator, CFUUIDRef typeID);
ULONG QuickLookGeneratorPluginAddRef(void *thisInstance);
ULONG QuickLookGeneratorPluginRelease(void *thisInstance);

// -----------------------------------------------------------------------------
// myInterfaceFtbl definition
// -----------------------------------------------------------------------------
// The QLGeneratorInterfaceStruct function table.
//
static QLGeneratorInterfaceStruct myInterfaceFtbl = {
NULL,
QuickLookGeneratorQueryInterface,
QuickLookGeneratorPluginAddRef,
QuickLookGeneratorPluginRelease,
NULL,
NULL,
NULL,
NULL
};

static QLGeneratorInterfaceStruct myInterfaceFtbl = {NULL,
QuickLookGeneratorQueryInterface,
QuickLookGeneratorPluginAddRef,
QuickLookGeneratorPluginRelease,
NULL,
NULL,
NULL,
NULL};

// -----------------------------------------------------------------------------
// AllocQuickLookGeneratorPluginType
Expand All @@ -89,24 +81,23 @@ static QLGeneratorInterfaceStruct myInterfaceFtbl = {
// You can do some initial setup for the generator here if you wish
// like allocating globals etc...
//
QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID)
{
QuickLookGeneratorPluginType *theNewInstance;
QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFactoryID) {
QuickLookGeneratorPluginType *theNewInstance;

theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType));
memset(theNewInstance,0,sizeof(QuickLookGeneratorPluginType));
theNewInstance = (QuickLookGeneratorPluginType *)malloc(sizeof(QuickLookGeneratorPluginType));
memset(theNewInstance, 0, sizeof(QuickLookGeneratorPluginType));

/* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct));
memcpy(theNewInstance->conduitInterface,&myInterfaceFtbl,sizeof(QLGeneratorInterfaceStruct));
/* Point to the function table Malloc enough to store the stuff and copy the filler from myInterfaceFtbl over */
theNewInstance->conduitInterface = malloc(sizeof(QLGeneratorInterfaceStruct));
memcpy(theNewInstance->conduitInterface, &myInterfaceFtbl, sizeof(QLGeneratorInterfaceStruct));

/* Retain and keep an open instance refcount for each factory. */
theNewInstance->factoryID = CFRetain(inFactoryID);
CFPlugInAddInstanceForFactory(inFactoryID);
/* Retain and keep an open instance refcount for each factory. */
theNewInstance->factoryID = CFRetain(inFactoryID);
CFPlugInAddInstanceForFactory(inFactoryID);

/* This function returns the IUnknown interface so set the refCount to one. */
theNewInstance->refCount = 1;
return theNewInstance;
/* This function returns the IUnknown interface so set the refCount to one. */
theNewInstance->refCount = 1;
return theNewInstance;
}

// -----------------------------------------------------------------------------
Expand All @@ -117,52 +108,55 @@ QuickLookGeneratorPluginType *AllocQuickLookGeneratorPluginType(CFUUIDRef inFact
// In the current implementation generator interfaces are never deallocated
// but implement this as this might change in the future
//
void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance)
{
CFUUIDRef theFactoryID;

theFactoryID = thisInstance->factoryID;
/* Free the conduitInterface table up */
free(thisInstance->conduitInterface);

/* Free the instance structure */
free(thisInstance);
if (theFactoryID){
CFPlugInRemoveInstanceForFactory(theFactoryID);
CFRelease(theFactoryID);
}
void DeallocQuickLookGeneratorPluginType(QuickLookGeneratorPluginType *thisInstance) {
CFUUIDRef theFactoryID;

theFactoryID = thisInstance->factoryID;
/* Free the conduitInterface table up */
free(thisInstance->conduitInterface);

/* Free the instance structure */
free(thisInstance);
if (theFactoryID) {
CFPlugInRemoveInstanceForFactory(theFactoryID);
CFRelease(theFactoryID);
}
}

// -----------------------------------------------------------------------------
// QuickLookGeneratorQueryInterface
// -----------------------------------------------------------------------------
// Implementation of the IUnknown QueryInterface function.
//
HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *ppv)
{
CFUUIDRef interfaceID;

interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault,iid);

if (CFEqual(interfaceID,kQLGeneratorCallbacksInterfaceID)){
/* If the Right interface was requested, bump the ref count,
* set the ppv parameter equal to the instance, and
* return good status.
*/
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GenerateThumbnailForURL = GenerateThumbnailForURL;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelThumbnailGeneration = CancelThumbnailGeneration;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->GeneratePreviewForURL = GeneratePreviewForURL;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)->CancelPreviewGeneration = CancelPreviewGeneration;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType*)thisInstance)->conduitInterface)->AddRef(thisInstance);
*ppv = thisInstance;
CFRelease(interfaceID);
return S_OK;
}else{
/* Requested interface unknown, bail with error. */
*ppv = NULL;
CFRelease(interfaceID);
return E_NOINTERFACE;
}
HRESULT QuickLookGeneratorQueryInterface(void *thisInstance, REFIID iid, LPVOID *ppv) {
CFUUIDRef interfaceID;

interfaceID = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, iid);

if (CFEqual(interfaceID, kQLGeneratorCallbacksInterfaceID)) {
/* If the Right interface was requested, bump the ref count,
* set the ppv parameter equal to the instance, and
* return good status.
*/
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)
->GenerateThumbnailForURL = GenerateThumbnailForURL;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)
->CancelThumbnailGeneration = CancelThumbnailGeneration;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)
->GeneratePreviewForURL = GeneratePreviewForURL;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)
->CancelPreviewGeneration = CancelPreviewGeneration;
((QLGeneratorInterfaceStruct *)((QuickLookGeneratorPluginType *)thisInstance)->conduitInterface)
->AddRef(thisInstance);
*ppv = thisInstance;
CFRelease(interfaceID);
return S_OK;
} else {
/* Requested interface unknown, bail with error. */
*ppv = NULL;
CFRelease(interfaceID);
return E_NOINTERFACE;
}
}

// -----------------------------------------------------------------------------
Expand All @@ -172,10 +166,9 @@ HRESULT QuickLookGeneratorQueryInterface(void *thisInstance,REFIID iid,LPVOID *p
// is requested, bump the refCount for the instance. NOTE: returning the
// refcount is a convention but is not required so don't rely on it.
//
ULONG QuickLookGeneratorPluginAddRef(void *thisInstance)
{
((QuickLookGeneratorPluginType *)thisInstance )->refCount += 1;
return ((QuickLookGeneratorPluginType*) thisInstance)->refCount;
ULONG QuickLookGeneratorPluginAddRef(void *thisInstance) {
((QuickLookGeneratorPluginType *)thisInstance)->refCount += 1;
return ((QuickLookGeneratorPluginType *)thisInstance)->refCount;
}

// -----------------------------------------------------------------------------
Expand All @@ -184,35 +177,32 @@ ULONG QuickLookGeneratorPluginAddRef(void *thisInstance)
// When an interface is released, decrement the refCount.
// If the refCount goes to zero, deallocate the instance.
//
ULONG QuickLookGeneratorPluginRelease(void *thisInstance)
{
((QuickLookGeneratorPluginType*)thisInstance)->refCount -= 1;
if (((QuickLookGeneratorPluginType*)thisInstance)->refCount == 0){
DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType*)thisInstance );
return 0;
}else{
return ((QuickLookGeneratorPluginType*) thisInstance )->refCount;
}
ULONG QuickLookGeneratorPluginRelease(void *thisInstance) {
((QuickLookGeneratorPluginType *)thisInstance)->refCount -= 1;
if (((QuickLookGeneratorPluginType *)thisInstance)->refCount == 0) {
DeallocQuickLookGeneratorPluginType((QuickLookGeneratorPluginType *)thisInstance);
return 0;
} else {
return ((QuickLookGeneratorPluginType *)thisInstance)->refCount;
}
}

// -----------------------------------------------------------------------------
// QuickLookGeneratorPluginFactory
// -----------------------------------------------------------------------------
void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator,CFUUIDRef typeID)
{
QuickLookGeneratorPluginType *result;
CFUUIDRef uuid;

/* If correct type is being requested, allocate an
* instance of kQLGeneratorTypeID and return the IUnknown interface.
*/
if (CFEqual(typeID,kQLGeneratorTypeID)){
uuid = CFUUIDCreateFromString(kCFAllocatorDefault,CFSTR(PLUGIN_ID));
result = AllocQuickLookGeneratorPluginType(uuid);
CFRelease(uuid);
return result;
}
/* If the requested type is incorrect, return NULL. */
return NULL;
void *QuickLookGeneratorPluginFactory(CFAllocatorRef allocator, CFUUIDRef typeID) {
QuickLookGeneratorPluginType *result;
CFUUIDRef uuid;

/* If correct type is being requested, allocate an
* instance of kQLGeneratorTypeID and return the IUnknown interface.
*/
if (CFEqual(typeID, kQLGeneratorTypeID)) {
uuid = CFUUIDCreateFromString(kCFAllocatorDefault, CFSTR(PLUGIN_ID));
result = AllocQuickLookGeneratorPluginType(uuid);
CFRelease(uuid);
return result;
}
/* If the requested type is incorrect, return NULL. */
return NULL;
}

8 changes: 7 additions & 1 deletion QuickLookAddict/themes/farran.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ body {

/* table */
table {
background: #f9f9f9;
border-color: #272822;
}
table td {
border-color: #272822;
}
tbody tr:nth-child(odd) {
background-color: #f5f7fa;
}

tbody tr:nth-child(even) {
background-color: #e6e9ed;
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

A QuickLook plugin that lets you view subtitles `.srt` files

![qladdict](https://user-images.githubusercontent.com/10502887/29235459-4c4e6bce-7eff-11e7-8417-b8f9d3415b9d.png)
![qladdict](/assets/default.png)

## Installation

Expand Down
Binary file modified assets/addic7ed-grey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/addic7ed.png
Binary file not shown.
Binary file added assets/calvert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/dark-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/farran.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion available-themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults write com.sub.QLAddict theme NAME_OF_THEME
```

### addic7ed or default
![addic7ed](/assets/addic7ed.png)
![addic7ed](/assets/default.png)

### farran
![farran](/assets/farran.png)
Expand All @@ -17,3 +17,6 @@ defaults write com.sub.QLAddict theme NAME_OF_THEME

### dark-light
![dark-light](/assets/dark-light.png)

### calvert
![calvert](/assets/calvert.png)

0 comments on commit 3863352

Please sign in to comment.