MythTV  master
mythprogressdialog.h
Go to the documentation of this file.
1 #ifndef MYTHPROGRESSBOX_H_
2 #define MYTHPROGRESSBOX_H_
3 
4 #include <QEvent>
5 #include <QMutex>
6 
7 #include "mythscreentype.h"
8 
9 class MythUIText;
10 class MythUIProgressBar;
11 
12 class MUI_PUBLIC ProgressUpdateEvent : public QEvent
13 {
14  public:
15  ProgressUpdateEvent(uint count, uint total=0, QString message="") :
16  QEvent(kEventType), m_total(total), m_count(count),
17  m_message(message) { }
18 
19  QString GetMessage() { return m_message; }
20  uint GetTotal() { return m_total; }
21  uint GetCount() { return m_count; }
22 
23  static Type kEventType;
24 
25  private:
26  uint m_total {0};
27  uint m_count {0};
28  QString m_message;
29 };
30 
32 {
33  Q_OBJECT
34  public:
35  MythUIBusyDialog(const QString &message,
36  MythScreenStack *parent, const char *name);
37 
38  bool Create(void) override; // MythScreenType
39  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
40  void SetMessage(const QString &message);
41  void Reset(void) override; // MythUIType
42  void Pulse(void) override; // MythUIType
43 
44  protected:
45  QString m_origMessage;
46  QString m_message;
47  bool m_haveNewMessage {false};
48  QString m_newMessage;
50 
51  MythUIText *m_messageText {nullptr};
52 };
53 
55 {
56  Q_OBJECT
57  public:
58  MythUIProgressDialog(const QString &message,
59  MythScreenStack *parent, const char *name)
60  : MythScreenType(parent, name, false), m_message(message) {}
61 
62  bool Create(void) override; // MythScreenType
63  bool keyPressEvent(QKeyEvent *event) override; // MythScreenType
64  void customEvent(QEvent *event) override; // MythUIType
65  void SetTotal(uint total);
66  void SetProgress(uint count);
67  void SetMessage(const QString &message);
68 
69  protected:
70  void UpdateProgress(void);
71 
72  QString m_message;
73  uint m_total {0};
74  uint m_count {0};
75 
76  MythUIText *m_messageText {nullptr};
77  MythUIText *m_progressText {nullptr};
78  MythUIProgressBar *m_progressBar {nullptr};
79 };
80 
81 MUI_PUBLIC MythUIBusyDialog *ShowBusyPopup(const QString &message);
82 
83 #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:977
MythUIProgressDialog(const QString &message, MythScreenStack *parent, const char *name)
virtual bool Create(void)
unsigned int uint
Definition: compat.h:140
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:442
const char * name
Definition: ParseText.cpp:328
bool keyPressEvent(QKeyEvent *) 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.