Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MythMusic: trackinfo_popup is now a true OSD over fullscreen vis #796

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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