Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
ab842940
Commit
ab842940
authored
Sep 24, 2019
by
Anthony Lim
Browse files
refs #26726 made ALFView presenter and model clearer
parent
396c488b
Changes
3
Hide whitespace changes
Inline
Side-by-side
qt/scientific_interfaces/Direct/ALFView_model.cpp
View file @
ab842940
...
...
@@ -59,7 +59,7 @@ int ALFView_model::loadData(const std::string &name) {
* Loads data, normalise to current and then converts to d spacing
* @return pair<bool,bool>:: If the instrument is ALF, if it is d-spacing
*/
std
::
pair
<
bool
,
bool
>
ALFView_model
::
isDataValid
()
{
std
::
map
<
std
::
string
,
bool
>
ALFView_model
::
isDataValid
()
{
Mantid
::
API
::
MatrixWorkspace_sptr
ws
=
Mantid
::
API
::
AnalysisDataService
::
Instance
()
.
retrieveWS
<
Mantid
::
API
::
MatrixWorkspace
>
(
tmpName
);
...
...
@@ -75,8 +75,11 @@ std::pair<bool, bool> ALFView_model::isDataValid() {
if
(
unit
==
"dSpacing"
)
{
isItDSpace
=
true
;
}
std
::
map
<
std
::
string
,
bool
>
result
=
{
{
"IsValidInstrument"
,
isItALF
},
{
"IsItDSpace"
,
isItDSpace
}};
return
std
::
make_pair
(
isItALF
,
isItDSpace
)
;
return
result
;
}
/*
...
...
qt/scientific_interfaces/Direct/ALFView_model.h
View file @
ab842940
...
...
@@ -6,6 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef MANTIDQT_CUSTOMINTERFACES_ALFVIEWMODEL_H_
#define MANTIDQT_CUSTOMINTERFACES_ALFVIEWMODEL_H_
#include <map>
#include <string>
namespace
MantidQt
{
...
...
@@ -15,7 +16,7 @@ class ALFView_model{
public:
void
loadEmptyInstrument
();
int
loadData
(
const
std
::
string
&
name
);
std
::
pair
<
bool
,
bool
>
isDataValid
();
std
::
map
<
std
::
string
,
bool
>
isDataValid
();
void
transformData
();
void
rename
();
void
remove
();
...
...
qt/scientific_interfaces/Direct/ALFView_presenter.cpp
View file @
ab842940
...
...
@@ -37,7 +37,7 @@ void ALFView_presenter::initLayout() {
void
ALFView_presenter
::
loadAndAnalysis
(
const
std
::
string
&
run
)
{
int
runNumber
=
m_model
->
loadData
(
run
);
auto
bools
=
m_model
->
isDataValid
();
if
(
bools
.
first
)
{
if
(
bools
[
"IsValidInstrument"
]
)
{
m_model
->
rename
();
m_currentRun
=
runNumber
;
}
else
{
...
...
@@ -47,7 +47,7 @@ void ALFView_presenter::loadAndAnalysis(const std::string &run) {
if
(
m_view
->
getRunNumber
()
!=
m_currentRun
)
{
m_view
->
setRunQuietly
(
QString
::
number
(
m_currentRun
));
}
if
(
bools
.
first
&&
!
bools
.
second
)
{
if
(
bools
[
"IsValidInstrument"
]
&&
!
bools
[
"IsItDSpace"
]
)
{
m_model
->
transformData
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment