Tome
A generic data editor for games supporting arbitrary input and output formats.
fielddefinitionwindow.h
1 #ifndef FIELDDEFINITIONWINDOW_H
2 #define FIELDDEFINITIONWINDOW_H
3 
4 #include <QDialog>
5 #include <QList>
6 
7 #include "../../Components/Model/component.h"
8 
9 
10 namespace Ui {
12 }
13 
14 namespace Tome
15 {
16  class ComponentsController;
17  class FacetsController;
18  class FieldDefinitionsController;
19  class FieldValueWidget;
20  class ProjectController;
21  class RecordsController;
22  class TypesController;
23 }
24 
28 class FieldDefinitionWindow : public QDialog
29 {
30  Q_OBJECT
31 
32  public:
43  explicit FieldDefinitionWindow(Tome::FieldDefinitionsController& fieldDefinitionsController,
44  Tome::ComponentsController& componentsController,
45  Tome::FacetsController& facetsController,
46  Tome::ProjectController& projectController,
47  Tome::RecordsController& recordsController,
48  Tome::TypesController& typesController,
49  QWidget* parent = 0);
51 
56  Tome::Component getFieldComponent() const;
57 
62  QString getFieldDefinitionSetName() const;
63 
68  QString getFieldDescription() const;
69 
74  QString getFieldDisplayName() const;
75 
80  QString getFieldId() const;
81 
86  QVariant getDefaultValue() const;
87 
92  QString getFieldType() const;
93 
97  void init();
98 
103  void setFieldComponent(const QString& component) const;
104 
109  void setFieldDefinitionSetName(const QString& fieldDefinitionSetName);
110 
115  void setFieldDefinitionSetNames(const QStringList& fieldDefinitionSetNames);
116 
121  void setFieldDescription(const QString& description);
122 
127  void setFieldDisplayName(const QString& displayName);
128 
133  void setFieldId(const QString& fieldId);
134 
139  void setDefaultValue(const QVariant& defaultValue);
140 
145  void setFieldType(const QString& fieldType) const;
146 
147  public slots:
151  void accept();
152 
153  protected:
158  void showEvent(QShowEvent* event);
159 
160  private slots:
161  void on_comboBoxType_currentIndexChanged(const QString &fieldType);
162  void on_lineEditDisplayName_textEdited(const QString &displayName);
163 
164  private:
165  static const int DefaultFormRows;
166  static const int ValueFormRow;
167 
168  Ui::FieldDefinitionWindow *ui;
169  Tome::FieldDefinitionsController& fieldDefinitionsController;
170  Tome::ComponentsController& componentsController;
171  Tome::FacetsController& facetsController;
172  Tome::ProjectController& projectController;
173  Tome::RecordsController& recordsController;
174  Tome::TypesController& typesController;
175 
176  Tome::FieldValueWidget* fieldValueWidget;
177 
178  bool validate();
179 };
180 
181 #endif // FIELDDEFINITIONWINDOW_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
Definition: mainwindow.h:25
Controller for adding and removing components.
Definition: componentscontroller.h:15
Changes its appearance depending on the specified type.
Definition: fieldvaluewidget.h:35
Controller for adding, updating and removing custom types.
Definition: typescontroller.h:14
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 creating, loading and saving projects.
Definition: projectcontroller.h:22