Canorus 0.0
Public Member Functions | Private Attributes | List of all members
CAPlugin Class Reference

#include <plugin.h>

Public Member Functions

 CAPlugin ()
 
 CAPlugin (QString name, QString author, QString version, QString date, QString dirName, QString homeUrl, QString updateUrl)
 
 ~CAPlugin ()
 
bool action (QString onAction, CAMainWin *mainWin=0, CADocument *document=0, QEvent *evt=0, QPoint *coords=0)
 
bool callAction (CAPluginAction *action, CAMainWin *mainWin=0, CADocument *document=0, QEvent *evt=0, QPoint *coords=0, QString filename="")
 
void addAction (CAPluginAction *action)
 
void addMenu (QString name, QMenu *menu)
 
void setEnabled (bool enabled)
 
bool isEnabled ()
 
QString name ()
 
QString author ()
 
QString version ()
 
QString date ()
 
QString dirName ()
 
QString homeUrl ()
 
QString updateUrl ()
 
QString description (QString lang)
 
QString localDescription ()
 
QMenu * menu (QString menuName)
 
void setName (QString name)
 
void setDescription (QString desc, QString lang=QString(""))
 
void setAuthor (QString author)
 
void setVersion (QString version)
 
void setDate (QString date)
 
void setDirName (QString dirName)
 
void setHomeUrl (QString homeUrl)
 
void setUpdateUrl (QString updateUrl)
 
QList< QString > actionList ()
 

Private Attributes

QString _name
 
QHash< QString, QString > _descMap
 
QString _author
 LOCALE description of the plugin, key means the language code, value is the translation. Empty string key is the key of universal non-translated description. More...
 
QString _version
 
QString _date
 
QString _dirName
 
QString _homeUrl
 ABSOLUTE Name of directory where the plugin is located - plugin only stores the relative one, Canorus changes it to absolute one. More...
 
QString _updateUrl
 
bool _enabled
 
QMultiHash< QString, CAPluginAction * > _actionMap
 
QHash< QString, QMenu * > _menuMap
 Key: onAction, Value: plugin's action. More...
 

Constructor & Destructor Documentation

◆ CAPlugin() [1/2]

CAPlugin::CAPlugin ( )

◆ CAPlugin() [2/2]

CAPlugin::CAPlugin ( QString  name,
QString  author,
QString  version,
QString  date,
QString  dirName,
QString  homeUrl,
QString  updateUrl 
)

References _author, _date, _dirName, _enabled, _homeUrl, _name, _updateUrl, _version, author(), date(), dirName(), homeUrl(), name(), updateUrl(), and version().

Here is the call graph for this function:

◆ ~CAPlugin()

CAPlugin::~CAPlugin ( )

References _actionMap, and _menuMap.

Member Function Documentation

◆ action()

bool CAPlugin::action ( QString  onAction,
CAMainWin mainWin = 0,
CADocument document = 0,
QEvent *  evt = 0,
QPoint *  coords = 0 
)

This function is called when an event was triggered in a program and a plugin connected to this event is triggered. It calls all the plugin's actions having the given onAction.

Parameters
onActionString describing action name. eg. onScoreClick, onDocumentClose
mainWinPointer to the current application main window.
documentPointer to the current document.
evtPointer to the Mouse/Key/Wheel event, if it happened.
coordsPointer to the coords in absolute world units, if a click on Score happened.
Returns
True, if all the actions were successfully called, False otherwise.

References _actionMap, _enabled, actionList(), and callAction().

Referenced by addAction(), callAction(), CAPluginManager::disablePlugin(), and CAPluginManager::enablePlugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ actionList()

QList< QString > CAPlugin::actionList ( )
inline

Return a list of all the actions the plugin is connected to.

Returns
List of actions in QList QString format.

References _actionMap.

Referenced by action(), CAPluginManager::disablePlugin(), and CAPluginManager::enablePlugin().

Here is the caller graph for this function:

◆ addAction()

void CAPlugin::addAction ( CAPluginAction action)

Adds an action to the plugin, if the actionName&action aren't present yet.

Parameters
onActionName of the Canorus's action the plugin reacts on.
langType of the action (ruby, python, library etc.).
fileNameFile name of the script/library which is to be run on Canorus event.
functionName of the function to be run.
argsList of arguments expected by the function.

References _actionMap, and action().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addMenu()

void CAPlugin::addMenu ( QString  name,
QMenu *  menu 
)
inline

References _menuMap, menu(), and name().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ author()

QString CAPlugin::author ( )
inline

References _author.

Referenced by CAPlugin(), and setAuthor().

Here is the caller graph for this function:

◆ callAction()

bool CAPlugin::callAction ( CAPluginAction action,
CAMainWin mainWin = 0,
CADocument document = 0,
QEvent *  evt = 0,
QPoint *  coords = 0,
QString  filename = "" 
)

This function calls a specific action. This is used for export, import and custom actions which aren't called by Canorus automatically.

Parameters
actionPointer to the action to be called.
mainWinPointer to the current application main window.
documentPointer to the current document.
evtPointer to the Mouse/Key/Wheel event, if it happened.
coordsPointer to the coords in absolute world units, if a click on Score happened.
Returns
True, if the action succeeded, False otherwise.

