MythTV master
tv_play_win.cpp
Go to the documentation of this file.
1// Qt
2#include <QTimer>
3#ifdef Q_OS_ANDROID
4#include <QCoreApplication>
5#endif
6
7// MythTV
11
12#include "tv_play_win.h"
13
14
16 : MythScreenType(parent, name)
17{
18 SetCanTakeFocus(true);
19}
20
22{
23 // Load the theme for this screen
24 bool foundtheme = CopyWindowFromBase("videowindow", this);
25 if (!foundtheme)
26 {
27 LOG(VB_GENERAL, LOG_ERR,
28 "Cannot load screen videowindow from base.xml");
29 return false;
30 }
31
32 m_progressBar = dynamic_cast<MythUIProgressBar*>(GetChild("progress"));
33 if (m_progressBar)
34 {
39 }
40
41 return true;
42}
43
45{
46 if (!m_progressBar)
47 return;
48 m_progress++;
49 if (m_progress > 100)
50 m_progress = 0;
53}
54
61{
62 bool handled = false;
63#ifdef Q_OS_ANDROID
64 switch (event->GetGesture())
65 {
67 switch (event->GetButton())
68 {
69 case Qt::RightButton :
70 LOG(VB_GENERAL, LOG_NOTICE, "TV Play Window R Click");
71 handled = true;
72 break;
73 case Qt::LeftButton :
74 {
75 LOG(VB_GENERAL, LOG_NOTICE, "TV Play Window L Click");
76 // send it on like the others to be handled by TV
77 QCoreApplication::postEvent(GetMythMainWindow(), new MythGestureEvent(*event));
78 handled = true;
79 }
80 break;
81 default:
82 LOG(VB_GENERAL, LOG_NOTICE, "TV Play Window other Click");
83 handled = true;
84 break;
85 }
86 break;
87 default:
88 break;
89 }
90#else
91 if (event->GetGesture() == MythGestureEvent::Click)
92 {
93 LOG(VB_GENERAL, LOG_NOTICE, "TV Play Window Click");
94 handled = true;
95 }
96#endif
97 return handled;
98}
A custom event that represents a mouse gesture.
Definition: mythgesture.h:40
Gesture GetGesture() const
Definition: mythgesture.h:85
Qt::MouseButton GetButton() const
Definition: mythgesture.h:88
Screen in which all other widgets are contained and rendered.
Progress bar widget.
void SetUsed(int value)
void SetStart(int value)
void SetTotal(int value)
void SetVisible(bool visible) override
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
Definition: mythuitype.cpp:362
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:138
void UpdateProgress(void)
Definition: tv_play_win.cpp:44
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, recieves mouse gesture events from event loop.
Definition: tv_play_win.cpp:60
bool Create(void) override
Definition: tv_play_win.cpp:21
MythUIProgressBar * m_progressBar
Definition: tv_play_win.h:26
TvPlayWindow(MythScreenStack *parent, const char *name)
Definition: tv_play_win.cpp:15
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
MythMainWindow * GetMythMainWindow(void)