Scribus
Open source desktop publishing at your fingertips
ScriptPlugin Class Reference
Inheritance diagram for ScriptPlugin:
Collaboration diagram for ScriptPlugin:

Public Member Functions

virtual bool initPlugin ()
 Initialize the plugin. More...
 
virtual bool cleanupPlugin ()
 Deactivates the plugin for unloading / program quit. More...
 
virtual const QString fullTrName () const
 Plug-in's human-readable, translated name. More...
 
virtual const AboutDatagetAboutData () const
 Return descriptive information about the plug-in. More...
 
virtual void deleteAboutData (const AboutData *about) const
 
virtual void languageChange ()
 Update all user-visible text to reflect current UI language. 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 void addToMainWindowMenu (ScribusMainWindow *)
 Allow plugins to add to a main menu.
 
- Public Member Functions inherited from ScPersistentPlugin
 ScPersistentPlugin ()
 ctor More...
 
virtual ~ScPersistentPlugin ()=0
 Pure virtual dtor for abstract class.
 
- Public Member Functions inherited from ScPlugin
 ScPlugin ()
 ctor, returns a new ScPlugin instance More...
 
virtual ~ScPlugin ()=0
 Destroy the ScPlugin instance. More...
 
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.
 
const QString pluginTypeName () const
 Returns human readable plugin type from plug-in's pluginType.
 
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)
 

Public Attributes

QByteArray pythonHome
 

Additional Inherited Members

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

Member Function Documentation

bool ScriptPlugin::cleanupPlugin ( )
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.

Implements ScPersistentPlugin.

const QString ScriptPlugin::fullTrName ( ) const
virtual

Plug-in's human-readable, translated name.

Please don't use this for anything except display to the user. The results of testing the value of this can not be guaranteed, as its value may change depending on locale and change at runtime.

Implements ScPlugin.

const ScActionPlugin::AboutData * ScriptPlugin::getAboutData ( ) const
virtual

Return descriptive information about the plug-in.

Returns a structure containing descriptive information about the plug-in. This information is used in places like the Help->About Plug-ins menu item. The stucture MUST be deleted using deleteAboutData(AboutData* about) when finished with.

Every plugin MUST reimplement getAboutData(...) and deleteAboutData(...).

See also
ScPlugin::deleteAboutData

Implements ScPlugin.

bool ScriptPlugin::initPlugin ( )
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.

Implements ScPersistentPlugin.

void ScriptPlugin::languageChange ( )
virtual

Update all user-visible text to reflect current UI language.

Updates the text on all widgets on the plug-in to reflect the new language. You should generally use this method to set all the widget text during construction. That ensures that text is not duplicated, and that when this method is called the text of all persistent widgets is correctly changed.

This method only needs to affect text in widgets that currently exists (displayed or otherwise).

Implements ScPlugin.

bool ScriptPlugin::newPrefsPanelWidget ( QWidget *  parent,
PrefsPanel *&  panel,
QString &  caption,
QPixmap &  icon 
)
virtual

Create and return a prefs UI panel for the plugin.

Override this method if you want to provide a panel for the preferences dialog.

The caller takes ownership of the panel. Qt is responsible for deleting it when it's parent is deleted. `parent' must be the dialog the widget will be added to or a child of it, otherwise the panel won't be deleted correctly when the dialog is.

See prefspanel.h for info on implementing the panel.

This method must return false (the default) if the plugin does not provide a prefs panel. If true is returned, caption, panel, and icon MUST have been assigned.

Parameters
parentParent widget, to be passed to panel ctor
panel(out) the panel created
caption(out) caption for icon in panel list
icon(out) icon for use in panel list
Returns
true if panel was created, false if not.

By default, returns 0 to indicate no prefs UI.

Reimplemented from ScPlugin.


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