Skip to content

Commit

Permalink
Merge pull request #25196 from notspiff/move_playlist_namespace_to_kodi
Browse files Browse the repository at this point in the history
changed: rename PLAYLIST namespace to KODI::PLAYLIST
  • Loading branch information
notspiff committed May 12, 2024
2 parents a43c9b9 + 452432c commit b0d72e8
Show file tree
Hide file tree
Showing 75 changed files with 344 additions and 237 deletions.
4 changes: 3 additions & 1 deletion xbmc/FileItemListModification.cpp
Expand Up @@ -12,9 +12,11 @@
#include "playlists/SmartPlaylistFileItemListModifier.h"
#include "video/windows/VideoFileItemListModifier.h"

using namespace KODI;

CFileItemListModification::CFileItemListModification()
{
m_modifiers.insert(new CSmartPlaylistFileItemListModifier());
m_modifiers.insert(new PLAYLIST::CSmartPlaylistFileItemListModifier());
m_modifiers.insert(new CMusicFileItemListModifier());
m_modifiers.insert(new CVideoFileItemListModifier());
}
Expand Down
1 change: 1 addition & 0 deletions xbmc/GUIInfoManager.cpp
Expand Up @@ -41,6 +41,7 @@
#include <memory>
#include <mutex>

using namespace KODI;
using namespace KODI::GUILIB;
using namespace KODI::GUILIB::GUIINFO;
using namespace INFO;
Expand Down
3 changes: 2 additions & 1 deletion xbmc/PartyModeManager.cpp
Expand Up @@ -35,6 +35,7 @@

#include <algorithm>

using namespace KODI;
using namespace KODI::MESSAGING;

