Unverified Commit 0bc884fc authored by DannyHindson's avatar DannyHindson Committed by GitHub
Browse files

Merge pull request #32531 from DavidFair/cppcheck_cache

Cppcheck cache
parents 3ee31c71 30f7d72e
...@@ -23,9 +23,9 @@ const std::string CURVES = "Curves"; ...@@ -23,9 +23,9 @@ const std::string CURVES = "Curves";
using namespace Mantid::API; using namespace Mantid::API;
namespace MantidQt::CustomInterfaces { namespace MantidQt::CustomInterfaces {
ALFCustomInstrumentModel::ALFCustomInstrumentModel() : m_numberOfTubesInAverage(0) { ALFCustomInstrumentModel::ALFCustomInstrumentModel()
m_base = new MantidWidgets::BaseCustomInstrumentModel("ALF_tmp", "ALF", "ALFData"); : m_numberOfTubesInAverage(0),
} m_base(std::make_unique<MantidWidgets::BaseCustomInstrumentModel>("ALF_tmp", "ALF", "ALFData")) {}
/* /*
* Runs load data alg * Runs load data alg
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h" #include "MantidQtWidgets/InstrumentView/BaseCustomInstrumentModel.h"
#include <map> #include <map>
#include <memory>
#include <string> #include <string>
namespace MantidQt { namespace MantidQt {
...@@ -40,7 +41,7 @@ class DLLExport ALFCustomInstrumentModel : public IALFCustomInstrumentModel { ...@@ -40,7 +41,7 @@ class DLLExport ALFCustomInstrumentModel : public IALFCustomInstrumentModel {
public: public:
ALFCustomInstrumentModel(); ALFCustomInstrumentModel();
virtual ~ALFCustomInstrumentModel(){}; virtual ~ALFCustomInstrumentModel() = default;
// virtual so we can patch them later // virtual so we can patch them later
virtual void loadAlg(const std::string &name) override; virtual void loadAlg(const std::string &name) override;
virtual void transformData() override; virtual void transformData() override;
...@@ -69,7 +70,7 @@ public: ...@@ -69,7 +70,7 @@ public:
private: private:
int m_numberOfTubesInAverage; int m_numberOfTubesInAverage;
MantidWidgets::BaseCustomInstrumentModel *m_base; std::unique_ptr<MantidWidgets::BaseCustomInstrumentModel> m_base;
}; };
} // namespace CustomInterfaces } // namespace CustomInterfaces
......
...@@ -25,7 +25,7 @@ namespace ISISReflectometry { ...@@ -25,7 +25,7 @@ namespace ISISReflectometry {
class BatchPresenterFactory : public IBatchPresenterFactory { class BatchPresenterFactory : public IBatchPresenterFactory {
public: public:
BatchPresenterFactory( BatchPresenterFactory(
// cppcheck-suppress passedByValue
RunsPresenterFactory runsPresenterFactory, EventPresenterFactory eventPresenterFactory, RunsPresenterFactory runsPresenterFactory, EventPresenterFactory eventPresenterFactory,
ExperimentPresenterFactory experimentPresenterFactory, InstrumentPresenterFactory instrumentPresenterFactory, ExperimentPresenterFactory experimentPresenterFactory, InstrumentPresenterFactory instrumentPresenterFactory,
PreviewPresenterFactory previewPresenterFactory, SavePresenterFactory savePresenterFactory) PreviewPresenterFactory previewPresenterFactory, SavePresenterFactory savePresenterFactory)
......
...@@ -22,7 +22,7 @@ namespace ISISReflectometry { ...@@ -22,7 +22,7 @@ namespace ISISReflectometry {
class ExperimentValidationErrors { class ExperimentValidationErrors {
public: public:
explicit ExperimentValidationErrors( explicit ExperimentValidationErrors(
// cppcheck-suppress passedByValue
LookupTableValidationError lookupTableErrors) LookupTableValidationError lookupTableErrors)
: m_lookupTableErrors(std::move(lookupTableErrors)) {} : m_lookupTableErrors(std::move(lookupTableErrors)) {}
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
namespace MantidQt::CustomInterfaces::ISISReflectometry { namespace MantidQt::CustomInterfaces::ISISReflectometry {
InvalidDefaultsError::InvalidDefaultsError( // cppcheck-suppress passedByValue InvalidDefaultsError::InvalidDefaultsError(int row, std::vector<int> invalidColumns)
int row, std::vector<int> invalidColumns)
: m_invalidColumns(std::move(invalidColumns)), m_row(row) {} : m_invalidColumns(std::move(invalidColumns)), m_row(row) {}
std::vector<int> const &InvalidDefaultsError::invalidColumns() const { return m_invalidColumns; } std::vector<int> const &InvalidDefaultsError::invalidColumns() const { return m_invalidColumns; }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
namespace MantidQt::CustomInterfaces::ISISReflectometry { namespace MantidQt::CustomInterfaces::ISISReflectometry {
LookupTableValidationError::LookupTableValidationError( LookupTableValidationError::LookupTableValidationError(
// cppcheck-suppress passedByValue
std::vector<InvalidDefaultsError> validationErrors, boost::optional<ThetaValuesValidationError> fullTableError) std::vector<InvalidDefaultsError> validationErrors, boost::optional<ThetaValuesValidationError> fullTableError)
: m_validationErrors(std::move(validationErrors)), m_fullTableError(std::move(fullTableError)) {} : m_validationErrors(std::move(validationErrors)), m_fullTableError(std::move(fullTableError)) {}
......
...@@ -19,9 +19,8 @@ namespace ISISReflectometry { ...@@ -19,9 +19,8 @@ namespace ISISReflectometry {
class RunsPresenterFactory { class RunsPresenterFactory {
public: public:
RunsPresenterFactory( // cppcheck-suppress passedByValue RunsPresenterFactory(RunsTablePresenterFactory runsTablePresenterFactory, double thetaTolerance,
RunsTablePresenterFactory runsTablePresenterFactory, double thetaTolerance, std::vector<std::string> instruments, std::vector<std::string> instruments, IMessageHandler *messageHandler)
IMessageHandler *messageHandler)
: m_runsTablePresenterFactory(std::move(runsTablePresenterFactory)), m_thetaTolerance(std::move(thetaTolerance)), : m_runsTablePresenterFactory(std::move(runsTablePresenterFactory)), m_thetaTolerance(std::move(thetaTolerance)),
m_instruments(std::move(instruments)), m_messageHandler(messageHandler) {} m_instruments(std::move(instruments)), m_messageHandler(messageHandler) {}
......
...@@ -24,9 +24,9 @@ Experiment::Experiment(AnalysisMode analysisMode, ReductionType reductionType, S ...@@ -24,9 +24,9 @@ Experiment::Experiment(AnalysisMode analysisMode, ReductionType reductionType, S
bool includePartialBins, bool debug, BackgroundSubtraction backgroundSubtraction, bool includePartialBins, bool debug, BackgroundSubtraction backgroundSubtraction,
PolarizationCorrections polarizationCorrections, FloodCorrections floodCorrections, PolarizationCorrections polarizationCorrections, FloodCorrections floodCorrections,
TransmissionStitchOptions transmissionStitchOptions, TransmissionStitchOptions transmissionStitchOptions,
// cppcheck-suppress passedByValue
std::map<std::string, std::string> stitchParameters, std::map<std::string, std::string> stitchParameters,
// cppcheck-suppress passedByValue
LookupTable lookupTable) LookupTable lookupTable)
: m_analysisMode(analysisMode), m_reductionType(reductionType), m_summationType(summationType), : m_analysisMode(analysisMode), m_reductionType(reductionType), m_summationType(summationType),
m_includePartialBins(includePartialBins), m_debug(debug), m_backgroundSubtraction(backgroundSubtraction), m_includePartialBins(includePartialBins), m_debug(debug), m_backgroundSubtraction(backgroundSubtraction),
......
...@@ -13,12 +13,11 @@ ...@@ -13,12 +13,11 @@
namespace MantidQt::CustomInterfaces::ISISReflectometry { namespace MantidQt::CustomInterfaces::ISISReflectometry {
Group::Group( // cppcheck-suppress passedByValue Group::Group(std::string name, std::vector<boost::optional<Row>> rows)
std::string name, std::vector<boost::optional<Row>> rows)
: m_name(std::move(name)), m_postprocessedWorkspaceName(), m_rows(std::move(rows)) {} : m_name(std::move(name)), m_postprocessedWorkspaceName(), m_rows(std::move(rows)) {}
Group::Group( Group::Group(
// cppcheck-suppress passedByValue
std::string name) std::string name)
: m_name(std::move(name)), m_rows() {} : m_name(std::move(name)), m_rows() {}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
namespace MantidQt::CustomInterfaces::ISISReflectometry { namespace MantidQt::CustomInterfaces::ISISReflectometry {
LookupRow::LookupRow(boost::optional<double> theta, LookupRow::LookupRow(boost::optional<double> theta,
// cppcheck-suppress passedByValue
TransmissionRunPair transmissionRuns, TransmissionRunPair transmissionRuns,
boost::optional<ProcessingInstructions> transmissionProcessingInstructions, RangeInQ qRange, boost::optional<ProcessingInstructions> transmissionProcessingInstructions, RangeInQ qRange,
boost::optional<double> scaleFactor, boost::optional<double> scaleFactor,
......
...@@ -32,9 +32,7 @@ int countItems(ReductionJobs const &jobs, Item::ItemCountFunction countFunction) ...@@ -32,9 +32,7 @@ int countItems(ReductionJobs const &jobs, Item::ItemCountFunction countFunction)
} }
} // namespace } // namespace
ReductionJobs::ReductionJobs( // cppcheck-suppress passedByValue ReductionJobs::ReductionJobs(std::vector<Group> groups) : m_groups(std::move(groups)), m_groupNameSuffix(1) {}
std::vector<Group> groups)
: m_groups(std::move(groups)), m_groupNameSuffix(1) {}
ReductionJobs::ReductionJobs() : m_groupNameSuffix(1) {} ReductionJobs::ReductionJobs() : m_groupNameSuffix(1) {}
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
namespace MantidQt::CustomInterfaces::ISISReflectometry { namespace MantidQt::CustomInterfaces::ISISReflectometry {
ReductionWorkspaces::ReductionWorkspaces( ReductionWorkspaces::ReductionWorkspaces(
// cppcheck-suppress passedByValue
std::vector<std::string> inputRunNumbers, std::vector<std::string> inputRunNumbers,
// cppcheck-suppress passedByValue
TransmissionRunPair transmissionRuns) TransmissionRunPair transmissionRuns)
: m_inputRunNumbers(std::move(inputRunNumbers)), m_transmissionRuns(std::move(transmissionRuns)), m_iVsLambda(), : m_inputRunNumbers(std::move(inputRunNumbers)), m_transmissionRuns(std::move(transmissionRuns)), m_iVsLambda(),
m_iVsQ(), m_iVsQBinned() {} m_iVsQ(), m_iVsQBinned() {}
......
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
namespace MantidQt::CustomInterfaces::ISISReflectometry { namespace MantidQt::CustomInterfaces::ISISReflectometry {
Row::Row( // cppcheck-suppress passedByValue Row::Row(std::vector<std::string> runNumbers, double theta,
std::vector<std::string> runNumbers, double theta,
// cppcheck-suppress passedByValue TransmissionRunPair transmissionRuns, RangeInQ qRange, boost::optional<double> scaleFactor,
TransmissionRunPair transmissionRuns, RangeInQ qRange, boost::optional<double> scaleFactor, ReductionOptionsMap reductionOptions,
ReductionOptionsMap reductionOptions,
// cppcheck-suppress passedByValue ReductionWorkspaces reducedWorkspaceNames)
ReductionWorkspaces reducedWorkspaceNames)
: Item(), m_runNumbers(std::move(runNumbers)), m_theta(theta), m_qRange(std::move(qRange)), m_qRangeOutput(), : Item(), m_runNumbers(std::move(runNumbers)), m_theta(theta), m_qRange(std::move(qRange)), m_qRangeOutput(),
m_scaleFactor(std::move(scaleFactor)), m_transmissionRuns(std::move(transmissionRuns)), m_scaleFactor(std::move(scaleFactor)), m_transmissionRuns(std::move(transmissionRuns)),
m_reducedWorkspaceNames(std::move(reducedWorkspaceNames)), m_reductionOptions(std::move(reductionOptions)) { m_reducedWorkspaceNames(std::move(reducedWorkspaceNames)), m_reductionOptions(std::move(reductionOptions)) {
......
...@@ -11,10 +11,9 @@ namespace MantidQt::CustomInterfaces::ISISReflectometry { ...@@ -11,10 +11,9 @@ namespace MantidQt::CustomInterfaces::ISISReflectometry {
using MantidWidgets::Batch::RowLocation; using MantidWidgets::Batch::RowLocation;
RunsTable::RunsTable( // cppcheck-suppress passedByValue RunsTable::RunsTable(std::vector<std::string> instruments, double thetaTolerance,
std::vector<std::string> instruments, double thetaTolerance,
// cppcheck-suppress passedByValue ReductionJobs reductionJobs)
ReductionJobs reductionJobs)
: m_instruments(std::move(instruments)), m_thetaTolerance(thetaTolerance), : m_instruments(std::move(instruments)), m_thetaTolerance(thetaTolerance),
m_reductionJobs(std::move(reductionJobs)), m_selectedRowLocations() {} m_reductionJobs(std::move(reductionJobs)), m_selectedRowLocations() {}
......
...@@ -41,9 +41,7 @@ std::ostream &operator<<(std::ostream &os, UniformSlicingByNumberOfSlices const ...@@ -41,9 +41,7 @@ std::ostream &operator<<(std::ostream &os, UniformSlicingByNumberOfSlices const
return (os << slicing.numberOfSlices() << " even slices"); return (os << slicing.numberOfSlices() << " even slices");
} }
CustomSlicingByList::CustomSlicingByList( // cppcheck-suppress passedByValue CustomSlicingByList::CustomSlicingByList(std::vector<double> sliceTimes) : m_sliceTimes(std::move(sliceTimes)) {}
std::vector<double> sliceTimes)
: m_sliceTimes(std::move(sliceTimes)) {}
std::vector<double> const &CustomSlicingByList::sliceTimes() const { return m_sliceTimes; } std::vector<double> const &CustomSlicingByList::sliceTimes() const { return m_sliceTimes; }
...@@ -66,8 +64,7 @@ std::ostream &operator<<(std::ostream &os, CustomSlicingByList const &slicing) { ...@@ -66,8 +64,7 @@ std::ostream &operator<<(std::ostream &os, CustomSlicingByList const &slicing) {
std::ostream &operator<<(std::ostream &os, InvalidSlicing const &) { return (os << "invalid slices"); } std::ostream &operator<<(std::ostream &os, InvalidSlicing const &) { return (os << "invalid slices"); }
SlicingByEventLog::SlicingByEventLog( // cppcheck-suppress passedByValue SlicingByEventLog::SlicingByEventLog(std::vector<double> sliceAtValues, std::string blockValue)
std::vector<double> sliceAtValues, std::string blockValue)
: m_sliceAtValues(std::move(sliceAtValues)), m_blockName(std::move(blockValue)) {} : m_sliceAtValues(std::move(sliceAtValues)), m_blockName(std::move(blockValue)) {}
std::vector<double> const &SlicingByEventLog::sliceAtValues() const { return m_sliceAtValues; } std::vector<double> const &SlicingByEventLog::sliceAtValues() const { return m_sliceAtValues; }
......
...@@ -11,17 +11,16 @@ namespace MantidQt::CustomInterfaces::ISISReflectometry { ...@@ -11,17 +11,16 @@ namespace MantidQt::CustomInterfaces::ISISReflectometry {
TransmissionRunPair::TransmissionRunPair() : m_firstTransmissionRunNumbers(), m_secondTransmissionRunNumbers() {} TransmissionRunPair::TransmissionRunPair() : m_firstTransmissionRunNumbers(), m_secondTransmissionRunNumbers() {}
TransmissionRunPair::TransmissionRunPair( // cppcheck-suppress passedByValue TransmissionRunPair::TransmissionRunPair(std::string firstTransmissionRun,
std::string firstTransmissionRun,
// cppcheck-suppress passedByValue std::string secondTransmissionRun)
std::string secondTransmissionRun)
: m_firstTransmissionRunNumbers{std::move(firstTransmissionRun)}, m_secondTransmissionRunNumbers{ : m_firstTransmissionRunNumbers{std::move(firstTransmissionRun)}, m_secondTransmissionRunNumbers{
std::move(secondTransmissionRun)} {} std::move(secondTransmissionRun)} {}
TransmissionRunPair::TransmissionRunPair( TransmissionRunPair::TransmissionRunPair(
// cppcheck-suppress passedByValue
std::vector<std::string> firstTransmissionRunNumbers, std::vector<std::string> firstTransmissionRunNumbers,
// cppcheck-suppress passedByValue
std::vector<std::string> secondTransmissionRunNumbers) std::vector<std::string> secondTransmissionRunNumbers)
: m_firstTransmissionRunNumbers(std::move(firstTransmissionRunNumbers)), : m_firstTransmissionRunNumbers(std::move(firstTransmissionRunNumbers)),
m_secondTransmissionRunNumbers(std::move(secondTransmissionRunNumbers)) {} m_secondTransmissionRunNumbers(std::move(secondTransmissionRunNumbers)) {}
......
...@@ -11,9 +11,7 @@ namespace MantidQt::CustomInterfaces { ...@@ -11,9 +11,7 @@ namespace MantidQt::CustomInterfaces {
IndirectBayesTab::IndirectBayesTab(QWidget *parent) : IndirectTab(parent), m_propTree(new QtTreePropertyBrowser()) { IndirectBayesTab::IndirectBayesTab(QWidget *parent) : IndirectTab(parent), m_propTree(new QtTreePropertyBrowser()) {
m_propTree->setFactoryForManager(m_dblManager, m_dblEdFac); m_propTree->setFactoryForManager(m_dblManager, m_dblEdFac);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
// cppcheck-suppress pureVirtualCall
SLOT(updateProperties(QtProperty *, double)));
} }
IndirectBayesTab::~IndirectBayesTab() { m_propTree->unsetFactoryForManager(m_dblManager); } IndirectBayesTab::~IndirectBayesTab() { m_propTree->unsetFactoryForManager(m_dblManager); }
......
...@@ -82,6 +82,9 @@ public: ...@@ -82,6 +82,9 @@ public:
explicit WidgetScrollbarDecorator(QWidget *target); explicit WidgetScrollbarDecorator(QWidget *target);
virtual ~WidgetScrollbarDecorator(); virtual ~WidgetScrollbarDecorator();
WidgetScrollbarDecorator(const WidgetScrollbarDecorator &) = delete;
WidgetScrollbarDecorator &operator=(WidgetScrollbarDecorator) = delete;
/// Check whether the target is currently scrollable /// Check whether the target is currently scrollable
bool enabled() const; bool enabled() const;
......
...@@ -213,7 +213,7 @@ protected: ...@@ -213,7 +213,7 @@ protected:
private: private:
friend class ObserverCallback; friend class ObserverCallback;
ObserverCallback *m_proxy; std::unique_ptr<ObserverCallback> m_proxy;
bool m_predel_observed, m_postdel_observed, m_add_observed, m_repl_observed, m_rename_observed, m_clr_observed; bool m_predel_observed, m_postdel_observed, m_add_observed, m_repl_observed, m_rename_observed, m_clr_observed;
}; };
......
...@@ -48,23 +48,23 @@ WorkspaceObserver::WorkspaceObserver() ...@@ -48,23 +48,23 @@ WorkspaceObserver::WorkspaceObserver()
m_addObserver(*this, &WorkspaceObserver::_addHandle), m_addObserver(*this, &WorkspaceObserver::_addHandle),
m_afterReplaceObserver(*this, &WorkspaceObserver::_afterReplaceHandle), m_afterReplaceObserver(*this, &WorkspaceObserver::_afterReplaceHandle),
m_renameObserver(*this, &WorkspaceObserver::_renameHandle), m_renameObserver(*this, &WorkspaceObserver::_renameHandle),
m_clearADSObserver(*this, &WorkspaceObserver::_clearADSHandle), m_predel_observed(false), m_clearADSObserver(*this, &WorkspaceObserver::_clearADSHandle), m_proxy(std::make_unique<ObserverCallback>(this)),
m_postdel_observed(false), m_add_observed(false), m_repl_observed(false), m_rename_observed(false), m_predel_observed(false), m_postdel_observed(false), m_add_observed(false), m_repl_observed(false),
m_clr_observed(false) { m_rename_observed(false), m_clr_observed(false) {}
m_proxy = new ObserverCallback(this);
}
/// Destructor /// Destructor
WorkspaceObserver::~WorkspaceObserver() { WorkspaceObserver::~WorkspaceObserver() {
observePreDelete(false); auto &notificationCenter = Mantid::API::AnalysisDataService::Instance().notificationCenter;
observePostDelete(false); // Do the minimum cleanup of dangling observer refs, rather than disconnecting signals / slots
observeAdd(false); // through observeX, as we're about to destroy the proxy anyway
observeAfterReplace(false); notificationCenter.removeObserver(m_preDeleteObserver);
observeRename(false); notificationCenter.removeObserver(m_postDeleteObserver);
observeADSClear(false); notificationCenter.removeObserver(m_addObserver);
notificationCenter.removeObserver(m_afterReplaceObserver);
notificationCenter.removeObserver(m_renameObserver);
notificationCenter.removeObserver(m_clearADSObserver);
m_proxy->disconnect(); m_proxy->disconnect();
delete m_proxy;
} }
/** /**
...@@ -76,13 +76,13 @@ void WorkspaceObserver::observePreDelete(bool turnOn) { ...@@ -76,13 +76,13 @@ void WorkspaceObserver::observePreDelete(bool turnOn) {
if (turnOn && !m_predel_observed) // Turning it on if (turnOn && !m_predel_observed) // Turning it on
{ {
Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_preDeleteObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_preDeleteObserver);
m_proxy->connect(m_proxy, SIGNAL(preDeleteRequested(const std::string &, Mantid::API::Workspace_sptr)), m_proxy->connect(m_proxy.get(), SIGNAL(preDeleteRequested(const std::string &, Mantid::API::Workspace_sptr)),
SLOT(handlePreDelete(const std::string &, Mantid::API::Workspace_sptr)), Qt::QueuedConnection); SLOT(handlePreDelete(const std::string &, Mantid::API::Workspace_sptr)), Qt::QueuedConnection);
} else if (!turnOn && m_predel_observed) // Turning it off } else if (!turnOn && m_predel_observed) // Turning it off
{ {
Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_preDeleteObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_preDeleteObserver);
m_proxy->disconnect(m_proxy, SIGNAL(preDeleteRequested(const std::string &, Mantid::API::Workspace_sptr)), m_proxy, m_proxy->disconnect(m_proxy.get(), SIGNAL(preDeleteRequested(const std::string &, Mantid::API::Workspace_sptr)),
SLOT(handlePreDelete(const std::string &, Mantid::API::Workspace_sptr))); m_proxy.get(), SLOT(handlePreDelete(const std::string &, Mantid::API::Workspace_sptr)));
} else { } else {
} }
m_predel_observed = turnOn; m_predel_observed = turnOn;
...@@ -97,12 +97,12 @@ void WorkspaceObserver::observePostDelete(bool turnOn) { ...@@ -97,12 +97,12 @@ void WorkspaceObserver::observePostDelete(bool turnOn) {
if (turnOn && !m_postdel_observed) // Turning it on if (turnOn && !m_postdel_observed) // Turning it on
{ {
Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_postDeleteObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_postDeleteObserver);
m_proxy->connect(m_proxy, SIGNAL(postDeleteRequested(const std::string &)), m_proxy->connect(m_proxy.get(), SIGNAL(postDeleteRequested(const std::string &)),
SLOT(handlePostDelete(const std::string &)), Qt::QueuedConnection); SLOT(handlePostDelete(const std::string &)), Qt::QueuedConnection);
} else if (!turnOn && m_postdel_observed) // Turning it off } else if (!turnOn && m_postdel_observed) // Turning it off
{ {
Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_postDeleteObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_postDeleteObserver);
m_proxy->disconnect(m_proxy, SIGNAL(postDeleteRequested(const std::string &)), m_proxy, m_proxy->disconnect(m_proxy.get(), SIGNAL(postDeleteRequested(const std::string &)), m_proxy.get(),
SLOT(handlePostDelete(const std::string &))); SLOT(handlePostDelete(const std::string &)));
} else { } else {
} }
...@@ -117,12 +117,12 @@ void WorkspaceObserver::observePostDelete(bool turnOn) { ...@@ -117,12 +117,12 @@ void WorkspaceObserver::observePostDelete(bool turnOn) {
void WorkspaceObserver::observeAfterReplace(bool turnOn) { void WorkspaceObserver::observeAfterReplace(bool turnOn) {
if (turnOn && !m_repl_observed) { if (turnOn && !m_repl_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_afterReplaceObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_afterReplaceObserver);
m_proxy->connect(m_proxy, SIGNAL(afterReplaced(const std::string &, Mantid::API::Workspace_sptr)), m_proxy->connect(m_proxy.get(), SIGNAL(afterReplaced(const std::string &, Mantid::API::Workspace_sptr)),
SLOT(handleAfterReplace(const std::string &, Mantid::API::Workspace_sptr)), Qt::QueuedConnection); SLOT(handleAfterReplace(const std::string &, Mantid::API::Workspace_sptr)), Qt::QueuedConnection);
} else if (!turnOn && m_repl_observed) { } else if (!turnOn && m_repl_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_afterReplaceObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_afterReplaceObserver);
m_proxy->disconnect(m_proxy, SIGNAL(afterReplaced(const std::string &, Mantid::API::Workspace_sptr)), m_proxy, m_proxy->disconnect(m_proxy.get(), SIGNAL(afterReplaced(const std::string &, Mantid::API::Workspace_sptr)),
SLOT(handleAfterReplace(const std::string &, Mantid::API::Workspace_sptr))); m_proxy.get(), SLOT(handleAfterReplace(const std::string &, Mantid::API::Workspace_sptr)));
} }
m_repl_observed = turnOn; m_repl_observed = turnOn;
} }
...@@ -135,11 +135,11 @@ void WorkspaceObserver::observeAfterReplace(bool turnOn) { ...@@ -135,11 +135,11 @@ void WorkspaceObserver::observeAfterReplace(bool turnOn) {
void WorkspaceObserver::observeRename(bool turnOn) { void WorkspaceObserver::observeRename(bool turnOn) {
if (turnOn && !m_rename_observed) { if (turnOn && !m_rename_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_renameObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_renameObserver);
m_proxy->connect(m_proxy, SIGNAL(renamed(const std::string &, const std::string &)), m_proxy->connect(m_proxy.get(), SIGNAL(renamed(const std::string &, const std::string &)),
SLOT(handleRename(const std::string &, const std::string &)), Qt::QueuedConnection); SLOT(handleRename(const std::string &, const std::string &)), Qt::QueuedConnection);
} else if (!turnOn && m_rename_observed) { } else if (!turnOn && m_rename_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_renameObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_renameObserver);
m_proxy->disconnect(m_proxy, SIGNAL(renamed(const std::string &, const std::string &)), m_proxy, m_proxy->disconnect(m_proxy.get(), SIGNAL(renamed(const std::string &, const std::string &)), m_proxy.get(),
SLOT(handleRename(const std::string &, const std::string &))); SLOT(handleRename(const std::string &, const std::string &)));
} }
m_rename_observed = turnOn; m_rename_observed = turnOn;
...@@ -153,12 +153,12 @@ void WorkspaceObserver::observeRename(bool turnOn) { ...@@ -153,12 +153,12 @@ void WorkspaceObserver::observeRename(bool turnOn) {
void WorkspaceObserver::observeAdd(bool turnOn) { void WorkspaceObserver::observeAdd(bool turnOn) {
if (turnOn && !m_add_observed) { if (turnOn && !m_add_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_addObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_addObserver);
m_proxy->connect(m_proxy, SIGNAL(addRequested(const std::string &, Mantid::API::Workspace_sptr)), m_proxy->connect(m_proxy.get(), SIGNAL(addRequested(const std::string &, Mantid::API::Workspace_sptr)),
SLOT(handleAdd(const std::string &, Mantid::API::Workspace_sptr)), Qt::QueuedConnection); SLOT(handleAdd(const std::string &, Mantid::API::Workspace_sptr)), Qt::QueuedConnection);
} else if (!turnOn && m_add_observed) { } else if (!turnOn && m_add_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_addObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_addObserver);
m_proxy->disconnect(m_proxy, SIGNAL(addRequested(const std::string &, Mantid::API::Workspace_sptr)), m_proxy, m_proxy->disconnect(m_proxy.get(), SIGNAL(addRequested(const std::string &, Mantid::API::Workspace_sptr)),
SLOT(handleAdd(const std::string &, Mantid::API::Workspace_sptr))); m_proxy.get(), SLOT(handleAdd(const std::string &, Mantid::API::Workspace_sptr)));
} }
m_add_observed = turnOn; m_add_observed = turnOn;
} }
...@@ -171,10 +171,10 @@ void WorkspaceObserver::observeAdd(bool turnOn) { ...@@ -171,10 +171,10 @@ void WorkspaceObserver::observeAdd(bool turnOn) {
void WorkspaceObserver::observeADSClear(bool turnOn) { void WorkspaceObserver::observeADSClear(bool turnOn) {
if (turnOn && !m_clr_observed) { if (turnOn && !m_clr_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_clearADSObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.addObserver(m_clearADSObserver);
m_proxy->connect(m_proxy, SIGNAL(adsCleared()), SLOT(handleClearADS()), Qt::QueuedConnection); m_proxy->connect(m_proxy.get(), SIGNAL(adsCleared()), SLOT(handleClearADS()), Qt::QueuedConnection);
} else if (!turnOn && m_clr_observed) { } else if (!turnOn && m_clr_observed) {
Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_clearADSObserver); Mantid::API::AnalysisDataService::Instance().notificationCenter.removeObserver(m_clearADSObserver);
m_proxy->disconnect(m_proxy, SIGNAL(adsCleared()), m_proxy, SLOT(handleClearADS())); m_proxy->disconnect(m_proxy.get(), SIGNAL(adsCleared()), m_proxy.get(), SLOT(handleClearADS()));
} }
m_clr_observed = turnOn; m_clr_observed = turnOn;
} }
......