32 PTreeContainer::PTreeContainer(QString
const & title,
QWidget* parent)
33 :
QWidget(parent), HasUnsavedChanges(title.toStdString()), m_opened(false), m_title(title)
35 m_window =
new PTreeEditorWindow();
36 m_window->setWindowTitle(m_title);
37 m_dock =
new MyDockWidget(
nullptr);
38 m_dock->setWindowTitle(m_title);
39 m_dock->setWidget(m_window);
40 m_menu =
new PTreeMenu(m_title, QString(),
nullptr);
42 connect(m_menu, SIGNAL(ItemTriggered(QString
const &)),
this, SLOT(OpenPath(QString
const &)));
43 connect(m_window, SIGNAL(ApplyTriggered(boost::property_tree::ptree
const &)),
this, SLOT(RefreshMenu(boost::property_tree::ptree
const &)));
44 connect(m_window, SIGNAL(ApplyTriggered(boost::property_tree::ptree
const &)),
this, SIGNAL(Applied(boost::property_tree::ptree
const &)));
45 connect(m_window, SIGNAL(StatusChanged(QString
const &)),
this, SIGNAL(StatusChanged(QString
const &)));
53 PTreeContainer::~PTreeContainer()
65 std::string PTreeContainer::GetEditPath()
const
67 return m_window->GetEditPath();
75 ptree PTreeContainer::GetPTreeState()
const
78 result.put_child(
"editor_window", m_window->GetPTreeState());
79 result.put_child(
"dock", m_dock->GetPTreeState());
83 void PTreeContainer::InternalForceClose()
86 m_dock->setWindowTitle(m_title);
89 bool PTreeContainer::InternalIsClean()
const
94 bool PTreeContainer::InternalSave()
99 bool PTreeContainer::IsOpened()
const
104 bool PTreeContainer::Open(boost::property_tree::ptree
const & pt, QString
const & edit_path)
106 if (m_window->OpenPTree(pt, edit_path))
109 m_dock->setWindowTitle(m_title +
": " + edit_path);
116 void PTreeContainer::OpenPath(QString
const & path)
118 m_window->OpenPath(path);
120 m_dock->setWindowTitle(m_title +
": " + path);
123 void PTreeContainer::Redo() {
127 void PTreeContainer::RefreshMenu(boost::property_tree::ptree
const & pt)
129 m_menu->OpenPTree(pt);
132 void PTreeContainer::SetPTreeState(
const ptree& state)
134 auto editor_window_state = state.get_child_optional(
"editor_window");
135 if (editor_window_state)
136 m_window->SetPTreeState(editor_window_state.get());
138 auto dock_state = state.get_child_optional(
"dock");
140 m_dock->SetPTreeState(dock_state.get());
144 void PTreeContainer::SetOnlyEditData(
bool b)
146 m_window->SetOnlyEditData(b);
149 void PTreeContainer::Undo() {
see the online Qt documentation
Interface for PTreeEditorWindow.
A menu reflecting the structure of a ptree.
see the online Qt documentation
bool OpenPTree(boost::property_tree::ptree const &pt, int depth=-1)
Open a ptree.
Namespace for generic graphical shell for simulators.
Interface for PTreeContainer.