QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
74  virtual void pushInfo( const QString &info );
75 
84  virtual void pushCommandInfo( const QString &info );
85 
93  virtual void pushDebugInfo( const QString &info );
94 
102  virtual void pushConsoleInfo( const QString &info );
103 
108  void pushVersionInfo( const QgsProcessingProvider *provider = nullptr );
109 
116  virtual QString htmlLog() const;
117 
124  virtual QString textLog() const;
125 
126  private:
127  bool mLogFeedback = true;
128  QString mHtmlLog;
129  QString mTextLog;
130 
131 };
132 
133 
147 {
148  Q_OBJECT
149 
150  public:
151 
158 
163  void setCurrentStep( int step );
164 
165  void setProgressText( const QString &text ) override;
166  void reportError( const QString &error, bool fatalError = false ) override;
167  void pushInfo( const QString &info ) override;
168  void pushCommandInfo( const QString &info ) override;
169  void pushDebugInfo( const QString &info ) override;
170  void pushConsoleInfo( const QString &info ) override;
171  QString htmlLog() const override;
172  QString textLog() const override;
173  private slots:
174 
175  void updateOverallProgress( double progress );
176 
177  private:
178 
179  int mChildSteps = 0;
180  int mCurrentStep = 0;
181  QgsProcessingFeedback *mFeedback = nullptr;
182 };
183 
184 #endif // QGSPROCESSINGFEEDBACK_H
185 
186 
QgsProcessingFeedback::setProgressText
virtual void setProgressText(const QString &text)
Sets a progress report text string.
Definition: qgsprocessingfeedback.cpp:35
QgsProcessingFeedback::pushCommandInfo
virtual void pushCommandInfo(const QString &info)
Pushes an informational message containing a command from the algorithm.
Definition: qgsprocessingfeedback.cpp:57
QgsProcessingFeedback
Definition: qgsprocessingfeedback.h:37
QgsProcessingFeedback::pushInfo
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
Definition: qgsprocessingfeedback.cpp:48
QgsProcessingFeedback::reportError
virtual void reportError(const QString &error, bool fatalError=false)
Reports that the algorithm encountered an error while executing.
Definition: qgsprocessingfeedback.cpp:39
QgsProcessingProvider
Definition: qgsprocessingprovider.h:34
QgsProcessingFeedback::textLog
virtual QString textLog() const
Returns the plain text contents of the log, which contains all messages pushed to the feedback object...
Definition: qgsprocessingfeedback.cpp:112
QgsProcessingFeedback::pushConsoleInfo
virtual void pushConsoleInfo(const QString &info)
Pushes a console feedback message from the algorithm.
Definition: qgsprocessingfeedback.cpp:75
QgsProcessingMultiStepFeedback
Definition: qgsprocessingfeedback.h:146
QgsFeedback
Definition: qgsfeedback.h:43
QgsProcessingFeedback::pushDebugInfo
virtual void pushDebugInfo(const QString &info)
Pushes an informational message containing debugging helpers from the algorithm.
Definition: qgsprocessingfeedback.cpp:66
QgsProcessingFeedback::htmlLog
virtual QString htmlLog() const
Returns the HTML formatted contents of the log, which contains all messages pushed to the feedback ob...
Definition: qgsprocessingfeedback.cpp:107
qgsfeedback.h
qgsmessagelog.h