MythTV  master
mythscreentype.h
Go to the documentation of this file.
1 #ifndef MYTHSCREEN_TYPE_H_
2 #define MYTHSCREEN_TYPE_H_
3 
4 #include "mythuicomposite.h"
5 #include "mythuiutils.h"
6 
7 #include <QSemaphore>
8 #include <QEvent>
9 
10 class ScreenLoadTask;
11 class MythScreenStack;
12 class MythUIBusyDialog;
13 
21 {
22  public:
23  explicit ScreenLoadCompletionEvent(const QString &id) :
24  QEvent(kEventType), m_id(id) { }
25 
26  QString GetId() { return m_id; }
27 
28  static Type kEventType;
29 
30  private:
31  QString m_id;
32 };
33 
41 {
42  Q_OBJECT
43 
44  friend class ScreenLoadTask;
45 
46  public:
47  MythScreenType(MythScreenStack *parent, const QString &name,
48  bool fullscreen = true);
49  virtual ~MythScreenType();
50 
51  virtual bool Create(void); // do the actual work of making the screen.
52  bool keyPressEvent(QKeyEvent *) override; // MythUIType
53  bool gestureEvent(MythGestureEvent *) override; // MythUIType
54  virtual void ShowMenu(void);
55 
56  void doInit(void);
57  void LoadInForeground(void);
58  bool IsInitialized(void) const;
59 
60  // if the widget is full screen and obscures widgets below it
61  bool IsFullscreen(void) const;
62  void SetFullscreen(bool full);
63 
64  MythUIType *GetFocusWidget(void) const;
65  bool SetFocusWidget(MythUIType *widget = nullptr);
66  virtual bool NextPrevWidgetFocus(bool up_or_down);
67  void BuildFocusList(void);
68 
69  MythScreenStack *GetScreenStack() const;
70 
71  virtual void aboutToHide(void);
72  virtual void aboutToShow(void);
73 
74  bool IsDeleting(void) const;
75  void SetDeleting(bool deleting);
76 
77  bool IsLoading(void) { return m_IsLoading; }
78  bool IsLoaded(void) { return m_IsLoaded; }
79 
80  MythPainter *GetPainter(void) override; // MythUIType
81 
82  public slots:
83  virtual void Close();
84 
85  signals:
86  void Exiting();
87 
88  protected:
89  // for the global store..
90  MythScreenType(MythUIType *parent, const QString &name,
91  bool fullscreen = true);
92 
93  void CopyFrom(MythUIType *base) override; // MythUIType
94  void CreateCopy(MythUIType *parent) override; // MythUIType
95  bool ParseElement( const QString &filename,
96  QDomElement &element,
97  bool showWarnings) override; // MythUIType
98 
99  virtual void Load(void); // ONLY to be used for loading data, NO UI WORK or it will segfault
100  virtual void Init(void); // UI work to draw data loaded
101 
102  void LoadInBackground(const QString& message = "");
103  void ReloadInBackground(void);
104 
105  void OpenBusyPopup(const QString& message = "");
106  void CloseBusyPopup(void);
107  void SetBusyPopupMessage(const QString &message);
108  void ResetBusyPopup(void);
109 
110  bool m_FullScreen {false};
111  bool m_IsDeleting {false};
112 
113  QSemaphore m_LoadLock {1};
114  volatile bool m_IsLoading {false};
115  volatile bool m_IsLoaded {false};
116  bool m_IsInitialized {false};
117 
118  MythUIType *m_CurrentFocusWidget {nullptr};
119  //TODO We are currently dependant on the internal sorting of QMap for
120  // entries to be iterated in the correct order, this should probably
121  // be changed.
122  QMap<int, MythUIType *> m_FocusWidgetList;
123 
124  MythScreenStack *m_ScreenStack {nullptr};
125  MythUIBusyDialog *m_BusyPopup {nullptr};
126 
127  QRegion m_SavedMask;
128 
129  friend class XMLParseBase;
130 };
131 
132 #endif
unsigned int slots[4]
Definition: element.c:38
virtual MythPainter * GetPainter(void)
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
Definition: mythuitype.cpp:974
virtual bool gestureEvent(MythGestureEvent *event)
Mouse click/movement handler, receives mouse gesture events from the QCoreApplication event loop.
Definition: mythuitype.cpp:990
Event that can be dispatched from a MythScreenType when it has completed loading.
The base class on which all widgets and screens are based.
Definition: mythuitype.h:63
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
QMap< int, MythUIType * > m_FocusWidgetList
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
ScreenLoadCompletionEvent(const QString &id)
bool IsLoading(void)
bool IsLoaded(void)
#define MUI_PUBLIC
Definition: mythuiexp.h:9
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
Screen in which all other widgets are contained and rendered.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.