Mantid
Loading...
Searching...
No Matches
AlgorithmProgressDialogWidget.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
12
13#include <QDialog>
14#include <QPushButton>
15
16#include <memory>
17#include <utility>
18
19class QProgressBar;
20
26namespace MantidQt {
27namespace MantidWidgets {
29 Q_OBJECT
30public:
32
35 std::pair<QTreeWidgetItem *, QProgressBar *> addAlgorithm(Mantid::API::IAlgorithm_sptr alg) override;
36
37protected:
38 void closeEvent(QCloseEvent *event) override;
39
40private:
42 QTreeWidget *m_tree;
43 std::unique_ptr<AlgorithmProgressDialogPresenter> m_presenter;
44};
45
46/*
47 * The AlgorithmProgressDialogWidgetCancelButton handles the Cancel buttons
48 * displayed in the dialog. It keeps a copy of the shared pointer to the
49 * algorithm to ensure that it can always be closed when the user clicks the
50 * button
51 */
53 Q_OBJECT
54public:
56 : QPushButton("Cancel", parent), m_alg(std::move(alg)) {
57 connect(this, &QPushButton::clicked, this, &AlgorithmProgressDialogWidgetCancelButton::clickedWithAlgSlot);
58 }
59
60signals:
62
63private slots:
64 void clickedWithAlgSlot() { m_alg->cancel(); }
65
66private:
68};
69
70} // namespace MantidWidgets
71} // namespace MantidQt
AlgorithmProgressDialogWidgetCancelButton(Mantid::API::IAlgorithm_sptr alg, QWidget *parent=0)
QTreeWidget * m_tree
Owned by this dialog, will be deleted on close.
std::pair< QTreeWidgetItem *, QProgressBar * > addAlgorithm(Mantid::API::IAlgorithm_sptr alg) override
Adds an algorithm to the dialog.
std::unique_ptr< AlgorithmProgressDialogPresenter > m_presenter
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
STL namespace.