MythTV  master
tv_play_win.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QTimer>
3 #ifdef ANDROID
4 #include <QCoreApplication>
5 #endif
6 
7 // MythTV
8 #include "mythmainwindow.h"
9 #include "mythlogging.h"
10 #include "mythuiprogressbar.h"
11 
12 #include "tv_play_win.h"
13 
14 
15 TvPlayWindow::TvPlayWindow(MythScreenStack *parent, const char *name)
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  {
35  m_progressBar->SetVisible(false);
37  m_progressBar->SetTotal(100);
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->gesture())
65  {
67  switch (event->GetButton())
68  {
70  LOG(VB_GENERAL, LOG_NOTICE, "TV Play Window R Click");
71  handled = true;
72  break;
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->gesture() == MythGestureEvent::Click)
92  {
93  LOG(VB_GENERAL, LOG_NOTICE, "TV Play Window Click");
94  handled = true;
95  }
96 #endif
97  return handled;
98 }
void SetVisible(bool visible) override
Gesture gesture(void) const
Get the gesture type.
Definition: mythgesture.h:107
TvPlayWindow(MythScreenStack *parent, const char *name)
Definition: tv_play_win.cpp:15
void UpdateProgress(void)
Definition: tv_play_win.cpp:44
MythUIProgressBar * m_progressBar
Definition: tv_play_win.h:26
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
bool Create(void) override
Definition: tv_play_win.cpp:21
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
MythMainWindow * GetMythMainWindow(void)
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:41
Button GetButton(void) const
Definition: mythgesture.h:119
bool gestureEvent(MythGestureEvent *) override
Mouse click/movement handler, recieves mouse gesture events from event loop.
Definition: tv_play_win.cpp:60
Screen in which all other widgets are contained and rendered.
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition: mythuitype.cpp:132
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
Definition: mythuitype.cpp:344