MythTV  master
mythprogressdialog.h
Go to the documentation of this file.
1 #ifndef MYTHPROGRESSBOX_H_
2 #define MYTHPROGRESSBOX_H_
3 
4 #include <utility>
5 
6 // Qt headers
7 #include <QEvent>
8 #include <QMutex>
9 
10 // MythTV headers
11 #include "mythscreentype.h"
12 
13 class MythUIText;
14 class MythUIProgressBar;
15 
16 class MUI_PUBLIC ProgressUpdateEvent : public QEvent
17 {
18  public:
19  explicit ProgressUpdateEvent(uint count, uint total=0, QString message="") :
20  QEvent(kEventType), m_total(total), m_count(count),
21  m_message(std::move(message)) { }
22 
23  QString GetMessage() { return m_message; }
24  uint GetTotal() { return m_total; }
25  uint GetCount() { return m_count; }
26 
27  static Type kEventType;
28 
29  private:
30  uint m_total {0};
31  uint m_count {0};
32  QString m_message;
33 };
34 
36 {
37  Q_OBJECT
38  public:
39  MythUIBusyDialog(const QString &message,
40  MythScreenStack *parent, const char *name);
41 
42  bool Create(void) override; // MythScreenType
43  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
44  void SetMessage(const QString &message);
45  void Reset(void) override; // MythUIType
46  void Pulse(void) override; // MythUIType
47 
48  protected:
49  QString m_origMessage;
50  QString m_message;
51  bool m_haveNewMessage {false};
52  QString m_newMessage;
54 
55  MythUIText *m_messageText {nullptr};
56 };
57 
59 {
60  Q_OBJECT
61  public:
62  MythUIProgressDialog(QString message,
63  MythScreenStack *parent, const char *name)
64  : MythScreenType(parent, name, false), m_message(std::move(message)) {}
65 
66  bool Create(void) override; // MythScreenType
67  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
68  void customEvent(QEvent *event) override; // MythUIType
69  void SetTotal(uint total);
70  void SetProgress(uint count);
71  void SetMessage(const QString &message);
72 
73  protected:
74  void UpdateProgress(void);
75 
76  QString m_message;
77  uint m_total {0};
78  uint m_count {0};
79 
80  MythUIText *m_messageText {nullptr};
81  MythUIText *m_progressText {nullptr};
82  MythUIProgressBar *m_progressBar {nullptr};
83 };
84 
85 MUI_PUBLIC MythUIBusyDialog *ShowBusyPopup(const QString &message);
86 
87 #endif
ProgressUpdateEvent(uint count, uint total=0, QString message="")
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:978
virtual bool Create(void)
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:440
unsigned int uint
Definition: compat.h:140
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:69
MUI_PUBLIC MythUIBusyDialog * ShowBusyPopup(const QString &message)
#define MUI_PUBLIC
Definition: mythuiexp.h:9
Screen in which all other widgets are contained and rendered.
Progress bar widget.
MythUIProgressDialog(QString message, MythScreenStack *parent, const char *name)