OpenASIP  2.0
Public Member Functions | List of all members
SaveOptionsCmd Class Reference

#include <SaveOptionsCmd.hh>

Inheritance diagram for SaveOptionsCmd:
Inheritance graph
Collaboration diagram for SaveOptionsCmd:
Collaboration graph

Public Member Functions

 SaveOptionsCmd ()
 
virtual ~SaveOptionsCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual SaveOptionsCmdcreate () const
 
virtual std::string icon () const
 
virtual std::string shortName () const
 
virtual bool isEnabled ()
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

wxCommand for saving editor options.

Creates and shows an OptionsDialog.

Definition at line 42 of file SaveOptionsCmd.hh.

Constructor & Destructor Documentation

◆ SaveOptionsCmd()

SaveOptionsCmd::SaveOptionsCmd ( )

The Constructor.

Definition at line 49 of file SaveOptionsCmd.cc.

Referenced by create().

◆ ~SaveOptionsCmd()

SaveOptionsCmd::~SaveOptionsCmd ( )
virtual

The Destructor.

Definition at line 57 of file SaveOptionsCmd.cc.

57 {}

Member Function Documentation

◆ create()

SaveOptionsCmd * SaveOptionsCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 98 of file SaveOptionsCmd.cc.

98  {
99  return new SaveOptionsCmd();
100 }

References SaveOptionsCmd().

Here is the call graph for this function:

◆ Do()

bool SaveOptionsCmd::Do ( )
virtual

Executes the command.

Returns
True, if the command was succesfully executed, false otherwise.

Implements GUICommand.

Definition at line 66 of file SaveOptionsCmd.cc.

66  {
67 
68  ProDeOptions* options = wxGetApp().options();
70  writer.setDestinationFile(Environment::userConfPath("ProDe.conf"));
71 
72  try {
73  writer.writeOptions(*options);
74  options->clearModified();
75  } catch (Exception e) {
76  ErrorDialog errorDialog(parentWindow(),
78  errorDialog.ShowModal();
79  return false;
80  }
81  return true;
82 }

References Exception::errorMessage(), options, GUICommand::parentWindow(), XMLSerializer::setDestinationFile(), WxConversion::toWxString(), Environment::userConfPath(), and GUIOptionsSerializer::writeOptions().

Here is the call graph for this function:

◆ icon()

string SaveOptionsCmd::icon ( ) const
virtual

Returns path to the command's icon file.

Reimplemented from EditorCommand.

Definition at line 117 of file SaveOptionsCmd.cc.

117  {
119 }

References ProDeConstants::CMD_ICON_SAVE_OPTIONS.

◆ id()

int SaveOptionsCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 89 of file SaveOptionsCmd.cc.

89  {
91 }

References ProDeConstants::COMMAND_SAVE_OPTIONS.

◆ isEnabled()

bool SaveOptionsCmd::isEnabled ( )
virtual

This command is enabled when the options have been modified.

Returns
True if the options have been modified, otherwise false.

Reimplemented from EditorCommand.

Definition at line 128 of file SaveOptionsCmd.cc.

128  {
129  return wxGetApp().options()->isModified();
130 }

◆ shortName()

string SaveOptionsCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 108 of file SaveOptionsCmd.cc.

108  {
110 }

References ProDeConstants::CMD_SNAME_SAVE_OPTIONS.


The documentation for this class was generated from the following files:
ProDeConstants::CMD_SNAME_SAVE_OPTIONS
static const std::string CMD_SNAME_SAVE_OPTIONS
Command name for the "Save Options" command.
Definition: ProDeConstants.hh:260
ProDeOptions
Definition: ProDeOptions.hh:44
ProDeConstants::COMMAND_SAVE_OPTIONS
@ COMMAND_SAVE_OPTIONS
Definition: ProDeConstants.hh:464
WxConversion::toWxString
static wxString toWxString(const std::string &source)
ProDeConstants::CMD_NAME_SAVE_OPTIONS
static const std::string CMD_NAME_SAVE_OPTIONS
Command name for the "Save Options" command.
Definition: ProDeConstants.hh:181
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
Environment::userConfPath
static TCEString userConfPath(const std::string &fileName)
Definition: Environment.cc:303
ErrorDialog
Definition: ErrorDialog.hh:42
SaveOptionsCmd::SaveOptionsCmd
SaveOptionsCmd()
Definition: SaveOptionsCmd.cc:49
XMLSerializer::setDestinationFile
void setDestinationFile(const std::string &fileName)
Definition: XMLSerializer.cc:142
Exception
Definition: Exception.hh:54
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
GUIOptionsSerializer::writeOptions
void writeOptions(const GUIOptions &options)
Definition: GUIOptionsSerializer.cc:163
ProDeConstants::CMD_ICON_SAVE_OPTIONS
static const std::string CMD_ICON_SAVE_OPTIONS
Icon location for the "Save Options" command.
Definition: ProDeConstants.hh:324
GUICommand::parentWindow
wxWindow * parentWindow() const
Definition: GUICommand.cc:75
ProDeOptionsSerializer
Definition: ProDeOptionsSerializer.hh:43