QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
qgsprocessingfeedback.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsprocessingfeedback.h
3  -----------------------
4  begin : December 2016
5  copyright : (C) 2016 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSPROCESSINGFEEDBACK_H
19 #define QGSPROCESSINGFEEDBACK_H
20 
21 #include "qgis_core.h"
22 #include "qgsfeedback.h"
23 #include "qgsmessagelog.h"
24 
26 
37 class CORE_EXPORT QgsProcessingFeedback : public QgsFeedback
38 {
39  Q_OBJECT
40 
41  public:
42 
49  QgsProcessingFeedback( bool logFeedback = true );
50 
57  virtual void setProgressText( const QString &text );
58 
64  virtual void reportError( const QString &error, bool fatalError = false );
65 
76  virtual void pushWarning( const QString &warning );
77 
87  virtual void pushInfo( const QString &info );
88 
98  virtual void pushCommandInfo( const QString &info );
99 
108  virtual void pushDebugInfo( const QString &info );
109 
118  virtual void pushConsoleInfo( const QString &info );
119 
124  void pushVersionInfo( const QgsProcessingProvider *provider = nullptr );
125 
132  virtual QString htmlLog() const;
133 
140  virtual QString textLog() const;
141 
142  private:
143  bool mLogFeedback = true;
144  QString mHtmlLog;
145  QString mTextLog;
146 
147 };
148 
149 
163 {
164  Q_OBJECT
165 
166  public:
167 
174 
179  void setCurrentStep( int step );
180 
181  void setProgressText( const QString &text ) override;
182  void reportError( const QString &error, bool fatalError = false ) override;
183  void pushWarning( const QString &warning ) override;
184  void pushInfo( const QString &info ) override;
185  void pushCommandInfo( const QString &info ) override;
186  void pushDebugInfo( const QString &info ) override;
187  void pushConsoleInfo( const QString &info ) override;
188  QString htmlLog() const override;
189  QString textLog() const override;
190  private slots:
191 
192  void updateOverallProgress( double progress );
193 
194  private:
195 
196  int mChildSteps = 0;
197  int mCurrentStep = 0;
198  QgsProcessingFeedback *mFeedback = nullptr;
199 };
200 
201 #endif // QGSPROCESSINGFEEDBACK_H
202 
203 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition: qgsfeedback.h:45
Base class for providing feedback from a processing algorithm.
Processing feedback object for multi-step operations.
Abstract base class for processing providers.