VPTissue Reference Manual
SimShell::Gui::PTreeEditorWindow Class Reference

Small editor widget for a Boost Property Tree object. More...

#include <PTreeEditorWindow.h>

Inheritance diagram for SimShell::Gui::PTreeEditorWindow:
Inheritance graph
Collaboration diagram for SimShell::Gui::PTreeEditorWindow:
Collaboration graph

Public Slots

void Apply ()
 Write changes to ptree object. Clean state is achieved as a side effect.
 
bool OpenPath (const QString &edit_path)
 Set subtree to show in editor. More...
 
bool OpenPTree (const boost::property_tree::ptree &, QString const &edit_path="")
 Set ptree to show in editor. More...
 

Signals

void ApplyTriggered (const boost::property_tree::ptree &pt)
 Emitted when changes are applied to ptree.
 
void StatusChanged (const QString &)
 Emitted when the window has information available, for e.g. a statusbar.
 

Public Member Functions

 PTreeEditorWindow (QWidget *parent=nullptr)
 
virtual ~PTreeEditorWindow ()
 Virtual destructor.
 
std::string GetEditPath () const
 Get the current edit path. More...
 
virtual boost::property_tree::ptree GetPTreeState () const
 
bool IsOnlyEditData () const
 Test whether the "only edit data" option is set. More...
 
virtual bool IsOpened () const
 
void Redo ()
 Redo last manipulation by the user.
 
void SetOnlyEditData (bool)
 Set the "only edit values" option. More...
 
virtual void SetPTreeState (const boost::property_tree::ptree &)
 
virtual QSize sizeHint () const
 Reimplemented from QWidget.
 
void Undo ()
 Undo last manipulation by the user.
 
- Public Member Functions inherited from SimShell::Gui::HasUnsavedChanges
 HasUnsavedChanges (std::string &&title)
 
virtual ~HasUnsavedChanges ()
 Virtual destructor.
 
ChildrenType::iterator begin ()
 Get iterator to first child.
 
ChildrenType::const_iterator begin () const
 Get iterator to first child.
 
ChildrenType::iterator end ()
 Get iterator to one position after last child.
 
ChildrenType::const_iterator end () const
 Get iterator to one position after last child.
 
void ForceClose ()
 Force this object and its children to go back to unopened state so it can be safely deleted.
 
const std::string & GetTitle ()
 Get title of this object.
 
bool IsClean () const
 
bool Save ()
 Try to save this widget's (and its children's) changes. More...
 
bool SaveAndClose ()
 Try to save this object (and its children) and, if successful, close them all.
 

Protected Member Functions

virtual void InternalForceClose ()
 
virtual bool InternalIsClean () const
 
virtual bool InternalSave ()
 
- Protected Member Functions inherited from SimShell::Gui::HasUnsavedChanges
void AddChild (ChildrenType::value_type &&v)
 Add child.
 
virtual void InternalPreForceClose ()
 Additional things to do before closing children of this widget.
 
void SetChildren (ChildrenType &&c)
 Set children.
 

Additional Inherited Members

- Public Types inherited from SimShell::Gui::HasUnsavedChanges
typedef std::vector< HasUnsavedChanges * > ChildrenType
 

Detailed Description

Small editor widget for a Boost Property Tree object.

Each manipulation by the user immediately results in an Apply() signal.

Definition at line 43 of file PTreeEditorWindow.h.

Constructor & Destructor Documentation

SimShell::Gui::PTreeEditorWindow::PTreeEditorWindow ( QWidget parent = nullptr)
Parameters
parentParent widget.

Definition at line 40 of file PTreeEditorWindow.cpp.

Member Function Documentation

std::string SimShell::Gui::PTreeEditorWindow::GetEditPath ( ) const

Get the current edit path.

The edit path is the subtree that is shown in the editor. The rest of the ptree is hidden. If this value is empty, the entire ptree is shown.

Definition at line 103 of file PTreeEditorWindow.cpp.