References _dirName, _name, action(), CAMainWin::currentScoreView(), CAMainWin::currentSheet(), dirName(), CADrawableMusElement::DrawableNote, CAScoreView::musElementSelection(), CAMainWin::pyConsoleIface, CACanorus::rebuildUI(), and CAScoreView::selection().

Referenced by action(), and CAPluginAction::triggeredSlot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ date()

QString CAPlugin::date ( )
inline

References _date.

Referenced by CAPlugin(), and setDate().

Here is the caller graph for this function:

◆ description()

QString CAPlugin::description ( QString  lang)
inline

References _descMap.

Referenced by localDescription().

Here is the caller graph for this function:

◆ dirName()

QString CAPlugin::dirName ( )
inline

References _dirName.

Referenced by callAction(), CAPlugin(), CAPluginManager::enablePlugin(), CAPluginManager::removePlugin(), and setDirName().

Here is the caller graph for this function:

◆ homeUrl()

QString CAPlugin::homeUrl ( )
inline

References _homeUrl.

Referenced by CAPlugin(), and setHomeUrl().

Here is the caller graph for this function:

◆ isEnabled()

bool CAPlugin::isEnabled ( )
inline

References _enabled.

Referenced by CAPluginManager::disablePlugin(), and CAPluginManager::enablePlugin().

Here is the caller graph for this function:

◆ localDescription()

QString CAPlugin::localDescription ( )
inline

References _descMap, description(), and name().

Here is the call graph for this function:

◆ menu()

QMenu * CAPlugin::menu ( QString  menuName)
inline

References _menuMap.

Referenced by addMenu(), and CAPluginManager::endElement().

Here is the caller graph for this function:

◆ name()

QString CAPlugin::name ( )
inline

References _name.

Referenced by addMenu(), CAPlugin(), localDescription(), and setName().

Here is the caller graph for this function:

◆ setAuthor()

void CAPlugin::setAuthor ( QString  author)
inline

References _author, and author().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setDate()

void CAPlugin::setDate ( QString  date)
inline

References _date, and date().

Here is the call graph for this function:

◆ setDescription()

void CAPlugin::setDescription ( QString  desc,
QString  lang = QString("") 
)
inline

References _descMap.

Referenced by CAPluginManager::endElement().

Here is the caller graph for this function:

◆ setDirName()

void CAPlugin::setDirName ( QString  dirName)
inline

References _dirName, and dirName().

Referenced by CAPluginManager::readPlugins().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnabled()

void CAPlugin::setEnabled ( bool  enabled)
inline

References _enabled.

Referenced by CAPluginManager::disablePlugin(), and CAPluginManager::enablePlugin().

Here is the caller graph for this function:

◆ setHomeUrl()

void CAPlugin::setHomeUrl ( QString  homeUrl)
inline

References _homeUrl, and homeUrl().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setName()

void CAPlugin::setName ( QString  name)
inline

References _name, and name().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setUpdateUrl()

void CAPlugin::setUpdateUrl ( QString  updateUrl)
inline

References _updateUrl, and updateUrl().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVersion()

void CAPlugin::setVersion ( QString  version)
inline

References _version, and version().

Referenced by CAPluginManager::endElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateUrl()

QString CAPlugin::updateUrl ( )
inline

References _updateUrl.

Referenced by CAPlugin(), and setUpdateUrl().

Here is the caller graph for this function:

◆ version()

QString CAPlugin::version ( )
inline

References _version.

Referenced by CAPlugin(), and setVersion().

Here is the caller graph for this function:

Member Data Documentation

◆ _actionMap

QMultiHash< QString, CAPluginAction* > CAPlugin::_actionMap
private

◆ _author

QString CAPlugin::_author
private

LOCALE description of the plugin, key means the language code, value is the translation. Empty string key is the key of universal non-translated description.

Referenced by author(), CAPlugin(), and setAuthor().

◆ _date

QString CAPlugin::_date
private

Referenced by CAPlugin(), date(), and setDate().

◆ _descMap

QHash<QString, QString> CAPlugin::_descMap
private

◆ _dirName

QString CAPlugin::_dirName
private

◆ _enabled

bool CAPlugin::_enabled
private

◆ _homeUrl

QString CAPlugin::_homeUrl
private

ABSOLUTE Name of directory where the plugin is located - plugin only stores the relative one, Canorus changes it to absolute one.

Referenced by CAPlugin(), homeUrl(), and setHomeUrl().

◆ _menuMap

QHash< QString, QMenu* > CAPlugin::_menuMap
private

Key: onAction, Value: plugin's action.

Referenced by addMenu(), menu(), and ~CAPlugin().

◆ _name

QString CAPlugin::_name
private

Referenced by callAction(), CAPlugin(), name(), and setName().

◆ _updateUrl

QString CAPlugin::_updateUrl
private

Referenced by CAPlugin(), setUpdateUrl(), and updateUrl().

◆ _version

QString CAPlugin::_version
private

Referenced by CAPlugin(), setVersion(), and version().


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