#define QUEUE_DEPTH 10
Expand All @@ -49,7 +50,7 @@ CPartyModeManager::CPartyModeManager(void)
bool CPartyModeManager::Enable(PartyModeContext context /*= PARTYMODECONTEXT_MUSIC*/, const std::string& strXspPath /*= ""*/)
{
// Filter using our PartyMode xml file
CSmartPlaylist playlist;
PLAYLIST::CSmartPlaylist playlist;
std::string partyModePath;
bool playlistLoaded;

Expand Down
6 changes: 3 additions & 3 deletions xbmc/PartyModeManager.h
Expand Up @@ -15,7 +15,7 @@

class CFileItem; typedef std::shared_ptr<CFileItem> CFileItemPtr;
class CFileItemList;
namespace PLAYLIST
namespace KODI::PLAYLIST
{
enum class Id;
class CPlayList;
Expand All @@ -37,7 +37,7 @@ class CPartyModeManager final
void Disable();
void Play(int iPos);
void OnSongChange(bool bUpdatePlayed = false);
void AddUserSongs(PLAYLIST::CPlayList& tempList, bool bPlay = false);
void AddUserSongs(KODI::PLAYLIST::CPlayList& tempList, bool bPlay = false);
void AddUserSongs(CFileItemList& tempList, bool bPlay = false);
bool IsEnabled(PartyModeContext context=PARTYMODECONTEXT_UNKNOWN) const;
int GetSongsPlayed();
Expand All @@ -59,7 +59,7 @@ class CPartyModeManager final
void ClearState();
void UpdateStats();
void Announce();
PLAYLIST::Id GetPlaylistId() const;
KODI::PLAYLIST::Id GetPlaylistId() const;

// state
bool m_bEnabled;
Expand Down
7 changes: 5 additions & 2 deletions xbmc/PlayListPlayer.cpp
Expand Up @@ -41,11 +41,12 @@
#include "video/VideoDatabase.h"
#include "video/VideoFileItemClassify.h"

using namespace PLAYLIST;
using namespace KODI;
using namespace KODI::MESSAGING;
using namespace KODI::VIDEO;

namespace KODI::PLAYLIST
{

CPlayListPlayer::CPlayListPlayer(void)
{
m_PlaylistMusic = new CPlayList(Id::TYPE_MUSIC);
Expand Down Expand Up @@ -1081,3 +1082,5 @@ void PLAYLIST::CPlayListPlayer::OnApplicationMessage(KODI::MESSAGING::ThreadMess
break;
}
}

} // namespace KODI::PLAYLIST
63 changes: 32 additions & 31 deletions xbmc/PlayListPlayer.h
Expand Up @@ -22,7 +22,7 @@ class CFileItemList;

class CVariant;

namespace PLAYLIST
namespace KODI::PLAYLIST
{
class CPlayList;

Expand Down Expand Up @@ -93,24 +93,24 @@ class CPlayListPlayer : public IMsgTargetCallback,
int GetNextItemIdx(int offset) const;

/*! \brief Set the active playlist
\param id Values can be PLAYLIST::TYPE_NONE, PLAYLIST::TYPE_MUSIC or PLAYLIST::TYPE_VIDEO
\param id Id of playlist
\sa GetCurrentPlaylist
*/
void SetCurrentPlaylist(PLAYLIST::Id playlistId);
void SetCurrentPlaylist(Id playlistId);

/*! \brief Get the currently active playlist
\return PLAYLIST::TYPE_NONE, PLAYLIST::TYPE_MUSIC or PLAYLIST::TYPE_VIDEO
\return Id of playlist
\sa SetCurrentPlaylist, GetPlaylist
*/
PLAYLIST::Id GetCurrentPlaylist() const;
Id GetCurrentPlaylist() const;

/*! \brief Get a particular playlist object
\param id Values can be PLAYLIST::TYPE_MUSIC or PLAYLIST::TYPE_VIDEO
\param id Id of playlist
\return A reference to the CPlayList object.
\sa GetCurrentPlaylist
*/
CPlayList& GetPlaylist(PLAYLIST::Id playlistId);
const CPlayList& GetPlaylist(PLAYLIST::Id playlistId) const;
CPlayList& GetPlaylist(Id playlistId);
const CPlayList& GetPlaylist(Id playlistId) const;

/*! \brief Removes any item from all playlists located on a removable share
\return Number of items removed from PLAYLIST::TYPE_MUSIC and PLAYLIST::TYPE_VIDEO
Expand All @@ -122,7 +122,7 @@ class CPlayListPlayer : public IMsgTargetCallback,
*/
void Reset();

void ClearPlaylist(PLAYLIST::Id playlistId);
void ClearPlaylist(Id playlistId);
void Clear();

/*! \brief Set shuffle state of a playlist.
Expand All @@ -133,15 +133,15 @@ class CPlayListPlayer : public IMsgTargetCallback,
\param notify notify the user with a Toast notification (defaults to false)
\sa IsShuffled
*/
void SetShuffle(PLAYLIST::Id playlistId, bool shuffle, bool notify = false);
void SetShuffle(Id playlistId, bool shuffle, bool notify = false);

/*! \brief Return whether a playlist is shuffled.
If partymode is enabled, this always returns false.
\param playlist the playlist to query for shuffle state, PLAYLIST::TYPE_MUSIC or PLAYLIST::TYPE_VIDEO.
\return true if the given playlist is shuffled and party mode isn't enabled, false otherwise.
\sa SetShuffle
*/
bool IsShuffled(PLAYLIST::Id playlistId) const;
bool IsShuffled(Id playlistId) const;

/*! \brief Return whether or not something has been played yet from the current playlist.
\return true if something has been played, false otherwise.
Expand All @@ -155,38 +155,39 @@ class CPlayListPlayer : public IMsgTargetCallback,
\param notify notify the user with a Toast notification
\sa GetRepeat
*/
void SetRepeat(PLAYLIST::Id playlistId, PLAYLIST::RepeatState state, bool notify = false);
PLAYLIST::RepeatState GetRepeat(PLAYLIST::Id playlistId) const;
void SetRepeat(Id playlistId, RepeatState state, bool notify = false);
RepeatState GetRepeat(Id playlistId) const;

// add items via the playlist player
void Add(PLAYLIST::Id playlistId, const CPlayList& playlist);
void Add(PLAYLIST::Id playlistId, const CFileItemPtr& pItem);
void Add(PLAYLIST::Id playlistId, const CFileItemList& items);
void Insert(PLAYLIST::Id playlistId, const CPlayList& playlist, int iIndex);
void Insert(PLAYLIST::Id playlistId, const CFileItemPtr& pItem, int iIndex);
void Insert(PLAYLIST::Id playlistId, const CFileItemList& items, int iIndex);
void Remove(PLAYLIST::Id playlistId, int iPosition);
void Swap(PLAYLIST::Id playlistId, int indexItem1, int indexItem2);
void Add(Id playlistId, const CPlayList& playlist);
void Add(Id playlistId, const CFileItemPtr& pItem);
void Add(Id playlistId, const CFileItemList& items);
void Insert(Id playlistId, const CPlayList& playlist, int iIndex);
void Insert(Id playlistId, const CFileItemPtr& pItem, int iIndex);
void Insert(Id playlistId, const CFileItemList& items, int iIndex);
void Remove(Id playlistId, int iPosition);
void Swap(Id playlistId, int indexItem1, int indexItem2);

bool IsSingleItemNonRepeatPlaylist() const;

bool OnAction(const CAction &action);

protected:
/*! \brief Returns true if the given is set to repeat all
\param playlist Playlist to be query
\return true if the given playlist is set to repeat all, false otherwise.
*/
bool Repeated(PLAYLIST::Id playlistId) const;
bool Repeated(Id playlistId) const;

/*! \brief Returns true if the given is set to repeat one
\param playlist Playlist to be query
\return true if the given playlist is set to repeat one, false otherwise.
*/
bool RepeatedOne(PLAYLIST::Id playlistId) const;
bool RepeatedOne(Id playlistId) const;

void ReShuffle(PLAYLIST::Id playlistId, int iPosition);
void ReShuffle(Id playlistId, int iPosition);

void AnnouncePropertyChanged(PLAYLIST::Id playlistId,
void AnnouncePropertyChanged(Id playlistId,
const std::string& strProperty,
const CVariant& value);

Expand All @@ -195,15 +196,15 @@ class CPlayListPlayer : public IMsgTargetCallback,
int m_iFailedSongs;
std::chrono::time_point<std::chrono::steady_clock> m_failedSongsStart;
int m_iCurrentSong;
PLAYLIST::Id m_iCurrentPlayList{PLAYLIST::Id::TYPE_NONE};
Id m_iCurrentPlayList{Id::TYPE_NONE};
CPlayList* m_PlaylistMusic;
CPlayList* m_PlaylistVideo;
CPlayList* m_PlaylistEmpty;
std::map<PLAYLIST::Id, PLAYLIST::RepeatState> m_repeatState{
{PLAYLIST::Id::TYPE_MUSIC, PLAYLIST::RepeatState::NONE},
{PLAYLIST::Id::TYPE_VIDEO, PLAYLIST::RepeatState::NONE},
{PLAYLIST::Id::TYPE_PICTURE, PLAYLIST::RepeatState::NONE},
std::map<Id, RepeatState> m_repeatState{
{Id::TYPE_MUSIC, RepeatState::NONE},
{Id::TYPE_VIDEO, RepeatState::NONE},
{Id::TYPE_PICTURE, RepeatState::NONE},
};
};

}
} // namespace KODI::PLAYLIST
4 changes: 2 additions & 2 deletions xbmc/ServiceBroker.h
Expand Up @@ -37,7 +37,7 @@ namespace PVR
class CPVRManager;
}

namespace PLAYLIST
namespace KODI::PLAYLIST
{
class CPlayListPlayer;
}
Expand Down Expand Up @@ -152,7 +152,7 @@ class CServiceBroker
static CContextMenuManager& GetContextMenuManager();
static CDataCacheCore& GetDataCacheCore();
static CPlatform& GetPlatform();
static PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
static KODI::PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
static CSlideShowDelegator& GetSlideShowDelegator();
static KODI::GAME::CControllerManager& GetGameControllerManager();
static KODI::GAME::CGameServices& GetGameServices();
Expand Down
6 changes: 3 additions & 3 deletions xbmc/ServiceManager.h
Expand Up @@ -27,7 +27,7 @@ namespace PVR
class CPVRManager;
}

