aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett Brown <themagnificentmrb@gmail.com>2018-08-17 14:20:36 -0700
committerGitHub <noreply@github.com>2018-08-17 14:20:36 -0700
commitf08d8686e96edcfbe065d4e5094ab6221da057b9 (patch)
treec24b6969ed416442ae007e4ff35a8ce9ff9b1703
parent17f811690eaad14be8eca0390d99122b0602c0cd (diff)
parent5bab5fb564cf4d3511b5a3733ed5c6bbcc1c1b9a (diff)
Merge pull request #14303 from garbear/announcement-instance18.0b1-Leia
Remove CAnnouncementManager::GetInstance()
-rw-r--r--xbmc/Application.cpp38
-rw-r--r--xbmc/Application.h6
-rw-r--r--xbmc/GUIInfoManager.cpp2
-rw-r--r--xbmc/PartyModeManager.cpp2
-rw-r--r--xbmc/PlayListPlayer.cpp2
-rw-r--r--xbmc/ServiceBroker.cpp20
-rw-r--r--xbmc/ServiceBroker.h6
-rw-r--r--xbmc/ServiceManager.cpp12
-rw-r--r--xbmc/ServiceManager.h7
-rw-r--r--xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp8
-rw-r--r--xbmc/dialogs/GUIDialogKeyboardGeneric.cpp4
-rw-r--r--xbmc/dialogs/GUIDialogNumeric.cpp5
-rw-r--r--xbmc/games/dialogs/osd/DialogGameVolume.cpp4
-rw-r--r--xbmc/interfaces/AnnouncementManager.cpp6
-rw-r--r--xbmc/interfaces/AnnouncementManager.h2
-rw-r--r--xbmc/interfaces/IAnnouncer.h2
-rw-r--r--xbmc/interfaces/builtins/ApplicationBuiltins.cpp2
-rw-r--r--xbmc/interfaces/json-rpc/JSONRPC.cpp46
-rw-r--r--xbmc/interfaces/python/XBPython.cpp17
-rw-r--r--xbmc/listproviders/DirectoryProvider.cpp15
-rw-r--r--xbmc/music/MusicDatabase.cpp12
-rw-r--r--xbmc/music/infoscanner/MusicInfoScanner.cpp4
-rw-r--r--xbmc/network/AirPlayServer.cpp9
-rw-r--r--xbmc/network/AirTunesServer.cpp9
-rw-r--r--xbmc/network/TCPServer.cpp9
-rw-r--r--xbmc/network/upnp/UPnPRenderer.cpp11
-rw-r--r--xbmc/network/upnp/UPnPServer.cpp6
-rw-r--r--xbmc/peripherals/Peripherals.cpp8
-rw-r--r--xbmc/peripherals/Peripherals.h9
-rw-r--r--xbmc/peripherals/devices/PeripheralCecAdapter.cpp25
-rw-r--r--xbmc/pictures/GUIWindowPictures.cpp2
-rw-r--r--xbmc/pictures/GUIWindowSlideShow.cpp14
-rw-r--r--xbmc/platform/android/activity/XBMCApp.cpp2
-rw-r--r--xbmc/platform/darwin/ios-common/AnnounceReceiver.mm4
-rw-r--r--xbmc/playlists/PlayList.cpp7
-rw-r--r--xbmc/powermanagement/PowerManager.cpp10
-rw-r--r--xbmc/pvr/PVRManager.cpp7
-rw-r--r--xbmc/utils/SaveFileStateJob.cpp6
-rw-r--r--xbmc/video/VideoDatabase.cpp14
-rw-r--r--xbmc/video/VideoInfoScanner.cpp6
-rw-r--r--xbmc/windowing/win10/WinEventsWin10.cpp7
-rw-r--r--xbmc/windows/GUIWindowHome.cpp14
42 files changed, 191 insertions, 210 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index d3afa69e39..b679c631d3 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -210,7 +210,6 @@ using namespace VIDEO;
using namespace MUSIC_INFO;
using namespace EVENTSERVER;
using namespace JSONRPC;
-using namespace ANNOUNCEMENT;
using namespace PVR;
using namespace PERIPHERALS;
using namespace KODI;
@@ -353,6 +352,11 @@ bool CApplication::Create(const CAppParamParser &params)
// Grab a handle to our thread to be used later in identifying the render thread.
m_threadID = CThread::GetCurrentThreadId();
+ // Announement service
+ m_pAnnouncementManager = std::make_shared<ANNOUNCEMENT::CAnnouncementManager>();
+ m_pAnnouncementManager->Start();
+ CServiceBroker::RegisterAnnouncementManager(m_pAnnouncementManager);
+
m_ServiceManager.reset(new CServiceManager());
if (!m_ServiceManager->InitStageOne())
@@ -2748,6 +2752,8 @@ bool CApplication::Cleanup()
m_ServiceManager.reset();
}
+ m_pAnnouncementManager.reset();
+
return true;
}
catch (...)
@@ -2784,7 +2790,7 @@ void CApplication::Stop(int exitCode)
CVariant vExitCode(CVariant::VariantTypeObject);
vExitCode["exitcode"] = exitCode;
- CAnnouncementManager::GetInstance().Announce(System, "xbmc", "OnQuit", vExitCode);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::System, "xbmc", "OnQuit", vExitCode);
// Abort any active screensaver
WakeUpScreenSaverAndDPMS();
@@ -3272,7 +3278,7 @@ void CApplication::OnPlayBackEnded()
CVariant data(CVariant::VariantTypeObject);
data["end"] = true;
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnStop", m_itemCurrentFile, data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnStop", m_itemCurrentFile, data);
CGUIMessage msg(GUI_MSG_PLAYBACK_ENDED, 0, 0);
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
@@ -3392,7 +3398,7 @@ void CApplication::OnPlayBackStopped()
CVariant data(CVariant::VariantTypeObject);
data["end"] = false;
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnStop", m_itemCurrentFile, data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnStop", m_itemCurrentFile, data);
CGUIMessage msg(GUI_MSG_PLAYBACK_STOPPED, 0, 0);
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
@@ -3419,7 +3425,7 @@ void CApplication::OnPlayBackPaused()
CVariant param;
param["player"]["speed"] = 0;
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnPause", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPause", m_itemCurrentFile, param);
}
void CApplication::OnPlayBackResumed()
@@ -3435,7 +3441,7 @@ void CApplication::OnPlayBackResumed()
CVariant param;
param["player"]["speed"] = 1;
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnResume", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnResume", m_itemCurrentFile, param);
}
void CApplication::OnPlayBackSpeedChanged(int iSpeed)
@@ -3447,7 +3453,7 @@ void CApplication::OnPlayBackSpeedChanged(int iSpeed)
CVariant param;
param["player"]["speed"] = iSpeed;
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnSpeedChanged", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnSpeedChanged", m_itemCurrentFile, param);
}
void CApplication::OnPlayBackSeek(int64_t iTime, int64_t seekOffset)
@@ -3461,7 +3467,7 @@ void CApplication::OnPlayBackSeek(int64_t iTime, int64_t seekOffset)
CJSONUtils::MillisecondsToTimeObject(seekOffset, param["player"]["seekoffset"]);
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
param["player"]["speed"] = (int)m_appPlayer.GetPlaySpeed();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnSeek", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnSeek", m_itemCurrentFile, param);
CServiceBroker::GetGUI()->GetInfoManager().GetInfoProviders().GetPlayerInfoProvider().SetDisplayAfterSeek(2500, static_cast<int>(seekOffset));
}
@@ -3482,7 +3488,7 @@ void CApplication::OnAVStarted(const CFileItem &file)
CVariant param;
param["player"]["speed"] = 1;
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnAVStart", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnAVStart", m_itemCurrentFile, param);
}
void CApplication::OnAVChange()
@@ -3497,7 +3503,7 @@ void CApplication::OnAVChange()
CVariant param;
param["player"]["speed"] = 1;
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnAVChange", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnAVChange", m_itemCurrentFile, param);
}
void CApplication::RequestVideoSettings(const CFileItem &fileItem)
@@ -3604,7 +3610,7 @@ bool CApplication::ToggleDPMS(bool manual)
m_dpmsIsActive = false;
m_dpmsIsManual = false;
SetRenderGUI(true);
- CAnnouncementManager::GetInstance().Announce(GUI, "xbmc", "OnDPMSDeactivated");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::GUI, "xbmc", "OnDPMSDeactivated");
return m_dpms->DisablePowerSaving();
}
else
@@ -3614,7 +3620,7 @@ bool CApplication::ToggleDPMS(bool manual)
m_dpmsIsActive = true;
m_dpmsIsManual = manual;
SetRenderGUI(false);
- CAnnouncementManager::GetInstance().Announce(GUI, "xbmc", "OnDPMSActivated");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::GUI, "xbmc", "OnDPMSActivated");
return true;
}
}
@@ -3645,7 +3651,7 @@ bool CApplication::WakeUpScreenSaverAndDPMS(bool bPowerOffKeyPressed /* = false
// allow listeners to ignore the deactivation if it precedes a powerdown/suspend etc
CVariant data(CVariant::VariantTypeObject);
data["shuttingdown"] = bPowerOffKeyPressed;
- CAnnouncementManager::GetInstance().Announce(GUI, "xbmc", "OnScreensaverDeactivated", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::GUI, "xbmc", "OnScreensaverDeactivated", data);
}
return result;
@@ -3833,7 +3839,7 @@ void CApplication::ActivateScreenSaver(bool forceType /*= false */)
}
m_screensaverActive = true;
- CAnnouncementManager::GetInstance().Announce(GUI, "xbmc", "OnScreensaverActivated");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::GUI, "xbmc", "OnScreensaverActivated");
// disable screensaver lock from the login screen
m_iScreenSaveLock = CServiceBroker::GetGUI()->GetWindowManager().GetActiveWindow() == WINDOW_LOGIN_SCREEN ? 1 : 0;
@@ -4008,7 +4014,7 @@ bool CApplication::OnMessage(CGUIMessage& message)
CVariant param;
param["player"]["speed"] = 1;
param["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
- CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", m_itemCurrentFile, param);
// we don't want a busy dialog when switching channels
if (!m_itemCurrentFile->IsLiveTV())
@@ -4559,7 +4565,7 @@ void CApplication::VolumeChanged()
CVariant data(CVariant::VariantTypeObject);
data["volume"] = GetVolume();
data["muted"] = m_muted;
- CAnnouncementManager::GetInstance().Announce(Application, "xbmc", "OnVolumeChanged", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Application, "xbmc", "OnVolumeChanged", data);
// if player has volume control, set it.
m_appPlayer.SetVolume(m_volumeLevel);
diff --git a/xbmc/Application.h b/xbmc/Application.h
index 08ff1840b5..1faf9dde6a 100644
--- a/xbmc/Application.h
+++ b/xbmc/Application.h
@@ -64,6 +64,11 @@ namespace ADDON
typedef std::shared_ptr<IAddon> AddonPtr;
}
+namespace ANNOUNCEMENT
+{
+ class CAnnouncementManager;
+}
+
namespace MEDIA_DETECT
{
class CAutorun;
@@ -390,6 +395,7 @@ protected:
*/
bool NotifyActionListeners(const CAction &action) const;
+ std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
std::unique_ptr<CGUIComponent> m_pGUI;
std::unique_ptr<CWinSystemBase> m_pWinSystem;
std::unique_ptr<ActiveAE::CActiveAE> m_pActiveAE;
diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp
index 1670f72560..381082a4d3 100644
--- a/xbmc/GUIInfoManager.cpp
+++ b/xbmc/GUIInfoManager.cpp
@@ -6714,7 +6714,7 @@ void CGUIInfoManager::SetCurrentItem(const CFileItem &item)
SetChanged();
NotifyObservers(ObservableMessageCurrentItem);
// todo this should be handled by one of the observers above and forwarded
- g_application.m_ServiceManager->GetAnnouncementManager().Announce(ANNOUNCEMENT::Info, "xbmc", "OnChanged");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Info, "xbmc", "OnChanged");
}
void CGUIInfoManager::SetCurrentAlbumThumb(const std::string &thumbFileName)
diff --git a/xbmc/PartyModeManager.cpp b/xbmc/PartyModeManager.cpp
index 375e0d8282..e3a95917d6 100644
--- a/xbmc/PartyModeManager.cpp
+++ b/xbmc/PartyModeManager.cpp
@@ -708,6 +708,6 @@ void CPartyModeManager::Announce()
data["player"]["playerid"] = CServiceBroker::GetPlaylistPlayer().GetCurrentPlaylist();
data["property"]["partymode"] = m_bEnabled;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
}
}
diff --git a/xbmc/PlayListPlayer.cpp b/xbmc/PlayListPlayer.cpp
index 215358c85f..efe6384b78 100644
--- a/xbmc/PlayListPlayer.cpp
+++ b/xbmc/PlayListPlayer.cpp
@@ -735,7 +735,7 @@ void CPlayListPlayer::AnnouncePropertyChanged(int iPlaylist, const std::string &
CVariant data;
data["player"]["playerid"] = iPlaylist;
data["property"][strProperty] = value;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
}
int PLAYLIST::CPlayListPlayer::GetMessageMask()
diff --git a/xbmc/ServiceBroker.cpp b/xbmc/ServiceBroker.cpp
index 091dd461fa..07f76a87ba 100644
--- a/xbmc/ServiceBroker.cpp
+++ b/xbmc/ServiceBroker.cpp
@@ -12,6 +12,21 @@
using namespace KODI;
+// announcement
+std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> CServiceBroker::m_pAnnouncementManager;
+std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> CServiceBroker::GetAnnouncementManager()
+{
+ return m_pAnnouncementManager;
+}
+void CServiceBroker::RegisterAnnouncementManager(std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> port)
+{
+ m_pAnnouncementManager = port;
+}
+void CServiceBroker::UnregisterAnnouncementManager()
+{
+ m_pAnnouncementManager.reset();
+}
+
ADDON::CAddonMgr &CServiceBroker::GetAddonMgr()
{
return g_application.m_ServiceManager->GetAddonMgr();
@@ -32,11 +47,6 @@ ADDON::CVFSAddonCache &CServiceBroker::GetVFSAddonCache()
return g_application.m_ServiceManager->GetVFSAddonCache();
}
-ANNOUNCEMENT::CAnnouncementManager &CServiceBroker::GetAnnouncementManager()
-{
- return g_application.m_ServiceManager->GetAnnouncementManager();
-}
-
#ifdef HAS_PYTHON
XBPython& CServiceBroker::GetXBPython()
{
diff --git a/xbmc/ServiceBroker.h b/xbmc/ServiceBroker.h
index b09a5a6231..b11bb7d498 100644
--- a/xbmc/ServiceBroker.h
+++ b/xbmc/ServiceBroker.h
@@ -76,11 +76,14 @@ namespace PERIPHERALS
class CServiceBroker
{
public:
+ static std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> GetAnnouncementManager();
+ static void RegisterAnnouncementManager(std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> announcementManager);
+ static void UnregisterAnnouncementManager();
+
static ADDON::CAddonMgr &GetAddonMgr();
static ADDON::CBinaryAddonManager &GetBinaryAddonManager();
static ADDON::CBinaryAddonCache &GetBinaryAddonCache();
static ADDON::CVFSAddonCache &GetVFSAddonCache();
- static ANNOUNCEMENT::CAnnouncementManager &GetAnnouncementManager();
static XBPython &GetXBPython();
static PVR::CPVRManager &GetPVRManager();
static CContextMenuManager& GetContextMenuManager();
@@ -124,6 +127,7 @@ public:
static void UnregisterAppPort();
private:
+ static std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
static CGUIComponent* m_pGUI;
static CWinSystemBase* m_pWinSystem;
static IAE* m_pActiveAE;
diff --git a/xbmc/ServiceManager.cpp b/xbmc/ServiceManager.cpp
index 4f7e657c62..e43cb4b603 100644
--- a/xbmc/ServiceManager.cpp
+++ b/xbmc/ServiceManager.cpp
@@ -97,9 +97,6 @@ void CServiceManager::DeinitTesting()
bool CServiceManager::InitStageOne()
{
- m_announcementManager.reset(new ANNOUNCEMENT::CAnnouncementManager());
- m_announcementManager->Start();
-
#ifdef HAS_PYTHON
m_XBPython.reset(new XBPython());
CScriptInvocationManager::GetInstance().RegisterLanguageInvocationHandler(m_XBPython.get(), ".py");
@@ -167,8 +164,7 @@ bool CServiceManager::InitStageTwo(const CAppParamParser &params)
m_inputManager.reset(new CInputManager(params));
m_inputManager->InitializeInputs();
- m_peripherals.reset(new PERIPHERALS::CPeripherals(*m_announcementManager,
- *m_inputManager,
+ m_peripherals.reset(new PERIPHERALS::CPeripherals(*m_inputManager,
*m_gameControllerManager));
m_gameRenderManager.reset(new RETRO::CGUIGameRenderManager);
@@ -260,7 +256,6 @@ void CServiceManager::DeinitStageOne()
CScriptInvocationManager::GetInstance().UnregisterLanguageInvocationHandler(m_XBPython.get());
m_XBPython.reset();
#endif
- m_announcementManager.reset();
}
ADDON::CAddonMgr &CServiceManager::GetAddonMgr()
@@ -293,11 +288,6 @@ ADDON::CRepositoryUpdater &CServiceManager::GetRepositoryUpdater()
return *m_repositoryUpdater;
}
-ANNOUNCEMENT::CAnnouncementManager& CServiceManager::GetAnnouncementManager()
-{
- return *m_announcementManager;
-}
-
#ifdef HAS_PYTHON
XBPython& CServiceManager::GetXBPython()
{
diff --git a/xbmc/ServiceManager.h b/xbmc/ServiceManager.h
index 4c3783ea60..415f7a4d96 100644
--- a/xbmc/ServiceManager.h
+++ b/xbmc/ServiceManager.h
@@ -22,11 +22,6 @@ class CServiceAddonManager;
class CRepositoryUpdater;
}
-namespace ANNOUNCEMENT
-{
-class CAnnouncementManager;
-}
-
namespace PVR
{
class CPVRManager;
@@ -97,7 +92,6 @@ public:
ADDON::CVFSAddonCache& GetVFSAddonCache();
ADDON::CServiceAddonManager& GetServiceAddons();
ADDON::CRepositoryUpdater& GetRepositoryUpdater();
- ANNOUNCEMENT::CAnnouncementManager& GetAnnouncementManager();
CNetworkBase& GetNetwork();
#ifdef HAS_PYTHON
XBPython& GetXBPython();
@@ -155,7 +149,6 @@ protected:
std::unique_ptr<ADDON::CVFSAddonCache> m_vfsAddonCache;
std::unique_ptr<ADDON::CServiceAddonManager> m_serviceAddons;
std::unique_ptr<ADDON::CRepositoryUpdater> m_repositoryUpdater;
- std::unique_ptr<ANNOUNCEMENT::CAnnouncementManager> m_announcementManager;
#ifdef HAS_PYTHON
std::unique_ptr<XBPython> m_XBPython;
#endif
diff --git a/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp b/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp
index 44377d5c67..7bb7ca665d 100644
--- a/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp
+++ b/xbmc/cores/VideoPlayer/VideoPlayerRadioRDS.cpp
@@ -940,7 +940,7 @@ unsigned int CDVDRadioRDSData::DecodeTA_TP(uint8_t *msgElement)
CVariant data(CVariant::VariantTypeObject);
data["on"] = true;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioTA", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioTA", data);
}
if (!traffic_announcement && m_TA_TP_TrafficAdvisory && CServiceBroker::GetSettings().GetBool("pvrplayback.trafficadvisory"))
@@ -950,7 +950,7 @@ unsigned int CDVDRadioRDSData::DecodeTA_TP(uint8_t *msgElement)
CVariant data(CVariant::VariantTypeObject);
data["on"] = false;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioTA", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioTA", data);
}
return 4;
@@ -1173,7 +1173,7 @@ unsigned int CDVDRadioRDSData::DecodeRTC(uint8_t *msgElement)
CVariant data(CVariant::VariantTypeObject);
data["dateTime"] = (m_RTC_DateTime.IsValid()) ? m_RTC_DateTime.GetAsRFC1123DateTime() : "";
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioRTC", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioRTC", data);
return 8;
}
@@ -1732,6 +1732,6 @@ void CDVDRadioRDSData::SendTMCSignal(unsigned int flags, uint8_t *data)
msg["y"] = (unsigned int)(m_TMC_LastData[1]<<8 | m_TMC_LastData[2]);
msg["z"] = (unsigned int)(m_TMC_LastData[3]<<8 | m_TMC_LastData[4]);
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioTMC", msg);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::PVR, "xbmc", "RDSRadioTMC", msg);
}
}
diff --git a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp
index 6abecf4cad..48b7e50085 100644
--- a/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp
+++ b/xbmc/dialogs/GUIDialogKeyboardGeneric.cpp
@@ -176,7 +176,7 @@ void CGUIDialogKeyboardGeneric::OnInitWindow()
data["title"] = m_strHeading;
data["type"] = !m_hiddenInput ? "keyboard" : "password";
data["value"] = GetText();
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
bool CGUIDialogKeyboardGeneric::OnAction(const CAction &action)
@@ -509,7 +509,7 @@ void CGUIDialogKeyboardGeneric::OnDeinitWindow(int nextWindowID)
// reset the heading (we don't always have this)
m_strHeading = "";
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputFinished");
}
void CGUIDialogKeyboardGeneric::MoveCursor(int iAmount)
diff --git a/xbmc/dialogs/GUIDialogNumeric.cpp b/xbmc/dialogs/GUIDialogNumeric.cpp
index 7ca2a2114c..11a6ed49ff 100644
--- a/xbmc/dialogs/GUIDialogNumeric.cpp
+++ b/xbmc/dialogs/GUIDialogNumeric.cpp
@@ -85,7 +85,8 @@ void CGUIDialogNumeric::OnInitWindow()
data["title"] = control->GetDescription();
data["value"] = GetOutputString();
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
+
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
void CGUIDialogNumeric::OnDeinitWindow(int nextWindowID)
@@ -93,7 +94,7 @@ void CGUIDialogNumeric::OnDeinitWindow(int nextWindowID)
// call base class
CGUIDialog::OnDeinitWindow(nextWindowID);
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputFinished");
}
bool CGUIDialogNumeric::OnAction(const CAction &action)
diff --git a/xbmc/games/dialogs/osd/DialogGameVolume.cpp b/xbmc/games/dialogs/osd/DialogGameVolume.cpp
index bf657038ff..4332d6561a 100644
--- a/xbmc/games/dialogs/osd/DialogGameVolume.cpp
+++ b/xbmc/games/dialogs/osd/DialogGameVolume.cpp
@@ -74,12 +74,12 @@ void CDialogGameVolume::OnInitWindow()
if (dialogVolumeBar != nullptr)
dialogVolumeBar->RegisterCallback(this);
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
void CDialogGameVolume::OnDeinitWindow(int nextWindowID)
{
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
CGUIDialogVolumeBar *dialogVolumeBar = dynamic_cast<CGUIDialogVolumeBar*>(CServiceBroker::GetGUI()->GetWindowManager().GetWindow(WINDOW_DIALOG_VOLUME_BAR));
if (dialogVolumeBar != nullptr)
diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp
index d5a3d18eff..98249333ce 100644
--- a/xbmc/interfaces/AnnouncementManager.cpp
+++ b/xbmc/interfaces/AnnouncementManager.cpp
@@ -18,7 +18,6 @@
#include "video/VideoDatabase.h"
#include "pvr/channels/PVRChannel.h"
#include "PlayListPlayer.h"
-#include "ServiceBroker.h"
#define LOOKUP_PROPERTY "database-lookup"
@@ -33,11 +32,6 @@ CAnnouncementManager::~CAnnouncementManager()
Deinitialize();
}
-CAnnouncementManager& CAnnouncementManager::GetInstance()
-{
- return CServiceBroker::GetAnnouncementManager();
-}
-
void CAnnouncementManager::Start()
{
Create();
diff --git a/xbmc/interfaces/AnnouncementManager.h b/xbmc/interfaces/AnnouncementManager.h
index 22a0fc1360..b3e24822ac 100644
--- a/xbmc/interfaces/AnnouncementManager.h
+++ b/xbmc/interfaces/AnnouncementManager.h
@@ -28,8 +28,6 @@ namespace ANNOUNCEMENT
CAnnouncementManager();
~CAnnouncementManager() override;
- static CAnnouncementManager& GetInstance();
-
void Start();
void Deinitialize();
diff --git a/xbmc/interfaces/IAnnouncer.h b/xbmc/interfaces/IAnnouncer.h
index 9d9fcd0bcc..3a8cb25e16 100644
--- a/xbmc/interfaces/IAnnouncer.h
+++ b/xbmc/interfaces/IAnnouncer.h
@@ -26,7 +26,7 @@ namespace ANNOUNCEMENT
Info = 0x400
};
- #define ANNOUNCE_ALL (Player | Playlist | GUI | System | VideoLibrary | AudioLibrary | Application | Input | ANNOUNCEMENT::PVR | Other)
+ const auto ANNOUNCE_ALL = (Player | Playlist | GUI | System | VideoLibrary | AudioLibrary | Application | Input | ANNOUNCEMENT::PVR | Other);
/*!
\brief Returns a string representation for the
diff --git a/xbmc/interfaces/builtins/ApplicationBuiltins.cpp b/xbmc/interfaces/builtins/ApplicationBuiltins.cpp
index 5e0a1b063f..1efb8c342b 100644
--- a/xbmc/interfaces/builtins/ApplicationBuiltins.cpp
+++ b/xbmc/interfaces/builtins/ApplicationBuiltins.cpp
@@ -80,7 +80,7 @@ static int NotifyAll(const std::vector<std::string>& params)
}
}
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Other, params[0].c_str(), params[1].c_str(), data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Other, params[0].c_str(), params[1].c_str(), data);
return 0;
}
diff --git a/xbmc/interfaces/json-rpc/JSONRPC.cpp b/xbmc/interfaces/json-rpc/JSONRPC.cpp
index 16e01f0d3d..91a5689436 100644
--- a/xbmc/interfaces/json-rpc/JSONRPC.cpp
+++ b/xbmc/interfaces/json-rpc/JSONRPC.cpp
@@ -21,9 +21,9 @@
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/Variant.h"
+#include "ServiceBroker.h"
#include "TextureDatabase.h"
-using namespace ANNOUNCEMENT;
using namespace JSONRPC;
bool CJSONRPC::m_initialized = false;
@@ -158,8 +158,8 @@ JSONRPC_STATUS CJSONRPC::GetConfiguration(const std::string &method, ITransportL
{
int flags = client->GetAnnouncementFlags();
- for (int i = 1; i <= ANNOUNCE_ALL; i *= 2)
- result["notifications"][AnnouncementFlagToString((AnnouncementFlag)i)] = (flags & i) == i;
+ for (int i = 1; i <= ANNOUNCEMENT::ANNOUNCE_ALL; i *= 2)
+ result["notifications"][AnnouncementFlagToString((ANNOUNCEMENT::AnnouncementFlag)i)] = (flags & i) == i;
return OK;
}
@@ -172,33 +172,33 @@ JSONRPC_STATUS CJSONRPC::SetConfiguration(const std::string &method, ITransportL
if (parameterObject.isMember("notifications"))
{
CVariant notifications = parameterObject["notifications"];
- if ((notifications["Player"].isNull() && (oldFlags & Player)) ||
+ if ((notifications["Player"].isNull() && (oldFlags & ANNOUNCEMENT::Player)) ||
(notifications["Player"].isBoolean() && notifications["Player"].asBoolean()))
- flags |= Player;
- if ((notifications["Playlist"].isNull() && (oldFlags & Playlist)) ||
+ flags |= ANNOUNCEMENT::Player;
+ if ((notifications["Playlist"].isNull() && (oldFlags & ANNOUNCEMENT::Playlist)) ||
(notifications["Playlist"].isBoolean() && notifications["Playlist"].asBoolean()))
- flags |= Playlist;
- if ((notifications["GUI"].isNull() && (oldFlags & GUI)) ||
+ flags |= ANNOUNCEMENT::Playlist;
+ if ((notifications["GUI"].isNull() && (oldFlags & ANNOUNCEMENT::GUI)) ||
(notifications["GUI"].isBoolean() && notifications["GUI"].asBoolean()))
- flags |= GUI;
- if ((notifications["System"].isNull() && (oldFlags & System)) ||
+ flags |= ANNOUNCEMENT::GUI;
+ if ((notifications["System"].isNull() && (oldFlags & ANNOUNCEMENT::System)) ||
(notifications["System"].isBoolean() && notifications["System"].asBoolean()))
- flags |= System;
- if ((notifications["VideoLibrary"].isNull() && (oldFlags & VideoLibrary)) ||
+ flags |= ANNOUNCEMENT::System;
+ if ((notifications["VideoLibrary"].isNull() && (oldFlags & ANNOUNCEMENT::VideoLibrary)) ||
(notifications["VideoLibrary"].isBoolean() && notifications["VideoLibrary"].asBoolean()))
- flags |= VideoLibrary;
- if ((notifications["AudioLibrary"].isNull() && (oldFlags & AudioLibrary)) ||
+ flags |= ANNOUNCEMENT::VideoLibrary;
+ if ((notifications["AudioLibrary"].isNull() && (oldFlags & ANNOUNCEMENT::AudioLibrary)) ||
(notifications["AudioLibrary"].isBoolean() && notifications["AudioLibrary"].asBoolean()))
- flags |= AudioLibrary;
- if ((notifications["Application"].isNull() && (oldFlags & Other)) ||
+ flags |= ANNOUNCEMENT::AudioLibrary;
+ if ((notifications["Application"].isNull() && (oldFlags & ANNOUNCEMENT::Other)) ||
(notifications["Application"].isBoolean() && notifications["Application"].asBoolean()))
- flags |= Application;
- if ((notifications["Input"].isNull() && (oldFlags & Input)) ||
+ flags |= ANNOUNCEMENT::Application;
+ if ((notifications["Input"].isNull() && (oldFlags & ANNOUNCEMENT::Input)) ||
(notifications["Input"].isBoolean() && notifications["Input"].asBoolean()))
- flags |= Input;
- if ((notifications["Other"].isNull() && (oldFlags & Other)) ||
+ flags |= ANNOUNCEMENT::Input;
+ if ((notifications["Other"].isNull() && (oldFlags & ANNOUNCEMENT::Other)) ||
(notifications["Other"].isBoolean() && notifications["Other"].asBoolean()))
- flags |= Other;
+ flags |= ANNOUNCEMENT::Other;
}
if (!client->SetAnnouncementFlags(flags))
@@ -210,12 +210,12 @@ JSONRPC_STATUS CJSONRPC::SetConfiguration(const std::string &method, ITransportL
JSONRPC_STATUS CJSONRPC::NotifyAll(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant& parameterObject, CVariant &result)
{
if (parameterObject["data"].isNull())
- CAnnouncementManager::GetInstance().Announce(Other, parameterObject["sender"].asString().c_str(),
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Other, parameterObject["sender"].asString().c_str(),
parameterObject["message"].asString().c_str());
else
{
CVariant data = parameterObject["data"];
- CAnnouncementManager::GetInstance().Announce(Other, parameterObject["sender"].asString().c_str(),
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Other, parameterObject["sender"].asString().c_str(),
parameterObject["message"].asString().c_str(), data);
}
diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp
index a14c6b82c8..9f7bd4003e 100644
--- a/xbmc/interfaces/python/XBPython.cpp
+++ b/xbmc/interfaces/python/XBPython.cpp
@@ -33,8 +33,7 @@
#include "interfaces/legacy/AddonUtils.h"
#include "interfaces/python/AddonPythonInvoker.h"
#include "interfaces/python/PythonInvoker.h"
-
-using namespace ANNOUNCEMENT;
+#include "ServiceBroker.h"
XBPython::XBPython()
{
@@ -47,13 +46,13 @@ XBPython::XBPython()
m_vecPlayerCallbackList.clear();
m_vecMonitorCallbackList.clear();
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
XBPython::~XBPython()
{
XBMC_TRACE;
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
}
#define LOCK_AND_COPY(type, dest, src) \
@@ -66,9 +65,9 @@ XBPython::~XBPython()
#define CHECK_FOR_ENTRY(l,v) \
(l.hadSomethingRemoved ? (std::find(l.begin(),l.end(),v) != l.end()) : true)
-void XBPython::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void XBPython::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
- if (flag & VideoLibrary)
+ if (flag & ANNOUNCEMENT::VideoLibrary)
{
if (strcmp(message, "OnScanFinished") == 0)
OnScanFinished("video");
@@ -79,7 +78,7 @@ void XBPython::Announce(AnnouncementFlag flag, const char *sender, const char *m
else if (strcmp(message, "OnCleanFinished") == 0)
OnCleanFinished("video");
}
- else if (flag & AudioLibrary)
+ else if (flag & ANNOUNCEMENT::AudioLibrary)
{
if (strcmp(message, "OnScanFinished") == 0)
OnScanFinished("music");
@@ -90,7 +89,7 @@ void XBPython::Announce(AnnouncementFlag flag, const char *sender, const char *m
else if (strcmp(message, "OnCleanFinished") == 0)
OnCleanFinished("music");
}
- else if (flag & GUI)
+ else if (flag & ANNOUNCEMENT::GUI)
{
if (strcmp(message, "OnScreensaverDeactivated") == 0)
OnScreensaverDeactivated();
@@ -512,7 +511,7 @@ void XBPython::Uninitialize()
// don't handle any more announcements as most scripts are probably already
// stopped and executing a callback on one of their already destroyed classes
// would lead to a crash
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
LOCK_AND_COPY(std::vector<PyElem>,tmpvec,m_vecPyList);
m_vecPyList.clear();
diff --git a/xbmc/listproviders/DirectoryProvider.cpp b/xbmc/listproviders/DirectoryProvider.cpp
index a5027970dd..70b7ddd4ca 100644
--- a/xbmc/listproviders/DirectoryProvider.cpp
+++ b/xbmc/listproviders/DirectoryProvider.cpp
@@ -39,7 +39,6 @@
#include "video/windows/GUIWindowVideoBase.h"
using namespace XFILE;
-using namespace ANNOUNCEMENT;
using namespace KODI::MESSAGING;
using namespace PVR;
@@ -216,23 +215,23 @@ bool CDirectoryProvider::Update(bool forceRefresh)
return changed; //! @todo Also returned changed if properties are changed (if so, need to update scroll to letter).
}
-void CDirectoryProvider::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CDirectoryProvider::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
// we are only interested in library, player and GUI changes
- if ((flag & (VideoLibrary | AudioLibrary | Player | GUI)) == 0)
+ if ((flag & (ANNOUNCEMENT::VideoLibrary | ANNOUNCEMENT::AudioLibrary | ANNOUNCEMENT::Player | ANNOUNCEMENT::GUI)) == 0)
return;
{
CSingleLock lock(m_section);
// we don't need to refresh anything if there are no fitting
// items in this list provider for the announcement flag
- if (((flag & VideoLibrary) &&
+ if (((flag & ANNOUNCEMENT::VideoLibrary) &&
(std::find(m_itemTypes.begin(), m_itemTypes.end(), InfoTagType::VIDEO) == m_itemTypes.end())) ||
- ((flag & AudioLibrary) &&
+ ((flag & ANNOUNCEMENT::AudioLibrary) &&
(std::find(m_itemTypes.begin(), m_itemTypes.end(), InfoTagType::AUDIO) == m_itemTypes.end())))
return;
- if (flag & Player)
+ if (flag & ANNOUNCEMENT::Player)
{
if (strcmp(message, "OnPlay") == 0 ||
strcmp(message, "OnResume") == 0 ||
@@ -326,7 +325,7 @@ void CDirectoryProvider::Reset()
if (m_isAnnounced)
{
m_isAnnounced = false;
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
CServiceBroker::GetFavouritesService().Events().Unsubscribe(this);
CServiceBroker::GetAddonMgr().Events().Unsubscribe(this);
CServiceBroker::GetPVRManager().Events().Unsubscribe(this);
@@ -439,7 +438,7 @@ bool CDirectoryProvider::UpdateURL()
if (!m_isAnnounced)
{
m_isAnnounced = true;
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
CServiceBroker::GetAddonMgr().Events().Subscribe(this, &CDirectoryProvider::OnAddonEvent);
CServiceBroker::GetPVRManager().Events().Subscribe(this, &CDirectoryProvider::OnPVRManagerEvent);
CServiceBroker::GetFavouritesService().Events().Subscribe(this, &CDirectoryProvider::OnFavouritesEvent);
diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp
index b244b376b2..2260fd159a 100644
--- a/xbmc/music/MusicDatabase.cpp
+++ b/xbmc/music/MusicDatabase.cpp
@@ -80,7 +80,7 @@ static void AnnounceRemove(const std::string& content, int id)
data["id"] = id;
if (g_application.IsMusicScanning())
data["transaction"] = true;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnRemove", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnRemove", data);
}
static void AnnounceUpdate(const std::string& content, int id, bool added = false)
@@ -92,7 +92,7 @@ static void AnnounceUpdate(const std::string& content, int id, bool added = fals
data["transaction"] = true;
if (added)
data["added"] = true;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnUpdate", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnUpdate", data);
}
CMusicDatabase::CMusicDatabase(void)
@@ -3345,7 +3345,7 @@ int CMusicDatabase::Cleanup(CGUIDialogProgress* progressDialog /*= nullptr*/)
int ret = ERROR_OK;
unsigned int time = XbmcThreads::SystemClockMillis();
CLog::Log(LOGNOTICE, "%s: Starting musicdatabase cleanup ..", __FUNCTION__);
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnCleanStarted");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnCleanStarted");
// first cleanup any songs with invalid paths
if (progressDialog)
@@ -3464,7 +3464,7 @@ int CMusicDatabase::Cleanup(CGUIDialogProgress* progressDialog /*= nullptr*/)
}
time = XbmcThreads::SystemClockMillis() - time;
CLog::Log(LOGNOTICE, "%s: Cleaning musicdatabase done. Operation took %s", __FUNCTION__, StringUtils::SecondsToTimeString(time / 1000).c_str());
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnCleanFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnCleanFinished");
if (!Compress(false))
{
@@ -3474,7 +3474,7 @@ int CMusicDatabase::Cleanup(CGUIDialogProgress* progressDialog /*= nullptr*/)
error:
RollbackTransaction();
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnCleanFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnCleanFinished");
return ret;
}
@@ -9786,7 +9786,7 @@ void CMusicDatabase::ExportToXML(const CLibExportSettings& settings, CGUIDialog
if (iFailCount > 0)
data["failcount"] = iFailCount;
}
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnExport", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnExport", data);
}
}
catch (...)
diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp
index 7b9330f3c7..00ec82af22 100644
--- a/xbmc/music/infoscanner/MusicInfoScanner.cpp
+++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp
@@ -73,7 +73,7 @@ CMusicInfoScanner::~CMusicInfoScanner() = default;
void CMusicInfoScanner::Process()
{
m_bStop = false;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnScanStarted");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnScanStarted");
try
{
if (m_showDialog && !CServiceBroker::GetSettings().GetBool(CSettings::SETTING_MUSICLIBRARY_BACKGROUNDUPDATE))
@@ -263,7 +263,7 @@ void CMusicInfoScanner::Process()
CLog::Log(LOGDEBUG, "%s - Finished scan", __FUNCTION__);
m_bRunning = false;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnScanFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnScanFinished");
// we need to clear the musicdb cache and update any active lists
CUtil::DeleteMusicDatabaseDirectoryCache();
diff --git a/xbmc/network/AirPlayServer.cpp b/xbmc/network/AirPlayServer.cpp
index 71b054638e..fdc183dc0e 100644
--- a/xbmc/network/AirPlayServer.cpp
+++ b/xbmc/network/AirPlayServer.cpp
@@ -37,7 +37,6 @@
#include "network/Zeroconf.h"
#endif // HAS_ZEROCONF
-using namespace ANNOUNCEMENT;
using namespace KODI::MESSAGING;
using KODI::UTILITY::CDigest;
@@ -148,11 +147,11 @@ const char *eventStrings[] = {"playing", "paused", "loading", "stopped"};
#define AUTH_REALM "AirPlay"
#define AUTH_REQUIRED "WWW-Authenticate: Digest realm=\"" AUTH_REALM "\", nonce=\"%s\"\r\n"
-void CAirPlayServer::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CAirPlayServer::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
CSingleLock lock(ServerInstanceLock);
- if ( (flag & Player) && strcmp(sender, "xbmc") == 0 && ServerInstance)
+ if ( (flag & ANNOUNCEMENT::Player) && strcmp(sender, "xbmc") == 0 && ServerInstance)
{
if (strcmp(message, "OnStop") == 0)
{
@@ -303,12 +302,12 @@ CAirPlayServer::CAirPlayServer(int port, bool nonlocal) : CThread("AirPlayServer
m_ServerSockets = std::vector<SOCKET>();
m_usePassword = false;
m_origVolume = -1;
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
CAirPlayServer::~CAirPlayServer()
{
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
}
void handleZeroconfAnnouncement()
diff --git a/xbmc/network/AirTunesServer.cpp b/xbmc/network/AirTunesServer.cpp
index 7341343497..3add8b7037 100644
--- a/xbmc/network/AirTunesServer.cpp
+++ b/xbmc/network/AirTunesServer.cpp
@@ -54,7 +54,6 @@
#define ZEROCONF_DACP_SERVICE "_dacp._tcp"
using namespace XFILE;
-using namespace ANNOUNCEMENT;
using namespace KODI::MESSAGING;
DllLibShairplay *CAirTunesServer::m_pLibShairplay = NULL;
@@ -159,9 +158,9 @@ void CAirTunesServer::SetMetadataFromBuffer(const char *buffer, unsigned int siz
RefreshMetadata();
}
-void CAirTunesServer::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CAirTunesServer::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
- if ( (flag & Player) && strcmp(sender, "xbmc") == 0)
+ if ( (flag & ANNOUNCEMENT::Player) && strcmp(sender, "xbmc") == 0)
{
if ((strcmp(message, "OnPlay") == 0 || strcmp(message, "OnResume") == 0) && m_streamStarted)
{
@@ -647,13 +646,13 @@ void CAirTunesServer::RegisterActionListener(bool doRegister)
{
if (doRegister)
{
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
g_application.RegisterActionListener(this);
ServerInstance->Create();
}
else
{
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
g_application.UnregisterActionListener(this);
ServerInstance->StopThread(true);
}
diff --git a/xbmc/network/TCPServer.cpp b/xbmc/network/TCPServer.cpp
index d00e966244..5c0990165a 100644
--- a/xbmc/network/TCPServer.cpp
+++ b/xbmc/network/TCPServer.cpp
@@ -46,7 +46,6 @@ static const bdaddr_t bt_bdaddr_local = {{0, 0, 0, 0xff, 0xff, 0xff}};
#endif
using namespace JSONRPC;
-using namespace ANNOUNCEMENT;
#define RECEIVEBUFFER 1024
@@ -234,7 +233,7 @@ int CTCPServer::GetCapabilities()
return Response | Announcing;
}
-void CTCPServer::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CTCPServer::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
std::string str = IJSONRPCAnnouncer::AnnouncementToJSONRPC(flag, sender, message, data, g_advancedSettings.m_jsonOutputCompact);
@@ -261,7 +260,7 @@ bool CTCPServer::Initialize()
if (started)
{
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
CLog::Log(LOGINFO, "JSONRPC Server: Successfully initialized");
return true;
}
@@ -493,13 +492,13 @@ void CTCPServer::Deinitialize()
m_sdpd = NULL;
#endif
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
}
CTCPServer::CTCPClient::CTCPClient()
{
m_new = true;
- m_announcementflags = ANNOUNCE_ALL;
+ m_announcementflags = ANNOUNCEMENT::ANNOUNCE_ALL;
m_socket = INVALID_SOCKET;
m_beginBrackets = 0;
m_endBrackets = 0;
diff --git a/xbmc/network/upnp/UPnPRenderer.cpp b/xbmc/network/upnp/UPnPRenderer.cpp
index 141ca37b1f..fb326efa17 100644
--- a/xbmc/network/upnp/UPnPRenderer.cpp
+++ b/xbmc/network/upnp/UPnPRenderer.cpp
@@ -37,7 +37,6 @@
NPT_SET_LOCAL_LOGGER("xbmc.upnp.renderer")
-using namespace ANNOUNCEMENT;
using namespace KODI::MESSAGING;
namespace UPNP
@@ -50,7 +49,7 @@ CUPnPRenderer::CUPnPRenderer(const char* friendly_name, bool show_ip /*= false*/
const char* uuid /*= NULL*/, unsigned int port /*= 0*/)
: PLT_MediaRenderer(friendly_name, show_ip, uuid, port)
{
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
/*----------------------------------------------------------------------
@@ -58,7 +57,7 @@ CUPnPRenderer::CUPnPRenderer(const char* friendly_name, bool show_ip /*= false*/
+---------------------------------------------------------------------*/
CUPnPRenderer::~CUPnPRenderer()
{
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
}
/*----------------------------------------------------------------------
@@ -230,7 +229,7 @@ CUPnPRenderer::ProcessHttpGetRequest(NPT_HttpRequest& request,
| CUPnPRenderer::Announce
+---------------------------------------------------------------------*/
void
-CUPnPRenderer::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+CUPnPRenderer::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
if (strcmp(sender, "xbmc") != 0)
return;
@@ -238,7 +237,7 @@ CUPnPRenderer::Announce(AnnouncementFlag flag, const char *sender, const char *m
NPT_AutoLock lock(m_state);
PLT_Service *avt, *rct;
- if (flag == Player) {
+ if (flag == ANNOUNCEMENT::Player) {
if (NPT_FAILED(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", avt)))
return;
if (strcmp(message, "OnPlay") == 0 || strcmp(message, "OnResume") == 0 ) {
@@ -267,7 +266,7 @@ CUPnPRenderer::Announce(AnnouncementFlag flag, const char *sender, const char *m
avt->SetStateVariable("TransportPlaySpeed", NPT_String::FromInteger(data["player"]["speed"].asInteger()));
}
}
- else if (flag == Application && strcmp(message, "OnVolumeChanged") == 0) {
+ else if (flag == ANNOUNCEMENT::Application && strcmp(message, "OnVolumeChanged") == 0) {
if (NPT_FAILED(FindServiceByType("urn:schemas-upnp-org:service:RenderingControl:1", rct)))
return;
diff --git a/xbmc/network/upnp/UPnPServer.cpp b/xbmc/network/upnp/UPnPServer.cpp
index d35255c6b3..efe2197081 100644
--- a/xbmc/network/upnp/UPnPServer.cpp
+++ b/xbmc/network/upnp/UPnPServer.cpp
@@ -71,7 +71,7 @@ CUPnPServer::CUPnPServer(const char* friendly_name, const char* uuid /*= NULL*/,
CUPnPServer::~CUPnPServer()
{
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
}
/*----------------------------------------------------------------------
@@ -108,7 +108,7 @@ CUPnPServer::SetupServices()
OnScanCompleted(VideoLibrary);
// now safe to start passing on new notifications
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
return result;
}
@@ -1076,7 +1076,7 @@ CUPnPServer::OnUpdateObject(PLT_ActionReference& action,
CVariant data;
data["id"] = updated.GetVideoInfoTag()->m_iDbId;
data["type"] = updated.GetVideoInfoTag()->m_type;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
}
updatelisting = true;
}
diff --git a/xbmc/peripherals/Peripherals.cpp b/xbmc/peripherals/Peripherals.cpp
index 58a596ca77..6eecb17329 100644
--- a/xbmc/peripherals/Peripherals.cpp
+++ b/xbmc/peripherals/Peripherals.cpp
@@ -68,10 +68,8 @@ using namespace PERIPHERALS;
using namespace XFILE;
using namespace KODI::MESSAGING;
-CPeripherals::CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements,
- CInputManager &inputManager,
+CPeripherals::CPeripherals(CInputManager &inputManager,
GAME::CControllerManager &controllerProfiles) :
- m_announcements(announcements),
m_inputManager(inputManager),
m_controllerProfiles(controllerProfiles),
m_eventScanner(new CEventScanner(*this))
@@ -130,13 +128,13 @@ void CPeripherals::Initialise()
m_eventScanner->Start();
MESSAGING::CApplicationMessenger::GetInstance().RegisterReceiver(this);
- m_announcements.AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
#endif
}
void CPeripherals::Clear()
{
- m_announcements.RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
m_eventScanner->Stop();
diff --git a/xbmc/peripherals/Peripherals.h b/xbmc/peripherals/Peripherals.h
index 9139ff40bc..e3c857bcd8 100644
--- a/xbmc/peripherals/Peripherals.h
+++ b/xbmc/peripherals/Peripherals.h
@@ -42,11 +42,6 @@ namespace JOYSTICK
}
}
-namespace ANNOUNCEMENT
-{
- class CAnnouncementManager;
-}
-
namespace PERIPHERALS
{
class CEventScanner;
@@ -58,8 +53,7 @@ namespace PERIPHERALS
public ANNOUNCEMENT::IAnnouncer
{
public:
- explicit CPeripherals(ANNOUNCEMENT::CAnnouncementManager &announcements,
- CInputManager &inputManager,
+ explicit CPeripherals(CInputManager &inputManager,
KODI::GAME::CControllerManager &controllerProfiles);
~CPeripherals() override;
@@ -336,7 +330,6 @@ namespace PERIPHERALS
void OnDeviceChanged();
// Construction parameters
- ANNOUNCEMENT::CAnnouncementManager &m_announcements;
CInputManager &m_inputManager;
KODI::GAME::CControllerManager &m_controllerProfiles;
diff --git a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
index 3dc25d3a6c..af3ee5a4c7 100644
--- a/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
+++ b/xbmc/peripherals/devices/PeripheralCecAdapter.cpp
@@ -28,7 +28,6 @@
using namespace KODI;
using namespace MESSAGING;
using namespace PERIPHERALS;
-using namespace ANNOUNCEMENT;
using namespace CEC;
#define CEC_LIB_SUPPORTED_VERSION LIBCEC_VERSION_TO_UINT(4, 0, 0)
@@ -68,7 +67,7 @@ CPeripheralCecAdapter::~CPeripheralCecAdapter(void)
{
{
CSingleLock lock(m_critSection);
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
m_bStop = true;
}
@@ -117,16 +116,16 @@ void CPeripheralCecAdapter::ResetMembers(void)
m_configuration.Clear();
}
-void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CPeripheralCecAdapter::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
- if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnQuit") && m_bIsReady)
+ if (flag == ANNOUNCEMENT::System && !strcmp(sender, "xbmc") && !strcmp(message, "OnQuit") && m_bIsReady)
{
CSingleLock lock(m_critSection);
m_iExitCode = static_cast<int>(data["exitcode"].asInteger(EXITCODE_QUIT));
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
StopThread(false);
}
- else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverDeactivated") && m_bIsReady)
+ else if (flag == ANNOUNCEMENT::GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverDeactivated") && m_bIsReady)
{
bool bIgnoreDeactivate(false);
if (data["shuttingdown"].isBoolean())
@@ -144,7 +143,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
ActivateSource();
}
}
- else if (flag == GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverActivated") && m_bIsReady)
+ else if (flag == ANNOUNCEMENT::GUI && !strcmp(sender, "xbmc") && !strcmp(message, "OnScreensaverActivated") && m_bIsReady)
{
// Don't put devices to standby if application is currently playing
if (!g_application.GetAppPlayer().IsPlaying() && m_bPowerOffScreensaver)
@@ -154,7 +153,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
StandbyDevices();
}
}
- else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnSleep"))
+ else if (flag == ANNOUNCEMENT::System && !strcmp(sender, "xbmc") && !strcmp(message, "OnSleep"))
{
// this will also power off devices when we're the active source
{
@@ -163,7 +162,7 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
}
StopThread();
}
- else if (flag == System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake"))
+ else if (flag == ANNOUNCEMENT::System && !strcmp(sender, "xbmc") && !strcmp(message, "OnWake"))
{
CLog::Log(LOGDEBUG, "%s - reconnecting to the CEC adapter after standby mode", __FUNCTION__);
if (ReopenConnection())
@@ -178,13 +177,13 @@ void CPeripheralCecAdapter::Announce(AnnouncementFlag flag, const char *sender,
ActivateSource();
}
}
- else if (flag == Player && !strcmp(sender, "xbmc") && !strcmp(message, "OnStop"))
+ else if (flag == ANNOUNCEMENT::Player && !strcmp(sender, "xbmc") && !strcmp(message, "OnStop"))
{
CSingleLock lock(m_critSection);
m_preventActivateSourceOnPlay = CDateTime::GetCurrentDateTime();
m_bOnPlayReceived = false;
}
- else if (flag == Player && !strcmp(sender, "xbmc") && (!strcmp(message, "OnPlay") || !strcmp(message, "OnResume")))
+ else if (flag == ANNOUNCEMENT::Player && !strcmp(sender, "xbmc") && (!strcmp(message, "OnPlay") || !strcmp(message, "OnResume")))
{
// activate the source when playback started, and the option is enabled
bool bActivateSource(false);
@@ -329,7 +328,7 @@ void CPeripheralCecAdapter::Process(void)
m_bActiveSourceBeforeStandby = false;
}
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
m_queryThread = new CPeripheralCecAdapterUpdateThread(this, &m_configuration);
m_queryThread->Create(false);
@@ -1677,7 +1676,7 @@ bool CPeripheralCecAdapter::ReopenConnection(bool bAsync /* = false */)
{
CSingleLock lock(m_critSection);
m_iExitCode = EXITCODE_RESTARTAPP;
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
StopThread(false);
}
StopThread();
diff --git a/xbmc/pictures/GUIWindowPictures.cpp b/xbmc/pictures/GUIWindowPictures.cpp
index 18f8c73b66..c5acd1de91 100644
--- a/xbmc/pictures/GUIWindowPictures.cpp
+++ b/xbmc/pictures/GUIWindowPictures.cpp
@@ -343,7 +343,7 @@ bool CGUIWindowPictures::ShowPicture(int iItem, bool startSlideShow)
CVariant param;
param["player"]["speed"] = 1;
param["player"]["playerid"] = PLAYLIST_PICTURE;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", pSlideShow->GetCurrentSlide(), param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", pSlideShow->GetCurrentSlide(), param);
}
m_slideShowStarted = true;
diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp
index e78851f0b0..0b09efa426 100644
--- a/xbmc/pictures/GUIWindowSlideShow.cpp
+++ b/xbmc/pictures/GUIWindowSlideShow.cpp
@@ -151,7 +151,7 @@ void CGUIWindowSlideShow::AnnouncePlayerPlay(const CFileItemPtr& item)
CVariant param;
param["player"]["speed"] = m_bSlideShow && !m_bPause ? 1 : 0;
param["player"]["playerid"] = PLAYLIST_PICTURE;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", item, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", item, param);
}
void CGUIWindowSlideShow::AnnouncePlayerPause(const CFileItemPtr& item)
@@ -159,7 +159,7 @@ void CGUIWindowSlideShow::AnnouncePlayerPause(const CFileItemPtr& item)
CVariant param;
param["player"]["speed"] = 0;
param["player"]["playerid"] = PLAYLIST_PICTURE;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPause", item, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPause", item, param);
}
void CGUIWindowSlideShow::AnnouncePlayerStop(const CFileItemPtr& item)
@@ -167,14 +167,14 @@ void CGUIWindowSlideShow::AnnouncePlayerStop(const CFileItemPtr& item)
CVariant param;
param["player"]["playerid"] = PLAYLIST_PICTURE;
param["end"] = true;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnStop", item, param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnStop", item, param);
}
void CGUIWindowSlideShow::AnnouncePlaylistClear()
{
CVariant data;
data["playlistid"] = PLAYLIST_PICTURE;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnClear", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnClear", data);
}
void CGUIWindowSlideShow::AnnouncePlaylistAdd(const CFileItemPtr& item, int pos)
@@ -182,7 +182,7 @@ void CGUIWindowSlideShow::AnnouncePlaylistAdd(const CFileItemPtr& item, int pos)
CVariant data;
data["playlistid"] = PLAYLIST_PICTURE;
data["position"] = pos;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnAdd", item, data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnAdd", item, data);
}
void CGUIWindowSlideShow::AnnouncePropertyChanged(const std::string &strProperty, const CVariant &value)
@@ -193,7 +193,7 @@ void CGUIWindowSlideShow::AnnouncePropertyChanged(const std::string &strProperty
CVariant data;
data["player"]["playerid"] = PLAYLIST_PICTURE;
data["property"][strProperty] = value;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPropertyChanged", data);
}
bool CGUIWindowSlideShow::IsPlaying() const
@@ -1226,7 +1226,7 @@ void CGUIWindowSlideShow::RunSlideShow(const std::string &strPath,
CVariant param;
param["player"]["speed"] = 0;
param["player"]["playerid"] = PLAYLIST_PICTURE;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", GetCurrentSlide(), param);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Player, "xbmc", "OnPlay", GetCurrentSlide(), param);
}
CServiceBroker::GetGUI()->GetWindowManager().ActivateWindow(WINDOW_SLIDESHOW);
diff --git a/xbmc/platform/android/activity/XBMCApp.cpp b/xbmc/platform/android/activity/XBMCApp.cpp
index 2a9aa71b84..a78196ef69 100644
--- a/xbmc/platform/android/activity/XBMCApp.cpp
+++ b/xbmc/platform/android/activity/XBMCApp.cpp
@@ -335,7 +335,7 @@ void CXBMCApp::onLostFocus()
void CXBMCApp::Initialize()
{
- g_application.m_ServiceManager->GetAnnouncementManager().AddAnnouncer(CXBMCApp::get());
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(CXBMCApp::get());
}
void CXBMCApp::Deinitialize()
diff --git a/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm b/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm
index 2d0a0b2d31..3bb46987d3 100644
--- a/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm
+++ b/xbmc/platform/darwin/ios-common/AnnounceReceiver.mm
@@ -190,12 +190,12 @@ CAnnounceReceiver *CAnnounceReceiver::GetInstance()
void CAnnounceReceiver::Initialize()
{
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().AddAnnouncer(GetInstance());
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(GetInstance());
}
void CAnnounceReceiver::DeInitialize()
{
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().RemoveAnnouncer(GetInstance());
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(GetInstance());
}
void CAnnounceReceiver::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
diff --git a/xbmc/playlists/PlayList.cpp b/xbmc/playlists/PlayList.cpp
index fb3e1c7e3c..8bdb7a217b 100644
--- a/xbmc/playlists/PlayList.cpp
+++ b/xbmc/playlists/PlayList.cpp
@@ -17,6 +17,7 @@
#include "utils/Variant.h"
#include "utils/StringUtils.h"
#include "interfaces/AnnouncementManager.h"
+#include "ServiceBroker.h"
#include <algorithm>
#include <cassert>
@@ -48,7 +49,7 @@ void CPlayList::AnnounceRemove(int pos)
CVariant data;
data["playlistid"] = m_id;
data["position"] = pos;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnRemove", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnRemove", data);
}
void CPlayList::AnnounceClear()
@@ -58,7 +59,7 @@ void CPlayList::AnnounceClear()
CVariant data;
data["playlistid"] = m_id;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnClear", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnClear", data);
}
void CPlayList::AnnounceAdd(const CFileItemPtr& item, int pos)
@@ -69,7 +70,7 @@ void CPlayList::AnnounceAdd(const CFileItemPtr& item, int pos)
CVariant data;
data["playlistid"] = m_id;
data["position"] = pos;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnAdd", item, data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::Playlist, "xbmc", "OnAdd", item, data);
}
void CPlayList::Add(const CFileItemPtr &item, int iPosition, int iOrder)
diff --git a/xbmc/powermanagement/PowerManager.cpp b/xbmc/powermanagement/PowerManager.cpp
index 4220189f99..be972205f9 100644
--- a/xbmc/powermanagement/PowerManager.cpp
+++ b/xbmc/powermanagement/PowerManager.cpp
@@ -34,8 +34,6 @@
extern HWND g_hWnd;
#endif
-using namespace ANNOUNCEMENT;
-
CPowerManager::CPowerManager() = default;
CPowerManager::~CPowerManager() = default;
@@ -119,7 +117,7 @@ bool CPowerManager::Reboot()
if (success)
{
- CAnnouncementManager::GetInstance().Announce(System, "xbmc", "OnRestart");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::System, "xbmc", "OnRestart");
CGUIDialogBusy* dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogBusy>(WINDOW_DIALOG_BUSY);
if (dialog)
@@ -164,7 +162,7 @@ void CPowerManager::ProcessEvents()
void CPowerManager::OnSleep()
{
- CAnnouncementManager::GetInstance().Announce(System, "xbmc", "OnSleep");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::System, "xbmc", "OnSleep");
CGUIDialogBusy* dialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogBusy>(WINDOW_DIALOG_BUSY);
if (dialog)
@@ -211,7 +209,7 @@ void CPowerManager::OnWake()
CServiceBroker::GetPVRManager().OnWake();
RestorePlayerState();
- CAnnouncementManager::GetInstance().Announce(System, "xbmc", "OnWake");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::System, "xbmc", "OnWake");
}
void CPowerManager::OnLowBattery()
@@ -220,7 +218,7 @@ void CPowerManager::OnLowBattery()
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(13050), "");
- CAnnouncementManager::GetInstance().Announce(System, "xbmc", "OnLowBattery");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::System, "xbmc", "OnLowBattery");
}
void CPowerManager::StorePlayerState()
diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp
index ba035b3915..947ce39f2c 100644
--- a/xbmc/pvr/PVRManager.cpp
+++ b/xbmc/pvr/PVRManager.cpp
@@ -37,7 +37,6 @@
#include "pvr/timers/PVRTimers.h"
using namespace PVR;
-using namespace ANNOUNCEMENT;
using namespace KODI::MESSAGING;
CPVRManagerJobQueue::CPVRManagerJobQueue()
@@ -134,16 +133,16 @@ CPVRManager::CPVRManager(void) :
CSettings::SETTING_PVRPARENTAL_DURATION
})
{
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
CPVRManager::~CPVRManager(void)
{
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
CLog::LogFC(LOGDEBUG, LOGPVR, "PVR Manager instance destroyed");
}
-void CPVRManager::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CPVRManager::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
if (!IsStarted())
return;
diff --git a/xbmc/utils/SaveFileStateJob.cpp b/xbmc/utils/SaveFileStateJob.cpp
index 4bde9d07a6..6617769c89 100644
--- a/xbmc/utils/SaveFileStateJob.cpp
+++ b/xbmc/utils/SaveFileStateJob.cpp
@@ -100,7 +100,7 @@ void CSaveFileState::DoWork(CFileItem& item,
CVariant data;
data["id"] = item.GetVideoInfoTag()->m_iDbId;
data["type"] = item.GetVideoInfoTag()->m_type;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
}
}
}
@@ -124,7 +124,7 @@ void CSaveFileState::DoWork(CFileItem& item,
CVariant data;
data["id"] = item.GetVideoInfoTag()->m_iDbId;
data["type"] = item.GetVideoInfoTag()->m_type;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
}
updateListing = true;
@@ -191,7 +191,7 @@ void CSaveFileState::DoWork(CFileItem& item,
CVariant data;
data["id"] = item.GetMusicInfoTag()->GetDatabaseId();
data["type"] = item.GetMusicInfoTag()->GetType();
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnUpdate", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::AudioLibrary, "xbmc", "OnUpdate", data);
}
}
}
diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp
index 0943234f08..911c72dd79 100644
--- a/xbmc/video/VideoDatabase.cpp
+++ b/xbmc/video/VideoDatabase.cpp
@@ -5541,7 +5541,7 @@ void CVideoDatabase::SetPlayCount(const CFileItem &item, int count, const CDateT
// Only provide the "playcount" value if it has actually changed
if (item.GetVideoInfoTag()->GetPlayCount() != count)
data["playcount"] = count;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", CFileItemPtr(new CFileItem(item)), data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", CFileItemPtr(new CFileItem(item)), data);
}
}
catch (...)
@@ -8502,7 +8502,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const st
unsigned int time = XbmcThreads::SystemClockMillis();
CLog::Log(LOGNOTICE, "%s: Starting videodatabase cleanup ..", __FUNCTION__);
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanStarted");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanStarted");
BeginTransaction();
@@ -8593,7 +8593,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const st
{
progress->Close();
m_pDS2->close();
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanFinished");
return;
}
}
@@ -8834,7 +8834,7 @@ void CVideoDatabase::CleanDatabase(CGUIDialogProgressBarHandle* handle, const st
if (progress)
progress->Close();
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnCleanFinished");
}
std::vector<int> CVideoDatabase::CleanMediaType(const std::string &mediaType, const std::string &cleanableFileIDs,
@@ -9494,7 +9494,7 @@ void CVideoDatabase::ExportToXML(const std::string &path, bool singleFile /* = t
if (iFailCount > 0)
data["failcount"] = iFailCount;
}
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnExport", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnExport", data);
}
catch (...)
{
@@ -9885,7 +9885,7 @@ void CVideoDatabase::AnnounceRemove(std::string content, int id, bool scanning /
data["id"] = id;
if (scanning)
data["transaction"] = true;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnRemove", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnRemove", data);
}
void CVideoDatabase::AnnounceUpdate(std::string content, int id)
@@ -9893,7 +9893,7 @@ void CVideoDatabase::AnnounceUpdate(std::string content, int id)
CVariant data;
data["type"] = content;
data["id"] = id;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", data);
}
bool CVideoDatabase::GetItemsForPath(const std::string &content, const std::string &strPath, CFileItemList &items)
diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp
index 36de966cd9..ed1ae2a5ca 100644
--- a/xbmc/video/VideoInfoScanner.cpp
+++ b/xbmc/video/VideoInfoScanner.cpp
@@ -104,7 +104,7 @@ namespace VIDEO
m_bCanInterrupt = true;
CLog::Log(LOGNOTICE, "VideoInfoScanner: Starting scan ..");
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnScanStarted");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnScanStarted");
// Database operations should not be canceled
// using Interrupt() while scanning as it could
@@ -163,7 +163,7 @@ namespace VIDEO
}
m_bRunning = false;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnScanFinished");
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnScanFinished");
if (m_handle)
m_handle->MarkFinished();
@@ -1401,7 +1401,7 @@ namespace VIDEO
data["added"] = true;
if (m_bRunning)
data["transaction"] = true;
- ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", itemCopy, data);
+ CServiceBroker::GetAnnouncementManager()->Announce(ANNOUNCEMENT::VideoLibrary, "xbmc", "OnUpdate", itemCopy, data);
return lResult;
}
diff --git a/xbmc/windowing/win10/WinEventsWin10.cpp b/xbmc/windowing/win10/WinEventsWin10.cpp
index 3f56747670..60ef2286eb 100644
--- a/xbmc/windowing/win10/WinEventsWin10.cpp
+++ b/xbmc/windowing/win10/WinEventsWin10.cpp
@@ -42,7 +42,6 @@ using namespace winrt::Windows::UI::Core;
using namespace winrt::Windows::UI::Input;
using namespace winrt::Windows::UI::ViewManagement;
-using namespace ANNOUNCEMENT;
using namespace PERIPHERALS;
using namespace KODI::MESSAGING;
@@ -153,7 +152,7 @@ void CWinEventsWin10::InitEventHandlers(const CoreWindow& window)
m_smtc.ButtonPressed(CWinEventsWin10::OnSystemMediaButtonPressed);
}
m_smtc.IsEnabled(true);;
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
if (CSysInfo::GetWindowsDeviceFamily() == CSysInfo::WindowsDeviceFamily::Xbox)
{
@@ -594,9 +593,9 @@ void CWinEventsWin10::OnSystemMediaButtonPressed(const SystemMediaTransportContr
}
}
-void CWinEventsWin10::Announce(AnnouncementFlag flag, const char * sender, const char * message, const CVariant & data)
+void CWinEventsWin10::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char * sender, const char * message, const CVariant & data)
{
- if (flag & AnnouncementFlag::Player)
+ if (flag & ANNOUNCEMENT::Player)
{
double speed = 1.0;
if (data.isMember("player") && data["player"].isMember("speed"))
diff --git a/xbmc/windows/GUIWindowHome.cpp b/xbmc/windows/GUIWindowHome.cpp
index 79da3f17a4..d2d79a4e17 100644
--- a/xbmc/windows/GUIWindowHome.cpp
+++ b/xbmc/windows/GUIWindowHome.cpp
@@ -21,19 +21,17 @@
#include "ServiceBroker.h"
#include "utils/StringUtils.h"
-using namespace ANNOUNCEMENT;
-
CGUIWindowHome::CGUIWindowHome(void) : CGUIWindow(WINDOW_HOME, "Home.xml")
{
m_updateRA = (Audio | Video | Totals);
m_loadType = KEEP_IN_MEMORY;
- CAnnouncementManager::GetInstance().AddAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this);
}
CGUIWindowHome::~CGUIWindowHome(void)
{
- CAnnouncementManager::GetInstance().RemoveAnnouncer(this);
+ CServiceBroker::GetAnnouncementManager()->RemoveAnnouncer(this);
}
bool CGUIWindowHome::OnAction(const CAction &action)
@@ -61,14 +59,14 @@ void CGUIWindowHome::OnInitWindow()
CGUIWindow::OnInitWindow();
}
-void CGUIWindowHome::Announce(AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+void CGUIWindowHome::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
{
int ra_flag = 0;
CLog::Log(LOGDEBUG, "GOT ANNOUNCEMENT, type: %i, from %s, message %s",(int)flag, sender, message);
// we are only interested in library changes
- if ((flag & (VideoLibrary | AudioLibrary)) == 0)
+ if ((flag & (ANNOUNCEMENT::VideoLibrary | ANNOUNCEMENT::AudioLibrary)) == 0)
return;
if (data.isMember("transaction") && data["transaction"].asBoolean())
@@ -86,9 +84,9 @@ void CGUIWindowHome::Announce(AnnouncementFlag flag, const char *sender, const c
// always update the full list except on an OnUpdate
if (!onUpdate)
{
- if (flag & VideoLibrary)
+ if (flag & ANNOUNCEMENT::VideoLibrary)
ra_flag |= Video;
- else if (flag & AudioLibrary)
+ else if (flag & ANNOUNCEMENT::AudioLibrary)
ra_flag |= Audio;
}