Fawkes API  Fawkes Development Version
ConfigEditorPlugin Class Referenceabstract

Base class for plugins for the Fawkes config editor. More...

#include <tools/config_editor/config_editor_plugin.h>

Inheritance diagram for ConfigEditorPlugin:

Public Member Functions

 ConfigEditorPlugin (std::string config_path, std::string ui_file)
 Constructor. More...
 
virtual ~ConfigEditorPlugin ()
 Destructor. More...
 
void initialize ()
 Initialize the plugin. More...
 
void run ()
 Run the plugin. More...
 
std::string get_config_path () const
 Get the config prefix specified for this config editor plugin. More...
 
void set_config (fawkes::Configuration *config)
 Set the configuration for the plugin to work on. More...
 

Protected Member Functions

virtual void pre_run ()=0
 Config editor plugins need to implement this function. More...
 
virtual void post_run (int response)=0
 This method is called after the dialog is closed. More...
 
virtual Gtk::Dialog * load_dialog ()=0
 In this function the (custom) dialog of the plugin needs to be initialized. More...
 

Protected Attributes

Gtk::Dialog * m_dialog
 The (main-) dialog of the plugin. More...
 
Glib::RefPtr< Gtk::Builder > m_builder
 Gtk Builder created from the UI file of the plugin. More...
 
std::string m_config_path
 The config prefix the plugin is attached to. More...
 
fawkes::Configurationm_config
 The fawkes::Configuration. More...
 

Detailed Description

Base class for plugins for the Fawkes config editor.

A plugin allows to manipulate a certain part of the configuration, most often this is intended to be the config options for a Fawkes plugin.

Author
Daniel Beck

Definition at line 34 of file config_editor_plugin.h.

Constructor & Destructor Documentation

ConfigEditorPlugin::ConfigEditorPlugin ( std::string  config_path,
std::string  ui_file 
)

Constructor.

Parameters
config_paththe prefix of the part that can be configured with this plugin
ui_filea Gtk Builder file which contains the definition the plugin's GUI components

Definition at line 78 of file config_editor_plugin.cpp.

ConfigEditorPlugin::~ConfigEditorPlugin ( )
virtual

Destructor.

Definition at line 85 of file config_editor_plugin.cpp.

Member Function Documentation

std::string ConfigEditorPlugin::get_config_path ( ) const

Get the config prefix specified for this config editor plugin.

Returns
the config prefix

Definition at line 93 of file config_editor_plugin.cpp.

Referenced by ConfigTreeView::register_plugin().

void ConfigEditorPlugin::initialize ( )

Initialize the plugin.

This method needs to be called before the plugin can be used.

Definition at line 111 of file config_editor_plugin.cpp.

Referenced by ConfigTreeView::register_plugin().

Gtk::Dialog * ConfigEditorPlugin::load_dialog ( )
protectedpure virtual

In this function the (custom) dialog of the plugin needs to be initialized.

Returns
pointer to the loaded dialog

Implemented in NaoStiffnessConfigPlugin, and RetrieverConfigPlugin.

void ConfigEditorPlugin::post_run ( int  response)
protectedpure virtual

This method is called after the dialog is closed.

Here, the input the user has made needs to be handled.

Parameters
responsethe response obtained from the run() method of the dialog (Gtk::RESPONSE_OK or Gtk::RESPONSE_CANCEL)

Implemented in NaoStiffnessConfigPlugin, and RetrieverConfigPlugin.

void ConfigEditorPlugin::pre_run ( )
protectedpure virtual

Config editor plugins need to implement this function.

It is called before the actual dialog is opened. Ususally, plugins want to parse the configuration, here, and initialize the GUI elements of the dialog.

Implemented in NaoStiffnessConfigPlugin, and RetrieverConfigPlugin.

void ConfigEditorPlugin::run ( )

Run the plugin.

Usually, this means opening a dialog where config values can be manipulated and on closing these are written to the config.

Definition at line 121 of file config_editor_plugin.cpp.

void ConfigEditorPlugin::set_config ( fawkes::Configuration config)

Set the configuration for the plugin to work on.

Parameters
configthe configuration

Definition at line 102 of file config_editor_plugin.cpp.

Member Data Documentation

ConfigEditorPlugin::m_builder
protected

Gtk Builder created from the UI file of the plugin.

Definition at line 54 of file config_editor_plugin.h.

Referenced by RetrieverConfigPlugin::load_dialog(), and NaoStiffnessConfigPlugin::load_dialog().

ConfigEditorPlugin::m_config
protected
ConfigEditorPlugin::m_config_path
protected

The config prefix the plugin is attached to.

Definition at line 56 of file config_editor_plugin.h.

Referenced by RetrieverConfigPlugin::post_run(), and RetrieverConfigPlugin::pre_run().

ConfigEditorPlugin::m_dialog
protected

The (main-) dialog of the plugin.

Definition at line 53 of file config_editor_plugin.h.

Referenced by RetrieverConfigPlugin::post_run(), and RetrieverConfigPlugin::pre_run().


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