Navigation Menu

Skip to content

Commit

Permalink
Add mode enum for processing algorithm dialogs so that code can
Browse files Browse the repository at this point in the history
determine if the single execution or batch execution dialog is shown
  • Loading branch information
nyalldawson committed Dec 16, 2021
1 parent 5333f17 commit 03d0c57
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Expand Up @@ -34,7 +34,13 @@ Base class for processing algorithm dialogs.
FormatHtml,
};

QgsProcessingAlgorithmDialogBase( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags() );
enum class DialogMode
{
Single,
Batch,
};

QgsProcessingAlgorithmDialogBase( QWidget *parent /TransferThis/ = 0, Qt::WindowFlags flags = Qt::WindowFlags(), QgsProcessingAlgorithmDialogBase::DialogMode mode = QgsProcessingAlgorithmDialogBase::DialogMode::Single );
%Docstring
Constructor for QgsProcessingAlgorithmDialogBase.
%End
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/BatchAlgorithmDialog.py
Expand Up @@ -65,7 +65,7 @@ def reportError(self, error: str, fatalError: bool = False):
class BatchAlgorithmDialog(QgsProcessingAlgorithmDialogBase):

def __init__(self, alg, parent=None):
super().__init__(parent)
super().__init__(parent, mode=QgsProcessingAlgorithmDialogBase.DialogMode.Batch)

self.setAlgorithm(alg)

Expand Down
3 changes: 2 additions & 1 deletion src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
Expand Up @@ -86,8 +86,9 @@ void QgsProcessingAlgorithmDialogFeedback::pushConsoleInfo( const QString &info
// QgsProcessingAlgorithmDialogBase
//

QgsProcessingAlgorithmDialogBase::QgsProcessingAlgorithmDialogBase( QWidget *parent, Qt::WindowFlags flags )
QgsProcessingAlgorithmDialogBase::QgsProcessingAlgorithmDialogBase( QWidget *parent, Qt::WindowFlags flags, DialogMode mode )
: QDialog( parent, flags )
, mMode( mode )
{
setupUi( this );

Expand Down
16 changes: 15 additions & 1 deletion src/gui/processing/qgsprocessingalgorithmdialogbase.h
Expand Up @@ -97,10 +97,22 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, public QgsPr
FormatHtml, //!< HTML file (.html)
};

/**
* Dialog modes.
*
* \since QGIS 3.24
*/
enum class DialogMode : int
{
Single, //!< Single algorithm execution mode
Batch, //!< Batch processing mode
};
Q_ENUM( QgsProcessingAlgorithmDialogBase::DialogMode )

/**
* Constructor for QgsProcessingAlgorithmDialogBase.
*/
QgsProcessingAlgorithmDialogBase( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
QgsProcessingAlgorithmDialogBase( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(), QgsProcessingAlgorithmDialogBase::DialogMode mode = QgsProcessingAlgorithmDialogBase::DialogMode::Single );
~QgsProcessingAlgorithmDialogBase() override;

/**
Expand Down Expand Up @@ -399,6 +411,8 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, public QgsPr

private:

DialogMode mMode = DialogMode::Single;

QPushButton *mButtonRun = nullptr;
QPushButton *mButtonClose = nullptr;
QPushButton *mButtonChangeParameters = nullptr;
Expand Down

0 comments on commit 03d0c57

Please sign in to comment.