CXpcEditorComp.h
Go to the documentation of this file.
1 #ifndef icmpstr_CXpcEditorComp_included
2 #define icmpstr_CXpcEditorComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QDir>
7 #if QT_VERSION >= 0x050000
8 #include <QtCore/QStringListModel>
9 #include <QtWidgets/QMenu>
10 #else
11 #include <QtGui/QStringListModel>
12 #include <QtGui/QMenu>
13 #endif
14 
15 // ACF includes
16 #include "icomp/CXpcModel.h"
17 #include "idoc/IDocumentManager.h"
19 
20 // ACF-Solutions includes
21 #include "GeneratedFiles/icmpstr/ui_CXpcEditorComp.h"
22 
23 
24 namespace icmpstr
25 {
26 
27 
32  public iqtgui::TDesignerGuiObserverCompBase<Ui::XpcEditorComp, icomp::CXpcModel>
33 {
34  Q_OBJECT
35 
36 public:
38 
39  I_BEGIN_COMPONENT(CXpcEditorComp);
40  I_ASSIGN(m_docMgrPtr, "DocumentManager", "An object to provide current document file name, to handle relative paths", true, "DocumentManager");
41  I_ASSIGN(m_configFileTypeInfo, "ConfigFileType", "File type description for filtering configuration files, ie. XPC", false, "ConfigFileType");
42  I_ASSIGN(m_packageFileTypeInfo, "PackageFileType", "File type description for filtering package files, ie. ARP", false, "PackageFileType");
43  I_ASSIGN(m_registryFileTypeInfo, "RegistryFileType", "File type description for filtering registry files, ie. ARX", false, "RegistryFileType");
44  I_END_COMPONENT;
45 
47 
48 protected:
49  // reimplemented (imod::IModelEditor)
50  virtual void UpdateModel() const;
51 
52  // reimplemented (iqtgui::TGuiObserverWrap)
53  virtual void UpdateGui(int updateFlags = 0);
54 
55  // reimplemented (CGuiComponentBase)
56  virtual void OnGuiCreated();
57 
58 private Q_SLOTS:
59  void on_ConfigPathAddButton_clicked();
60  void on_PackageDirAddButton_clicked();
61  void on_PackagePathAddButton_clicked();
62  void on_RegistryPathAddButton_clicked();
63  void on_ConfigPathRemoveButton_clicked();
64  void on_PackageDirRemoveButton_clicked();
65  void on_PackagePathRemoveButton_clicked();
66  void on_RegistryPathRemoveButton_clicked();
67  void on_ConfigPathBrowseButton_clicked();
68  void on_PackageDirBrowseButton_clicked();
69  void on_PackagePathBrowseButton_clicked();
70  void on_RegistryPathBrowseButton_clicked();
71 
72  // undo manager support
73  void OnDoUpdateModel();
74  void OnModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
75 
76  void OnConfigPathViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
77  void OnPackageDirViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
78  void OnPackagePathViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
79  void OnRegistryPathViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
80 
81  // navigation
82  void on_ConfigPathView_doubleClicked(const QModelIndex& index);
83  void on_RegistryPathView_doubleClicked(const QModelIndex& index);
84 
85  // update selected table row
86  void on_ConfigPathEdit_editingFinished();
87  void on_PackageDirEdit_editingFinished();
88  void on_PackagePathEdit_editingFinished();
89  void on_RegistryPathEdit_editingFinished();
90 
91  // maintain selection on lost focus
92  void on_ConfigPathEdit_selectionChanged();
93  void on_PackageDirEdit_selectionChanged();
94  void on_PackagePathEdit_selectionChanged();
95  void on_RegistryPathEdit_selectionChanged();
96 
97  void on_ConfigPathEdit_cursorPositionChanged(int oldPosition, int newPosition);
98  void on_PackageDirEdit_cursorPositionChanged(int oldPosition, int newPosition);
99  void on_PackagePathEdit_cursorPositionChanged(int oldPosition, int newPosition);
100  void on_RegistryPathEdit_cursorPositionChanged(int oldPosition, int newPosition);
101 
102  void OnInsertVariable(QAction* action);
103 
104 Q_SIGNALS:
105  void DoLateUpdateModel();
106 
107 private:
108  enum Section
109  {
110  S_CONFIG_PATH = 0,
111  S_PACKAGE_DIR,
112  S_PACKAGE_PATH,
113  S_REGISTRY_PATH,
114  S_FIRST = S_CONFIG_PATH,
115  S_LAST = S_REGISTRY_PATH
116  };
117 
121  QStringList GetStringList(int tableIdx) const;
122 
127  void SetStringList(int tableIdx, QStringList);
128 
129  QDir GetCurrentDocumentDir();
130 
138  void PickFileNameForLineEdit(
139  QLineEdit& lineEdit,
140  bool SelectDirectories = false,
141  ifile::IFileTypeInfo* typeInfo = NULL);
142 
143  // static methods
147  static void MaintainLineEditSelection(QLineEdit* lineEdit);
148 
150  QStringListModel* m_guiModel[S_LAST + 1];
151 
152  QMenu m_startVariableMenus[S_LAST + 1];
153  QMenu m_variableMenus[S_LAST + 1];
154 
163  void SetupVariablesMenu(bool isBegin, int sectionIndex, QMenu& menu);
164 
165  I_REF(idoc::IDocumentManager, m_docMgrPtr);
166  I_REF(ifile::IFileTypeInfo, m_configFileTypeInfo);
167  I_REF(ifile::IFileTypeInfo, m_packageFileTypeInfo);
168  I_REF(ifile::IFileTypeInfo, m_registryFileTypeInfo);
169 };
170 
171 
172 } // namespace icmpstr
173 
174 
175 #endif // !icmpstr_CXpcEditorComp_included
176 
177 
iqtgui::TDesignerGuiObserverCompBase< Ui::XpcEditorComp, icomp::CXpcModel > BaseClass
Editor GUI component for the XpcModel.
virtual void UpdateGui(int updateFlags=0)
virtual void UpdateModel() const
virtual void OnGuiCreated()

© 2007-2011 Witold Gantzke and Kirill Lepskiy