Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #P XBMC
- Index: xbmc/GUIWindowSlideShow.cpp
- ===================================================================
- --- xbmc/GUIWindowSlideShow.cpp (revision 33608)
- +++ xbmc/GUIWindowSlideShow.cpp (working copy)
- @@ -42,8 +42,11 @@
- #include "utils/SingleLock.h"
- #include "utils/log.h"
- #include "utils/TimeUtils.h"
- +#include "PlayList.h"
- using namespace XFILE;
- +using namespace PLAYLIST;
- +
- #define MAX_ZOOM_FACTOR 10
- #define MAX_PICTURE_SIZE 2048*2048
- @@ -119,8 +122,9 @@
- }
- }
- }
- - CLog::Log(LOGDEBUG, "Time for loading %u images: %u ms, average %u ms",
- - count, totalTime, totalTime / count);
- + if (count > 0)
- + CLog::Log(LOGDEBUG, "Time for loading %u images: %u ms, average %u ms",
- + count, totalTime, totalTime / count);
- }
- void CBackgroundPicLoader::LoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, const int maxWidth, const int maxHeight)
- @@ -140,7 +144,7 @@
- m_pBackgroundLoader = NULL;
- m_slides = new CFileItemList;
- m_Resolution = RES_INVALID;
- - Reset();
- + Reset();
- }
- CGUIWindowSlideShow::~CGUIWindowSlideShow(void)
- @@ -160,6 +164,7 @@
- g_infoManager.SetShowCodec(false);
- m_bSlideShow = false;
- m_bPause = false;
- + m_bPlayingVideo = false;
- m_bErrorMessage = false;
- m_bReloadImage = false;
- m_bScreensaver = false;
- @@ -173,6 +178,7 @@
- CSingleLock lock(m_slideSection);
- m_slides->Clear();
- m_Resolution = g_graphicsContext.GetVideoResolution();
- + m_strExtensions = g_settings.m_pictureExtensions;
- }
- void CGUIWindowSlideShow::FreeResources()
- @@ -209,7 +215,6 @@
- m_iNextSlide = m_iCurrentSlide + 1;
- if (m_iNextSlide >= m_slides->Size())
- m_iNextSlide = 0;
- -
- m_bLoadNextPic = true;
- }
- @@ -290,7 +295,7 @@
- m_pBackgroundLoader->Create(this);
- }
- - bool bSlideShow = m_bSlideShow && !m_bPause;
- + bool bSlideShow = m_bSlideShow && !m_bPause && !m_bPlayingVideo;
- if (m_bErrorMessage)
- { // we have an error when loading either the current or next picture
- @@ -341,8 +346,9 @@
- GetCheckedSize((float)g_settings.m_ResInfo[m_Resolution].iWidth * zoomamount[m_iZoomFactor - 1],
- (float)g_settings.m_ResInfo[m_Resolution].iHeight * zoomamount[m_iZoomFactor - 1],
- maxWidth, maxHeight);
- - m_pBackgroundLoader->LoadPic(m_iCurrentPic, m_iCurrentSlide, m_slides->Get(m_iCurrentSlide)->m_strPath, maxWidth, maxHeight);
- - }
- + if (!m_slides->Get(m_iCurrentSlide)->IsVideo())
- + m_pBackgroundLoader->LoadPic(m_iCurrentPic, m_iCurrentSlide, m_slides->Get(m_iCurrentSlide)->m_strPath, maxWidth, maxHeight);
- + }
- // check if we should discard an already loaded next slide
- if (m_bLoadNextPic && m_Image[1 - m_iCurrentPic].IsLoaded() && m_Image[1 - m_iCurrentPic].SlideNumber() != m_iNextSlide)
- @@ -384,7 +390,8 @@
- GetCheckedSize((float)g_settings.m_ResInfo[m_Resolution].iWidth * zoomamount[m_iZoomFactor - 1],
- (float)g_settings.m_ResInfo[m_Resolution].iHeight * zoomamount[m_iZoomFactor - 1],
- maxWidth, maxHeight);
- - m_pBackgroundLoader->LoadPic(1 - m_iCurrentPic, m_iNextSlide, m_slides->Get(m_iNextSlide)->m_strPath, maxWidth, maxHeight);
- + if (!m_slides->Get(m_iNextSlide)->IsVideo())
- + m_pBackgroundLoader->LoadPic(1 - m_iCurrentPic, m_iNextSlide, m_slides->Get(m_iNextSlide)->m_strPath, maxWidth, maxHeight);
- }
- }
- @@ -395,7 +402,25 @@
- m_Image[m_iCurrentPic].Pause(m_bPause);
- m_Image[m_iCurrentPic].Render();
- }
- +
- + if (m_slides->Get(m_iCurrentSlide)->IsVideo() && bSlideShow)
- + {
- + CLog::Log(LOGDEBUG, "Playing slide %s as video", m_slides->Get(m_iCurrentSlide)->m_strPath.c_str());
- + m_bPlayingVideo = true;
- + g_playlistPlayer.Reset();
- + g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
- + CPlayList& playlist = g_playlistPlayer.GetPlaylist(PLAYLIST_VIDEO);
- + playlist.Clear();
- + playlist.Add(m_slides->Get(m_iCurrentSlide));
- + // play movie...
- + g_playlistPlayer.Play(0);
- + m_iCurrentSlide = m_iNextSlide;
- + m_iNextSlide++;
- + if (m_iNextSlide >= m_slides->Size())
- + m_iNextSlide = 0;
- + }
- +
- // Check if we should be transistioning immediately
- if (m_bLoadNextPic)
- {
- @@ -426,7 +451,6 @@
- }
- }
- }
- -
- // check if we should swap images now
- if (m_Image[m_iCurrentPic].IsFinished())
- {
- @@ -645,6 +669,24 @@
- RunSlideShow(strFolder, bRecursive, bRandom, bNotRandom);
- }
- break;
- + case GUI_MSG_PLAYLISTPLAYER_STOPPED:
- + {
- + m_bPlayingVideo = false;
- + if (m_bSlideShow)
- + g_windowManager.ActivateWindow(WINDOW_SLIDESHOW);
- + }
- + break;
- + case GUI_MSG_PLAYBACK_STARTED:
- + {
- + g_windowManager.ActivateWindow(WINDOW_FULLSCREEN_VIDEO);
- + }
- + break;
- + case GUI_MSG_PLAYBACK_STOPPED:
- + {
- + m_bSlideShow = false;
- + g_windowManager.PreviousWindow();
- + }
- + break;
- }
- return CGUIWindow::OnMessage(message);
- }
- @@ -778,7 +820,12 @@
- return m_iCurrentSlide + 1;
- }
- -void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath,
- +void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath, bool bRecursive, SORT_METHOD method, SORT_ORDER order)
- +{
- + AddFromPath(strPath, g_settings.m_pictureExtensions, bRecursive, method, order);
- +}
- +
- +void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath, const CStdString &strExtensions,
- bool bRecursive,
- SORT_METHOD method, SORT_ORDER order)
- {
- @@ -786,6 +833,7 @@
- {
- // reset the slideshow
- Reset();
- + m_strExtensions = strExtensions;
- if (bRecursive)
- {
- path_set recursivePaths;
- @@ -796,13 +844,20 @@
- }
- }
- -void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath, bool bRecursive /* = false */, bool bRandom /* = false */, bool bNotRandom /* = false */, SORT_METHOD method /* = SORT_METHOD_LABEL */, SORT_ORDER order /* = SORT_ORDER_ASC */)
- +void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath,
- + bool bRecursive /* = false */, bool bRandom /* = false */,
- + bool bNotRandom /* = false */, SORT_METHOD method /* = SORT_METHOD_LABEL */,
- + SORT_ORDER order /* = SORT_ORDER_ASC */)
- +{
- + RunSlideShow(strPath, g_settings.m_pictureExtensions, bRecursive, bRandom, bNotRandom, method, order);
- +}
- +void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath, const CStdString &strExtensions, bool bRecursive /* = false */, bool bRandom /* = false */, bool bNotRandom /* = false */, SORT_METHOD method /* = SORT_METHOD_LABEL */, SORT_ORDER order /* = SORT_ORDER_ASC */)
- {
- // stop any video
- if (g_application.IsPlayingVideo())
- g_application.StopPlaying();
- - AddFromPath(strPath, bRecursive, method, order);
- + AddFromPath(strPath, strExtensions, bRecursive, method, order);
- // mutually exclusive options
- // if both are set, clear both and use the gui setting
- @@ -832,7 +887,7 @@
- // fetch directory and sort accordingly
- CFileItemList items;
- - if (!CDirectory::GetDirectory(strPath, items, g_settings.m_pictureExtensions,false,false,DIR_CACHE_ONCE,true,true))
- + if (!CDirectory::GetDirectory(strPath, items, m_strExtensions,false,false,DIR_CACHE_ONCE,true,true))
- return;
- items.Sort(method, order);
- Index: xbmc/GUIWindowSlideShow.h
- ===================================================================
- --- xbmc/GUIWindowSlideShow.h (revision 33608)
- +++ xbmc/GUIWindowSlideShow.h (working copy)
- @@ -71,6 +71,10 @@
- void Select(const CStdString& strPicture);
- const CFileItemList &GetSlideShowContents();
- const CFileItemPtr GetCurrentSlide();
- + void RunSlideShow(const CStdString &strPath, const CStdString &strExtensions, bool bRecursive = false,
- + bool bRandom = false, bool bNotRandom = false,
- + SORT_METHOD method = SORT_METHOD_LABEL,
- + SORT_ORDER order = SORT_ORDER_ASC);
- void RunSlideShow(const CStdString &strPath, bool bRecursive = false,
- bool bRandom = false, bool bNotRandom = false,
- SORT_METHOD method = SORT_METHOD_LABEL,
- @@ -78,6 +82,9 @@
- void AddFromPath(const CStdString &strPath, bool bRecursive,
- SORT_METHOD method=SORT_METHOD_LABEL,
- SORT_ORDER order=SORT_ORDER_ASC);
- + void AddFromPath(const CStdString &strPath, const CStdString &strExtensions, bool bRecursive,
- + SORT_METHOD method=SORT_METHOD_LABEL,
- + SORT_ORDER order=SORT_ORDER_ASC);
- void StartSlideShow(bool screensaver=false);
- bool InSlideShow() const;
- virtual bool OnMessage(CGUIMessage& message);
- @@ -88,6 +95,7 @@
- int NumSlides() const;
- int CurrentSlide() const;
- void Shuffle();
- + void setExtensions(CStdString strExtensions);
- private:
- typedef std::set<CStdString> path_set; // set to track which paths we're adding
- void AddItems(const CStdString &strPath, path_set *recursivePaths,
- @@ -108,6 +116,7 @@
- bool m_bSlideShow;
- bool m_bScreensaver;
- bool m_bPause;
- + bool m_bPlayingVideo;
- bool m_bErrorMessage;
- CFileItemList* m_slides;
- @@ -123,4 +132,5 @@
- DllImageLib m_ImageLib;
- RESOLUTION m_Resolution;
- CCriticalSection m_slideSection;
- + CStdString m_strExtensions;
- };
- Index: xbmc/GUIWindowPictures.cpp
- ===================================================================
- --- xbmc/GUIWindowPictures.cpp (revision 33608)
- +++ xbmc/GUIWindowPictures.cpp (working copy)
- @@ -342,10 +342,26 @@
- {
- CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
- if (pSlideShow)
- - pSlideShow->RunSlideShow(strPicture, true,
- - g_guiSettings.GetBool("slideshow.shuffle"),false,
- - m_guiState->GetSortMethod(),
- - m_guiState->GetSortOrder());
- + {
- + CStdString strExtensions = "";
- + CFileItemList items;
- + CGUIViewState* viewState=CGUIViewState::GetViewState(GetID(), items);
- + if (viewState)
- + {
- + strExtensions = viewState->GetExtensions();
- + delete viewState;
- + }
- + if (strExtensions.Equals("", false))
- + pSlideShow->RunSlideShow(strPicture, true,
- + g_guiSettings.GetBool("slideshow.shuffle"),false,
- + m_guiState->GetSortMethod(),
- + m_guiState->GetSortOrder());
- + else
- + pSlideShow->RunSlideShow(strPicture, strExtensions, true,
- + g_guiSettings.GetBool("slideshow.shuffle"),false,
- + m_guiState->GetSortMethod(),
- + m_guiState->GetSortOrder());
- + }
- }
- void CGUIWindowPictures::OnSlideShowRecursive()
- @@ -363,9 +379,24 @@
- {
- CGUIWindowSlideShow *pSlideShow = (CGUIWindowSlideShow *)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
- if (pSlideShow)
- - pSlideShow->RunSlideShow(strPicture, false ,false, false,
- - m_guiState->GetSortMethod(),
- - m_guiState->GetSortOrder());
- + {
- + CStdString strExtensions = "";
- + CFileItemList items;
- + CGUIViewState* viewState=CGUIViewState::GetViewState(GetID(), items);
- + if (viewState)
- + {
- + strExtensions = viewState->GetExtensions();
- + delete viewState;
- + }
- + if (strExtensions.Equals("", false))
- + pSlideShow->RunSlideShow(strPicture, false ,false, false,
- + m_guiState->GetSortMethod(),
- + m_guiState->GetSortOrder());
- + else
- + pSlideShow->RunSlideShow(strPicture, strExtensions, false ,false, false,
- + m_guiState->GetSortMethod(),
- + m_guiState->GetSortOrder());
- + }
- }
- void CGUIWindowPictures::OnRegenerateThumbs()
- @@ -495,7 +526,6 @@
- return;
- if (g_application.IsPlayingVideo())
- g_application.StopPlaying();
- -
- // convert playlist items into slideshow items
- pSlideShow->Reset();
- for (int i = 0; i < (int)playlist.size(); ++i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement