Mantid
Loading...
Searching...
No Matches
Public Slots | Signals | Public Member Functions | Properties | Private Slots | Private Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::InstrumentSelector Class Reference

This class defines a widget for selecting an instrument known to Mantid. More...

#include <InstrumentSelector.h>

Inheritance diagram for MantidQt::MantidWidgets::InstrumentSelector:

Public Slots

void fillWithInstrumentsFromFacility (const QString &name=QString())
 Update list for a new facility. More...
 

Signals

void configValueChanged (const QString &, const QString &, const QString &)
 
void instrumentListUpdated ()
 Signals that the list of instruments has been updated. More...
 
void instrumentSelectionChanged (const QString &)
 Indicate that the instrument selection has changed. More...
 

Public Member Functions

bool getAutoUpdate ()
 Returns true of auto reloading on facility change is enabled. More...
 
QString getFacility ()
 Get the name of the facility instrumetns are currently loaded from. More...
 
QStringList getTechniques () const
 Return the list of techniques. More...
 
 InstrumentSelector (QWidget *parent=nullptr, bool init=true)
 Default Constructor. More...
 
void setAutoUpdate (bool autoUpdate)
 Enable or disable reloading on facility change. More...
 
void setFacility (const QString &facilityName)
 Load instruments from a given facility. More...
 
void setTechniques (const QStringList &techniques)
 Set the list of techniques. More...
 
void updateInstrumentOnSelection (const bool storeChanges)
 Sets whether to update the default instrument on selection change. More...
 
 ~InstrumentSelector () override
 Destructor. More...
 

Properties

QString facility
 
QStringList techniques
 
bool updateOnFacilityChange
 

Private Slots

void updateInstrument (const QString &name)
 Handle an instrument seelction. More...
 

Private Member Functions

void filterByTechniquesAtFacility (const QStringList &techniques, const Mantid::Kernel::FacilityInfo &facility)
 Filter the list to only show those supporting the given technique. More...
 
void handleConfigChange (Mantid::Kernel::ConfigValChangeNotification_ptr pNf)
 

Private Attributes

Poco::NObserver< InstrumentSelector, Mantid::Kernel::ConfigValChangeNotificationm_changeObserver
 Poco Observer for Config Service Notifications. More...
 
const Mantid::Kernel::FacilityInfom_currentFacility
 The current facility. More...
 
bool m_init
 Should the object be initialized. More...
 
QString m_selectedInstrument
 The last selected instrument. More...
 
bool m_storeChanges
 Should the default instrument be changed when the selection changes. More...
 
QStringList m_techniques
 A list of technqiues. More...
 
bool m_updateOnFacilityChange
 If the instrument list should be reloaded when the facility changes. More...
 

Detailed Description

This class defines a widget for selecting an instrument known to Mantid.

Author
Martyn Gigg, Tessella Support Services plc
Date
10/08/2010

Definition at line 30 of file InstrumentSelector.h.

Constructor & Destructor Documentation

◆ InstrumentSelector()

MantidQt::MantidWidgets::InstrumentSelector::InstrumentSelector ( QWidget *  parent = nullptr,
bool  init = true 
)

Default Constructor.

Default constructor.

Parameters
parent:: A widget to act as this widget's parent (default = NULL)
init:: If true then the widget will be populated with the instrument list (default = true)

Definition at line 29 of file InstrumentSelector.cpp.

References Mantid::Kernel::ConfigServiceImpl::addObserver(), fillWithInstrumentsFromFacility(), Mantid::Kernel::SingletonHolder< T >::Instance(), m_changeObserver, and updateInstrument().

◆ ~InstrumentSelector()

MantidQt::MantidWidgets::InstrumentSelector::~InstrumentSelector ( )
override

Destructor.

Destructor for InstrumentSelector De-subscribes this object from the Poco NotificationCentre.

Definition at line 49 of file InstrumentSelector.cpp.

References Mantid::Kernel::SingletonHolder< T >::Instance(), m_changeObserver, and m_init.

Member Function Documentation

◆ configValueChanged

void MantidQt::MantidWidgets::InstrumentSelector::configValueChanged ( const QString &  ,
const QString &  ,
const QString &   
)
signal

