Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::API::AbstractAlgorithmInputHistory Class Referenceabstract

This abstract class deals with the loading and saving of previous algorithm property values to/from MantidPlot's QSettings. More...

#include <AlgorithmInputHistory.h>

Inheritance diagram for MantidQt::API::AbstractAlgorithmInputHistory:
MantidQt::MantidWidgets::Configurable< AlgorithmInputHistorySettings > MantidQt::API::AlgorithmInputHistoryImpl

Public Member Functions

 AbstractAlgorithmInputHistory (const AbstractAlgorithmInputHistory &)=delete
 
AlgorithmInputHistorySettings captureSettings () const override
 Capture current history without persistent I/O.
 
void clearAlgorithmInput (const QString &algName)
 Clear values for a particular algorithm.
 
const QString & getPreviousDirectory () const
 Get the directory that was accessed when the previous open file dialog was used.
 
AbstractAlgorithmInputHistory & operator= (const AbstractAlgorithmInputHistory &)=delete
 
QString previousInput (const QString &algName, const QString &propName) const
 Retrieve an old parameter value.
 
AlgorithmInputHistorySettings readSettings (const QSettings &storage) const
 Query persistent storage without changing the history.
 
void restoreSettings (const AlgorithmInputHistorySettings &settings) override
 Apply an already-read snapshot without persistent I/O.
 
void save () const
 Save the values stored here to persistent storage.
 
void saveSettings (QSettings &storage, const AlgorithmInputHistorySettings &settings) const
 Persist an explicit snapshot.
 
void setPreviousDirectory (const QString &lastdir)
 Set the directory that was accessed when the previous open file dialog was used.
 
void storeNewValue (const QString &algName, const std::pair< QString, QString > &property)
 Update the old values that are stored here.
 
virtual ~AbstractAlgorithmInputHistory () override=0
 Abstract destructor.
 
- Public Member Functions inherited from MantidQt::MantidWidgets::Configurable< AlgorithmInputHistorySettings >
virtual void restoreSettings (const AlgorithmInputHistorySettings &)=0
 Apply an already-read snapshot without persistent I/O.
 
virtual ~Configurable ()=default
 

Protected Member Functions

 AbstractAlgorithmInputHistory (const QString &settingsGroup)
 Constructor.
 

Private Member Functions

void initializeSettings ()
 Load any values that are available from persistent storage.
 

Private Attributes

QString m_algorithmsGroup
 The string denoting the group (in the QSettings) where the algorithm properties are stored.
 
QString m_dirKey
 The string denoting the key for the previous dir storage.
 
QHash< QString, QHash< QString, QString > > m_lastInput
 A map indexing the algorithm name and a list of property name:value pairs.
 
QString m_previousDirectory
 The directory that last used by an open file dialog.
 

Detailed Description

This abstract class deals with the loading and saving of previous algorithm property values to/from MantidPlot's QSettings.

Definition at line 38 of file AlgorithmInputHistory.h.

Constructor & Destructor Documentation

◆ AbstractAlgorithmInputHistory() [1/2]

MantidQt::API::AbstractAlgorithmInputHistory::AbstractAlgorithmInputHistory ( const AbstractAlgorithmInputHistory &  )
delete

◆ ~AbstractAlgorithmInputHistory()

AbstractAlgorithmInputHistory::~AbstractAlgorithmInputHistory ( )
overridepure virtual

Abstract destructor.

Destructor.

Definition at line 44 of file AlgorithmInputHistory.cpp.

◆ AbstractAlgorithmInputHistory() [2/2]

AbstractAlgorithmInputHistory::AbstractAlgorithmInputHistory ( const QString &  settingsGroup)
protected

Constructor.

Definition at line 35 of file AlgorithmInputHistory.cpp.

References initializeSettings().

Member Function Documentation

◆ captureSettings()

AlgorithmInputHistorySettings AbstractAlgorithmInputHistory::captureSettings ( ) const
overridevirtual

Capture current history without persistent I/O.

Implements MantidQt::MantidWidgets::Configurable< AlgorithmInputHistorySettings >.

Definition at line 134 of file AlgorithmInputHistory.cpp.

References m_lastInput, and m_previousDirectory.

Referenced by save().

◆ clearAlgorithmInput()

void AbstractAlgorithmInputHistory::clearAlgorithmInput ( const QString &  algName)

Clear values for a particular algorithm.

Clear all stored values associated with a particular algorithm.

Definition at line 64 of file AlgorithmInputHistory.cpp.

