20#include "moc_qgsprocessingrecentalgorithmlog.cpp"
24const int MAX_LOG_LENGTH = 5;
26QgsProcessingRecentAlgorithmLog::QgsProcessingRecentAlgorithmLog( QObject *parent )
30 mRecentAlgorithmIds = settings.
value( QStringLiteral(
"processing/recentAlgorithms" ), QVariant(),
QgsSettings::Gui ).toStringList();
33QStringList QgsProcessingRecentAlgorithmLog::recentAlgorithmIds()
const
35 return mRecentAlgorithmIds;
38void QgsProcessingRecentAlgorithmLog::push(
const QString &
id )
40 const QStringList previous = mRecentAlgorithmIds;
41 mRecentAlgorithmIds.removeAll(
id );
42 mRecentAlgorithmIds.insert( 0,
id );
43 if ( mRecentAlgorithmIds.length() > MAX_LOG_LENGTH )
44 mRecentAlgorithmIds = mRecentAlgorithmIds.mid( 0, MAX_LOG_LENGTH );
49 if ( previous != mRecentAlgorithmIds )
Stores settings for use within QGIS.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.