Tome
A generic data editor for games supporting arbitrary input and output formats.
fielddefinitionswindow.h
1 #ifndef FIELDDEFINITIONSWINDOW_H
2 #define FIELDDEFINITIONSWINDOW_H
3 
4 #include <QItemSelection>
5 #include <QMainWindow>
6 
7 #include "../../Components/Model/component.h"
8 
10 
11 namespace Ui {
13 }
14 
15 namespace Tome
16 {
17  class ComponentsController;
18  class FacetsController;
19  class FieldDefinition;
20  class FieldDefinitionsController;
21  class FindUsagesController;
22  class ProjectController;
23  class RecordsController;
24  class TypesController;
25  class UndoController;
26 }
27 
31 class FieldDefinitionsWindow : public QMainWindow
32 {
33  Q_OBJECT
34 
35  public:
48  explicit FieldDefinitionsWindow(
49  Tome::FieldDefinitionsController& fieldDefinitionsController,
50  Tome::ComponentsController& componentsController,
51  Tome::FacetsController& facetsController,
52  Tome::FindUsagesController& findUsagesController,
53  Tome::ProjectController& projectController,
54  Tome::RecordsController& recordsController,
55  Tome::TypesController& typesController,
56  Tome::UndoController& undoController,
57  QWidget* parent = 0);
59 
60  signals:
65  void fieldChanged(const QString fieldId);
66 
67  protected:
72  void showEvent(QShowEvent* event);
73 
74  private slots:
75  void on_actionNew_Field_triggered();
76  void on_actionEdit_Field_triggered();
77  void on_actionDelete_Field_triggered();
78 
79  void on_actionFind_Usages_triggered();
80 
81  void on_tableWidget_doubleClicked(const QModelIndex &index);
82 
83  void onFieldDefinitionAdded(const Tome::FieldDefinition& fieldDefinition);
84  void onFieldDefinitionRemoved(const Tome::FieldDefinition& fieldDefinition);
85  void onFieldDefinitionUpdated(const Tome::FieldDefinition& oldFieldDefinition, const Tome::FieldDefinition& newFieldDefinition);
86 
87  void tableWidgetSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
88 
89  private:
90  Ui::FieldDefinitionsWindow *ui;
91 
92  Tome::FieldDefinitionsController& fieldDefinitionsController;
93  Tome::ComponentsController& componentsController;
94  Tome::FacetsController& facetsController;
95  Tome::FindUsagesController& findUsagesController;
96  Tome::ProjectController& projectController;
97  Tome::RecordsController& recordsController;
98  Tome::TypesController& typesController;
99  Tome::UndoController& undoController;
100 
101  FieldDefinitionWindow* fieldDefinitionWindow;
102 
103  int getFieldRow(const QString& fieldId) const;
104  QString getSelectedFieldId() const;
105 
106  void updateTable();
107  void updateMenus();
108 
109  void updateFieldDefinition(
110  const QString oldId,
111  const QString newId,
112  const QString& displayName,
113  const QString& fieldType,
114  const QVariant& defaultValue,
115  const QString& description,
116  const Tome::Component& component,
117  const QString& fieldDefinitionSetName);
118  void updateRow(const int index, const Tome::FieldDefinition& fieldDefinition, bool disableSorting);
119 };
120 
121 #endif // FIELDDEFINITIONSWINDOW_H
Definition: commandlineoptions.h:6
Controller for adding, updating and removing field definitions.
Definition: fielddefinitionscontroller.h:15
Controller for adding, updating and removing records.
Definition: recordscontroller.h:21
Controller for finding usages of fields, records and custom types.
Definition: findusagescontroller.h:17
Definition: mainwindow.h:25
Controller for adding and removing components.
Definition: componentscontroller.h:15
Field that can be added to a record to hold data.
Definition: fielddefinition.h:15
Controller for adding, updating and removing custom types.
Definition: typescontroller.h:14
Window for adding and removing field definitions.
Definition: fielddefinitionswindow.h:31
Window for adding a new field definition or editing an existing one.
Definition: fielddefinitionwindow.h:28
Controller for validating type facets.
Definition: facetscontroller.h:16
Controller for performing undo-able commands.
Definition: undocontroller.h:13
Controller for creating, loading and saving projects.
Definition: projectcontroller.h:22