Jump to content

Quicklook For Windows


Recommended Posts

Hi everybody.

I'm begining developing the Quicklook for windows. Here it's my ideas for design, for available controls for plugins' developers.

On the picture (attach was painted by me :)) you can find following controls/places:

1. Image control - you will be able to add any picture from file's path/HICON/memory/may something else.

2. Text control - just setup text's size, style, color, alignments and etc.

3. The client area, where your (plugin's) controls will have a place.

4. Command button - just a button, I think it will be enough (for the first time) only change its text.

5. Radio/Check boxes - they are the same, but only one thing, radio controls that only one button can be checked.

6. Track bar - may create only two styles (large/small) or may make possible to control height, color of the background, size, gradient colors of the track button.

7. There are buttons you will be able to add your own buttons (but it would be another API, not like for client area, I will think about later).

Plugin - it's a simple .dll file (may rename extension). You write a plugin using Quicklook's API.

I'm going to implement following:

1. Controls, also create Video Player, Coverflow, Text viewer/editor...

2. You won't have to know anything about DirectShow, Gdiplus and so on, you will just set your properties for controls and simply run them.

3. Every control has its own ID (DWORD). Using this ID, you can get/set all properties using the same API. You just prepare a special structure and install neccessery flags (for properties) and call API.

After all, when the base will be written, I think only then we can create a new type of control - container. What does it mean ? You can create container (on client area), then receive its handle (HWND), and place your child windows there.

Here it's only what I know/think about for now.

If somebody wants to join me, just send me a private message or write to ICQ 240605815.

Thanks. Vladimir.

Quicklook API

Support Controls:

- Picture

- Button

- Text

Implementation of API:

/*
Quicklook API for Windows.
*/

#ifndef QUICKLOOKAPI_H
#define QUICKLOOKAPI_H

// version
#define QLVersion 0x0001 // 0.0.0.1

// defenitions
#define QLCallType __stdcall
#define QLVoid void
#define QLNull 0
#define QLUInt8 unsigned char
#define QLUInt16 unsigned short
#define QLUInt32 unsigned int
#define QLSInt8 signed char
#define QLSInt16 signed short
#define QLSInt32 signed int
#define QLBool QLUInt8
#define QLTrue 1
#define QLFalse 0
#define QLId QLUInt32
#define QLChar wchar_t
#define QLString QLChar*
#define QLCharLen 256
#define QLImage QLVoid*

// IMPORTANT: when you call a function which has argument QLString (QLChar*), you should allocate memory for it.
// Example: QLChar buffer[QLCharLen];

struct QLURect
{
QLUInt32 x;
QLUInt32 y;
QLUInt32 width;
QLUInt32 height;
};
typedef struct QLURect QLURect;


// supported controls
enum QLControl
{
QLControlNone = 0,
QLControlButton,
QLControlPicture,
QLControlText
};
typedef enum QLControl QLControl;


// controls' properties
enum QLControlPropery
{
QLPropertyNone = 0,
QLPropertyRect,
QLPropertyEnabled,
QLPropertyVisible,
QLPropertyText,
QLPropertyImage,
QLPropertyTextAlignment,
QLPropertyTextVAlignment,
QLPropertyFontSize,
QLPropertyFontColor,
QLPropertyFontStyle
};
typedef enum QLControlPropery QLControlPropery;


// text alignments
enum QLTextAlignment
{
QLTextAlignmentCenter = 0,
QLTextAlignmentNear,
QLTextAlignmentFar
};
typedef enum QLTextAlignment QLTextAlignment;


// font style
enum QLFontStyle
{
QLFontStyleNone = 0,
QLFontStyleBold,
QLFontStyleItalic,
QLFontStyleBoldItalic,
QLFontStyleStrikeout,
QLFontStyleUnderline
};
typedef enum QLFontStyle QLFontStyle;



// Plugin API
enum QLQueryInformationFlags
{
QLQueryPluginInfo = 1 << 0
};

struct QLQueryInformation
{
QLUInt32 flags;

// QLQueryPluginInfo
QLUInt16 version;
QLString description;
QLString extensions;
};
typedef struct QLQueryInformation QLQueryInformation;

enum QLContainerEvent
{
QLContainerEventNone = 0,
QLContainerEventCreate,
QLContainerEventDestroy,
QLContainerEventChangeArea,
QLContainerEventFullScreenOn,
QLContainerEventFullScreenOff,
};
typedef enum QLContainerEvent QLContainerEvent;

enum QLControlEvent
{
QLControlEventNone = 0,
QLControlEventLeftClick
};
typedef enum QLControlEvent QLControlEvent;


// processing errors
enum QLError
{
QLOkay = 0,
QLInternalError,
QLIncorrectParameters,
QLPropertyNotFound,
QLNotEnoughMemory,
QLNotSupportedImageFormat,
QLUnknown
};
typedef enum QLError QLError;

QLError QLCallType QLGetLastError();


// API Functions

// Quicklook Core
QLBool QLCallType QLImageCreate(QLImage *image); // create instance
QLVoid QLCallType QLImageDelete(QLImage image); // delete instance

QLBool QLCallType QLImageResize(QLImage image, QLUInt16 width, QLUInt16 height); // new size of the image
QLVoid QLCallType QLImageFree(QLImage image); // free data of image, but image's instance won't be deleted.

// get data
QLUInt16 QLCallType QLImageWidth(QLImage image); // width is in pixels
QLUInt16 QLCallType QLImageHeight(QLImage image); // height is in pixels

QLVoid* QLCallType QLImagePixels(QLImage image, QLUInt16 x, QLUInt16 y); // pointer to ARGB array

QLUInt32 QLCallType QLImageDC(QLImage image); // HDC
QLVoid* QLCallType QLImageBitmap(QLImage image); // Gdiplus::Bitmap

// functions
QLVoid QLCallType QLImageRotate180(QLImage image);
QLVoid QLCallType QLImageBlur(QLImage image, QLUInt16 destX, QLUInt16 destY, QLUInt16 destWidth, QLUInt16 destHeight,
QLUInt16 missX, QLUInt16 missY, QLUInt16 missWidth, QLUInt16 missHeight,
QLUInt16 alpha);

// load image
QLBool QLCallType QLImageSetImage(QLImage image, QLImage originalImage);
QLBool QLCallType QLImageSetBits(QLImage image, QLVoid *scan0, QLUInt8 bits, QLUInt16 width, QLUInt16 height);
QLBool QLCallType QLImageSetIcon(QLImage image, QLUInt32 icon); // HICON
QLBool QLCallType QLImageSetBitmap(QLImage image, QLVoid *bitmap); // Gdiplus::Bitmap
QLBool QLCallType QLImageSetFileName(QLImage image, QLString fileName);
QLBool QLCallType QLImageSetResourceFileName(QLImage image, QLString fileName, QLString resName); // load any image from resources
QLBool QLCallType QLImageSetResource(QLImage image, QLUInt32 module, QLString resName); // HMODULE

// Quicklook plugin's area
QLBool QLCallType QLGetArea(QLURect *rect);

QLBool QLCallType QLGetApplicationPath(QLString path);
QLBool QLCallType QLGetApplicationDataPath(QLString path);
QLBool QLCallType QLGetPluginPath(QLString path);

QLBool QLCallType QLGetFileName(QLString path);
QLBool QLCallType QLGetPIDL(QLVoid **pIdl);

// Quicklook Controls
QLId QLCallType QLControlCreate(QLControl control);
QLBool QLCallType QLControlDelete(QLId id);

QLBool QLCallType QLControlMove(QLId id, QLUInt32 x, QLUInt32 y);
QLBool QLCallType QLControlSize(QLId id, QLUInt32 width, QLUInt32 height);

QLBool QLCallType QLControlSetProperty(QLId id, QLControlPropery prop, QLVoid *value);
QLBool QLCallType QLControlGetProperty(QLId id, QLControlPropery prop, QLVoid *value);

#endif /* QUICKLOOKAPI_H */

post-87061-1256282006_thumb.png

Link to comment

:) Here it's a what API I prepared to make. May somebody can look at it and say what he thinks about it.

