Commit 9efeb8e1 authored by Anthony Lim's avatar Anthony Lim
Browse files

refs #26726 clang format for ALFView

parent ab842940
......@@ -4,8 +4,8 @@
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#include "ALFView_presenter.h"
#include "ALFView_model.h"
#include "ALFView_presenter.h"
// will need these later
#include "MantidQtWidgets/Common/FunctionBrowser.h"
......@@ -13,7 +13,6 @@
#include "MantidQtWidgets/InstrumentView/InstrumentWidgetPickTab.h"
#include "MantidQtWidgets/Plotting/PreviewPlot.h"
#include "ALFView.h"
namespace MantidQt {
......@@ -21,13 +20,13 @@ namespace CustomInterfaces {
using namespace Mantid;
DECLARE_SUBWINDOW(ALFView)
/// static logger
Mantid::Kernel::Logger g_log("ALFView");
ALFView::ALFView(QWidget *parent) : UserSubWindow(parent), m_view(nullptr),m_presenter(nullptr) {
ALFView::ALFView(QWidget *parent)
: UserSubWindow(parent), m_view(nullptr), m_presenter(nullptr) {
m_view = new ALFView_view(this);
m_model = new ALFView_model();
......
......@@ -7,23 +7,21 @@
#ifndef MANTIDQT_CUSTOMINTERFACES_ALFVIEW_H_
#define MANTIDQT_CUSTOMINTERFACES_ALFVIEW_H_
#include "ALFView_model.h"
#include "ALFView_presenter.h"
#include "ALFView_view.h"
#include "DllConfig.h"
#include "MantidQtWidgets/Common/UserSubWindow.h"
#include "ALFView_view.h"
#include "ALFView_presenter.h"
#include "ALFView_model.h"
namespace MantidQt {
namespace CustomInterfaces {
namespace CustomInterfaces {
/** ALCInterface : Custom interface for Avoided Level Crossing analysis
*/
class MANTIDQT_DIRECT_DLL ALFView : public API::UserSubWindow {
Q_OBJECT
public:
ALFView(QWidget *parent=nullptr);
ALFView(QWidget *parent = nullptr);
~ALFView(){};
static std::string name() { return "ALF View"; }
static QString categoryInfo() { return "Direct"; }
......@@ -32,15 +30,11 @@ protected:
void initLayout() override;
private:
ALFView_view *m_view;
ALFView_model *m_model;
ALFView_presenter *m_presenter;
};
}// customInterfaces
}// MantidQt
} // namespace CustomInterfaces
} // namespace MantidQt
#endif /* MANTIDQT_CUSTOMINTERFACES_ALFVIEW_H_ */
......@@ -27,7 +27,6 @@ const std::string wsName = "ALFData";
namespace MantidQt {
namespace CustomInterfaces {
void ALFView_model::loadEmptyInstrument() {
Mantid::API::IAlgorithm_sptr alg =
Mantid::API::AlgorithmManager::Instance().create("LoadEmptyInstrument");
......@@ -75,9 +74,8 @@ std::map<std::string, bool> ALFView_model::isDataValid() {
if (unit == "dSpacing") {
isItDSpace = true;
}
std::map<std::string, bool> result = {
{"IsValidInstrument", isItALF},
{"IsItDSpace", isItDSpace}};
std::map<std::string, bool> result = {{"IsValidInstrument", isItALF},
{"IsItDSpace", isItDSpace}};
return result;
}
......@@ -117,7 +115,7 @@ int ALFView_model::currentRun() {
Mantid::API::AnalysisDataService::Instance()
.retrieveWS<Mantid::API::MatrixWorkspace>(wsName);
return ws->getRunNumber();
} catch(...) {
} catch (...) {
return -999; // special error code
}
}
......
......@@ -12,17 +12,17 @@
namespace MantidQt {
namespace CustomInterfaces {
class ALFView_model{
class ALFView_model {
public:
void loadEmptyInstrument();
int loadData(const std::string &name);
std::map<std::string, bool> isDataValid();
void transformData();
void rename();
void remove();
int currentRun();
int loadData(const std::string &name);
std::map<std::string, bool> isDataValid();
void transformData();
void rename();
void remove();
int currentRun();
}; // namespace CustomInterfaces
} // namespace MantidQt
} // namespace CustomInterfaces
} // namespace MantidQt
#endif /* MANTIDQT_CUSTOMINTERFACES_ALFVIEWMODEL_H_ */
......@@ -10,14 +10,14 @@
#include "MantidAPI/FileFinder.h"
#include<functional>
#include <functional>
namespace MantidQt {
namespace CustomInterfaces {
ALFView_presenter::ALFView_presenter(ALFView_view *view, ALFView_model *model)
: m_view(view), m_model(model), m_currentRun(0),
m_loadRunObserver(nullptr), m_browseObserver(nullptr) {
: m_view(view), m_model(model), m_currentRun(0), m_loadRunObserver(nullptr),
m_browseObserver(nullptr) {
m_loadRunObserver = new loadObserver();
m_browseObserver = new generalObserver();
m_model->loadEmptyInstrument();
......
......@@ -7,26 +7,26 @@
#ifndef MANTIDQT_CUSTOMINTERFACES_ALFVIEWPRESENTER_H_
#define MANTIDQT_CUSTOMINTERFACES_ALFVIEWPRESENTER_H_
#include "ALFView_model.h"
#include "ALFView_view.h"
#include "DllConfig.h"
#include "MantidQtWidgets/Common/UserSubWindow.h"
#include "ALFView_view.h"
#include "ALFView_model.h"
#include "observerPattern.h"
namespace MantidQt {
namespace CustomInterfaces {
namespace CustomInterfaces {
/** ALCInterface : Custom interface for Avoided Level Crossing analysis
*/
class MANTIDQT_DIRECT_DLL ALFView_presenter : public QObject{
Q_OBJECT
class MANTIDQT_DIRECT_DLL ALFView_presenter : public QObject {
Q_OBJECT
public:
ALFView_presenter( ALFView_view *view, ALFView_model *model);
ALFView_presenter(ALFView_view *view, ALFView_model *model);
~ALFView_presenter(){};
void initLayout();
private slots:
void loadRunNumber();
void loadRunNumber();
void loadBrowsedFile(const std::string);
private:
......@@ -37,11 +37,8 @@ private:
int m_currentRun;
loadObserver *m_loadRunObserver;
generalObserver *m_browseObserver;
};
}// customInterfaces
}// MantidQt
};
} // namespace CustomInterfaces
} // namespace MantidQt
#endif /* MANTIDQT_CUSTOMINTERFACES_ALFVIEWPRESENTER_H_ */
......@@ -17,8 +17,8 @@ namespace MantidQt {
namespace CustomInterfaces {
ALFView_view::ALFView_view(QWidget *parent)
: QWidget(parent), m_run(nullptr),
m_loadRunObservable(nullptr), m_browseObservable(nullptr) {
: QWidget(parent), m_run(nullptr), m_loadRunObservable(nullptr),
m_browseObservable(nullptr) {
QSplitter *MainLayout = new QSplitter(Qt::Vertical, this);
QWidget *loadBar = new QWidget();
m_loadRunObservable = new observable();
......@@ -56,12 +56,12 @@ void ALFView_view::runChanged() {
} // emit newRun(); }
void ALFView_view::browse() {
auto file = QFileDialog::getOpenFileName(this, "Open a file",
"", "File (*.nxs)");
auto file =
QFileDialog::getOpenFileName(this, "Open a file", "", "File (*.nxs)");
if (file.isEmpty()) {
return;
}
//emit browsedToRun(file.toStdString());
// emit browsedToRun(file.toStdString());
m_browseObservable->notify(file.toStdString());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment