[fix] another order dependnecy. This one required moving the instantiation of the...
authorJim Carroll <thecarrolls@jiminger.com>
Sun, 23 Dec 2012 16:06:20 +0000 (11:06 -0500)
committerJim Carroll <thecarrolls@jiminger.com>
Sun, 23 Dec 2012 16:06:20 +0000 (11:06 -0500)
17 files changed:
xbmc/Application.cpp
xbmc/Application.h
xbmc/GUIInfoManager.cpp
xbmc/SystemGlobals.cpp
xbmc/Util.cpp
xbmc/filesystem/DirectoryFactory.cpp
xbmc/filesystem/FileFactory.cpp
xbmc/guilib/GUIWindowManager.h
xbmc/interfaces/Builtins.cpp
xbmc/interfaces/legacy/ModuleXbmc.cpp
xbmc/music/MusicDatabase.cpp
xbmc/network/AirPlayServer.cpp
xbmc/network/AirTunesServer.cpp
xbmc/network/upnp/UPnPRenderer.cpp
xbmc/settings/GUISettings.cpp
xbmc/utils/RssReader.cpp
xbmc/utils/URIUtils.cpp

index 2db9d59..50b4b8f 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "threads/SystemClock.h"
 #include "system.h"
 #include "Application.h"
 #include "music/karaoke/GUIDialogKaraokeSongSelector.h"
 #include "music/karaoke/GUIWindowKaraokeLyrics.h"
 #endif
-#include "network/Network.h"
 #include "network/Zeroconf.h"
 #include "network/ZeroconfBrowser.h"
 #ifndef _LINUX
 #include "pictures/GUIDialogPictureInfo.h"
 #include "addons/GUIDialogAddonSettings.h"
 #include "addons/GUIDialogAddonInfo.h"
-#ifdef HAS_LINUX_NETWORK
-#include "network/GUIDialogAccessPoints.h"
-#endif
 
 /* PVR related include Files */
 #include "pvr/PVRManager.h"
@@ -386,6 +383,7 @@ CApplication::CApplication(void)
   , m_musicInfoScanner(new CMusicInfoScanner)
   , m_seekHandler(new CSeekHandler)
 {
+  m_network = NULL;
   TiXmlBase::SetCondenseWhiteSpace(false);
   m_iPlaySpeed = 1;
   m_bInhibitIdleShutdown = false;
@@ -466,6 +464,9 @@ CApplication::~CApplication(void)
   delete m_dpms;
   delete m_seekHandler;
   delete m_pInertialScrollingHandler;
+
+  if (m_network != NULL)
+     delete m_network;
 }
 
 bool CApplication::OnEvent(XBMC_Event& newEvent)