Thanks.

Edit:

Please, help me decide what API we will use from QuickLook. Look at Quicklook plugin's area & Quicklook controls

Edit:

Guys, why do I ask you about API now ? Because I do not want to re-write API/code in future, when application will be ready and you do not like something in it. I hope you understand me.

Edit:

HI there :) Here it's first test. Now I've made API (still think about new functions) and simple image-viewer plugin. Below you can find how it's easy to create a such plugin for Quicklook :) Just try to drag&drop some image from your computer into Quicklook area.

#include <windows.h>
#include "QuicklookApi.h"

BOOL WINAPI DllMain(__in HINSTANCE hinstDLL, __in DWORD fdwReason, __in LPVOID lpvReserved)
{
return TRUE;
}

// Notes: if you do not want to use some functions, you can just ignore them and do not implement at all.
// IMPORTANT: declaration QLPQueryInformation must exists, if not, Quicklook won't find your plugin.

// Call, when Quicklook has to know what plugin is for.
QLVoid QLCallType QLPQueryInformation(QLQueryInformation *info)
{
if(info->flags & QLQueryPluginInfo)
{
info->version = 0x0001; // 0.0.0.1
wcscpy_s(info->description, QLCharLen, L"Image viewer by Lichonos Vladimir.");
wcscpy_s(info->extensions, QLCharLen, L".jpg,.jpeg,.bmp,.png,.gif,.tiff,.ico");
}
}

// Plugin's data, you can implement here whatever you want.
struct QLPData
{
QLId picture;
};
typedef struct QLPData QLPdata;

// Call, when Quicklook run the plugin (after QLPQueryInformation).
// Only here you can prepeare/allocate your own data to get access to it in future using qlData.
QLBool QLCallType QLPStart(QLPData **qlData)
{
*qlData = new QLPData;

return QLTrue; // return QLFalse to not load your plugin, if something is wrong.
}

