Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote-tracking branch 'upstream/master' into dsplayer

  • Loading branch information...
commit c921ef3bf31a5c57a417b22fa3cfe81834a70806 2 parents c46dafe + e59aa6f
0wing authored
8 project/VS2010Express/VC90.CRT.x86.manifest
... ... @@ -1,8 +0,0 @@
1   -<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
2   -<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
3   - <dependency>
4   - <dependentAssembly>
5   - <assemblyIdentity type='win32' name='Microsoft.VC90.CRT' version='9.0.30729.1' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
6   - </dependentAssembly>
7   - </dependency>
8   -</assembly>
4 project/VS2010Express/XBMC.vcxproj
@@ -140,7 +140,6 @@
140 140 <TargetMachine>MachineX86</TargetMachine>
141 141 </Link>
142 142 <Manifest>
143   - <AdditionalManifestFiles>VC90.CRT.x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
144 143 <EnableDPIAwareness>true</EnableDPIAwareness>
145 144 </Manifest>
146 145 </ItemDefinitionGroup>
@@ -183,7 +182,6 @@
183 182 <TargetMachine>MachineX86</TargetMachine>
184 183 </Link>
185 184 <Manifest>
186   - <AdditionalManifestFiles>VC90.CRT.x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
187 185 <EnableDPIAwareness>true</EnableDPIAwareness>
188 186 </Manifest>
189 187 </ItemDefinitionGroup>
@@ -231,7 +229,6 @@
231 229 <TargetMachine>MachineX86</TargetMachine>
232 230 </Link>
233 231 <Manifest>
234   - <AdditionalManifestFiles>VC90.CRT.x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
235 232 <EnableDPIAwareness>true</EnableDPIAwareness>
236 233 </Manifest>
237 234 </ItemDefinitionGroup>
@@ -275,7 +272,6 @@
275 272 <TargetMachine>MachineX86</TargetMachine>
276 273 </Link>
277 274 <Manifest>
278   - <AdditionalManifestFiles>VC90.CRT.x86.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
279 275 <EnableDPIAwareness>true</EnableDPIAwareness>
280 276 </Manifest>
281 277 </ItemDefinitionGroup>
30 xbmc/cores/AudioRenderers/CoreAudioRenderer.cpp
@@ -25,7 +25,9 @@
25 25 #include <CoreServices/CoreServices.h>
26 26
27 27 #include "CoreAudioRenderer.h"
  28 +#include "Application.h"
28 29 #include "guilib/AudioContext.h"
  30 +#include "osx/CocoaInterface.h"
29 31 #include "settings/GUISettings.h"
30 32 #include "settings/Settings.h"
31 33 #include "settings/AdvancedSettings.h"
@@ -425,11 +427,15 @@ CCoreAudioRenderer::CCoreAudioRenderer() :
425 427 CLog::Log(LOGERROR, "CoreAudioRenderer::constructor: kAudioHardwarePropertyRunLoop error.");
426 428 }
427 429 }
  430 + AudioHardwareAddPropertyListener(kAudioHardwarePropertyDevices, PropertyListenerProc, this);
  431 + AudioHardwareAddPropertyListener(kAudioHardwarePropertyDefaultOutputDevice, PropertyListenerProc, this);
