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 const 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::GetCount
uint GetCount() const
Definition: mythprogressdialog.h:26
MUI_PUBLIC
#define MUI_PUBLIC
Definition: mythuiexp.h:9
false
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:89
ProgressUpdateEvent::ProgressUpdateEvent
ProgressUpdateEvent(uint count, uint total=0, QString message="")
Definition: mythprogressdialog.h:19
MythScreenStack
Definition: mythscreenstack.h:16
MythScreenType::Create
virtual bool Create(void)
Definition: mythscreentype.cpp:263
MythUIType::customEvent
void customEvent(QEvent *event) override
Definition: mythuitype.cpp:1003
ProgressUpdateEvent::m_message
QString m_message
Definition: mythprogressdialog.h:33
MythUIBusyDialog::m_newMessageLock
QMutex m_newMessageLock
Definition: mythprogressdialog.h:54
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
MythUIType::Pulse
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
Definition: mythuitype.cpp:456
MythUIProgressDialog::MythUIProgressDialog
MythUIProgressDialog(QString message, MythScreenStack *parent, const char *name)
Definition: mythprogressdialog.h:63
ProgressUpdateEvent
Definition: mythprogressdialog.h:16
ShowBusyPopup
MUI_PUBLIC MythUIBusyDialog * ShowBusyPopup(const QString &message)
Definition: mythprogressdialog.cpp:97
ProgressUpdateEvent::kEventType
static const Type kEventType
Definition: mythprogressdialog.h:28
MythUIProgressBar
Progress bar widget.
Definition: mythuiprogressbar.h:12
MythUIProgressDialog
Definition: mythprogressdialog.h:59
MythUIBusyDialog
Definition: mythprogressdialog.h:36
MythUIBusyDialog::m_newMessage
QString m_newMessage
Definition: mythprogressdialog.h:53
uint
unsigned int uint
Definition: compat.h:81
MythUIType::Reset
virtual void Reset(void)
Reset the widget to it's original state, should not reset changes made by the theme.
Definition: mythuitype.cpp:73
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: mythscreentype.cpp:401
ProgressUpdateEvent::GetMessage
QString GetMessage()
Definition: mythprogressdialog.h:24
MythUIBusyDialog::m_message
QString m_message
Definition: mythprogressdialog.h:51
MythUIBusyDialog::m_origMessage
QString m_origMessage
Definition: mythprogressdialog.h:50
MythUIProgressDialog::m_message
QString m_message
Definition: mythprogressdialog.h:77
mythscreentype.h
ProgressUpdateEvent::GetTotal
uint GetTotal() const
Definition: mythprogressdialog.h:25