To create a plugin preference pane, you need to add some entries to the Info.plist file and create a subclass of QSPreferencePane.
Info.plist entries
The following needs to be added to the QSRegistration key in the Info.plist file of your plugin (there may be other entries in addition to this):
<key>QSRegistration</key> <dict> ... <key>QSPreferencePanes</key> <dict> <key>PREFPANECLASSNAME</key> <dict> <key>class</key> <string>PREFPANECLASSNAME</string> <key>description</key> <string>PREFPANEDESCRIPTION</string> <key>icon</key> <string></string> <key>name</key> <string>PREFPANENAME</string> </dict> </dict> </dict>
Implementing the preference pane subclass
A subclass of QSPreferencePane needs to be created (named 'PREFPANECLASSNAME', like in the Info.plist file).
The header of the preference pane class may look like this:
#import <QSInterface/QSPreferencePane.h> @interface PREFPANECLASSNAME : QSPreferencePane { } @end
The implementation (.m) file just needs to return the name of the .nib (minus the ”.nib” extension) corresponding to this class (may or may not be different to PREFPANECLASSNAME, depending on your style):
#import "PREFPANECLASSNAME.h" @implementation PREFPANECLASSNAME -(NSString *) mainNibName { return @"PREFPANENIBNAME"; } @end
Creating the preference pane Nib
A new Nib has to be created containing a window. “File's Owner” should be set to PREFPANECLASSNAME. In order to do this, perform the following:
- Drag the QSPreferencePane.h file into the Nib window
- Drag the PREFPANECLASSNAME.h file into the Nib window
- Click on “File's Owner” in the Nib “Instances” tab
- In the “Inspector” window, select “Custom Class” from the drop-down menu at the top
- Select PREFPANECLASSNAME
The window also needs to be connected to the “_window” outlet of the “File's Owner”.
Finally, customise the window as you see fit.