|
OpenASIP 2.2
|
#include <GUIOptionsSerializer.hh>


Public Member Functions | |
| GUIOptionsSerializer (std::string configurationName) | |
| virtual | ~GUIOptionsSerializer () |
| void | writeState (const ObjectState *optionsState) |
| ObjectState * | readState () |
| void | writeOptions (const GUIOptions &options) |
| GUIOptions * | readOptions () |
Public Member Functions inherited from XMLSerializer | |
| XMLSerializer () | |
| virtual | ~XMLSerializer () |
| void | setSourceFile (const std::string &fileName) |
| void | setSourceString (const std::string &source) |
| void | setDestinationFile (const std::string &fileName) |
| void | setDestinationString (std::string &destination) |
| void | setSchemaFile (const std::string &fileName) |
| void | setUseSchema (bool useSchema) |
| void | setXMLNamespace (std::string nsUri) |
Public Member Functions inherited from TCETools::Serializer | |
| virtual | ~Serializer () |
Protected Member Functions | |
| virtual ObjectState * | convertToConfigFileFormat (const ObjectState *options) const |
| virtual ObjectState * | convertToOptionsObjectFormat (const ObjectState *root) const |
Protected Member Functions inherited from XMLSerializer | |
| std::string | sourceFile () const |
Private Member Functions | |
| void | setWindowProperties (const ObjectState *windowElem, ObjectState *options) const |
| void | setToolbarProperties (const ObjectState *toolbarElem, ObjectState *options) const |
| void | addKeyboardShortcut (const ObjectState *ksElem, ObjectState *options) const |
| GUIOptionsSerializer (const GUIOptionsSerializer &) | |
| Copying not allowed. | |
| GUIOptionsSerializer & | operator= (const GUIOptionsSerializer &) |
| Assignment not allowed. | |
Private Attributes | |
| std::string | configurationName_ |
| Name of the configuration to read/write. | |
Reads and writes options of a graphical user interface from an XML file.
This is a base class which provides storing of options common to all GUIs, such as window size and position, toolbar contents and list of keyboard shortcuts. If a GUI needs application specific options, a custom options serializer can be derived from this class. See design documentation for details.
Definition at line 52 of file GUIOptionsSerializer.hh.
| GUIOptionsSerializer::GUIOptionsSerializer | ( | std::string | name | ) |
Constructor.
| name | Name of the configuration. |
Definition at line 113 of file GUIOptionsSerializer.cc.
|
virtual |
|
private |
Copying not allowed.
|
private |
Adds a keyboard shortcut to the given options according to the given keyboard-shortcut element.
| ksElem | ObjectState representing a keyboard-shortcut element in options file. |
| options | Options ObjectState which is modified. |
Definition at line 495 of file GUIOptionsSerializer.cc.
References ObjectState::childByName(), DELETE_KEY, FKEY_NUMBER, ObjectState::hasChild(), ObjectState::intAttribute(), KEY_COMB_ALT, KEY_COMB_CTRL, KEY_COMB_FKEY, KEY_COMB_KEY, KEY_VALUE, KS_ACTION, KS_KEY_COMBINATION, options, KeyboardShortcut::OSKEY_ACTION, KeyboardShortcut::OSKEY_ALT, KeyboardShortcut::OSKEY_CTRL, KeyboardShortcut::OSKEY_FKEY, KeyboardShortcut::OSKEY_KEY, KeyboardShortcut::OSNAME_KEYBOARD_SHORTCUT, ObjectState::setAttribute(), ObjectState::stringAttribute(), and ObjectState::stringValue().
Referenced by convertToOptionsObjectFormat().

|
protectedvirtual |
Converts the given ObjectState tree created by GUIOptions::saveState to the format of configuration file.
| options | ObjectState tree to be converted. |
Reimplemented in ProDeOptionsSerializer.
Definition at line 194 of file GUIOptionsSerializer.cc.
References ObjectState::addChild(), configurationName_, DELETE_KEY, FALSE, FKEY_NUMBER, ObjectState::hasAttribute(), ObjectState::intAttribute(), KEY_COMB_ALT, KEY_COMB_CTRL, KEY_COMB_FKEY, KEY_COMB_KEY, KEY_VALUE, KEYBOARD_SHORTCUT, KS_ACTION, KS_KEY_COMBINATION, ObjectState::name(), options, KeyboardShortcut::OSKEY_ACTION, ToolbarButton::OSKEY_ACTION, KeyboardShortcut::OSKEY_ALT, KeyboardShortcut::OSKEY_CTRL, KeyboardShortcut::OSKEY_FKEY, GUIOptions::OSKEY_FULL_SCREEN, KeyboardShortcut::OSKEY_KEY, GUIOptions::OSKEY_POSITION, ToolbarButton::OSKEY_SLOT, GUIOptions::OSKEY_TOOLBAR_LAYOUT, GUIOptions::OSKEY_TOOLBAR_VISIBILITY, GUIOptions::OSKEY_WINDOW_HEIGHT, GUIOptions::OSKEY_WINDOW_WIDTH, GUIOptions::OSKEY_X_POS, GUIOptions::OSKEY_Y_POS, KeyboardShortcut::OSNAME_KEYBOARD_SHORTCUT, GUIOptions::OSNAME_SEPARATOR, ToolbarButton::OSNAME_TOOLBAR_BUTTON, GUIOptions::OSVALUE_ICON, GUIOptions::OSVALUE_TEXT, SEPARATOR_POSITION, ObjectState::setAttribute(), ObjectState::setValue(), SLOT_POSITION, ObjectState::stringAttribute(), TB_LA_ICON, TB_LA_TEXT, TB_LAYOUT, TB_SEPARATOR, TB_SLOT, TB_SLOT_ACTION, TB_VISIBLE, TOOLBAR, Conversion::toString(), TRUE, WI_FULLSCREEN, WI_HEIGHT, WI_WIDTH, WI_X_POSITION, WI_Y_POSITION, and WINDOW.
Referenced by ProDeOptionsSerializer::convertToConfigFileFormat(), and writeState().