428 432 g_Windowing.Register(this);
429 433 }
430 434
431 435 CCoreAudioRenderer::~CCoreAudioRenderer()
432 436 {
  437 + AudioHardwareRemovePropertyListener(kAudioHardwarePropertyDevices, PropertyListenerProc);
  438 + AudioHardwareRemovePropertyListener(kAudioHardwarePropertyDefaultOutputDevice, PropertyListenerProc);
433 439 g_Windowing.Unregister(this);
434 440 Deinitialize();
435 441 }
@@ -450,6 +456,11 @@ bool CCoreAudioRenderer::Initialize(IAudioCallback* pCallback, const CStdString&
450 456 if (m_Initialized)
451 457 Deinitialize();
452 458
  459 + // Reset all the devices to a default 'non-hog' and mixable format.
  460 + // If we don't do this we may be unable to find the Default Output device.
  461 + // (e.g. if we crashed last time leaving it stuck in AC3/DTS/SPDIF mode)
  462 + Cocoa_ResetAudioDevices();
  463 +
453 464 if(bPassthrough)
454 465 g_audioContext.SetActiveDevice(CAudioContext::DIRECTSOUND_DEVICE_DIGITAL);
455 466 else
@@ -1173,6 +1184,25 @@ bool CCoreAudioRenderer::InitializeEncoded(AudioDeviceID outputDevice, UInt32 sa
1173 1184 return true;
1174 1185 }
1175 1186
  1187 +OSStatus CCoreAudioRenderer::PropertyListenerProc(AudioHardwarePropertyID property, void *data)
  1188 +{
  1189 + //CCoreAudioRenderer *m = (CCoreAudioRenderer*)data;
  1190 + switch(property)
  1191 + {
  1192 + // the device list changed
  1193 + case kAudioHardwarePropertyDevices:
  1194 + CLog::Log(LOGDEBUG, "CCoreAudioRenderer::PropertyListenerProc:kAudioHardwarePropertyDevices");
  1195 + break;
  1196 + case kAudioHardwarePropertyDefaultOutputDevice:
  1197 + CLog::Log(LOGDEBUG, "CCoreAudioRenderer::PropertyListenerProc:kAudioHardwarePropertyDefaultOutputDevice");
  1198 + break;
  1199 + default:
  1200 + break;
  1201 + }
  1202 +
  1203 + return 0;
  1204 +}
  1205 +
1176 1206 void CCoreAudioRenderer::OnLostDevice()
1177 1207 {
1178 1208 if (g_guiSettings.GetBool("videoplayer.adjustrefreshrate"))
2  xbmc/cores/AudioRenderers/CoreAudioRenderer.h
@@ -165,6 +165,8 @@ class CCoreAudioRenderer : public IAudioRenderer, public ICoreAudioSource, publi
165 165
166 166 bool CreateMixMap();
167 167
  168 + static OSStatus PropertyListenerProc(AudioHardwarePropertyID property, void *data);
  169 +
168 170 bool m_Pause;
169 171 bool m_Initialized; // Prevent multiple init/deinit
170 172
19 xbmc/filesystem/DllLibCurl.cpp
@@ -32,14 +32,14 @@ using namespace XCURL;
32 32
33 33 /* okey this is damn ugly. our dll loader doesn't allow for postload, preunload functions */
34 34 static long g_curlReferences = 0;
35   -static unsigned int g_curlTimeout = 0;
  35 +//static unsigned int g_curlTimeout = 0;
36 36
37 37 bool DllLibCurlGlobal::Load()
38 38 {
39 39 CSingleLock lock(m_critSection);
40 40 if(g_curlReferences > 0)
41 41 {
42   - g_curlReferences++;
  42 + //g_curlReferences++;
43 43 return true;
44 44 }
45 45
@@ -56,13 +56,16 @@ bool DllLibCurlGlobal::Load()
56 56 }
57 57
58 58 /* check idle will clean up the last one */
59   - g_curlReferences = 2;
  59 + //g_curlReferences = 2;
  60 + g_curlReferences = 1;
60 61
61 62 return true;
62 63 }
63 64
64 65 void DllLibCurlGlobal::Unload()
65 66 {
  67 + return;
  68 + /*
66 69 CSingleLock lock(m_critSection);
67 70 if (--g_curlReferences == 0)
68 71 {
@@ -75,19 +78,22 @@ void DllLibCurlGlobal::Unload()
75 78 DllDynamic::Unload();
76 79 }
77 80
78   - /* CheckIdle will clear this one up */
  81 + // CheckIdle will clear this one up
79 82 if(g_curlReferences == 1)
80 83 g_curlTimeout = XbmcThreads::SystemClockMillis();
  84 + */
81 85 }
82 86
83 87 void DllLibCurlGlobal::CheckIdle()
84 88 {
85 89 /* avoid locking section here, to avoid stalling gfx thread on loads*/
  90 + return;
  91 + /*
86 92 if(g_curlReferences == 0)
87 93 return;
88 94
89 95 CSingleLock lock(m_critSection);
90   - /* 20 seconds idle time before closing handle */
  96 + // 20 seconds idle time before closing handle
91 97 const unsigned int idletime = 30000;
92 98
93 99 VEC_CURLSESSIONS::iterator it = m_sessions.begin();
@@ -112,9 +118,10 @@ void DllLibCurlGlobal::CheckIdle()
112 118 it++;
113 119 }
114 120
115   - /* check if we should unload the dll */
  121 + // check if we should unload the dll
116 122 if(g_curlReferences == 1 && XbmcThreads::SystemClockMillis() - g_curlTimeout > idletime)
117 123 Unload();
  124 + */
118 125 }
119 126
120 127 void DllLibCurlGlobal::easy_aquire(const char *protocol, const char *hostname, CURL_HANDLE** easy_handle, CURLM** multi_handle)
2  xbmc/guilib/GUIAudioManager.cpp
@@ -72,7 +72,7 @@ void CGUIAudioManager::Initialize(int iDevice)
72 72 m_bInitialized = true;
73 73 #elif defined(HAS_SDL_AUDIO)
74 74 Mix_CloseAudio();
75   - if (Mix_OpenAudio(44100, AUDIO_S16, 2, 4096))
  75 + if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 4096))
