From c5f8afb9447be154c7b58283f910dc356a121070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 7 Sep 2010 14:36:32 +0000 Subject: [PATCH] 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. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38570 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/MainWin.cpp | 12 ++++++++++++ src/apps/mediaplayer/MainWin.h | 2 ++ src/apps/mediaplayer/settings/SettingsWindow.cpp | 7 ++----- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index bd8969bed3..a0719eb3fd 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -604,9 +604,19 @@ MainWin::MessageReceived(BMessage* msg) 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 @@ MainWin::_AdoptGlobalSettings() fCloseWhenDonePlayingMovie = settings.closeWhenDonePlayingMovie; fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound; + fLoopMovies = settings.loopMovie; + fLoopSounds = settings.loopSound; } diff --git a/src/apps/mediaplayer/MainWin.h b/src/apps/mediaplayer/MainWin.h index 8c8540cbdd..081eaeaf57 100644 --- a/src/apps/mediaplayer/MainWin.h +++ b/src/apps/mediaplayer/MainWin.h @@ -186,6 +186,8 @@ private: ListenerAdapter fGlobalSettingsListener; bool fCloseWhenDonePlayingMovie; bool fCloseWhenDonePlayingSound; + bool fLoopMovies; + bool fLoopSounds; bigtime_t fInitialSeekPosition; static int sNoVideoWidth; diff --git a/src/apps/mediaplayer/settings/SettingsWindow.cpp b/src/apps/mediaplayer/settings/SettingsWindow.cpp index 28d9e3e345..c562edc3c0 100644 --- a/src/apps/mediaplayer/settings/SettingsWindow.cpp +++ b/src/apps/mediaplayer/settings/SettingsWindow.cpp @@ -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 + * Stephan Aßmus */ #include "SettingsWindow.h" @@ -261,10 +262,6 @@ SettingsWindow::SettingsWindow(BRect frame) view->AddChild(bbox); AddChild(view); #endif - - // disable currently unsupported features - fLoopMoviesCB->SetEnabled(false); - fLoopSoundsCB->SetEnabled(false); }