![]() |
Tome
A generic data editor for games supporting arbitrary input and output formats.
|
Controller for creating, loading and saving projects. More...
#include <projectcontroller.h>
Signals | |
| void | progressChanged (const QString title, const QString text, const int currentValue, const int maximumValue) |
| Progress of the current project operation has changed. More... | |
| void | projectChanged (QSharedPointer< Tome::Project > project) |
| Current project has changed (e.g. newly created or loaded from disk). More... | |
Public Member Functions | |
| ProjectController () | |
| Constructs a new controller for creating, loading and saving projects. | |
| QString | buildFullFilePath (QString filePath, QString projectPath, QString desiredExtension) const |
| Ensures the specified file path is an absolute file path with the passed extension. More... | |
| void | createProject (const QString &projectName, const QString &projectPath, const Tome::RecordIdType::RecordIdType recordIdType) |
| Creates a new project with the specified name and path and saves it to disk. More... | |
| const QString | getFullProjectPath () const |
| Gets the absolute path of the current project, including project file name and extension. More... | |
| const QString | getProjectName () const |
| Gets the name of the current project. More... | |
| const QString | getProjectPath () const |
| Gets the absolute path of the current project, without project file name. More... | |
| RecordIdType::RecordIdType | getProjectRecordIdType () const |
| Gets the type of the ids of the records of the current project. More... | |
| bool | getProjectIgnoreReadOnly () const |
| Checks whether the current project allows to modify read-only data. More... | |
| bool | hasComponentSet (const QString &componentSetName) const |
| Checks whether a component set with the specified name has already been added to the project. More... | |
| bool | hasCustomTypeSet (const QString &customTypeSetName) const |
| Checks whether a custom type set with the specified name has already been added to the project. More... | |
| bool | hasExportTemplate (const QString &exportTemplatePath) const |
| Checks whether an export template with the specified path has already been added to the project. More... | |
| bool | hasFieldDefinitionSet (const QString &fieldDefinitionSetName) const |
| Checks whether a field definition set with the specified name has already been added to the project. More... | |
| bool | hasImportTemplate (const QString &importTemplatePath) const |
| Checks whether an import template with the specified path has already been added to the project. More... | |
| bool | hasRecordSet (const QString &recordSetName) const |
| Checks whether a record set with the specified name has already been added to the project. More... | |
| bool | isProjectLoaded () const |
| Checks whether any project is loaded. More... | |
| void | loadComponentSet (const QString &projectPath, ComponentSet &componentSet) const |
| Loads the specified component set from disk. More... | |
| void | loadCustomTypeSet (const QString &projectPath, CustomTypeSet &customTypeSet) const |
| Loads the specified custom type set from disk. More... | |
| void | loadExportTemplate (const QString &projectPath, RecordExportTemplate &exportTemplate) const |
| Loads the specified export template from disk. More... | |
| void | loadFieldDefinitionSet (const QString &projectPath, FieldDefinitionSet &fieldDefinitionSet) const |
| Loads the specified field definition set from disk. More... | |
| void | loadImportTemplate (const QString &projectPath, RecordTableImportTemplate &importTemplate) const |
| Loads the specified import template set from disk. More... | |
| void | loadRecordSet (const QString &projectPath, RecordSet &recordSet) const |
| Loads the specified record set set from disk. More... | |
| void | openProject (const QString &projectFileName) |
| Opens the specified project file. More... | |
| void | saveProject () const |
| Saves the current project to disk, including all data and templates. More... | |
Static Public Attributes | |
| static const QString | ComponentFileExtension = ".tcomp" |
| File extension of Tome component files, including the dot. | |
| static const QString | FieldDefinitionFileExtension = ".tfields" |
| File extension of Tome field definition files, including the dot. | |
| static const QString | ProjectFileExtension = ".tproj" |
| File extension of Tome project files, including the dot. | |
| static const QString | RecordExportComponentDelimiterExtension = ".texportcd" |
| File extension of Tome record export component delimiter files, including the dot. | |
| static const QString | RecordExportComponentTemplateExtension = ".texportc" |
| File extension of Tome record export component template files, including the dot. | |
| static const QString | RecordExportFieldValueTemplateExtension = ".texportv" |
| File extension of Tome record export field value template files, including the dot. | |
| static const QString | RecordExportFieldValueDelimiterExtension = ".texportvd" |
| File extension of Tome record export field value delimiter files, including the dot. | |
| static const QString | RecordExportListTemplateExtension = ".texportl" |
| File extension of Tome record export list template files, including the dot. | |
| static const QString | RecordExportListItemTemplateExtension = ".texportli" |
| File extension of Tome record export list item template files, including the dot. | |
| static const QString | RecordExportListItemDelimiterExtension = ".texportld" |
| File extension of Tome record export list item delimiter files, including the dot. | |
| static const QString | RecordExportLocalizedFieldValueTemplateExtension = ".texportvloc" |
| File extension of Tome record export localized field value template files, including the dot. | |
| static const QString | RecordExportMapTemplateExtension = ".texportm" |
| File extension of Tome record export map template files, including the dot. | |
| static const QString | RecordExportMapItemTemplateExtension = ".texportmi" |
| File extension of Tome record export map item template files, including the dot. | |
| static const QString | RecordExportMapItemDelimiterExtension = ".texportmd" |
| File extension of Tome record export map item delimiter files, including the dot. | |
| static const QString | RecordExportRecordFileTemplateExtension = ".texportf" |
| File extension of Tome record export record file template files, including the dot. | |
| static const QString | RecordExportRecordTemplateExtension = ".texportr" |
| File extension of Tome record export record template files, including the dot. | |
| static const QString | RecordExportRecordDelimiterExtension = ".texportrd" |
| File extension of Tome record export record delimiter files, including the dot. | |
| static const QString | RecordExportTemplateFileExtension = ".texport" |
| File extension of Tome record export template files, including the dot. | |
| static const QString | RecordFileExtension = ".tdata" |
| File extension of Tome record files, including the dot. | |
| static const QString | RecordImportTemplateFileExtension = ".timport" |
| File extension of Tome import template files, including the dot. | |
| static const QString | TypeFileExtension = ".ttypes" |
| File extension of Tome type files, including the dot. | |
Controller for creating, loading and saving projects.
| QString ProjectController::buildFullFilePath | ( | QString | filePath, |
| QString | projectPath, | ||
| QString | desiredExtension | ||
| ) | const |
Ensures the specified file path is an absolute file path with the passed extension.
| filePath | File path to convert. |
| projectPath | Absolute path to the current project, without file name. |
| desiredExtension | File extension to add, if missing. |
| void ProjectController::createProject | ( | const QString & | projectName, |
| const QString & | projectPath, | ||
| const Tome::RecordIdType::RecordIdType | recordIdType | ||
| ) |
Creates a new project with the specified name and path and saves it to disk.
| projectName | Name of the project to create. |
| projectPath | Path to write the project files to. |
| recordIdType | Type of the ids of the records of the new project. |
| const QString ProjectController::getFullProjectPath | ( | ) | const |
Gets the absolute path of the current project, including project file name and extension.
| bool ProjectController::getProjectIgnoreReadOnly | ( | ) | const |
Checks whether the current project allows to modify read-only data.
| const QString ProjectController::getProjectName | ( | ) | const |
Gets the name of the current project.
| const QString ProjectController::getProjectPath | ( | ) | const |
Gets the absolute path of the current project, without project file name.
| RecordIdType::RecordIdType ProjectController::getProjectRecordIdType | ( | ) | const |
Gets the type of the ids of the records of the current project.
| bool ProjectController::hasComponentSet | ( | const QString & | componentSetName | ) | const |
Checks whether a component set with the specified name has already been added to the project.
| componentSetName | Name of the component set to check. |
| bool ProjectController::hasCustomTypeSet | ( | const QString & | customTypeSetName | ) | const |
Checks whether a custom type set with the specified name has already been added to the project.
| customTypeSetName | Name of the custom type set to check. |
| bool ProjectController::hasExportTemplate | ( | const QString & | exportTemplatePath | ) | const |
Checks whether an export template with the specified path has already been added to the project.
| exportTemplatePath | Path of the export template to check. |
| bool ProjectController::hasFieldDefinitionSet | ( | const QString & | fieldDefinitionSetName | ) | const |
Checks whether a field definition set with the specified name has already been added to the project.
| fieldDefinitionSetName | Name of the field definition set to check. |
| bool ProjectController::hasImportTemplate | ( | const QString & | importTemplatePath | ) | const |
Checks whether an import template with the specified path has already been added to the project.
| importTemplatePath | Path of the import template to check. |
| bool ProjectController::hasRecordSet | ( | const QString & | recordSetName | ) | const |
Checks whether a record set with the specified name has already been added to the project.
| recordSetName | Name of the record set to check. |
| bool ProjectController::isProjectLoaded | ( | ) | const |
Checks whether any project is loaded.
| void ProjectController::loadComponentSet | ( | const QString & | projectPath, |
| ComponentSet & | componentSet | ||
| ) | const |
Loads the specified component set from disk.
| std::runtime_error | if the component set file could not be read. |
| projectPath | Absolute path to the project, without file name. |
| componentSet | Component set to load from disk. |
| void ProjectController::loadCustomTypeSet | ( | const QString & | projectPath, |
| CustomTypeSet & | customTypeSet | ||
| ) | const |
Loads the specified custom type set from disk.
| std::runtime_error | if the custom type set file could not be read. |
| projectPath | Absolute path to the project, without file name. |
| customTypeSet | Custom type set to load from disk. |
| void ProjectController::loadExportTemplate | ( | const QString & | projectPath, |
| RecordExportTemplate & | exportTemplate | ||
| ) | const |
Loads the specified export template from disk.
| std::runtime_error | if any of the export template files could not be read. |
| projectPath | Absolute path to the project, without file name. |
| exportTemplate | Export template to load from disk. |
| void ProjectController::loadFieldDefinitionSet | ( | const QString & | projectPath, |
| FieldDefinitionSet & | fieldDefinitionSet | ||
| ) | const |
Loads the specified field definition set from disk.
| std::runtime_error | if the field definition set file could not be read. |
| projectPath | Absolute path to the project, without file name. |
| fieldDefinitionSet | Field definition set to load from disk. |
| void ProjectController::loadImportTemplate | ( | const QString & | projectPath, |
| RecordTableImportTemplate & | importTemplate | ||
| ) | const |
Loads the specified import template set from disk.
| std::runtime_error | if the import template file could not be read. |
| projectPath | Absolute path to the project, without file name. |
| importTemplate | Import template to load from disk. |
| void ProjectController::loadRecordSet | ( | const QString & | projectPath, |
| RecordSet & | recordSet | ||
| ) | const |
Loads the specified record set set from disk.
| std::runtime_error | if the record set file could not be read. |
| projectPath | Absolute path to the project, without file name. |
| recordSet | Record set to load from disk. |
| void ProjectController::openProject | ( | const QString & | projectFileName | ) |
Opens the specified project file.
| std::runtime_error | if the project file could not be read. |
| projectFileName | Name of the project file to open. |
|
signal |
Progress of the current project operation has changed.
| title | Title of the current project operation step. |
| text | Details of the current project operation step. |
| currentValue | Current progress value of the current project operation step. |
| maximumValue | Maximum progress value of the current project operation step. |
|
signal |
Current project has changed (e.g. newly created or loaded from disk).
| project | Current project. |
| void ProjectController::saveProject | ( | ) | const |
Saves the current project to disk, including all data and templates.
| std::runtime_error | if any of the project files could not be written. |
1.8.13