mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Add CutterPlugin::terminate() (#1372)
This commit is contained in:
parent
2ab676be71
commit
894a79b0cc
@ -10,10 +10,32 @@ class MainWindow;
|
||||
class CutterPlugin
|
||||
{
|
||||
public:
|
||||
virtual ~CutterPlugin() {}
|
||||
virtual ~CutterPlugin() = default;
|
||||
|
||||
/**
|
||||
* @brief Initialize the Plugin
|
||||
*
|
||||
* called right when the plugin is loaded initially
|
||||
*/
|
||||
virtual void setupPlugin() = 0;
|
||||
|
||||
/**
|
||||
* @brief Setup any UI components for the Plugin
|
||||
* @param main the MainWindow to add any UI to
|
||||
*
|
||||
* called after Cutter's core UI has been initialized
|
||||
*/
|
||||
virtual void setupInterface(MainWindow *main) = 0;
|
||||
|
||||
/**
|
||||
* @brief Shutdown the Plugin
|
||||
*
|
||||
* called just before the Plugin is deleted.
|
||||
* This method is usually only relevant for Python Plugins where there is no
|
||||
* direct equivalent of the destructor.
|
||||
*/
|
||||
virtual void terminate() {};
|
||||
|
||||
virtual QString getName() const = 0;
|
||||
virtual QString getAuthor() const = 0;
|
||||
virtual QString getDescription() const = 0;
|
||||
|
@ -78,6 +78,7 @@ void PluginManager::loadPlugins()
|
||||
void PluginManager::destroyPlugins()
|
||||
{
|
||||
for (CutterPlugin *plugin : plugins) {
|
||||
plugin->terminate();
|
||||
delete plugin;
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,9 @@ class CutterSamplePlugin(cutter.CutterPlugin):
|
||||
widget = FortuneWidget(main, action)
|
||||
main.addPluginDockWidget(widget, action)
|
||||
|
||||
def terminate(self): # optional
|
||||
print("CutterSamplePlugin shutting down")
|
||||
|
||||
|
||||
# This function will be called by Cutter and should return an instance of the plugin.
|
||||
def create_cutter_plugin():
|
||||
|
Loading…
Reference in New Issue
Block a user