// Call, when Quicklook not need this plugin anymore. You should free your data here.
QLVoid QLCallType QLPShutdown(QLPdata *qlData)
{
delete qlData;
}

// Call, when Quicklook need to know or change something in the container.
QLVoid QLCallType QLPContainer(QLPData *qlData, QLContainerEvent qlEvent)
{
switch(qlEvent)
{
case QLContainerEventCreate:
{
// now you should create your controls

qlData->picture = QLControlCreate(QLControlPicture);

QLChar fileName[QLCharLen];
if(QLGetFileName(fileName) == QLTrue)
{
QLImage image;
if(QLImageCreate(&image) == QLTrue)
{
QLImageSetFileName(image, fileName);
QLControlSetProperty(qlData->picture, QLPropertyImage, image);
QLImageDelete(image);
}
}
}
break;

case QLContainerEventDestroy:
{
// now you must delete all your controls here

QLControlDelete(qlData->picture);
}
break;

case QLContainerEventChangeArea:
{
// now you should move/size controls, because Quicklook's area has been changed.

QLURect area;
if(QLGetArea(&area) == QLFalse)
{
// something is wrong, see QLGetLastError()
break;
}

QLControlSetProperty(qlData->picture, QLPropertyRect, &area); // set size of control to all client's area
}
break;
}
}

// Call, when Quicklook or user do with your controls.
QLBool QLCallType QLPControl(QLPData *qlData, QLId qlId, QLControlEvent qlEvent)
{
// for example, you can make a list of your controls (QLId)
// and now, find the item knowing qlId then process qlEvent

return QLFalse; // return this if you do not process this event
}

Link to comment

Hi Vladimir,

Tested in Windows7 RC and..what I can say..it's run fine. Open quickly, close same.

I dragged & dropped some images into quicklook area..and worked very nice too. ;)

For what you ask ...APIs, plugins that should be in the future version app what can I say..Hmmm...let's put the same features of original Quicklook ;) It will be great to have a such app on windoze.

If I have ideas until Monday I will tell you.

Anyway it's an another step of customization Windoze

Cya soon

Edited by Elevati0n
Link to comment

I'm back...

My Wish QuickLook Plugins List( inspirated from Mac Leopard QL):

1.SneakPeek Photo - simply click on the unopened photo file (no matter where it is, even on your card reader) and hit the space bar. Up pops the picture into a large view that immediately gives you the detailed information you need.

2.ImageFolderQLGenerator - creates thumbnails and previews for folders that contain image files. The thumbnails and previews it generates look like the normal folder icons, only with small thumbnails of some of the contained images overlaid on top. (Look at the bottom picture )

3.Source Code Viewer - provides preview of an syntax-highlighting for source code displayed in QuickLook.

That's it for now...

Edited by Elevati0n
Link to comment

Hey.

If we want something, we must create not only for one thing, we must think over a technologies :) I mean, for example, ImageFolderQLGenerator: first, we already have images api, then it's no need to create another api only for this, for example, create new plugin and you will know what path of the folder, you will have api to get any images from files and just paint your own image like on the picture, or even, like now in the snow leopard, install timer and generate animation :) So, I hope you understand me.

Edit:

Hey, I've upload a new one of Quicklook, made it faster I hope ;)

Link to comment
Yes, it is much quickly than last version.

Pity that I can't improve your code..for me is alien language. But I want to test the new versions. With buttons,info panels..etc :)

For now, API is not really ready to use for developers :) When I have a time I'm working on carefully, I do not want to hurry because then I will have got problems and the app won't be cool one. Anyway, when I'm ready to publish API you will know ;)

Link to comment

Example how to create/customize new control - Text and new API (attach is the old one).

// somewhere in the code
QLId qlData->text;

...

QLFontColor fontColor = 0xffffffff;
QLFontSize fontSize = 24.0f;
QLFontStyle fontStyle = QLFontStyleBold;
QLTextAlignment alignment = QLTextAlignmentCenter;
QLChar text[] = L"Fullscreen is disabled";

qlData->text = QLControlCreate(QLControlText);
QLControlSetProperty(qlData->text, QLPropertyFontColor, &fontColor);
QLControlSetProperty(qlData->text, QLPropertyFontSize, &fontSize);
QLControlSetProperty(qlData->text, QLPropertyFontStyle, &fontStyle);
QLControlSetProperty(qlData->text, QLPropertyTextAlignment, &alignment);
QLControlSetProperty(qlData->text, QLPropertyTextVAlignment, &alignment);
QLControlSetProperty(qlData->text, QLPropertyText, text);

Edit:

Updated API (look at the first post) and began a new topic for everyone here

Link to comment
  • 2 years later...

Hello all,

Browsing the web, I am looking for the implementation of a quicklook function in Windows. Your plugin (?) looks promising. Is it still under development? How does this work? Is this a standalone software? I didn't know aquasoft before and can't find explanation on the forum. Thank you!

Link to comment

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...