76 76 CLog::Log(LOGERROR, "Unable to open audio mixer");
77 77 else
78 78 Mix_Volume(0, (int)(128.f * (g_settings.m_nVolumeLevel - VOLUME_MINIMUM) / (float)(VOLUME_MAXIMUM - VOLUME_MINIMUM)));
3  xbmc/osx/CocoaInterface.h
@@ -85,6 +85,9 @@ extern "C"
85 85 // http://developer.apple.com/mac/library/qa/qa2001/qa1134.html
86 86 OSStatus SendAppleEventToSystemProcess(AEEventID EventToSend);
87 87 #endif
  88 +
  89 + void Cocoa_ResetAudioDevices();
  90 +
88 91 #ifdef __cplusplus
89 92 }
90 93 #endif
174 xbmc/osx/CocoaInterface.mm
@@ -22,11 +22,18 @@
22 22 #import <unistd.h>
23 23 #import <sys/mount.h>
24 24
  25 +#define BOOL XBMC_BOOL
  26 +#include "utils/log.h"
  27 +#undef BOOL
  28 +
25 29 #import <Cocoa/Cocoa.h>
26 30 #import <QuartzCore/QuartzCore.h>
27 31 #import <Carbon/Carbon.h>
28 32 #import <OpenGL/OpenGL.h>
29 33 #import <OpenGL/gl.h>
  34 +#import <AudioUnit/AudioUnit.h>
  35 +#import <AudioToolbox/AudioToolbox.h>
  36 +#import <CoreServices/CoreServices.h>
