Tome
A generic data editor for games supporting arbitrary input and output formats.
Signals | Public Member Functions | List of all members
Tome::ImportController Class Reference

Controller for importing record data. More...

#include <importcontroller.h>

Inheritance diagram for Tome::ImportController:

Signals

void importError (const QString &error) const
 Importing records asynchronously has failed. More...
 
void importFinished () const
 Importing records asynchronously has finished.
 
void importStarted () const
 Importing records asynchronously has started.
 
void importTemplatesChanged ()
 Available record import templates have changed.
 
void progressChanged (const QString title, const QString text, const int currentValue, const int maximumValue) const
 Importing records asynchronously has made notable progress. More...
 

Public Member Functions

 ImportController (FieldDefinitionsController &fieldDefinitionsController, RecordsController &recordsController, TypesController &typesController)
 Constructs a new controller for importing record data. More...
 
void addRecordImportTemplate (const RecordTableImportTemplate &importTemplate)
 Adds the specified record import template to the project. More...
 
const RecordTableImportTemplate getRecordTableImportTemplate (const QString &name) const
 Gets the record import template with the specified name. More...
 
const RecordTableImportTemplateList getRecordTableImportTemplates () const
 Gets a list of all record import templates in the project. More...
 
void importRecords (const RecordTableImportTemplate &importTemplate, const QVariant &context)
 Begins importing records asynchronously using the specified template. More...
 
bool removeImportTemplate (const QString &name)
 Removes the record import template with the specified name from the project. More...
 
void setRecordTableImportTemplates (RecordTableImportTemplateList &importTemplates)
 Uses the specified list of record import templates as model for this controller. More...
 

Detailed Description

Controller for importing record data.

Constructor & Destructor Documentation

◆ ImportController()

ImportController::ImportController ( FieldDefinitionsController fieldDefinitionsController,
RecordsController recordsController,
TypesController typesController 
)

Constructs a new controller for importing record data.

Parameters
fieldDefinitionsControllerController for adding, updating and removing field definitions.
recordsControllerController for adding, updating and removing records.
typesControllerController for adding, updating and removing custom types.

Member Function Documentation

◆ addRecordImportTemplate()

void ImportController::addRecordImportTemplate ( const RecordTableImportTemplate importTemplate)

Adds the specified record import template to the project.

Parameters
importTemplateImport template to add.

◆ getRecordTableImportTemplate()

const RecordTableImportTemplate ImportController::getRecordTableImportTemplate ( const QString &  name) const

Gets the record import template with the specified name.

Exceptions
std::out_of_rangeif the record import template could not be found.
Parameters
nameName of the record import template to get.
Returns
Record import template with the specified name.

◆ getRecordTableImportTemplates()

const RecordTableImportTemplateList ImportController::getRecordTableImportTemplates ( ) const

Gets a list of all record import templates in the project.

Returns
List of all record import templates in the project.

◆ importError

void Tome::ImportController::importError ( const QString &  error) const
signal

Importing records asynchronously has failed.

Parameters
errorLocalized error message.

◆ importRecords()

void ImportController::importRecords ( const RecordTableImportTemplate importTemplate,
const QVariant &  context 
)

Begins importing records asynchronously using the specified template.

Parameters
importTemplateTemplate to use for importing the record data.
contextContext to import the data in (e.g. source file name).

◆ progressChanged

void Tome::ImportController::progressChanged ( const QString  title,
const QString  text,
const int  currentValue,
const int  maximumValue 
) const
signal

Importing records asynchronously has made notable progress.

Parameters
titleLocalized title of the progress message.
textLocalized text of the progress message.
currentValueCurrent progress value (e.g. imported record count).
maximumValueMaximum progress value (e.g. maximum record count).

◆ removeImportTemplate()

bool ImportController::removeImportTemplate ( const QString &  name)

Removes the record import template with the specified name from the project.

Parameters
nameName of the record import template to remove.
Returns
true, if the import template was removed, and false otherwise.

◆ setRecordTableImportTemplates()

void ImportController::setRecordTableImportTemplates ( RecordTableImportTemplateList &  importTemplates)

Uses the specified list of record import templates as model for this controller.

Parameters
importTemplatesNew list of record import templates to use as model for this controller.

The documentation for this class was generated from the following files: