From 813f3e6cc66ac3b62706d3b19e3b50bee5c54258 Mon Sep 17 00:00:00 2001 From: Timothy D Witham Date: Tue, 12 Sep 2023 23:04:03 -0500 Subject: [PATCH 1/2] 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. --- mythplugins/mythmusic/mythmusic/musiccommon.h | 3 +- .../mythmusic/mythmusic/visualizerview.cpp | 31 +++++++++++++++++-- .../mythmusic/mythmusic/visualizerview.h | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/mythplugins/mythmusic/mythmusic/musiccommon.h b/mythplugins/mythmusic/mythmusic/musiccommon.h index 87cb8a38ed4..706bfa05ba8 100644 --- a/mythplugins/mythmusic/mythmusic/musiccommon.h +++ b/mythplugins/mythmusic/mythmusic/musiccommon.h @@ -40,7 +40,8 @@ enum MusicView MV_ALBUMINFO, MV_TRACKINFO, MV_RADIO, - MV_MINIPLAYER + MV_MINIPLAYER, + MV_VISUALIZERINFO }; Q_DECLARE_METATYPE(MusicView); diff --git a/mythplugins/mythmusic/mythmusic/visualizerview.cpp b/mythplugins/mythmusic/mythmusic/visualizerview.cpp index 9d1caa44a6d..5ca6f4fe4c5 100644 --- a/mythplugins/mythmusic/mythmusic/visualizerview.cpp +++ b/mythplugins/mythmusic/mythmusic/visualizerview.cpp @@ -77,6 +77,19 @@ bool VisualizerView::keyPressEvent(QKeyEvent *event) 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; } @@ -94,7 +107,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"); @@ -109,6 +122,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); @@ -142,7 +157,6 @@ bool TrackInfoPopup::Create(void) return false; // find common widgets available on any view - m_currentView = MV_VISUALIZER; // reverted to zero ?! err = CreateCommon(); if (err) @@ -150,6 +164,7 @@ bool TrackInfoPopup::Create(void) 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(); @@ -187,6 +202,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); @@ -195,7 +214,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()); diff --git a/mythplugins/mythmusic/mythmusic/visualizerview.h b/mythplugins/mythmusic/mythmusic/visualizerview.h index 15194d621d6..258abb61abc 100644 --- a/mythplugins/mythmusic/mythmusic/visualizerview.h +++ b/mythplugins/mythmusic/mythmusic/visualizerview.h @@ -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 From bb1e23e37ed2e53e075e27f7c6aaa6e4b4d9e2e8 Mon Sep 17 00:00:00 2001 From: Timothy D Witham Date: Wed, 13 Sep 2023 22:34:57 -0500 Subject: [PATCH 2/2] 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. --- mythplugins/mythmusic/mythmusic/mythmusic.cpp | 4 ++-- .../mythmusic/mythmusic/visualizerview.cpp | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mythplugins/mythmusic/mythmusic/mythmusic.cpp b/mythplugins/mythmusic/mythmusic/mythmusic.cpp index 5d42c04af6d..65a217aaa0e 100644 --- a/mythplugins/mythmusic/mythmusic/mythmusic.cpp +++ b/mythplugins/mythmusic/mythmusic/mythmusic.cpp @@ -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", diff --git a/mythplugins/mythmusic/mythmusic/visualizerview.cpp b/mythplugins/mythmusic/mythmusic/visualizerview.cpp index 5ca6f4fe4c5..e09ff6b5d2a 100644 --- a/mythplugins/mythmusic/mythmusic/visualizerview.cpp +++ b/mythplugins/mythmusic/mythmusic/visualizerview.cpp @@ -75,6 +75,28 @@ 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 (