@@ -565,6 +566,14 @@ void CApplication::Preflight()
 
 bool CApplication::Create()
 {
+#if defined(HAS_LINUX_NETWORK)
+  m_network = new CNetworkLinux();
+#elif defined(HAS_WIN32_NETWORK)
+  m_network = new CNetworkWin32();
+#else
+  m_network = new CNetwork();
+#endif
+
   Preflight();
   g_settings.Initialize(); //Initialize default AdvancedSettings
 
@@ -637,7 +646,7 @@ bool CApplication::Create()
 
   CStdString executable = CUtil::ResolveExecutablePath();
   CLog::Log(LOGNOTICE, "The executable running is: %s", executable.c_str());
-  CLog::Log(LOGNOTICE, "Local hostname: %s", m_network.GetHostName().c_str());
+  CLog::Log(LOGNOTICE, "Local hostname: %s", m_network->GetHostName().c_str());
   CLog::Log(LOGNOTICE, "Log File is located: %sxbmc.log", g_settings.m_logFolder.c_str());
   CLog::Log(LOGNOTICE, "-----------------------------------------------------------------------");
 
@@ -1507,7 +1516,7 @@ bool CApplication::StartServer(enum ESERVERS eServer, bool bStart, bool bWait/*
 bool CApplication::StartWebServer()
 {
 #ifdef HAS_WEB_SERVER
-  if (g_guiSettings.GetBool("services.webserver") && m_network.IsAvailable())
+  if (g_guiSettings.GetBool("services.webserver") && m_network->IsAvailable())
   {
     int webPort = atoi(g_guiSettings.GetString("services.webserverport"));
     CLog::Log(LOGNOTICE, "Webserver: Starting...");
@@ -1563,7 +1572,7 @@ bool CApplication::StartAirplayServer()
 {
   bool ret = false;
 #ifdef HAS_AIRPLAY
-  if (g_guiSettings.GetBool("services.airplay") && m_network.IsAvailable())
+  if (g_guiSettings.GetBool("services.airplay") && m_network->IsAvailable())
   {
     int listenPort = g_advancedSettings.m_airPlayPort;
     CStdString password = g_guiSettings.GetString("services.airplaypassword");
@@ -1593,7 +1602,7 @@ bool CApplication::StartAirplayServer()
 #endif
   {
 #ifdef HAS_AIRTUNES
-    if (g_guiSettings.GetBool("services.airplay") && m_network.IsAvailable())
+    if (g_guiSettings.GetBool("services.airplay") && m_network->IsAvailable())
     {
       int listenPort = g_advancedSettings.m_airTunesPort;
       CStdString password = g_guiSettings.GetString("services.airplaypassword");
@@ -1856,7 +1865,7 @@ void CApplication::StartServices()
 
 void CApplication::StopServices()
 {
-  m_network.NetworkMessage(CNetwork::SERVICES_DOWN, 0);
+  m_network->NetworkMessage(CNetwork::SERVICES_DOWN, 0);
 
 #if !defined(_WIN32) && defined(HAS_DVD_DRIVE)
   CLog::Log(LOGNOTICE, "stop dvd detect media");
@@ -5855,23 +5864,10 @@ void CApplication::SetRenderGUI(bool renderGUI)
   m_renderGUI = renderGUI;
 }
 
-#if defined(HAS_LINUX_NETWORK)
-CNetworkLinux& CApplication::getNetwork()
-{
-  return m_network;
-}
-#elif defined(HAS_WIN32_NETWORK)
-CNetworkWin32& CApplication::getNetwork()
-{
-  return m_network;
-}
-#else
 CNetwork& CApplication::getNetwork()
 {
-  return m_network;
+  return *m_network;
 }
-
-#endif
 #ifdef HAS_PERFORMANCE_SAMPLE
 CPerformanceStats &CApplication::GetPerformanceStats()
 {
index 5a485ab..595b285 100644 (file)
@@ -26,6 +26,7 @@
 #include "guilib/IMsgTargetCallback.h"
 #include "guilib/Key.h"
 #include "threads/Condition.h"
+#include "utils/GlobalsHandling.h"
 
 #include <map>
 
@@ -53,7 +54,6 @@ namespace MEDIA_DETECT
 #include "win32/WIN32Util.h"
 #endif
 #include "utils/Stopwatch.h"
-#include "network/Network.h"
 #include "utils/CharsetConverter.h"
 #ifdef HAS_PERFORMANCE_SAMPLE
 #include "utils/PerformanceStats.h"
@@ -80,6 +80,9 @@ class CHTTPWebinterfaceHandler;
 class CHTTPWebinterfaceAddonsHandler;
 #endif
 #endif
+
+class CNetwork;
+
 namespace VIDEO
 {
   class CVideoInfoScanner;
@@ -262,13 +265,7 @@ public:
 
   static bool OnEvent(XBMC_Event& newEvent);
 
-#if defined(HAS_LINUX_NETWORK)
-  CNetworkLinux& getNetwork();
-#elif defined(HAS_WIN32_NETWORK)
-  CNetworkWin32& getNetwork();
-#else
   CNetwork& getNetwork();
-#endif
 #ifdef HAS_PERFORMANCE_SAMPLE
   CPerformanceStats &GetPerformanceStats();
 #endif
@@ -462,13 +459,7 @@ protected:
 
   CSeekHandler *m_seekHandler;
   CInertialScrollingHandler *m_pInertialScrollingHandler;
-#if defined(HAS_LINUX_NETWORK)
-  CNetworkLinux m_network;
-#elif defined(HAS_WIN32_NETWORK)
-  CNetworkWin32 m_network;
-#else
-  CNetwork    m_network;
-#endif
+  CNetwork    *m_network;
 #ifdef HAS_PERFORMANCE_SAMPLE
   CPerformanceStats m_perfStats;
 #endif
@@ -479,4 +470,5 @@ protected:
 
 };
 
-extern CApplication g_application;
+XBMC_GLOBAL_REF(CApplication,g_application);
+#define g_application XBMC_GLOBAL_USE(CApplication)
index 89053a1..a4098e0 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "system.h"
 #include "GUIInfoManager.h"
 #include "windows/GUIMediaWindow.h"
index 3c2be26..70d2394 100644 (file)
@@ -63,7 +63,6 @@
   CLocalizeStrings   g_localizeStrings;
   CLocalizeStrings   g_localizeStringsTemp;
 
-  CGUIWindowManager  g_windowManager;
   XFILE::CDirectoryCache g_directoryCache;
 
   CGUITextureManager g_TextureManager;
@@ -84,7 +83,6 @@
 #endif
   CAlarmClock        g_alarmClock;
   PLAYLIST::CPlayListPlayer g_playlistPlayer;
-  CApplication       g_application;
 
 #ifdef TARGET_RASPBERRY_PI
   CRBP               g_RBP;
index ddb0def..241bc9a 100644 (file)
@@ -17,6 +17,7 @@
  *  <http://www.gnu.org/licenses/>.
  *
  */
+#include "network/Network.h"
 #include "threads/SystemClock.h"
 #include "system.h"
 #if defined(TARGET_DARWIN)
index cb394f4..9fb2169 100644 (file)
@@ -21,6 +21,7 @@
 #if (defined HAVE_CONFIG_H) && (!defined WIN32)
   #include "config.h"
 #endif
+#include "network/Network.h"
 #include "system.h"
 #include "DirectoryFactory.h"
 #include "HDDirectory.h"
index 09482c7..a042d39 100644 (file)
@@ -22,6 +22,7 @@
 #if (defined HAVE_CONFIG_H) && (!defined WIN32)
   #include "config.h"
 #endif
+#include "network/Network.h"
 #include "system.h"
 #include "FileFactory.h"
 #include "HDFile.h"
index ebc2cb7..8b33150 100644 (file)
@@ -32,6 +32,7 @@
 #include "IWindowManagerCallback.h"
 #include "IMsgTargetCallback.h"
 #include "DirtyRegionTracker.h"
+#include "utils/GlobalsHandling.h"
 
 class CGUIDialog;
 
@@ -179,6 +180,7 @@ private:
  \ingroup winman
  \brief
  */
-extern CGUIWindowManager g_windowManager;
+XBMC_GLOBAL_REF(CGUIWindowManager,g_windowManager);
+#define g_windowManager XBMC_GLOBAL_USE(CGUIWindowManager)
 #endif
 
index 406e8c6..4d96064 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "system.h"
 #include "utils/AlarmClock.h"
 #include "utils/Screenshot.h"
index e03dc76..f995a2f 100644 (file)
@@ -24,6 +24,7 @@
 #if (defined HAVE_CONFIG_H) && (!defined WIN32)
   #include "config.h"
 #endif
+#include "network/Network.h"
 
 #include "ModuleXbmc.h"
 
index 3b12454..0b512a8 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "threads/SystemClock.h"
 #include "system.h"
 #include "MusicDatabase.h"
index 87fa043..fd7f755 100644 (file)
@@ -17,6 +17,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "network/Network.h"
 #include "AirPlayServer.h"
 
 #ifdef HAS_AIRPLAY
index fe5039c..8af8319 100644 (file)
@@ -17,6 +17,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "network/Network.h"
 #if !defined(TARGET_WINDOWS)
 #pragma GCC diagnostic ignored "-Wwrite-strings"
 #endif
index 70cc6c4..adde44c 100644 (file)
@@ -1,3 +1,4 @@
+#include "network/Network.h"
 #include "UPnPRenderer.h"
 #include "UPnP.h"
 #include "UPnPInternal.h"
index 1733789..6bc8dfe 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "GUISettings.h"
 #include <limits.h>
 #include <float.h>
index fb5aaad..10527b7 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "threads/SystemClock.h"
 #include "RssReader.h"
 #include "utils/HTMLUtil.h"
index 7e47894..e54c491 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "network/Network.h"
 #include "URIUtils.h"
 #include "Application.h"
 #include "FileItem.h"