30 37
31 38 #import "CocoaInterface.h"
32 39 #import "DllPaths_generated.h"
@@ -662,4 +669,171 @@ OSStatus SendAppleEventToSystemProcess(AEEventID EventToSend)
662 669
663 670 return(error);
664 671 }
  672 +
  673 +// All this just to reset all audio devices to default :)
  674 +static AudioStreamBasicDescription* FormatsAudioList(AudioStreamID s)
  675 +{
  676 + OSStatus ret;
  677 + UInt32 listSize;
  678 + AudioDevicePropertyID p;
  679 + AudioStreamBasicDescription *list;
  680 +
  681 + // This is deprecated for kAudioStreamPropertyAvailablePhysicalFormats,
  682 + // but compiling on 10.3 requires the older constant
  683 + p = kAudioStreamPropertyPhysicalFormats;
  684 +
  685 + // Retrieve all the stream formats supported by this output stream
  686 + ret = AudioStreamGetPropertyInfo(s, 0, p, &listSize, NULL);
  687 + if (ret != noErr)
  688 + {
  689 + CLog::Log(LOGERROR, "CCoreAudioHardware::FormatsList: "
  690 + "could not get list size: Error = 0x%08x",
  691 + (unsigned int)ret);
  692 + return NULL;
  693 + }
  694 +
  695 + // Space for a terminating ID:
  696 + listSize += sizeof(AudioStreamBasicDescription);
  697 + list = (AudioStreamBasicDescription *)malloc(listSize);
  698 +
  699 + if (list == NULL)
  700 + {
  701 + CLog::Log(LOGERROR, "CCoreAudioHardware::FormatsList(): out of memory?");
  702 + return NULL;
  703 + }
  704 +
  705 + ret = AudioStreamGetProperty(s, 0, p, &listSize, list);
  706 + if (ret != noErr)
  707 + {
  708 + CLog::Log(LOGERROR, "CCoreAudioHardware::FormatsList: "
  709 + "could not get list: Error = 0x%08x",
  710 + (unsigned int)ret);
  711 + free(list);
  712 + return NULL;
  713 + }
  714 +
  715 + // Add a terminating ID:
  716 + list[listSize/sizeof(AudioStreamID)].mFormatID = 0;
  717 +
  718 + return list;
  719 +}
  720 +
  721 +static void ResetAudioStream(AudioStreamID s)
  722 +{
  723 + OSStatus ret;
  724 + UInt32 paramSize;
  725 + AudioStreamBasicDescription currentFormat;
  726 +
  727 + // Find the streams current physical format
  728 + paramSize = sizeof(currentFormat);
  729 + AudioStreamGetProperty(s, 0,
  730 + kAudioStreamPropertyPhysicalFormat, &paramSize, &currentFormat);
  731 +
  732 + // If it's currently AC-3/SPDIF then reset it to some mixable format
  733 + if (currentFormat.mFormatID == 'IAC3' ||
  734 + currentFormat.mFormatID == kAudioFormat60958AC3)
  735 + {
  736 + bool streamReset = false;
  737 + AudioStreamBasicDescription *formats = FormatsAudioList(s);
  738 +
  739 + if (!formats)
  740 + return;
  741 +
  742 + for (int i = 0; !streamReset && formats[i].mFormatID != 0; i++)
  743 + {
  744 + if (formats[i].mFormatID == kAudioFormatLinearPCM)
  745 + {
  746 + ret = AudioStreamSetProperty(s, NULL, 0,
  747 + kAudioStreamPropertyPhysicalFormat, sizeof(formats[i]), &(formats[i]));
  748 + if (ret != noErr)
  749 + {
  750 + CLog::Log(LOGWARNING, "ResetAudioStream: "
  751 + "could not set physical format: Error = 0x%08x",
  752 + (unsigned int)ret);
  753 + continue;
  754 + }
  755 + else
  756 + {
  757 + streamReset = true;
  758 + sleep(1); // For the change to take effect
  759 + }
  760 + }
  761 + }
  762 + free(formats);
  763 + }
  764 +}
  765 +
  766 +static AudioStreamID* AudioStreamsList(AudioDeviceID d)
  767 +{
  768 + OSStatus ret;
  769 + UInt32 listSize;
  770 + AudioStreamID *list;
  771 +
  772 + ret = AudioDeviceGetPropertyInfo(d, 0, FALSE,
  773 + kAudioDevicePropertyStreams, &listSize, NULL);
  774 + if (ret != noErr)
  775 + {
  776 + CLog::Log(LOGERROR, "CCoreAudioHardware::StreamsList: "
  777 + "could not get list size: Error = 0x%08x",
  778 + (unsigned int)ret);
  779 + return NULL;
  780 + }
  781 +
  782 + // Space for a terminating ID:
  783 + listSize += sizeof(AudioStreamID);
  784 + list = (AudioStreamID *)malloc(listSize);
  785 +
  786 + if (list == NULL)
  787 + {
  788 + CLog::Log(LOGERROR, "CCoreAudioHardware::StreamsList(): out of memory?");
  789 + return NULL;
  790 + }
  791 +
  792 + ret = AudioDeviceGetProperty(d, 0, FALSE,
  793 + kAudioDevicePropertyStreams, &listSize, list);
  794 + if (ret != noErr)
  795 + {
  796 + CLog::Log(LOGERROR, "CCoreAudioHardware::StreamsList: "
  797 + "could not get list: Error = 0x%08x",
  798 + (unsigned int)ret);
  799 + return NULL;
  800 + }
  801 + // Add a terminating ID:
  802 + list[listSize/sizeof(AudioStreamID)] = kAudioHardwareBadStreamError;
  803 +
  804 + return list;
  805 +}
  806 +
  807 +void Cocoa_ResetAudioDevices()
  808 +{
  809 + // Reset any devices with an AC3/DTS/SPDIF stream back to a Linear PCM
  810 + // so that they can become a default output device
  811 + UInt32 size;
  812 + int numDevices;
  813 + AudioDeviceID *devices;
  814 +
  815 + AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &size, NULL);
  816 + devices = (AudioDeviceID*)malloc(size);
  817 + if (!devices)
  818 + {
  819 + CLog::Log(LOGERROR, "ResetAudioDevices: out of memory?");
  820 + return;
  821 + }
  822 + numDevices = size / sizeof(AudioDeviceID);
  823 + AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &size, devices);
  824 +
  825 + for (int i = 0; i < numDevices; i++)
  826 + {
  827 + AudioStreamID *streams;
  828 + streams = AudioStreamsList(devices[i]);
  829 + if (!streams)
  830 + continue;
  831 + for (int j = 0; streams[j] != kAudioHardwareBadStreamError; j++)
  832 + ResetAudioStream(streams[j]);
  833 +
  834 + free(streams);
  835 + }
  836 + free(devices);
  837 +}
  838 +