ptree SimShell::Gui::PTreeEditorWindow::GetPTreeState ( ) const
virtual
See also
IHasPTreeState::GetPTreeState().

Implements SimShell::Gui::IHasPTreeState.

Definition at line 107 of file PTreeEditorWindow.cpp.

References SimShell::Gui::MyTreeView::GetPTreeState().

Here is the call graph for this function:

void SimShell::Gui::PTreeEditorWindow::InternalForceClose ( )
protectedvirtual
See also
HasUnsavedChanges

Implements SimShell::Gui::HasUnsavedChanges.

Definition at line 115 of file PTreeEditorWindow.cpp.

References SimShell::Gui::PTreeView::setModel().

Here is the call graph for this function:

bool SimShell::Gui::PTreeEditorWindow::InternalIsClean ( ) const
protectedvirtual
See also
HasUnsavedChanges

Implements SimShell::Gui::HasUnsavedChanges.

Definition at line 126 of file PTreeEditorWindow.cpp.

References SimShell::Gui::PTreeView::IsClean().

Here is the call graph for this function:

bool SimShell::Gui::PTreeEditorWindow::InternalSave ( )
protectedvirtual
See also
HasUnsavedChanges

Implements SimShell::Gui::HasUnsavedChanges.

Definition at line 131 of file PTreeEditorWindow.cpp.

References Apply(), and SimShell::Gui::PTreeView::IsClean().

Here is the call graph for this function:

bool SimShell::Gui::PTreeEditorWindow::IsOnlyEditData ( ) const

Test whether the "only edit data" option is set.

If true, the user can only edit values in the 'data' column. The user cannot add/move/remove/rename keys.

Definition at line 138 of file PTreeEditorWindow.cpp.

bool SimShell::Gui::PTreeEditorWindow::IsOpened ( ) const
virtual
See also
HasUnsavedChanges

Implements SimShell::Gui::HasUnsavedChanges.

Definition at line 143 of file PTreeEditorWindow.cpp.

bool SimShell::Gui::PTreeEditorWindow::OpenPath ( const QString &  edit_path)
slot

Set subtree to show in editor.

If the edit path is different from the current one, a dialog asking to apply unapplied changes will be shown.

Returns
true if path was set successfully

Definition at line 148 of file PTreeEditorWindow.cpp.

References Apply(), SimShell::Gui::PTreeView::IsClean(), SimShell::Gui::PTreeView::setModel(), and SimShell::Gui::PTreeModel::SetOnlyEditData().

Referenced by SetPTreeState().

Here is the call graph for this function:

Here is the caller graph for this function:

bool SimShell::Gui::PTreeEditorWindow::OpenPTree ( const boost::property_tree::ptree &  ,
QString const &  edit_path = "" 
)
slot

Set ptree to show in editor.

A confirmation dialog is shown if there are unapplied changes.

Returns
true if we are in opened state.

Definition at line 175 of file PTreeEditorWindow.cpp.

References SimShell::Gui::HasUnsavedChanges::SaveAndClose(), SimShell::Gui::PTreeView::setModel(), and SimShell::Gui::PTreeModel::SetOnlyEditData().

Here is the call graph for this function:

void SimShell::Gui::PTreeEditorWindow::SetOnlyEditData ( bool  b)

Set the "only edit values" option.

See also
IsOnlyEditValues()

Definition at line 195 of file PTreeEditorWindow.cpp.

References SimShell::Gui::PTreeModel::SetOnlyEditData().

Here is the call graph for this function:

void SimShell::Gui::PTreeEditorWindow::SetPTreeState ( const boost::property_tree::ptree &  )
virtual
See also
IHasPTreeState::SetPTreeState().

Implements SimShell::Gui::IHasPTreeState.

Definition at line 205 of file PTreeEditorWindow.cpp.

References OpenPath(), and SimShell::Gui::MyTreeView::SetPTreeState().

Here is the call graph for this function:


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