17 #include "qgssettings.h"
21 const int MAX_LOG_LENGTH = 5;
23 QgsProcessingRecentAlgorithmLog::QgsProcessingRecentAlgorithmLog( QObject *parent )
27 mRecentAlgorithmIds = settings.value( QStringLiteral(
"processing/recentAlgorithms" ), QVariant(), QgsSettings::Gui ).toStringList();
30 QStringList QgsProcessingRecentAlgorithmLog::recentAlgorithmIds()
const
32 return mRecentAlgorithmIds;
35 void QgsProcessingRecentAlgorithmLog::push(
const QString &
id )
37 const QStringList previous = mRecentAlgorithmIds;
38 mRecentAlgorithmIds.removeAll(
id );
39 mRecentAlgorithmIds.insert( 0,
id );
40 if ( mRecentAlgorithmIds.length() > MAX_LOG_LENGTH )
41 mRecentAlgorithmIds = mRecentAlgorithmIds.mid( 0, MAX_LOG_LENGTH );
44 settings.setValue( QStringLiteral(
"processing/recentAlgorithms" ), mRecentAlgorithmIds, QgsSettings::Gui );
46 if ( previous != mRecentAlgorithmIds )