17#include "moc_qgsprocessingrecentalgorithmlog.cpp"
22const int MAX_LOG_LENGTH = 5;
24QgsProcessingRecentAlgorithmLog::QgsProcessingRecentAlgorithmLog( QObject *parent )
28 mRecentAlgorithmIds = settings.
value( QStringLiteral(
"processing/recentAlgorithms" ), QVariant(),
QgsSettings::Gui ).toStringList();
31QStringList QgsProcessingRecentAlgorithmLog::recentAlgorithmIds()
const
33 return mRecentAlgorithmIds;
36void QgsProcessingRecentAlgorithmLog::push(
const QString &
id )
38 const QStringList previous = mRecentAlgorithmIds;
39 mRecentAlgorithmIds.removeAll(
id );
40 mRecentAlgorithmIds.insert( 0,
id );
41 if ( mRecentAlgorithmIds.length() > MAX_LOG_LENGTH )
42 mRecentAlgorithmIds = mRecentAlgorithmIds.mid( 0, MAX_LOG_LENGTH );
47 if ( previous != mRecentAlgorithmIds )
This class is a composition of two QSettings instances:
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.