665 839 #endif
2  xbmc/osx/CoreAudio.cpp
@@ -218,7 +218,6 @@ const char* CCoreAudioChannelLayout::ChannelLayoutToString(AudioChannelLayout& l
218 218 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
219 219 // CCoreAudioHardware
220 220 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
221   -
222 221 AudioDeviceID CCoreAudioHardware::FindAudioDevice(CStdString searchName)
223 222 {
224 223 if (!searchName.length())
@@ -978,6 +977,7 @@ bool CCoreAudioStream::SetPhysicalFormat(AudioStreamBasicDescription* pDesc)
978 977 (unsigned int)m_StreamId, (unsigned int)ret, CONVERT_OSSTATUS(ret));
979 978 return false;
980 979 }
  980 + sleep(1); // For the change to take effect
981 981 return true;
982 982 }
983 983
3  xbmc/windowing/osx/WinSystemOSX.h
@@ -62,7 +62,7 @@ class CWinSystemOSX : public CWinSystemBase
62 62
63 63 virtual int GetNumScreens();
64 64
65   -
  65 + void CheckDisplayChanging(u_int32_t flags);
66 66 protected:
67 67 void* CreateWindowedContext(void* shareCtx);
68 68 void* CreateFullScreenContext(int screen_index, void* shareCtx);
@@ -72,7 +72,6 @@ class CWinSystemOSX : public CWinSystemBase
72 72 void FillInVideoModes();
73 73 bool FlushBuffer(void);
74 74
75   - void CheckDisplayChanging(u_int32_t flags);
76 75 static void DisplayReconfigured(CGDirectDisplayID display,
77 76 CGDisplayChangeSummaryFlags flags, void *userData);
78 77
49 xbmc/windowing/osx/WinSystemOSX.mm
@@ -44,6 +44,34 @@
44 44 #import <IOKit/graphics/IOGraphicsLib.h>
45 45 #import <Carbon/Carbon.h> // ShowMenuBar, HideMenuBar
46 46
  47 +//------------------------------------------------------------------------------------------
  48 +// special object-c class for handling a delayed display change callback.
  49 +@interface DelayedCheckDisplayChanging : NSObject
  50 +{
  51 + int m_flags;
  52 + void *m_userdata;
  53 +}
  54 ++ initWith: (int) flags userdata: (void*) userdata;
  55 +- (void) doDelayedCheckDisplayChanging;
  56 +@end
  57 +@implementation DelayedCheckDisplayChanging
  58 ++ initWith: (int) flags userdata: (void*) userdata;
  59 +{
  60 + DelayedCheckDisplayChanging *checkdisplay = [DelayedCheckDisplayChanging new];
  61 + checkdisplay->m_flags = flags;
  62 + checkdisplay->m_userdata = userdata;
  63 + return [checkdisplay autorelease];
  64 +}
  65 +- (void) doDelayedCheckDisplayChanging;
  66 +{
  67 + CWinSystemOSX *winsys = (CWinSystemOSX*)m_userdata;
  68 + if (!winsys)
  69 + return;
  70 + winsys->CheckDisplayChanging(m_flags);
  71 +}
  72 +@end
  73 +//------------------------------------------------------------------------------------------
  74 +