namespace PLAYLIST
namespace KODI::PLAYLIST
{
class CPlayListPlayer;
}
Expand Down Expand Up @@ -127,7 +127,7 @@ class CServiceManager
KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
PERIPHERALS::CPeripherals& GetPeripherals();

PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
KODI::PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
CSlideShowDelegator& GetSlideShowDelegator();
int init_level = 0;

Expand Down Expand Up @@ -167,7 +167,7 @@ class CServiceManager
std::unique_ptr<CContextMenuManager> m_contextMenuManager;
std::unique_ptr<CDataCacheCore> m_dataCacheCore;
std::unique_ptr<CPlatform> m_Platform;
std::unique_ptr<PLAYLIST::CPlayListPlayer> m_playlistPlayer;
std::unique_ptr<KODI::PLAYLIST::CPlayListPlayer> m_playlistPlayer;
std::unique_ptr<KODI::GAME::CControllerManager> m_gameControllerManager;
std::unique_ptr<KODI::GAME::CGameServices> m_gameServices;
std::unique_ptr<KODI::RETRO::CGUIGameRenderManager> m_gameRenderManager;
Expand Down
1 change: 0 additions & 1 deletion xbmc/Util.cpp
Expand Up @@ -92,7 +92,6 @@ using namespace MEDIA_DETECT;
#endif

