FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
progress.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include <QtCore/QVariant>
19 #include <QtCore/QString>
20 
21 #include <unordered_map>
22 
23 namespace qttask {
24 
25 class BaseRunner;
26 
29 class Progress
30 {
31 public:
32  ~Progress();
33 
34  int value() const;
35  void setValue(int pct);
36 
37  const QString& step() const;
38  void setStep(const QString& title);
39 
40  void outputMessage(const QString& msg);
41 
42  QVariant data(int key) const;
43  void setData(int key, const QVariant& value);
44 
45  bool isAbortRequested() const;
46 
47 private:
48  friend class Manager;
49  friend class BaseRunner;
50 
51  Progress(BaseRunner* runner);
52 
53  BaseRunner* m_runner;
54  std::unordered_map<int, QVariant> m_dataHash;
55  int m_value;
56  QString m_step;
57 };
58 
59 } // namespace qttask
Base class for all runner objects.
Definition: base_runner.h:31
~Progress()
Definition: progress.cpp:27
void outputMessage(const QString &msg)
Definition: progress.cpp:52
void setValue(int pct)
Definition: progress.cpp:35
QVariant data(int key) const
Returns this progress' custom data for the key key as a QVariant.
Definition: progress.cpp:63
bool isAbortRequested() const
Definition: progress.cpp:79
void setStep(const QString &title)
Definition: progress.cpp:46
Provides feedback on the progress of an executing operation.
Definition: progress.h:29
Central class providing management of tasks and notifications.
Definition: manager.h:32
int value() const
Definition: progress.cpp:30
const QString & step() const
Definition: progress.cpp:41
Definition: base_runner.cpp:20
void setData(int key, const QVariant &value)
Set this progress' custom data for the key key to value.
Definition: progress.cpp:74