1 #ifndef RECORDSCONTROLLER_H 2 #define RECORDSCONTROLLER_H 8 #include "../Model/recordsetlist.h" 13 class FieldDefinition;
14 class FieldDefinitionsController;
15 class ProjectController;
16 class TypesController;
50 const QString& displayName,
51 const QString& editorIconFieldId,
52 const QStringList& fieldIds,
53 const QString& recordSetName);
95 const RecordList
getChildren(
const QVariant&
id)
const;
129 const QVariant
getParentId(
const QVariant&
id)
const;
209 bool hasRecord(
const QVariant&
id)
const;
224 bool isAncestorOf(
const QVariant& possibleAncestor,
const QVariant& recordId)
const;
259 void reparentRecord(
const QVariant& recordId,
const QVariant& newParentId);
271 void setReadOnly(
const QVariant& recordId,
const bool readOnly);
297 const QVariant newId,
298 const QString newDisplayName,
299 const QString newEditorIconFieldId,
300 const QStringList& newFieldIds,
301 const QString& newRecordSetName);
314 void updateRecordFieldValue(
const QVariant& recordId,
const QString& fieldId,
const QVariant& fieldValue);
324 void progressChanged(
const QString title,
const QString text,
const int currentValue,
const int maximumValue);
332 void recordAdded(
const QVariant& recordId,
const QString& recordDisplayName,
const QVariant& parentId);
352 void recordReparented(
const QVariant& recordId,
const QVariant& oldParentId,
const QVariant& newParentId);
364 const QString& oldDisplayName,
365 const QString& oldEditorIconFieldId,
366 const QVariant& newId,
367 const QString& newDisplayName,
368 const QString& newEditorIconFieldId);
381 RecordSetList* model;
387 std::mt19937 recordIdGenerator;
388 std::uniform_int_distribution<int> recordIdDistribution;
390 void addRecordField(
const QVariant& recordId,
const QString& fieldId);
391 int generateIntegerId();
392 const QString generateUuid()
const;
393 Record* getRecordById(
const QVariant&
id)
const;
394 void moveFieldToComponent(
const QString& fieldId,
const QString& oldComponent,
const QString& newComponent);
395 void moveRecordToSet(
const QVariant& recordId,
const QString& recordSetName);
396 void removeRecordField(
const QVariant& recordId,
const QString& fieldId);
397 void renameRecordField(
const QString oldFieldId,
const QString newFieldId);
398 QVariant revertFieldValue(
const QVariant& recordId,
const QString& fieldId);
399 void updateRecordReferences(
const QVariant oldReference,
const QVariant newReference);
400 void verifyRecordIds();
401 void verifyRecordIntegerIds();
402 void verifyRecordStringIds();
403 void verifyRecordUuids();
407 #endif // RECORDSCONTROLLER_H const RecordList getChildren(const QVariant &id) const
Gets the list of all records that have the record with the specified id as parent.
Definition: recordscontroller.cpp:261
Definition: commandlineoptions.h:6
void reparentRecord(const QVariant &recordId, const QVariant &newParentId)
Changes the parent of the record with the specified id.
Definition: recordscontroller.cpp:623
Controller for adding, updating and removing field definitions.
Definition: fielddefinitionscontroller.h:15
Controller for adding, updating and removing records.
Definition: recordscontroller.h:21
void recordReparented(const QVariant &recordId, const QVariant &oldParentId, const QVariant &newParentId)
The parent of a record has changed.
bool haveTheSameParent(const QVariantList ids) const
Checks whether all records with the specified ids have the same parent in the record tree...
Definition: recordscontroller.cpp:495
const QVariantList getRecordIds() const
Gets a list of the ids of all records in the project.
Definition: recordscontroller.cpp:386
void recordFieldsChanged(const QVariant &recordId)
A new field has been added to a record, or one of its fields has been updated or removed.
void recordAdded(const QVariant &recordId, const QString &recordDisplayName, const QVariant &parentId)
A new record has been added to the project.
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.
Definition: recordscontroller.cpp:400
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.
Definition: recordscontroller.cpp:283
Named set of Tome records.
Definition: recordset.h:11
bool isAncestorOf(const QVariant &possibleAncestor, const QVariant &recordId) const
Checks whether the first record is an ancestor of the second one.
Definition: recordscontroller.cpp:520
bool hasRecord(const QVariant &id) const
Checks whether the project has a record with the specified id.
Definition: recordscontroller.cpp:475
const RecordList getRecords() const
Gets a list of all records in the project.
Definition: recordscontroller.cpp:369
void revertRecord(const QVariant &recordId)
Reverts all fields of the record with the specified id to their inherited or default value...
Definition: recordscontroller.cpp:598
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.
Definition: recordscontroller.cpp:647
void removeRecordSet(const QString &name)
Removes the record set with the specified name from the project, including all records.
Definition: recordscontroller.cpp:580
Field that can be added to a record to hold data.
Definition: fielddefinition.h:15
const QVariant getParentId(const QVariant &id) const
Gets the id of the parent of the record with the specified id.
Definition: recordscontroller.cpp:354
const QStringList getRecordSetNames() const
Gets a list of the names of all record sets in the project.
Definition: recordscontroller.cpp:438
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...
Definition: recordscontroller.cpp:330
const QStringList getRecordNames() const
Returns a list of the names of all records of this project.
Definition: recordscontroller.cpp:424
Controller for adding, updating and removing custom types.
Definition: typescontroller.h:14
const QVariant getRootRecordId(const QVariant &id) const
Gets the id of the root of the record with the specified id.
Definition: recordscontroller.cpp:469
void progressChanged(const QString title, const QString text, const int currentValue, const int maximumValue)
Progress of the current record operation has changed.
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 paren...
Definition: recordscontroller.cpp:313
const Record & getRecord(const QVariant &id) const
Returns the record with the specified id.
Definition: recordscontroller.cpp:364
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.
const QString computeRecordsHash() const
Computes an MD5 hash of all current record data.
Definition: recordscontroller.cpp:123
void updateRecordFieldValue(const QVariant &recordId, const QString &fieldId, const QVariant &fieldValue)
Updates the current value of a record field.
Definition: recordscontroller.cpp:737
Data record that combines the values of various fields.
Definition: record.h:16
void setRecordSets(RecordSetList &model)
Uses the specified list of record sets as model for this controller.
Definition: recordscontroller.cpp:640
const Record duplicateRecord(const QVariant &existingRecordId, const QVariant &newRecordId)
Duplicats the record with the specified id, including all of its field values.
Definition: recordscontroller.cpp:187
void addRecordSet(const RecordSet &recordSet)
Adds the passed record set to the project.
Definition: recordscontroller.cpp:114
Controller for creating, loading and saving projects.
Definition: projectcontroller.h:22
const RecordSetList & getRecordSets() const
Gets a list of all record sets in the project.
Definition: recordscontroller.cpp:359
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.
Definition: recordscontroller.cpp:45
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...
Definition: recordscontroller.cpp:634
RecordsController(const FieldDefinitionsController &fieldDefinitionsController, const ProjectController &projectController, const TypesController &typesController)
Constructs a new controller for adding, updating and removing records.
Definition: recordscontroller.cpp:23
void recordRemoved(const QVariant &recordId)
A record has been removed from the project.
const RecordFieldValueMap getRecordFieldValues(const QVariant &id) const
Returns the map of actual field values of the record with the specified id, including all inherited v...
Definition: recordscontroller.cpp:451
void recordSetsChanged()
A record set has been added to or removed from the project.
void removeRecord(const QVariant &recordId)
Removes the record with the specified id from the project.
Definition: recordscontroller.cpp:541
const RecordList getAncestors(const QVariant &id) const
Gets the list of all ancestors of the record with the specified id, direct parent first...
Definition: recordscontroller.cpp:243