| 1 |
/* |
| 2 |
* Copyright (C) 2023 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "SlideShowDelegator.h" |
| 10 |
|
| 11 |
void CSlideShowDelegator::SetDelegate(ISlideShowDelegate* delegate) |
| 12 |
{ |
| 13 |
m_delegate = delegate; |
| 14 |
} |
| 15 |
|
| 16 |
void CSlideShowDelegator::ResetDelegate() |
| 17 |
{ |
| 18 |
m_delegate = nullptr; |
| 19 |
} |
| 20 |
|
| 21 |
void CSlideShowDelegator::Add(const CFileItem* picture) |
| 22 |
{ |
| 23 |
if (m_delegate) |
| 24 |
{ |
| 25 |
m_delegate->Add(picture); |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
bool CSlideShowDelegator::IsPlaying() const |
| 30 |
{ |
| 31 |
if (m_delegate) |
| 32 |
{ |
| 33 |
return m_delegate->IsPlaying(); |
| 34 |
} |
| 35 |
return false; |
| 36 |
} |
| 37 |
|
| 38 |
void CSlideShowDelegator::Select(const std::string& picture) |
| 39 |
{ |
| 40 |
if (m_delegate) |
| 41 |
{ |
| 42 |
m_delegate->Select(picture); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
void CSlideShowDelegator::GetSlideShowContents(CFileItemList& list) |
| 47 |
{ |
| 48 |
if (m_delegate) |
| 49 |
{ |
| 50 |
m_delegate->GetSlideShowContents(list); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
std::shared_ptr<const CFileItem> CSlideShowDelegator::GetCurrentSlide() |
| 55 |
{ |
| 56 |
if (m_delegate) |
| 57 |
{ |
| 58 |
return m_delegate->GetCurrentSlide(); |
| 59 |
} |
| 60 |
return nullptr; |
| 61 |
} |
| 62 |
|
| 63 |
void CSlideShowDelegator::StartSlideShow() |
| 64 |
{ |
| 65 |
if (m_delegate) |
| 66 |
{ |
| 67 |
m_delegate->StartSlideShow(); |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
void CSlideShowDelegator::PlayPicture() |
| 72 |
{ |
| 73 |
if (m_delegate) |
| 74 |
{ |
| 75 |
m_delegate->PlayPicture(); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
bool CSlideShowDelegator::InSlideShow() const |
| 80 |
{ |
| 81 |
if (m_delegate) |
| 82 |
{ |
| 83 |
return m_delegate->InSlideShow(); |
| 84 |
} |
| 85 |
return false; |
| 86 |
} |
| 87 |
|
| 88 |
int CSlideShowDelegator::NumSlides() const |
| 89 |
{ |
| 90 |
if (m_delegate) |
| 91 |
{ |
| 92 |
return m_delegate->NumSlides(); |
| 93 |
} |
| 94 |
return -1; |
| 95 |
} |
| 96 |
|
| 97 |
int CSlideShowDelegator::CurrentSlide() const |
| 98 |
{ |
| 99 |
if (m_delegate) |
| 100 |
{ |
| 101 |
return m_delegate->CurrentSlide(); |
| 102 |
} |
| 103 |
return -1; |
| 104 |
} |
| 105 |
|
| 106 |
bool CSlideShowDelegator::IsPaused() const |
| 107 |
{ |
| 108 |
if (m_delegate) |
| 109 |
{ |
| 110 |
return m_delegate->IsPaused(); |
| 111 |
} |
| 112 |
return false; |
| 113 |
} |
| 114 |
|
| 115 |
bool CSlideShowDelegator::IsShuffled() const |
| 116 |
{ |
| 117 |
if (m_delegate) |
| 118 |
{ |
| 119 |
return m_delegate->IsShuffled(); |
| 120 |
} |
| 121 |
return false; |
| 122 |
} |
| 123 |
|
| 124 |
void CSlideShowDelegator::Reset() |
| 125 |
{ |
| 126 |
if (m_delegate) |
| 127 |
{ |
| 128 |
m_delegate->Reset(); |
| 129 |
} |
| 130 |
} |
| 131 |
|
| 132 |
void CSlideShowDelegator::Shuffle() |
| 133 |
{ |
| 134 |
if (m_delegate) |
| 135 |
{ |
| 136 |
m_delegate->Shuffle(); |
| 137 |
} |
| 138 |
} |
| 139 |
|
| 140 |
int CSlideShowDelegator::GetDirection() const |
| 141 |
{ |
| 142 |
if (m_delegate) |
| 143 |
{ |
| 144 |
return m_delegate->GetDirection(); |
| 145 |
} |
| 146 |
return -1; |
| 147 |
} |
| 148 |
|
| 149 |
void CSlideShowDelegator::RunSlideShow(const std::string& strPath, |
| 150 |
bool bRecursive, |
| 151 |
bool bRandom, |
| 152 |
bool bNotRandom, |
| 153 |
const std::string& beginSlidePath, |
| 154 |
bool startSlideShow, |
| 155 |
SortBy method, |
| 156 |
SortOrder order, |
| 157 |
SortAttribute sortAttributes, |
| 158 |
const std::string& strExtensions) |
| 159 |
{ |
| 160 |
if (m_delegate) |
| 161 |
{ |
| 162 |
m_delegate->RunSlideShow(strPath, bRecursive, bRandom, bNotRandom, beginSlidePath, |
| 163 |
startSlideShow, method, order, sortAttributes, strExtensions); |
| 164 |
} |
| 165 |
} |
| 166 |
|
| 167 |
void CSlideShowDelegator::AddFromPath(const std::string& strPath, |
| 168 |
bool bRecursive, |
| 169 |
SortBy method, |
| 170 |
SortOrder order, |
| 171 |
SortAttribute sortAttributes, |
| 172 |
const std::string& strExtensions) |
| 173 |
{ |
| 174 |
if (m_delegate) |
| 175 |
{ |
| 176 |
m_delegate->AddFromPath(strPath, bRecursive, method, order, sortAttributes, strExtensions); |
| 177 |
} |
| 178 |
} |