aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorulion <ulion2002@gmail.com>2013-04-04 20:54:36 +0800
committerulion <ulion2002@gmail.com>2013-04-05 07:08:34 +0800
commitcc67a07f1b9cb9cbe871f52d12194d38c401329d (patch)
treee0668b33844ea32d6f812db2868fa3d92e937bae
parent38d577547f042ac0296714729b7ed21226731d12 (diff)
Enhanced builtin func SlideShow() support pause and set beginslide path
-rw-r--r--xbmc/interfaces/Builtins.cpp29
-rw-r--r--xbmc/pictures/GUIWindowSlideShow.cpp29
-rw-r--r--xbmc/pictures/GUIWindowSlideShow.h3
3 files changed, 47 insertions, 14 deletions
diff --git a/xbmc/interfaces/Builtins.cpp b/xbmc/interfaces/Builtins.cpp
index 06bcbb0de3..599e66ddf1 100644
--- a/xbmc/interfaces/Builtins.cpp
+++ b/xbmc/interfaces/Builtins.cpp
@@ -639,24 +639,37 @@ int CBuiltins::Execute(const CStdString& execString)
CLog::Log(LOGERROR, "XBMC.SlideShow called with empty parameter");
return -2;
}
+ std::string beginSlidePath;
// leave RecursiveSlideShow command as-is
unsigned int flags = 0;
if (execute.Equals("RecursiveSlideShow"))
flags |= 1;
- // SlideShow(dir[,recursive][,[not]random])
+ // SlideShow(dir[,recursive][,[not]random][,pause][,beginslide="/path/to/start/slide.jpg"])
+ // the beginslide value need be escaped (for '"' or '\' in it, by backslash)
+ // and then quoted, or not. See CUtil::SplitParams()
else
{
- if ((params.size() > 1 && params[1] == "recursive") || (params.size() > 2 && params[2] == "recursive"))
- flags |= 1;
- if ((params.size() > 1 && params[1] == "random") || (params.size() > 2 && params[2] == "random"))
- flags |= 2;
- if ((params.size() > 1 && params[1] == "notrandom") || (params.size() > 2 && params[2] == "notrandom"))
- flags |= 4;
+ for (unsigned int i = 1 ; i < params.size() ; i++)
+ {
+ if (params[i].Equals("recursive"))
+ flags |= 1;
+ else if (params[i].Equals("random")) // set fullscreen or windowed
+ flags |= 2;
+ else if (params[i].Equals("notrandom"))
+ flags |= 4;
+ else if (params[i].Equals("pause"))
+ flags |= 8;
+ else if (params[i].Left(11).Equals("beginslide="))
+ beginSlidePath = params[i].Mid(11);
+ }
}
CGUIMessage msg(GUI_MSG_START_SLIDESHOW, 0, 0, flags);
- msg.SetStringParam(params[0]);
+ vector<CStdString> strParams;
+ strParams.push_back(params[0]);
+ strParams.push_back(beginSlidePath);
+ msg.SetStringParams(strParams);
CGUIWindow *pWindow = g_windowManager.GetWindow(WINDOW_SLIDESHOW);
if (pWindow) pWindow->OnMessage(msg);
}
diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp
index 77fdc34490..7ab81aee51 100644
--- a/xbmc/pictures/GUIWindowSlideShow.cpp
+++ b/xbmc/pictures/GUIWindowSlideShow.cpp
@@ -864,10 +864,12 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)
{
CStdString strFolder = message.GetStringParam();
unsigned int iParams = message.GetParam1();
+ std::string beginSlidePath = message.GetStringParam(1);
//decode params
bool bRecursive = false;
bool bRandom = false;
bool bNotRandom = false;
+ bool bPause = false;
if (iParams > 0)
{
if ((iParams & 1) == 1)
@@ -876,8 +878,10 @@ bool CGUIWindowSlideShow::OnMessage(CGUIMessage& message)
bRandom = true;
if ((iParams & 4) == 4)
bNotRandom = true;
+ if ((iParams & 8) == 8)
+ bPause = true;
}
- RunSlideShow(strFolder, bRecursive, bRandom, bNotRandom);
+ RunSlideShow(strFolder, bRecursive, bRandom, bNotRandom, SORT_METHOD_LABEL, SortOrderAscending, "", beginSlidePath, !bPause);
}
break;
@@ -1091,7 +1095,8 @@ void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath,
void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath,
bool bRecursive /* = false */, bool bRandom /* = false */,
bool bNotRandom /* = false */, SORT_METHOD method /* = SORT_METHOD_LABEL */,
- SortOrder order /* = SortOrderAscending */, const CStdString &strExtensions)
+ SortOrder order /* = SortOrderAscending */, const CStdString &strExtensions /* = "" */,
+ const CStdString &beginSlidePath /* = "" */, bool startSlideShow /* = true */)
{
// stop any video
if (g_application.IsPlayingVideo())
@@ -1099,6 +1104,9 @@ void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath,
AddFromPath(strPath, bRecursive, method, order, strExtensions);
+ if (!NumSlides())
+ return;
+
// mutually exclusive options
// if both are set, clear both and use the gui setting
if (bRandom && bNotRandom)
@@ -1108,9 +1116,20 @@ void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath,
if ((!bNotRandom && g_guiSettings.GetBool("slideshow.shuffle")) || bRandom)
Shuffle();
- StartSlideShow();
- if (NumSlides())
- g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
+ if (!beginSlidePath.IsEmpty())
+ Select(beginSlidePath);
+
+ if (startSlideShow)
+ StartSlideShow();
+ else
+ {
+ CVariant param;
+ param["player"]["speed"] = 0;
+ param["player"]["playerid"] = PLAYLIST_PICTURE;
+ ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", GetCurrentSlide(), param);
+ }
+
+ g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
}
void CGUIWindowSlideShow::AddItems(const CStdString &strPath, path_set *recursivePaths, SORT_METHOD method, SortOrder order)
diff --git a/xbmc/pictures/GUIWindowSlideShow.h b/xbmc/pictures/GUIWindowSlideShow.h
index d8fa7978e7..02c652083a 100644
--- a/xbmc/pictures/GUIWindowSlideShow.h
+++ b/xbmc/pictures/GUIWindowSlideShow.h
@@ -76,7 +76,8 @@ public:
void RunSlideShow(const CStdString &strPath, bool bRecursive = false,
bool bRandom = false, bool bNotRandom = false,
SORT_METHOD method = SORT_METHOD_LABEL,
- SortOrder order = SortOrderAscending, const CStdString &strExtensions="");
+ SortOrder order = SortOrderAscending, const CStdString &strExtensions="",
+ const CStdString &beginSlidePath="", bool startSlideShow = true);
void AddFromPath(const CStdString &strPath, bool bRecursive,
SORT_METHOD method=SORT_METHOD_LABEL,
SortOrder order = SortOrderAscending, const CStdString &strExtensions="");