[mythtv] [PATCH] MythMusic: Visualization Interrupt,
PageUp/PageDown, PrevTrack Behavior
Perry Wintner
bbengineer at comcast.net
Fri Jun 25 13:50:14 EDT 2004
Just realized that the two patches won't apply after each other...so
attached is a combined patch.
Thanks
Perry
BBEngineer wrote:
> Here's my first patch(es), so be gentle:
>
> 1) The first patch is a MythMusic patch that will stop a full screen
> visualization and revert back to the playlist screen when a songs
> changes. If the visualization delay is set, it will wait that long to
> restart the visualization. If the visualization delay is not set (but
> full screen visualization was running), it will wait 5 seconds to
> restart full screen visualization
>
> The purpose of this is to be able to see the currently playing track
> information on a song change.
>
> This option can be enabled/disabled the same place in the menus as
> Cycle Visualization
>
> I am actually thinking of doing an OSD for this, but am not sure if it
> is possible to OSD on a visualization and how difficult it would
> actually be. Any suggestions??
>
> 2) The second patch adds PageUp/PageDown to the navigation of the
> playlist (F5/F6 is now RWND/FFWD). This allows the navigation of a
> large playlist quickly. ( I believe someone else submitted something
> similar not too long ago). It also changes the behavior of the
> PREVTRACK action. If the song playing is within the first 3 seconds,
> PREVTRACK will go to the previous track. If it is past 3 seconds,
> PREVTRACK will restart the song.
> This behavior is modeled after a typical CD/DVD player. I didn't make
> the threshold configurable, although maybe it should be...
>
> Sorry about the combined second patch...
>
>
> I am also thinking about adding the ability to delete a track from the
> current playlist while it is playing. Any thoughts on whether that is
> useful or how to go about doing that?
>
> Any suggestions/comments???
>
> Thanks
>
> Perry
>
>------------------------------------------------------------------------
>
>Index: mythmusic/globalsettings.cpp
>===================================================================
>RCS file: /var/lib/mythcvs/mythmusic/mythmusic/globalsettings.cpp,v
>retrieving revision 1.19
>diff -u -r1.19 globalsettings.cpp
>--- mythmusic/globalsettings.cpp 22 May 2004 05:45:16 -0000 1.19
>+++ mythmusic/globalsettings.cpp 8 Jun 2004 18:40:05 -0000
>@@ -383,6 +383,17 @@
> };
> };
>
>+class VisualInterruptOnSongChange: public CheckBoxSetting, public GlobalSetting {
>+public:
>+ VisualInterruptOnSongChange():
>+ GlobalSetting("VisualInterruptOnSongChange") {
>+ setLabel(QObject::tr("Interrupt Visualizer on each song"));
>+ setValue(false);
>+ setHelpText(QObject::tr("Interrupt the visualizer when the song "
>+ "change."));
>+ };
>+};
>+
> class VisualScaleWidth: public SpinBoxSetting, public GlobalSetting {
> public:
> VisualScaleWidth():
>@@ -594,6 +605,7 @@
> playersettings2->setLabel(QObject::tr("Visualization Settings"));
> playersettings2->addChild(new VisualizationMode());
> playersettings2->addChild(new VisualCycleOnSongChange());
>+ playersettings2->addChild(new VisualInterruptOnSongChange());
> playersettings2->addChild(new VisualModeDelay());
> playersettings2->addChild(new VisualScaleWidth());
> playersettings2->addChild(new VisualScaleHeight());
>Index: mythmusic/playbackbox.cpp
>===================================================================
>RCS file: /var/lib/mythcvs/mythmusic/mythmusic/playbackbox.cpp,v
>retrieving revision 1.72
>diff -u -r1.72 playbackbox.cpp
>--- mythmusic/playbackbox.cpp 27 Apr 2004 09:50:22 -0000 1.72
>+++ mythmusic/playbackbox.cpp 8 Jun 2004 18:40:06 -0000
>@@ -63,6 +63,8 @@
> showrating = gContext->GetNumSetting("MusicShowRatings", 0);
> listAsShuffled = gContext->GetNumSetting("ListAsShuffled", 0);
> cycle_visualizer = gContext->GetNumSetting("VisualCycleOnSongChange", 0);
>+ interrupt_visualizer =
>+ gContext->GetNumSetting("VisualInterruptOnSongChange", 0);
>
> // Through the magic of themes, our "GUI" already exists we just need to
> // wire up it
>@@ -158,10 +160,14 @@
> visual_mode_delay = visual_delay.toInt(&delayOK);
> if (!delayOK)
> visual_mode_delay = 0;
>+
>+ // Connect the visual mode callback for Visual Interrupt support
>+ // regardless of the visual_mode_delay value
>+ connect(visual_mode_timer, SIGNAL(timeout()), this, SLOT(visEnable()));
>+
> if (visual_mode_delay > 0)
> {
> visual_mode_timer->start(visual_mode_delay * 1000);
>- connect(visual_mode_timer, SIGNAL(timeout()), this, SLOT(visEnable()));
> }
> visualizer_status = 1;
>
>@@ -318,6 +324,11 @@
> QString action = actions[i];
> if (action == "ESCAPE" || action == "4")
> {
>+ // In case we enabled visual mode interrupt, ESCAPE
>+ // will cancel it
>+ if ( !visual_mode_delay )
>+ visual_mode_timer->stop();
>+
> visualizer_status = 1;
> QString visual_workaround = mainvisual->getCurrentVisual();
>
>@@ -366,8 +377,13 @@
> else if (action == "SELECT")
> {
> music_tree_list->select();
>+
>+ if (visualizer_status > 0 && interrupt_visualizer)
>+ InterruptVisualizer();
>+
> if (visualizer_status > 0 && cycle_visualizer)
> CycleVisualizer();
>+
> }
> else if (action == "REFRESH")
> {
>@@ -661,6 +677,44 @@
> }
>
>
>+void PlaybackBox::InterruptVisualizer()
>+{
>+
>+ // Only interrupt the visualizer if the user currently has a visualizer active
>+ if ( visualizer_status == 2 )
>+ {
>+ visualizer_status = 1;
>+ QString visual_workaround = mainvisual->getCurrentVisual();
>+
>+ // We may have gotten to full screen by pushing 7
>+ // (full screen blank). Or it may be blank because
>+ // the user likes "Blank". Figure out what to do ...
>+
>+ if (visual_workaround == "Blank" && visual_mode != "Blank")
>+ visual_workaround = visual_mode;
>+
>+ mainvisual->setVisual("Blank");
>+
>+ if (visual_blackhole)
>+ mainvisual->setGeometry(visual_blackhole->getScreenArea());
>+ else
>+ mainvisual->setGeometry(screenwidth + 10,
>+ screenheight + 10,
>+ 160, 160);
>+ setUpdatesEnabled(true);
>+
>+ mainvisual->setVisual(visual_workaround);
>+
>+ if (visual_mode_delay > 0)
>+ visual_mode_timer->start(visual_mode_delay * 1000);
>+ else
>+ // If the visualization was full screen, and there is no
>+ // visual mode, delay, wait 5 seconds before restarting
>+ visual_mode_timer->start(5 * 1000);
>+ }
>+}
>+
>+
> void PlaybackBox::pause(void)
> {
> if (output)
>@@ -798,8 +852,12 @@
> music_tree_list->activate();
> }
>
>+ if (visualizer_status > 0 && interrupt_visualizer)
>+ InterruptVisualizer();
>+
> if (visualizer_status > 0 && cycle_visualizer)
> CycleVisualizer();
>+
> }
>
> void PlaybackBox::next()
>@@ -818,8 +876,12 @@
> music_tree_list->activate();
> }
>
>+ if (visualizer_status > 0 && interrupt_visualizer)
>+ InterruptVisualizer();
>+
> if (visualizer_status > 0 && cycle_visualizer)
> CycleVisualizer();
>+
> }
>
> void PlaybackBox::nextAuto()
>Index: mythmusic/playbackbox.h
>===================================================================
>RCS file: /var/lib/mythcvs/mythmusic/mythmusic/playbackbox.h,v
>retrieving revision 1.31
>diff -u -r1.31 playbackbox.h
>--- mythmusic/playbackbox.h 26 Aug 2003 15:45:18 -0000 1.31
>+++ mythmusic/playbackbox.h 8 Jun 2004 18:40:06 -0000
>@@ -79,6 +79,7 @@
> void wireUpTheme();
>
> void CycleVisualizer(void);
>+ void InterruptVisualizer(void);
>
> QIODevice *input;
> Output *output;
>@@ -135,6 +136,7 @@
> GenericTree *playlist_tree;
>
> bool cycle_visualizer;
>+ bool interrupt_visualizer;
> bool show_whole_tree;
> bool keyboard_accelerators;
>
>
>
>------------------------------------------------------------------------
>
>Index: mythmusic/globalsettings.cpp
>Index: mythmusic/main.cpp
>===================================================================
>RCS file: /var/lib/mythcvs/mythmusic/mythmusic/main.cpp,v
>retrieving revision 1.49
>diff -u -r1.49 main.cpp
>--- mythmusic/main.cpp 21 Mar 2004 06:22:42 -0000 1.49
>+++ mythmusic/main.cpp 25 Jun 2004 14:37:28 -0000
>@@ -371,8 +371,8 @@
> REG_KEY("Music", "DELETE", "Delete track from playlist", "D");
> REG_KEY("Music", "NEXTTRACK", "Move to the next track", ">,.,Z,End");
> REG_KEY("Music", "PREVTRACK", "Move to the previous track", ",,<,Q,Home");
>- REG_KEY("Music", "FFWD", "Fast forward", "PgDown");
>- REG_KEY("Music", "RWND", "Rewind", "PgUp");
>+ REG_KEY("Music", "FFWD", "Fast forward", "F5");
>+ REG_KEY("Music", "RWND", "Rewind", "F6");
> REG_KEY("Music", "PAUSE", "Pause/Start playback", "P");
> REG_KEY("Music", "STOP", "Stop playback", "O");
> REG_KEY("Music", "VOLUMEDOWN", "Volume down", "[,{,F10");
>Index: mythmusic/playbackbox.cpp
>===================================================================
>RCS file: /var/lib/mythcvs/mythmusic/mythmusic/playbackbox.cpp,v
>retrieving revision 1.72
>diff -u -r1.72 playbackbox.cpp
>--- mythmusic/playbackbox.cpp 27 Apr 2004 09:50:22 -0000 1.72
>+++ mythmusic/playbackbox.cpp 25 Jun 2004 14:37:28 -0000
>@@ -352,6 +363,10 @@
> music_tree_list->moveUp();
> else if (action == "DOWN")
> music_tree_list->moveDown();
>+ else if (action == "PAGEDOWN")
>+ music_tree_list->pageDown();
>+ else if (action == "PAGEUP")
>+ music_tree_list->pageUp();
> else if (action == "LEFT")
> music_tree_list->popUp();
> else if (action == "RIGHT")
>@@ -787,19 +845,27 @@
>
> void PlaybackBox::previous()
> {
>- if (repeatmode == REPEAT_ALL)
>+ // If we are more than 3 seconds into the song, restart the song on a
>+ // previous track action, otherwise, go to previous track
>+ if ( currentTime > 3 )
> {
>- if (music_tree_list->prevActive(true, show_whole_tree))
>- music_tree_list->activate();
>+ music_tree_list->activate();
> }
> else
>- {
>- if (music_tree_list->prevActive(false, show_whole_tree))
>+ if (repeatmode == REPEAT_ALL)
>+ {
>+ if (music_tree_list->prevActive(true, show_whole_tree))
>+ music_tree_list->activate();
>+ }
>+ else
>+ {
>+ if (music_tree_list->prevActive(false, show_whole_tree))
> music_tree_list->activate();
> }
>
> if (visualizer_status > 0 && cycle_visualizer)
> CycleVisualizer();
>+
> }
>
> void PlaybackBox::next()
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>mythtv-dev mailing list
>mythtv-dev at mythtv.org
>http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev
>
>
-------------- next part --------------
Index: mythmusic/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/globalsettings.cpp,v
retrieving revision 1.19
diff -u -r1.19 globalsettings.cpp
--- mythmusic/globalsettings.cpp 22 May 2004 05:45:16 -0000 1.19
+++ mythmusic/globalsettings.cpp 25 Jun 2004 17:48:22 -0000
@@ -383,6 +383,17 @@
};
};
+class VisualInterruptOnSongChange: public CheckBoxSetting, public GlobalSetting {
+public:
+ VisualInterruptOnSongChange():
+ GlobalSetting("VisualInterruptOnSongChange") {
+ setLabel(QObject::tr("Interrupt Visualizer on each song"));
+ setValue(false);
+ setHelpText(QObject::tr("Interrupt the visualizer when the song "
+ "change."));
+ };
+};
+
class VisualScaleWidth: public SpinBoxSetting, public GlobalSetting {
public:
VisualScaleWidth():
@@ -594,6 +605,7 @@
playersettings2->setLabel(QObject::tr("Visualization Settings"));
playersettings2->addChild(new VisualizationMode());
playersettings2->addChild(new VisualCycleOnSongChange());
+ playersettings2->addChild(new VisualInterruptOnSongChange());
playersettings2->addChild(new VisualModeDelay());
playersettings2->addChild(new VisualScaleWidth());
playersettings2->addChild(new VisualScaleHeight());
Index: mythmusic/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/main.cpp,v
retrieving revision 1.49
diff -u -r1.49 main.cpp
--- mythmusic/main.cpp 21 Mar 2004 06:22:42 -0000 1.49
+++ mythmusic/main.cpp 25 Jun 2004 17:48:23 -0000
@@ -371,8 +371,8 @@
REG_KEY("Music", "DELETE", "Delete track from playlist", "D");
REG_KEY("Music", "NEXTTRACK", "Move to the next track", ">,.,Z,End");
REG_KEY("Music", "PREVTRACK", "Move to the previous track", ",,<,Q,Home");
- REG_KEY("Music", "FFWD", "Fast forward", "PgDown");
- REG_KEY("Music", "RWND", "Rewind", "PgUp");
+ REG_KEY("Music", "FFWD", "Fast forward", "F5");
+ REG_KEY("Music", "RWND", "Rewind", "F6");
REG_KEY("Music", "PAUSE", "Pause/Start playback", "P");
REG_KEY("Music", "STOP", "Stop playback", "O");
REG_KEY("Music", "VOLUMEDOWN", "Volume down", "[,{,F10");
Index: mythmusic/playbackbox.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/playbackbox.cpp,v
retrieving revision 1.72
diff -u -r1.72 playbackbox.cpp
--- mythmusic/playbackbox.cpp 27 Apr 2004 09:50:22 -0000 1.72
+++ mythmusic/playbackbox.cpp 25 Jun 2004 17:48:23 -0000
@@ -63,6 +63,8 @@
showrating = gContext->GetNumSetting("MusicShowRatings", 0);
listAsShuffled = gContext->GetNumSetting("ListAsShuffled", 0);
cycle_visualizer = gContext->GetNumSetting("VisualCycleOnSongChange", 0);
+ interrupt_visualizer =
+ gContext->GetNumSetting("VisualInterruptOnSongChange", 0);
// Through the magic of themes, our "GUI" already exists we just need to
// wire up it
@@ -158,10 +160,14 @@
visual_mode_delay = visual_delay.toInt(&delayOK);
if (!delayOK)
visual_mode_delay = 0;
+
+ // Connect the visual mode callback for Visual Interrupt support
+ // regardless of the visual_mode_delay value
+ connect(visual_mode_timer, SIGNAL(timeout()), this, SLOT(visEnable()));
+
if (visual_mode_delay > 0)
{
visual_mode_timer->start(visual_mode_delay * 1000);
- connect(visual_mode_timer, SIGNAL(timeout()), this, SLOT(visEnable()));
}
visualizer_status = 1;
@@ -318,6 +324,11 @@
QString action = actions[i];
if (action == "ESCAPE" || action == "4")
{
+ // In case we enabled visual mode interrupt, ESCAPE
+ // will cancel it
+ if ( !visual_mode_delay )
+ visual_mode_timer->stop();
+
visualizer_status = 1;
QString visual_workaround = mainvisual->getCurrentVisual();
@@ -352,6 +363,10 @@
music_tree_list->moveUp();
else if (action == "DOWN")
music_tree_list->moveDown();
+ else if (action == "PAGEDOWN")
+ music_tree_list->pageDown();
+ else if (action == "PAGEUP")
+ music_tree_list->pageUp();
else if (action == "LEFT")
music_tree_list->popUp();
else if (action == "RIGHT")
@@ -366,8 +381,13 @@
else if (action == "SELECT")
{
music_tree_list->select();
+
+ if (visualizer_status > 0 && interrupt_visualizer)
+ InterruptVisualizer();
+
if (visualizer_status > 0 && cycle_visualizer)
CycleVisualizer();
+
}
else if (action == "REFRESH")
{
@@ -661,6 +681,44 @@
}
+void PlaybackBox::InterruptVisualizer()
+{
+
+ // Only interrupt the visualizer if the user currently has a visualizer active
+ if ( visualizer_status == 2 )
+ {
+ visualizer_status = 1;
+ QString visual_workaround = mainvisual->getCurrentVisual();
+
+ // We may have gotten to full screen by pushing 7
+ // (full screen blank). Or it may be blank because
+ // the user likes "Blank". Figure out what to do ...
+
+ if (visual_workaround == "Blank" && visual_mode != "Blank")
+ visual_workaround = visual_mode;
+
+ mainvisual->setVisual("Blank");
+
+ if (visual_blackhole)
+ mainvisual->setGeometry(visual_blackhole->getScreenArea());
+ else
+ mainvisual->setGeometry(screenwidth + 10,
+ screenheight + 10,
+ 160, 160);
+ setUpdatesEnabled(true);
+
+ mainvisual->setVisual(visual_workaround);
+
+ if (visual_mode_delay > 0)
+ visual_mode_timer->start(visual_mode_delay * 1000);
+ else
+ // If the visualization was full screen, and there is no
+ // visual mode, delay, wait 5 seconds before restarting
+ visual_mode_timer->start(5 * 1000);
+ }
+}
+
+
void PlaybackBox::pause(void)
{
if (output)
@@ -787,19 +845,30 @@
void PlaybackBox::previous()
{
- if (repeatmode == REPEAT_ALL)
+ // If we are more than 3 seconds into the song, restart the song on a
+ // previous track action, otherwise, go to previous track
+ if ( currentTime > 3 )
{
- if (music_tree_list->prevActive(true, show_whole_tree))
- music_tree_list->activate();
+ music_tree_list->activate();
}
else
- {
- if (music_tree_list->prevActive(false, show_whole_tree))
+ if (repeatmode == REPEAT_ALL)
+ {
+ if (music_tree_list->prevActive(true, show_whole_tree))
+ music_tree_list->activate();
+ }
+ else
+ {
+ if (music_tree_list->prevActive(false, show_whole_tree))
music_tree_list->activate();
}
+ if (visualizer_status > 0 && interrupt_visualizer)
+ InterruptVisualizer();
+
if (visualizer_status > 0 && cycle_visualizer)
CycleVisualizer();
+
}
void PlaybackBox::next()
@@ -818,8 +887,12 @@
music_tree_list->activate();
}
+ if (visualizer_status > 0 && interrupt_visualizer)
+ InterruptVisualizer();
+
if (visualizer_status > 0 && cycle_visualizer)
CycleVisualizer();
+
}
void PlaybackBox::nextAuto()
Index: mythmusic/playbackbox.h
===================================================================
RCS file: /var/lib/mythcvs/mythmusic/mythmusic/playbackbox.h,v
retrieving revision 1.31
diff -u -r1.31 playbackbox.h
--- mythmusic/playbackbox.h 26 Aug 2003 15:45:18 -0000 1.31
+++ mythmusic/playbackbox.h 25 Jun 2004 17:48:23 -0000
@@ -79,6 +79,7 @@
void wireUpTheme();
void CycleVisualizer(void);
+ void InterruptVisualizer(void);
QIODevice *input;
Output *output;
@@ -135,6 +136,7 @@
GenericTree *playlist_tree;
bool cycle_visualizer;
+ bool interrupt_visualizer;
bool show_whole_tree;
bool keyboard_accelerators;
More information about the mythtv-dev
mailing list