![]() |
Tome
A generic data editor for games supporting arbitrary input and output formats.
|
Controller for adding, updating and removing records. More...
#include <recordscontroller.h>
Signals | |
| void | progressChanged (const QString title, const QString text, const int currentValue, const int maximumValue) |
| Progress of the current record operation has changed. More... | |
| void | recordAdded (const QVariant &recordId, const QString &recordDisplayName, const QVariant &parentId) |
| A new record has been added to the project. More... | |
| void | recordFieldsChanged (const QVariant &recordId) |
| A new field has been added to a record, or one of its fields has been updated or removed. More... | |
| void | recordRemoved (const QVariant &recordId) |
| A record has been removed from the project. More... | |
| void | recordReparented (const QVariant &recordId, const QVariant &oldParentId, const QVariant &newParentId) |
| The parent of a record has changed. More... | |
| void | recordUpdated (const QVariant &oldId, const QString &oldDisplayName, const QString &oldEditorIconFieldId, const QVariant &newId, const QString &newDisplayName, const QString &newEditorIconFieldId) |
| The properties of a record have been updated. More... | |
| void | recordSetsChanged () |
| A record set has been added to or removed from the project. | |
Public Member Functions | |
| RecordsController (const FieldDefinitionsController &fieldDefinitionsController, const ProjectController &projectController, const TypesController &typesController) | |
| Constructs a new controller for adding, updating and removing records. More... | |
| const Record | addRecord (const QVariant &id, const QString &displayName, const QString &editorIconFieldId, const QStringList &fieldIds, const QString &recordSetName) |
| Adds a new record to the specified set. More... | |
| void | addRecordSet (const RecordSet &recordSet) |
| Adds the passed record set to the project. More... | |
| const QString | computeRecordsHash () const |
| Computes an MD5 hash of all current record data. More... | |
| const Record | duplicateRecord (const QVariant &existingRecordId, const QVariant &newRecordId) |
| Duplicats the record with the specified id, including all of its field values. More... | |
| const RecordList | getAncestors (const QVariant &id) const |
| Gets the list of all ancestors of the record with the specified id, direct parent first. More... | |
| const RecordList | getChildren (const QVariant &id) const |
| Gets the list of all records that have the record with the specified id as parent. More... | |
| const RecordList | getDescendents (const QVariant &id) const |
| Gets the list of all records that have the record with the specified id as parent, or any parent that has. More... | |
| const QVariant | getInheritedFieldValue (const QVariant &id, const QString &fieldId) const |
| Gets the value of the specified field for the record with the specified id, as inherited by its parent or any of its ancestors. More... | |
| const RecordFieldValueMap | getInheritedFieldValues (const QVariant &id) const |
| Gets the values of all fields for the record with the specified id, as inherited by its parent or any of its ancestors. More... | |
| const QVariant | getParentId (const QVariant &id) const |
| Gets the id of the parent of the record with the specified id. More... | |
| const RecordSetList & | getRecordSets () const |
| Gets a list of all record sets in the project. More... | |
| const Record & | getRecord (const QVariant &id) const |
| Returns the record with the specified id. More... | |
| const RecordList | getRecords () const |
| Gets a list of all records in the project. More... | |
| const QVariantList | getRecordIds () const |
| Gets a list of the ids of all records in the project. More... | |
| const QString | getRecordEditorIconFieldId (const QVariant &id) const |
| Gets the id of the field to use as editor icon for the record with the specified id. More... | |
| const QStringList | getRecordNames () const |
| Returns a list of the names of all records of this project. More... | |
| const QStringList | getRecordSetNames () const |
| Gets a list of the names of all record sets in the project. More... | |
| const RecordFieldValueMap | getRecordFieldValues (const QVariant &id) const |
| Returns the map of actual field values of the record with the specified id, including all inherited values. More... | |
| const QVariant | getRootRecordId (const QVariant &id) const |
| Gets the id of the root of the record with the specified id. More... | |
| bool | hasRecord (const QVariant &id) const |
| Checks whether the project has a record with the specified id. More... | |
| bool | haveTheSameParent (const QVariantList ids) const |
| Checks whether all records with the specified ids have the same parent in the record tree. More... | |
| bool | isAncestorOf (const QVariant &possibleAncestor, const QVariant &recordId) const |
| Checks whether the first record is an ancestor of the second one. More... | |
| void | removeRecord (const QVariant &recordId) |
| Removes the record with the specified id from the project. More... | |
| void | removeRecordSet (const QString &name) |
| Removes the record set with the specified name from the project, including all records. More... | |
| void | revertRecord (const QVariant &recordId) |
| Reverts all fields of the record with the specified id to their inherited or default value. More... | |
| void | reparentRecord (const QVariant &recordId, const QVariant &newParentId) |
| Changes the parent of the record with the specified id. More... | |
| void | setReadOnly (const QVariant &recordId, const bool readOnly) |
| Marks the record with the specified id as read-only or not, preventing it from being edited, reparented or removed. More... | |
| void | setRecordSets (RecordSetList &model) |
| Uses the specified list of record sets as model for this controller. More... | |
| void | updateRecord (const QVariant oldId, const QVariant newId, const QString newDisplayName, const QString newEditorIconFieldId, const QStringList &newFieldIds, const QString &newRecordSetName) |
| Updates the properties of the specified record. More... | |
| void | updateRecordFieldValue (const QVariant &recordId, const QString &fieldId, const QVariant &fieldValue) |
| Updates the current value of a record field. More... | |
Controller for adding, updating and removing records.
| RecordsController::RecordsController | ( | const FieldDefinitionsController & | fieldDefinitionsController, |
| const ProjectController & | projectController, | ||
| const TypesController & | typesController | ||
| ) |
Constructs a new controller for adding, updating and removing records.
| fieldDefinitionsController | Controller for adding, updating and removing field definitions. |
| projectController | Controller for creating, loading and saving projects. |
| typesController | Controller for adding, updating and removing custom types. |
| const Record RecordsController::addRecord | ( | const QVariant & | id, |
| const QString & | displayName, | ||
| const QString & | editorIconFieldId, | ||
| const QStringList & | fieldIds, | ||
| const QString & | recordSetName | ||
| ) |
Adds a new record to the specified set.
| std::out_of_range | if the record set could not be found. |
| std::out_of_range | if the record id type of the project is invalid. |
| id | Id of the record to add. |
| displayName | Display name of the record to add. |
| editorIconFieldId | Id of the field to use as editor icon for the record to add. |
| fieldIds | Ids of the fields to add to the new record. |
| recordSetName | Name of the record set to add the new record to. |
| void RecordsController::addRecordSet | ( | const RecordSet & | recordSet | ) |
Adds the passed record set to the project.
| recordSet | Record set to add. |
| const QString RecordsController::computeRecordsHash | ( | ) | const |
Computes an MD5 hash of all current record data.
| const Record RecordsController::duplicateRecord | ( | const QVariant & | existingRecordId, |
| const QVariant & | newRecordId | ||
| ) |
Duplicats the record with the specified id, including all of its field values.
| std::out_of_range | if the record id type of the project is invalid. |
| existingRecordId | Id of the record to duplicate. |
| newRecordId | Id of the record to add. |
| const RecordList RecordsController::getAncestors | ( | const QVariant & | id | ) | const |
Gets the list of all ancestors of the record with the specified id, direct parent first.
| std::out_of_range | if the record with the specified id could not be found. |
| id | Id of the record to get the ancestors of. |
| const RecordList RecordsController::getChildren | ( | const QVariant & | id | ) | const |
Gets the list of all records that have the record with the specified id as parent.
| id | Id of the record to get the children of. |
| const RecordList RecordsController::getDescendents | ( | const QVariant & | id | ) | const |
Gets the list of all records that have the record with the specified id as parent, or any parent that has.
| id | Id of the record to get the descendants of. |
| const QVariant RecordsController::getInheritedFieldValue | ( | const QVariant & | id, |
| const QString & | fieldId | ||
| ) | const |
Gets the value of the specified field for the record with the specified id, as inherited by its parent or any of its ancestors.
| id | Id of the record to get the inherited field value of. |
| fieldId | Id of the field to get the inherited field value of. |
| const RecordFieldValueMap RecordsController::getInheritedFieldValues | ( | const QVariant & | id | ) | const |
Gets the values of all fields for the record with the specified id, as inherited by its parent or any of its ancestors.
| id | Id of the record to get the inherited field values of. |
| const QVariant RecordsController::getParentId | ( | const QVariant & | id | ) | const |
Gets the id of the parent of the record with the specified id.
| std::out_of_range | if the record with the specified id could not be found. |
| id | Id of the record to get the parent id of. |
| const Record & RecordsController::getRecord | ( | const QVariant & | id | ) | const |
| const QString RecordsController::getRecordEditorIconFieldId | ( | const QVariant & | id | ) | const |
Gets the id of the field to use as editor icon for the record with the specified id.
| std::out_of_range | if the record with the specified id could not be found. |
| id | Id of the record to get the editor icon field of. |
| const RecordFieldValueMap RecordsController::getRecordFieldValues | ( | const QVariant & | id | ) | const |
Returns the map of actual field values of the record with the specified id, including all inherited values.
| std::out_of_range | if the record with the specified id could not be found. |
| id | Id of the record the get the map of field values of. |
| const QVariantList RecordsController::getRecordIds | ( | ) | const |
Gets a list of the ids of all records in the project.
| const QStringList RecordsController::getRecordNames | ( | ) | const |
Returns a list of the names of all records of this project.
| const RecordList RecordsController::getRecords | ( | ) | const |
Gets a list of all records in the project.
| const QStringList RecordsController::getRecordSetNames | ( | ) | const |
Gets a list of the names of all record sets in the project.
| const RecordSetList & RecordsController::getRecordSets | ( | ) | const |
Gets a list of all record sets in the project.
| const QVariant RecordsController::getRootRecordId | ( | const QVariant & | id | ) | const |
Gets the id of the root of the record with the specified id.
| id | Id of the record to get the root of. |
| bool RecordsController::hasRecord | ( | const QVariant & | id | ) | const |
Checks whether the project has a record with the specified id.
| id | Id of the record to look for. |
| bool RecordsController::haveTheSameParent | ( | const QVariantList | ids | ) | const |
Checks whether all records with the specified ids have the same parent in the record tree.
| ids | List of ids of the records to check. |
| bool RecordsController::isAncestorOf | ( | const QVariant & | possibleAncestor, |
| const QVariant & | recordId | ||
| ) | const |
|
signal |
Progress of the current record operation has changed.
| title | Title of the current record operation step. |
| text | Details of the current record operation step. |
| currentValue | Current progress value of the current record operation step. |
| maximumValue | Maximum progress value of the current record operation step. |
|
signal |
A new record has been added to the project.
| recordId | Id of the new record. |
| recordDisplayName | Display name of the new record. |
| parentId | Id of the parent of the new record, or null if its a new root of the record tree. |
|
signal |
A new field has been added to a record, or one of its fields has been updated or removed.
| recordId | Id of the record whose fields have changed. |
|
signal |
A record has been removed from the project.
| recordId | Id of the record that has been removed from the project. |
|
signal |
The parent of a record has changed.
| recordId | Id of the record whose parent has changed. |
| oldParentId | Id of the previous parent of the record. |
| newParentId | Id of the new parent of the record, or null if its a new root of the record tree. |
|
signal |
The properties of a record have been updated.
| oldId | Previous id of the record which has been updated. |
| oldDisplayName | Previous display name of the record which has been updated. |
| oldEditorIconFieldId | Previous id of the field to use as editor icon for the record which has been updated. |
| newId | New id of the record which has been updated. |
| newDisplayName | New display name of the record which has been updated. |
| newEditorIconFieldId | New id of the field to use as editor icon for the record which has been updated. |
| void RecordsController::removeRecord | ( | const QVariant & | recordId | ) |
Removes the record with the specified id from the project.
| recordId | Id of the record to remove. |
| void RecordsController::removeRecordSet | ( | const QString & | name | ) |
Removes the record set with the specified name from the project, including all records.
| name | Name of the record set to remove. |
| void RecordsController::reparentRecord | ( | const QVariant & | recordId, |
| const QVariant & | newParentId | ||
| ) |
Changes the parent of the record with the specified id.
| std::out_of_range | if the record to reparent could not be found. |
| recordId | Id of the record to change the parent of. |
| newParentId | Id of the new parent of the record. |
| void RecordsController::revertRecord | ( | const QVariant & | recordId | ) |
Reverts all fields of the record with the specified id to their inherited or default value.
| std::out_of_range | if the record with the specified id could not be found. |
| recordId | Id of the record to revert. |
| void RecordsController::setReadOnly | ( | const QVariant & | recordId, |
| const bool | readOnly | ||
| ) |
Marks the record with the specified id as read-only or not, preventing it from being edited, reparented or removed.
| std::out_of_range | if the record with the specified id could not be found. |
| recordId | Id of the record to make read-only or not. |
| readOnly | Whether to make the record read-only or not. |
| void RecordsController::setRecordSets | ( | RecordSetList & | model | ) |
Uses the specified list of record sets as model for this controller.
| std::out_of_range | if the record id type of the project is invalid. |
| model | New list of record sets to use as model for this controller. |
| void RecordsController::updateRecord | ( | const QVariant | oldId, |
| const QVariant | newId, | ||
| const QString | newDisplayName, | ||
| const QString | newEditorIconFieldId, | ||
| const QStringList & | newFieldIds, | ||
| const QString & | newRecordSetName | ||
| ) |
Updates the properties of the specified record.
| std::out_of_range | if the record with the specified id could not be found. |
| oldId | Current id of the record to update. |
| newId | New id of the record to update. |
| newDisplayName | New display name of the record to update. |
| newEditorIconFieldId | New id of the field to use as editor icon for the record to update. |
| newFieldIds | Ids of the new fields of the record to update. |
| newRecordSetName | Name of the new record set the record should belong to. |
| void RecordsController::updateRecordFieldValue | ( | const QVariant & | recordId, |
| const QString & | fieldId, | ||
| const QVariant & | fieldValue | ||
| ) |
Updates the current value of a record field.
| std::out_of_range | if the record with the specified id could not be found. |
| recordId | Id of the record to update the field value of. |
| fieldId | Id of the field to update the value of. |
| fieldValue | New value of the field to update. |
1.8.13