24 #include <QTextStream>
25 #include <QRegularExpression>
26 #include <QRegularExpressionMatch>
34 return QStringLiteral(
"processing" );
39 const QString logPath = oldLogPath();
40 if ( !QFile::exists( logPath ) )
43 QFile logFile( logPath );
44 if ( logFile.open( QIODevice::ReadOnly ) )
46 QTextStream in( &logFile );
47 QList< QgsHistoryEntry > entries;
50 const QString line = in.readLine().trimmed();
51 QStringList parts = line.split( QStringLiteral(
"|~|" ) );
52 if ( parts.size() <= 1 )
53 parts = line.split(
'|' );
55 if ( parts.size() == 3 && parts.at( 0 ).startsWith( QLatin1String(
"ALGORITHM" ), Qt::CaseInsensitive ) )
58 details.insert( QStringLiteral(
"python_command" ), parts.at( 2 ) );
60 const thread_local QRegularExpression algIdRegEx( QStringLiteral(
"processing\\.run\\(\"(.*?)\"" ) );
61 const QRegularExpressionMatch match = algIdRegEx.match( parts.at( 2 ) );
62 if ( match.hasMatch() )
63 details.insert( QStringLiteral(
"algorithm_id" ), match.captured( 1 ) );
66 QDateTime::fromString( parts.at( 1 ), QStringLiteral(
"yyyy-MM-d hh:mm:ss" ) ),
75 QString QgsProcessingHistoryProvider::oldLogPath()
const
78 return userDir + QStringLiteral(
"/processing.log" );
static QString qgisSettingsDirPath()
Returns the path to the settings directory in user's home dir.
static QgsHistoryProviderRegistry * historyProviderRegistry()
Returns the global history provider registry, used for tracking history providers.
Encapsulates a history entry.
bool addEntries(const QList< QgsHistoryEntry > &entries, QgsHistoryProviderRegistry::HistoryEntryOptions options=QgsHistoryProviderRegistry::HistoryEntryOptions())
Adds a list of entries to the history logs.
QString id() const override
Returns the provider's unique id, which is used to associate existing history entries with the provid...
void portOldLog()
Ports the old text log to the history framework.
QgsProcessingHistoryProvider()