29 auto* session_item =
dynamic_cast<SessionItem*
>(item);
37 , m_applicationModels(nullptr)
39 setObjectName(
"DatafieldIOService");
44 , m_applicationModels(nullptr)
46 setObjectName(
"DatafieldIOService");
86 if (
auto* jobItem = parentJobItem(item)) {
87 if (jobItem->isRunning()) {
88 jobItem->setComments(
"Possible GUI crash while job was running");
92 }
catch (
const std::exception& ex) {
93 if (
auto* jobItem = parentJobItem(item)) {
96 QString(
"Load of the data from disk failed with '%1'").arg(QString(ex.what())));
101 messageService->
addWarning(
this, QString(ex.what()));
111 QVector<SaveLoadInterface*> result;
118 result.push_back(non_xml_item);
127 const QStringList& newSaves)
129 const auto toRemove = oldSaves.toSet().subtract(newSaves.toSet());
130 for (
const auto&
name : toRemove)
Defines class holding all application models.
Defines class DatafieldIOService.
@ Failed
the job aborted because it hit an error
Defines MessageService class.
Defines namespace GUI::Model::Path.
Defines namespace GUI::Project::Utils.
Defines save/load interface.
QVector< SessionItem * > nonXMLItems() const
Returns all non-XML items.
Save history information for collection of items with non-XML data.
QStringList savedFileNames() const
Returns list of file names used to save all items in a history.
void markAsSaved(const SaveLoadInterface *item)
void setHistory(const QString &dirname, const DatafieldDirHistory &history)
Sets history for given directory. Previous history will be rewritten.
bool wasModifiedSinceLastSave(const QString &dirname, const SaveLoadInterface *item)
QStringList savedFileNames(const QString &dirname) const
bool hasHistory(const QString &dirname) const
ApplicationModels * m_applicationModels
void setApplicationModels(ApplicationModels *models)
QVector< SaveLoadInterface * > dataInterfaces() const
Returns all non-XML items available for save/load.
DatafieldIOHistory m_history
void save(const QString &projectDir)
DatafieldIOService(QObject *parent=nullptr)
void cleanOldFiles(const QString &projectDir, const QStringList &oldSaves, const QStringList &newSaves)
Clean old saved files. All files in oldSaves list, which are not in newSaves list,...
void loadDataFiles(const QString &projectDir, MessageService *messageService=nullptr)
static constexpr auto M_TYPE
The service to collect messages from different senders.
void addWarning(QObject *sender, const QString &description)
Abstract base class to handle non-XML data save and load.
Base class for a GUI data item.
SessionItem * ancestor(SessionItem *item, const QString &requiredModelType)
Returns ancestor of given modelType for given item.
QString projectDir(const QString &projectFileName)
Returns project directory deduced from project file name.
QString const & name(EShape k)