Tome
A generic data editor for games supporting arbitrary input and output formats.
exportcontroller.h
1 #ifndef EXPORTCONTROLLER_H
2 #define EXPORTCONTROLLER_H
3 
4 #include <QIODevice>
5 #include <QString>
6 
7 #include "../Model/recordexporttemplatelist.h"
8 #include "../Model/recordexporttemplatemap.h"
9 
10 namespace Tome
11 {
12  class FacetsController;
13  class FieldDefinitionsController;
14  class RecordsController;
15  class TypesController;
16 
20  class ExportController : public QObject
21  {
22  Q_OBJECT
23 
24  public:
32  ExportController(const FacetsController& facetsController,
33  const FieldDefinitionsController& fieldDefinitionsController,
34  const RecordsController& recordsController,
35  const TypesController& typesController);
36 
41  void addRecordExportTemplate(const RecordExportTemplate& exportTemplate);
42 
53  const RecordExportTemplate getRecordExportTemplate(const QString& name) const;
54 
59  const RecordExportTemplateList getRecordExportTemplates() const;
60 
66  bool hasRecordExportTemplate(const QString& name) const;
67 
76  void exportRecords(const RecordExportTemplate& exportTemplate, const QString& filePath) const;
77 
83  void exportRecords(const RecordExportTemplate& exportTemplate, QIODevice& device) const;
84 
90  bool removeExportTemplate(const QString& name);
91 
96  void setRecordExportTemplates(RecordExportTemplateList& exportTemplates);
97 
98  signals:
102  void exportTemplatesChanged();
103 
111  void progressChanged(const QString title, const QString text, const int currentValue, const int maximumValue) const;
112 
113  private:
114  RecordExportTemplateList* model;
115 
116  static const QString PlaceholderAppVersion;
117  static const QString PlaceholderAppVersionName;
118  static const QString PlaceholderComponents;
119  static const QString PlaceholderComponentName;
120  static const QString PlaceholderExportTime;
121  static const QString PlaceholderFieldComponent;
122  static const QString PlaceholderFieldDescription;
123  static const QString PlaceholderFieldDisplayName;
124  static const QString PlaceholderFieldId;
125  static const QString PlaceholderFieldKey;
126  static const QString PlaceholderFieldType;
127  static const QString PlaceholderFieldValue;
128  static const QString PlaceholderHash;
129  static const QString PlaceholderItemType;
130  static const QString PlaceholderKeyType;
131  static const QString PlaceholderListItem;
132  static const QString PlaceholderRecordDisplayName;
133  static const QString PlaceholderRecordFields;
134  static const QString PlaceholderRecordId;
135  static const QString PlaceholderRecordParentId;
136  static const QString PlaceholderRecordRootId;
137  static const QString PlaceholderRecords;
138  static const QString PlaceholderValueType;
139 
140  const FacetsController& facetsController;
141  const FieldDefinitionsController& fieldDefinitionsController;
142  const RecordsController& recordsController;
143  const TypesController& typesController;
144  };
145 }
146 
147 #endif // EXPORTCONTROLLER_H
Definition: commandlineoptions.h:6
Controller for adding, updating and removing field definitions.
Definition: fielddefinitionscontroller.h:15
Controller for exporting records using templates.
Definition: exportcontroller.h:20
const RecordExportTemplate getRecordExportTemplate(const QString &name) const
Gets the record export template with the specified name.
Definition: exportcontroller.cpp:68
Controller for adding, updating and removing records.
Definition: recordscontroller.h:21
const RecordExportTemplateList getRecordExportTemplates() const
Gets a list of all available record export templates of the project.
Definition: exportcontroller.cpp:85
Template for exporting record data.
Definition: recordexporttemplate.h:12
void exportTemplatesChanged()
Available record export templates have changed.
void exportRecords(const RecordExportTemplate &exportTemplate, const QString &filePath) const
Exports all records using the passed export template to a file at the specified path.
Definition: exportcontroller.cpp:105
Controller for adding, updating and removing custom types.
Definition: typescontroller.h:14
void setRecordExportTemplates(RecordExportTemplateList &exportTemplates)
Uses the specified list of record export templates as model for this controller.
Definition: exportcontroller.cpp:597
bool hasRecordExportTemplate(const QString &name) const
Checks whether the project has a record export template with the specified name.
Definition: exportcontroller.cpp:90
Controller for validating type facets.
Definition: facetscontroller.h:16
void addRecordExportTemplate(const RecordExportTemplate &exportTemplate)
Adds a new template for exporting records to the project.
Definition: exportcontroller.cpp:57
ExportController(const FacetsController &facetsController, const FieldDefinitionsController &fieldDefinitionsController, const RecordsController &recordsController, const TypesController &typesController)
Constructs a new controller for exporting records using templates.
Definition: exportcontroller.cpp:46
bool removeExportTemplate(const QString &name)
Removes the record export template with the specified name from the project.
Definition: exportcontroller.cpp:575
void progressChanged(const QString title, const QString text, const int currentValue, const int maximumValue) const
Progress of the current record export operation has changed.