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 (iqtgui::TGuiObserverWrap)
50  virtual void UpdateModel() const;
51  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
52 
53  // reimplemented (CGuiComponentBase)
54  virtual void OnGuiCreated();
55 
56 private Q_SLOTS:
57  void on_ConfigPathAddButton_clicked();
58  void on_PackageDirAddButton_clicked();
59  void on_PackagePathAddButton_clicked();
60  void on_RegistryPathAddButton_clicked();
61  void on_ConfigPathRemoveButton_clicked();
62  void on_PackageDirRemoveButton_clicked();
63  void on_PackagePathRemoveButton_clicked();
64  void on_RegistryPathRemoveButton_clicked();
65  void on_ConfigPathBrowseButton_clicked();
66  void on_PackageDirBrowseButton_clicked();
67  void on_PackagePathBrowseButton_clicked();
68  void on_RegistryPathBrowseButton_clicked();
69 
70  // undo manager support
71  void OnDoUpdateModel();
72  void OnModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
73 
74  void OnConfigPathViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
75  void OnPackageDirViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
76  void OnPackagePathViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
77  void OnRegistryPathViewSelected(const QItemSelection& selected, const QItemSelection& deselected);
78 
79  // navigation
80  void on_ConfigPathView_doubleClicked(const QModelIndex& index);
81  void on_RegistryPathView_doubleClicked(const QModelIndex& index);
82 
83  // update selected table row
84  void on_ConfigPathEdit_editingFinished();
85  void on_PackageDirEdit_editingFinished();
86  void on_PackagePathEdit_editingFinished();
87  void on_RegistryPathEdit_editingFinished();
88 
89  // maintain selection on lost focus
90  void on_ConfigPathEdit_selectionChanged();
91  void on_PackageDirEdit_selectionChanged();
92  void on_PackagePathEdit_selectionChanged();
93  void on_RegistryPathEdit_selectionChanged();
94 
95  void on_ConfigPathEdit_cursorPositionChanged(int oldPosition, int newPosition);
96  void on_PackageDirEdit_cursorPositionChanged(int oldPosition, int newPosition);
97  void on_PackagePathEdit_cursorPositionChanged(int oldPosition, int newPosition);
98  void on_RegistryPathEdit_cursorPositionChanged(int oldPosition, int newPosition);
99 
100  void OnInsertVariable(QAction* action);
101 
102 Q_SIGNALS:
103  void DoLateUpdateModel();
104 
105 private:
106  enum Section
107  {
108  S_CONFIG_PATH = 0,
109  S_PACKAGE_DIR,
110  S_PACKAGE_PATH,
111  S_REGISTRY_PATH,
112  S_FIRST = S_CONFIG_PATH,
113  S_LAST = S_REGISTRY_PATH
114  };
115 
119  QStringList GetStringList(int tableIdx) const;
120 
125  void SetStringList(int tableIdx, QStringList);
126 
127  QDir GetCurrentDocumentDir();
128 
136  void PickFileNameForLineEdit(
137  QLineEdit& lineEdit,
138  bool SelectDirectories = false,
139  ifile::IFileTypeInfo* typeInfo = NULL);
140 
149  void SetupVariablesMenu(bool isBegin, int sectionIndex, QMenu& menu);
150 
151  // static methods
155  static void MaintainLineEditSelection(QLineEdit* lineEdit);
156 
157  QStringListModel* m_guiModel[S_LAST + 1]; // MVC models to handle data lists for tables
158  QMenu m_startVariableMenus[S_LAST + 1];
159  QMenu m_variableMenus[S_LAST + 1];
160 
161  I_REF(idoc::IDocumentManager, m_docMgrPtr);
162  I_REF(ifile::IFileTypeInfo, m_configFileTypeInfo);
163  I_REF(ifile::IFileTypeInfo, m_packageFileTypeInfo);
164  I_REF(ifile::IFileTypeInfo, m_registryFileTypeInfo);
165 };
166 
167 
168 } // namespace icmpstr
169 
170 
171 #endif // !icmpstr_CXpcEditorComp_included
172 
173 
iqtgui::TDesignerGuiObserverCompBase< Ui::XpcEditorComp, icomp::CXpcModel > BaseClass
Editor GUI component for the XpcModel.
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
virtual void UpdateModel() const
virtual void OnGuiCreated()

© 2007-2017 Witold Gantzke and Kirill Lepskiy