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;
105 enum class DialogMode : int
110 Q_ENUM( QgsProcessingAlgorithmDialogBase::DialogMode )
115 QgsProcessingAlgorithmDialogBase( QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags(), QgsProcessingAlgorithmDialogBase::DialogMode mode = QgsProcessingAlgorithmDialogBase::DialogMode::Single );
116 ~QgsProcessingAlgorithmDialogBase()
override;
155 bool wasExecuted()
const {
return mExecuted; }
162 QVariantMap results()
const {
return mResults; }
176 void saveLogToFile( const QString &path, LogFormat format = FormatPlainText );
199 virtual
void setParameters( const QVariantMap &values );
208 void reportError( const QString &error,
bool fatalError );
213 void pushWarning( const QString &warning );
218 void pushInfo( const QString &info );
223 void pushDebugInfo( const QString &message );
228 void pushCommandInfo( const QString &info );
233 void setPercentage(
double percent );
238 void setProgressText( const QString &text );
243 void pushConsoleInfo( const QString &info );
249 QDialog *createProgressDialog();
268 void copyLogToClipboard();
273 void showParameters();
275 void reject() override;
279 void closeEvent( QCloseEvent *e ) override;
284 QPushButton *runButton();
289 QPushButton *cancelButton();
294 QPushButton *changeParametersButton();
299 QDialogButtonBox *buttonBox();
304 QTabWidget *tabWidget();
309 void clearProgress();
316 void setExecuted(
bool executed );
321 void setExecutedAnyResult(
bool executedAnyResult );
328 void setResults( const QVariantMap &results );
333 void setInfo( const QString &message,
bool isError = false,
bool escapeHtml = true,
bool isWarning = false );
344 virtual
void resetAdditionalGui();
349 void updateRunButtonVisibility();
355 void blockControlsWhileRunning();
361 virtual
void blockAdditionalControlsWhileRunning();
371 void hideShortHelp();
384 static QString formatStringForLog( const QString &
string );
391 virtual
bool isFinalized();
400 void algorithmFinished(
bool successful, const QVariantMap &result );
412 virtual
void runAlgorithm();
419 virtual
void algExecuted(
bool successful, const QVariantMap &results );
424 void toggleCollapsed();
426 void splitterChanged(
int pos,
int index );
427 void mTabWidget_currentChanged(
int index );
428 void linkClicked( const QUrl &url );
429 void taskTriggered(
QgsTask *task );
434 DialogMode mMode = DialogMode::Single;
436 QPushButton *mButtonRun =
nullptr;
437 QPushButton *mButtonClose =
nullptr;
438 QPushButton *mButtonChangeParameters =
nullptr;
439 QByteArray mSplitterState;
440 QToolButton *mButtonCollapse =
nullptr;
442 QPushButton *mAdvancedButton =
nullptr;
443 QMenu *mAdvancedMenu =
nullptr;
444 QAction *mCopyAsQgisProcessCommand =
nullptr;
445 QAction *mPasteJsonAction =
nullptr;
447 bool mExecuted = false;
448 bool mExecutedAnyResult = false;
449 QVariantMap mResults;
454 bool mHelpCollapsed = false;
456 int mMessageLoggedCount = 0;
461 void scrollToBottomOfLog();
462 void processEvents();
474 class QgsProcessingAlgorithmProgressDialog :
public QDialog,
private Ui::QgsProcessingProgressDialogBase
483 QgsProcessingAlgorithmProgressDialog( QWidget *parent =
nullptr );
488 QProgressBar *progressBar();
493 QPushButton *cancelButton();
498 QTextEdit *logTextEdit();
502 void reject()
override;
510 #endif // QGSPROCESSINGALGORITHMDIALOGBASE_H