MythTV master
mythscreentype.h
Go to the documentation of this file.
1#ifndef MYTHSCREEN_TYPE_H_
2#define MYTHSCREEN_TYPE_H_
3
4#include <utility>
5
6// Qt headers
7#include <QEvent>
8#include <QSemaphore>
9
10// MythTV headers
11#include "mythuicomposite.h"
12#include "mythuiutils.h"
13
14class QInputMethodEvent;
15class ScreenLoadTask;
16class MythScreenStack;
18
26{
27 public:
28 explicit ScreenLoadCompletionEvent(QString id) :
29 QEvent(kEventType), m_id(std::move(id)) { }
30
31 QString GetId() { return m_id; }
32
33 static const Type kEventType;
34
35 private:
36 QString m_id;
37};
38
46{
47 Q_OBJECT
48
49 friend class ScreenLoadTask;
50
51 public:
52 MythScreenType(MythScreenStack *parent, const QString &name,
53 bool fullscreen = true);
54 ~MythScreenType() override;
55
56 virtual bool Create(void); // do the actual work of making the screen.
57 bool keyPressEvent(QKeyEvent *event) override; // MythUIType
58 bool inputMethodEvent(QInputMethodEvent *event) override;// MythUIType
59 bool gestureEvent(MythGestureEvent *event) override; // MythUIType
60 virtual void ShowMenu(void);
61
62 void doInit(void);
63 void LoadInForeground(void);
64 bool IsInitialized(void) const;
65
66 // if the widget is full screen and obscures widgets below it
67 bool IsFullscreen(void) const;
68 void SetFullscreen(bool full);
69
70 MythUIType *GetFocusWidget(void) const;
71 bool SetFocusWidget(MythUIType *widget = nullptr);
72 virtual bool NextPrevWidgetFocus(bool up_or_down);
73 void BuildFocusList(void);
74
75 MythScreenStack *GetScreenStack() const;
76
77 virtual void aboutToHide(void);
78 virtual void aboutToShow(void);
79
80 bool IsDeleting(void) const;
81 void SetDeleting(bool deleting);
82
83 bool IsLoading(void) const { return m_isLoading; }
84 bool IsLoaded(void) const { return m_isLoaded; }
85
86 MythPainter *GetPainter(void) override; // MythUIType
87
88 public slots:
89 virtual void Close();
90
91 signals:
92 void Exiting();
93
94 protected:
95 // for the global store..
96 MythScreenType(MythUIType *parent, const QString &name,
97 bool fullscreen = true);
98
99 void CopyFrom(MythUIType *base) override; // MythUIType
100 void CreateCopy(MythUIType *parent) override; // MythUIType
101 bool ParseElement( const QString &filename,
102 QDomElement &element,
103 bool showWarnings) override; // MythUIType
104
105 virtual void Load(void); // ONLY to be used for loading data, NO UI WORK or it will segfault
106 virtual void Init(void); // UI work to draw data loaded
107
108 void LoadInBackground(const QString& message = "");
109 void ReloadInBackground(void);
110
111 void OpenBusyPopup(const QString& message = "");
112 void CloseBusyPopup(void);
113 void SetBusyPopupMessage(const QString &message);
114 void ResetBusyPopup(void);
115
116 bool m_fullScreen {false};
117 bool m_isDeleting {false};
118
119 QSemaphore m_loadLock {1};
120 volatile bool m_isLoading {false};
121 volatile bool m_isLoaded {false};
122 bool m_isInitialized {false};
123
124 MythUIType *m_currentFocusWidget {nullptr};
125 //TODO We are currently dependant on the internal sorting of QMap for
126 // entries to be iterated in the correct order, this should probably
127 // be changed.
129
130 MythScreenStack *m_screenStack {nullptr};
131 MythUIBusyDialog *m_busyPopup {nullptr};
132
133 QRegion m_savedMask;
134
135 friend class XMLParseBase;
136};
137
138#endif
A custom event that represents a mouse gesture.
Definition: mythgesture.h:40
Screen in which all other widgets are contained and rendered.
bool IsLoading(void) const
bool IsLoaded(void) const
FocusInfoType m_focusWidgetList
The base class on which all widgets and screens are based.
Definition: mythuitype.h:86
Event that can be dispatched from a MythScreenType when it has completed loading.
static const Type kEventType
ScreenLoadCompletionEvent(QString id)
#define MUI_PUBLIC
Definition: mythuiexp.h:9
QMultiMap< int, MythUIType * > FocusInfoType
Definition: mythuitype.h:39
STL namespace.