Tome
A generic data editor for games supporting arbitrary input and output formats.
customtypeswindow.h
1 #ifndef CUSTOMTYPESWINDOW_H
2 #define CUSTOMTYPESWINDOW_H
3 
4 #include <QMainWindow>
5 
8 class ListWindow;
9 class MapWindow;
10 
11 namespace Ui {
12  class CustomTypesWindow;
13 }
14 
15 namespace Tome
16 {
17  class CustomType;
18  class FacetsController;
19  class FieldDefinitionsController;
20  class FindUsagesController;
21  class RecordsController;
22  class TypesController;
23  class UndoController;
24 }
25 
29 class CustomTypesWindow : public QMainWindow
30 {
31  Q_OBJECT
32 
33  public:
44  explicit CustomTypesWindow(Tome::TypesController& typesController,
45  Tome::FacetsController& facetsController,
46  Tome::FieldDefinitionsController& fieldDefinitionsController,
47  Tome::FindUsagesController& findUsagesController,
48  Tome::RecordsController& recordsController,
49  Tome::UndoController& undoController,
50  QWidget *parent = 0);
52 
53  protected:
58  void showEvent(QShowEvent* event);
59 
60  private slots:
61  void on_actionNew_Derived_Type_triggered();
62  void on_actionNew_Custom_Type_triggered();
63  void on_actionNew_List_triggered();
64  void on_actionNew_Map_triggered();
65 
66  void on_actionEdit_Custom_Type_triggered();
67  void on_actionDelete_Custom_Type_triggered();
68 
69  void on_actionFind_Usages_triggered();
70 
71  void on_tableWidget_doubleClicked(const QModelIndex &index);
72 
73  void onTypeAdded(const Tome::CustomType& type);
74  void onTypeRemoved(const Tome::CustomType& type);
75  void onTypeUpdated(const Tome::CustomType& type);
76 
77  private:
78  Ui::CustomTypesWindow *ui;
79 
80  Tome::TypesController& typesController;
81  Tome::FacetsController& facetsController;
82  Tome::FieldDefinitionsController& fieldDefinitionsController;
83  Tome::FindUsagesController& findUsagesController;
84  Tome::RecordsController& recordsController;
85  Tome::UndoController& undoController;
86 
87  DerivedTypeWindow* derivedTypeWindow;
88  EnumerationWindow* enumerationWindow;
89  ListWindow* listWindow;
90  MapWindow* mapWindow;
91 
92  int getSelectedTypeIndex() const;
93  QString getSelectedTypeName() const;
94 
95  void editDerivedType(QString typeName, const Tome::CustomType& type);
96  void editEnumeration(QString typeName, const Tome::CustomType& type);
97  void editList(QString typeName, const Tome::CustomType& type);
98  void editMap(QString typeName, const Tome::CustomType& type);
99 
100  void updateDerivedType(const QString& oldName, const QString& newName, const QString& baseType, const QVariantMap facets, const QString& typeSetName);
101  void updateEnumeration(const QString& oldName, const QString& newName, const QStringList& enumeration, const QString& typeSetName);
102  void updateList(const QString& oldName, const QString& name, const QString& itemType, const QString& typeSetName);
103  void updateMap(const QString& oldName, const QString& newName, const QString& keyType, const QString& valueType, const QString& typeSetName);
104 
105  void updateRow(const int index, const Tome::CustomType& type);
106  void updateTable();
107 };
108 
109 #endif // CUSTOMTYPESWINDOW_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
Window for adding a new map type or editing an existing one.
Definition: mapwindow.h:18
Definition: mainwindow.h:25
Window for adding a new enumeration or editing an existing one.
Definition: enumerationwindow.h:20
Controller for adding, updating and removing custom types.
Definition: typescontroller.h:14
Window for adding a new list type or editing an existing one.
Definition: listwindow.h:19
User-defined type of any field.
Definition: customtype.h:14
Controller for validating type facets.
Definition: facetscontroller.h:16
Window for adding and removing custom types.
Definition: customtypeswindow.h:29
Controller for performing undo-able commands.
Definition: undocontroller.h:13
Window for adding a new derived type or editing an existing one.
Definition: derivedtypewindow.h:20