DO/Modding/Tools/Wh32Edit/Plugins
From Dark Omen Wiki
(→Interface: Removed result() and errorMessage(). Throwing exceptions (and displaying error via e.what) is enough for now.) |
(→Regiment Panel Plugins: updated interface) |
||
Line 58: | Line 58: | ||
class RegimentPanelInterface : public QWidget | class RegimentPanelInterface : public QWidget | ||
{ | { | ||
+ | |||
public: | public: | ||
RegimentPanelInterface (QWidget *parent = 0) {} | RegimentPanelInterface (QWidget *parent = 0) {} | ||
Line 76: | Line 77: | ||
*/ | */ | ||
virtual void setDatabase(Database& db) {} | virtual void setDatabase(Database& db) {} | ||
+ | |||
+ | /** | ||
+ | * Called by the Plugin Loader on creation. | ||
+ | * The implementation should return a new instance of the Panel. | ||
+ | */ | ||
+ | virtual RegimentPanelInterface* createInstance(QWidget *parent = 0) = 0; | ||
}; | }; | ||
+ | |||
+ | } // ns wh32edit | ||
+ | } // ns darkomen | ||
</source> | </source> | ||
- | The name returned by widgetName( | + | The name returned by widgetName() will be used as the Label for the Tab. |
Special LineEdit- (TextFields), SpinBox- and ComboBox classes are provided by Wh32Edit to make managing Armies easier. | Special LineEdit- (TextFields), SpinBox- and ComboBox classes are provided by Wh32Edit to make managing Armies easier. |
Revision as of 20:30, 26 April 2010
Contents |
Introduction
This page just contains some thoughts and is subject to change. There is not even a plugin loader in the Wh32Edit Trunk (non public qt version) and won't be added in the next days.
Because Qt has an integrated Multi Plattform Plugin Loader I had some thoughts about improving Wh32Edit by supporting custom C++ plugins.
Possible Plugin Apis
Export Plugins
Plugins integrated at File->Export->-Menu. As an example see the Smf Clipboard Export in the old Wh32Edit version. Such export jobs could be expanded by using Plugins.
Regiment Panel Plugins
Plugins that add new panels when editing regiments (new Panels besides General, Leader/Unit and Attributes) or plugins that replace the old...
Header Panel Plugins
Same as for Regiment but for Header editing
Savegame Panel Plugins
Same as for Regiment but for Savegame Header and Footer editing
Interface
Export Plugins
class ExportPluginInterface : public QObject { public: ExportPluginInterface() {} ~ExportPluginInterface() {} /** * Called if the Menu Entry of the Plugin the Export menu has been clicked. * It should do things like exporting things to the clipboard (and display * a MsgBox e.g.) * @param armParser ARMParser used by the current active army * @param selectedRegiment Current selected regiment in the Wh32Edit listview. * @param database Database associated with the current army * @return <0 Error during export */ virtual int export(ARMParser &armParser, arm::Regiment& selectedRegiment, Database &database) = 0; };
The Export Plugins should overload setName() of QObject, this name will be displayed in the Menu.
Regiment Panel Plugins
class RegimentPanelInterface : public QWidget { public: RegimentPanelInterface (QWidget *parent = 0) {} ~RegimentPanelInterface () {} /** * Called if a new Regiment has been selected. * The Widget should update all of it's controls. * @param selectedRegiment Current selected regiments in the Wh32Edit listview. */ virtual void setRegiment(arm::Regiment& selectedRegiment) = 0; /** * Called if the Database has been changed. * All controls on this widget supporting databases (ComboBox) should update * there lists. * @param db The new database */ virtual void setDatabase(Database& db) {} /** * Called by the Plugin Loader on creation. * The implementation should return a new instance of the Panel. */ virtual RegimentPanelInterface* createInstance(QWidget *parent = 0) = 0; }; } // ns wh32edit } // ns darkomen
The name returned by widgetName() will be used as the Label for the Tab.
Special LineEdit- (TextFields), SpinBox- and ComboBox classes are provided by Wh32Edit to make managing Armies easier.