References m_lastInput.

◆ getPreviousDirectory()

const QString & AbstractAlgorithmInputHistory::getPreviousDirectory ( ) const

Get the directory that was accessed when the previous open file dialog was used.

Definition at line 94 of file AlgorithmInputHistory.cpp.

References m_previousDirectory.

◆ initializeSettings()

void AbstractAlgorithmInputHistory::initializeSettings ( )
private

Load any values that are available from persistent storage.

Note: this clears all currently values stored

Definition at line 170 of file AlgorithmInputHistory.cpp.

References readSettings(), and restoreSettings().

Referenced by AbstractAlgorithmInputHistory().

◆ operator=()

AbstractAlgorithmInputHistory & MantidQt::API::AbstractAlgorithmInputHistory::operator= ( const AbstractAlgorithmInputHistory &  )
delete

◆ previousInput()

QString AbstractAlgorithmInputHistory::previousInput ( const QString &  algName,
const QString &  propName 
) const

Retrieve an old parameter value.

Parameters
algName:: The name of the algorithm
propName:: The name of the property

Definition at line 74 of file AlgorithmInputHistory.cpp.

References m_lastInput.

Referenced by MantidQt::API::AlgorithmPropertiesWidget::initLayout().

◆ readSettings()

AlgorithmInputHistorySettings AbstractAlgorithmInputHistory::readSettings ( const QSettings &  storage) const

Query persistent storage without changing the history.

Definition at line 104 of file AlgorithmInputHistory.cpp.

References m_algorithmsGroup, m_dirKey, and value.

Referenced by initializeSettings().

◆ restoreSettings()

void AbstractAlgorithmInputHistory::restoreSettings ( const AlgorithmInputHistorySettings &  settings)
override

◆ save()

void AbstractAlgorithmInputHistory::save ( ) const

Save the values stored here to persistent storage.

Save the stored information to persistent storage.

Definition at line 99 of file AlgorithmInputHistory.cpp.

References captureSettings(), and saveSettings().

◆ saveSettings()

void AbstractAlgorithmInputHistory::saveSettings ( QSettings &  storage,
const AlgorithmInputHistorySettings &  settings 
) const

◆ setPreviousDirectory()

void AbstractAlgorithmInputHistory::setPreviousDirectory ( const QString &  lastdir)

Set the directory that was accessed when the previous open file dialog was used.

Parameters
lastdir:: A QString giving the path of the directory that was last accessed with a file dialog

Definition at line 90 of file AlgorithmInputHistory.cpp.

References m_previousDirectory.

◆ storeNewValue()

void AbstractAlgorithmInputHistory::storeNewValue ( const QString &  algName,
const std::pair< QString, QString > &  property 
)

Update the old values that are stored here.

Update the stored map with new property value.

Only valid values are stored here

If the algorithm doesn't exist then it is appended to the list otherwise the previous value is overwritten.

Parameters
algName:: The name of the algorithm
property:: A pair containing <name,value> of a property

Definition at line 57 of file AlgorithmInputHistory.cpp.

References m_lastInput.

Referenced by MantidQt::API::AlgorithmPropertiesWidget::saveInput().

Member Data Documentation

◆ m_algorithmsGroup

QString MantidQt::API::AbstractAlgorithmInputHistory::m_algorithmsGroup
private

The string denoting the group (in the QSettings) where the algorithm properties are stored.

Definition at line 92 of file AlgorithmInputHistory.h.

Referenced by readSettings(), and saveSettings().

◆ m_dirKey

QString MantidQt::API::AbstractAlgorithmInputHistory::m_dirKey
private

The string denoting the key for the previous dir storage.

Definition at line 95 of file AlgorithmInputHistory.h.

Referenced by readSettings(), and saveSettings().

◆ m_lastInput

QHash<QString, QHash<QString, QString> > MantidQt::API::AbstractAlgorithmInputHistory::m_lastInput
private

A map indexing the algorithm name and a list of property name:value pairs.

Definition at line 85 of file AlgorithmInputHistory.h.

Referenced by captureSettings(), clearAlgorithmInput(), previousInput(), restoreSettings(), and storeNewValue().

◆ m_previousDirectory

QString MantidQt::API::AbstractAlgorithmInputHistory::m_previousDirectory
private

The directory that last used by an open file dialog.

Definition at line 88 of file AlgorithmInputHistory.h.

Referenced by captureSettings(), getPreviousDirectory(), restoreSettings(), and setPreviousDirectory().


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