diff options
| author | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-01-01 11:40:09 +0000 |
|---|---|---|
| committer | craig <craig@11d20701-8431-0410-a711-e3c959e3b870> | 2012-01-01 11:40:09 +0000 |
| commit | 7ed83b6c6666eb8b6b104c211ae7e52907350372 (patch) | |
| tree | 4430b556abac0ad660a0aacf1887d77f85d8be02 /scribus/plugins/myplugin/myplugin.cpp | |
| download | scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.tar.gz scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.tar.xz scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.zip | |
Branch 1.3.5 tree to 1.4.x tree, goodbye 1.3.x
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17163 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/plugins/myplugin/myplugin.cpp')
| -rw-r--r-- | scribus/plugins/myplugin/myplugin.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/scribus/plugins/myplugin/myplugin.cpp b/scribus/plugins/myplugin/myplugin.cpp new file mode 100644 index 0000000..d39067c --- /dev/null +++ b/scribus/plugins/myplugin/myplugin.cpp @@ -0,0 +1,88 @@ +/* +For general Scribus (>=1.3.2) copyright and licensing information please refer +to the COPYING file provided with the program. Following this notice may exist +a copyright and/or license notice that predates the release of Scribus 1.3.2 +for which a new license (GPL+exception) is in place. +*/ +#include "myplugin.h" +#include "mypluginimpl.h" + +// See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods +// do. That documentatation is not duplicated here. +// Please don't implement the functionality of your plugin here; do that +// in mypluginimpl.h and mypluginimpl.cpp . + +MyPlugin::MyPlugin() : ScActionPlugin() +{ + // Set action info in languageChange, so we only have to do + // it in one place. + languageChange(); +} + +MyPlugin::~MyPlugin() {}; + +void MyPlugin::languageChange() +{ + // Note that we leave the unused members unset. They'll be initialised + // with their default ctors during construction. + // Action name + m_actionInfo.name = "MyPlugin"; + // Action text for menu, including &accel + m_actionInfo.text = tr("My &Plugin"); + // Menu + m_actionInfo.menu = "Extras"; + // If needed, what item to add the menu item after + //m_actionInfo.menuAfterName = "ColorWheel" + // If needed, the keyboard shortcut for the plugin + //m_actionInfo.keySequence = "CTRL+ALT+F3" + // Should the menu item be enabled when the app starts + // (even without a document open) ? + m_actionInfo.enabledOnStartup = true; +} + +const QString MyPlugin::fullTrName() const +{ + return QObject::tr("My Plugin"); +} + +const ScActionPlugin::AboutData* MyPlugin::getAboutData() const +{ + AboutData* about = new AboutData; + Q_CHECK_PTR(about); + return about; +} + +void MyPlugin::deleteAboutData(const AboutData* about) const +{ + Q_ASSERT(about); + delete about; +} + +bool MyPlugin::run(ScribusDoc* doc, QString target) +{ + MyPluginImpl *myPluginImpl = new MyPluginImpl(); + Q_CHECK_PTR(myPluginImpl); + bool result = myPluginImpl->run(target, doc); + delete myPluginImpl; + return result; +} + +// Low level plugin API +int myplugin_getPluginAPIVersion() +{ + return PLUGIN_API_VERSION; +} + +ScPlugin* myplugin_getPlugin() +{ + MyPlugin* plug = new MyPlugin(); + Q_CHECK_PTR(plug); + return plug; +} + +void myplugin_freePlugin(ScPlugin* plugin) +{ + MyPlugin* plug = dynamic_cast<MyPlugin*>(plugin); + Q_ASSERT(plug); + delete plug; +} |
