Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
fb2973e6
Commit
fb2973e6
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
improve project reading/writing
parent
8ad4d93e
No related branches found
No related tags found
1 merge request
!494
Remove SessionModel/SessionItem from MaterialModel/MaterialItem
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Project/ProjectDocument.cpp
+12
-1
12 additions, 1 deletion
GUI/Model/Project/ProjectDocument.cpp
GUI/Model/Session/SessionXML.cpp
+1
-1
1 addition, 1 deletion
GUI/Model/Session/SessionXML.cpp
with
13 additions
and
2 deletions
GUI/Model/Project/ProjectDocument.cpp
+
12
−
1
View file @
fb2973e6
...
@@ -339,9 +339,10 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
...
@@ -339,9 +339,10 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
else
if
(
reader
.
name
()
==
SimulationOptionsTag
)
{
else
if
(
reader
.
name
()
==
SimulationOptionsTag
)
{
m_simulationOptionsItem
.
readContentFrom
(
&
reader
);
m_simulationOptionsItem
.
readContentFrom
(
&
reader
);
reader
.
skipCurrentElement
();
reader
.
skipCurrentElement
();
ASSERT
(
reader
.
name
()
==
SimulationOptionsTag
);
}
else
if
(
reader
.
name
()
==
MaterialsTag
)
{
}
else
if
(
reader
.
name
()
==
MaterialsTag
)
{
m_materials
.
readContentFrom
(
&
reader
);
m_materials
.
readContentFrom
(
&
reader
);
reader
.
skipCurrentElement
(
);
ASSERT
(
reader
.
name
()
==
MaterialsTag
);
}
else
}
else
m_applicationModels
.
readFrom
(
&
reader
,
&
messageService
);
m_applicationModels
.
readFrom
(
&
reader
,
&
messageService
);
}
}
...
@@ -353,6 +354,16 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
...
@@ -353,6 +354,16 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
for
(
auto
itemWithMaterial
:
multiLayerItem
->
itemsWithMaterial
())
for
(
auto
itemWithMaterial
:
multiLayerItem
->
itemsWithMaterial
())
itemWithMaterial
->
setMaterialModel
(
materialModel
());
itemWithMaterial
->
setMaterialModel
(
materialModel
());
// make a sanity check whether all materials are present
for
(
auto
multiLayerItem
:
m_applicationModels
.
sampleModel
()
->
multiLayerItems
())
for
(
auto
itemWithMaterial
:
multiLayerItem
->
itemsWithMaterial
())
if
(
itemWithMaterial
->
materialItem
()
==
nullptr
)
{
QString
message
=
QString
(
"Material link is broken (id: '%1')"
)
.
arg
(
itemWithMaterial
->
materialIdentifier
());
messageService
.
addError
(
this
,
message
);
return
ReadResult
::
error
;
}
if
(
reader
.
hasError
())
{
if
(
reader
.
hasError
())
{
QString
message
=
QString
(
"Format error '%1'"
).
arg
(
reader
.
errorString
());
QString
message
=
QString
(
"Format error '%1'"
).
arg
(
reader
.
errorString
());
messageService
.
addError
(
this
,
message
);
messageService
.
addError
(
this
,
message
);
...
...
This diff is collapsed.
Click to expand it.
GUI/Model/Session/SessionXML.cpp
+
1
−
1
View file @
fb2973e6
...
@@ -157,7 +157,7 @@ void GUI::Session::XML::writeAttribute(QXmlStreamWriter* writer, const QString&
...
@@ -157,7 +157,7 @@ void GUI::Session::XML::writeAttribute(QXmlStreamWriter* writer, const QString&
void
GUI
::
Session
::
XML
::
writeAttribute
(
QXmlStreamWriter
*
writer
,
const
QString
&
attributeName
,
void
GUI
::
Session
::
XML
::
writeAttribute
(
QXmlStreamWriter
*
writer
,
const
QString
&
attributeName
,
double
d
)
double
d
)
{
{
writer
->
writeAttribute
(
attributeName
,
QString
::
number
(
d
,
'e'
,
12
));
writer
->
writeAttribute
(
attributeName
,
d
==
0.0
?
"0"
:
QString
::
number
(
d
,
'e'
,
12
));
}
}
void
GUI
::
Session
::
XML
::
writeAttribute
(
QXmlStreamWriter
*
writer
,
const
QString
&
attributeName
,
void
GUI
::
Session
::
XML
::
writeAttribute
(
QXmlStreamWriter
*
writer
,
const
QString
&
attributeName
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment