16 #ifndef QGSPROCESSINGALGORITHMDIALOGBASE_H
17 #define QGSPROCESSINGALGORITHMDIALOGBASE_H
21 #include "ui_qgsprocessingalgorithmdialogbase.h"
22 #include "ui_qgsprocessingalgorithmprogressdialogbase.h"
31 class QgsProcessingAlgorithmDialogBase;
53 QgsProcessingAlgorithmDialogFeedback();
57 void progressTextChanged(
const QString &text );
58 void errorReported(
const QString &text,
bool fatalError );
59 void warningPushed(
const QString &text );
60 void infoPushed(
const QString &text );
61 void commandInfoPushed(
const QString &text );
62 void debugInfoPushed(
const QString &text );
63 void consoleInfoPushed(
const QString &text );
68 void reportError(
const QString &error,
bool fatalError )
override;
70 void pushInfo(
const QString &info )
override;
103 QgsProcessingAlgorithmDialogBase( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
104 ~QgsProcessingAlgorithmDialogBase()
override;
143 bool wasExecuted()
const {
return mExecuted; }
150 QVariantMap results()
const {
return mResults; }
164 void saveLogToFile( const QString &path, LogFormat format = FormatPlainText );
173 void reportError( const QString &error,
bool fatalError );
178 void pushWarning( const QString &warning );
183 void pushInfo( const QString &info );
188 void pushDebugInfo( const QString &message );
193 void pushCommandInfo( const QString &info );
198 void setPercentage(
double percent );
203 void setProgressText( const QString &text );
208 void pushConsoleInfo( const QString &info );
214 QDialog *createProgressDialog();
233 void copyLogToClipboard();
238 void showParameters();
240 void reject() override;
244 void closeEvent( QCloseEvent *e ) override;
249 QPushButton *runButton();
254 QPushButton *cancelButton();
259 QPushButton *changeParametersButton();
264 QDialogButtonBox *buttonBox();
269 QTabWidget *tabWidget();
274 void clearProgress();
281 void setExecuted(
bool executed );
286 void setExecutedAnyResult(
bool executedAnyResult );
293 void setResults( const QVariantMap &results );
298 void setInfo( const QString &message,
bool isError = false,
bool escapeHtml = true,
bool isWarning = false );
309 virtual
void resetAdditionalGui();
314 void updateRunButtonVisibility();
320 void blockControlsWhileRunning();
326 virtual
void blockAdditionalControlsWhileRunning();
336 void hideShortHelp();
349 static QString formatStringForLog( const QString &
string );
358 void algorithmFinished(
bool successful, const QVariantMap &result );
370 virtual
void runAlgorithm();
375 void toggleCollapsed();
377 void splitterChanged(
int pos,
int index );
378 void mTabWidget_currentChanged(
int index );
379 void linkClicked( const QUrl &url );
380 void algExecuted(
bool successful, const QVariantMap &results );
381 void taskTriggered(
QgsTask *task );
386 QPushButton *mButtonRun =
nullptr;
387 QPushButton *mButtonClose =
nullptr;
388 QPushButton *mButtonChangeParameters =
nullptr;
389 QByteArray mSplitterState;
390 QToolButton *mButtonCollapse =
nullptr;
393 bool mExecuted = false;
394 bool mExecutedAnyResult = false;
395 QVariantMap mResults;
400 bool mHelpCollapsed = false;
403 void scrollToBottomOfLog();
404 void processEvents();
416 class QgsProcessingAlgorithmProgressDialog :
public QDialog,
private Ui::QgsProcessingProgressDialogBase
425 QgsProcessingAlgorithmProgressDialog( QWidget *parent =
nullptr );
430 QProgressBar *progressBar();
435 QPushButton *cancelButton();
440 QTextEdit *logTextEdit();
444 void reject()
override;
A bar for displaying non-blocking messages to the user.
QgsTask task which runs a QgsProcessingAlgorithm in a background task.
Abstract base class for processing algorithms.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
virtual void pushCommandInfo(const QString &info)
Pushes an informational message containing a command from the algorithm.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
virtual void pushWarning(const QString &warning)
Pushes a warning informational message from the algorithm.
virtual void pushDebugInfo(const QString &info)
Pushes an informational message containing debugging helpers from the algorithm.
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
virtual void pushConsoleInfo(const QString &info)
Pushes a console feedback message from the algorithm.
virtual void setProgressText(const QString &text)
Sets a progress report text string.
An interface for objects which can create sets of parameter values for processing algorithms.
Abstract base class for long running background tasks.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call