ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvProgressDialog.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "CV_db.h"
12 
13 // Qt
14 #include <QAtomicInt>
15 #include <QProgressDialog>
16 #include <QTimer>
17 
18 // CV_CORE_LIB
20 
22 
28  : public QProgressDialog,
30  Q_OBJECT
31 
32 public:
34 
42  ecvProgressDialog(bool cancelButton = false, QWidget* parent = 0);
43 
45  virtual ~ecvProgressDialog() {}
46 
47  // inherited method
48  virtual void update(float percent) override;
49  inline virtual void setMethodTitle(const char* methodTitle) override {
50  setMethodTitle(QString(methodTitle));
51  }
52  inline virtual void setInfo(const char* infoStr) override {
53  setInfo(QString(infoStr));
54  }
55  inline virtual bool isCancelRequested() override { return wasCanceled(); }
56  virtual void start() override;
57  virtual void stop() override;
58 
60  virtual void setMethodTitle(QString methodTitle);
62  virtual void setInfo(QString infoStr);
63 
64 protected Q_SLOTS:
65 
67 
71  void refresh();
72 
73 signals:
74 
77 
78 protected:
80  QAtomicInt m_currentValue;
81 
83  QAtomicInt m_lastRefreshValue;
84 };
#define CV_DB_LIB_API
Definition: CV_db.h:15
#define signals
virtual void setInfo(const char *infoStr)=0
Notifies some information about the ongoing process.
virtual void setMethodTitle(const char *methodTitle)=0
Notifies the algorithm title.
Graphical progress indicator (thread-safe)
virtual void stop() override
Notifies the fact that the process has ended.
virtual void update(float percent) override
Notifies the algorithm progress.
virtual void start() override
ecvProgressDialog(bool cancelButton=false, QWidget *parent=0)
Default constructor.
virtual void setInfo(const char *infoStr) override
Notifies some information about the ongoing process.
void refresh()
Refreshes the progress.
QAtomicInt m_currentValue
Current progress value (percent)
virtual void setInfo(QString infoStr)
setInfo with a QString as argument
void scheduleRefresh()
Schedules a call to refresh.
virtual bool isCancelRequested() override
Checks if the process should be canceled.
virtual void setMethodTitle(QString methodTitle)
setMethodTitle with a QString as argument
QAtomicInt m_lastRefreshValue
Last displayed progress value (percent)
virtual ~ecvProgressDialog()
Destructor (virtual)
virtual void setMethodTitle(const char *methodTitle) override
Notifies the algorithm title.