VPTissue Reference Manual
PTreeEditor.h
Go to the documentation of this file.
1 #ifndef MAIN_PTREE_EDITOR_H_INCLUDED
2 #define MAIN_PTREE_EDITOR_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
23 
24 #include <boost/property_tree/ptree.hpp>
25 #include <QMainWindow>
26 #include <string>
27 
28 class QTabWidget;
29 class QMenu;
30 class QStatusBar;
31 class QToolBar;
32 
33 namespace SimShell {
34 namespace Gui {
35 
36 class MyFindDialog;
37 class PTreeView;
38 class PTreeModel;
39 
40 } // namespace Gui
41 } // namespace SimShell
42 
43 namespace SimPT_Shell {
44 namespace Gui {
45 
46 using namespace SimShell::Gui;
47 
52 {
53  Q_OBJECT
54 public:
55  PTreeEditor(QWidget* parent = 0);
56  virtual ~PTreeEditor() {}
57 
64  bool OpenPath(std::string const & path);
65 
72  bool SavePath(std::string const & path);
73 
75  virtual bool IsOpened() const;
76 
77 private slots:
83  void SLOT_Save();
84 
89  void SLOT_PromptClose();
90 
94  void SLOT_New();
95 
99  void SLOT_OpenDialog();
100 
105  bool SLOT_SaveAsDialog();
106 
110  void SLOT_SetFullscreenMode(bool);
111 
115  void SLOT_AboutDialog();
116 
120  void SLOT_SetClean(bool);
121 
122 protected:
129  virtual void closeEvent(QCloseEvent *event);
130 
132  virtual void InternalForceClose();
133 
135  virtual bool InternalIsClean() const;
136 
138  virtual bool InternalSave();
139 
140 private:
141  QAction* action_new;
142  QAction* action_open;
143  QAction* action_save;
144  QAction* action_save_as;
145  QAction* action_close;
146  QAction* action_quit;
147  QAction* action_view_toolbar;
148  QAction* action_view_statusbar;
149  QAction* action_fullscreen;
150  QAction* action_about;
151 
152  QToolBar* toolbar;
153  QStatusBar* statusbar;
154 
155  std::string opened_path; // empty but ptree_model != 0 means an untitled new file is opened.
156  PTreeView* ptree_view;
157  PTreeModel* ptree_model; // 0 if app is in unopened state
158 
159  boost::property_tree::ptree root_pt;
160  std::string subtree_key;
161 
162  static const QString g_caption;
163  static const QString g_caption_with_file;
164 };
165 
166 } // namespace
167 } // namespace
168 
169 #endif // end_of_inclde_guard
HasUnsavedChanges with the ability of displaying a "save-discard-cancel" dialog to the user before cl...
Namespace for SimPT shell package.
Definition: Client.cpp:50
Namespace for graphical interface classes.
Qt model reflecting hierarchical structure of a ptree.
Definition: PTreeModel.h:37
see the online Qt documentation
TreeView widget that presents an editable ptree to the user.
Definition: PTreeView.h:37
see the online Qt documentation
see the online Qt documentation
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
Stand-alone Property Tree editor.
Definition: PTreeEditor.h:51
HasUnsavedChangesPrompt interface.