47 75
48 76 #define MAX_DISPLAYS 32
49 77 static NSWindow* blankingWindows[MAX_DISPLAYS];
@@ -936,6 +964,8 @@ CFDictionaryRef GetMode(int width, int height, double refreshrate, int screenIdx
936 964
937 965 bool CWinSystemOSX::SwitchToVideoMode(int width, int height, double refreshrate, int screenIdx)
938 966 {
  967 + // SwitchToVideoMode will not return until the display has actually switched over.
  968 + // This can take several seconds.
939 969 if( screenIdx >= GetNumScreens())
940 970 return false;
941 971
@@ -1203,11 +1233,13 @@ CFDictionaryRef GetMode(int width, int height, double refreshrate, int screenIdx
1203 1233 // tell any shared resources
1204 1234 if (flags & kCGDisplayBeginConfigurationFlag)
1205 1235 {
  1236 + CLog::Log(LOGDEBUG, "CWinSystemOSX::CheckDisplayChanging:OnLostDevice");
1206 1237 for (std::vector<IDispResource *>::iterator i = m_resources.begin(); i != m_resources.end(); i++)
1207 1238 (*i)->OnLostDevice();
1208 1239 }
1209 1240 if (flags & kCGDisplaySetModeFlag)
1210 1241 {
  1242 + CLog::Log(LOGDEBUG, "CWinSystemOSX::CheckDisplayChanging:OnResetDevice");
1211 1243 for (std::vector<IDispResource *>::iterator i = m_resources.begin(); i != m_resources.end(); i++)
1212 1244 (*i)->OnResetDevice();
1213 1245 }
@@ -1233,7 +1265,22 @@ CFDictionaryRef GetMode(int width, int height, double refreshrate, int screenIdx
1233 1265 {
1234 1266 // we only respond to changes on the display we are running on.
1235 1267 CSingleLock lock(winsys->m_resourceSection);
1236   - winsys->CheckDisplayChanging(flags);
  1268 + if (flags & kCGDisplayBeginConfigurationFlag)
  1269 + {
  1270 + CLog::Log(LOGDEBUG, "CWinSystemOSX::DisplayReconfigured:kCGDisplayBeginConfigurationFlag");
  1271 + winsys->CheckDisplayChanging(flags);
  1272 + }
  1273 + else if (flags & kCGDisplaySetModeFlag)
  1274 + {
  1275 + // spin out a delayed OnResetDevice, this gets complicated
  1276 + // because we need to use a NSTimer.
  1277 + CLog::Log(LOGDEBUG, "CWinSystemOSX::DisplayReconfigured:kCGDisplaySetModeFlag");
  1278 + DelayedCheckDisplayChanging *delayedCheckDisplayChanging;
  1279 + delayedCheckDisplayChanging = [DelayedCheckDisplayChanging initWith: flags userdata:winsys];
  1280 + // delayedCheckDisplayChanging will auto release after nstimer fires.
  1281 + [NSTimer scheduledTimerWithTimeInterval:1.0 target:delayedCheckDisplayChanging
  1282 + selector:@selector(doDelayedCheckDisplayChanging) userInfo:nil repeats:NO];
  1283 + }
1237 1284 }
1238 1285 }
1239 1286 }
39 xbmc/windows/GUIWindowWeather.cpp
@@ -152,6 +152,14 @@ void CGUIWindowWeather::UpdateLocations()
152 152
153 153 unsigned int iCurWeather = g_weatherManager.GetArea();
154 154
  155 + if (iCurWeather > m_maxLocation)
  156 + {
  157 + g_weatherManager.SetArea(m_maxLocation);
  158 + iCurWeather = m_maxLocation;
  159 + ClearProperties();
  160 + g_weatherManager.Refresh();
  161 + }
  162 +
155 163 for (unsigned int i = 1; i <= m_maxLocation; i++)
156 164 {
157 165 CStdString strLabel = g_weatherManager.GetLocation(i);
@@ -240,6 +248,7 @@ void CGUIWindowWeather::SetLocation(int loc)
240 248 // Avoid a settings write if old location == new location
241 249 if (g_weatherManager.GetArea() != loc)
242 250 {
  251 + ClearProperties();
243 252 g_weatherManager.SetArea(loc);
244 253 CStdString strLabel = g_weatherManager.GetLocation(loc);
245 254 int iPos = strLabel.ReverseFind(", ");
@@ -285,3 +294,33 @@ void CGUIWindowWeather::SetProperties()
285 294 SetProperty(day + "FanartCode", fanartcode);
286 295 }
287 296 }
  297 +
  298 +void CGUIWindowWeather::ClearProperties()
  299 +{
  300 + // Current weather
  301 + SetProperty("Location", "");
  302 + SetProperty("LocationIndex", "");
  303 + SetProperty("Updated", "");
  304 + SetProperty("Current.ConditionIcon", "");
  305 + SetProperty("Current.Condition", "");
  306 + SetProperty("Current.Temperature", "");
  307 + SetProperty("Current.FeelsLike", "");
  308 + SetProperty("Current.UVIndex", "");
  309 + SetProperty("Current.Wind", "");
  310 + SetProperty("Current.DewPoint", "");
  311 + SetProperty("Current.Humidity", "");
  312 + SetProperty("Current.FanartCode", "");
  313 +
  314 + // Future weather
  315 + CStdString day;
  316 + for (int i = 0; i < NUM_DAYS; i++)
  317 + {
  318 + day.Format("Day%i.", i);
  319 + SetProperty(day + "Title", "");
  320 + SetProperty(day + "HighTemp", "");
  321 + SetProperty(day + "LowTemp", "");
  322 + SetProperty(day + "Outlook", "");
  323 + SetProperty(day + "OutlookIcon", "");
  324 + SetProperty(day + "FanartCode", "");
  325 + }
  326 +}
1  xbmc/windows/GUIWindowWeather.h
@@ -38,6 +38,7 @@ class CGUIWindowWeather : public CGUIWindow
38 38 void UpdateButtons();
39 39 void UpdateLocations();
40 40 void SetProperties();
  41 + void ClearProperties();
41 42 void SetLocation(int loc);
42 43
43 44 unsigned int m_maxLocation;

0 comments on commit c921ef3

Please sign in to comment.
Something went wrong with that request. Please try again.