◆ fillWithInstrumentsFromFacility

void MantidQt::MantidWidgets::InstrumentSelector::fillWithInstrumentsFromFacility ( const QString &  name = QString())
slot

Update list for a new facility.

Populate list with instruments from the named facility.

Note the current list is cleared.

Parameters
name:: The name of the facility whose instruments should be placed in the list. An empty string uses the default facility defined in Mantid.

Definition at line 126 of file InstrumentSelector.cpp.

References addItem(), filterByTechniquesAtFacility(), Mantid::Kernel::ConfigServiceImpl::getFacility(), Mantid::Kernel::ConfigServiceImpl::getFacilityNames(), index, Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::Kernel::FacilityInfo::instrument(), instrumentListUpdated(), Mantid::Kernel::FacilityInfo::instruments(), m_currentFacility, m_techniques, Mantid::Kernel::InstrumentInfo::shortName(), and updateInstrument().

Referenced by handleConfigChange(), InstrumentSelector(), and setFacility().

◆ filterByTechniquesAtFacility()

void MantidQt::MantidWidgets::InstrumentSelector::filterByTechniquesAtFacility ( const QStringList &  techniques,
const Mantid::Kernel::FacilityInfo facility 
)
private

Filter the list to only show those supporting the given technique.

Parameters
techniques:: A string list containing the names of a techniques to filter the instrument list by
facility:: A FacilityInfo object

Definition at line 216 of file InstrumentSelector.cpp.

References count, facility, instrumentListUpdated(), removeItem(), and techniques.

Referenced by fillWithInstrumentsFromFacility(), and setTechniques().

◆ getAutoUpdate()

bool MantidQt::MantidWidgets::InstrumentSelector::getAutoUpdate ( )

Returns true of auto reloading on facility change is enabled.

Returns if the list of instruments will be refeshed when the facility changes.

Returns
If facility auto update is enabled

Definition at line 67 of file InstrumentSelector.cpp.

References m_updateOnFacilityChange.

◆ getFacility()

QString MantidQt::MantidWidgets::InstrumentSelector::getFacility ( )

Get the name of the facility instrumetns are currently loaded from.

Returns the name of the facility from which instruments are listed.

Returns
Facility name

Definition at line 91 of file InstrumentSelector.cpp.

References m_currentFacility, and Mantid::Kernel::FacilityInfo::name().

◆ getTechniques()

QStringList MantidQt::MantidWidgets::InstrumentSelector::getTechniques ( ) const

Return the list of techniques.

Return the list of techniques that are supported by the instruments in the widget.

Returns
A list of supported techniques

Definition at line 60 of file InstrumentSelector.cpp.

References m_techniques.

◆ handleConfigChange()

void MantidQt::MantidWidgets::InstrumentSelector::handleConfigChange ( Mantid::Kernel::ConfigValChangeNotification_ptr  pNf)
private

◆ instrumentListUpdated

void MantidQt::MantidWidgets::InstrumentSelector::instrumentListUpdated ( )
signal

Signals that the list of instruments has been updated.

Referenced by fillWithInstrumentsFromFacility(), and filterByTechniquesAtFacility().

◆ instrumentSelectionChanged

void MantidQt::MantidWidgets::InstrumentSelector::instrumentSelectionChanged ( const QString &  )
signal

Indicate that the instrument selection has changed.

The parameter will contain the new name

Referenced by updateInstrument().

◆ setAutoUpdate()

void MantidQt::MantidWidgets::InstrumentSelector::setAutoUpdate ( bool  autoUpdate)

Enable or disable reloading on facility change.

Sets if the list of instruments should be updated folowing a facility change.

Parameters
autoUpdateIf instruments are to be updated

Definition at line 73 of file InstrumentSelector.cpp.

References m_updateOnFacilityChange.

◆ setFacility()

void MantidQt::MantidWidgets::InstrumentSelector::setFacility ( const QString &  facilityName)

Load instruments from a given facility.

Sets the facility instruments should be loaded from and refeshes the list.

Parameters
facilityNameName of facilty

Definition at line 97 of file InstrumentSelector.cpp.

References fillWithInstrumentsFromFacility().

◆ setTechniques()

