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  ~ProgressUpdateEvent() override;
23 
24  QString GetMessage() { return m_message; }
25  uint GetTotal() const { return m_total; }
26  uint GetCount() const { return m_count; }
27 
28  static Type kEventType;
29 
30  private:
31  uint m_total {0};
32  uint m_count {0};
33  QString m_message;
34 };
35 
37 {
38  Q_OBJECT
39  public:
40  MythUIBusyDialog(const QString &message,
41  MythScreenStack *parent, const char *name);
42 
43  bool Create(void) override; // MythScreenType
44  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
45  void SetMessage(const QString &message);
46  void Reset(void) override; // MythUIType
47  void Pulse(void) override; // MythUIType
48 
49  protected:
50  QString m_origMessage;
51  QString m_message;
52  bool m_haveNewMessage {false};
53  QString m_newMessage;
55 
56  MythUIText *m_messageText {nullptr};
57 };
58 
60 {
61  Q_OBJECT
62  public:
63  MythUIProgressDialog(QString message,
64  MythScreenStack *parent, const char *name)
65  : MythScreenType(parent, name, false), m_message(std::move(message)) {}
66 
67  bool Create(void) override; // MythScreenType
68  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
69  void customEvent(QEvent *event) override; // MythUIType
70  void SetTotal(uint total);
71  void SetProgress(uint count);
72  void SetMessage(const QString &message);
73 
74  protected:
75  void UpdateProgress(void);
76 
77  QString m_message;
78  uint m_total {0};
79  uint m_count {0};
80 
81  MythUIText *m_messageText {nullptr};
82  MythUIText *m_progressText {nullptr};
83  MythUIProgressBar *m_progressBar {nullptr};
84 };
85 
86 MUI_PUBLIC MythUIBusyDialog *ShowBusyPopup(const QString &message);
87 
88 #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)