VR-Forces 4.2 Class Documentation
DtInformationDialogPage.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtInformationDialogPage.h,v $ $Revision: 1.2 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 
15 #include <vrvUtil/signalslib.h>
16 
18 
19 #include <vrvCoreQt/DtPage.h>
20 #include <vrvCore/DtPageConfiguration.h>
21 #include <vrvCore/DtStateView.h>
22 #include <vrvCore/DtEntityState.h>
23 #include <vrvCore/DtSimEntry.h>
24 
25 #include <vrvUtil/DtSignalConnectionManager.h>
26 
27 #include <QtGui/QTreeWidget>
28 
29 class QLabel;
30 class QVBoxLayout;
31 
32 namespace makVrv
33 {
34  class DtDe;
35  class DtPersistenceToolbarWidget;
36 }
37 
38 namespace makVrf
39 {
40  namespace makVrfGuiObjectInformationQt
41  {
42  class DtInformationDialogPageLogic;
43  class DtInformationTreeWidgetItem;
44 
46  {
47  public:
49  : myLogic(0)
50  {
51  }
52 
54  : myLogic(l)
55  {
56  }
57 
59  {
60  }
61 
62  virtual void setLogic(DtInformationDialogPageLogic* l);
63 
64  virtual QVariant value(int col, int role, const QTreeWidgetItem*,
65  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*) = 0;
66  virtual bool valueNeedsUpdate(int col, makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*) = 0;
67 
68  virtual void activate(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*)
69  {
70  }
71 
72  virtual void deactivate(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* s)
73  {
74  }
75 
76  protected:
78  makVrv::DtSignalConnectionManager myConnections;
79  };
80 
82  {
83  public:
85  virtual std::string creatorName() = 0;
86  virtual DtItemUpdateFunction* create() = 0;
87  };
88 
90  {
91  public:
94 
95  virtual std::string creatorName() { return T::creatorName(); };
96  virtual DtItemUpdateFunction* create() { return new T(); };
97  };
98 
100  {
101  Q_OBJECT
102  public:
103 
105  DtInformationDialogPage(makVrv::DtDe& de, QWidget* parent, Qt::WindowFlags f = Qt::SubWindow);
106 
108  virtual ~DtInformationDialogPage();
109 
110  virtual void setupGui();
111 
112  virtual QTreeWidget* dataItems();
113 
115  virtual void activate(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* state);
116 
118  virtual void deactivate();
119 
120  virtual void stateViewRemoved();
121 
122  virtual void updateData();
123 
124  virtual void addDataItems(const makVrv::DtPageConfiguration::PagePathList&);
125 
127  virtual void unknownDataItem(const std::string&);
128 
129  virtual const makVrv::DtPageConfiguration::PagePathList& informationItems() const
130  {
131  return myInformationItems;
132  }
133 
134  boost::signal<void ()> signal_stateViewUpdated;
135 
136  protected:
137  virtual QWidget* createPageContents();
138 
140  virtual void activate();
141 
142  protected:
144  makVrv::DtPageConfiguration::PagePathList myInformationItems;
145 
146  public:
147  makVrv::DtPersistenceToolbarWidget* myTitle;
148  QVBoxLayout* myMainLayout;
149  QVBoxLayout* myContentsLayout;
151  };
152 
154  {
155  public:
157 
158  virtual ~DtInformationDialogPageLogic();
159 
160  virtual void updateData();
161 
162  makVrv::DtDe& de()
163  {
164  return myDe;
165  }
166 
167  makVrv::DtElementID elementId() const
168  {
169  return myStateId;
170  }
171 
172  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* state()
173  {
174  return myState;
175  }
176 
177  virtual void addDataItems(const makVrv::DtPageConfiguration::PagePathList& pathList);
178 
179  public:
181  virtual void addDataItem(const std::string& name, DtItemUpdateFunction* function,
182  const std::string& before = "");
183 
185  virtual void replaceUpdateFunction(const std::string& name, DtItemUpdateFunction* function);
186 
188  virtual void removeDataItem(const std::string& name);
189 
191  virtual void activate(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* state);
192  virtual void deactivate();
193 
194  virtual void stateViewRemoved();
195 
196  protected:
197  virtual void slot_onStateViewUpdated(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>*);
198  virtual DtInformationTreeWidgetItem* createTreeWidgetItem();
199 
201  virtual void slot_onUpdateRateChanged(makVrv::DtUniqueID id, int rate);
202 
203  virtual void completeRateChange();
204  virtual void slot_onStateViewAboutToBeRemoved(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>& state);
205 
206  protected:
208  makVrv::DtDe& myDe;
209  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* myState;
210  makVrv::DtElementID myStateId;
211  std::map<std::string, DtInformationTreeWidgetItem*> myItems;
212  };
213 
215  {
216  public:
218  virtual ~DtInformationTreeWidgetItem();
219 
221  {
222  DtItemUpdateFunction* old = myUpdater;
223 
224  myUpdater = f;
225 
226  return old;
227  }
228 
229  virtual bool needsUpdate(int col) const;
230 
231  const std::string& internalName() const
232  {
233  return myInternalName;
234  }
235 
236  void setInternalName(const std::string& n)
237  {
238  myInternalName = n;
239  }
240 
241  void setState(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* s)
242  {
243  myState = s;
244  }
245 
246  void activate(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* s)
247  {
248  myUpdater->activate(s);
249  }
250 
251  void deactivate(makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* s)
252  {
253  myUpdater->deactivate(s);
254  }
255 
257  {
258  return myUpdater;
259  }
260 
261  protected:
262  virtual QVariant data(int col, int role) const;
263 
264  protected:
266  std::string myInternalName;
267  makVrv::DtStateView<makVrv::DtVrlinkSimulatedBaseState>* myState;
268  };
269  }
270 }

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)