void MantidQt::MantidWidgets::InstrumentSelector::setTechniques ( const QStringList &  techniques)

Set the list of techniques.

Parameters
techniques:: Only those instruments that support these techniques will be shown

Definition at line 80 of file InstrumentSelector.cpp.

References count, filterByTechniquesAtFacility(), m_currentFacility, m_techniques, and techniques.

◆ updateInstrument

void MantidQt::MantidWidgets::InstrumentSelector::updateInstrument ( const QString &  name)
privateslot

Handle an instrument seelction.

Handle an instrument being selected from the drop down.

Set the named instrument as the default for Mantid if desired and emit the signal if the new instrument is different to that which was previously selected.

Parameters
name:: A string containing the new instrument to set as the default

Definition at line 192 of file InstrumentSelector.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, Mantid::Kernel::SingletonHolder< T >::Instance(), instrumentSelectionChanged(), m_selectedInstrument, and m_storeChanges.

Referenced by fillWithInstrumentsFromFacility(), and InstrumentSelector().

◆ updateInstrumentOnSelection()

void MantidQt::MantidWidgets::InstrumentSelector::updateInstrumentOnSelection ( const bool  storeChanges)

Sets whether to update the default instrument on selection change.

Parameters
storeChanges:: True = store change on selection change

Definition at line 180 of file InstrumentSelector.cpp.

References m_storeChanges.

Member Data Documentation

◆ m_changeObserver

Poco::NObserver<InstrumentSelector, Mantid::Kernel::ConfigValChangeNotification> MantidQt::MantidWidgets::InstrumentSelector::m_changeObserver
private

Poco Observer for Config Service Notifications.

Definition at line 80 of file InstrumentSelector.h.

Referenced by InstrumentSelector(), and ~InstrumentSelector().

◆ m_currentFacility

const Mantid::Kernel::FacilityInfo* MantidQt::MantidWidgets::InstrumentSelector::m_currentFacility
private

The current facility.

Definition at line 85 of file InstrumentSelector.h.

Referenced by fillWithInstrumentsFromFacility(), getFacility(), handleConfigChange(), and setTechniques().

◆ m_init

bool MantidQt::MantidWidgets::InstrumentSelector::m_init
private

Should the object be initialized.

Definition at line 87 of file InstrumentSelector.h.

Referenced by ~InstrumentSelector().

◆ m_selectedInstrument

QString MantidQt::MantidWidgets::InstrumentSelector::m_selectedInstrument
private

The last selected instrument.

Definition at line 93 of file InstrumentSelector.h.

Referenced by updateInstrument().

◆ m_storeChanges

bool MantidQt::MantidWidgets::InstrumentSelector::m_storeChanges
private

Should the default instrument be changed when the selection changes.

Definition at line 89 of file InstrumentSelector.h.

Referenced by updateInstrument(), and updateInstrumentOnSelection().

◆ m_techniques

QStringList MantidQt::MantidWidgets::InstrumentSelector::m_techniques
private

A list of technqiues.

Only those instruments supporting these techniques are shown.

Definition at line 83 of file InstrumentSelector.h.

Referenced by fillWithInstrumentsFromFacility(), getTechniques(), and setTechniques().

◆ m_updateOnFacilityChange

bool MantidQt::MantidWidgets::InstrumentSelector::m_updateOnFacilityChange
private

If the instrument list should be reloaded when the facility changes.

Definition at line 91 of file InstrumentSelector.h.

Referenced by getAutoUpdate(), handleConfigChange(), and setAutoUpdate().

Property Documentation

◆ facility

QString MantidQt::MantidWidgets::InstrumentSelector::facility
readwrite

Definition at line 30 of file InstrumentSelector.h.

Referenced by filterByTechniquesAtFacility().

◆ techniques

QStringList MantidQt::MantidWidgets::InstrumentSelector::techniques
readwrite

Definition at line 30 of file InstrumentSelector.h.

Referenced by filterByTechniquesAtFacility(), and setTechniques().

◆ updateOnFacilityChange

bool MantidQt::MantidWidgets::InstrumentSelector::updateOnFacilityChange
readwrite

Definition at line 30 of file InstrumentSelector.h.


The documentation for this class was generated from the following files: