Plug-In

Describes plug-ins and how to write it

Summary

Plug-In is a piece of program that add unique features to Folder Window via QTTabBar.
Most of them provide Command Buttons to Command Bar.
Currently several official plug-ins are released.

Writing plug-ins is open to the public. Everyone can write his/her own plug-ins with a little knowledge about programing in .net.

How to register plug-ins

Plug-ins are distributed in the form of dll files.
You can register to QTTabBar by dropping the dll file to the plug-in list in the Option Window.
Some dll files include multiple plug-ins in them.

Plug-ins page of Options Window

Option button to open option dialog of the plug-in if it has options.
Disable button sets the plug-in deactivated. Command buttons are removed from Command Bar if any.
Enable button sets the plug-in activated. You need to add Command Button to Command Bar by yourself, if it provides any.
Uninstall button unregisters all plug-ins that are provided by the dll file. (The dll file itself remains. You can delete it by yourself.)

Anyway, they don't take effect until "OK" or "Apply" button of Option Window is pressed.

Plug-in Classifications

Type Description Example of Official Plug-ins
Interactive Performs something when a Command Button is pressed in the Command Bar FileTools pack provides buttons to manipulate files and folders.
Background Triggered by some events in a folder window, performs something in background.
This type of plug-ins may not have Command Buttons.
Window Manager resizes and repositions a window when it is about to open.
Activate By Mouse Hover activates a tab listening mouse hover events.
Static Only one instance is created in the process and do something on request from QTTabBar.

To add Command Buttons that are provided by plug-ins to Command Bar

Open Command Bar page of Options Window. Available buttons are listed there if plug-ins are successfully registered.
Drag & drop them to Command Bars.

How to write your own plug-in

  1. Add a reference to QTPluginLib.dll. The file is included in the source codes.
    If you have installed QTTabBar, it is at \Windows\Microsoft.Net\assembly\GAC_MSIL\QTPluginLib\v4.0_1.0.0.0__78a0cde69b47ca25\
  2. Implement QTPlugin.IPluginClient interface
  3. Attach QTPlugin.PluginAttribute to the class
That's all.
Source codes of QTPluginLib.dll and other sample plug-ins will help you.
If you intend to distribute your plug-ins, keep the following guidelines in mind.

Naming plug-in

Every plug-in assembly should have an System.Reflection.AssemblyTitle attribute value.
Your namespace should be as unique as possible and an author should use a namespace consistently.

QTTabBar identifies and manages plug-ins using concatenation of the following strings as ID:

AssemblyTitleAttribute, AssemblyVersionAttribute, type fullname ("NAMESPACE.PLUGINCLASSNAME") and a full path to the dll file.

An assembly or a namespace can include multiple plug-in classes.

Images

QTTabBar searches images in the assembly resource that is named "NAMESPACE.Resource".
(usually, adding assembly resource will make a "Resource1.resx" so all you have to do is rename it to "Resource.resx".)

If image resources named "CLASSNAME_large" and "CLASSNAME_small" are found, QTTabBar use them as large and small icons of the plug-in.
For larger image support (Command Bar supports 256x256 pixel images. think about high DPI environments), implement IPluginItemWithImage interface and add "CLASSNAME_32", "CLASSNAME_48", "CLASSNAME_256" images.

Settings

A plug-in can save its settings to the registry key under:

HKEY_CURRENT_USER\Software\Quizo\QTTabBar\Plugins\Settings\KEYNAME

Recommended key name is "author name + GUID" or "Type.FullName + GUID".
(or simply, it could be author name or Type.FullName if they're unique enough...)

Uninstallation

If your plug-in saves settings somewhere, the class must have a method Uninstall() that removes all.

When a user decides to remove a plug-in in QTTabBar Options Window, QTTabBar calls uninstallation methods of all the types that implement IPluginClient interface in the plug-in assembly. This is done by using reflection. The method is requested to delete all settings that are saved for the user, including registry keys and other files if any.

public static void Uninstall(){...}

It needs to be public and static, return nothing, and accept no arguments.

Localization

Consider implementing a class that inherits LocalizedStringProvider class and pass the type of it to PluginAttribute constructor.

[Plugin( PluginType.Interactive, typeof( Localizer ), Version = "1.0.0.0" )]
public class SomePluginClass : IPluginClient
{
 ...
}

class Localizer : LocalizedStringProvider
{
 ...
}
					
LocalizedStringProvider enables to localize your plugin on execution time.