Skip to content

Commit

Permalink
MythMusic: trackinfo_popup is now a true OSD over fullscreen vis (#796)
Browse files Browse the repository at this point in the history
* MythMusic: trackinfo_popup is now a true OSD over fullscreen vis

Any track or player changing keys now pops the trackinfo.  Like
miniplayer, hitting SELECT will "stick" the info until ESCAPE.  Any
other key extends the 8 second timer to dismiss.

* MythMusic: Make unassigned arrow keys useful in full screen visualizer

up/down changes track while left/right seeks in the track.  Also at
music level 1,3 can change speed along with x/w since they are more
likely to be on remotes.
  • Loading branch information
twitham1 authored Sep 26, 2023
1 parent 850b63c commit e66e173
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
3 changes: 2 additions & 1 deletion mythplugins/mythmusic/mythmusic/musiccommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ enum MusicView
MV_ALBUMINFO,
MV_TRACKINFO,
MV_RADIO,
MV_MINIPLAYER
MV_MINIPLAYER,
MV_VISUALIZERINFO
};

Q_DECLARE_METATYPE(MusicView);
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythmusic/mythmusic/mythmusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,9 @@ static void setupKeys(void)
REG_KEY("Music", "REFRESH", QT_TRANSLATE_NOOP("MythControls",
"Refresh music tree"), "8");
REG_KEY("Music", "SPEEDUP", QT_TRANSLATE_NOOP("MythControls",
"Increase Play Speed"), "W");
"Increase Play Speed"), "W,3");
REG_KEY("Music", "SPEEDDOWN", QT_TRANSLATE_NOOP("MythControls",
"Decrease Play Speed"), "X");
"Decrease Play Speed"), "X,1");
REG_KEY("Music", "MARK", QT_TRANSLATE_NOOP("MythControls",
"Toggle track selection"), "T");
REG_KEY("Music", "TOGGLESHUFFLE", QT_TRANSLATE_NOOP("MythControls",
Expand Down
53 changes: 50 additions & 3 deletions mythplugins/mythmusic/mythmusic/visualizerview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,43 @@ bool VisualizerView::keyPressEvent(QKeyEvent *event)
QString action = actions[i];
handled = true;

// unassgined arrow keys might as well be useful
if (action == "UP")
{
action = "PREVTRACK";
previous();
}
else if (action == "DOWN")
{
action = "NEXTTRACK";
next();
}
else if (action == "LEFT")
{
action = "RWND";
seekback();
}
else if (action == "RIGHT")
{
action = "FFWD";
seekforward();
}

if (action == "INFO")
showTrackInfoPopup();
else if (
action == "NEXTTRACK" ||
action == "PREVTRACK" ||
action == "FFWD" ||
action == "RWND" ||
action == "THMBUP" ||
action == "THMBDOWN" ||
action == "SPEEDUP" ||
action == "SPEEDDOWN")
{
handled = MusicCommon::keyPressEvent(event);
showTrackInfoPopup();
}
else
handled = false;
}
Expand All @@ -94,7 +129,7 @@ void VisualizerView::ShowMenu(void)
auto *menu = new MythMenu(label, this, "menu");

menu->AddItem(tr("Change Visualizer"), nullptr, createVisualizerMenu());
menu->AddItem(tr("Show Track Info"), &showTrackInfoPopup);
menu->AddItem(tr("Show Track Info"), &VisualizerView::showTrackInfoPopup);
menu->AddItem(tr("Other Options"), nullptr, createMainMenu());

MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
Expand All @@ -109,6 +144,8 @@ void VisualizerView::ShowMenu(void)

void VisualizerView::showTrackInfoPopup(void)
{
if (m_currentView == MV_VISUALIZERINFO)
return;
MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");

auto *popup = new TrackInfoPopup(popupStack);
Expand Down Expand Up @@ -142,14 +179,14 @@ bool TrackInfoPopup::Create(void)
return false;

// find common widgets available on any view
m_currentView = MV_VISUALIZER; // reverted to zero ?!
err = CreateCommon();

if (err)
{
LOG(VB_GENERAL, LOG_ERR, "Cannot load screen 'trackinfo_popup'");
return false;
}
m_currentView = MV_VISUALIZERINFO;

// get map for current track
MusicMetadata *metadata = gPlayer->getCurrentMetadata();
Expand Down Expand Up @@ -187,6 +224,10 @@ bool TrackInfoPopup::Create(void)

bool TrackInfoPopup::keyPressEvent(QKeyEvent *event)
{
if (GetFocusWidget() && GetFocusWidget()->keyPressEvent(event))
return true;

m_currentView = MV_VISUALIZERINFO;
QStringList actions;
bool handled = GetMythMainWindow()->TranslateKeyPress("Music", event, actions, false);

Expand All @@ -195,7 +236,13 @@ bool TrackInfoPopup::keyPressEvent(QKeyEvent *event)
QString action = actions[i];
handled = true;

if (action == "ESCAPE")
if (action == "SELECT")
{
if (m_displayTimer)
m_displayTimer->stop();
return true;
}
else if (action == "ESCAPE")
Close();
else if (action == "INFO")
showTrackInfo(gPlayer->getCurrentMetadata());
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/visualizerview.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class VisualizerView : public MusicCommon
void customEvent(QEvent *event) override; // MusicCommon

private slots:
static void showTrackInfoPopup(void);
void showTrackInfoPopup(void);
};

class MPLUGIN_PUBLIC TrackInfoPopup : public VisualizerView
Expand Down

0 comments on commit e66e173

Please sign in to comment.