Author: stippi Date: 2010-09-07 16:36:32 +0200 (Tue, 07 Sep 2010) New Revision: 38570 Changeset: http://dev.haiku-os.org/changeset/38570 Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/MainWin.h haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp Log: First implementation at the "loop by default" settings. To make it better, there should be a looping mode per window, and the settings should serve only as defaults. Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2010-09-07 14:18:09 UTC (rev 38569) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2010-09-07 14:36:32 UTC (rev 38570) @@ -604,9 +604,19 @@ bool hadNext = fPlaylist->SetCurrentItemIndex( fPlaylist->CurrentItemIndex() + 1); if (!hadNext) { + // Reached end of playlist + // Handle "quit when done" settings if ((fHasVideo && fCloseWhenDonePlayingMovie) || (!fHasVideo && fCloseWhenDonePlayingSound)) PostMessage(B_QUIT_REQUESTED); + // Handle "loop by default" settings + if ((fHasVideo && fLoopMovies) + || (!fHasVideo && fLoopSounds)) { + if (fPlaylist->CountItems() > 1) + fPlaylist->SetCurrentItemIndex(0); + else + fController->Play(); + } } break; } @@ -2287,6 +2297,8 @@ fCloseWhenDonePlayingMovie = settings.closeWhenDonePlayingMovie; fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound; + fLoopMovies = settings.loopMovie; + fLoopSounds = settings.loopSound; } Modified: haiku/trunk/src/apps/mediaplayer/MainWin.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.h 2010-09-07 14:18:09 UTC (rev 38569) +++ haiku/trunk/src/apps/mediaplayer/MainWin.h 2010-09-07 14:36:32 UTC (rev 38570) @@ -186,6 +186,8 @@ ListenerAdapter fGlobalSettingsListener; bool fCloseWhenDonePlayingMovie; bool fCloseWhenDonePlayingSound; + bool fLoopMovies; + bool fLoopSounds; bigtime_t fInitialSeekPosition; static int sNoVideoWidth; Modified: haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp 2010-09-07 14:18:09 UTC (rev 38569) +++ haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp 2010-09-07 14:36:32 UTC (rev 38570) @@ -1,9 +1,10 @@ /* - * Copyright 2008-2009, Haiku, Inc. All rights reserved. + * Copyright 2008-2010, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Fredrik Modéen <fredrik@xxxxxxxxx> + * Stephan Aßmus <superstippi@xxxxxx> */ #include "SettingsWindow.h" @@ -261,10 +262,6 @@ view->AddChild(bbox); AddChild(view); #endif - - // disable currently unsupported features - fLoopMoviesCB->SetEnabled(false); - fLoopSoundsCB->SetEnabled(false); }