Skip to content

Commit 2617826

Browse files
author
Mark Kendall
committed
Move DVD menu keypress handling into DVDRingBuffer
1 parent 269b5eb commit 2617826

File tree

3 files changed

+45
-38
lines changed

3 files changed

+45
-38
lines changed

mythtv/libs/libmythtv/dvdringbuffer.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,44 @@ void DVDRingBuffer::GoToPreviousProgram(void)
957957
dvdnav_prev_pg_search(m_dvdnav);
958958
}
959959

960+
bool DVDRingBuffer::HandleAction(const QStringList &actions, int64_t pts)
961+
{
962+
(void)pts;
963+
964+
if (!NumMenuButtons())
965+
return false;
966+
967+
bool handled = true;
968+
if (actions.contains(ACTION_UP) ||
969+
actions.contains(ACTION_CHANNELUP))
970+
{
971+
MoveButtonUp();
972+
}
973+
else if (actions.contains(ACTION_DOWN) ||
974+
actions.contains(ACTION_CHANNELDOWN))
975+
{
976+
MoveButtonDown();
977+
}
978+
else if (actions.contains(ACTION_LEFT) ||
979+
actions.contains(ACTION_SEEKRWND))
980+
{
981+
MoveButtonLeft();
982+
}
983+
else if (actions.contains(ACTION_RIGHT) ||
984+
actions.contains(ACTION_SEEKFFWD))
985+
{
986+
MoveButtonRight();
987+
}
988+
else if (actions.contains(ACTION_SELECT))
989+
{
990+
ActivateButton();
991+
}
992+
else
993+
handled = false;
994+
995+
return handled;
996+
}
997+
960998
void DVDRingBuffer::MoveButtonLeft(void)
961999
{
9621000
if (NumMenuButtons() > 1)

mythtv/libs/libmythtv/dvdringbuffer.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ class MPUBLIC DVDRingBuffer : public RingBuffer
6767
QRect GetButtonCoords(void);
6868
void ReleaseMenuButton(void);
6969
bool IsInMenu(void) const { return m_inMenu; }
70-
void ActivateButton(void);
71-
void MoveButtonLeft(void);
72-
void MoveButtonRight(void);
73-
void MoveButtonUp(void);
74-
void MoveButtonDown(void);
70+
bool HandleAction(const QStringList &actions, int64_t pts);
7571

7672
// Subtitles
7773
uint GetSubtitleLanguage(int key);
@@ -175,6 +171,11 @@ class MPUBLIC DVDRingBuffer : public RingBuffer
175171
MythDVDPlayer *m_parent;
176172

177173
// Private menu/button stuff
174+
void ActivateButton(void);
175+
void MoveButtonLeft(void);
176+
void MoveButtonRight(void);
177+
void MoveButtonUp(void);
178+
void MoveButtonDown(void);
178179
bool DVDButtonUpdate(bool b_mode);
179180
void ClearMenuSPUParameters(void);
180181
void ClearMenuButton(void);

mythtv/libs/libmythtv/tv_play.cpp

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3854,39 +3854,7 @@ bool TV::DiscMenuHandleAction(PlayerContext *ctx, const QStringList &actions)
38543854

38553855
if (dvdrb)
38563856
{
3857-
int nb_buttons = dvdrb->NumMenuButtons();
3858-
if (nb_buttons == 0)
3859-
return false;
3860-
3861-
handled = true;
3862-
if (has_action(ACTION_UP, actions) ||
3863-
has_action(ACTION_CHANNELUP, actions))
3864-
{
3865-
dvdrb->MoveButtonUp();
3866-
}
3867-
else if (has_action(ACTION_DOWN, actions) ||
3868-
has_action(ACTION_CHANNELDOWN, actions))
3869-
{
3870-
dvdrb->MoveButtonDown();
3871-
}
3872-
else if (has_action(ACTION_LEFT, actions) ||
3873-
has_action(ACTION_SEEKRWND, actions))
3874-
{
3875-
dvdrb->MoveButtonLeft();
3876-
}
3877-
else if (has_action(ACTION_RIGHT, actions) ||
3878-
has_action(ACTION_SEEKFFWD, actions))
3879-
{
3880-
dvdrb->MoveButtonRight();
3881-
}
3882-
else if (has_action(ACTION_SELECT, actions))
3883-
{
3884-
ctx->LockDeletePlayer(__FILE__, __LINE__);
3885-
dvdrb->ActivateButton();
3886-
ctx->UnlockDeletePlayer(__FILE__, __LINE__);
3887-
}
3888-
else
3889-
handled = false;
3857+
handled = dvdrb->HandleAction(actions, 0);
38903858
}
38913859
else if (bdrb)
38923860
{

0 commit comments

Comments
 (0)