MythTV
master
mythtv
libs
libmythtv
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
8
#include "
libmythbase/mythlogging.h
"
9
#include "
libmythui/mythmainwindow.h
"
10
#include "
libmythui/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
21
bool
TvPlayWindow::Create
()
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
);
36
m_progressBar
->
SetStart
(0);
37
m_progressBar
->
SetTotal
(100);
38
m_progressBar
->
SetUsed
(
m_progress
);
39
}
40
41
return
true
;
42
}
43
44
void
TvPlayWindow::UpdateProgress
(
void
)
45
{
46
if
(!
m_progressBar
)
47
return
;
48
m_progress
++;
49
if
(
m_progress
> 100)
50
m_progress
= 0;
51
m_progressBar
->
SetUsed
(
m_progress
);
52
m_progressBar
->
SetVisible
(
true
);
53
}
54
60
bool
TvPlayWindow::gestureEvent
(
MythGestureEvent
*event)
61
{
62
bool
handled =
false
;
63
#ifdef Q_OS_ANDROID
64
switch
(event->
GetGesture
())
65
{
66
case
MythGestureEvent::Click
:
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
}
TvPlayWindow::Create
bool Create(void) override
Definition:
tv_play_win.cpp:21
MythGestureEvent::Click
@ Click
Definition:
mythgesture.h:77
mythuiprogressbar.h
MythGestureEvent::GetGesture
Gesture GetGesture() const
Definition:
mythgesture.h:85
MythGestureEvent::GetButton
Qt::MouseButton GetButton() const
Definition:
mythgesture.h:88
MythUIProgressBar::SetStart
void SetStart(int value)
Definition:
mythuiprogressbar.cpp:66
MythUIType::GetChild
MythUIType * GetChild(const QString &name) const
Get a named child of this UIType.
Definition:
mythuitype.cpp:138
MythUIProgressBar::SetUsed
void SetUsed(int value)
Definition:
mythuiprogressbar.cpp:72
MythScreenStack
Definition:
mythscreenstack.h:16
MythUIType::SetCanTakeFocus
void SetCanTakeFocus(bool set=true)
Set whether this widget can take focus.
Definition:
mythuitype.cpp:362
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition:
mythlogging.h:39
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition:
mythscreentype.h:45
MythUIProgressBar::SetTotal
void SetTotal(int value)
Definition:
mythuiprogressbar.cpp:78
mythlogging.h
MythUIProgressBar
Progress bar widget.
Definition:
mythuiprogressbar.h:12
XMLParseBase::CopyWindowFromBase
static bool CopyWindowFromBase(const QString &windowname, MythScreenType *win)
Definition:
xmlparsebase.cpp:941
tv_play_win.h
TvPlayWindow::UpdateProgress
void UpdateProgress(void)
Definition:
tv_play_win.cpp:44
TvPlayWindow::TvPlayWindow
TvPlayWindow(MythScreenStack *parent, const char *name)
Definition:
tv_play_win.cpp:15
GetMythMainWindow
MythMainWindow * GetMythMainWindow(void)
Definition:
mythmainwindow.cpp:104
TvPlayWindow::m_progress
int m_progress
Definition:
tv_play_win.h:27
MythGestureEvent
A custom event that represents a mouse gesture.
Definition:
mythgesture.h:39
TvPlayWindow::gestureEvent
bool gestureEvent(MythGestureEvent *event) override
Mouse click/movement handler, recieves mouse gesture events from event loop.
Definition:
tv_play_win.cpp:60
MythUIProgressBar::SetVisible
void SetVisible(bool visible) override
Definition:
mythuiprogressbar.cpp:193
TvPlayWindow::m_progressBar
MythUIProgressBar * m_progressBar
Definition:
tv_play_win.h:26
mythmainwindow.h
Generated on Sun Jan 19 2025 03:16:56 for MythTV by
1.8.17