59 QString fileName = QFileDialog::getSaveFileName(
this, tr(
"Save File" ), QDir::homePath(), tr(
"Log files (*.log *.LOG)" ) );
64 if ( fileName.isEmpty() )
71 const QString logSeparator = QStringLiteral(
"|~|" );
72 QFile logFile( fileName );
73 if ( logFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
75 QTextStream logOut( &logFile );
78 logOut << QStringLiteral(
"ALGORITHM%1%2%3%4\n" ).arg( logSeparator, entry.timestamp.toString(
"yyyy-MM-dd HH:mm:ss" ), logSeparator, entry.entry.value( QStringLiteral(
"python_command" ) ).toString() );
91 setObjectName( QStringLiteral(
"QgsProcessingHistoryDialog" ) );
94 setWindowTitle( tr(
"Processing History" ) );
96 QVBoxLayout *vl =
new QVBoxLayout();
98 vl->addWidget( mWidget, 1 );
100 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Close | QDialogButtonBox::Help );
102 QPushButton *clearButton =
new QPushButton( tr(
"Clear" ) );
103 clearButton->setToolTip( tr(
"Clear history" ) );
104 mButtonBox->addButton( clearButton, QDialogButtonBox::ActionRole );
106 QPushButton *saveButton =
new QPushButton( tr(
"Save As…" ) );
107 saveButton->setToolTip( tr(
"Save history" ) );
108 mButtonBox->addButton( saveButton, QDialogButtonBox::ActionRole );
113 connect( mButtonBox->button( QDialogButtonBox::Close ), &QPushButton::clicked, mWidget, [
this]() { close(); } );
115 vl->addWidget( mButtonBox );
Encapsulates a history entry.
bool clearHistory(Qgis::HistoryProviderBackend backend, const QString &providerId=QString())
Clears the history for the specified backend.
QList< QgsHistoryEntry > queryEntries(const QDateTime &start=QDateTime(), const QDateTime &end=QDateTime(), const QString &providerId=QString(), Qgis::HistoryProviderBackends backends=Qgis::HistoryProviderBackend::LocalProfile) const
Queries history entries which occurred between the specified start and end times.
QgsProcessingHistoryDialog(QWidget *parent=nullptr)
Constructor for QgsProcessingHistoryDialog.