Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
c38153ed
Commit
c38153ed
authored
Oct 10, 2018
by
Gigg, Martyn Anthony
Committed by
Martyn Gigg
Oct 13, 2018
Browse files
Disable project saving for non-Qt4 instrument view
Project saving does not yet exist in newer builds and will not take the same form.
parent
8af700e6
Changes
17
Hide whitespace changes
Inline
Side-by-side
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentRenderer.h
View file @
c38153ed
...
...
@@ -13,7 +13,7 @@
#include
"MantidGeometry/Rendering/OpenGL_Headers.h"
#include
"MantidQtWidgets/InstrumentView/BankTextureBuilder.h"
#include
"MantidQtWidgets/
LegacyQwt/Mantid
ColorMap.h"
#include
"MantidQtWidgets/
InstrumentView/
ColorMap.h"
#include
<QString>
#include
<map>
#include
<vector>
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h
View file @
c38153ed
...
...
@@ -12,7 +12,6 @@
#include
"InstrumentWidgetTab.h"
#include
"MantidQtWidgets/Common/GraphOptions.h"
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
class
QPushButton
;
class
QLineEdit
;
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/OpenGLError.h
View file @
c38153ed
...
...
@@ -7,6 +7,7 @@
#ifndef OPENGLERROR_H_
#define OPENGLERROR_H_
#include
<ostream>
#include
<stdexcept>
#include
<string>
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/Shape2D.h
View file @
c38153ed
...
...
@@ -7,7 +7,6 @@
#ifndef MANTIDPLOT_SHAPE2D_H_
#define MANTIDPLOT_SHAPE2D_H_
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#include
"RectF.h"
#include
<QColor>
...
...
qt/widgets/instrumentview/src/InstrumentActor.cpp
View file @
c38153ed
...
...
@@ -5,7 +5,9 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidQtWidgets/InstrumentView/InstrumentActor.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
"MantidQtWidgets/InstrumentView/InstrumentRenderer.h"
#include
"MantidQtWidgets/InstrumentView/OpenGLError.h"
...
...
@@ -1179,6 +1181,7 @@ InstrumentActor::getStringParameter(const std::string &name,
* @return string representing the current state of the instrumet actor.
*/
std
::
string
InstrumentActor
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
const
std
::
string
currentColorMap
=
getCurrentColorMap
().
toStdString
();
...
...
@@ -1187,6 +1190,9 @@ std::string InstrumentActor::saveToProject() const {
tsv
.
writeSection
(
"binmasks"
,
m_maskBinsData
.
saveToProject
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"InstrumentActor::saveToProject() not implemented for Qt >= 5"
);
#endif
}
/**
...
...
@@ -1194,6 +1200,7 @@ std::string InstrumentActor::saveToProject() const {
* @param lines :: string representing the current state of the instrumet actor.
*/
void
InstrumentActor
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
tsv
.
selectLine
(
"FileName"
))
{
QString
filename
;
...
...
@@ -1206,6 +1213,10 @@ void InstrumentActor::loadFromProject(const std::string &lines) {
tsv
>>
binMaskLines
;
m_maskBinsData
.
loadFromProject
(
binMaskLines
);
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"InstrumentActor::saveToProject() not implemented for Qt >= 5"
);
#endif
}
bool
InstrumentActor
::
hasGridBank
()
const
{
return
m_hasGrid
;
}
...
...
qt/widgets/instrumentview/src/InstrumentWidget.cpp
View file @
c38153ed
...
...
@@ -8,7 +8,9 @@
#include
"MantidGeometry/Instrument/ComponentInfo.h"
#include
"MantidGeometry/Instrument/DetectorInfo.h"
#include
"MantidQtWidgets/Common/MantidDesktopServices.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
"MantidQtWidgets/InstrumentView/DetXMLFile.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentActor.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentWidgetMaskTab.h"
...
...
@@ -1390,6 +1392,7 @@ int InstrumentWidget::getCurrentTab() const {
* @return string representing the current state of the instrumet widget.
*/
std
::
string
InstrumentWidget
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
TSVSerialiser
tsv
;
// serialise widget properties
...
...
@@ -1405,6 +1408,10 @@ std::string InstrumentWidget::saveToProject() const {
tsv
.
writeSection
(
"tabs"
,
saveTabs
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"InstrumentWidget::saveToProject() not implemented for Qt >= 5"
);
#endif
}
/**
...
...
@@ -1435,6 +1442,7 @@ void InstrumentWidget::loadTabs(const std::string &lines) const {
* file.
*/
void
InstrumentWidget
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
TSVSerialiser
tsv
(
lines
);
if
(
tsv
.
selectLine
(
"SurfaceType"
))
{
...
...
@@ -1474,6 +1482,11 @@ void InstrumentWidget::loadFromProject(const std::string &lines) {
}
updateInstrumentView
();
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"InstrumentWidget::loadFromProject() not implemented for Qt >= 5"
);
#endif
}
}
// namespace MantidWidgets
...
...
qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp
View file @
c38153ed
...
...
@@ -5,7 +5,9 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidQtWidgets/InstrumentView/InstrumentWidgetMaskTab.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
"MantidQtWidgets/InstrumentView/DetXMLFile.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentActor.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentWidget.h"
...
...
@@ -1198,6 +1200,7 @@ void InstrumentWidgetMaskTab::changedIntegrationRange(double, double) {
* @param lines :: lines from the project file to load state from
*/
void
InstrumentWidgetMaskTab
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
!
tsv
.
selectSection
(
"masktab"
))
...
...
@@ -1235,6 +1238,11 @@ void InstrumentWidgetMaskTab::loadFromProject(const std::string &lines) {
tab
>>
maskWSName
;
loadMaskViewFromProject
(
maskWSName
);
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"InstrumentWidgetMaskTab::loadFromProject() not implemented for Qt >= 5"
);
#endif
}
/** Load a mask workspace applied to the instrument actor from the project
...
...
@@ -1309,6 +1317,7 @@ InstrumentWidgetMaskTab::loadMask(const std::string &fileName) {
* @return a string representing the state of the mask tab
*/
std
::
string
InstrumentWidgetMaskTab
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
API
::
TSVSerialiser
tab
;
...
...
@@ -1338,6 +1347,10 @@ std::string InstrumentWidgetMaskTab::saveToProject() const {
tsv
.
writeSection
(
"masktab"
,
tab
.
outputLines
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"InstrumentWidgetMaskTab::saveToProject() not implemented for Qt >= 5"
);
#endif
}
/** Save a mask workspace containing masks applied to the instrument view
...
...
qt/widgets/instrumentview/src/InstrumentWidgetPickTab.cpp
View file @
c38153ed
...
...
@@ -5,7 +5,9 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidQtWidgets/InstrumentView/InstrumentWidgetPickTab.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
"MantidQtWidgets/InstrumentView/CollapsiblePanel.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentActor.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentWidget.h"
...
...
@@ -596,11 +598,10 @@ void InstrumentWidgetPickTab::initSurface() {
m_plotController
->
setPlotType
(
static_cast
<
DetectorPlotController
::
PlotType
>
(
m_plotTypeCache
));
// miniplot X unit
const
auto
&
actor
=
m_instrWidget
->
getInstrumentActor
();
const
auto
&
actor
=
m_instrWidget
->
getInstrumentActor
();
// default X axis label
m_plot
->
setXLabel
(
QString
::
fromStdString
(
actor
.
getWorkspace
()
->
getAxis
(
0
)
->
unit
()
->
unitID
()));
}
/**
...
...
@@ -768,6 +769,7 @@ void InstrumentWidgetPickTab::savePlotToWorkspace() {
* @param lines :: lines from the project file to load state from
*/
void
InstrumentWidgetPickTab
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
!
tsv
.
selectSection
(
"picktab"
))
...
...
@@ -789,12 +791,18 @@ void InstrumentWidgetPickTab::loadFromProject(const std::string &lines) {
tab
>>
value
;
button
->
setChecked
(
value
);
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"MaskBinsData::loadFromProject() not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the pick tab to a Mantid project file
* @return a string representing the state of the pick tab
*/
std
::
string
InstrumentWidgetPickTab
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
,
tab
;
// save active push button
...
...
@@ -810,6 +818,10 @@ std::string InstrumentWidgetPickTab::saveToProject() const {
tsv
.
writeSection
(
"picktab"
,
tab
.
outputLines
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"MaskBinsData::saveToProject() not implemented for Qt >= 5"
);
#endif
}
//=====================================================================================//
...
...
qt/widgets/instrumentview/src/InstrumentWidgetRenderTab.cpp
View file @
c38153ed
...
...
@@ -12,6 +12,10 @@
#include
"MantidQtWidgets/InstrumentView/UCorrectionDialog.h"
#include
"MantidQtWidgets/InstrumentView/UnwrappedSurface.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
<QAction>
#include
<QActionGroup>
#include
<QCheckBox>
...
...
@@ -832,6 +836,8 @@ QPointF InstrumentWidgetRenderTab::getUCorrection() const {
*/
std
::
string
MantidQt
::
MantidWidgets
::
InstrumentWidgetRenderTab
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tab
;
tab
.
writeLine
(
"AxesView"
)
<<
mAxisCombo
->
currentIndex
();
...
...
@@ -858,6 +864,9 @@ MantidQt::MantidWidgets::InstrumentWidgetRenderTab::saveToProject() const {
API
::
TSVSerialiser
tsv
;
tsv
.
writeSection
(
"rendertab"
,
tab
.
outputLines
());
return
tsv
.
outputLines
();
#else
return
""
;
#endif
}
/**
...
...
@@ -865,6 +874,7 @@ MantidQt::MantidWidgets::InstrumentWidgetRenderTab::saveToProject() const {
* @param lines :: lines defining the state of the render tab
*/
void
InstrumentWidgetRenderTab
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
!
tsv
.
selectSection
(
"rendertab"
))
...
...
@@ -931,6 +941,11 @@ void InstrumentWidgetRenderTab::loadFromProject(const std::string &lines) {
tab
>>
colorMapLines
;
m_colorBarWidget
->
loadFromProject
(
colorMapLines
);
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"InstrumentActor::saveToProject() not implemented for Qt >= 5"
);
#endif
}
}
// namespace MantidWidgets
...
...
qt/widgets/instrumentview/src/InstrumentWidgetTreeTab.cpp
View file @
c38153ed
...
...
@@ -5,7 +5,9 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidQtWidgets/InstrumentView/InstrumentWidgetTreeTab.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
"MantidQtWidgets/InstrumentView/InstrumentActor.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentTreeWidget.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentWidget.h"
...
...
@@ -68,6 +70,7 @@ void InstrumentWidgetTreeTab::showEvent(QShowEvent *) {
* @param lines :: lines from the project file to load state from
*/
void
InstrumentWidgetTreeTab
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
!
tsv
.
selectSection
(
"treetab"
))
...
...
@@ -91,12 +94,18 @@ void InstrumentWidgetTreeTab::loadFromProject(const std::string &lines) {
m_instrumentTree
->
setExpanded
(
index
,
true
);
}
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"InstrumentWidgetTreeTab::loadFromProject() not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the tree tab to a Mantid project file
* @return a string representing the state of the tree tab
*/
std
::
string
InstrumentWidgetTreeTab
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
,
tab
;
auto
index
=
m_instrumentTree
->
currentIndex
();
...
...
@@ -116,6 +125,10 @@ std::string InstrumentWidgetTreeTab::saveToProject() const {
tsv
.
writeSection
(
"treetab"
,
tab
.
outputLines
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"InstrumentWidgetTreeTab::saveToProject() not implemented for Qt >= 5"
);
#endif
}
}
// namespace MantidWidgets
...
...
qt/widgets/instrumentview/src/MaskBinsData.cpp
View file @
c38153ed
...
...
@@ -7,7 +7,10 @@
#include
"MantidQtWidgets/InstrumentView/MaskBinsData.h"
#include
"MantidAPI/AlgorithmManager.h"
#include
"MantidAPI/MatrixWorkspace.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
<vector>
...
...
@@ -71,6 +74,7 @@ void MaskBinsData::clear() { m_masks.clear(); }
* @param lines :: lines from the project file to load state from
*/
void
MaskBinsData
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
for
(
auto
&
maskLines
:
tsv
.
sections
(
"Mask"
))
{
API
::
TSVSerialiser
mask
(
maskLines
);
...
...
@@ -88,12 +92,18 @@ void MaskBinsData::loadFromProject(const std::string &lines) {
addXRange
(
start
,
end
,
spectra
);
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"MaskBinsData::loadFromProject() not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the mask bins to a Mantid project file
* @return a string representing the state of the mask bins
*/
std
::
string
MaskBinsData
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
for
(
const
auto
&
binMask
:
m_masks
)
{
API
::
TSVSerialiser
mask
;
...
...
@@ -105,6 +115,10 @@ std::string MaskBinsData::saveToProject() const {
tsv
.
writeSection
(
"Mask"
,
mask
.
outputLines
());
}
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"MaskBinsData::saveToProject() not implemented for Qt >= 5"
);
#endif
}
}
// namespace MantidWidgets
...
...
qt/widgets/instrumentview/src/Projection3D.cpp
View file @
c38153ed
...
...
@@ -17,7 +17,10 @@
#include
"MantidGeometry/Instrument/ComponentInfo.h"
#include
"MantidGeometry/Objects/CSGObject.h"
#include
"MantidQtWidgets/Common/InputController.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
<boost/scoped_ptr.hpp>
#include
<boost/shared_ptr.hpp>
...
...
@@ -458,6 +461,7 @@ void Projection3D::setLightingModel(bool picking) const {
* @param lines :: lines from the project file to load state from
*/
void
Projection3D
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
ProjectionSurface
::
loadFromProject
(
lines
);
API
::
TSVSerialiser
tsv
(
lines
);
...
...
@@ -466,16 +470,26 @@ void Projection3D::loadFromProject(const std::string &lines) {
tsv
>>
viewportLines
;
m_viewport
.
loadFromProject
(
viewportLines
);
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"Projection3D::loadFromProject not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the 3D projection to a Mantid project file
* @return a string representing the state of the 3D projection
*/
std
::
string
Projection3D
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
tsv
.
writeRaw
(
ProjectionSurface
::
saveToProject
());
tsv
.
writeSection
(
"Viewport"
,
m_viewport
.
saveToProject
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"Projection3D::saveToProject not implemented for Qt >= 5"
);
#endif
}
}
// namespace MantidWidgets
...
...
qt/widgets/instrumentview/src/ProjectionSurface.cpp
View file @
c38153ed
...
...
@@ -6,7 +6,9 @@
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidQtWidgets/InstrumentView/ProjectionSurface.h"
#include
"MantidQtWidgets/Common/InputController.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
"MantidQtWidgets/InstrumentView/GLColor.h"
#include
"MantidQtWidgets/InstrumentView/InstrumentRenderer.h"
#include
"MantidQtWidgets/InstrumentView/MantidGLWidget.h"
...
...
@@ -1004,6 +1006,7 @@ QStringList ProjectionSurface::getPeaksWorkspaceNames() const {
* @param lines :: lines from the project file to load state from
*/
void
ProjectionSurface
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
tsv
.
selectLine
(
"BackgroundColor"
))
{
...
...
@@ -1041,12 +1044,18 @@ void ProjectionSurface::loadFromProject(const std::string &lines) {
return
std
::
make_pair
(
qValue
,
origin
);
});
}
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"ProjectionSurface::loadFromProject() not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the projection surface to a Mantid project file
* @return a string representing the state of the projection surface
*/
std
::
string
ProjectionSurface
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
tsv
.
writeLine
(
"BackgroundColor"
)
<<
m_backgroundColor
;
tsv
.
writeSection
(
"shapes"
,
m_maskShapes
.
saveToProject
());
...
...
@@ -1060,6 +1069,10 @@ std::string ProjectionSurface::saveToProject() const {
tsv
.
writeSection
(
"AlignmentInfo"
,
alignmentInfo
.
outputLines
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"ProjectionSurface::loadsaveToProject() not implemented for Qt >= 5"
);
#endif
}
}
// namespace MantidWidgets
...
...
qt/widgets/instrumentview/src/Shape2D.cpp
View file @
c38153ed
...
...
@@ -5,6 +5,9 @@
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include
"MantidQtWidgets/InstrumentView/Shape2D.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include
"MantidQtWidgets/Common/TSVSerialiser.h"
#endif
#include
<QMouseEvent>
#include
<QPainter>
...
...
@@ -166,6 +169,7 @@ bool Shape2D::isMasked(const QPointF &p) const {
* @return a new shape2D with old state applied
*/
Shape2D
*
Shape2D
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
if
(
!
tsv
.
selectLine
(
"Type"
))
...
...
@@ -201,6 +205,10 @@ Shape2D *Shape2D::loadFromProject(const std::string &lines) {
}
return
shape
;
#else
Q_UNUSED
(
lines
);
return
nullptr
;
#endif
}
/**
...
...
@@ -231,6 +239,7 @@ Shape2D *Shape2D::loadShape2DFromType(const std::string &type,
* @return a string representing the state of the shape 2D
*/
std
::
string
Shape2D
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
bool
props
[]{
m_scalable
,
m_editing
,
m_selected
,
m_visible
};
...
...
@@ -246,6 +255,10 @@ std::string Shape2D::saveToProject() const {
tsv
.
writeLine
(
"FillColor"
)
<<
fillColor
;
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"InstrumentActor::saveToProject() not implemented for Qt >= 5"
);
#endif
}
// --- Shape2DEllipse --- //
...
...
@@ -359,17 +372,24 @@ void Shape2DEllipse::setPoint(const QString &prop, const QPointF &value) {
* @return a new shape2D in the shape of a ellipse
*/
Shape2D
*
Shape2DEllipse
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
tsv
.
selectLine
(
"Parameters"
);
double
radius1
,
radius2
,
x
,
y
;
tsv
>>
radius1
>>
radius2
>>
x
>>
y
;
return
new
Shape2DEllipse
(
QPointF
(
x
,
y
),
radius1
,
radius2
);
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"Shape2DEllipse::loadFromProject not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the shape 2D ellipe to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std
::
string
Shape2DEllipse
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
double
radius1
=
getDouble
(
"radius1"
);
double
radius2
=
getDouble
(
"radius2"
);
...
...
@@ -379,6 +399,10 @@ std::string Shape2DEllipse::saveToProject() const {
tsv
.
writeLine
(
"Parameters"
)
<<
radius1
<<
radius2
<<
centre
.
x
(),
centre
.
y
();
tsv
.
writeRaw
(
Shape2D
::
saveToProject
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"Shape2DEllipse::saveToProject() not implemented for Qt >= 5"
);
#endif
}
// --- Shape2DRectangle --- //
...
...
@@ -423,6 +447,7 @@ void Shape2DRectangle::addToPath(QPainterPath &path) const {
* @return a new shape2D in the shape of a rectangle
*/
Shape2D
*
Shape2DRectangle
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
tsv
.
selectLine
(
"Parameters"
);
double
x0
,
y0
,
x1
,
y1
;
...
...
@@ -430,12 +455,18 @@ Shape2D *Shape2DRectangle::loadFromProject(const std::string &lines) {
QPointF
point1
(
x0
,
y0
);
QPointF
point2
(
x1
,
y1
);
return
new
Shape2DRectangle
(
point1
,
point2
);
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"Shape2DRectangle::loadFromProject not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the shape 2D rectangle to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std
::
string
Shape2DRectangle
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
auto
x0
=
m_boundingRect
.
x0
();
auto
x1
=
m_boundingRect
.
x1
();
...
...
@@ -446,6 +477,10 @@ std::string Shape2DRectangle::saveToProject() const {
tsv
.
writeLine
(
"Parameters"
)
<<
x0
<<
y0
<<
x1
<<
y1
;
tsv
.
writeRaw
(
Shape2D
::
saveToProject
());
return
tsv
.
outputLines
();
#else
throw
std
::
runtime_error
(
"Shape2DRectangle::saveToProject() not implemented for Qt >= 5"
);
#endif
}
// --- Shape2DRing --- //
...
...
@@ -592,6 +627,7 @@ void Shape2DRing::setColor(const QColor &color) {
* @return a new shape2D in the shape of a ring
*/
Shape2D
*
Shape2DRing
::
loadFromProject
(
const
std
::
string
&
lines
)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
(
lines
);
tsv
.
selectLine
(
"Parameters"
);
double
xWidth
,
yWidth
;
...
...
@@ -603,12 +639,18 @@ Shape2D *Shape2DRing::loadFromProject(const std::string &lines) {
auto
baseShape
=
Shape2D
::
loadFromProject
(
baseShapeLines
);
return
new
Shape2DRing
(
baseShape
,
xWidth
,
yWidth
);
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"Shape2DRing::saveToProject() not implemented for Qt >= 5"
);
#endif
}
/** Save the state of the shape 2D ring to a Mantid project file
* @return a string representing the state of the shape 2D
*/
std
::
string
Shape2DRing
::
saveToProject
()
const
{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
API
::
TSVSerialiser
tsv
;
auto
xWidth
=
getDouble
(
"xwidth"
);
auto
yWidth
=
getDouble
(
"ywidth"
);
...
...
@@ -619,6 +661,10 @@ std::string Shape2DRing::saveToProject() const {
tsv
.
writeSection
(