GUI: simplify save/load machinery
This MR is about reorganization of saving and loading datafield files. The aim was to simplify logic, make it traceable and eliminate artificial references to parent JobItem
for updating its status (#365 (closed)).
The former mechanism looked overingineered, it was really hard to follow the logic. There were numerous services responsible for saving and loading datafield files and tracking changes to them: DatafieldIOService
, DatafieldIOHistory
, DatafieldDirHistory
, DatafieldSaveInfo
, SaveService
, SaveThread
. The data was saved and read in the following order: first the project file was read and only then all the data files, one by one.
Now, after the simplification, the above-mentioned classes have been removed from code and their functionality has been moved to ProjectManager
, ProjectDocument
, ApplicationModels
, DataItem
. The data file for each JobItem
or RealItem
is saved or loaded immediately after reading or writing the xml data. So the method DataItem::saveDatafield()
is called from the corresponding DataItem::writeTo()
method and DataItem::loadDatafield()
is called from the JobItem::readFrom()
or RealItem::readFrom()
. Each data is saved in a separate thread in the background.
Tests that tested redundant functionality of removed classes have been removed. The rest was adapted and test files were renamed:
TestIOService
--> TestApplicationModel
TestSaveService
--> TestAutosaveController
Minor changes:
-
The functions and variables to set/get full address of the project file have been renamed from
projectFileName()
toprojectFullPath()
to avoid confusing, becauseprojectFileName
can be misunderstood asUntitled.pro
instead of/some/way/to/project/Untitled.pro
-
The nofitication of the project has been restored for loading and removal user data in the
Data
view. -
Some issues with synchronized representation in jobs containing user data have been fixed.
-
Missing or corrupted datafiles are allowed now. The handling of such cases has been restored.
This resolves #418 (closed), #364 (closed), #365 (closed)