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 );
189 void reportError( const QString &error,
bool fatalError );
194 void pushWarning( const QString &warning );
199 void pushInfo( const QString &info );
204 void pushDebugInfo( const QString &message );
209 void pushCommandInfo( const QString &info );
214 void setPercentage(
double percent );
219 void setProgressText( const QString &text );
224 void pushConsoleInfo( const QString &info );
230 QDialog *createProgressDialog();
249 void copyLogToClipboard();
254 void showParameters();
256 void reject() override;
260 void closeEvent( QCloseEvent *e ) override;
265 QPushButton *runButton();
270 QPushButton *cancelButton();
275 QPushButton *changeParametersButton();
280 QDialogButtonBox *buttonBox();
285 QTabWidget *tabWidget();
290 void clearProgress();
297 void setExecuted(
bool executed );
302 void setExecutedAnyResult(
bool executedAnyResult );
309 void setResults( const QVariantMap &results );
314 void setInfo( const QString &message,
bool isError = false,
bool escapeHtml = true,
bool isWarning = false );
325 virtual
void resetAdditionalGui();
330 void updateRunButtonVisibility();
336 void blockControlsWhileRunning();
342 virtual
void blockAdditionalControlsWhileRunning();
352 void hideShortHelp();
365 static QString formatStringForLog( const QString &
string );
374 void algorithmFinished(
bool successful, const QVariantMap &result );
386 virtual
void runAlgorithm();
391 void toggleCollapsed();
393 void splitterChanged(
int pos,
int index );
394 void mTabWidget_currentChanged(
int index );
395 void linkClicked( const QUrl &url );
396 void algExecuted(
bool successful, const QVariantMap &results );
397 void taskTriggered(
QgsTask *task );
402 QPushButton *mButtonRun =
nullptr;
403 QPushButton *mButtonClose =
nullptr;
404 QPushButton *mButtonChangeParameters =
nullptr;
405 QByteArray mSplitterState;
406 QToolButton *mButtonCollapse =
nullptr;
409 bool mExecuted = false;
410 bool mExecutedAnyResult = false;
411 QVariantMap mResults;
416 bool mHelpCollapsed = false;
418 int mMessageLoggedCount = 0;
423 void scrollToBottomOfLog();
424 void processEvents();
436 class QgsProcessingAlgorithmProgressDialog :
public QDialog,
private Ui::QgsProcessingProgressDialogBase
445 QgsProcessingAlgorithmProgressDialog( QWidget *parent =
nullptr );
450 QProgressBar *progressBar();
455 QPushButton *cancelButton();
460 QTextEdit *logTextEdit();
464 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