DO/Modding/Tools/Wh32Edit/Plugins
From Dark Omen Wiki
(added some thoughts about a plugin api) |
m (small fix) |
||
Line 72: | Line 72: | ||
{ | { | ||
public: | public: | ||
- | virtual | + | virtual RegimentPanelInterface (QWidget *parent = 0) {} |
- | virtual ~ | + | virtual ~RegimentPanelInterface () {} |
/** | /** |
Revision as of 17:09, 15 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: virtual ExportPluginInterface() {} virtual ~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); /** * Called after constructing the plugin to check for errors. * (e.g. if the Plugin is delivered with an additional file and * this one was missing) * @return <0 - Error */ virtual int result(); /** * String displayed in an error MsgBox if result was <0 */ virtual QString errorMessage(); };
The Export Plugins should overload setName() of QObject, this name will be displayed in the Menu.
Regiment Panel Plugins
class RegimentPanelInterface : public QWidget { public: virtual RegimentPanelInterface (QWidget *parent = 0) {} virtual ~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); /** * 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 after constructing the plugin to check for errors. * (e.g. if the Plugin is delivered with an additional file and * this one was missing) * @return <0 - Error */ virtual int result(); /** * String displayed in an error MsgBox if result was <0 */ virtual QString errorMessage(); };
The name returned by widgetName() (use setWidgetName() to change the name) will be used as the Label for the Tab. Overloading showEvent(QShowEvent *) allows detecting if the Widget has been selected in the TabWidget by the user (and to do some updates if needed) (Note: Have to test if this situation really causes this event...)
Special LineEdit- (TextFields), SpinBox- and ComboBox classes are provided by Wh32Edit to make managing Armies easier.