Scribus
Open source desktop publishing at your fingertips
ScPersistentPlugin Class Referenceabstract

A plug-in that is resident for the lifetime of the app. More...

#include <scplugin.h>

Inheritance diagram for ScPersistentPlugin:
Collaboration diagram for ScPersistentPlugin:

Public Member Functions

 ScPersistentPlugin ()
 ctor More...
 
virtual ~ScPersistentPlugin ()=0
 Pure virtual dtor for abstract class.
 
virtual bool initPlugin ()=0
 Initialize the plugin. More...
 
virtual bool cleanupPlugin ()=0
 Deactivates the plugin for unloading / program quit. More...
 
- Public Member Functions inherited from ScPlugin
 ScPlugin ()
 ctor, returns a new ScPlugin instance More...
 
virtual ~ScPlugin ()=0
 Destroy the ScPlugin instance. More...
 
virtual const QString fullTrName () const =0
 Plug-in's human-readable, translated name. More...
 
virtual bool newPrefsPanelWidget (QWidget *parent, PrefsPanel *&panel, QString &caption, QPixmap &icon)
 Create and return a prefs UI panel for the plugin. More...
 
virtual bool newPrefsPanelWidget (QWidget *parent, Prefs_Pane *&panel, QString &caption, QPixmap &icon)
 
virtual const AboutDatagetAboutData () const =0
 Return descriptive information about the plug-in. More...
 
virtual void deleteAboutData (const AboutData *about) const =0
 
const QString & lastError () const
 Text summary of last error encountered. More...
 
bool hasLastError () const
 Returns if lastError message is not empty.
 
void clearLastError ()
 Clear last error message.
 
virtual void languageChange ()=0
 Update all user-visible text to reflect current UI language. More...
 
const QString pluginTypeName () const
 Returns human readable plugin type from plug-in's pluginType.
 
virtual void addToMainWindowMenu (ScribusMainWindow *)=0
 Allow plugins to add to a main menu.
 
virtual void setDoc (ScribusDoc *doc)
 hooks that plugins can use to detect if the current document was closed etc..
 
virtual void unsetDoc ()
 
virtual void changedDoc (ScribusDoc *doc)
 

Additional Inherited Members

- Protected Attributes inherited from ScPlugin
QString m_lastError
 Human readable, translated version of last error to occur.
 

Detailed Description

A plug-in that is resident for the lifetime of the app.

ScPersistentPlugin describes a plugin that is to be kept resident for the lifetime of the app (or until unloaded by a request to the plug-in manager). Persistent plugins are useful where the plugin author needs to retain state, needs more control of how they integrate with the Scribus user interface, and/or wants to perform tasks in the background.

Such plug-ins have an init method and a cleanup method; they have no "run" method as such. It is up to the plugin to determine how best to interfact with the user.

Constructor & Destructor Documentation

ScPersistentPlugin::ScPersistentPlugin ( )

ctor

See also
ScPlugin::ScPlugin()

Member Function Documentation

virtual bool ScPersistentPlugin::cleanupPlugin ( )
pure virtual

Deactivates the plugin for unloading / program quit.

This method will be called when the plug-in is about to be unloaded, or if the plug-in manager has been asked to disable the plug-in. This method will never be called unless initPlugin has been called first, but there is no guarantee the plugin will actually be unloaded after this is called, or before initPlugin is called again.

Returns
bool True for success.

Implemented in ScriptPlugin, ShapePlugin, and Scripter.

virtual bool ScPersistentPlugin::initPlugin ( )
pure virtual

Initialize the plugin.

This method must initialize the plugin. It is called at plug-in load time. This method will never be called twice without an intervening cleanupPlugin call, but there is no guarantee the plugin will actually be unloaded between initPlugin() and cleanupPlugin().

It will usually instantiate a class and store a pointer to the instance in a static variable of the plugin or a member of its ScPersistentPlugin subclass, letting that class do the work of setup and integration into the app.

Note that this is NOT the same as the init function of the plugin. That is always simple and lightweight, intended to just get an instance of this class back to the core app. This function is where any time-consuming or memory expensive init should be triggered, generally by the instantiation of the class that does the real work for the plugin.

If this method returns failure, the plugin will be treated as dead and cleanupPlug() will not be called.

Returns
bool True for success.

Implemented in ScriptPlugin, ShapePlugin, and Scripter.


The documentation for this class was generated from the following files: