|
Mantid
|
This abstract class deals with the loading and saving of previous algorithm property values to/from MantidPlot's QSettings. More...
#include <AlgorithmInputHistory.h>
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. | |
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.
|
delete |
|
overridepure virtual |
|
protected |
Constructor.
Definition at line 35 of file AlgorithmInputHistory.cpp.
References initializeSettings().
|
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().
| 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.
| 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.
|
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().
|
delete |
| QString AbstractAlgorithmInputHistory::previousInput | ( | const QString & | algName, |
| const QString & | propName | ||
| ) | const |
Retrieve an old parameter value.
| 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().
| 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().
|
override |
Apply an already-read snapshot without persistent I/O.
Definition at line 129 of file AlgorithmInputHistory.cpp.
References MantidQt::API::AlgorithmInputHistorySettings::lastInput(), m_lastInput, m_previousDirectory, and MantidQt::API::AlgorithmInputHistorySettings::previousDirectory().
Referenced by initializeSettings().
| 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().
| void AbstractAlgorithmInputHistory::saveSettings | ( | QSettings & | storage, |
| const AlgorithmInputHistorySettings & | settings | ||
| ) | const |
Persist an explicit snapshot.
Definition at line 138 of file AlgorithmInputHistory.cpp.
References MantidQt::API::AlgorithmInputHistorySettings::lastInput(), m_algorithmsGroup, m_dirKey, MantidQt::API::AlgorithmInputHistorySettings::previousDirectory(), MantidQt::MantidWidgets::QSettingsChangeAware::remove(), and MantidQt::MantidWidgets::QSettingsChangeAware::setValue().
Referenced by save().
| void AbstractAlgorithmInputHistory::setPreviousDirectory | ( | const QString & | lastdir | ) |
Set the directory that was accessed when the previous open file dialog was used.
| 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.
| 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.
| 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().
|
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().
|
private |
The string denoting the key for the previous dir storage.
Definition at line 95 of file AlgorithmInputHistory.h.
Referenced by readSettings(), and saveSettings().
|
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().
|
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().