using namespace XFILE;
using namespace PLAYLIST;
using KODI::UTILITY::CDigest;
using namespace KODI;

Expand Down
2 changes: 1 addition & 1 deletion xbmc/application/Application.cpp
Expand Up @@ -2176,7 +2176,7 @@ bool CApplication::PlayMedia(CFileItem& item, const std::string& player, PLAYLIS
CUtil::GetRecursiveListing(item.GetPath(), items, "", DIR_FLAG_NO_FILE_DIRS);
if (items.Size())
{
CSmartPlaylist smartpl;
PLAYLIST::CSmartPlaylist smartpl;
//get name and type of smartplaylist, this will always succeed as GetDirectory also did this.
smartpl.OpenAndReadName(item.GetURL());
PLAYLIST::CPlayList playlist;
Expand Down
8 changes: 4 additions & 4 deletions xbmc/application/Application.h
Expand Up @@ -59,7 +59,7 @@ namespace MEDIA_DETECT
class CAutorun;
}

namespace PLAYLIST
namespace KODI::PLAYLIST
{
class CPlayList;
}
Expand Down Expand Up @@ -120,10 +120,10 @@ class CApplication : public IWindowManagerCallback,
int GetMessageMask() override;
void OnApplicationMessage(KODI::MESSAGING::ThreadMessage* pMsg) override;

bool PlayMedia(CFileItem& item, const std::string& player, PLAYLIST::Id playlistId);
bool PlayMedia(CFileItem& item, const std::string& player, KODI::PLAYLIST::Id playlistId);
bool ProcessAndStartPlaylist(const std::string& strPlayList,
PLAYLIST::CPlayList& playlist,
PLAYLIST::Id playlistId,
KODI::PLAYLIST::CPlayList& playlist,
KODI::PLAYLIST::Id playlistId,
int track = 0);
bool PlayFile(CFileItem item,
const std::string& player,
Expand Down
2 changes: 1 addition & 1 deletion xbmc/application/ApplicationPlayer.h
Expand Up @@ -95,7 +95,7 @@ class CApplicationPlayer : public IApplicationComponent
int64_t GetChapterPos(int chapterIdx = -1) const;
float GetPercentage() const;
std::string GetPlayerState();
PLAYLIST::Id GetPreferredPlaylist() const;
KODI::PLAYLIST::Id GetPreferredPlaylist() const;
int GetSubtitleDelay() const;
int GetSubtitle();
void GetSubtitleCapabilities(std::vector<int>& subCaps) const;
Expand Down
18 changes: 12 additions & 6 deletions xbmc/dialogs/GUIDialogMediaFilter.cpp
Expand Up @@ -31,6 +31,8 @@
#include "video/VideoDatabase.h"
#include "video/VideoDbUrl.h"

using namespace KODI;

#define CONTROL_HEADING 2

#define CONTROL_OKAY_BUTTON 28
Expand Down Expand Up @@ -186,7 +188,8 @@ bool CGUIDialogMediaFilter::OnMessage(CGUIMessage& message)
return CGUIDialogSettingsManualBase::OnMessage(message);
}

void CGUIDialogMediaFilter::ShowAndEditMediaFilter(const std::string &path, CSmartPlaylist &filter)
void CGUIDialogMediaFilter::ShowAndEditMediaFilter(const std::string& path,
PLAYLIST::CSmartPlaylist& filter)
{
CGUIDialogMediaFilter *dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogMediaFilter>(WINDOW_DIALOG_MEDIA_FILTER);
if (dialog == NULL)
Expand Down Expand Up @@ -411,7 +414,7 @@ void CGUIDialogMediaFilter::InitializeSettings()
{
if (rule->m_field == filter.field)
{
filter.rule = static_cast<CSmartPlaylistRule*>(rule.get());
filter.rule = static_cast<PLAYLIST::CSmartPlaylistRule*>(rule.get());
handledRules++;
break;
}
Expand Down Expand Up @@ -644,7 +647,7 @@ int CGUIDialogMediaFilter::GetItems(const Filter &filter, std::vector<std::strin
CFileItemList selectItems;

// remove the rule for the field of the filter we want to retrieve items for
CSmartPlaylist tmpFilter = *m_filter;
PLAYLIST::CSmartPlaylist tmpFilter = *m_filter;
for (CDatabaseQueryRules::iterator rule = tmpFilter.m_ruleCombination.m_rules.begin();
rule != tmpFilter.m_ruleCombination.m_rules.end(); ++rule)
{
Expand Down Expand Up @@ -730,14 +733,17 @@ int CGUIDialogMediaFilter::GetItems(const Filter &filter, std::vector<std::strin
return items.size();
}

CSmartPlaylistRule* CGUIDialogMediaFilter::AddRule(Field field, CDatabaseQueryRule::SEARCH_OPERATOR ruleOperator /* = CDatabaseQueryRule::OPERATOR_CONTAINS */)
PLAYLIST::CSmartPlaylistRule* CGUIDialogMediaFilter::AddRule(
Field field,
CDatabaseQueryRule::SEARCH_OPERATOR ruleOperator /* = CDatabaseQueryRule::OPERATOR_CONTAINS */)
{
CSmartPlaylistRule rule;
PLAYLIST::CSmartPlaylistRule rule;
rule.m_field = field;
rule.m_operator = ruleOperator;

m_filter->m_ruleCombination.AddRule(rule);
return (CSmartPlaylistRule *)m_filter->m_ruleCombination.m_rules.back().get();
return static_cast<PLAYLIST::CSmartPlaylistRule*>(
m_filter->m_ruleCombination.m_rules.back().get());
}

void CGUIDialogMediaFilter::DeleteRule(Field field)
Expand Down

0 comments on commit b0d72e8

Please sign in to comment.