22#include "moc_qgsprocessingrecentalgorithmlog.cpp"
24using namespace Qt::StringLiterals;
28const int MAX_LOG_LENGTH = 5;
30QgsProcessingRecentAlgorithmLog::QgsProcessingRecentAlgorithmLog( QObject *parent )
34 mRecentAlgorithmIds = settings.
value( u
"processing/recentAlgorithms"_s, QVariant(),
QgsSettings::Gui ).toStringList();
37QStringList QgsProcessingRecentAlgorithmLog::recentAlgorithmIds()
const
39 return mRecentAlgorithmIds;
42void QgsProcessingRecentAlgorithmLog::push(
const QString &
id )
44 const QStringList previous = mRecentAlgorithmIds;
45 mRecentAlgorithmIds.removeAll(
id );
46 mRecentAlgorithmIds.insert( 0,
id );
47 if ( mRecentAlgorithmIds.length() > MAX_LOG_LENGTH )
48 mRecentAlgorithmIds = mRecentAlgorithmIds.mid( 0, MAX_LOG_LENGTH );
53 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.