|
protectedvirtual |
Creates a new ObjectState tree which can be given to GUIOptions constructor. The tree is created according to the given tree which matches with the syntax of the options file.
| root | Root node of the ObjectState tree to be converted. |
Reimplemented in ProDeOptionsSerializer.
Definition at line 343 of file GUIOptionsSerializer.cc.
References addKeyboardShortcut(), ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), DEFAULT_HEIGHT, DEFAULT_WIDTH, DEFAULT_X_POS, DEFAULT_Y_POS, ObjectState::hasChild(), KEYBOARD_SHORTCUT, ObjectState::name(), options, GUIOptions::OSKEY_FULL_SCREEN, GUIOptions::OSKEY_TOOLBAR_LAYOUT, GUIOptions::OSKEY_TOOLBAR_VISIBILITY, GUIOptions::OSKEY_WINDOW_HEIGHT, GUIOptions::OSKEY_WINDOW_WIDTH, GUIOptions::OSKEY_X_POS, GUIOptions::OSKEY_Y_POS, GUIOptions::OSNAME_OPTIONS, GUIOptions::OSVALUE_BOTH, setToolbarProperties(), setWindowProperties(), TOOLBAR, and WINDOW.
Referenced by ProDeOptionsSerializer::convertToOptionsObjectFormat(), and readState().

|
private |
Assignment not allowed.
| GUIOptions * GUIOptionsSerializer::readOptions | ( | ) |
Reads the current input file and creates GUIOptions according to it.
| SerializerException | If an error occurs while reading the file. |
| ObjectStateLoadingException | If an error occurs while creating options. |
Definition at line 178 of file GUIOptionsSerializer.cc.
References options, and readState().

|
virtual |
Reads the options from the current XML file set and creates an ObjectState tree which can be read by GUIOptions::loadState.
| SerializerException | If an error occurs while reading the file. |
Reimplemented from XMLSerializer.
Definition at line 149 of file GUIOptionsSerializer.cc.
References convertToOptionsObjectFormat(), and XMLSerializer::readState().
Referenced by Proxim::loadOptions(), ProDe::OnInit(), and readOptions().

|
private |
Sets the toolbar properties for the given options according to the given toolbar element.
| toolbarElem | ObjectState representing toolbar element in options file. |
| options | Options ObjectState which is modified. |
Definition at line 430 of file GUIOptionsSerializer.cc.
References assert, ObjectState::child(), ObjectState::childByName(), ObjectState::childCount(), FALSE, ObjectState::hasChild(), ObjectState::name(), options, ToolbarButton::OSKEY_ACTION, GUIOptions::OSKEY_POSITION, ToolbarButton::OSKEY_SLOT, GUIOptions::OSKEY_TOOLBAR_LAYOUT, GUIOptions::OSKEY_TOOLBAR_VISIBILITY, GUIOptions::OSNAME_SEPARATOR, ToolbarButton::OSNAME_TOOLBAR_BUTTON, GUIOptions::OSVALUE_BOTH, GUIOptions::OSVALUE_ICON, GUIOptions::OSVALUE_TEXT, SEPARATOR_POSITION, ObjectState::setAttribute(), SLOT_POSITION, ObjectState::stringAttribute(), ObjectState::stringValue(), TB_LA_ICON, TB_LA_TEXT, TB_LAYOUT, TB_SEPARATOR, TB_SLOT, TB_SLOT_ACTION, TB_VISIBLE, and TRUE.
Referenced by convertToOptionsObjectFormat().

|
private |
Sets the window properties for the given options according to the given window element.
| windowElem | ObjectState representing window element in options file. |
| options | Options ObjectState which is modified. |
Definition at line 390 of file GUIOptionsSerializer.cc.
References assert, ObjectState::childByName(), FALSE, options, GUIOptions::OSKEY_FULL_SCREEN, GUIOptions::OSKEY_WINDOW_HEIGHT, GUIOptions::OSKEY_WINDOW_WIDTH, GUIOptions::OSKEY_X_POS, GUIOptions::OSKEY_Y_POS, ObjectState::stringValue(), TRUE, WI_FULLSCREEN, WI_HEIGHT, WI_WIDTH, WI_X_POSITION, and WI_Y_POSITION.
Referenced by convertToOptionsObjectFormat().

| void GUIOptionsSerializer::writeOptions | ( | const GUIOptions & | options | ) |
Serializes the given options to the file set.
| options | The options to be serialized. |
| SerializerException | If an error occurs while serializing. |
Definition at line 163 of file GUIOptionsSerializer.cc.
References options, and writeState().
Referenced by ProximQuitCmd::Do(), and SaveOptionsCmd::Do().

|
virtual |
Serializes the given ObjectState tree created by GUIOptions::saveState to an XML file.
| optionsState | ObjectState tree created by GUIOptions::saveState. |
| SerializerException | If the current destination file cannot be written. |
Reimplemented from XMLSerializer.
Definition at line 135 of file GUIOptionsSerializer.cc.
References convertToConfigFileFormat(), and XMLSerializer::writeState().
Referenced by writeOptions().

|
private |
Name of the configuration to read/write.
Definition at line 84 of file GUIOptionsSerializer.hh.
Referenced by convertToConfigFileFormat().