Merge pull request #2248 from Tolriq/compilationartist
authorSascha Montellese <sascha.montellese@gmail.com>
Thu, 7 Mar 2013 11:29:32 +0000 (03:29 -0800)
committerSascha Montellese <sascha.montellese@gmail.com>
Thu, 7 Mar 2013 11:29:32 +0000 (03:29 -0800)
jsonrpc: add compilationartist property to AudioLibrary.GetArtists

380 files changed:
Makefile.in
XBMC-ATV2.xcodeproj/project.pbxproj
XBMC-IOS.xcodeproj/project.pbxproj
XBMC.xcodeproj/project.pbxproj
addons/library.xbmc.addon/libXBMC_addon.h
addons/library.xbmc.gui/libXBMC_gui.h
addons/xbmc.pvr/addon.xml
configure.in
language/English/strings.po
lib/addons/library.xbmc.addon/libXBMC_addon.cpp
lib/addons/library.xbmc.gui/libXBMC_gui.cpp
lib/libcec/Makefile
lib/libdvd/libdvdread/src/dvd_reader.c
project/BuildDependencies/scripts/libcec_d.txt
project/VS2010Express/XBMC.vcxproj
project/VS2010Express/XBMC.vcxproj.filters
project/Win32BuildSetup/buildpvraddons.bat
system/keymaps/joystick.Microsoft.Xbox.360.Controller.xml
system/peripherals.xml
tools/android/depends/libcec/Makefile
tools/android/depends/xbmc-pvr-addons/Makefile
tools/android/packaging/xbmc/AndroidManifest.xml
tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java [new file with mode: 0644]
tools/darwin/depends/libcec/Makefile
tools/darwin/depends/xbmc-pvr-addons/Makefile
tools/darwin/packaging/xbmc-atv2/mkdeb-xbmc-atv2.sh
tools/darwin/packaging/xbmc-seatbeltunlock/f387cee7d7d302ec9e740632f44f1352.patch [new file with mode: 0644]
tools/darwin/packaging/xbmc-seatbeltunlock/mkdeb-xbmc-seatbeltunlock.sh
xbmc/AppParamParser.cpp [new file with mode: 0644]
xbmc/AppParamParser.h [new file with mode: 0644]
xbmc/Application.cpp
xbmc/Application.h
xbmc/ApplicationMessenger.cpp
xbmc/ApplicationMessenger.h
xbmc/Autorun.cpp
xbmc/DynamicDll.h
xbmc/Favourites.cpp
xbmc/Favourites.h
xbmc/FileItem.cpp
xbmc/FileItem.h
xbmc/GUIInfoManager.cpp
xbmc/GUIInfoManager.h
xbmc/GUIPassword.cpp
xbmc/Makefile.in
xbmc/NfoFile.cpp
xbmc/PasswordManager.cpp
xbmc/PlayListPlayer.cpp
xbmc/TextureCache.cpp
xbmc/TextureCacheJob.h
xbmc/URL.cpp
xbmc/Util.cpp
xbmc/addons/AddonCallbacks.h
xbmc/addons/AddonCallbacksAddon.cpp
xbmc/addons/AddonCallbacksAddon.h
xbmc/addons/AddonCallbacksGUI.cpp
xbmc/addons/AddonCallbacksGUI.h
xbmc/addons/AddonDll.h
xbmc/addons/AddonInstaller.cpp
xbmc/addons/DllAddon.h
xbmc/addons/Visualisation.cpp
xbmc/addons/Visualisation.h
xbmc/addons/include/xbmc_addon_dll.h
xbmc/addons/include/xbmc_pvr_dll.h
xbmc/addons/include/xbmc_pvr_types.h
xbmc/android/activity/AndroidFeatures.cpp
xbmc/android/activity/EventLoop.cpp
xbmc/android/activity/IActivityHandler.h
xbmc/android/activity/Intents.cpp [new file with mode: 0644]
xbmc/android/activity/Intents.h [new file with mode: 0644]
xbmc/android/activity/JNI.cpp [new file with mode: 0644]
xbmc/android/activity/JNIThreading.cpp [new file with mode: 0644]
xbmc/android/activity/JNIThreading.h [new file with mode: 0644]
xbmc/android/activity/Makefile.in
xbmc/android/activity/XBMCApp.cpp
xbmc/android/activity/XBMCApp.h
xbmc/android/activity/android_main.cpp
xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioMixMap.cpp
xbmc/cores/AudioEngine/Engines/CoreAudio/CoreAudioMixMap.h
xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
xbmc/cores/AudioEngine/Engines/SoftAE/SoftAEStream.cpp
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.h
xbmc/cores/AudioEngine/Sinks/AESinkNULL.cpp
xbmc/cores/AudioEngine/Sinks/AESinkNULL.h
xbmc/cores/AudioEngine/Utils/AEConvert.cpp
xbmc/cores/AudioEngine/Utils/AERingBuffer.h
xbmc/cores/DllLoader/exports/emu_msvcrt.cpp
xbmc/cores/IPlayer.h
xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
xbmc/cores/VideoRenderers/OverlayRendererGL.cpp
xbmc/cores/VideoRenderers/VideoShaders/YUV2RGBShader.cpp
xbmc/cores/amlplayer/AMLPlayer.cpp
xbmc/cores/amlplayer/AMLPlayer.h
xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlay.h
xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayImage.h
xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h
xbmc/cores/dvdplayer/DVDCodecs/Overlay/DVDOverlayText.h
xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h
xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
xbmc/cores/dvdplayer/DVDPlayer.cpp
xbmc/cores/dvdplayer/DVDPlayer.h
xbmc/cores/dvdplayer/DVDPlayerSubtitle.cpp
xbmc/cores/dvdplayer/DVDSubtitles/DVDSubtitleParser.h
xbmc/cores/dvdplayer/Edl.cpp
xbmc/cores/dvdplayer/Edl.h
xbmc/cores/omxplayer/DllOMX.h [deleted file]
xbmc/cores/omxplayer/OMXPlayer.cpp
xbmc/cores/omxplayer/OMXPlayer.h
xbmc/cores/omxplayer/OMXPlayerAudio.cpp
xbmc/cores/omxplayer/OMXPlayerAudio.h
xbmc/cores/omxplayer/OMXPlayerVideo.cpp
xbmc/cores/omxplayer/OMXPlayerVideo.h
xbmc/cores/omxplayer/OMXVideo.cpp
xbmc/cores/omxplayer/OMXVideo.h
xbmc/cores/paplayer/CodecFactory.cpp
xbmc/cores/paplayer/MP3codec.cpp
xbmc/cores/paplayer/PAPlayer.cpp
xbmc/cores/paplayer/PAPlayer.h
xbmc/cores/playercorefactory/PlayerCoreFactory.cpp
xbmc/cores/playercorefactory/PlayerCoreFactory.h
xbmc/cores/playercorefactory/PlayerSelectionRule.cpp
xbmc/cores/playercorefactory/PlayerSelectionRule.h
xbmc/dialogs/GUIDialogCache.cpp
xbmc/dialogs/GUIDialogContextMenu.cpp
xbmc/dialogs/GUIDialogMediaFilter.h
xbmc/filesystem/CacheStrategy.cpp
xbmc/filesystem/CircularCache.cpp
xbmc/filesystem/CircularCache.h
xbmc/filesystem/CurlFile.cpp
xbmc/filesystem/CurlFile.h
xbmc/filesystem/DAVDirectory.cpp
xbmc/filesystem/DirectoryFactory.cpp
xbmc/filesystem/FTPDirectory.cpp
xbmc/filesystem/FileFactory.cpp
xbmc/filesystem/LastFMDirectory.cpp [deleted file]
xbmc/filesystem/LastFMDirectory.h [deleted file]
xbmc/filesystem/LastFMFile.cpp [deleted file]
xbmc/filesystem/LastFMFile.h [deleted file]
xbmc/filesystem/Makefile.in
xbmc/filesystem/ShoutcastFile.cpp
xbmc/filesystem/SourcesDirectory.cpp
xbmc/filesystem/VTPSession.cpp
xbmc/guilib/GUIControlFactory.cpp
xbmc/guilib/GUIFontTTF.cpp
xbmc/guilib/GUIFontTTFDX.cpp
xbmc/guilib/GUIFontTTFGL.cpp
xbmc/guilib/GUIKeyboardFactory.cpp
xbmc/guilib/GUIRenderingControl.cpp
xbmc/guilib/GUIRenderingControl.h
xbmc/guilib/GUITextureD3D.cpp
xbmc/guilib/GUITextureGL.cpp
xbmc/guilib/GUIVisualisationControl.cpp
xbmc/guilib/GUIVisualisationControl.h
xbmc/guilib/GUIWindowManager.cpp
xbmc/guilib/GUIWindowManager.h
xbmc/guilib/IRenderingCallback.h [new file with mode: 0644]
xbmc/guilib/JpegIO.cpp
xbmc/guilib/TextureGL.cpp
xbmc/guilib/cximage.cpp
xbmc/input/ButtonTranslator.cpp
xbmc/interfaces/AnnouncementManager.cpp
xbmc/interfaces/Builtins.cpp
xbmc/interfaces/json-rpc/AddonsOperations.cpp
xbmc/interfaces/json-rpc/AudioLibrary.cpp
xbmc/interfaces/json-rpc/FileItemHandler.cpp
xbmc/interfaces/json-rpc/FileOperations.cpp
xbmc/interfaces/json-rpc/PlayerOperations.cpp
xbmc/interfaces/json-rpc/ServiceDescription.h
xbmc/interfaces/json-rpc/VideoLibrary.cpp
xbmc/interfaces/json-rpc/methods.json
xbmc/interfaces/json-rpc/types.json
xbmc/interfaces/legacy/ListItem.cpp
xbmc/interfaces/legacy/Player.cpp
xbmc/linux/XFileUtils.cpp
xbmc/main/main.cpp
xbmc/music/GUIViewStateMusic.cpp
xbmc/music/GUIViewStateMusic.h
xbmc/music/LastFmManager.cpp [deleted file]
xbmc/music/LastFmManager.h [deleted file]
xbmc/music/Makefile
xbmc/music/MusicDatabase.cpp
xbmc/music/dialogs/GUIDialogMusicInfo.cpp
xbmc/music/windows/GUIWindowMusicBase.cpp
xbmc/music/windows/GUIWindowMusicNav.cpp
xbmc/music/windows/GUIWindowMusicPlaylist.cpp
xbmc/music/windows/GUIWindowMusicSongs.cpp
xbmc/network/AirPlayServer.cpp
xbmc/network/AirTunesServer.cpp
xbmc/network/Network.cpp
xbmc/network/TCPServer.cpp
xbmc/network/WebServer.cpp
xbmc/network/libscrobbler/Makefile [deleted file]
xbmc/network/libscrobbler/errors.h [deleted file]
xbmc/network/libscrobbler/lastfmscrobbler.cpp [deleted file]
xbmc/network/libscrobbler/lastfmscrobbler.h [deleted file]
xbmc/network/libscrobbler/librefmscrobbler.cpp [deleted file]
xbmc/network/libscrobbler/librefmscrobbler.h [deleted file]
xbmc/network/libscrobbler/scrobbler.cpp [deleted file]
xbmc/network/libscrobbler/scrobbler.h [deleted file]
xbmc/network/linux/NetworkLinux.cpp
xbmc/network/upnp/Makefile.in
xbmc/network/upnp/UPnP.cpp
xbmc/network/upnp/UPnPPlayer.cpp
xbmc/network/upnp/UPnPSettings.cpp [new file with mode: 0644]
xbmc/network/upnp/UPnPSettings.h [new file with mode: 0644]
xbmc/network/websocket/WebSocket.cpp
xbmc/network/websocket/WebSocket.h
xbmc/osx/DarwinUtils.mm
xbmc/osx/IOSScreenManager.mm
xbmc/osx/atv2/XBMCATV2-Info.plist
xbmc/osx/atv2/XBMCAppliance.h
xbmc/osx/atv2/XBMCAppliance.m [deleted file]
xbmc/osx/atv2/XBMCAppliance.mm [new file with mode: 0644]
xbmc/osx/atv2/XBMCController.h
xbmc/osx/atv2/XBMCController.mm
xbmc/osx/atv2/substrate.h [new file with mode: 0644]
xbmc/osx/ios/IOSKeyboardView.h
xbmc/osx/ios/IOSKeyboardView.mm
xbmc/osx/ios/XBMCController.mm
xbmc/peripherals/PeripheralTypes.h
xbmc/peripherals/Peripherals.cpp
xbmc/peripherals/Peripherals.h
xbmc/peripherals/bus/Makefile.in
xbmc/peripherals/bus/PeripheralBus.cpp
xbmc/peripherals/bus/PeripheralBus.h
xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp [deleted file]
xbmc/peripherals/bus/linux/PeripheralBusRPi.h [deleted file]
xbmc/peripherals/bus/linux/PeripheralBusUSBLibUSB.cpp
xbmc/peripherals/bus/linux/PeripheralBusUSBLibUdev.cpp
xbmc/peripherals/bus/osx/PeripheralBusUSB.cpp
xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp [new file with mode: 0644]
xbmc/peripherals/bus/virtual/PeripheralBusCEC.h [new file with mode: 0644]
xbmc/peripherals/bus/win32/PeripheralBusUSB.cpp
xbmc/peripherals/devices/Peripheral.cpp
xbmc/peripherals/devices/Peripheral.h
xbmc/peripherals/devices/PeripheralBluetooth.cpp
xbmc/peripherals/devices/PeripheralBluetooth.h
xbmc/peripherals/devices/PeripheralCecAdapter.cpp
xbmc/peripherals/devices/PeripheralCecAdapter.h
xbmc/peripherals/devices/PeripheralDisk.cpp
xbmc/peripherals/devices/PeripheralDisk.h
xbmc/peripherals/devices/PeripheralHID.cpp
xbmc/peripherals/devices/PeripheralHID.h
xbmc/peripherals/devices/PeripheralImon.cpp
xbmc/peripherals/devices/PeripheralImon.h
xbmc/peripherals/devices/PeripheralNIC.cpp
xbmc/peripherals/devices/PeripheralNIC.h
xbmc/peripherals/devices/PeripheralNyxboard.cpp
xbmc/peripherals/devices/PeripheralNyxboard.h
xbmc/peripherals/devices/PeripheralTuner.cpp
xbmc/peripherals/devices/PeripheralTuner.h
xbmc/peripherals/dialogs/GUIDialogPeripheralSettings.h
xbmc/pictures/PictureInfoTag.cpp
xbmc/pictures/PictureInfoTag.h
xbmc/playlists/PlayList.cpp
xbmc/playlists/PlayListFactory.cpp
xbmc/pvr/addons/PVRClient.cpp
xbmc/pvr/addons/PVRClient.h
xbmc/pvr/addons/PVRClients.cpp
xbmc/pvr/addons/PVRClients.h
xbmc/pvr/channels/PVRChannel.cpp
xbmc/pvr/dialogs/GUIDialogPVRTimerSettings.h
xbmc/pvr/recordings/PVRRecording.cpp
xbmc/pvr/recordings/PVRRecording.h
xbmc/pvr/windows/GUIWindowPVR.cpp
xbmc/rendering/dx/GUIWindowTestPatternDX.h
xbmc/rendering/gl/GUIWindowTestPatternGL.h
xbmc/screensavers/rsxs-0.9/src/euphoria/euphoria.cc
xbmc/screensavers/rsxs-0.9/src/plasma/plasma.cc
xbmc/screensavers/rsxs-0.9/src/solarwinds/solarwinds.cc
xbmc/settings/AdvancedSettings.cpp
xbmc/settings/AdvancedSettings.h
xbmc/settings/AppParamParser.cpp [deleted file]
xbmc/settings/AppParamParser.h [deleted file]
xbmc/settings/GUIDialogContentSettings.cpp [deleted file]
xbmc/settings/GUIDialogContentSettings.h [deleted file]
xbmc/settings/GUIDialogLockSettings.cpp [deleted file]
xbmc/settings/GUIDialogLockSettings.h [deleted file]
xbmc/settings/GUIDialogProfileSettings.cpp [deleted file]
xbmc/settings/GUIDialogProfileSettings.h [deleted file]
xbmc/settings/GUIDialogSettings.cpp [deleted file]
xbmc/settings/GUIDialogSettings.h [deleted file]
xbmc/settings/GUISettings.cpp
xbmc/settings/GUIWindowSettings.cpp [deleted file]
xbmc/settings/GUIWindowSettings.h [deleted file]
xbmc/settings/GUIWindowSettingsCategory.cpp [deleted file]
xbmc/settings/GUIWindowSettingsCategory.h [deleted file]
xbmc/settings/GUIWindowSettingsProfile.cpp [deleted file]
xbmc/settings/GUIWindowSettingsProfile.h [deleted file]
xbmc/settings/GUIWindowSettingsScreenCalibration.cpp [deleted file]
xbmc/settings/GUIWindowSettingsScreenCalibration.h [deleted file]
xbmc/settings/GUIWindowTestPattern.cpp [deleted file]
xbmc/settings/GUIWindowTestPattern.h [deleted file]
xbmc/settings/Makefile
xbmc/settings/Settings.cpp
xbmc/settings/Settings.h
xbmc/settings/SettingsControls.cpp [deleted file]
xbmc/settings/SettingsControls.h [deleted file]
xbmc/settings/dialogs/GUIDialogContentSettings.cpp [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogContentSettings.h [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogLockSettings.cpp [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogLockSettings.h [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogProfileSettings.cpp [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogProfileSettings.h [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogSettings.cpp [new file with mode: 0644]
xbmc/settings/dialogs/GUIDialogSettings.h [new file with mode: 0644]
xbmc/settings/dialogs/Makefile [new file with mode: 0644]
xbmc/settings/windows/GUISettingControls.cpp [new file with mode: 0644]
xbmc/settings/windows/GUISettingControls.h [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettings.cpp [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettings.h [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettingsCategory.cpp [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettingsCategory.h [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettingsProfile.cpp [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettingsProfile.h [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp [new file with mode: 0644]
xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h [new file with mode: 0644]
xbmc/settings/windows/GUIWindowTestPattern.cpp [new file with mode: 0644]
xbmc/settings/windows/GUIWindowTestPattern.h [new file with mode: 0644]
xbmc/settings/windows/Makefile [new file with mode: 0644]
xbmc/storage/cdioSupport.cpp
xbmc/threads/platform/pthreads/ThreadImpl.cpp
xbmc/utils/BitstreamConverter.cpp
xbmc/utils/CharsetConverter.cpp
xbmc/utils/Job.h
xbmc/utils/JobManager.cpp
xbmc/utils/JobManager.h
xbmc/utils/SaveFileStateJob.h
xbmc/utils/StreamDetails.cpp
xbmc/utils/StreamDetails.h
xbmc/utils/StringUtils.cpp
xbmc/utils/StringUtils.h
xbmc/utils/TuxBoxUtil.cpp
xbmc/utils/URIUtils.cpp
xbmc/utils/URIUtils.h
xbmc/utils/XMLUtils.cpp
xbmc/utils/XMLUtils.h
xbmc/utils/test/TestStringUtils.cpp
xbmc/utils/test/TestURIUtils.cpp
xbmc/video/VideoDatabase.cpp
xbmc/video/VideoDatabase.h
xbmc/video/VideoThumbLoader.cpp
xbmc/video/VideoThumbLoader.h
xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.h
xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp
xbmc/video/dialogs/GUIDialogVideoInfo.cpp
xbmc/video/dialogs/GUIDialogVideoSettings.h
xbmc/video/windows/GUIWindowFullScreen.cpp
xbmc/video/windows/GUIWindowVideoBase.cpp
xbmc/video/windows/GUIWindowVideoNav.cpp
xbmc/video/windows/GUIWindowVideoPlaylist.cpp
xbmc/view/GUIViewState.cpp
xbmc/visualizations/DirectXSpectrum/directx_spectrum.cpp
xbmc/visualizations/Goom/Main.cpp
xbmc/visualizations/Milkdrop/MilkdropXBMC.cpp
xbmc/visualizations/OpenGLSpectrum/opengl_spectrum.cpp
xbmc/visualizations/Vortex/VortexXBMC/VortexXBMC.cpp
xbmc/visualizations/WaveForm/Main.cpp
xbmc/visualizations/WaveForm/Main_gles.cpp
xbmc/visualizations/XBMCProjectM/Main.cpp
xbmc/visualizations/XBMCProjectM/libprojectM/Parser.cpp
xbmc/visualizations/fishBMC/fishbmc_addon.cpp
xbmc/win32/WIN32Util.cpp
xbmc/win32/XBMC_PC.cpp
xbmc/windowing/WinSystem.cpp
xbmc/windowing/WinSystem.h
xbmc/windowing/android/WinEventsAndroid.cpp
xbmc/windowing/android/WinEventsAndroid.h
xbmc/windowing/egl/WinSystemEGL.cpp
xbmc/windowing/egl/WinSystemEGL.h
xbmc/windowing/osx/WinEventsIOS.mm
xbmc/windows/GUIMediaWindow.cpp
xbmc/windows/GUIWindowFileManager.cpp
xbmc/windows/GUIWindowLoginScreen.cpp

index b3dd4df..c7ae87c 100644 (file)
@@ -58,7 +58,6 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \
                    xbmc/music/music.a \
                    xbmc/music/tags/musictags.a \
                    xbmc/music/windows/musicwindows.a \
-                   xbmc/network/libscrobbler/scrobbler.a \
                    xbmc/network/websocket/websocket.a \
                    xbmc/network/network.a \
                    xbmc/peripherals/bus/peripheral-bus.a \
@@ -78,6 +77,8 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \
                    xbmc/pvr/windows/pvrwindows.a \
                    xbmc/rendering/rendering.a \
                    xbmc/settings/settings.a \
+                   xbmc/settings/dialogs/settings_dialogs.a \
+                   xbmc/settings/windows/settings_windows.a \
                    xbmc/storage/storage.a \
                    xbmc/utils/utils.a \
                    xbmc/video/dialogs/videodialogs.a \
index c3466be..3aca038 100644 (file)
@@ -29,7 +29,6 @@
                36A95DB41624898700727135 /* GUIDialogMediaFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A95DB21624898700727135 /* GUIDialogMediaFilter.cpp */; };
                4D5D2E131301753F006ABC13 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D5D2E121301753F006ABC13 /* CFNetwork.framework */; };
                5500731516A75A2700097786 /* UPnPPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5500731316A75A2700097786 /* UPnPPlayer.cpp */; };
-               7C0A7ECD13A5DBF900AFC2BD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7ECB13A5DBF900AFC2BD /* AppParamParser.cpp */; };
                7C0A7FC813A9E75400AFC2BD /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FC413A9E75400AFC2BD /* DirtyRegionSolvers.cpp */; };
                7C0A7FC913A9E75400AFC2BD /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FC613A9E75400AFC2BD /* DirtyRegionTracker.cpp */; };
                7C0A7FCC13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FCA13A9E76E00AFC2BD /* GUIWindowDebugInfo.cpp */; };
                DF93D7781444B09C007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7481444B09C007C6459 /* FileReaderFile.cpp */; };
                DF93D7791444B09C007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D74A1444B09C007C6459 /* HDFile.cpp */; };
                DF93D77A1444B09C007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D74C1444B09C007C6459 /* ISOFile.cpp */; };
-               DF93D77B1444B09C007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D74E1444B09C007C6459 /* LastFMFile.cpp */; };
                DF93D77C1444B09C007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7501444B09C007C6459 /* MusicDatabaseFile.cpp */; };
                DF93D77D1444B09C007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7521444B09C007C6459 /* NFSFile.cpp */; };
                DF93D77E1444B09C007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7541444B09C007C6459 /* PipeFile.cpp */; };
                DFFEFBDB151606CB001294DC /* IOSScreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFEFBDA151606CB001294DC /* IOSScreenManager.mm */; };
                DFFEFC2215160927001294DC /* IOSExternalTouchController.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFEFC2115160927001294DC /* IOSExternalTouchController.mm */; };
                F54D9E8E12B71457006870F9 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F54D9E8D12B71457006870F9 /* CoreAudio.framework */; };
+               F563530316E5442F00D21BAD /* UPnPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530116E5442F00D21BAD /* UPnPSettings.cpp */; };
+               F563530F16E5446300D21BAD /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530716E5446300D21BAD /* GUIDialogContentSettings.cpp */; };
+               F563531016E5446300D21BAD /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530916E5446300D21BAD /* GUIDialogLockSettings.cpp */; };
+               F563531116E5446300D21BAD /* GUIDialogProfileSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530B16E5446300D21BAD /* GUIDialogProfileSettings.cpp */; };
+               F563531216E5446300D21BAD /* GUIDialogSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530D16E5446300D21BAD /* GUIDialogSettings.cpp */; };
+               F563531F16E5446C00D21BAD /* GUISettingControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531316E5446C00D21BAD /* GUISettingControls.cpp */; };
+               F563532016E5446C00D21BAD /* GUIWindowSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531516E5446C00D21BAD /* GUIWindowSettings.cpp */; };
+               F563532116E5446C00D21BAD /* GUIWindowSettingsCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531716E5446C00D21BAD /* GUIWindowSettingsCategory.cpp */; };
+               F563532216E5446C00D21BAD /* GUIWindowSettingsProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531916E5446C00D21BAD /* GUIWindowSettingsProfile.cpp */; };
+               F563532316E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531B16E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp */; };
+               F563532416E5446C00D21BAD /* GUIWindowTestPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531D16E5446C00D21BAD /* GUIWindowTestPattern.cpp */; };
+               F563532716E5447C00D21BAD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563532516E5447C00D21BAD /* AppParamParser.cpp */; };
                F56B15FB12CD6922009B4C96 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15FA12CD6922009B4C96 /* CoreVideo.framework */; };
                F56B15FD12CD6930009B4C96 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15FC12CD6930009B4C96 /* AudioToolbox.framework */; };
                F56B15FF12CD695C009B4C96 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15FE12CD695C009B4C96 /* CoreGraphics.framework */; };
                F56C79A0131EC154000AD0F6 /* IFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73FA131EC151000AD0F6 /* IFile.cpp */; };
                F56C79A1131EC154000AD0F6 /* iso9660.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73FD131EC151000AD0F6 /* iso9660.cpp */; };
                F56C79A2131EC154000AD0F6 /* ISO9660Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C73FF131EC151000AD0F6 /* ISO9660Directory.cpp */; };
-               F56C79A3131EC154000AD0F6 /* LastFMDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7401131EC151000AD0F6 /* LastFMDirectory.cpp */; };
                F56C79A4131EC154000AD0F6 /* MultiPathDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7403131EC151000AD0F6 /* MultiPathDirectory.cpp */; };
                F56C79A5131EC154000AD0F6 /* MultiPathFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7405131EC152000AD0F6 /* MultiPathFile.cpp */; };
                F56C79A6131EC154000AD0F6 /* DirectoryNodeSingles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7408131EC152000AD0F6 /* DirectoryNodeSingles.cpp */; };
                F56C7AB5131EC155000AD0F6 /* Album.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7639131EC153000AD0F6 /* Album.cpp */; };
                F56C7AB6131EC155000AD0F6 /* Artist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C763B131EC153000AD0F6 /* Artist.cpp */; };
                F56C7AB7131EC155000AD0F6 /* GUIViewStateMusic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C763D131EC153000AD0F6 /* GUIViewStateMusic.cpp */; };
-               F56C7AB8131EC155000AD0F6 /* LastFmManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C763F131EC153000AD0F6 /* LastFmManager.cpp */; };
                F56C7AB9131EC155000AD0F6 /* MusicDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7641131EC153000AD0F6 /* MusicDatabase.cpp */; };
                F56C7ABA131EC155000AD0F6 /* MusicInfoLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7643131EC153000AD0F6 /* MusicInfoLoader.cpp */; };
                F56C7ABB131EC155000AD0F6 /* Song.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7645131EC153000AD0F6 /* Song.cpp */; };
-               F56C7ABC131EC155000AD0F6 /* lastfmscrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C764A131EC153000AD0F6 /* lastfmscrobbler.cpp */; };
-               F56C7ABD131EC155000AD0F6 /* librefmscrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C764C131EC153000AD0F6 /* librefmscrobbler.cpp */; };
-               F56C7ABE131EC155000AD0F6 /* scrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C764E131EC153000AD0F6 /* scrobbler.cpp */; };
                F56C7ABF131EC155000AD0F6 /* NetworkLinux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7651131EC153000AD0F6 /* NetworkLinux.cpp */; };
                F56C7AC0131EC155000AD0F6 /* ZeroconfBrowserOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7654131EC153000AD0F6 /* ZeroconfBrowserOSX.cpp */; };
                F56C7AC1131EC155000AD0F6 /* ZeroconfOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C7656131EC153000AD0F6 /* ZeroconfOSX.cpp */; };
                F56C7AED131EC155000AD0F6 /* GUIViewStatePrograms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76B5131EC153000AD0F6 /* GUIViewStatePrograms.cpp */; };
                F56C7AEE131EC155000AD0F6 /* GUIWindowPrograms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76B7131EC153000AD0F6 /* GUIWindowPrograms.cpp */; };
                F56C7AF3131EC155000AD0F6 /* RenderSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76C3131EC153000AD0F6 /* RenderSystem.cpp */; };
-               F56C7AF4131EC155000AD0F6 /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76C7131EC153000AD0F6 /* GUIDialogContentSettings.cpp */; };
-               F56C7AF5131EC155000AD0F6 /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76C9131EC153000AD0F6 /* GUIDialogLockSettings.cpp */; };
-               F56C7AF6131EC155000AD0F6 /* GUIDialogProfileSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76CB131EC153000AD0F6 /* GUIDialogProfileSettings.cpp */; };
-               F56C7AF7131EC155000AD0F6 /* GUIDialogSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76CD131EC153000AD0F6 /* GUIDialogSettings.cpp */; };
-               F56C7AF8131EC155000AD0F6 /* GUIWindowTestPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76CF131EC153000AD0F6 /* GUIWindowTestPattern.cpp */; };
                F56C7AF9131EC155000AD0F6 /* GUISettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D1131EC153000AD0F6 /* GUISettings.cpp */; };
                F56C7AFA131EC155000AD0F6 /* AdvancedSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D3131EC153000AD0F6 /* AdvancedSettings.cpp */; };
-               F56C7AFB131EC155000AD0F6 /* GUIWindowSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D5131EC153000AD0F6 /* GUIWindowSettings.cpp */; };
-               F56C7AFC131EC155000AD0F6 /* GUIWindowSettingsCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D7131EC153000AD0F6 /* GUIWindowSettingsCategory.cpp */; };
-               F56C7AFD131EC155000AD0F6 /* GUIWindowSettingsProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D9131EC153000AD0F6 /* GUIWindowSettingsProfile.cpp */; };
-               F56C7AFE131EC155000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76DB131EC153000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp */; };
                F56C7AFF131EC155000AD0F6 /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76DD131EC153000AD0F6 /* Profile.cpp */; };
                F56C7B00131EC155000AD0F6 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76DF131EC153000AD0F6 /* Settings.cpp */; };
-               F56C7B01131EC155000AD0F6 /* SettingsControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76E1131EC153000AD0F6 /* SettingsControls.cpp */; };
                F56C7B02131EC155000AD0F6 /* VideoSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76E3131EC153000AD0F6 /* VideoSettings.cpp */; };
                F56C7B03131EC155000AD0F6 /* DarwinStorageProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76E7131EC153000AD0F6 /* DarwinStorageProvider.cpp */; };
                F56C7B04131EC155000AD0F6 /* AutorunMediaJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76E9131EC153000AD0F6 /* AutorunMediaJob.cpp */; };
                F56C7B89131EC155000AD0F6 /* Util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C780A131EC154000AD0F6 /* Util.cpp */; };
                F56C7B8B131EC155000AD0F6 /* XBApplicationEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C780E131EC154000AD0F6 /* XBApplicationEx.cpp */; };
                F56C7B9B131EC1B4000AD0F6 /* AutoPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = F56C7B9A131EC1B4000AD0F6 /* AutoPool.mm */; };
-               F56C7BC9131EC2DB000AD0F6 /* XBMCAppliance.m in Sources */ = {isa = PBXBuildFile; fileRef = F56C7BC2131EC2DB000AD0F6 /* XBMCAppliance.m */; };
+               F56C7BC9131EC2DB000AD0F6 /* XBMCAppliance.mm in Sources */ = {isa = PBXBuildFile; fileRef = F56C7BC2131EC2DB000AD0F6 /* XBMCAppliance.mm */; };
                F56C7BCA131EC2DB000AD0F6 /* XBMCController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F56C7BC5131EC2DB000AD0F6 /* XBMCController.mm */; };
                F56C7BD0131EC301000AD0F6 /* XBMC.png in Resources */ = {isa = PBXBuildFile; fileRef = F56C7BCD131EC301000AD0F6 /* XBMC.png */; };
                F56C7BDC131EC390000AD0F6 /* WinEventsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = F56C7BD9131EC390000AD0F6 /* WinEventsIOS.mm */; };
                4D5D2E121301753F006ABC13 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
                5500731316A75A2700097786 /* UPnPPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPPlayer.cpp; sourceTree = "<group>"; };
                5500731416A75A2700097786 /* UPnPPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPPlayer.h; sourceTree = "<group>"; };
-               7C0A7ECB13A5DBF900AFC2BD /* AppParamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppParamParser.cpp; sourceTree = "<group>"; };
-               7C0A7ECC13A5DBF900AFC2BD /* AppParamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppParamParser.h; sourceTree = "<group>"; };
                7C0A7FC313A9E75400AFC2BD /* DirtyRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegion.h; sourceTree = "<group>"; };
                7C0A7FC413A9E75400AFC2BD /* DirtyRegionSolvers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirtyRegionSolvers.cpp; sourceTree = "<group>"; };
                7C0A7FC513A9E75400AFC2BD /* DirtyRegionSolvers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegionSolvers.h; sourceTree = "<group>"; };
                DF93D74B1444B09C007C6459 /* HDFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDFile.h; sourceTree = "<group>"; };
                DF93D74C1444B09C007C6459 /* ISOFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOFile.cpp; sourceTree = "<group>"; };
                DF93D74D1444B09C007C6459 /* ISOFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOFile.h; sourceTree = "<group>"; };
-               DF93D74E1444B09C007C6459 /* LastFMFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMFile.cpp; sourceTree = "<group>"; };
-               DF93D74F1444B09C007C6459 /* LastFMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMFile.h; sourceTree = "<group>"; };
                DF93D7501444B09C007C6459 /* MusicDatabaseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabaseFile.cpp; sourceTree = "<group>"; };
                DF93D7511444B09C007C6459 /* MusicDatabaseFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabaseFile.h; sourceTree = "<group>"; };
                DF93D7521444B09C007C6459 /* NFSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSFile.cpp; sourceTree = "<group>"; };
                F54D9E8D12B71457006870F9 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
                F558F66813AFE7F300631E12 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                F558F66E13AFE81500631E12 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
+               F563530116E5442F00D21BAD /* UPnPSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPSettings.cpp; sourceTree = "<group>"; };
+               F563530216E5442F00D21BAD /* UPnPSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPSettings.h; sourceTree = "<group>"; };
+               F563530716E5446300D21BAD /* GUIDialogContentSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogContentSettings.cpp; path = dialogs/GUIDialogContentSettings.cpp; sourceTree = "<group>"; };
+               F563530816E5446300D21BAD /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogContentSettings.h; path = dialogs/GUIDialogContentSettings.h; sourceTree = "<group>"; };
+               F563530916E5446300D21BAD /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogLockSettings.cpp; path = dialogs/GUIDialogLockSettings.cpp; sourceTree = "<group>"; };
+               F563530A16E5446300D21BAD /* GUIDialogLockSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogLockSettings.h; path = dialogs/GUIDialogLockSettings.h; sourceTree = "<group>"; };
+               F563530B16E5446300D21BAD /* GUIDialogProfileSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogProfileSettings.cpp; path = dialogs/GUIDialogProfileSettings.cpp; sourceTree = "<group>"; };
+               F563530C16E5446300D21BAD /* GUIDialogProfileSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogProfileSettings.h; path = dialogs/GUIDialogProfileSettings.h; sourceTree = "<group>"; };
+               F563530D16E5446300D21BAD /* GUIDialogSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogSettings.cpp; path = dialogs/GUIDialogSettings.cpp; sourceTree = "<group>"; };
+               F563530E16E5446300D21BAD /* GUIDialogSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogSettings.h; path = dialogs/GUIDialogSettings.h; sourceTree = "<group>"; };
+               F563531316E5446C00D21BAD /* GUISettingControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUISettingControls.cpp; path = windows/GUISettingControls.cpp; sourceTree = "<group>"; };
+               F563531416E5446C00D21BAD /* GUISettingControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUISettingControls.h; path = windows/GUISettingControls.h; sourceTree = "<group>"; };
+               F563531516E5446C00D21BAD /* GUIWindowSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettings.cpp; path = windows/GUIWindowSettings.cpp; sourceTree = "<group>"; };
+               F563531616E5446C00D21BAD /* GUIWindowSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettings.h; path = windows/GUIWindowSettings.h; sourceTree = "<group>"; };
+               F563531716E5446C00D21BAD /* GUIWindowSettingsCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsCategory.cpp; path = windows/GUIWindowSettingsCategory.cpp; sourceTree = "<group>"; };
+               F563531816E5446C00D21BAD /* GUIWindowSettingsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsCategory.h; path = windows/GUIWindowSettingsCategory.h; sourceTree = "<group>"; };
+               F563531916E5446C00D21BAD /* GUIWindowSettingsProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsProfile.cpp; path = windows/GUIWindowSettingsProfile.cpp; sourceTree = "<group>"; };
+               F563531A16E5446C00D21BAD /* GUIWindowSettingsProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsProfile.h; path = windows/GUIWindowSettingsProfile.h; sourceTree = "<group>"; };
+               F563531B16E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsScreenCalibration.cpp; path = windows/GUIWindowSettingsScreenCalibration.cpp; sourceTree = "<group>"; };
+               F563531C16E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsScreenCalibration.h; path = windows/GUIWindowSettingsScreenCalibration.h; sourceTree = "<group>"; };
+               F563531D16E5446C00D21BAD /* GUIWindowTestPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowTestPattern.cpp; path = windows/GUIWindowTestPattern.cpp; sourceTree = "<group>"; };
+               F563531E16E5446C00D21BAD /* GUIWindowTestPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowTestPattern.h; path = windows/GUIWindowTestPattern.h; sourceTree = "<group>"; };
+               F563532516E5447C00D21BAD /* AppParamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppParamParser.cpp; sourceTree = "<group>"; };
+               F563532616E5447C00D21BAD /* AppParamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppParamParser.h; sourceTree = "<group>"; };
                F56B15FA12CD6922009B4C96 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
                F56B15FC12CD6930009B4C96 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
                F56B15FE12CD695C009B4C96 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
                F56C73FE131EC151000AD0F6 /* iso9660.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iso9660.h; sourceTree = "<group>"; };
                F56C73FF131EC151000AD0F6 /* ISO9660Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISO9660Directory.cpp; sourceTree = "<group>"; };
                F56C7400131EC151000AD0F6 /* ISO9660Directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISO9660Directory.h; sourceTree = "<group>"; };
-               F56C7401131EC151000AD0F6 /* LastFMDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMDirectory.cpp; sourceTree = "<group>"; };
-               F56C7402131EC151000AD0F6 /* LastFMDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMDirectory.h; sourceTree = "<group>"; };
                F56C7403131EC151000AD0F6 /* MultiPathDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathDirectory.cpp; sourceTree = "<group>"; };
                F56C7404131EC152000AD0F6 /* MultiPathDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiPathDirectory.h; sourceTree = "<group>"; };
                F56C7405131EC152000AD0F6 /* MultiPathFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathFile.cpp; sourceTree = "<group>"; };
                F56C763C131EC153000AD0F6 /* Artist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Artist.h; sourceTree = "<group>"; };
                F56C763D131EC153000AD0F6 /* GUIViewStateMusic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIViewStateMusic.cpp; sourceTree = "<group>"; };
                F56C763E131EC153000AD0F6 /* GUIViewStateMusic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIViewStateMusic.h; sourceTree = "<group>"; };
-               F56C763F131EC153000AD0F6 /* LastFmManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFmManager.cpp; sourceTree = "<group>"; };
-               F56C7640131EC153000AD0F6 /* LastFmManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFmManager.h; sourceTree = "<group>"; };
                F56C7641131EC153000AD0F6 /* MusicDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabase.cpp; sourceTree = "<group>"; };
                F56C7642131EC153000AD0F6 /* MusicDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabase.h; sourceTree = "<group>"; };
                F56C7643131EC153000AD0F6 /* MusicInfoLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicInfoLoader.cpp; sourceTree = "<group>"; };
                F56C7645131EC153000AD0F6 /* Song.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Song.cpp; sourceTree = "<group>"; };
                F56C7646131EC153000AD0F6 /* Song.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Song.h; sourceTree = "<group>"; };
                F56C7649131EC153000AD0F6 /* errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = errors.h; sourceTree = "<group>"; };
-               F56C764A131EC153000AD0F6 /* lastfmscrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lastfmscrobbler.cpp; sourceTree = "<group>"; };
-               F56C764B131EC153000AD0F6 /* lastfmscrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lastfmscrobbler.h; sourceTree = "<group>"; };
-               F56C764C131EC153000AD0F6 /* librefmscrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = librefmscrobbler.cpp; sourceTree = "<group>"; };
-               F56C764D131EC153000AD0F6 /* librefmscrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = librefmscrobbler.h; sourceTree = "<group>"; };
-               F56C764E131EC153000AD0F6 /* scrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scrobbler.cpp; sourceTree = "<group>"; };
-               F56C764F131EC153000AD0F6 /* scrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scrobbler.h; sourceTree = "<group>"; };
                F56C7651131EC153000AD0F6 /* NetworkLinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkLinux.cpp; sourceTree = "<group>"; };
                F56C7652131EC153000AD0F6 /* NetworkLinux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkLinux.h; sourceTree = "<group>"; };
                F56C7654131EC153000AD0F6 /* ZeroconfBrowserOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZeroconfBrowserOSX.cpp; sourceTree = "<group>"; };
                F56C76B8131EC153000AD0F6 /* GUIWindowPrograms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowPrograms.h; sourceTree = "<group>"; };
                F56C76C3131EC153000AD0F6 /* RenderSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSystem.cpp; sourceTree = "<group>"; };
                F56C76C4131EC153000AD0F6 /* RenderSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSystem.h; sourceTree = "<group>"; };
-               F56C76C7131EC153000AD0F6 /* GUIDialogContentSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogContentSettings.cpp; sourceTree = "<group>"; };
-               F56C76C8131EC153000AD0F6 /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogContentSettings.h; sourceTree = "<group>"; };
-               F56C76C9131EC153000AD0F6 /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogLockSettings.cpp; sourceTree = "<group>"; };
-               F56C76CA131EC153000AD0F6 /* GUIDialogLockSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogLockSettings.h; sourceTree = "<group>"; };
-               F56C76CB131EC153000AD0F6 /* GUIDialogProfileSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogProfileSettings.cpp; sourceTree = "<group>"; };
-               F56C76CC131EC153000AD0F6 /* GUIDialogProfileSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogProfileSettings.h; sourceTree = "<group>"; };
-               F56C76CD131EC153000AD0F6 /* GUIDialogSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSettings.cpp; sourceTree = "<group>"; };
-               F56C76CE131EC153000AD0F6 /* GUIDialogSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogSettings.h; sourceTree = "<group>"; };
-               F56C76CF131EC153000AD0F6 /* GUIWindowTestPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowTestPattern.cpp; sourceTree = "<group>"; };
-               F56C76D0131EC153000AD0F6 /* GUIWindowTestPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowTestPattern.h; sourceTree = "<group>"; };
                F56C76D1131EC153000AD0F6 /* GUISettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUISettings.cpp; sourceTree = "<group>"; };
                F56C76D2131EC153000AD0F6 /* GUISettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUISettings.h; sourceTree = "<group>"; };
                F56C76D3131EC153000AD0F6 /* AdvancedSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AdvancedSettings.cpp; sourceTree = "<group>"; };
                F56C76D4131EC153000AD0F6 /* AdvancedSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdvancedSettings.h; sourceTree = "<group>"; };
-               F56C76D5131EC153000AD0F6 /* GUIWindowSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettings.cpp; sourceTree = "<group>"; };
-               F56C76D6131EC153000AD0F6 /* GUIWindowSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettings.h; sourceTree = "<group>"; };
-               F56C76D7131EC153000AD0F6 /* GUIWindowSettingsCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsCategory.cpp; sourceTree = "<group>"; };
-               F56C76D8131EC153000AD0F6 /* GUIWindowSettingsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsCategory.h; sourceTree = "<group>"; };
-               F56C76D9131EC153000AD0F6 /* GUIWindowSettingsProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsProfile.cpp; sourceTree = "<group>"; };
-               F56C76DA131EC153000AD0F6 /* GUIWindowSettingsProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsProfile.h; sourceTree = "<group>"; };
-               F56C76DB131EC153000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsScreenCalibration.cpp; sourceTree = "<group>"; };
-               F56C76DC131EC153000AD0F6 /* GUIWindowSettingsScreenCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsScreenCalibration.h; sourceTree = "<group>"; };
                F56C76DD131EC153000AD0F6 /* Profile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Profile.cpp; sourceTree = "<group>"; };
                F56C76DE131EC153000AD0F6 /* Profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Profile.h; sourceTree = "<group>"; };
                F56C76DF131EC153000AD0F6 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
                F56C76E0131EC153000AD0F6 /* Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Settings.h; sourceTree = "<group>"; };
-               F56C76E1131EC153000AD0F6 /* SettingsControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsControls.cpp; sourceTree = "<group>"; };
-               F56C76E2131EC153000AD0F6 /* SettingsControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsControls.h; sourceTree = "<group>"; };
                F56C76E3131EC153000AD0F6 /* VideoSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoSettings.cpp; sourceTree = "<group>"; };
                F56C76E4131EC153000AD0F6 /* VideoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoSettings.h; sourceTree = "<group>"; };
                F56C76E7131EC153000AD0F6 /* DarwinStorageProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DarwinStorageProvider.cpp; sourceTree = "<group>"; };
                F56C780F131EC154000AD0F6 /* XBApplicationEx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBApplicationEx.h; sourceTree = "<group>"; };
                F56C7B99131EC1B4000AD0F6 /* AutoPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoPool.h; sourceTree = "<group>"; };
                F56C7B9A131EC1B4000AD0F6 /* AutoPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoPool.mm; sourceTree = "<group>"; };
-               F56C7BC2131EC2DB000AD0F6 /* XBMCAppliance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XBMCAppliance.m; sourceTree = "<group>"; };
+               F56C7BC2131EC2DB000AD0F6 /* XBMCAppliance.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = XBMCAppliance.mm; sourceTree = "<group>"; };
                F56C7BC3131EC2DB000AD0F6 /* XBMCAppliance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBMCAppliance.h; sourceTree = "<group>"; };
                F56C7BC4131EC2DB000AD0F6 /* XBMCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBMCController.h; sourceTree = "<group>"; };
                F56C7BC5131EC2DB000AD0F6 /* XBMCController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = XBMCController.mm; sourceTree = "<group>"; };
                                DF23460C15FA671900A934F6 /* UPnPRenderer.h */,
                                DF23460D15FA671900A934F6 /* UPnPServer.cpp */,
                                DF23460E15FA671900A934F6 /* UPnPServer.h */,
+                               F563530116E5442F00D21BAD /* UPnPSettings.cpp */,
+                               F563530216E5442F00D21BAD /* UPnPSettings.h */,
                        );
                        path = upnp;
                        sourceTree = "<group>";
                        path = pthreads;
                        sourceTree = "<group>";
                };
+               F563530516E5444100D21BAD /* dialogs */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F563530716E5446300D21BAD /* GUIDialogContentSettings.cpp */,
+                               F563530816E5446300D21BAD /* GUIDialogContentSettings.h */,
+                               F563530916E5446300D21BAD /* GUIDialogLockSettings.cpp */,
+                               F563530A16E5446300D21BAD /* GUIDialogLockSettings.h */,
+                               F563530B16E5446300D21BAD /* GUIDialogProfileSettings.cpp */,
+                               F563530C16E5446300D21BAD /* GUIDialogProfileSettings.h */,
+                               F563530D16E5446300D21BAD /* GUIDialogSettings.cpp */,
+                               F563530E16E5446300D21BAD /* GUIDialogSettings.h */,
+                       );
+                       name = dialogs;
+                       sourceTree = "<group>";
+               };
+               F563530616E5444500D21BAD /* windows */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F563531316E5446C00D21BAD /* GUISettingControls.cpp */,
+                               F563531416E5446C00D21BAD /* GUISettingControls.h */,
+                               F563531516E5446C00D21BAD /* GUIWindowSettings.cpp */,
+                               F563531616E5446C00D21BAD /* GUIWindowSettings.h */,
+                               F563531716E5446C00D21BAD /* GUIWindowSettingsCategory.cpp */,
+                               F563531816E5446C00D21BAD /* GUIWindowSettingsCategory.h */,
+                               F563531916E5446C00D21BAD /* GUIWindowSettingsProfile.cpp */,
+                               F563531A16E5446C00D21BAD /* GUIWindowSettingsProfile.h */,
+                               F563531B16E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp */,
+                               F563531C16E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.h */,
+                               F563531D16E5446C00D21BAD /* GUIWindowTestPattern.cpp */,
+                               F563531E16E5446C00D21BAD /* GUIWindowTestPattern.h */,
+                       );
+                       name = windows;
+                       sourceTree = "<group>";
+               };
                F56C704E131EC150000AD0F6 /* Source */ = {
                        isa = PBXGroup;
                        children = (
                                F56C77CF131EC154000AD0F6 /* Application.h */,
                                F56C77D0131EC154000AD0F6 /* ApplicationMessenger.cpp */,
                                F56C77D1131EC154000AD0F6 /* ApplicationMessenger.h */,
+                               F563532516E5447C00D21BAD /* AppParamParser.cpp */,
+                               F563532616E5447C00D21BAD /* AppParamParser.h */,
                                F56C77D2131EC154000AD0F6 /* Autorun.cpp */,
                                F56C77D3131EC154000AD0F6 /* Autorun.h */,
                                F56C77D4131EC154000AD0F6 /* AutoSwitch.cpp */,
                                F56C7400131EC151000AD0F6 /* ISO9660Directory.h */,
                                DF93D74C1444B09C007C6459 /* ISOFile.cpp */,
                                DF93D74D1444B09C007C6459 /* ISOFile.h */,
-                               F56C7401131EC151000AD0F6 /* LastFMDirectory.cpp */,
-                               F56C7402131EC151000AD0F6 /* LastFMDirectory.h */,
-                               DF93D74E1444B09C007C6459 /* LastFMFile.cpp */,
-                               DF93D74F1444B09C007C6459 /* LastFMFile.h */,
                                7C1F6F8A13ED17CC001726AB /* LibraryDirectory.cpp */,
                                7C1F6F8B13ED17CC001726AB /* LibraryDirectory.h */,
                                DFDB00471516408F005079A4 /* MemBufferCache.cpp */,
                                F56C763C131EC153000AD0F6 /* Artist.h */,
                                F56C763D131EC153000AD0F6 /* GUIViewStateMusic.cpp */,
                                F56C763E131EC153000AD0F6 /* GUIViewStateMusic.h */,
-                               F56C763F131EC153000AD0F6 /* LastFmManager.cpp */,
-                               F56C7640131EC153000AD0F6 /* LastFmManager.h */,
                                F56C7641131EC153000AD0F6 /* MusicDatabase.cpp */,
                                F56C7642131EC153000AD0F6 /* MusicDatabase.h */,
                                36A9468C15CF217400727135 /* MusicDbUrl.cpp */,
                        isa = PBXGroup;
                        children = (
                                DFCA6AFD15224684000BFAAE /* httprequesthandler */,
-                               F56C7648131EC153000AD0F6 /* libscrobbler */,
                                F56C7650131EC153000AD0F6 /* linux */,
                                F56C7653131EC153000AD0F6 /* osx */,
                                DF23460515FA671900A934F6 /* upnp */,
                        path = network;
                        sourceTree = "<group>";
                };
-               F56C7648131EC153000AD0F6 /* libscrobbler */ = {
-                       isa = PBXGroup;
-                       children = (
-                               F56C7649131EC153000AD0F6 /* errors.h */,
-                               F56C764A131EC153000AD0F6 /* lastfmscrobbler.cpp */,
-                               F56C764B131EC153000AD0F6 /* lastfmscrobbler.h */,
-                               F56C764C131EC153000AD0F6 /* librefmscrobbler.cpp */,
-                               F56C764D131EC153000AD0F6 /* librefmscrobbler.h */,
-                               F56C764E131EC153000AD0F6 /* scrobbler.cpp */,
-                               F56C764F131EC153000AD0F6 /* scrobbler.h */,
-                       );
-                       path = libscrobbler;
-                       sourceTree = "<group>";
-               };
                F56C7650131EC153000AD0F6 /* linux */ = {
                        isa = PBXGroup;
                        children = (
                F56C76C6131EC153000AD0F6 /* settings */ = {
                        isa = PBXGroup;
                        children = (
+                               F563530516E5444100D21BAD /* dialogs */,
+                               F563530616E5444500D21BAD /* windows */,
                                F56C76D3131EC153000AD0F6 /* AdvancedSettings.cpp */,
                                F56C76D4131EC153000AD0F6 /* AdvancedSettings.h */,
-                               7C0A7ECB13A5DBF900AFC2BD /* AppParamParser.cpp */,
-                               7C0A7ECC13A5DBF900AFC2BD /* AppParamParser.h */,
-                               F56C76C7131EC153000AD0F6 /* GUIDialogContentSettings.cpp */,
-                               F56C76C8131EC153000AD0F6 /* GUIDialogContentSettings.h */,
-                               F56C76C9131EC153000AD0F6 /* GUIDialogLockSettings.cpp */,
-                               F56C76CA131EC153000AD0F6 /* GUIDialogLockSettings.h */,
-                               F56C76CB131EC153000AD0F6 /* GUIDialogProfileSettings.cpp */,
-                               F56C76CC131EC153000AD0F6 /* GUIDialogProfileSettings.h */,
-                               F56C76CD131EC153000AD0F6 /* GUIDialogSettings.cpp */,
-                               F56C76CE131EC153000AD0F6 /* GUIDialogSettings.h */,
                                F56C76D1131EC153000AD0F6 /* GUISettings.cpp */,
                                F56C76D2131EC153000AD0F6 /* GUISettings.h */,
-                               F56C76D5131EC153000AD0F6 /* GUIWindowSettings.cpp */,
-                               F56C76D6131EC153000AD0F6 /* GUIWindowSettings.h */,
-                               F56C76D7131EC153000AD0F6 /* GUIWindowSettingsCategory.cpp */,
-                               F56C76D8131EC153000AD0F6 /* GUIWindowSettingsCategory.h */,
-                               F56C76D9131EC153000AD0F6 /* GUIWindowSettingsProfile.cpp */,
-                               F56C76DA131EC153000AD0F6 /* GUIWindowSettingsProfile.h */,
-                               F56C76DB131EC153000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp */,
-                               F56C76DC131EC153000AD0F6 /* GUIWindowSettingsScreenCalibration.h */,
-                               F56C76CF131EC153000AD0F6 /* GUIWindowTestPattern.cpp */,
-                               F56C76D0131EC153000AD0F6 /* GUIWindowTestPattern.h */,
                                F56C76DD131EC153000AD0F6 /* Profile.cpp */,
                                F56C76DE131EC153000AD0F6 /* Profile.h */,
                                F56C76DF131EC153000AD0F6 /* Settings.cpp */,
                                F56C76E0131EC153000AD0F6 /* Settings.h */,
-                               F56C76E1131EC153000AD0F6 /* SettingsControls.cpp */,
-                               F56C76E2131EC153000AD0F6 /* SettingsControls.h */,
                                F56C76E3131EC153000AD0F6 /* VideoSettings.cpp */,
                                F56C76E4131EC153000AD0F6 /* VideoSettings.h */,
                        );
                                F56C7F2D131F0BB4000AD0F6 /* English.lproj */,
                                F56C7BCD131EC301000AD0F6 /* XBMC.png */,
                                F56C7BC3131EC2DB000AD0F6 /* XBMCAppliance.h */,
-                               F56C7BC2131EC2DB000AD0F6 /* XBMCAppliance.m */,
+                               F56C7BC2131EC2DB000AD0F6 /* XBMCAppliance.mm */,
                                F56C7BCE131EC301000AD0F6 /* XBMCATV2-Info.plist */,
                                F56C7BC4131EC2DB000AD0F6 /* XBMCController.h */,
                                F56C7BC5131EC2DB000AD0F6 /* XBMCController.mm */,
                                F56C79A0131EC154000AD0F6 /* IFile.cpp in Sources */,
                                F56C79A1131EC154000AD0F6 /* iso9660.cpp in Sources */,
                                F56C79A2131EC154000AD0F6 /* ISO9660Directory.cpp in Sources */,
-                               F56C79A3131EC154000AD0F6 /* LastFMDirectory.cpp in Sources */,
                                F56C79A4131EC154000AD0F6 /* MultiPathDirectory.cpp in Sources */,
                                F56C79A5131EC154000AD0F6 /* MultiPathFile.cpp in Sources */,
                                F56C79A6131EC154000AD0F6 /* DirectoryNodeSingles.cpp in Sources */,
                                F56C7AB5131EC155000AD0F6 /* Album.cpp in Sources */,
                                F56C7AB6131EC155000AD0F6 /* Artist.cpp in Sources */,
                                F56C7AB7131EC155000AD0F6 /* GUIViewStateMusic.cpp in Sources */,
-                               F56C7AB8131EC155000AD0F6 /* LastFmManager.cpp in Sources */,
                                F56C7AB9131EC155000AD0F6 /* MusicDatabase.cpp in Sources */,
                                F56C7ABA131EC155000AD0F6 /* MusicInfoLoader.cpp in Sources */,
                                F56C7ABB131EC155000AD0F6 /* Song.cpp in Sources */,
-                               F56C7ABC131EC155000AD0F6 /* lastfmscrobbler.cpp in Sources */,
-                               F56C7ABD131EC155000AD0F6 /* librefmscrobbler.cpp in Sources */,
-                               F56C7ABE131EC155000AD0F6 /* scrobbler.cpp in Sources */,
                                F56C7ABF131EC155000AD0F6 /* NetworkLinux.cpp in Sources */,
                                F56C7AC0131EC155000AD0F6 /* ZeroconfBrowserOSX.cpp in Sources */,
                                F56C7AC1131EC155000AD0F6 /* ZeroconfOSX.cpp in Sources */,
                                F56C7AED131EC155000AD0F6 /* GUIViewStatePrograms.cpp in Sources */,
                                F56C7AEE131EC155000AD0F6 /* GUIWindowPrograms.cpp in Sources */,
                                F56C7AF3131EC155000AD0F6 /* RenderSystem.cpp in Sources */,
-                               F56C7AF4131EC155000AD0F6 /* GUIDialogContentSettings.cpp in Sources */,
-                               F56C7AF5131EC155000AD0F6 /* GUIDialogLockSettings.cpp in Sources */,
-                               F56C7AF6131EC155000AD0F6 /* GUIDialogProfileSettings.cpp in Sources */,
-                               F56C7AF7131EC155000AD0F6 /* GUIDialogSettings.cpp in Sources */,
-                               F56C7AF8131EC155000AD0F6 /* GUIWindowTestPattern.cpp in Sources */,
                                F56C7AF9131EC155000AD0F6 /* GUISettings.cpp in Sources */,
                                F56C7AFA131EC155000AD0F6 /* AdvancedSettings.cpp in Sources */,
-                               F56C7AFB131EC155000AD0F6 /* GUIWindowSettings.cpp in Sources */,
-                               F56C7AFC131EC155000AD0F6 /* GUIWindowSettingsCategory.cpp in Sources */,
-                               F56C7AFD131EC155000AD0F6 /* GUIWindowSettingsProfile.cpp in Sources */,
-                               F56C7AFE131EC155000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
                                F56C7AFF131EC155000AD0F6 /* Profile.cpp in Sources */,
                                F56C7B00131EC155000AD0F6 /* Settings.cpp in Sources */,
-                               F56C7B01131EC155000AD0F6 /* SettingsControls.cpp in Sources */,
                                F56C7B02131EC155000AD0F6 /* VideoSettings.cpp in Sources */,
                                F56C7B03131EC155000AD0F6 /* DarwinStorageProvider.cpp in Sources */,
                                F56C7B04131EC155000AD0F6 /* AutorunMediaJob.cpp in Sources */,
                                F56C7B89131EC155000AD0F6 /* Util.cpp in Sources */,
                                F56C7B8B131EC155000AD0F6 /* XBApplicationEx.cpp in Sources */,
                                F56C7B9B131EC1B4000AD0F6 /* AutoPool.mm in Sources */,
-                               F56C7BC9131EC2DB000AD0F6 /* XBMCAppliance.m in Sources */,
+                               F56C7BC9131EC2DB000AD0F6 /* XBMCAppliance.mm in Sources */,
                                F56C7BCA131EC2DB000AD0F6 /* XBMCController.mm in Sources */,
                                F56C7BDC131EC390000AD0F6 /* WinEventsIOS.mm in Sources */,
                                F56C7BDD131EC390000AD0F6 /* WinSystemIOS.mm in Sources */,
                                C8EC5D51136954E400CCC10D /* XBMC_keytable.cpp in Sources */,
                                1840B796139968DB007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B797139968DB007C848B /* JSONVariantWriter.cpp in Sources */,
-                               7C0A7ECD13A5DBF900AFC2BD /* AppParamParser.cpp in Sources */,
                                18B7013C13A6ABBA0009C1AF /* AddonVersion.cpp in Sources */,
                                7C0A7FC813A9E75400AFC2BD /* DirtyRegionSolvers.cpp in Sources */,
                                7C0A7FC913A9E75400AFC2BD /* DirtyRegionTracker.cpp in Sources */,
                                DF93D7781444B09C007C6459 /* FileReaderFile.cpp in Sources */,
                                DF93D7791444B09C007C6459 /* HDFile.cpp in Sources */,
                                DF93D77A1444B09C007C6459 /* ISOFile.cpp in Sources */,
-                               DF93D77B1444B09C007C6459 /* LastFMFile.cpp in Sources */,
                                DF93D77C1444B09C007C6459 /* MusicDatabaseFile.cpp in Sources */,
                                DF93D77D1444B09C007C6459 /* NFSFile.cpp in Sources */,
                                DF93D77E1444B09C007C6459 /* PipeFile.cpp in Sources */,
                                DF64FE6F16C07B2C00D028FB /* ViewDatabase.cpp in Sources */,
                                DFD5812B16C829020008EEA0 /* DAVCommon.cpp in Sources */,
                                DFD5812C16C829020008EEA0 /* DAVFile.cpp in Sources */,
+                               F563530316E5442F00D21BAD /* UPnPSettings.cpp in Sources */,
+                               F563530F16E5446300D21BAD /* GUIDialogContentSettings.cpp in Sources */,
+                               F563531016E5446300D21BAD /* GUIDialogLockSettings.cpp in Sources */,
+                               F563531116E5446300D21BAD /* GUIDialogProfileSettings.cpp in Sources */,
+                               F563531216E5446300D21BAD /* GUIDialogSettings.cpp in Sources */,
+                               F563531F16E5446C00D21BAD /* GUISettingControls.cpp in Sources */,
+                               F563532016E5446C00D21BAD /* GUIWindowSettings.cpp in Sources */,
+                               F563532116E5446C00D21BAD /* GUIWindowSettingsCategory.cpp in Sources */,
+                               F563532216E5446C00D21BAD /* GUIWindowSettingsProfile.cpp in Sources */,
+                               F563532316E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
+                               F563532416E5446C00D21BAD /* GUIWindowTestPattern.cpp in Sources */,
+                               F563532716E5447C00D21BAD /* AppParamParser.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 5bee22f..3eec7f3 100644 (file)
@@ -30,7 +30,6 @@
                36A95DAD1624896C00727135 /* GUIDialogMediaFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A95DAB1624896C00727135 /* GUIDialogMediaFilter.cpp */; };
                4D5D2E1E1301758F006ABC13 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D5D2E1D1301758F006ABC13 /* CFNetwork.framework */; };
                5500730E16A759D800097786 /* UPnPPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5500730C16A759D800097786 /* UPnPPlayer.cpp */; };
-               7C0A7EDE13A5DC2800AFC2BD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7EDC13A5DC2800AFC2BD /* AppParamParser.cpp */; };
                7C0A7F9D13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7F9B13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp */; };
                7C0A7FB213A9E72E00AFC2BD /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FAE13A9E72E00AFC2BD /* DirtyRegionSolvers.cpp */; };
                7C0A7FB313A9E72E00AFC2BD /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7FB013A9E72E00AFC2BD /* DirtyRegionTracker.cpp */; };
                DF93D7D71444B105007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A71444B105007C6459 /* FileReaderFile.cpp */; };
                DF93D7D81444B105007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7A91444B105007C6459 /* HDFile.cpp */; };
                DF93D7D91444B105007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7AB1444B105007C6459 /* ISOFile.cpp */; };
-               DF93D7DA1444B105007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7AD1444B105007C6459 /* LastFMFile.cpp */; };
                DF93D7DB1444B105007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7AF1444B105007C6459 /* MusicDatabaseFile.cpp */; };
                DF93D7DC1444B105007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B11444B105007C6459 /* NFSFile.cpp */; };
                DF93D7DD1444B105007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7B31444B105007C6459 /* PipeFile.cpp */; };
                DFFD59401506B5B10088DE4B /* IOSEAGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFD593F1506B5B10088DE4B /* IOSEAGLView.mm */; };
                DFFEFBEE15160739001294DC /* IOSScreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFEFBED15160739001294DC /* IOSScreenManager.mm */; };
                DFFEFC0415160808001294DC /* IOSExternalTouchController.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFEFC0315160808001294DC /* IOSExternalTouchController.mm */; };
+               F56352D916E543BD00D21BAD /* UPnPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352D716E543BD00D21BAD /* UPnPSettings.cpp */; };
+               F56352E916E543F800D21BAD /* GUISettingControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352DD16E543F800D21BAD /* GUISettingControls.cpp */; };
+               F56352EA16E543F800D21BAD /* GUIWindowSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352DF16E543F800D21BAD /* GUIWindowSettings.cpp */; };
+               F56352EB16E543F800D21BAD /* GUIWindowSettingsCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352E116E543F800D21BAD /* GUIWindowSettingsCategory.cpp */; };
+               F56352EC16E543F800D21BAD /* GUIWindowSettingsProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352E316E543F800D21BAD /* GUIWindowSettingsProfile.cpp */; };
+               F56352ED16E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352E516E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp */; };
+               F56352EE16E543F800D21BAD /* GUIWindowTestPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352E716E543F800D21BAD /* GUIWindowTestPattern.cpp */; };
+               F56352F716E5440300D21BAD /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352EF16E5440300D21BAD /* GUIDialogContentSettings.cpp */; };
+               F56352F816E5440300D21BAD /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352F116E5440300D21BAD /* GUIDialogLockSettings.cpp */; };
+               F56352F916E5440300D21BAD /* GUIDialogProfileSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352F316E5440300D21BAD /* GUIDialogProfileSettings.cpp */; };
+               F56352FA16E5440300D21BAD /* GUIDialogSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352F516E5440300D21BAD /* GUIDialogSettings.cpp */; };
+               F56352FD16E5441600D21BAD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352FB16E5441600D21BAD /* AppParamParser.cpp */; };
                F56B143412CAF279009B4C96 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B143312CAF279009B4C96 /* CoreVideo.framework */; };
                F56B14A512CAF523009B4C96 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B14A412CAF523009B4C96 /* AudioToolbox.framework */; };
                F56B15D512CD67A9009B4C96 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56B15D412CD67A9009B4C96 /* CoreGraphics.framework */; };
                F56C898A131F42ED000AD0F6 /* IFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83DD131F42E8000AD0F6 /* IFile.cpp */; };
                F56C898B131F42ED000AD0F6 /* iso9660.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83E0131F42E8000AD0F6 /* iso9660.cpp */; };
                F56C898C131F42ED000AD0F6 /* ISO9660Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83E2131F42E8000AD0F6 /* ISO9660Directory.cpp */; };
-               F56C898D131F42ED000AD0F6 /* LastFMDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83E4131F42E8000AD0F6 /* LastFMDirectory.cpp */; };
                F56C898E131F42ED000AD0F6 /* MultiPathDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83E6131F42E8000AD0F6 /* MultiPathDirectory.cpp */; };
                F56C898F131F42ED000AD0F6 /* MultiPathFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83E8131F42E8000AD0F6 /* MultiPathFile.cpp */; };
                F56C8990131F42ED000AD0F6 /* DirectoryNodeSingles.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C83EB131F42E8000AD0F6 /* DirectoryNodeSingles.cpp */; };
                F56C8A9F131F42ED000AD0F6 /* Album.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C861C131F42EA000AD0F6 /* Album.cpp */; };
                F56C8AA0131F42ED000AD0F6 /* Artist.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C861E131F42EA000AD0F6 /* Artist.cpp */; };
                F56C8AA1131F42ED000AD0F6 /* GUIViewStateMusic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8620131F42EA000AD0F6 /* GUIViewStateMusic.cpp */; };
-               F56C8AA2131F42ED000AD0F6 /* LastFmManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8622131F42EA000AD0F6 /* LastFmManager.cpp */; };
                F56C8AA3131F42ED000AD0F6 /* MusicDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8624131F42EA000AD0F6 /* MusicDatabase.cpp */; };
                F56C8AA4131F42ED000AD0F6 /* MusicInfoLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8626131F42EA000AD0F6 /* MusicInfoLoader.cpp */; };
                F56C8AA5131F42ED000AD0F6 /* Song.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8628131F42EA000AD0F6 /* Song.cpp */; };
-               F56C8AA6131F42ED000AD0F6 /* lastfmscrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C862D131F42EA000AD0F6 /* lastfmscrobbler.cpp */; };
-               F56C8AA7131F42ED000AD0F6 /* librefmscrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C862F131F42EA000AD0F6 /* librefmscrobbler.cpp */; };
-               F56C8AA8131F42ED000AD0F6 /* scrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8631131F42EA000AD0F6 /* scrobbler.cpp */; };
                F56C8AA9131F42ED000AD0F6 /* NetworkLinux.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8634131F42EA000AD0F6 /* NetworkLinux.cpp */; };
                F56C8AAA131F42ED000AD0F6 /* ZeroconfBrowserOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8637131F42EA000AD0F6 /* ZeroconfBrowserOSX.cpp */; };
                F56C8AAB131F42ED000AD0F6 /* ZeroconfOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C8639131F42EA000AD0F6 /* ZeroconfOSX.cpp */; };
                F56C8ADC131F42ED000AD0F6 /* GUIWindowPrograms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86A4131F42EB000AD0F6 /* GUIWindowPrograms.cpp */; };
                F56C8ADF131F42ED000AD0F6 /* RenderSystemGLES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86AC131F42EB000AD0F6 /* RenderSystemGLES.cpp */; };
                F56C8AE0131F42ED000AD0F6 /* RenderSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86AE131F42EB000AD0F6 /* RenderSystem.cpp */; };
-               F56C8AE1131F42ED000AD0F6 /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86B2131F42EB000AD0F6 /* GUIDialogContentSettings.cpp */; };
-               F56C8AE2131F42ED000AD0F6 /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86B4131F42EB000AD0F6 /* GUIDialogLockSettings.cpp */; };
-               F56C8AE3131F42ED000AD0F6 /* GUIDialogProfileSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86B6131F42EB000AD0F6 /* GUIDialogProfileSettings.cpp */; };
-               F56C8AE4131F42ED000AD0F6 /* GUIDialogSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86B8131F42EB000AD0F6 /* GUIDialogSettings.cpp */; };
-               F56C8AE5131F42ED000AD0F6 /* GUIWindowTestPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86BA131F42EB000AD0F6 /* GUIWindowTestPattern.cpp */; };
                F56C8AE6131F42ED000AD0F6 /* GUISettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86BC131F42EB000AD0F6 /* GUISettings.cpp */; };
                F56C8AE7131F42ED000AD0F6 /* AdvancedSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86BE131F42EB000AD0F6 /* AdvancedSettings.cpp */; };
-               F56C8AE8131F42ED000AD0F6 /* GUIWindowSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86C0131F42EB000AD0F6 /* GUIWindowSettings.cpp */; };
-               F56C8AE9131F42ED000AD0F6 /* GUIWindowSettingsCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86C2131F42EB000AD0F6 /* GUIWindowSettingsCategory.cpp */; };
-               F56C8AEA131F42ED000AD0F6 /* GUIWindowSettingsProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86C4131F42EB000AD0F6 /* GUIWindowSettingsProfile.cpp */; };
-               F56C8AEB131F42ED000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86C6131F42EB000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp */; };
                F56C8AEC131F42ED000AD0F6 /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86C8131F42EB000AD0F6 /* Profile.cpp */; };
                F56C8AED131F42ED000AD0F6 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86CA131F42EB000AD0F6 /* Settings.cpp */; };
-               F56C8AEE131F42ED000AD0F6 /* SettingsControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86CC131F42EB000AD0F6 /* SettingsControls.cpp */; };
                F56C8AEF131F42ED000AD0F6 /* VideoSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86CE131F42EB000AD0F6 /* VideoSettings.cpp */; };
                F56C8AF0131F42ED000AD0F6 /* DarwinStorageProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86D2131F42EB000AD0F6 /* DarwinStorageProvider.cpp */; };
                F56C8AF1131F42ED000AD0F6 /* AutorunMediaJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86D4131F42EB000AD0F6 /* AutorunMediaJob.cpp */; };
                4D5D2E1D1301758F006ABC13 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
                5500730C16A759D800097786 /* UPnPPlayer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPPlayer.cpp; sourceTree = "<group>"; };
                5500730D16A759D800097786 /* UPnPPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPPlayer.h; sourceTree = "<group>"; };
-               7C0A7EDC13A5DC2800AFC2BD /* AppParamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppParamParser.cpp; sourceTree = "<group>"; };
-               7C0A7EDD13A5DC2800AFC2BD /* AppParamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppParamParser.h; sourceTree = "<group>"; };
                7C0A7F9B13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowDebugInfo.cpp; sourceTree = "<group>"; };
                7C0A7F9C13A9E70800AFC2BD /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; };
                7C0A7FAD13A9E72E00AFC2BD /* DirtyRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegion.h; sourceTree = "<group>"; };
                DF93D7AA1444B105007C6459 /* HDFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDFile.h; sourceTree = "<group>"; };
                DF93D7AB1444B105007C6459 /* ISOFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOFile.cpp; sourceTree = "<group>"; };
                DF93D7AC1444B105007C6459 /* ISOFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOFile.h; sourceTree = "<group>"; };
-               DF93D7AD1444B105007C6459 /* LastFMFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMFile.cpp; sourceTree = "<group>"; };
-               DF93D7AE1444B105007C6459 /* LastFMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMFile.h; sourceTree = "<group>"; };
                DF93D7AF1444B105007C6459 /* MusicDatabaseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabaseFile.cpp; sourceTree = "<group>"; };
                DF93D7B01444B105007C6459 /* MusicDatabaseFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabaseFile.h; sourceTree = "<group>"; };
                DF93D7B11444B105007C6459 /* NFSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSFile.cpp; sourceTree = "<group>"; };
                F502C07B160F417B00C96C76 /* XBPyThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XBPyThread.h; path = python/XBPyThread.h; sourceTree = "<group>"; };
                F558F60613AFDC1700631E12 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
                F558F61013AFDC3000631E12 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
+               F56352D716E543BD00D21BAD /* UPnPSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPSettings.cpp; sourceTree = "<group>"; };
+               F56352D816E543BD00D21BAD /* UPnPSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPSettings.h; sourceTree = "<group>"; };
+               F56352DD16E543F800D21BAD /* GUISettingControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUISettingControls.cpp; path = windows/GUISettingControls.cpp; sourceTree = "<group>"; };
+               F56352DE16E543F800D21BAD /* GUISettingControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUISettingControls.h; path = windows/GUISettingControls.h; sourceTree = "<group>"; };
+               F56352DF16E543F800D21BAD /* GUIWindowSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettings.cpp; path = windows/GUIWindowSettings.cpp; sourceTree = "<group>"; };
+               F56352E016E543F800D21BAD /* GUIWindowSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettings.h; path = windows/GUIWindowSettings.h; sourceTree = "<group>"; };
+               F56352E116E543F800D21BAD /* GUIWindowSettingsCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsCategory.cpp; path = windows/GUIWindowSettingsCategory.cpp; sourceTree = "<group>"; };
+               F56352E216E543F800D21BAD /* GUIWindowSettingsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsCategory.h; path = windows/GUIWindowSettingsCategory.h; sourceTree = "<group>"; };
+               F56352E316E543F800D21BAD /* GUIWindowSettingsProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsProfile.cpp; path = windows/GUIWindowSettingsProfile.cpp; sourceTree = "<group>"; };
+               F56352E416E543F800D21BAD /* GUIWindowSettingsProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsProfile.h; path = windows/GUIWindowSettingsProfile.h; sourceTree = "<group>"; };
+               F56352E516E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsScreenCalibration.cpp; path = windows/GUIWindowSettingsScreenCalibration.cpp; sourceTree = "<group>"; };
+               F56352E616E543F800D21BAD /* GUIWindowSettingsScreenCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsScreenCalibration.h; path = windows/GUIWindowSettingsScreenCalibration.h; sourceTree = "<group>"; };
+               F56352E716E543F800D21BAD /* GUIWindowTestPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowTestPattern.cpp; path = windows/GUIWindowTestPattern.cpp; sourceTree = "<group>"; };
+               F56352E816E543F800D21BAD /* GUIWindowTestPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowTestPattern.h; path = windows/GUIWindowTestPattern.h; sourceTree = "<group>"; };
+               F56352EF16E5440300D21BAD /* GUIDialogContentSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogContentSettings.cpp; path = dialogs/GUIDialogContentSettings.cpp; sourceTree = "<group>"; };
+               F56352F016E5440300D21BAD /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogContentSettings.h; path = dialogs/GUIDialogContentSettings.h; sourceTree = "<group>"; };
+               F56352F116E5440300D21BAD /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogLockSettings.cpp; path = dialogs/GUIDialogLockSettings.cpp; sourceTree = "<group>"; };
+               F56352F216E5440300D21BAD /* GUIDialogLockSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogLockSettings.h; path = dialogs/GUIDialogLockSettings.h; sourceTree = "<group>"; };
+               F56352F316E5440300D21BAD /* GUIDialogProfileSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogProfileSettings.cpp; path = dialogs/GUIDialogProfileSettings.cpp; sourceTree = "<group>"; };
+               F56352F416E5440300D21BAD /* GUIDialogProfileSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogProfileSettings.h; path = dialogs/GUIDialogProfileSettings.h; sourceTree = "<group>"; };
+               F56352F516E5440300D21BAD /* GUIDialogSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogSettings.cpp; path = dialogs/GUIDialogSettings.cpp; sourceTree = "<group>"; };
+               F56352F616E5440300D21BAD /* GUIDialogSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogSettings.h; path = dialogs/GUIDialogSettings.h; sourceTree = "<group>"; };
+               F56352FB16E5441600D21BAD /* AppParamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppParamParser.cpp; sourceTree = "<group>"; };
+               F56352FC16E5441600D21BAD /* AppParamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppParamParser.h; sourceTree = "<group>"; };
                F56B143312CAF279009B4C96 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
                F56B14A412CAF523009B4C96 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
                F56B15D412CD67A9009B4C96 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
                F56C83E1131F42E8000AD0F6 /* iso9660.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iso9660.h; sourceTree = "<group>"; };
                F56C83E2131F42E8000AD0F6 /* ISO9660Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISO9660Directory.cpp; sourceTree = "<group>"; };
                F56C83E3131F42E8000AD0F6 /* ISO9660Directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISO9660Directory.h; sourceTree = "<group>"; };
-               F56C83E4131F42E8000AD0F6 /* LastFMDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMDirectory.cpp; sourceTree = "<group>"; };
-               F56C83E5131F42E8000AD0F6 /* LastFMDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMDirectory.h; sourceTree = "<group>"; };
                F56C83E6131F42E8000AD0F6 /* MultiPathDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathDirectory.cpp; sourceTree = "<group>"; };
                F56C83E7131F42E8000AD0F6 /* MultiPathDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiPathDirectory.h; sourceTree = "<group>"; };
                F56C83E8131F42E8000AD0F6 /* MultiPathFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathFile.cpp; sourceTree = "<group>"; };
                F56C861F131F42EA000AD0F6 /* Artist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Artist.h; sourceTree = "<group>"; };
                F56C8620131F42EA000AD0F6 /* GUIViewStateMusic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIViewStateMusic.cpp; sourceTree = "<group>"; };
                F56C8621131F42EA000AD0F6 /* GUIViewStateMusic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIViewStateMusic.h; sourceTree = "<group>"; };
-               F56C8622131F42EA000AD0F6 /* LastFmManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFmManager.cpp; sourceTree = "<group>"; };
-               F56C8623131F42EA000AD0F6 /* LastFmManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFmManager.h; sourceTree = "<group>"; };
                F56C8624131F42EA000AD0F6 /* MusicDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabase.cpp; sourceTree = "<group>"; };
                F56C8625131F42EA000AD0F6 /* MusicDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabase.h; sourceTree = "<group>"; };
                F56C8626131F42EA000AD0F6 /* MusicInfoLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicInfoLoader.cpp; sourceTree = "<group>"; };
                F56C8628131F42EA000AD0F6 /* Song.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Song.cpp; sourceTree = "<group>"; };
                F56C8629131F42EA000AD0F6 /* Song.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Song.h; sourceTree = "<group>"; };
                F56C862C131F42EA000AD0F6 /* errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = errors.h; sourceTree = "<group>"; };
-               F56C862D131F42EA000AD0F6 /* lastfmscrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lastfmscrobbler.cpp; sourceTree = "<group>"; };
-               F56C862E131F42EA000AD0F6 /* lastfmscrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lastfmscrobbler.h; sourceTree = "<group>"; };
-               F56C862F131F42EA000AD0F6 /* librefmscrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = librefmscrobbler.cpp; sourceTree = "<group>"; };
-               F56C8630131F42EA000AD0F6 /* librefmscrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = librefmscrobbler.h; sourceTree = "<group>"; };
-               F56C8631131F42EA000AD0F6 /* scrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scrobbler.cpp; sourceTree = "<group>"; };
-               F56C8632131F42EA000AD0F6 /* scrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scrobbler.h; sourceTree = "<group>"; };
                F56C8634131F42EA000AD0F6 /* NetworkLinux.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkLinux.cpp; sourceTree = "<group>"; };
                F56C8635131F42EA000AD0F6 /* NetworkLinux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkLinux.h; sourceTree = "<group>"; };
                F56C8637131F42EA000AD0F6 /* ZeroconfBrowserOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ZeroconfBrowserOSX.cpp; sourceTree = "<group>"; };
                F56C86AD131F42EB000AD0F6 /* RenderSystemGLES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSystemGLES.h; sourceTree = "<group>"; };
                F56C86AE131F42EB000AD0F6 /* RenderSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSystem.cpp; sourceTree = "<group>"; };
                F56C86AF131F42EB000AD0F6 /* RenderSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSystem.h; sourceTree = "<group>"; };
-               F56C86B2131F42EB000AD0F6 /* GUIDialogContentSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogContentSettings.cpp; sourceTree = "<group>"; };
-               F56C86B3131F42EB000AD0F6 /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogContentSettings.h; sourceTree = "<group>"; };
-               F56C86B4131F42EB000AD0F6 /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogLockSettings.cpp; sourceTree = "<group>"; };
-               F56C86B5131F42EB000AD0F6 /* GUIDialogLockSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogLockSettings.h; sourceTree = "<group>"; };
-               F56C86B6131F42EB000AD0F6 /* GUIDialogProfileSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogProfileSettings.cpp; sourceTree = "<group>"; };
-               F56C86B7131F42EB000AD0F6 /* GUIDialogProfileSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogProfileSettings.h; sourceTree = "<group>"; };
-               F56C86B8131F42EB000AD0F6 /* GUIDialogSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSettings.cpp; sourceTree = "<group>"; };
-               F56C86B9131F42EB000AD0F6 /* GUIDialogSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogSettings.h; sourceTree = "<group>"; };
-               F56C86BA131F42EB000AD0F6 /* GUIWindowTestPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowTestPattern.cpp; sourceTree = "<group>"; };
-               F56C86BB131F42EB000AD0F6 /* GUIWindowTestPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowTestPattern.h; sourceTree = "<group>"; };
                F56C86BC131F42EB000AD0F6 /* GUISettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUISettings.cpp; sourceTree = "<group>"; };
                F56C86BD131F42EB000AD0F6 /* GUISettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUISettings.h; sourceTree = "<group>"; };
                F56C86BE131F42EB000AD0F6 /* AdvancedSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AdvancedSettings.cpp; sourceTree = "<group>"; };
                F56C86BF131F42EB000AD0F6 /* AdvancedSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdvancedSettings.h; sourceTree = "<group>"; };
-               F56C86C0131F42EB000AD0F6 /* GUIWindowSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettings.cpp; sourceTree = "<group>"; };
-               F56C86C1131F42EB000AD0F6 /* GUIWindowSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettings.h; sourceTree = "<group>"; };
-               F56C86C2131F42EB000AD0F6 /* GUIWindowSettingsCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsCategory.cpp; sourceTree = "<group>"; };
-               F56C86C3131F42EB000AD0F6 /* GUIWindowSettingsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsCategory.h; sourceTree = "<group>"; };
-               F56C86C4131F42EB000AD0F6 /* GUIWindowSettingsProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsProfile.cpp; sourceTree = "<group>"; };
-               F56C86C5131F42EB000AD0F6 /* GUIWindowSettingsProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsProfile.h; sourceTree = "<group>"; };
-               F56C86C6131F42EB000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsScreenCalibration.cpp; sourceTree = "<group>"; };
-               F56C86C7131F42EB000AD0F6 /* GUIWindowSettingsScreenCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsScreenCalibration.h; sourceTree = "<group>"; };
                F56C86C8131F42EB000AD0F6 /* Profile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Profile.cpp; sourceTree = "<group>"; };
                F56C86C9131F42EB000AD0F6 /* Profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Profile.h; sourceTree = "<group>"; };
                F56C86CA131F42EB000AD0F6 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
                F56C86CB131F42EB000AD0F6 /* Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Settings.h; sourceTree = "<group>"; };
-               F56C86CC131F42EB000AD0F6 /* SettingsControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsControls.cpp; sourceTree = "<group>"; };
-               F56C86CD131F42EB000AD0F6 /* SettingsControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsControls.h; sourceTree = "<group>"; };
                F56C86CE131F42EB000AD0F6 /* VideoSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoSettings.cpp; sourceTree = "<group>"; };
                F56C86CF131F42EB000AD0F6 /* VideoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoSettings.h; sourceTree = "<group>"; };
                F56C86D2131F42EB000AD0F6 /* DarwinStorageProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DarwinStorageProvider.cpp; sourceTree = "<group>"; };
                                DF23461E15FA675200A934F6 /* UPnPRenderer.h */,
                                DF23461F15FA675200A934F6 /* UPnPServer.cpp */,
                                DF23462015FA675200A934F6 /* UPnPServer.h */,
+                               F56352D716E543BD00D21BAD /* UPnPSettings.cpp */,
+                               F56352D816E543BD00D21BAD /* UPnPSettings.h */,
                        );
                        path = upnp;
                        sourceTree = "<group>";
                        path = pthreads;
                        sourceTree = "<group>";
                };
+               F56352DB16E543DE00D21BAD /* windows */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F56352DD16E543F800D21BAD /* GUISettingControls.cpp */,
+                               F56352DE16E543F800D21BAD /* GUISettingControls.h */,
+                               F56352DF16E543F800D21BAD /* GUIWindowSettings.cpp */,
+                               F56352E016E543F800D21BAD /* GUIWindowSettings.h */,
+                               F56352E116E543F800D21BAD /* GUIWindowSettingsCategory.cpp */,
+                               F56352E216E543F800D21BAD /* GUIWindowSettingsCategory.h */,
+                               F56352E316E543F800D21BAD /* GUIWindowSettingsProfile.cpp */,
+                               F56352E416E543F800D21BAD /* GUIWindowSettingsProfile.h */,
+                               F56352E516E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp */,
+                               F56352E616E543F800D21BAD /* GUIWindowSettingsScreenCalibration.h */,
+                               F56352E716E543F800D21BAD /* GUIWindowTestPattern.cpp */,
+                               F56352E816E543F800D21BAD /* GUIWindowTestPattern.h */,
+                       );
+                       name = windows;
+                       sourceTree = "<group>";
+               };
+               F56352DC16E543E900D21BAD /* dialogs */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F56352EF16E5440300D21BAD /* GUIDialogContentSettings.cpp */,
+                               F56352F016E5440300D21BAD /* GUIDialogContentSettings.h */,
+                               F56352F116E5440300D21BAD /* GUIDialogLockSettings.cpp */,
+                               F56352F216E5440300D21BAD /* GUIDialogLockSettings.h */,
+                               F56352F316E5440300D21BAD /* GUIDialogProfileSettings.cpp */,
+                               F56352F416E5440300D21BAD /* GUIDialogProfileSettings.h */,
+                               F56352F516E5440300D21BAD /* GUIDialogSettings.cpp */,
+                               F56352F616E5440300D21BAD /* GUIDialogSettings.h */,
+                       );
+                       name = dialogs;
+                       sourceTree = "<group>";
+               };
                F56C8034131F42E5000AD0F6 /* Source */ = {
                        isa = PBXGroup;
                        children = (
                                F56C87BC131F42ED000AD0F6 /* Application.h */,
                                F56C87BD131F42ED000AD0F6 /* ApplicationMessenger.cpp */,
                                F56C87BE131F42ED000AD0F6 /* ApplicationMessenger.h */,
+                               F56352FB16E5441600D21BAD /* AppParamParser.cpp */,
+                               F56352FC16E5441600D21BAD /* AppParamParser.h */,
                                F56C87BF131F42ED000AD0F6 /* Autorun.cpp */,
                                F56C87C0131F42ED000AD0F6 /* Autorun.h */,
                                F56C87C1131F42ED000AD0F6 /* AutoSwitch.cpp */,
                                F56C83E3131F42E8000AD0F6 /* ISO9660Directory.h */,
                                DF93D7AB1444B105007C6459 /* ISOFile.cpp */,
                                DF93D7AC1444B105007C6459 /* ISOFile.h */,
-                               F56C83E4131F42E8000AD0F6 /* LastFMDirectory.cpp */,
-                               F56C83E5131F42E8000AD0F6 /* LastFMDirectory.h */,
-                               DF93D7AD1444B105007C6459 /* LastFMFile.cpp */,
-                               DF93D7AE1444B105007C6459 /* LastFMFile.h */,
                                7C1F6F7813ED178F001726AB /* LibraryDirectory.cpp */,
                                7C1F6F7913ED178F001726AB /* LibraryDirectory.h */,
                                DFDB00221516403A005079A4 /* MemBufferCache.cpp */,
                                F56C861F131F42EA000AD0F6 /* Artist.h */,
                                F56C8620131F42EA000AD0F6 /* GUIViewStateMusic.cpp */,
                                F56C8621131F42EA000AD0F6 /* GUIViewStateMusic.h */,
-                               F56C8622131F42EA000AD0F6 /* LastFmManager.cpp */,
-                               F56C8623131F42EA000AD0F6 /* LastFmManager.h */,
                                F56C8624131F42EA000AD0F6 /* MusicDatabase.cpp */,
                                F56C8625131F42EA000AD0F6 /* MusicDatabase.h */,
                                36A9467215CF208B00727135 /* MusicDbUrl.cpp */,
                        isa = PBXGroup;
                        children = (
                                DFCA6ADD15224671000BFAAE /* httprequesthandler */,
-                               F56C862B131F42EA000AD0F6 /* libscrobbler */,
                                F56C8633131F42EA000AD0F6 /* linux */,
                                F56C8636131F42EA000AD0F6 /* osx */,
                                DF23461715FA675200A934F6 /* upnp */,
                        path = network;
                        sourceTree = "<group>";
                };
-               F56C862B131F42EA000AD0F6 /* libscrobbler */ = {
-                       isa = PBXGroup;
-                       children = (
-                               F56C862C131F42EA000AD0F6 /* errors.h */,
-                               F56C862D131F42EA000AD0F6 /* lastfmscrobbler.cpp */,
-                               F56C862E131F42EA000AD0F6 /* lastfmscrobbler.h */,
-                               F56C862F131F42EA000AD0F6 /* librefmscrobbler.cpp */,
-                               F56C8630131F42EA000AD0F6 /* librefmscrobbler.h */,
-                               F56C8631131F42EA000AD0F6 /* scrobbler.cpp */,
-                               F56C8632131F42EA000AD0F6 /* scrobbler.h */,
-                       );
-                       path = libscrobbler;
-                       sourceTree = "<group>";
-               };
                F56C8633131F42EA000AD0F6 /* linux */ = {
                        isa = PBXGroup;
                        children = (
                F56C86B1131F42EB000AD0F6 /* settings */ = {
                        isa = PBXGroup;
                        children = (
+                               F56352DC16E543E900D21BAD /* dialogs */,
+                               F56352DB16E543DE00D21BAD /* windows */,
                                F56C86BE131F42EB000AD0F6 /* AdvancedSettings.cpp */,
                                F56C86BF131F42EB000AD0F6 /* AdvancedSettings.h */,
-                               7C0A7EDC13A5DC2800AFC2BD /* AppParamParser.cpp */,
-                               7C0A7EDD13A5DC2800AFC2BD /* AppParamParser.h */,
-                               F56C86B2131F42EB000AD0F6 /* GUIDialogContentSettings.cpp */,
-                               F56C86B3131F42EB000AD0F6 /* GUIDialogContentSettings.h */,
-                               F56C86B4131F42EB000AD0F6 /* GUIDialogLockSettings.cpp */,
-                               F56C86B5131F42EB000AD0F6 /* GUIDialogLockSettings.h */,
-                               F56C86B6131F42EB000AD0F6 /* GUIDialogProfileSettings.cpp */,
-                               F56C86B7131F42EB000AD0F6 /* GUIDialogProfileSettings.h */,
-                               F56C86B8131F42EB000AD0F6 /* GUIDialogSettings.cpp */,
-                               F56C86B9131F42EB000AD0F6 /* GUIDialogSettings.h */,
                                F56C86BC131F42EB000AD0F6 /* GUISettings.cpp */,
                                F56C86BD131F42EB000AD0F6 /* GUISettings.h */,
-                               F56C86C0131F42EB000AD0F6 /* GUIWindowSettings.cpp */,
-                               F56C86C1131F42EB000AD0F6 /* GUIWindowSettings.h */,
-                               F56C86C2131F42EB000AD0F6 /* GUIWindowSettingsCategory.cpp */,
-                               F56C86C3131F42EB000AD0F6 /* GUIWindowSettingsCategory.h */,
-                               F56C86C4131F42EB000AD0F6 /* GUIWindowSettingsProfile.cpp */,
-                               F56C86C5131F42EB000AD0F6 /* GUIWindowSettingsProfile.h */,
-                               F56C86C6131F42EB000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp */,
-                               F56C86C7131F42EB000AD0F6 /* GUIWindowSettingsScreenCalibration.h */,
-                               F56C86BA131F42EB000AD0F6 /* GUIWindowTestPattern.cpp */,
-                               F56C86BB131F42EB000AD0F6 /* GUIWindowTestPattern.h */,
                                F56C86C8131F42EB000AD0F6 /* Profile.cpp */,
                                F56C86C9131F42EB000AD0F6 /* Profile.h */,
                                F56C86CA131F42EB000AD0F6 /* Settings.cpp */,
                                F56C86CB131F42EB000AD0F6 /* Settings.h */,
-                               F56C86CC131F42EB000AD0F6 /* SettingsControls.cpp */,
-                               F56C86CD131F42EB000AD0F6 /* SettingsControls.h */,
                                F56C86CE131F42EB000AD0F6 /* VideoSettings.cpp */,
                                F56C86CF131F42EB000AD0F6 /* VideoSettings.h */,
                        );
                                F56C898A131F42ED000AD0F6 /* IFile.cpp in Sources */,
                                F56C898B131F42ED000AD0F6 /* iso9660.cpp in Sources */,
                                F56C898C131F42ED000AD0F6 /* ISO9660Directory.cpp in Sources */,
-                               F56C898D131F42ED000AD0F6 /* LastFMDirectory.cpp in Sources */,
                                F56C898E131F42ED000AD0F6 /* MultiPathDirectory.cpp in Sources */,
                                F56C898F131F42ED000AD0F6 /* MultiPathFile.cpp in Sources */,
                                F56C8990131F42ED000AD0F6 /* DirectoryNodeSingles.cpp in Sources */,
                                F56C8A9F131F42ED000AD0F6 /* Album.cpp in Sources */,
                                F56C8AA0131F42ED000AD0F6 /* Artist.cpp in Sources */,
                                F56C8AA1131F42ED000AD0F6 /* GUIViewStateMusic.cpp in Sources */,
-                               F56C8AA2131F42ED000AD0F6 /* LastFmManager.cpp in Sources */,
                                F56C8AA3131F42ED000AD0F6 /* MusicDatabase.cpp in Sources */,
                                F56C8AA4131F42ED000AD0F6 /* MusicInfoLoader.cpp in Sources */,
                                F56C8AA5131F42ED000AD0F6 /* Song.cpp in Sources */,
-                               F56C8AA6131F42ED000AD0F6 /* lastfmscrobbler.cpp in Sources */,
-                               F56C8AA7131F42ED000AD0F6 /* librefmscrobbler.cpp in Sources */,
-                               F56C8AA8131F42ED000AD0F6 /* scrobbler.cpp in Sources */,
                                F56C8AA9131F42ED000AD0F6 /* NetworkLinux.cpp in Sources */,
                                F56C8AAA131F42ED000AD0F6 /* ZeroconfBrowserOSX.cpp in Sources */,
                                F56C8AAB131F42ED000AD0F6 /* ZeroconfOSX.cpp in Sources */,
                                F56C8ADC131F42ED000AD0F6 /* GUIWindowPrograms.cpp in Sources */,
                                F56C8ADF131F42ED000AD0F6 /* RenderSystemGLES.cpp in Sources */,
                                F56C8AE0131F42ED000AD0F6 /* RenderSystem.cpp in Sources */,
-                               F56C8AE1131F42ED000AD0F6 /* GUIDialogContentSettings.cpp in Sources */,
-                               F56C8AE2131F42ED000AD0F6 /* GUIDialogLockSettings.cpp in Sources */,
-                               F56C8AE3131F42ED000AD0F6 /* GUIDialogProfileSettings.cpp in Sources */,
-                               F56C8AE4131F42ED000AD0F6 /* GUIDialogSettings.cpp in Sources */,
-                               F56C8AE5131F42ED000AD0F6 /* GUIWindowTestPattern.cpp in Sources */,
                                F56C8AE6131F42ED000AD0F6 /* GUISettings.cpp in Sources */,
                                F56C8AE7131F42ED000AD0F6 /* AdvancedSettings.cpp in Sources */,
-                               F56C8AE8131F42ED000AD0F6 /* GUIWindowSettings.cpp in Sources */,
-                               F56C8AE9131F42ED000AD0F6 /* GUIWindowSettingsCategory.cpp in Sources */,
-                               F56C8AEA131F42ED000AD0F6 /* GUIWindowSettingsProfile.cpp in Sources */,
-                               F56C8AEB131F42ED000AD0F6 /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
                                F56C8AEC131F42ED000AD0F6 /* Profile.cpp in Sources */,
                                F56C8AED131F42ED000AD0F6 /* Settings.cpp in Sources */,
-                               F56C8AEE131F42ED000AD0F6 /* SettingsControls.cpp in Sources */,
                                F56C8AEF131F42ED000AD0F6 /* VideoSettings.cpp in Sources */,
                                F56C8AF0131F42ED000AD0F6 /* DarwinStorageProvider.cpp in Sources */,
                                F56C8AF1131F42ED000AD0F6 /* AutorunMediaJob.cpp in Sources */,
                                C8EC5D26136953E100CCC10D /* XBMC_keytable.cpp in Sources */,
                                1840B77A1399616D007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B77B1399616D007C848B /* JSONVariantWriter.cpp in Sources */,
-                               7C0A7EDE13A5DC2800AFC2BD /* AppParamParser.cpp in Sources */,
                                18B700F613A6A7850009C1AF /* AddonVersion.cpp in Sources */,
                                7C0A7F9D13A9E70800AFC2BD /* GUIWindowDebugInfo.cpp in Sources */,
                                7C0A7FB213A9E72E00AFC2BD /* DirtyRegionSolvers.cpp in Sources */,
                                DF93D7D71444B105007C6459 /* FileReaderFile.cpp in Sources */,
                                DF93D7D81444B105007C6459 /* HDFile.cpp in Sources */,
                                DF93D7D91444B105007C6459 /* ISOFile.cpp in Sources */,
-                               DF93D7DA1444B105007C6459 /* LastFMFile.cpp in Sources */,
                                DF93D7DB1444B105007C6459 /* MusicDatabaseFile.cpp in Sources */,
                                DF93D7DC1444B105007C6459 /* NFSFile.cpp in Sources */,
                                DF93D7DD1444B105007C6459 /* PipeFile.cpp in Sources */,
                                DF64FE5916C07AF700D028FB /* ViewDatabase.cpp in Sources */,
                                DFD5813116C829350008EEA0 /* DAVCommon.cpp in Sources */,
                                DFD5813216C829350008EEA0 /* DAVFile.cpp in Sources */,
+                               F56352D916E543BD00D21BAD /* UPnPSettings.cpp in Sources */,
+                               F56352E916E543F800D21BAD /* GUISettingControls.cpp in Sources */,
+                               F56352EA16E543F800D21BAD /* GUIWindowSettings.cpp in Sources */,
+                               F56352EB16E543F800D21BAD /* GUIWindowSettingsCategory.cpp in Sources */,
+                               F56352EC16E543F800D21BAD /* GUIWindowSettingsProfile.cpp in Sources */,
+                               F56352ED16E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
+                               F56352EE16E543F800D21BAD /* GUIWindowTestPattern.cpp in Sources */,
+                               F56352F716E5440300D21BAD /* GUIDialogContentSettings.cpp in Sources */,
+                               F56352F816E5440300D21BAD /* GUIDialogLockSettings.cpp in Sources */,
+                               F56352F916E5440300D21BAD /* GUIDialogProfileSettings.cpp in Sources */,
+                               F56352FA16E5440300D21BAD /* GUIDialogSettings.cpp in Sources */,
+                               F56352FD16E5441600D21BAD /* AppParamParser.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index ee73a42..a7d8594 100644 (file)
                18B7C38A12942090009E7A26 /* GUIDialogAddonInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C38612942090009E7A26 /* GUIDialogAddonInfo.cpp */; };
                18B7C38B12942090009E7A26 /* GUIViewStateAddonBrowser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C38812942090009E7A26 /* GUIViewStateAddonBrowser.cpp */; };
                18B7C392129420E5009E7A26 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C38E129420E5009E7A26 /* Settings.cpp */; };
-               18B7C393129420E5009E7A26 /* SettingsControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C390129420E5009E7A26 /* SettingsControls.cpp */; };
-               18B7C39E12942114009E7A26 /* GUIWindowSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C39612942114009E7A26 /* GUIWindowSettings.cpp */; };
-               18B7C39F12942114009E7A26 /* GUIWindowSettingsCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C39812942114009E7A26 /* GUIWindowSettingsCategory.cpp */; };
-               18B7C3A012942114009E7A26 /* GUIWindowSettingsProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C39A12942114009E7A26 /* GUIWindowSettingsProfile.cpp */; };
-               18B7C3A112942114009E7A26 /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C39C12942114009E7A26 /* GUIWindowSettingsScreenCalibration.cpp */; };
                18B7C3A812942132009E7A26 /* AdvancedSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C3A612942132009E7A26 /* AdvancedSettings.cpp */; };
                18B7C7A91294222E009E7A26 /* AnimatedGif.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C7541294222E009E7A26 /* AnimatedGif.cpp */; };
                18B7C7AB1294222E009E7A26 /* D3DResource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C7561294222E009E7A26 /* D3DResource.cpp */; };
                18B7C8F31294261F009E7A26 /* StringUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8F11294261F009E7A26 /* StringUtils.cpp */; };
                18B7C8FB12942718009E7A26 /* GUIDialogAddonSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8F912942718009E7A26 /* GUIDialogAddonSettings.cpp */; };
                18B7C90012942761009E7A26 /* GUIDialogAudioSubtitleSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8FE12942761009E7A26 /* GUIDialogAudioSubtitleSettings.cpp */; };
-               18B7C90D129427A6009E7A26 /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C903129427A6009E7A26 /* GUIDialogContentSettings.cpp */; };
-               18B7C90E129427A6009E7A26 /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C905129427A6009E7A26 /* GUIDialogLockSettings.cpp */; };
-               18B7C90F129427A6009E7A26 /* GUIDialogProfileSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C907129427A6009E7A26 /* GUIDialogProfileSettings.cpp */; };
-               18B7C910129427A6009E7A26 /* GUIDialogSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C909129427A6009E7A26 /* GUIDialogSettings.cpp */; };
                18B7C911129427A6009E7A26 /* GUIDialogVideoSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C90B129427A6009E7A26 /* GUIDialogVideoSettings.cpp */; };
                18B7C930129428CA009E7A26 /* PlayList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C91D129428CA009E7A26 /* PlayList.cpp */; };
                18B7C931129428CA009E7A26 /* PlayListB4S.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C91F129428CA009E7A26 /* PlayListB4S.cpp */; };
                18E7CACB1578C26D001D4554 /* CDDARipJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18E7CAC91578C26D001D4554 /* CDDARipJob.cpp */; };
                18ECC96213CF178D00A9ED6C /* StreamUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18ECC96013CF178D00A9ED6C /* StreamUtils.cpp */; };
                1D638128161E211E003603ED /* PeripheralImon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D638126161E211E003603ED /* PeripheralImon.cpp */; };
+               1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */; };
                1DE0443515828F4B005DDB4D /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DE0443315828F4B005DDB4D /* Exception.cpp */; };
                32C631281423A90F00F18420 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; };
                36A9443D15821E2800727135 /* DatabaseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443B15821E2800727135 /* DatabaseUtils.cpp */; };
                5538432B15F3646C00CE061B /* NptPosixTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5538432A15F3646C00CE061B /* NptPosixTime.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
                5538433115F3678900CE061B /* NptCocoaEnviroment.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5538432D15F3678900CE061B /* NptCocoaEnviroment.mm */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
                5538433415F3685C00CE061B /* NptAppleAutoreleasePool.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5538433315F3685C00CE061B /* NptAppleAutoreleasePool.mm */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
-               7C0A7EC013A5DBCE00AFC2BD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0A7EBE13A5DBCE00AFC2BD /* AppParamParser.cpp */; };
                7C0B98A4154B79C30065A238 /* AEDeviceInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C0B98A1154B79C30065A238 /* AEDeviceInfo.cpp */; };
                7C1A492315A962EE004AF4A4 /* SeekHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C1A492115A962EE004AF4A4 /* SeekHandler.cpp */; };
                7C1A85661520522500C63311 /* TextureCacheJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C1A85631520522500C63311 /* TextureCacheJob.cpp */; };
                DF93D6A11444A8B1007C6459 /* FileReaderFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6731444A8B0007C6459 /* FileReaderFile.cpp */; };
                DF93D6A21444A8B1007C6459 /* HDFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6751444A8B0007C6459 /* HDFile.cpp */; };
                DF93D6A31444A8B1007C6459 /* ISOFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6771444A8B0007C6459 /* ISOFile.cpp */; };
-               DF93D6A41444A8B1007C6459 /* LastFMFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D6791444A8B0007C6459 /* LastFMFile.cpp */; };
                DF93D6A51444A8B1007C6459 /* MusicDatabaseFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67B1444A8B0007C6459 /* MusicDatabaseFile.cpp */; };
                DF93D6A61444A8B1007C6459 /* NFSFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67D1444A8B0007C6459 /* NFSFile.cpp */; };
                DF93D6A71444A8B1007C6459 /* PipeFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D67F1444A8B0007C6459 /* PipeFile.cpp */; };
                E38E20280D25F9FD00618676 /* IFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EE0D25F9FA00618676 /* IFile.cpp */; };
                E38E20290D25F9FD00618676 /* iso9660.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16F10D25F9FA00618676 /* iso9660.cpp */; };
                E38E202A0D25F9FD00618676 /* ISO9660Directory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16F30D25F9FA00618676 /* ISO9660Directory.cpp */; };
-               E38E202B0D25F9FD00618676 /* LastFMDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16F50D25F9FA00618676 /* LastFMDirectory.cpp */; };
                E38E20330D25F9FD00618676 /* MultiPathDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E17080D25F9FA00618676 /* MultiPathDirectory.cpp */; };
                E38E20340D25F9FD00618676 /* DirectoryNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E170B0D25F9FA00618676 /* DirectoryNode.cpp */; };
                E38E20350D25F9FD00618676 /* DirectoryNodeAlbum.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E170D0D25F9FA00618676 /* DirectoryNodeAlbum.cpp */; };
                E38E20D10D25F9FD00618676 /* GUIWindowWeather.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E18490D25F9FA00618676 /* GUIWindowWeather.cpp */; };
                E38E20D60D25F9FD00618676 /* LangCodeExpander.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E18560D25F9FA00618676 /* LangCodeExpander.cpp */; };
                E38E20D70D25F9FD00618676 /* LangInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E18580D25F9FA00618676 /* LangInfo.cpp */; };
-               E38E20D80D25F9FD00618676 /* LastFmManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E185A0D25F9FA00618676 /* LastFmManager.cpp */; };
-               E38E21670D25F9FD00618676 /* scrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E1A250D25F9FB00618676 /* scrobbler.cpp */; };
                E38E21740D25F9FD00618676 /* MediaCrawler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E1ABD0D25F9FB00618676 /* MediaCrawler.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
                E38E21760D25F9FD00618676 /* PltMicroMediaController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E1AC20D25F9FB00618676 /* PltMicroMediaController.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
                E38E21780D25F9FD00618676 /* PltAction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E1AC70D25F9FB00618676 /* PltAction.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
                F558F27B13ABD56600631E12 /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F27913ABD56600631E12 /* DirtyRegionSolvers.cpp */; };
                F558F27F13ABD57400631E12 /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F27D13ABD57400631E12 /* DirtyRegionTracker.cpp */; };
                F558F29613ABD7DF00631E12 /* GUIWindowDebugInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F29413ABD7DF00631E12 /* GUIWindowDebugInfo.cpp */; };
+               F563529616E53FAB00D21BAD /* UPnPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563529416E53FAB00D21BAD /* UPnPSettings.cpp */; settings = {COMPILER_FLAGS = "-I$SRCROOT/lib/libUPnP/Platinum/Source/Core -I$SRCROOT/lib/libUPnP/Platinum/Source/Platinum -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaConnect -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaRenderer -I$SRCROOT/lib/libUPnP/Platinum/Source/Devices/MediaServer -I$SRCROOT/lib/libUPnP/Platinum/Source/Extras -I$SRCROOT/lib/libUPnP/Neptune/Source/System/Posix -I$SRCROOT/lib/libUPnP/Neptune/Source/Core"; }; };
+               F56352AA16E5402100D21BAD /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352A216E5402100D21BAD /* GUIDialogContentSettings.cpp */; };
+               F56352AB16E5402100D21BAD /* GUIDialogLockSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352A416E5402100D21BAD /* GUIDialogLockSettings.cpp */; };
+               F56352AC16E5402100D21BAD /* GUIDialogProfileSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352A616E5402100D21BAD /* GUIDialogProfileSettings.cpp */; };
+               F56352AD16E5402100D21BAD /* GUIDialogSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352A816E5402100D21BAD /* GUIDialogSettings.cpp */; };
+               F56352BA16E5403400D21BAD /* GUISettingControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352AE16E5403400D21BAD /* GUISettingControls.cpp */; };
+               F56352BB16E5403400D21BAD /* GUIWindowSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352B016E5403400D21BAD /* GUIWindowSettings.cpp */; };
+               F56352BC16E5403400D21BAD /* GUIWindowSettingsCategory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352B216E5403400D21BAD /* GUIWindowSettingsCategory.cpp */; };
+               F56352BD16E5403400D21BAD /* GUIWindowSettingsProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352B416E5403400D21BAD /* GUIWindowSettingsProfile.cpp */; };
+               F56352BE16E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352B616E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp */; };
+               F56352BF16E5403400D21BAD /* GUIWindowTestPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352B816E5403400D21BAD /* GUIWindowTestPattern.cpp */; };
+               F56352C816E5436900D21BAD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352C616E5436900D21BAD /* AppParamParser.cpp */; };
                F56579AF13060D1E0085ED7F /* RenderCapture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56579AD13060D1E0085ED7F /* RenderCapture.cpp */; };
                F56A084B0F4A18FB003F9F87 /* karaokewindowbackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */; };
                F56C8CE7131F5DC6000AD0F6 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = F56C8CE6131F5DC6000AD0F6 /* libz.dylib */; };
                F59876BC0FBA34C0008EF4FB /* DVDPlayerAudioResampler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F59876BA0FBA34C0008EF4FB /* DVDPlayerAudioResampler.cpp */; };
                F59876C00FBA351D008EF4FB /* VideoReferenceClock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F59876BF0FBA351D008EF4FB /* VideoReferenceClock.cpp */; };
                F59879080FBAA0C3008EF4FB /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F59879070FBAA0C3008EF4FB /* QuartzCore.framework */; };
-               F5987B250FBB9682008EF4FB /* librefmscrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5987B220FBB9682008EF4FB /* librefmscrobbler.cpp */; };
-               F5987B260FBB9682008EF4FB /* lastfmscrobbler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5987B230FBB9682008EF4FB /* lastfmscrobbler.cpp */; };
                F5987F050FBDF274008EF4FB /* DPMSSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5987F040FBDF274008EF4FB /* DPMSSupport.cpp */; };
                F5987FDB0FBE2DFD008EF4FB /* PAPlayer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5987FDA0FBE2DFD008EF4FB /* PAPlayer.cpp */; };
                F599CD2B108E65370010EC2A /* IoSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F599CD29108E65370010EC2A /* IoSupport.cpp */; };
                F5F2EF4B0E593E0D0092C37F /* DVDFileInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5F2EF4A0E593E0D0092C37F /* DVDFileInfo.cpp */; };
                F5F8E1DA0E427E8000A8E96F /* VGMCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5F8E1D90E427E8000A8E96F /* VGMCodec.cpp */; };
                F5F8E1E80E427F6700A8E96F /* md5.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5F8E1E60E427F6700A8E96F /* md5.cpp */; };
-               F5F95DA00E4E203700C3FA5C /* GUIWindowTestPattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5F95D9F0E4E203700C3FA5C /* GUIWindowTestPattern.cpp */; };
                F5FAB0710EFABAC800BAD4AE /* VTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5FAB0700EFABAC800BAD4AE /* VTPFile.cpp */; };
                F5FAB0760EFABE2C00BAD4AE /* VTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5FAB0750EFABE2C00BAD4AE /* VTPDirectory.cpp */; };
                F5FAB07A0EFABE4A00BAD4AE /* VTPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5FAB0790EFABE4A00BAD4AE /* VTPSession.cpp */; };
                18B7C38912942090009E7A26 /* GUIViewStateAddonBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIViewStateAddonBrowser.h; sourceTree = "<group>"; };
                18B7C38E129420E5009E7A26 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
                18B7C38F129420E5009E7A26 /* Settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Settings.h; sourceTree = "<group>"; };
-               18B7C390129420E5009E7A26 /* SettingsControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsControls.cpp; sourceTree = "<group>"; };
-               18B7C391129420E5009E7A26 /* SettingsControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsControls.h; sourceTree = "<group>"; };
-               18B7C39612942114009E7A26 /* GUIWindowSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettings.cpp; sourceTree = "<group>"; };
-               18B7C39712942114009E7A26 /* GUIWindowSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettings.h; sourceTree = "<group>"; };
-               18B7C39812942114009E7A26 /* GUIWindowSettingsCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsCategory.cpp; sourceTree = "<group>"; };
-               18B7C39912942114009E7A26 /* GUIWindowSettingsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsCategory.h; sourceTree = "<group>"; };
-               18B7C39A12942114009E7A26 /* GUIWindowSettingsProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsProfile.cpp; sourceTree = "<group>"; };
-               18B7C39B12942114009E7A26 /* GUIWindowSettingsProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsProfile.h; sourceTree = "<group>"; };
-               18B7C39C12942114009E7A26 /* GUIWindowSettingsScreenCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowSettingsScreenCalibration.cpp; sourceTree = "<group>"; };
-               18B7C39D12942114009E7A26 /* GUIWindowSettingsScreenCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowSettingsScreenCalibration.h; sourceTree = "<group>"; };
                18B7C3A612942132009E7A26 /* AdvancedSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AdvancedSettings.cpp; sourceTree = "<group>"; };
                18B7C3A712942132009E7A26 /* AdvancedSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdvancedSettings.h; sourceTree = "<group>"; };
                18B7C6F61294222D009E7A26 /* AnimatedGif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimatedGif.h; sourceTree = "<group>"; };
                18B7C8FA12942718009E7A26 /* GUIDialogAddonSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogAddonSettings.h; sourceTree = "<group>"; };
                18B7C8FE12942761009E7A26 /* GUIDialogAudioSubtitleSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogAudioSubtitleSettings.cpp; sourceTree = "<group>"; };
                18B7C8FF12942761009E7A26 /* GUIDialogAudioSubtitleSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogAudioSubtitleSettings.h; sourceTree = "<group>"; };
-               18B7C903129427A6009E7A26 /* GUIDialogContentSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogContentSettings.cpp; sourceTree = "<group>"; };
-               18B7C904129427A6009E7A26 /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogContentSettings.h; sourceTree = "<group>"; };
-               18B7C905129427A6009E7A26 /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogLockSettings.cpp; sourceTree = "<group>"; };
-               18B7C906129427A6009E7A26 /* GUIDialogLockSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogLockSettings.h; sourceTree = "<group>"; };
-               18B7C907129427A6009E7A26 /* GUIDialogProfileSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogProfileSettings.cpp; sourceTree = "<group>"; };
-               18B7C908129427A6009E7A26 /* GUIDialogProfileSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogProfileSettings.h; sourceTree = "<group>"; };
-               18B7C909129427A6009E7A26 /* GUIDialogSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSettings.cpp; sourceTree = "<group>"; };
-               18B7C90A129427A6009E7A26 /* GUIDialogSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogSettings.h; sourceTree = "<group>"; };
                18B7C90B129427A6009E7A26 /* GUIDialogVideoSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogVideoSettings.cpp; sourceTree = "<group>"; };
                18B7C90C129427A6009E7A26 /* GUIDialogVideoSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogVideoSettings.h; sourceTree = "<group>"; };
                18B7C91D129428CA009E7A26 /* PlayList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlayList.cpp; sourceTree = "<group>"; };
                18ECC96113CF178D00A9ED6C /* StreamUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamUtils.h; sourceTree = "<group>"; };
                1D638126161E211E003603ED /* PeripheralImon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PeripheralImon.cpp; sourceTree = "<group>"; };
                1D638127161E211E003603ED /* PeripheralImon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralImon.h; sourceTree = "<group>"; };
+               1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PeripheralBusCEC.cpp; sourceTree = "<group>"; };
+               1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralBusCEC.h; sourceTree = "<group>"; };
                1DE0443315828F4B005DDB4D /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = commons/Exception.cpp; sourceTree = "<group>"; };
                1DE0443415828F4B005DDB4D /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = commons/Exception.h; sourceTree = "<group>"; };
                32C631261423A90F00F18420 /* JpegIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JpegIO.cpp; sourceTree = "<group>"; };
                6E97BDC10DA2B620003A2A89 /* EventServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventServer.h; sourceTree = "<group>"; };
                6E97BDC30DA2B620003A2A89 /* Fanart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fanart.h; sourceTree = "<group>"; };
                6E97BDC40DA2B620003A2A89 /* Socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Socket.h; sourceTree = "<group>"; };
-               7C0A7EBE13A5DBCE00AFC2BD /* AppParamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppParamParser.cpp; sourceTree = "<group>"; };
-               7C0A7EBF13A5DBCE00AFC2BD /* AppParamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppParamParser.h; sourceTree = "<group>"; };
                7C0B98A1154B79C30065A238 /* AEDeviceInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AEDeviceInfo.cpp; sourceTree = "<group>"; };
                7C0B98A2154B79C30065A238 /* AEDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AEDeviceInfo.h; sourceTree = "<group>"; };
                7C1A492115A962EE004AF4A4 /* SeekHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SeekHandler.cpp; sourceTree = "<group>"; };
                DF93D6761444A8B0007C6459 /* HDFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDFile.h; sourceTree = "<group>"; };
                DF93D6771444A8B0007C6459 /* ISOFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISOFile.cpp; sourceTree = "<group>"; };
                DF93D6781444A8B0007C6459 /* ISOFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISOFile.h; sourceTree = "<group>"; };
-               DF93D6791444A8B0007C6459 /* LastFMFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMFile.cpp; sourceTree = "<group>"; };
-               DF93D67A1444A8B0007C6459 /* LastFMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMFile.h; sourceTree = "<group>"; };
                DF93D67B1444A8B0007C6459 /* MusicDatabaseFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicDatabaseFile.cpp; sourceTree = "<group>"; };
                DF93D67C1444A8B0007C6459 /* MusicDatabaseFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicDatabaseFile.h; sourceTree = "<group>"; };
                DF93D67D1444A8B0007C6459 /* NFSFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSFile.cpp; sourceTree = "<group>"; };
                E38E16F20D25F9FA00618676 /* iso9660.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iso9660.h; sourceTree = "<group>"; };
                E38E16F30D25F9FA00618676 /* ISO9660Directory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISO9660Directory.cpp; sourceTree = "<group>"; };
                E38E16F40D25F9FA00618676 /* ISO9660Directory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISO9660Directory.h; sourceTree = "<group>"; };
-               E38E16F50D25F9FA00618676 /* LastFMDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFMDirectory.cpp; sourceTree = "<group>"; };
-               E38E16F60D25F9FA00618676 /* LastFMDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFMDirectory.h; sourceTree = "<group>"; };
                E38E17080D25F9FA00618676 /* MultiPathDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiPathDirectory.cpp; sourceTree = "<group>"; };
                E38E17090D25F9FA00618676 /* MultiPathDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiPathDirectory.h; sourceTree = "<group>"; };
                E38E170B0D25F9FA00618676 /* DirectoryNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectoryNode.cpp; sourceTree = "<group>"; };
                E38E18570D25F9FA00618676 /* LangCodeExpander.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LangCodeExpander.h; sourceTree = "<group>"; };
                E38E18580D25F9FA00618676 /* LangInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LangInfo.cpp; sourceTree = "<group>"; };
                E38E18590D25F9FA00618676 /* LangInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LangInfo.h; sourceTree = "<group>"; };
-               E38E185A0D25F9FA00618676 /* LastFmManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LastFmManager.cpp; sourceTree = "<group>"; };
-               E38E185B0D25F9FA00618676 /* LastFmManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LastFmManager.h; sourceTree = "<group>"; };
                E38E18830D25F9FA00618676 /* libexif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libexif.h; sourceTree = "<group>"; };
                E38E196E0D25F9FB00618676 /* hdhomerun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hdhomerun.h; sourceTree = "<group>"; };
                E38E196F0D25F9FB00618676 /* hdhomerun_channelscan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hdhomerun_channelscan.h; sourceTree = "<group>"; };
                E38E1A1F0D25F9FB00618676 /* rtv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtv.h; sourceTree = "<group>"; };
                E38E1A200D25F9FB00618676 /* sleep.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sleep.h; sourceTree = "<group>"; };
                E38E1A220D25F9FB00618676 /* errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = errors.h; sourceTree = "<group>"; };
-               E38E1A250D25F9FB00618676 /* scrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = scrobbler.cpp; sourceTree = "<group>"; };
-               E38E1A260D25F9FB00618676 /* scrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scrobbler.h; sourceTree = "<group>"; };
                E38E1AB80D25F9FB00618676 /* SConstruct */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SConstruct; sourceTree = "<group>"; };
                E38E1ABD0D25F9FB00618676 /* MediaCrawler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaCrawler.cpp; sourceTree = "<group>"; };
                E38E1ABE0D25F9FB00618676 /* MediaCrawler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaCrawler.h; sourceTree = "<group>"; };
                F558F29513ABD7DF00631E12 /* GUIWindowDebugInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowDebugInfo.h; sourceTree = "<group>"; };
                F558F51D13AF03AD00631E12 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadLocal.h; sourceTree = "<group>"; };
                F558F54D13AF091000631E12 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = "<group>"; };
+               F563529416E53FAB00D21BAD /* UPnPSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UPnPSettings.cpp; sourceTree = "<group>"; };
+               F563529516E53FAB00D21BAD /* UPnPSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UPnPSettings.h; sourceTree = "<group>"; };
+               F56352A216E5402100D21BAD /* GUIDialogContentSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogContentSettings.cpp; path = dialogs/GUIDialogContentSettings.cpp; sourceTree = "<group>"; };
+               F56352A316E5402100D21BAD /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogContentSettings.h; path = dialogs/GUIDialogContentSettings.h; sourceTree = "<group>"; };
+               F56352A416E5402100D21BAD /* GUIDialogLockSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogLockSettings.cpp; path = dialogs/GUIDialogLockSettings.cpp; sourceTree = "<group>"; };
+               F56352A516E5402100D21BAD /* GUIDialogLockSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogLockSettings.h; path = dialogs/GUIDialogLockSettings.h; sourceTree = "<group>"; };
+               F56352A616E5402100D21BAD /* GUIDialogProfileSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogProfileSettings.cpp; path = dialogs/GUIDialogProfileSettings.cpp; sourceTree = "<group>"; };
+               F56352A716E5402100D21BAD /* GUIDialogProfileSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogProfileSettings.h; path = dialogs/GUIDialogProfileSettings.h; sourceTree = "<group>"; };
+               F56352A816E5402100D21BAD /* GUIDialogSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIDialogSettings.cpp; path = dialogs/GUIDialogSettings.cpp; sourceTree = "<group>"; };
+               F56352A916E5402100D21BAD /* GUIDialogSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogSettings.h; path = dialogs/GUIDialogSettings.h; sourceTree = "<group>"; };
+               F56352AE16E5403400D21BAD /* GUISettingControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUISettingControls.cpp; path = windows/GUISettingControls.cpp; sourceTree = "<group>"; };
+               F56352AF16E5403400D21BAD /* GUISettingControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUISettingControls.h; path = windows/GUISettingControls.h; sourceTree = "<group>"; };
+               F56352B016E5403400D21BAD /* GUIWindowSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettings.cpp; path = windows/GUIWindowSettings.cpp; sourceTree = "<group>"; };
+               F56352B116E5403400D21BAD /* GUIWindowSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettings.h; path = windows/GUIWindowSettings.h; sourceTree = "<group>"; };
+               F56352B216E5403400D21BAD /* GUIWindowSettingsCategory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsCategory.cpp; path = windows/GUIWindowSettingsCategory.cpp; sourceTree = "<group>"; };
+               F56352B316E5403400D21BAD /* GUIWindowSettingsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsCategory.h; path = windows/GUIWindowSettingsCategory.h; sourceTree = "<group>"; };
+               F56352B416E5403400D21BAD /* GUIWindowSettingsProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsProfile.cpp; path = windows/GUIWindowSettingsProfile.cpp; sourceTree = "<group>"; };
+               F56352B516E5403400D21BAD /* GUIWindowSettingsProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsProfile.h; path = windows/GUIWindowSettingsProfile.h; sourceTree = "<group>"; };
+               F56352B616E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowSettingsScreenCalibration.cpp; path = windows/GUIWindowSettingsScreenCalibration.cpp; sourceTree = "<group>"; };
+               F56352B716E5403400D21BAD /* GUIWindowSettingsScreenCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowSettingsScreenCalibration.h; path = windows/GUIWindowSettingsScreenCalibration.h; sourceTree = "<group>"; };
+               F56352B816E5403400D21BAD /* GUIWindowTestPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIWindowTestPattern.cpp; path = windows/GUIWindowTestPattern.cpp; sourceTree = "<group>"; };
+               F56352B916E5403400D21BAD /* GUIWindowTestPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIWindowTestPattern.h; path = windows/GUIWindowTestPattern.h; sourceTree = "<group>"; };
+               F56352C616E5436900D21BAD /* AppParamParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppParamParser.cpp; sourceTree = "<group>"; };
+               F56352C716E5436900D21BAD /* AppParamParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppParamParser.h; sourceTree = "<group>"; };
                F56579AD13060D1E0085ED7F /* RenderCapture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderCapture.cpp; sourceTree = "<group>"; };
                F56579AE13060D1E0085ED7F /* RenderCapture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderCapture.h; sourceTree = "<group>"; };
                F56A08490F4A18FB003F9F87 /* karaokewindowbackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokewindowbackground.h; sourceTree = "<group>"; };
                F59876BE0FBA351D008EF4FB /* VideoReferenceClock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoReferenceClock.h; sourceTree = "<group>"; };
                F59876BF0FBA351D008EF4FB /* VideoReferenceClock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoReferenceClock.cpp; sourceTree = "<group>"; };
                F59879070FBAA0C3008EF4FB /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
-               F5987B210FBB9682008EF4FB /* lastfmscrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lastfmscrobbler.h; sourceTree = "<group>"; };
-               F5987B220FBB9682008EF4FB /* librefmscrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = librefmscrobbler.cpp; sourceTree = "<group>"; };
-               F5987B230FBB9682008EF4FB /* lastfmscrobbler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = lastfmscrobbler.cpp; sourceTree = "<group>"; };
-               F5987B240FBB9682008EF4FB /* librefmscrobbler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = librefmscrobbler.h; sourceTree = "<group>"; };
                F5987F030FBDF274008EF4FB /* DPMSSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DPMSSupport.h; sourceTree = "<group>"; };
                F5987F040FBDF274008EF4FB /* DPMSSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DPMSSupport.cpp; sourceTree = "<group>"; };
                F5987FD90FBE2DFD008EF4FB /* PAPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PAPlayer.h; sourceTree = "<group>"; };
                F5F8E1D90E427E8000A8E96F /* VGMCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = VGMCodec.cpp; sourceTree = "<group>"; };
                F5F8E1E60E427F6700A8E96F /* md5.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = md5.cpp; sourceTree = "<group>"; };
                F5F8E1E70E427F6700A8E96F /* md5.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
-               F5F95D9E0E4E203700C3FA5C /* GUIWindowTestPattern.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GUIWindowTestPattern.h; sourceTree = "<group>"; };
-               F5F95D9F0E4E203700C3FA5C /* GUIWindowTestPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowTestPattern.cpp; sourceTree = "<group>"; };
                F5FAB06F0EFABAC800BAD4AE /* VTPFile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VTPFile.h; sourceTree = "<group>"; };
                F5FAB0700EFABAC800BAD4AE /* VTPFile.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = VTPFile.cpp; sourceTree = "<group>"; };
                F5FAB0740EFABE2C00BAD4AE /* VTPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VTPDirectory.h; sourceTree = "<group>"; };
                                880DBE4A0DC223FF00E26B71 /* Artist.h */,
                                E38E17FB0D25F9FA00618676 /* GUIViewStateMusic.cpp */,
                                E38E17FC0D25F9FA00618676 /* GUIViewStateMusic.h */,
-                               E38E185A0D25F9FA00618676 /* LastFmManager.cpp */,
-                               E38E185B0D25F9FA00618676 /* LastFmManager.h */,
                                E38E1D8F0D25F9FD00618676 /* MusicDatabase.cpp */,
                                E38E1D900D25F9FD00618676 /* MusicDatabase.h */,
                                36A9466515CF1FD200727135 /* MusicDbUrl.cpp */,
                        name = Products;
                        sourceTree = "<group>";
                };
+               1DAFDB7916DFDCA7007F8C68 /* virtual */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */,
+                               1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */,
+                       );
+                       path = virtual;
+                       sourceTree = "<group>";
+               };
                38F4E56013CCCB3B00664821 /* platform */ = {
                        isa = PBXGroup;
                        children = (
                        isa = PBXGroup;
                        children = (
                                DFCA6AB8152245CD000BFAAE /* httprequesthandler */,
-                               4313772B12D6474F00680C15 /* libscrobbler */,
                                432D7CE112D86D4900CE4C49 /* linux */,
                                4313772312D646E300680C15 /* osx */,
                                DF2345D715FA639500A934F6 /* upnp */,
                        path = osx;
                        sourceTree = "<group>";
                };
-               4313772B12D6474F00680C15 /* libscrobbler */ = {
-                       isa = PBXGroup;
-                       children = (
-                               E38E1A220D25F9FB00618676 /* errors.h */,
-                               F5987B230FBB9682008EF4FB /* lastfmscrobbler.cpp */,
-                               F5987B210FBB9682008EF4FB /* lastfmscrobbler.h */,
-                               F5987B220FBB9682008EF4FB /* librefmscrobbler.cpp */,
-                               F5987B240FBB9682008EF4FB /* librefmscrobbler.h */,
-                               E38E1A250D25F9FB00618676 /* scrobbler.cpp */,
-                               E38E1A260D25F9FB00618676 /* scrobbler.h */,
-                       );
-                       path = libscrobbler;
-                       sourceTree = "<group>";
-               };
                4313773012D647BB00680C15 /* dbwrappers */ = {
                        isa = PBXGroup;
                        children = (
                DF2345D715FA639500A934F6 /* upnp */ = {
                        isa = PBXGroup;
                        children = (
-                               552840CA1626163B00ED1333 /* UPnPPlayer.cpp */,
-                               552840CB1626163B00ED1333 /* UPnPPlayer.h */,
                                DF2345D915FA639500A934F6 /* UPnP.cpp */,
                                DF2345DA15FA639500A934F6 /* UPnP.h */,
                                DF2345DB15FA639500A934F6 /* UPnPInternal.cpp */,
                                DF2345DC15FA639500A934F6 /* UPnPInternal.h */,
+                               552840CA1626163B00ED1333 /* UPnPPlayer.cpp */,
+                               552840CB1626163B00ED1333 /* UPnPPlayer.h */,
                                DF2345DD15FA639500A934F6 /* UPnPRenderer.cpp */,
                                DF2345DE15FA639500A934F6 /* UPnPRenderer.h */,
                                DF2345DF15FA639500A934F6 /* UPnPServer.cpp */,
                                DF2345E015FA639500A934F6 /* UPnPServer.h */,
+                               F563529416E53FAB00D21BAD /* UPnPSettings.cpp */,
+                               F563529516E53FAB00D21BAD /* UPnPSettings.h */,
                        );
                        path = upnp;
                        sourceTree = "<group>";
                                E38E14650D25F9F900618676 /* Application.h */,
                                E38E14660D25F9F900618676 /* ApplicationMessenger.cpp */,
                                E38E14670D25F9F900618676 /* ApplicationMessenger.h */,
+                               F56352C616E5436900D21BAD /* AppParamParser.cpp */,
+                               F56352C716E5436900D21BAD /* AppParamParser.h */,
                                E38E146E0D25F9F900618676 /* Autorun.cpp */,
                                E38E146F0D25F9F900618676 /* Autorun.h */,
                                E38E14700D25F9F900618676 /* AutoSwitch.cpp */,
                                E38E16F40D25F9FA00618676 /* ISO9660Directory.h */,
                                DF93D6771444A8B0007C6459 /* ISOFile.cpp */,
                                DF93D6781444A8B0007C6459 /* ISOFile.h */,
-                               E38E16F50D25F9FA00618676 /* LastFMDirectory.cpp */,
-                               E38E16F60D25F9FA00618676 /* LastFMDirectory.h */,
-                               DF93D6791444A8B0007C6459 /* LastFMFile.cpp */,
-                               DF93D67A1444A8B0007C6459 /* LastFMFile.h */,
                                7C1F6EB913ECCFA7001726AB /* LibraryDirectory.cpp */,
                                7C1F6EBA13ECCFA7001726AB /* LibraryDirectory.h */,
                                E38E16970D25F9FA00618676 /* MemBufferCache.cpp */,
                E38E1E000D25F9FD00618676 /* settings */ = {
                        isa = PBXGroup;
                        children = (
+                               F563529F16E53FE900D21BAD /* dialogs */,
+                               F56352A016E53FF300D21BAD /* windows */,
                                18B7C3A612942132009E7A26 /* AdvancedSettings.cpp */,
                                18B7C3A712942132009E7A26 /* AdvancedSettings.h */,
-                               7C0A7EBE13A5DBCE00AFC2BD /* AppParamParser.cpp */,
-                               7C0A7EBF13A5DBCE00AFC2BD /* AppParamParser.h */,
-                               18B7C903129427A6009E7A26 /* GUIDialogContentSettings.cpp */,
-                               18B7C904129427A6009E7A26 /* GUIDialogContentSettings.h */,
-                               18B7C905129427A6009E7A26 /* GUIDialogLockSettings.cpp */,
-                               18B7C906129427A6009E7A26 /* GUIDialogLockSettings.h */,
-                               18B7C907129427A6009E7A26 /* GUIDialogProfileSettings.cpp */,
-                               18B7C908129427A6009E7A26 /* GUIDialogProfileSettings.h */,
-                               18B7C909129427A6009E7A26 /* GUIDialogSettings.cpp */,
-                               18B7C90A129427A6009E7A26 /* GUIDialogSettings.h */,
                                18B7C8C212942451009E7A26 /* GUISettings.cpp */,
                                18B7C8C312942451009E7A26 /* GUISettings.h */,
-                               18B7C39612942114009E7A26 /* GUIWindowSettings.cpp */,
-                               18B7C39712942114009E7A26 /* GUIWindowSettings.h */,
-                               18B7C39812942114009E7A26 /* GUIWindowSettingsCategory.cpp */,
-                               18B7C39912942114009E7A26 /* GUIWindowSettingsCategory.h */,
-                               18B7C39A12942114009E7A26 /* GUIWindowSettingsProfile.cpp */,
-                               18B7C39B12942114009E7A26 /* GUIWindowSettingsProfile.h */,
-                               18B7C39C12942114009E7A26 /* GUIWindowSettingsScreenCalibration.cpp */,
-                               18B7C39D12942114009E7A26 /* GUIWindowSettingsScreenCalibration.h */,
-                               F5F95D9F0E4E203700C3FA5C /* GUIWindowTestPattern.cpp */,
-                               F5F95D9E0E4E203700C3FA5C /* GUIWindowTestPattern.h */,
                                E38E1DF10D25F9FD00618676 /* Profile.cpp */,
                                E38E1DF20D25F9FD00618676 /* Profile.h */,
                                18B7C38E129420E5009E7A26 /* Settings.cpp */,
                                18B7C38F129420E5009E7A26 /* Settings.h */,
-                               18B7C390129420E5009E7A26 /* SettingsControls.cpp */,
-                               18B7C391129420E5009E7A26 /* SettingsControls.h */,
                                E38E1E010D25F9FD00618676 /* VideoSettings.cpp */,
                                E38E1E020D25F9FD00618676 /* VideoSettings.h */,
                        );
                        path = libhts;
                        sourceTree = "<group>";
                };
+               F563529F16E53FE900D21BAD /* dialogs */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F56352A216E5402100D21BAD /* GUIDialogContentSettings.cpp */,
+                               F56352A316E5402100D21BAD /* GUIDialogContentSettings.h */,
+                               F56352A416E5402100D21BAD /* GUIDialogLockSettings.cpp */,
+                               F56352A516E5402100D21BAD /* GUIDialogLockSettings.h */,
+                               F56352A616E5402100D21BAD /* GUIDialogProfileSettings.cpp */,
+                               F56352A716E5402100D21BAD /* GUIDialogProfileSettings.h */,
+                               F56352A816E5402100D21BAD /* GUIDialogSettings.cpp */,
+                               F56352A916E5402100D21BAD /* GUIDialogSettings.h */,
+                       );
+                       name = dialogs;
+                       sourceTree = "<group>";
+               };
+               F56352A016E53FF300D21BAD /* windows */ = {
+                       isa = PBXGroup;
+                       children = (
+                               F56352AE16E5403400D21BAD /* GUISettingControls.cpp */,
+                               F56352AF16E5403400D21BAD /* GUISettingControls.h */,
+                               F56352B016E5403400D21BAD /* GUIWindowSettings.cpp */,
+                               F56352B116E5403400D21BAD /* GUIWindowSettings.h */,
+                               F56352B216E5403400D21BAD /* GUIWindowSettingsCategory.cpp */,
+                               F56352B316E5403400D21BAD /* GUIWindowSettingsCategory.h */,
+                               F56352B416E5403400D21BAD /* GUIWindowSettingsProfile.cpp */,
+                               F56352B516E5403400D21BAD /* GUIWindowSettingsProfile.h */,
+                               F56352B616E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp */,
+                               F56352B716E5403400D21BAD /* GUIWindowSettingsScreenCalibration.h */,
+                               F56352B816E5403400D21BAD /* GUIWindowTestPattern.cpp */,
+                               F56352B916E5403400D21BAD /* GUIWindowTestPattern.h */,
+                       );
+                       name = windows;
+                       sourceTree = "<group>";
+               };
                F57E1ED20E36E8FD00700C9D /* internal libs */ = {
                        isa = PBXGroup;
                        children = (
                F5E1050D140AA38000175026 /* bus */ = {
                        isa = PBXGroup;
                        children = (
+                               1DAFDB7916DFDCA7007F8C68 /* virtual */,
                                F5E10512140AA38000175026 /* osx */,
                                F5E10515140AA38000175026 /* PeripheralBus.cpp */,
                                F5E10516140AA38000175026 /* PeripheralBus.h */,
                                E38E20280D25F9FD00618676 /* IFile.cpp in Sources */,
                                E38E20290D25F9FD00618676 /* iso9660.cpp in Sources */,
                                E38E202A0D25F9FD00618676 /* ISO9660Directory.cpp in Sources */,
-                               E38E202B0D25F9FD00618676 /* LastFMDirectory.cpp in Sources */,
                                E38E20330D25F9FD00618676 /* MultiPathDirectory.cpp in Sources */,
                                E38E20340D25F9FD00618676 /* DirectoryNode.cpp in Sources */,
                                E38E20350D25F9FD00618676 /* DirectoryNodeAlbum.cpp in Sources */,
                                E38E20D10D25F9FD00618676 /* GUIWindowWeather.cpp in Sources */,
                                E38E20D60D25F9FD00618676 /* LangCodeExpander.cpp in Sources */,
                                E38E20D70D25F9FD00618676 /* LangInfo.cpp in Sources */,
-                               E38E20D80D25F9FD00618676 /* LastFmManager.cpp in Sources */,
-                               E38E21670D25F9FD00618676 /* scrobbler.cpp in Sources */,
                                E38E21740D25F9FD00618676 /* MediaCrawler.cpp in Sources */,
                                E38E21760D25F9FD00618676 /* PltMicroMediaController.cpp in Sources */,
                                E38E21780D25F9FD00618676 /* PltAction.cpp in Sources */,
                                815EE6350E17F1DC009FBE3C /* DVDInputStreamRTMP.cpp in Sources */,
                                F5F8E1DA0E427E8000A8E96F /* VGMCodec.cpp in Sources */,
                                F5F8E1E80E427F6700A8E96F /* md5.cpp in Sources */,
-                               F5F95DA00E4E203700C3FA5C /* GUIWindowTestPattern.cpp in Sources */,
                                F506297A0E57B9680066625A /* MultiPathFile.cpp in Sources */,
                                F5F2EF4B0E593E0D0092C37F /* DVDFileInfo.cpp in Sources */,
                                F5FDF51D0E7218950005B0A6 /* AsyncFileCopy.cpp in Sources */,
                                F5AACA970FB3E2B800DBB77C /* GUIDialogSlider.cpp in Sources */,
                                F59876BC0FBA34C0008EF4FB /* DVDPlayerAudioResampler.cpp in Sources */,
                                F59876C00FBA351D008EF4FB /* VideoReferenceClock.cpp in Sources */,
-                               F5987B250FBB9682008EF4FB /* librefmscrobbler.cpp in Sources */,
-                               F5987B260FBB9682008EF4FB /* lastfmscrobbler.cpp in Sources */,
                                83A72B970FBC8E3B00171871 /* LockFree.cpp in Sources */,
                                F5987F050FBDF274008EF4FB /* DPMSSupport.cpp in Sources */,
                                F5987FDB0FBE2DFD008EF4FB /* PAPlayer.cpp in Sources */,
                                18B7C38A12942090009E7A26 /* GUIDialogAddonInfo.cpp in Sources */,
                                18B7C38B12942090009E7A26 /* GUIViewStateAddonBrowser.cpp in Sources */,
                                18B7C392129420E5009E7A26 /* Settings.cpp in Sources */,
-                               18B7C393129420E5009E7A26 /* SettingsControls.cpp in Sources */,
-                               18B7C39E12942114009E7A26 /* GUIWindowSettings.cpp in Sources */,
-                               18B7C39F12942114009E7A26 /* GUIWindowSettingsCategory.cpp in Sources */,
-                               18B7C3A012942114009E7A26 /* GUIWindowSettingsProfile.cpp in Sources */,
-                               18B7C3A112942114009E7A26 /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
                                18B7C3A812942132009E7A26 /* AdvancedSettings.cpp in Sources */,
                                18B7C7A91294222E009E7A26 /* AnimatedGif.cpp in Sources */,
                                18B7C7AB1294222E009E7A26 /* D3DResource.cpp in Sources */,
                                18B7C8F31294261F009E7A26 /* StringUtils.cpp in Sources */,
                                18B7C8FB12942718009E7A26 /* GUIDialogAddonSettings.cpp in Sources */,
                                18B7C90012942761009E7A26 /* GUIDialogAudioSubtitleSettings.cpp in Sources */,
-                               18B7C90D129427A6009E7A26 /* GUIDialogContentSettings.cpp in Sources */,
-                               18B7C90E129427A6009E7A26 /* GUIDialogLockSettings.cpp in Sources */,
-                               18B7C90F129427A6009E7A26 /* GUIDialogProfileSettings.cpp in Sources */,
-                               18B7C910129427A6009E7A26 /* GUIDialogSettings.cpp in Sources */,
                                18B7C911129427A6009E7A26 /* GUIDialogVideoSettings.cpp in Sources */,
                                18B7C930129428CA009E7A26 /* PlayList.cpp in Sources */,
                                18B7C931129428CA009E7A26 /* PlayListB4S.cpp in Sources */,
                                C8EC5D0E1369519D00CCC10D /* XBMC_keytable.cpp in Sources */,
                                1840B74D13993D8A007C848B /* JSONVariantParser.cpp in Sources */,
                                1840B75313993DA0007C848B /* JSONVariantWriter.cpp in Sources */,
-                               7C0A7EC013A5DBCE00AFC2BD /* AppParamParser.cpp in Sources */,
                                18B700E113A6A5750009C1AF /* AddonVersion.cpp in Sources */,
                                F558F25613ABCF7800631E12 /* WinEventsOSX.mm in Sources */,
                                F558F27B13ABD56600631E12 /* DirtyRegionSolvers.cpp in Sources */,
                                DF93D6A11444A8B1007C6459 /* FileReaderFile.cpp in Sources */,
                                DF93D6A21444A8B1007C6459 /* HDFile.cpp in Sources */,
                                DF93D6A31444A8B1007C6459 /* ISOFile.cpp in Sources */,
-                               DF93D6A41444A8B1007C6459 /* LastFMFile.cpp in Sources */,
                                DF93D6A51444A8B1007C6459 /* MusicDatabaseFile.cpp in Sources */,
                                DF93D6A61444A8B1007C6459 /* NFSFile.cpp in Sources */,
                                DF93D6A71444A8B1007C6459 /* PipeFile.cpp in Sources */,
                                DF404A3A16B9896C00D8023E /* imagefactory.cpp in Sources */,
                                DFD5812516C828500008EEA0 /* DAVCommon.cpp in Sources */,
                                DFD5812616C828500008EEA0 /* DAVFile.cpp in Sources */,
+                               1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */,
+                               F563529616E53FAB00D21BAD /* UPnPSettings.cpp in Sources */,
+                               F56352AA16E5402100D21BAD /* GUIDialogContentSettings.cpp in Sources */,
+                               F56352AB16E5402100D21BAD /* GUIDialogLockSettings.cpp in Sources */,
+                               F56352AC16E5402100D21BAD /* GUIDialogProfileSettings.cpp in Sources */,
+                               F56352AD16E5402100D21BAD /* GUIDialogSettings.cpp in Sources */,
+                               F56352BA16E5403400D21BAD /* GUISettingControls.cpp in Sources */,
+                               F56352BB16E5403400D21BAD /* GUIWindowSettings.cpp in Sources */,
+                               F56352BC16E5403400D21BAD /* GUIWindowSettingsCategory.cpp in Sources */,
+                               F56352BD16E5403400D21BAD /* GUIWindowSettingsProfile.cpp in Sources */,
+                               F56352BE16E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
+                               F56352BF16E5403400D21BAD /* GUIWindowTestPattern.cpp in Sources */,
+                               F56352C816E5436900D21BAD /* AppParamParser.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 35e58fa..4740bd6 100644 (file)
@@ -158,6 +158,10 @@ namespace ADDON
         dlsym(m_libXBMC_addon, "XBMC_queue_notification");
       if (XBMC_queue_notification == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
 
+      XBMC_wake_on_lan = (bool (*)(void* HANDLE, void *CB, const char *mac))
+        dlsym(m_libXBMC_addon, "XBMC_wake_on_lan");
+      if (XBMC_wake_on_lan == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
+
       XBMC_unknown_to_utf8 = (char* (*)(void* HANDLE, void* CB, const char* str))
         dlsym(m_libXBMC_addon, "XBMC_unknown_to_utf8");
       if (XBMC_unknown_to_utf8 == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
@@ -296,6 +300,16 @@ namespace ADDON
     }
 
     /*!
+     * @brief Send WakeOnLan magic packet.
+     * @param mac Network address of the host to wake.
+     * @return True if the magic packet was successfully sent, false otherwise.
+     */
+    bool WakeOnLan(const char* mac)
+    {
+      return XBMC_wake_on_lan(m_Handle, m_Callbacks, mac);
+    }
+
+    /*!
      * @brief Translate a string with an unknown encoding to UTF8.
      * @param str The string to translate.
      * @return The string translated to UTF8. Must be freed by calling FreeString() when done.
@@ -541,6 +555,7 @@ namespace ADDON
     void (*XBMC_log)(void *HANDLE, void* CB, const addon_log_t loglevel, const char *msg);
     bool (*XBMC_get_setting)(void *HANDLE, void* CB, const char* settingName, void *settingValue);
     void (*XBMC_queue_notification)(void *HANDLE, void* CB, const queue_msg_t type, const char *msg);
+    bool (*XBMC_wake_on_lan)(void *HANDLE, void* CB, const char* mac);
     char* (*XBMC_unknown_to_utf8)(void *HANDLE, void* CB, const char* str);
     char* (*XBMC_get_localized_string)(void *HANDLE, void* CB, int dwCode);
     char* (*XBMC_get_dvd_menu_language)(void *HANDLE, void* CB);
index 3fccaf0..4050fdf 100644 (file)
@@ -35,6 +35,12 @@ typedef void* GUIHANDLE;
 #define GUI_HELPER_DLL "/library.xbmc.gui/" GUI_HELPER_DLL_NAME
 #endif
 
+/* current ADDONGUI API version */
+#define XBMC_GUI_API_VERSION "1.0.0"
+
+/* min. ADDONGUI API version */
+#define XBMC_GUI_MIN_API_VERSION "1.0.0"
+
 #define ADDON_ACTION_PREVIOUS_MENU          10
 #define ADDON_ACTION_CLOSE_DIALOG           51
 
@@ -43,6 +49,7 @@ class CAddonGUISpinControl;
 class CAddonGUIRadioButton;
 class CAddonGUIProgressControl;
 class CAddonListItem;
+class CAddonGUIRenderingControl;
 
 class CHelper_libXBMC_gui
 {
@@ -154,6 +161,14 @@ public:
       dlsym(m_libXBMC_gui, "GUI_ListItem_destroy");
     if (GUI_ListItem_destroy == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
 
+    GUI_control_get_rendering = (CAddonGUIRenderingControl* (*)(void *HANDLE, void *CB, CAddonGUIWindow *window, int controlId))
+      dlsym(m_libXBMC_gui, "GUI_control_get_rendering");
+    if (GUI_control_get_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
+
+    GUI_control_release_rendering = (void (*)(CAddonGUIRenderingControl* p))
+      dlsym(m_libXBMC_gui, "GUI_control_release_rendering");
+    if (GUI_control_release_rendering == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; }
+
 
     m_Callbacks = GUI_register_me(m_Handle);
     return m_Callbacks != NULL;
@@ -234,6 +249,16 @@ public:
     return GUI_ListItem_destroy(p);
   }
 
+  CAddonGUIRenderingControl* Control_getRendering(CAddonGUIWindow *window, int controlId)
+  {
+    return GUI_control_get_rendering(m_Handle, m_Callbacks, window, controlId);
+  }
+
+  void Control_releaseRendering(CAddonGUIRenderingControl* p)
+  {
+    return GUI_control_release_rendering(p);
+  }
+
 protected:
   void* (*GUI_register_me)(void *HANDLE);
   void (*GUI_unregister_me)(void *HANDLE, void* CB);
@@ -252,6 +277,8 @@ protected:
   void (*GUI_control_release_progress)(CAddonGUIProgressControl* p);
   CAddonListItem* (*GUI_ListItem_create)(void *HANDLE, void* CB, const char *label, const char *label2, const char *iconImage, const char *thumbnailImage, const char *path);
   void (*GUI_ListItem_destroy)(CAddonListItem* p);
+  CAddonGUIRenderingControl* (*GUI_control_get_rendering)(void *HANDLE, void* CB, CAddonGUIWindow *window, int controlId);
+  void (*GUI_control_release_rendering)(CAddonGUIRenderingControl* p);
 
 private:
   void *m_libXBMC_gui;
@@ -355,6 +382,7 @@ class CAddonGUIWindow
 friend class CAddonGUISpinControl;
 friend class CAddonGUIRadioButton;
 friend class CAddonGUIProgressControl;
+friend class CAddonGUIRenderingControl;
 
 public:
   CAddonGUIWindow(void *hdl, void *cb, const char *xmlFilename, const char *defaultSkin, bool forceFallback, bool asDialog);
@@ -385,6 +413,7 @@ public:
   virtual void         SetCurrentListPosition(int listPos);
   virtual int          GetCurrentListPosition();
   virtual void         SetControlLabel(int controlId, const char *label);
+  virtual void         MarkDirtyRegion();
 
   virtual bool         OnClick(int controlId);
   virtual bool         OnFocus(int controlId);
@@ -402,3 +431,29 @@ protected:
   void *m_Handle;
   void *m_cb;
 };
+
+class CAddonGUIRenderingControl
+{
+public:
+  CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId);
+  virtual ~CAddonGUIRenderingControl();
+  virtual void Init();
+
+  virtual bool Create(int x, int y, int w, int h, void *device);
+  virtual void Render();
+  virtual void Stop();
+  virtual bool Dirty();
+
+  GUIHANDLE m_cbhdl;
+  bool (*CBCreate)(GUIHANDLE cbhdl, int x, int y, int w, int h, void *device);
+  void (*CBRender)(GUIHANDLE cbhdl);
+  void (*CBStop)(GUIHANDLE cbhdl);
+  bool (*CBDirty)(GUIHANDLE cbhdl);
+
+private:
+  CAddonGUIWindow *m_Window;
+  int         m_ControlId;
+  GUIHANDLE   m_RenderingHandle;
+  void *m_Handle;
+  void *m_cb;
+};
index d21b21c..1d70420 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<addon id="xbmc.pvr" version="1.6.0" provider-name="Team XBMC">
+<addon id="xbmc.pvr" version="1.7.0" provider-name="Team XBMC">
   <requires>
     <import addon="xbmc.core" version="0.1.0"/>
   </requires>
index b176919..0b20572 100644 (file)
@@ -159,8 +159,6 @@ libusb_disabled="== libusb disabled. Plug and play USB device support will not b
 libusb_disabled_udev_found="== libusb disabled. =="
 libcec_enabled="== libcec enabled. =="
 libcec_disabled="== libcec disabled. CEC adapter support will not be available. =="
-libcec_disabled_missing_libs="== libcec disabled because it either needs libudev, or libusb a compatible version of the RPi API. CEC adapter support will not be available. =="
-cec_rpi_api_missing="== no compatible RPi API found =="
 
 # External library message strings
 external_libraries_enabled="== Use of all supported external libraries enabled. =="
@@ -976,9 +974,15 @@ AC_CHECK_LIB([jpeg],        [main],, AC_MSG_ERROR($missing_library)) # check for
 AC_CHECK_LIB([tiff],        [main],, AC_MSG_ERROR($missing_library))
 if echo "$ARCH" | grep -q freebsd; then
 AC_CHECK_LIB([pthread],     [main],LIBS="-pthread $LIBS", AC_MSG_ERROR($missing_library))
+AC_CHECK_LIB([pthread],     [pthread_set_name_np],
+  AC_DEFINE([HAVE_PTHREAD_SET_NAME_NP],[1],["Define to 1 if pthread has pthread_set_name_np"]),
+  AC_MSG_RESULT([Could not find pthread_set_name_np in pthread]))
 else
 if test "$target_platform" != "target_android" ; then
   AC_CHECK_LIB([pthread],     [main],, AC_MSG_ERROR($missing_library))
+  AC_CHECK_LIB([pthread],     [pthread_setname_np],
+    AC_DEFINE([HAVE_PTHREAD_SETNAME_NP],[1],["Define to 1 if pthread has pthread_setname_np"]),
+    AC_MSG_RESULT([Could not find pthread_setname_np in pthread]))
 fi
 fi
 AC_CHECK_LIB([lzo2],        [main],, AC_MSG_ERROR($missing_library))
@@ -1497,46 +1501,18 @@ fi
 
 # libcec
 USE_LIBCEC=0
-USE_CEC_RPI_API=0
-use_rpi_cec_api="auto"
 if test "x$use_libcec" != "xno"; then
-  case "${host_cpu}" in
-    arm*)
-      echo "will check for RPi support"
-      AC_CHECK_HEADER(interface/vmcs_host/vc_cec.h,,use_rpi_cec_api="no")
-      ;;
-    *)
-      echo "will not check for RPi support (unsupported cpu: ${host_cpu})"
-      use_rpi_cec_api="no"
-      ;;
-  esac
-
-  # libcec needs libudev, libusb or the RPi API under linux, or the device will never be detected.
-  if test "$host_vendor" != "apple" && test "$use_libusb" = "no" && test "$use_libudev" = "no" && test "$use_rpi_cec_api" = "no"; then
-    if test "x$use_libcec" != "xauto"; then
-      AC_MSG_ERROR($libcec_disabled_missing_libs)
-    else
-      use_libcec="no"
-      AC_MSG_NOTICE($libcec_disabled_missing_libs)
-    fi
-  fi
-
   # libcec is dyloaded, so we need to check for its headers and link any depends.
   if test "x$use_libcec" != "xno"; then
     if test "x$use_libcec" != "xauto"; then
-      PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
+      PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_ERROR($libcec_disabled)])
     else
-      PKG_CHECK_MODULES([CEC],[libcec >= 2.0.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
+      PKG_CHECK_MODULES([CEC],[libcec >= 2.1.0],,[use_libcec="no";AC_MSG_RESULT($libcec_disabled)])
     fi
 
     if test "x$use_libcec" != "xno"; then
       INCLUDES="$INCLUDES $CEC_CFLAGS"
       USE_LIBCEC=1;AC_DEFINE([HAVE_LIBCEC],[1],["Define to 1 if libcec is installed"])
-      if test "x$use_rpi_cec_api" != "xno"; then
-        LIBS+=" -lvcos -lvchiq_arm"
-        AC_DEFINE([HAVE_CEC_RPI_API],[1],["Define to 1 if the CEC RPi API is installed"])
-        USE_CEC_RPI_API=1
-      fi
       XB_FIND_SONAME([LIBCEC],[cec],[use_libcec])
       AC_MSG_NOTICE($libcec_enabled)
     else
@@ -2289,11 +2265,6 @@ fi
 
 if test "x$use_libcec" != "xno"; then
   final_message="$final_message\n  libcec support:\tYes"
-  if test "x$use_rpi_cec_api" != "xno"; then
-    final_message="$final_message\n  libcec RPi support:\tYes"
-  else
-    final_message="$final_message\n  libcec RPi support:\tNo"
-  fi
 else
   final_message="$final_message\n  libcec support:\tNo"
 fi
@@ -2487,7 +2458,6 @@ AC_SUBST(USE_AIRTUNES)
 AC_SUBST(USE_LIBUDEV)
 AC_SUBST(USE_LIBUSB)
 AC_SUBST(USE_LIBCEC)
-AC_SUBST(USE_CEC_RPI_API)
 AC_SUBST(USE_MYSQL)
 AC_SUBST(USE_WEB_SERVER)
 AC_SUBST(USE_UPNP)
index 5b79b46..01c4263 100644 (file)
@@ -6007,57 +6007,6 @@ msgctxt "#15200"
 msgid "Last.fm"
 msgstr ""
 
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15201"
-msgid "Submit songs to Last.fm"
-msgstr ""
-
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15202"
-msgid "Last.fm username"
-msgstr ""
-
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15203"
-msgid "Last.fm password"
-msgstr ""
-
-msgctxt "#15204"
-msgid "Unable to handshake: sleeping..."
-msgstr ""
-
-msgctxt "#15205"
-msgid "Please update XBMC"
-msgstr ""
-
-msgctxt "#15206"
-msgid "Bad authorization: Check username and password"
-msgstr ""
-
-msgctxt "#15207"
-msgid "Connected"
-msgstr ""
-
-msgctxt "#15208"
-msgid "Not connected"
-msgstr ""
-
-msgctxt "#15209"
-msgid "Submit interval %i"
-msgstr ""
-
-msgctxt "#15210"
-msgid "Cached %i songs"
-msgstr ""
-
-msgctxt "#15211"
-msgid "Submitting..."
-msgstr ""
-
-msgctxt "#15212"
-msgid "Submitting in %i secs"
-msgstr ""
-
 msgctxt "#15213"
 msgid "Play using..."
 msgstr ""
@@ -6074,227 +6023,7 @@ msgctxt "#15216"
 msgid "Play in party mode"
 msgstr ""
 
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15217"
-msgid "Submit songs to Libre.fm"
-msgstr ""
-
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15218"
-msgid "Libre.fm username"
-msgstr ""
-
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15219"
-msgid "Libre.fm password"
-msgstr ""
-
-msgctxt "#15220"
-msgid "Libre.fm"
-msgstr ""
-
-#: xbmc/settings/GUISettings.cpp
-msgctxt "#15221"
-msgid "Song submission"
-msgstr ""
-
-#empty strings from id 15222 to 15249
-
-msgctxt "#15250"
-msgid "Submit Last.fm radio to Last.fm"
-msgstr ""
-
-msgctxt "#15251"
-msgid "Connecting to Last.fm..."
-msgstr ""
-
-msgctxt "#15252"
-msgid "Selecting station..."
-msgstr ""
-
-msgctxt "#15253"
-msgid "Search similar artists..."
-msgstr ""
-
-msgctxt "#15254"
-msgid "Search similar tags..."
-msgstr ""
-
-msgctxt "#15255"
-msgid "Your profile (%name%)"
-msgstr ""
-
-msgctxt "#15256"
-msgid "Overall top tags"
-msgstr ""
-
-msgctxt "#15257"
-msgid "Top artists for tag %name%"
-msgstr ""
-
-msgctxt "#15258"
-msgid "Top albums for tag %name%"
-msgstr ""
-
-msgctxt "#15259"
-msgid "Top tracks for tag %name%"
-msgstr ""
-
-msgctxt "#15260"
-msgid "Listen to tag %name% Last.fm radio"
-msgstr ""
-
-msgctxt "#15261"
-msgid "Similar artists as %name%"
-msgstr ""
-
-msgctxt "#15262"
-msgid "Top %name% albums"
-msgstr ""
-
-msgctxt "#15263"
-msgid "Top %name% tracks"
-msgstr ""
-
-msgctxt "#15264"
-msgid "Top %name% tags"
-msgstr ""
-
-msgctxt "#15265"
-msgid "Biggest fans of %name%"
-msgstr ""
-
-msgctxt "#15266"
-msgid "Listen to %name% fans Last.fm radio"
-msgstr ""
-
-msgctxt "#15267"
-msgid "Listen to %name% similar artists Last.fm radio"
-msgstr ""
-
-msgctxt "#15268"
-msgid "Top artists for user %name%"
-msgstr ""
-
-msgctxt "#15269"
-msgid "Top albums for user %name%"
-msgstr ""
-
-msgctxt "#15270"
-msgid "Top tracks for user %name%"
-msgstr ""
-
-msgctxt "#15271"
-msgid "Friends of user %name%"
-msgstr ""
-
-msgctxt "#15272"
-msgid "Neighbours of user %name%"
-msgstr ""
-
-msgctxt "#15273"
-msgid "Weekly artist chart for %name%"
-msgstr ""
-
-msgctxt "#15274"
-msgid "Weekly album chart for %name%"
-msgstr ""
-
-msgctxt "#15275"
-msgid "Weekly track chart for %name%"
-msgstr ""
-
-msgctxt "#15276"
-msgid "Listen to %name%'s neighbours Last.fm radio"
-msgstr ""
-
-msgctxt "#15277"
-msgid "Listen to %name%'s personal Last.fm radio"
-msgstr ""
-
-msgctxt "#15278"
-msgid "Listen to %name%'s mix Last.fm radio"
-msgstr ""
-
-msgctxt "#15279"
-msgid "Retrieving list from Last.fm..."
-msgstr ""
-
-msgctxt "#15280"
-msgid "Can't retrieve list from Last.fm..."
-msgstr ""
-
-msgctxt "#15281"
-msgid "Enter an artist name to find related ones"
-msgstr ""
-
-msgctxt "#15282"
-msgid "Enter a tag name to find similar ones"
-msgstr ""
-
-msgctxt "#15283"
-msgid "Tracks recently listened by %name%"
-msgstr ""
-
-msgctxt "#15284"
-msgid "Listen to %name%'s recommendations Last.fm radio"
-msgstr ""
-
-msgctxt "#15285"
-msgid "Top tags for user %name%"
-msgstr ""
-
-#empty string with id 15286
-
-msgctxt "#15287"
-msgid "Do you want to add the current track to your loved tracks?"
-msgstr ""
-
-msgctxt "#15288"
-msgid "Do you want to ban the current track?"
-msgstr ""
-
-msgctxt "#15289"
-msgid "Added to your loved tracks: '%s'."
-msgstr ""
-
-msgctxt "#15290"
-msgid "Could not add '%s' to your loved tracks."
-msgstr ""
-
-msgctxt "#15291"
-msgid "Banned: '%s'."
-msgstr ""
-
-msgctxt "#15292"
-msgid "Could not ban '%s'."
-msgstr ""
-
-msgctxt "#15293"
-msgid "Tracks recently loved by %name%"
-msgstr ""
-
-msgctxt "#15294"
-msgid "Tracks recently banned by %name%"
-msgstr ""
-
-msgctxt "#15295"
-msgid "Remove from loved tracks"
-msgstr ""
-
-msgctxt "#15296"
-msgid "Un-ban"
-msgstr ""
-
-msgctxt "#15297"
-msgid "Do you want to remove this track from your loved tracks?"
-msgstr ""
-
-msgctxt "#15298"
-msgid "Do you want to un-ban this track?"
-msgstr ""
-
-#empty string with id 15299
+#empty strings from id 15216 to 15299
 
 msgctxt "#15300"
 msgid "Path not found or invalid"
@@ -12008,3 +11737,8 @@ msgstr ""
 msgctxt "#36041"
 msgid "* Item folder"
 msgstr ""
+
+#: xbmc/settings/GUISettings.cpp
+msgctxt "#36042"
+msgid "Use limited color range (16-235)"
+msgstr ""
index 9849424..e39931d 100644 (file)
@@ -84,6 +84,14 @@ DLLEXPORT void XBMC_queue_notification(void *hdl, void* cb, const queue_msg_t ty
   ((CB_AddOnLib*)cb)->QueueNotification(((AddonCB*)hdl)->addonData, type, msg);
 }
 
+DLLEXPORT bool XBMC_wake_on_lan(void* hdl, void* cb, char* mac)
+{
+  if (cb == NULL)
+    return false;
+
+  return ((CB_AddOnLib*)cb)->WakeOnLan(mac);
+}
+
 DLLEXPORT char* XBMC_unknown_to_utf8(void *hdl, void* cb, const char* str)
 {
   if (cb == NULL)
index c9765a3..7da98db 100644 (file)
@@ -300,6 +300,11 @@ void CAddonGUIWindow::SetControlLabel(int controlId, const char *label)
   ((CB_GUILib*)m_cb)->Window_SetControlLabel(((AddonCB*)m_Handle)->addonData, m_WindowHandle, controlId, label);
 }
 
+void CAddonGUIWindow::MarkDirtyRegion()
+{
+  ((CB_GUILib*)m_cb)->Window_MarkDirtyRegion(((AddonCB*)m_Handle)->addonData, m_WindowHandle);
+}
+
 ///-------------------------------------
 /// cGUISpinControl
 
@@ -555,5 +560,91 @@ void CAddonListItem::SetPath(const char *Path)
     ((CB_GUILib*)m_cb)->ListItem_SetPath(((AddonCB*)m_Handle)->addonData, m_ListItemHandle, Path);
 }
 
+///-------------------------------------
+/// cGUIRenderingControl
+
+DLLEXPORT CAddonGUIRenderingControl* GUI_control_get_rendering(void *hdl, void *cb, CAddonGUIWindow *window, int controlId)
+{
+  return new CAddonGUIRenderingControl(hdl, cb, window, controlId);
+}
+
+DLLEXPORT void GUI_control_release_rendering(CAddonGUIRenderingControl* p)
+{
+  delete p;
+}
+
+DLLEXPORT bool GUI_control_rendering_create(GUIHANDLE handle, int x, int y, int w, int h, void *device)
+{
+  CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle;
+  return pControl->Create(x,y,w,h,device);
+}
+
+DLLEXPORT void GUI_control_rendering_render(GUIHANDLE handle)
+{
+  CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle;
+  pControl->Render();
+}
+
+DLLEXPORT void GUI_control_rendering_stop(GUIHANDLE handle)
+{
+  CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle;
+  pControl->Stop();
+}
+
+DLLEXPORT bool GUI_control_rendering_dirty(GUIHANDLE handle)
+{
+  CAddonGUIRenderingControl *pControl = (CAddonGUIRenderingControl*) handle;
+  return pControl->Dirty();
+}
+
+CAddonGUIRenderingControl::CAddonGUIRenderingControl(void *hdl, void *cb, CAddonGUIWindow *window, int controlId)
+ : m_Window(window)
+ , m_ControlId(controlId)
+ , m_Handle(hdl)
+ , m_cb(cb)
+{
+  m_RenderingHandle = ((CB_GUILib*)m_cb)->Window_GetControl_RenderAddon(((AddonCB*)m_Handle)->addonData, m_Window->m_WindowHandle, controlId);
+}
+
+CAddonGUIRenderingControl::~CAddonGUIRenderingControl()
+{
+  ((CB_GUILib*)m_cb)->RenderAddon_Delete(((AddonCB*)m_Handle)->addonData, m_RenderingHandle);
+}
+
+void CAddonGUIRenderingControl::Init()
+{
+  ((CB_GUILib*)m_cb)->RenderAddon_SetCallbacks(((AddonCB*)m_Handle)->addonData, m_RenderingHandle, this, GUI_control_rendering_create, GUI_control_rendering_render, GUI_control_rendering_stop, GUI_control_rendering_dirty);
+}
+
+bool CAddonGUIRenderingControl::Create(int x, int y, int w, int h, void *device)
+{
+  if (!CBCreate)
+    return false;
+
+  return CBCreate(m_cbhdl, x, y, w, h, device);
+}
+
+void CAddonGUIRenderingControl::Render()
+{
+  if (!CBRender)
+    return;
 
+  CBRender(m_cbhdl);
+}
+
+void CAddonGUIRenderingControl::Stop()
+{
+  if (!CBStop)
+    return;
+
+  CBStop(m_cbhdl);
+}
+
+bool CAddonGUIRenderingControl::Dirty()
+{
+  if (!CBDirty)
+    return true;
+
+  return CBDirty(m_cbhdl);
+}
 };
index e48760f..bb837d1 100644 (file)
@@ -7,7 +7,7 @@
 
 # lib name, version
 LIBNAME=libcec
-VERSION=2.0.3
+VERSION=2.1.0
 SOURCE=$(LIBNAME)-$(VERSION)
 
 # download location and format
@@ -36,19 +36,19 @@ $(LIBNAME): $(TARBALLS_LOCATION)/$(ARCHIVE)
        rm -rf $(LIBNAME)
        $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
        echo $(LIBNAME) > .gitignore
-       cd $(LIBNAME); autoreconf -vif
-       cd $(LIBNAME); $(CONFIGURE)
+       cd $(SOURCE); autoreconf -vif
+       cd $(SOURCE); $(CONFIGURE)
 
 $(SO_NAME): $(LIBNAME)
-       make -j 1 -C $(LIBNAME)
+       make -j 1 -C $(SOURCE)
 
 install:
-       make -C $(LIBNAME) install
+       make -C $(SOURCE) install
        ldconfig
 
 clean:
-       rm -rf $(LIBNAME)
+       rm -rf $(SOURCE)
 
 distclean::
-       rm -rf $(LIBNAME)
+       rm -rf $(SOURCE)
 
index d9544b3..38a3812 100644 (file)
@@ -445,7 +445,11 @@ dvd_reader_t *DVDOpen( const char *ppath )
                close( cdir );
         cdir = -1;
         if( retval == -1 ) {
+#if defined(_XBMC)
+          fprintf( stderr, "libdvdread: failed to reset working directory to \".\": %s\n", strerror(errno)); /* but ignore error */
+#else
           goto DVDOpen_error;
+#endif // _XBMC
         }
                    path_copy = new_path;
         new_path = NULL;
index c1419b5..2c7d495 100644 (file)
@@ -1,3 +1,3 @@
 ; filename                        source of the file
 
-libcec-2.0.5.zip                  http://mirrors.xbmc.org/build-deps/win32/
+libcec-2.1.0.zip                  http://mirrors.xbmc.org/build-deps/win32/
index 6143060..3dcf4a0 100644 (file)
     <ClCompile Include="..\..\xbmc\addons\Skin.cpp" />
     <ClCompile Include="..\..\xbmc\Application.cpp" />
     <ClCompile Include="..\..\xbmc\ApplicationMessenger.cpp" />
+    <ClCompile Include="..\..\xbmc\AppParamParser.cpp" />
     <ClCompile Include="..\..\xbmc\Autorun.cpp" />
     <ClCompile Include="..\..\xbmc\AutoSwitch.cpp" />
     <ClCompile Include="..\..\xbmc\BackgroundInfoLoader.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\iso9660.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\ISO9660Directory.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\ISOFile.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\LastFMDirectory.cpp" />
-    <ClCompile Include="..\..\xbmc\filesystem\LastFMFile.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\LibraryDirectory.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\MemBufferCache.cpp" />
     <ClCompile Include="..\..\xbmc\filesystem\MultiPathDirectory.cpp" />
     <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextustar.cpp" />
     <ClCompile Include="..\..\xbmc\music\karaoke\karaokewindowbackground.cpp" />
     <ClCompile Include="..\..\xbmc\music\karaoke\karaokevideobackground.cpp" />
-    <ClCompile Include="..\..\xbmc\music\LastFmManager.cpp" />
     <ClCompile Include="..\..\xbmc\music\MusicDatabase.cpp" />
     <ClCompile Include="..\..\xbmc\music\MusicDbUrl.cpp" />
     <ClCompile Include="..\..\xbmc\music\MusicInfoLoader.cpp" />
     <ClCompile Include="..\..\xbmc\network\httprequesthandler\HTTPWebinterfaceAddonsHandler.cpp" />
     <ClCompile Include="..\..\xbmc\network\httprequesthandler\HTTPWebinterfaceHandler.cpp" />
     <ClCompile Include="..\..\xbmc\network\httprequesthandler\IHTTPRequestHandler.cpp" />
-    <ClCompile Include="..\..\xbmc\network\libscrobbler\lastfmscrobbler.cpp" />
-    <ClCompile Include="..\..\xbmc\network\libscrobbler\librefmscrobbler.cpp" />
-    <ClCompile Include="..\..\xbmc\network\libscrobbler\scrobbler.cpp" />
     <ClCompile Include="..\..\xbmc\network\Network.cpp" />
     <ClCompile Include="..\..\xbmc\network\Socket.cpp" />
     <ClCompile Include="..\..\xbmc\network\TCPServer.cpp" />
     <ClCompile Include="..\..\xbmc\network\upnp\UPnPPlayer.cpp" />
     <ClCompile Include="..\..\xbmc\network\upnp\UPnPRenderer.cpp" />
     <ClCompile Include="..\..\xbmc\network\upnp\UPnPServer.cpp" />
+    <ClCompile Include="..\..\xbmc\network\upnp\UPnPSettings.cpp" />
     <ClCompile Include="..\..\xbmc\network\WebServer.cpp" />
     <ClCompile Include="..\..\xbmc\network\websocket\WebSocket.cpp" />
     <ClCompile Include="..\..\xbmc\network\websocket\WebSocketManager.cpp" />
     <ClCompile Include="..\..\xbmc\PartyModeManager.cpp" />
     <ClCompile Include="..\..\xbmc\PasswordManager.cpp" />
     <ClCompile Include="..\..\xbmc\peripherals\bus\PeripheralBus.cpp" />
+    <ClCompile Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.cpp" />
     <ClCompile Include="..\..\xbmc\peripherals\bus\win32\PeripheralBusUSB.cpp" />
     <ClCompile Include="..\..\xbmc\peripherals\devices\Peripheral.cpp" />
     <ClCompile Include="..\..\xbmc\peripherals\devices\PeripheralBluetooth.cpp" />
     <ClCompile Include="..\..\xbmc\rendering\RenderSystem.cpp" />
     <ClCompile Include="..\..\xbmc\SectionLoader.cpp" />
     <ClCompile Include="..\..\xbmc\settings\AdvancedSettings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\AppParamParser.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogContentSettings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogLockSettings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogProfileSettings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogSettings.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogContentSettings.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogLockSettings.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogProfileSettings.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogSettings.cpp" />
     <ClCompile Include="..\..\xbmc\settings\GUISettings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettingsCategory.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettingsProfile.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettingsScreenCalibration.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowTestPattern.cpp" />
     <ClCompile Include="..\..\xbmc\settings\Profile.cpp" />
     <ClCompile Include="..\..\xbmc\settings\Settings.cpp" />
-    <ClCompile Include="..\..\xbmc\settings\SettingsControls.cpp" />
     <ClCompile Include="..\..\xbmc\settings\VideoSettings.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\windows\GUISettingControls.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettings.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsCategory.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsProfile.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsScreenCalibration.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowTestPattern.cpp" />
     <ClCompile Include="..\..\xbmc\storage\AutorunMediaJob.cpp" />
     <ClCompile Include="..\..\xbmc\storage\cdioSupport.cpp" />
     <ClCompile Include="..\..\xbmc\storage\IoSupport.cpp" />
     <ClCompile Include="..\..\xbmc\TextureCacheJob.cpp" />
     <ClCompile Include="..\..\xbmc\TextureDatabase.cpp" />
     <ClCompile Include="..\..\xbmc\DatabaseManager.cpp" />
+    <ClInclude Include="..\..\xbmc\AppParamParser.h" />
     <ClInclude Include="..\..\xbmc\cores\AudioEngine\AEAudioFormat.h" />
     <ClInclude Include="..\..\xbmc\cores\AudioEngine\AEFactory.h" />
     <ClInclude Include="..\..\xbmc\cores\AudioEngine\AESinkFactory.h" />
     <ClInclude Include="..\..\xbmc\interfaces\python\PyContext.h" />
     <ClInclude Include="..\..\xbmc\interfaces\python\pythreadstate.h" />
     <ClInclude Include="..\..\xbmc\music\karaoke\karaokevideobackground.h" />
+    <ClInclude Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.h" />
+    <ClInclude Include="..\..\xbmc\network\upnp\UPnPSettings.h" />
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogContentSettings.h" />
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogLockSettings.h" />
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogProfileSettings.h" />
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogSettings.h" />
+    <ClInclude Include="..\..\xbmc\settings\windows\GUISettingControls.h" />
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettings.h" />
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsCategory.h" />
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsProfile.h" />
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsScreenCalibration.h" />
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowTestPattern.h" />
     <ClInclude Include="..\..\xbmc\video\FFmpegVideoDecoder.h" />
     <ClInclude Include="..\..\xbmc\interfaces\python\swig.h" />
     <ClInclude Include="..\..\xbmc\interfaces\python\XBPython.h" />
     <ClInclude Include="..\..\xbmc\filesystem\iso9660.h" />
     <ClInclude Include="..\..\xbmc\filesystem\ISO9660Directory.h" />
     <ClInclude Include="..\..\xbmc\filesystem\ISOFile.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\LastFMDirectory.h" />
-    <ClInclude Include="..\..\xbmc\filesystem\LastFMFile.h" />
     <ClInclude Include="..\..\xbmc\filesystem\LibraryDirectory.h" />
     <ClInclude Include="..\..\xbmc\filesystem\MultiPathDirectory.h" />
     <ClInclude Include="..\..\xbmc\filesystem\MultiPathFile.h" />
     <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextlrc.h" />
     <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextustar.h" />
     <ClInclude Include="..\..\xbmc\music\karaoke\karaokewindowbackground.h" />
-    <ClInclude Include="..\..\xbmc\music\LastFmManager.h" />
     <ClInclude Include="..\..\xbmc\music\MusicDatabase.h" />
     <ClInclude Include="..\..\xbmc\music\MusicInfoLoader.h" />
     <ClInclude Include="..\..\xbmc\music\Song.h" />
     <ClInclude Include="..\..\xbmc\network\EventServer.h" />
     <ClInclude Include="..\..\xbmc\network\GUIDialogAccessPoints.h" />
     <ClInclude Include="..\..\xbmc\network\GUIDialogNetworkSetup.h" />
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\errors.h" />
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\lastfmscrobbler.h" />
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\librefmscrobbler.h" />
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\scrobbler.h" />
     <ClInclude Include="..\..\xbmc\network\Network.h" />
     <ClInclude Include="..\..\xbmc\network\Socket.h" />
     <ClInclude Include="..\..\xbmc\network\TCPServer.h" />
     <ClInclude Include="..\..\xbmc\rendering\RenderSystem.h" />
     <ClInclude Include="..\..\xbmc\SectionLoader.h" />
     <ClInclude Include="..\..\xbmc\settings\AdvancedSettings.h" />
-    <ClInclude Include="..\..\xbmc\settings\AppParamParser.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogContentSettings.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogLockSettings.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogProfileSettings.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogSettings.h" />
     <ClInclude Include="..\..\xbmc\settings\GUISettings.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettings.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettingsCategory.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettingsProfile.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettingsScreenCalibration.h" />
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowTestPattern.h" />
     <ClInclude Include="..\..\xbmc\settings\Profile.h" />
     <ClInclude Include="..\..\xbmc\settings\Settings.h" />
-    <ClInclude Include="..\..\xbmc\settings\SettingsControls.h" />
     <ClInclude Include="..\..\xbmc\settings\VideoSettings.h" />
     <ClInclude Include="..\..\xbmc\SortFileItem.h" />
     <ClInclude Include="..\..\xbmc\storage\AutorunMediaJob.h" />
index 2f48c80..ddeb4f3 100644 (file)
     <Filter Include="music\windows">
       <UniqueIdentifier>{6589445b-fe8f-4083-ba15-3d0d45b8cd2d}</UniqueIdentifier>
     </Filter>
-    <Filter Include="network\libscrobbler">
-      <UniqueIdentifier>{cbd5c896-0dfc-4b84-9ef0-cdf7a49dc29a}</UniqueIdentifier>
-    </Filter>
     <Filter Include="network\windows">
       <UniqueIdentifier>{3d43220c-4ea4-4da7-8ede-ef159da2cd25}</UniqueIdentifier>
     </Filter>
     <Filter Include="view">
       <UniqueIdentifier>{90f512bb-8cda-4f04-b938-4f48d29bc82a}</UniqueIdentifier>
     </Filter>
+    <Filter Include="settings\dialogs">
+      <UniqueIdentifier>{38264422-e35f-427f-8d3d-27bc075b9bdd}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="settings\windows">
+      <UniqueIdentifier>{1a1eb956-43d1-4709-9467-ce471d54941d}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\xbmc\win32\pch.cpp">
     <ClCompile Include="..\..\xbmc\music\GUIViewStateMusic.cpp">
       <Filter>music</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\music\LastFmManager.cpp">
-      <Filter>music</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\music\MusicInfoLoader.cpp">
       <Filter>music</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\network\Zeroconf.cpp">
       <Filter>network</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\network\libscrobbler\lastfmscrobbler.cpp">
-      <Filter>network\libscrobbler</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\network\libscrobbler\librefmscrobbler.cpp">
-      <Filter>network\libscrobbler</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\network\libscrobbler\scrobbler.cpp">
-      <Filter>network\libscrobbler</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\network\windows\NetworkWin32.cpp">
       <Filter>network\windows</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\settings\AdvancedSettings.cpp">
       <Filter>settings</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogContentSettings.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogLockSettings.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogProfileSettings.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIDialogSettings.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\settings\GUISettings.cpp">
       <Filter>settings</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettings.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettingsCategory.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettingsProfile.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowSettingsScreenCalibration.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\GUIWindowTestPattern.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\settings\Profile.cpp">
       <Filter>settings</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\settings\Settings.cpp">
       <Filter>settings</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\SettingsControls.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\settings\VideoSettings.cpp">
       <Filter>settings</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\utils\JSONVariantWriter.cpp">
       <Filter>utils</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\settings\AppParamParser.cpp">
-      <Filter>settings</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\addons\AddonVersion.cpp">
       <Filter>addons</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\filesystem\ISOFile.cpp">
       <Filter>filesystem</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\LastFMDirectory.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\xbmc\filesystem\LastFMFile.cpp">
-      <Filter>filesystem</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\xbmc\filesystem\LibraryDirectory.cpp">
       <Filter>filesystem</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\network\upnp\UPnPInternal.cpp">
       <Filter>network\upnp</Filter>
     </ClCompile>
-     <ClCompile Include="..\..\xbmc\network\upnp\UPnPPlayer.cpp">
+    <ClCompile Include="..\..\xbmc\network\upnp\UPnPPlayer.cpp">
       <Filter>network\upnp</Filter>
     </ClCompile>
     <ClCompile Include="..\..\xbmc\network\upnp\UPnPRenderer.cpp">
     <ClCompile Include="..\..\xbmc\filesystem\DAVCommon.cpp">
       <Filter>filesystem</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.cpp">
+      <Filter>peripherals\bus</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\network\upnp\UPnPSettings.cpp">
+      <Filter>network\upnp</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\AppParamParser.cpp" />
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogContentSettings.cpp">
+      <Filter>settings\dialogs</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogLockSettings.cpp">
+      <Filter>settings\dialogs</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogProfileSettings.cpp">
+      <Filter>settings\dialogs</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogSettings.cpp">
+      <Filter>settings\dialogs</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\windows\GUISettingControls.cpp">
+      <Filter>settings\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettings.cpp">
+      <Filter>settings\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsCategory.cpp">
+      <Filter>settings\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsProfile.cpp">
+      <Filter>settings\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsScreenCalibration.cpp">
+      <Filter>settings\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\xbmc\settings\windows\GUIWindowTestPattern.cpp">
+      <Filter>settings\windows</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\xbmc\win32\pch.h">
     <ClInclude Include="..\..\xbmc\music\GUIViewStateMusic.h">
       <Filter>music</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\music\LastFmManager.h">
-      <Filter>music</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\music\MusicInfoLoader.h">
       <Filter>music</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\network\Zeroconf.h">
       <Filter>network</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\errors.h">
-      <Filter>network\libscrobbler</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\lastfmscrobbler.h">
-      <Filter>network\libscrobbler</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\librefmscrobbler.h">
-      <Filter>network\libscrobbler</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\network\libscrobbler\scrobbler.h">
-      <Filter>network\libscrobbler</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\network\windows\NetworkWin32.h">
       <Filter>network\windows</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\settings\AdvancedSettings.h">
       <Filter>settings</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogContentSettings.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogLockSettings.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogProfileSettings.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIDialogSettings.h">
-      <Filter>settings</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\settings\GUISettings.h">
       <Filter>settings</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettings.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettingsCategory.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettingsProfile.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowSettingsScreenCalibration.h">
-      <Filter>settings</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\GUIWindowTestPattern.h">
-      <Filter>settings</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\settings\Profile.h">
       <Filter>settings</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\settings\Settings.h">
       <Filter>settings</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\SettingsControls.h">
-      <Filter>settings</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\settings\VideoSettings.h">
       <Filter>settings</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\utils\JSONVariantWriter.h">
       <Filter>utils</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\settings\AppParamParser.h">
-      <Filter>settings</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\addons\AddonVersion.h">
       <Filter>addons</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\filesystem\ISOFile.h">
       <Filter>filesystem</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\LastFMDirectory.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\xbmc\filesystem\LastFMFile.h">
-      <Filter>filesystem</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\xbmc\filesystem\LibraryDirectory.h">
       <Filter>filesystem</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\interfaces\python\PyContext.h">
       <Filter>interfaces\python</Filter>
     </ClInclude>
-
     <ClInclude Include="..\..\xbmc\guilib\iimage.h">
       <Filter>guilib</Filter>
     </ClInclude>
     <ClInclude Include="..\..\xbmc\filesystem\DAVCommon.h">
       <Filter>filesystem</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.h">
+      <Filter>peripherals\bus</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\network\upnp\UPnPSettings.h">
+      <Filter>network\upnp</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\AppParamParser.h" />
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogContentSettings.h">
+      <Filter>settings\dialogs</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogLockSettings.h">
+      <Filter>settings\dialogs</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogProfileSettings.h">
+      <Filter>settings\dialogs</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogSettings.h">
+      <Filter>settings\dialogs</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\windows\GUISettingControls.h">
+      <Filter>settings\windows</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettings.h">
+      <Filter>settings\windows</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsCategory.h">
+      <Filter>settings\windows</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsProfile.h">
+      <Filter>settings\windows</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsScreenCalibration.h">
+      <Filter>settings\windows</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\xbmc\settings\windows\GUIWindowTestPattern.h">
+      <Filter>settings\windows</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
index bd67f5f..77d10dd 100644 (file)
@@ -9,7 +9,7 @@ SET DEPS_DIR=..\BuildDependencies
 SET TMP_DIR=%DEPS_DIR%\tmp
 
 SET LIBNAME=xbmc-pvr-addons
-SET VERSION=96774c4f775b156a46fb58151379dece3e773c96
+SET VERSION=5ef7f7f88c9dd3ca9c1daf57e7c92c005faa5910
 SET SOURCE=%LIBNAME%
 SET GIT_URL=git://github.com/opdenkamp/%LIBNAME%.git
 SET SOURCE_DIR=%TMP_DIR%\%SOURCE%
index 22076c3..e4e3d99 100644 (file)
@@ -73,6 +73,7 @@
 <keymap>
   <global>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <!-- A selects. B goes back. X gets context menu. Y goes fullscreen and back. -->
       <button id="1">Select</button>
       <button id="2">Back</button>
   </global>
   <Home>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="8">XBMC.Skin.ToggleSetting(HomeViewToggle)</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </Home>
   <MyFiles>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="6">Highlight</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </MyFiles>
   <MyMusicPlaylist>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="5">Delete</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </MyMusicLibrary>
   <FullscreenVideo>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <!--
             A pauses and starts the video.
             B stops the video.
   </FullscreenVideo>
   <FullscreenLiveTV>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="11">ChannelUp</button>
       <button id="12">ChannelDown</button>
       <button id="13">PreviousChannelGroup</button>
   </FullscreenLiveTV>
   <FullscreenInfo>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
       <button id="3">OSD</button>
       <button id="8">Close</button>
   </FullscreenInfo>
   <PlayerControls>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="3">Close</button>
       <button id="9">Close</button>
       <button id="10">Close</button>
   </PlayerControls>
   <Visualisation>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="1">Pause</button>
       <button id="2">Stop</button>
       <button id="3">XBMC.ActivateWindow(MusicOSD)</button>
   </Visualisation>
   <MusicOSD>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="3">Close</button>
       <button id="6">Info</button>
     </joystick>
   </MusicOSD>
   <VisualisationSettings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </VisualisationSettings>
   <VisualisationPresetList>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </VisualisationPresetList>
   <SlideShow>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="1">Pause</button>
       <button id="2">Stop</button>
       <button id="4">ZoomNormal</button>
   </SlideShow>
   <ScreenCalibration>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="3">ResetCalibration</button>
       <button id="5">NextResolution</button>
       <button id="6">NextCalibration</button>
   </ScreenCalibration>
   <GUICalibration>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="3">ResetCalibration</button>
       <button id="5">NextResolution</button>
       <button id="6">NextCalibration</button>
   </GUICalibration>
   <VideoOSD>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="3">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </VideoOSD>
   <VideoMenu>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Stop</button>
       <button id="3">OSD</button>
       <button id="5">AspectRatio</button>
   </VideoMenu>
   <OSDVideoSettings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="5">AspectRatio</button>
       <button id="3">Close</button>
     </joystick>
   </OSDVideoSettings>
   <OSDAudioSettings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="5">AspectRatio</button>
       <button id="3">Close</button>
     </joystick>
   </OSDAudioSettings>
   <VideoBookmarks>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="5">Delete</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </MyVideoFiles>
   <MyVideoPlaylist>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="5">Delete</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </MyVideoPlaylist>
   <VirtualKeyboard>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">BackSpace</button>
       <button id="4">Symbols</button>
       <button id="5">Shift</button>
   </VirtualKeyboard>
   <ContextMenu>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
       <button id="3">Close</button>
     </joystick>
   </ContextMenu>
   <Scripts>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="3">Info</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </Scripts>
   <Settings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">PreviousMenu</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </Settings>
   <AddonInformation>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </AddonInformation>
   <AddonSettings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </AddonSettings>
   <TextViewer>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </TextViewer>
   <shutdownmenu>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">PreviousMenu</button>
       <button id="9">PreviousMenu</button>
     </joystick>
   </shutdownmenu>
   <submenu>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">PreviousMenu</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </submenu>
   <MusicInformation>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </MusicInformation>
   <MovieInformation>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">Close</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </MovieInformation>
   <NumericInput>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">BackSpace</button>
       <button id="9">Enter</button>
     </joystick>
   </NumericInput>
   <GamepadInput>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="9">Stop</button>
     </joystick>
     <joystick name="Microsoft X-Box 360 pad">
   </GamepadInput>
   <LockSettings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">PreviousMenu</button>
       <button id="9">Close</button>
     </joystick>
   </LockSettings>
   <ProfileSettings>
     <joystick name="Controller (XBOX 360 For Windows)">
+      <altname>Afterglow Gamepad for Xbox 360 (Controller)</altname>
       <altname>Controller (Gamepad F310)</altname>
       <altname>Controller (Gamepad for Xbox 360)</altname>
       <altname>Controller (Rumble Gamepad F510)</altname>
       <altname>Controller (Xbox 360 Wireless Receiver for Windows)</altname>
       <altname>Controller (Xbox wireless receiver for windows)</altname>
       <altname>Controller (XBOX360 GAMEPAD)</altname>
+      <altname>Wireless Gamepad F710 (Controller)</altname>
       <altname>XBOX 360 For Windows</altname>
       <altname>XBOX 360 For Windows (Controller)</altname>
       <altname>Xbox 360 Wireless Controller</altname>
       <altname>Xbox Receiver for Windows (Wireless Controller)</altname>
       <altname>Xbox wireless receiver for windows (Controller)</altname>
+      <altname>Gamepad F310 (Controller)</altname>
       <button id="2">PreviousMenu</button>
       <button id="9">Close</button>
     </joystick>
index 967b96c..68205df 100644 (file)
@@ -7,30 +7,7 @@
     <setting key="flip_remote" value="Dialog.Close(virtualkeyboard)" label="36003" order="4" />
   </peripheral>
 
-  <peripheral vendor_product="2708:1001" bus="rpi" name="Raspberry Pi CEC Adapter" mapTo="cec">
-    <setting key="enabled" type="bool" value="1" label="305" order="1" />
-    <setting key="activate_source" type="bool" value="1" label="36020" order="2" />
-    <setting key="wake_devices" type="enum" value="36037" label="36007" lvalues="36037|36038|36039|231" order="3" />
-    <setting key="standby_devices" type="enum" value="36037" label="36008" lvalues="36037|36038|36039|231" order="4" />
-    <setting key="send_inactive_source" type="bool" value="1" label="36025" order="5" />
-    <setting key="cec_standby_screensaver" type="bool" value="0" label="36009" order="7" />
-    <setting key="standby_pc_on_tv_standby" type="enum" value="13011" label="36029" order="7" lvalues="36028|13005|13011" />
-    <setting key="standby_tv_on_pc_standby" type="bool" value="1" label="36026" order="8" />
-    <setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="9" />
-    <setting key="physical_address" type="string" label="36021" value="0" order="10" />
-
-    <setting key="tv_vendor" type="int" value="0" configurable="0" />
-    <setting key="device_name" type="string" value="XBMC" configurable="0" />
-    <setting key="device_type" type="int" value="1" configurable="0" />
-    <setting key="cec_hdmi_port" type="int" value="1" label="36015" configurable="0" />
-    <setting key="connected_device" type="int" label="36019" value="0" configurable="0" />
-    <setting key="port" type="string" value="" label="36022" configurable="0" />
-    <setting key="wake_devices_advanced" type="string" value="" configurable="0" />
-    <setting key="standby_devices_advanced" type="string" value="" configurable="0" />
-    <setting key="double_tap_timeout_ms" type="int" min="0" value="2000" configurable="0" />
-  </peripheral>
-
-  <peripheral vendor_product="2548:1001,2548:1002" bus="usb" name="Pulse-Eight CEC Adapter" mapTo="cec">
+  <peripheral bus="cec" name="CEC Adapter" mapTo="cec">
     <setting key="enabled" type="bool" value="1" label="305" order="1" />
     <setting key="activate_source" type="bool" value="1" label="36020" order="2" />
     <setting key="wake_devices" type="enum" value="36037" label="36007" lvalues="36037|36038|36039|231" order="3" />
     <setting key="double_tap_timeout_ms" type="int" min="0" value="2000" configurable="0" />
   </peripheral>
 
+  <peripheral vendor_product="2548:1001,2548:1002" bus="usb" name="Pulse-Eight CEC Adapter" mapTo="cec">
+    <!-- This entry will not create a CPeripheralCecAdapter instance, since it's filtered out in CPeripherals::CreatePeripheral,
+         but it will ensure that a warning is displayed when an adapter is inserted, but libCEC is not present or couldn't be loaded.
+         Since libCEC is now used to scan for devices, the warning will not be displayed without this mapping -->
+  </peripheral>
+
   <peripheral vendor_product="15C2:32,15C2:33,15C2:34,15C2:35,15C2:36,15C2:37,15C2:38,15C2:39,15C2:3A,15C2:3B,15C2:3C,15C2:3D,15C2:3E,15C2:3F,15C2:41,15C2:42,15C2:43,15C2:44,15C2:45,15C2:46" bus="usb" name="iMON HID device" mapTo="imon">
     <setting key="do_not_use_custom_keymap" type="bool" value="1" label="35009" configurable="0"/>
     <setting key="disable_winjoystick" type="bool" value="1" label="35102" order="1" />
index 7d9b6b8..164e0a4 100644 (file)
@@ -3,7 +3,7 @@ DEPS= ../Makefile.include Makefile
 
 # lib name, version
 LIBNAME=libcec
-VERSION=2.0.5-3
+VERSION=2.1.0
 SOURCE=$(LIBNAME)-$(VERSION)
 ARCHIVE=$(SOURCE).tar.gz
 
@@ -11,7 +11,7 @@ ARCHIVE=$(SOURCE).tar.gz
 CONFIGURE=./configure --prefix=$(PREFIX) --host=$(HOST) \
           ac_cv_search_dlopen=yes
 
-LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.0
+LIBDYLIB=$(PLATFORM)/src/lib/.libs/libcec.so.2.0.1
 
 all: .installed-$(PLATFORM)
 
@@ -30,7 +30,7 @@ $(LIBDYLIB): $(PLATFORM)
 .installed-$(PLATFORM): $(LIBDYLIB)
        $(MAKE) -C $(PLATFORM)/src/lib install
        rm -f $(PREFIX)/lib/libcec.la $(PREFIX)/lib/libcec.so $(PREFIX)/lib/libcec.so.2
-       mv -f $(PREFIX)/lib/libcec.so.2.0.0 $(PREFIX)/lib/libcec.so
+       mv -f $(PREFIX)/lib/libcec.so.2.0.1 $(PREFIX)/lib/libcec.so
        $(RPL) -e "libcec.so.2" "libcec.so\x00\x00" $(PREFIX)/lib/libcec.so
        -$(READELF) --dynamic $(PREFIX)/lib/libcec.so | grep ibrary
        touch $@
index 26bff3c..6ded314 100644 (file)
@@ -2,7 +2,7 @@ include ../Makefile.include
 DEPS= ../Makefile.include Makefile
 
 LIBNAME=xbmc-pvr-addons
-VERSION=96774c4f775b156a46fb58151379dece3e773c96
+VERSION=5ef7f7f88c9dd3ca9c1daf57e7c92c005faa5910
 GIT_DIR=$(TARBALLS_LOCATION)/$(LIBNAME).git
 BASE_URL=git://github.com/opdenkamp/$(LIBNAME).git
 DYLIB=$(PLATFORM)/addons/pvr.demo/.libs/libpvrdemo-addon.so
index 55d26fc..c4de2fd 100644 (file)
                 android:name="android.app.lib_name"
                 android:value="xbmc" />
         </activity>
+        <receiver android:name="XBMCBroadcastReceiver" >
+            <intent-filter>
+                <action android:name="android.intent.action.MEDIA_MOUNTED" />
+                <data android:scheme="file"/>
+            </intent-filter>
+        </receiver>
     </application>
 
 </manifest><!-- END_INCLUDE(manifest) -->
diff --git a/tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java b/tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java
new file mode 100644 (file)
index 0000000..010c229
--- /dev/null
@@ -0,0 +1,24 @@
+package org.xbmc.xbmc;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+public class XBMCBroadcastReceiver extends BroadcastReceiver
+{
+  native void ReceiveIntent(Intent intent);
+  static
+  {
+    System.loadLibrary("xbmc");
+  }
+
+  @Override
+  public void onReceive(Context context, Intent intent)
+  {
+    String actionName = intent.getAction();
+    if (actionName != null)
+    {
+        ReceiveIntent(intent);
+    }
+  }
+}
index 3e84bff..b7970dd 100644 (file)
@@ -3,7 +3,7 @@ include ../config.site.mk
 
 # lib name, version
 LIBNAME=libcec
-VERSION=2.0.5-3
+VERSION=2.1.0
 SOURCE=$(LIBNAME)-$(VERSION)
 ARCHIVE=$(SOURCE).tar.gz
 
index c58d670..310b258 100644 (file)
@@ -5,7 +5,7 @@ XBMC_ADDONSDIR=../../../../addons
 
 # lib name, version
 LIBNAME=xbmc-pvr-addons
-VERSION=96774c4f775b156a46fb58151379dece3e773c96
+VERSION=5ef7f7f88c9dd3ca9c1daf57e7c92c005faa5910
 SOURCE=$(LIBNAME)-$(VERSION)
 ARCHIVE=$(SOURCE).tar.gz
 
index 44a98cf..f96b945 100755 (executable)
@@ -79,6 +79,8 @@ chmod +x $DIRNAME/$PACKAGE/DEBIAN/prerm
 # postinst: symlink XBMC.frappliance into correct location and reload Lowtide/AppleTV.
 echo "#!/bin/sh"                                  >  $DIRNAME/$PACKAGE/DEBIAN/postinst
 echo "chown -R mobile:mobile /Applications/XBMC.frappliance" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
+echo "cp /Applications/XBMC.frappliance/AppIcon.png /Applications/AppleTV.app/com.apple.frontrow.appliance.xbmc\@720p.png" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
+echo "cp /Applications/XBMC.frappliance/AppIcon.png /Applications/XBMC.frappliance/TopRowIcon.png" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
 echo "if [ \"\`uname -r\`\" = \"10.3.1\" ]; then" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
 echo "  ln -sf /Applications/XBMC.frappliance /Applications/Lowtide.app/Appliances/XBMC.frappliance" >> $DIRNAME/$PACKAGE/DEBIAN/postinst
 echo "  killall Lowtide"                          >> $DIRNAME/$PACKAGE/DEBIAN/postinst
diff --git a/tools/darwin/packaging/xbmc-seatbeltunlock/f387cee7d7d302ec9e740632f44f1352.patch b/tools/darwin/packaging/xbmc-seatbeltunlock/f387cee7d7d302ec9e740632f44f1352.patch
new file mode 100644 (file)
index 0000000..a990cd9
Binary files /dev/null and b/tools/darwin/packaging/xbmc-seatbeltunlock/f387cee7d7d302ec9e740632f44f1352.patch differ
index 067827b..d9d422a 100755 (executable)
@@ -12,7 +12,7 @@ fi
 PACKAGE=org.xbmc.xbmc-seatbeltunlock
 
 VERSION=1.0
-REVISION=4
+REVISION=5
 ARCHIVE=${PACKAGE}_${VERSION}-${REVISION}_iphoneos-arm.deb
 
 echo Creating $PACKAGE package version $VERSION revision $REVISION
@@ -77,6 +77,15 @@ echo "   chmod 755 /var/tmp/AppleTV-nosb"               >> $PACKAGE/DEBIAN/posti
 echo "   mv -f /Applications/AppleTV.app/AppleTV /Applications/AppleTV.app/AppleTV_org" >> $PACKAGE/DEBIAN/postinst
 echo "   mv /var/tmp/AppleTV-nosb /Applications/AppleTV.app/AppleTV" >> $PACKAGE/DEBIAN/postinst
 echo "   killall AppleTV ;;"                            >> $PACKAGE/DEBIAN/postinst
+echo " f387cee7d7d302ec9e740632f44f1352 )"              >> $PACKAGE/DEBIAN/postinst
+echo "   echo \"Found 6.1 (10B144b):Removing seatbelt profile key from AppleTV\"" >> $PACKAGE/DEBIAN/postinst
+echo "   bspatch /Applications/AppleTV.app/AppleTV /var/tmp/AppleTV-nosb /var/tmp/f387cee7d7d302ec9e740632f44f1352.patch" >> $PACKAGE/DEBIAN/postinst
+echo "   rm /var/tmp/f387cee7d7d302ec9e740632f44f1352.patch" >> $PACKAGE/DEBIAN/postinst
+echo "   chmod 755 /var/tmp/AppleTV-nosb"               >> $PACKAGE/DEBIAN/postinst
+echo "   mv -f /Applications/AppleTV.app/AppleTV /Applications/AppleTV.app/AppleTV_org" >> $PACKAGE/DEBIAN/postinst
+echo "   mv /var/tmp/AppleTV-nosb /Applications/AppleTV.app/AppleTV" >> $PACKAGE/DEBIAN/postinst
+echo "   killall AppleTV ;;"                            >> $PACKAGE/DEBIAN/postinst
+
 echo " * )"                                             >> $PACKAGE/DEBIAN/postinst
 echo "   echo \"Frontrow app md5sum is unknown, not patching\" ;;" >> $PACKAGE/DEBIAN/postinst
 echo "esac"                                             >> $PACKAGE/DEBIAN/postinst
@@ -88,6 +97,7 @@ cp 12313417e3afeba6531255af58cb5283.patch               $PACKAGE/var/tmp/
 cp 5a28620a15c15d41e1ae836dd1f95f8d.patch               $PACKAGE/var/tmp/
 cp 03e48c66a9cae1ff768eb3fe7981c499.patch               $PACKAGE/var/tmp/
 cp 42d00865f281bb662b6ce447c9815e59.patch               $PACKAGE/var/tmp/
+cp f387cee7d7d302ec9e740632f44f1352.patch               $PACKAGE/var/tmp/
 
 # set ownership to root:root
 ${SUDO} chown -R 0:0 $PACKAGE
diff --git a/xbmc/AppParamParser.cpp b/xbmc/AppParamParser.cpp
new file mode 100644 (file)
index 0000000..78d8d94
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "AppParamParser.h"
+#include "GUIInfoManager.h"
+#include "PlayListPlayer.h"
+#include "FileItem.h"
+#include "Application.h"
+#include "ApplicationMessenger.h"
+#include "settings/AdvancedSettings.h"
+#include "utils/log.h"
+#ifdef TARGET_WINDOWS
+#include "WIN32Util.h"
+#endif
+#ifdef HAS_LIRC
+#include "input/linux/LIRC.h"
+#endif
+#ifndef TARGET_WINDOWS
+#include "linux/XTimeUtils.h"
+#endif
+
+CAppParamParser::CAppParamParser()
+{
+  m_testmode = false;
+}
+
+void CAppParamParser::Parse(const char* argv[], int nArgs)
+{
+  if (nArgs > 1)
+  {
+    for (int i = 1; i < nArgs; i++)
+    {
+      ParseArg(argv[i]);
+#ifdef HAS_LIRC
+      if (strnicmp(argv[i], "-l", 2) == 0 || strnicmp(argv[i], "--lircdev", 9) == 0)
+      {
+        // check the next arg with the proper value.
+        int next=i+1;
+        if (next < nArgs)
+        {
+          if ((argv[next][0] != '-' ) && (argv[next][0] == '/' ))
+          {
+            g_RemoteControl.setDeviceName(argv[next]);
+            i++;
+          }
+        }
+      }
+      else if (strnicmp(argv[i], "-n", 2) == 0 || strnicmp(argv[i], "--nolirc", 8) == 0)
+         g_RemoteControl.setUsed(false);
+#endif
+      if (stricmp(argv[i], "-d") == 0)
+      {
+        if (i + 1 < nArgs)
+        {
+          int sleeptime = atoi(argv[i + 1]);
+          if (sleeptime > 0 && sleeptime < 360)
+            Sleep(sleeptime*1000);
+        }
+        i++;
+      }
+    }
+  }
+  PlayPlaylist();
+}
+
+void CAppParamParser::DisplayVersion()
+{
+  printf("XBMC Media Center %s\n", g_infoManager.GetVersion().c_str());
+  printf("Copyright (C) 2005-2013 Team XBMC - http://www.xbmc.org\n");
+  exit(0);
+}
+
+void CAppParamParser::DisplayHelp()
+{
+  printf("Usage: xbmc [OPTION]... [FILE]...\n\n");
+  printf("Arguments:\n");
+  printf("  -d <n>\t\tdelay <n> seconds before starting\n");
+  printf("  -fs\t\t\tRuns XBMC in full screen\n");
+  printf("  --standalone\t\tXBMC runs in a stand alone environment without a window \n");
+  printf("\t\t\tmanager and supporting applications. For example, that\n");
+  printf("\t\t\tenables network settings.\n");
+  printf("  -p or --portable\tXBMC will look for configurations in install folder instead of ~/.xbmc\n");
+  printf("  --legacy-res\t\tEnables screen resolutions such as PAL, NTSC, etc.\n");
+#ifdef HAS_LIRC
+  printf("  -l or --lircdev\tLircDevice to use default is "LIRC_DEVICE" .\n");
+  printf("  -n or --nolirc\tdo not use Lirc, i.e. no remote input.\n");
+#endif
+  printf("  --debug\t\tEnable debug logging\n");
+  printf("  --version\t\tPrint version information\n");
+  printf("  --test\t\tEnable test mode. [FILE] required.\n");
+  printf("  --settings=<filename>\t\tLoads specified file after advancedsettings.xml replacing any settings specified\n");
+  printf("  \t\t\t\tspecified file must exist in special://xbmc/system/\n");
+  exit(0);
+}
+
+void CAppParamParser::EnableDebugMode()
+{
+  g_advancedSettings.m_logLevel     = LOG_LEVEL_DEBUG;
+  g_advancedSettings.m_logLevelHint = LOG_LEVEL_DEBUG;
+  CLog::SetLogLevel(g_advancedSettings.m_logLevel);
+}
+
+void CAppParamParser::ParseArg(const CStdString &arg)
+{
+  if (arg == "-fs" || arg == "--fullscreen")
+    g_advancedSettings.m_startFullScreen = true;
+  else if (arg == "-h" || arg == "--help")
+    DisplayHelp();
+  else if (arg == "-v" || arg == "--version")
+    DisplayVersion();
+  else if (arg == "--standalone")
+    g_application.SetStandAlone(true);
+  else if (arg == "-p" || arg  == "--portable")
+    g_application.EnablePlatformDirectories(false);
+  else if (arg == "--debug")
+    EnableDebugMode();
+  else if (arg == "--legacy-res")
+    g_application.SetEnableLegacyRes(true);
+  else if (arg == "--test")
+    m_testmode = true;
+  else if (arg.substr(0, 11) == "--settings=")
+    g_advancedSettings.AddSettingsFile(arg.substr(11));
+  else if (arg.length() != 0 && arg[0] != '-')
+  {
+    if (m_testmode)
+      g_application.SetEnableTestMode(true);
+    CFileItemPtr pItem(new CFileItem(arg));
+    pItem->SetPath(arg);
+    m_playlist.Add(pItem);
+  }
+}
+
+void CAppParamParser::PlayPlaylist()
+{
+  if (m_playlist.Size() > 0)
+  {
+    g_playlistPlayer.Add(0, m_playlist);
+    g_playlistPlayer.SetCurrentPlaylist(0);
+  }
+
+  ThreadMessage tMsg = {TMSG_PLAYLISTPLAYER_PLAY, (DWORD) -1};
+  CApplicationMessenger::Get().SendMessage(tMsg, false);
+}
diff --git a/xbmc/AppParamParser.h b/xbmc/AppParamParser.h
new file mode 100644 (file)
index 0000000..78d6174
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "utils/StdString.h"
+#include "FileItem.h"
+
+class CAppParamParser
+{
+  public:
+    CAppParamParser();
+    void Parse(const char* argv[], int nArgs);
+
+  private:
+    bool m_testmode;
+    CFileItemList m_playlist;
+    void ParseArg(const CStdString &arg);
+    void DisplayHelp();
+    void DisplayVersion();
+    void EnableDebugMode();
+    void PlayPlaylist();
+};
index d6e663b..cf1a476 100644 (file)
@@ -61,8 +61,6 @@
 #endif
 #include "input/ButtonTranslator.h"
 #include "guilib/GUIAudioManager.h"
-#include "network/libscrobbler/lastfmscrobbler.h"
-#include "network/libscrobbler/librefmscrobbler.h"
 #include "GUIPassword.h"
 #include "input/InertialScrollingHandler.h"
 #include "ApplicationMessenger.h"
@@ -86,7 +84,6 @@
 #include "utils/TimeUtils.h"
 #include "GUILargeTextureManager.h"
 #include "TextureCache.h"
-#include "music/LastFmManager.h"
 #include "playlists/SmartPlayList.h"
 #ifdef HAS_FILESYSTEM_RAR
 #include "filesystem/RarManager.h"
 // Windows includes
 #include "guilib/GUIWindowManager.h"
 #include "windows/GUIWindowHome.h"
-#include "settings/GUIWindowSettings.h"
+#include "settings/windows/GUIWindowSettings.h"
 #include "windows/GUIWindowFileManager.h"
-#include "settings/GUIWindowSettingsCategory.h"
+#include "settings/windows/GUIWindowSettingsCategory.h"
 #include "music/windows/GUIWindowMusicPlaylist.h"
 #include "music/windows/GUIWindowMusicSongs.h"
 #include "music/windows/GUIWindowMusicNav.h"
 #include "music/dialogs/GUIDialogMusicInfo.h"
 #include "video/dialogs/GUIDialogVideoInfo.h"
 #include "video/windows/GUIWindowVideoNav.h"
-#include "settings/GUIWindowSettingsProfile.h"
+#include "settings/windows/GUIWindowSettingsProfile.h"
 #ifdef HAS_GL
 #include "rendering/gl/GUIWindowTestPatternGL.h"
 #endif
 #ifdef HAS_DX
 #include "rendering/dx/GUIWindowTestPatternDX.h"
 #endif
-#include "settings/GUIWindowSettingsScreenCalibration.h"
+#include "settings/windows/GUIWindowSettingsScreenCalibration.h"
 #include "programs/GUIWindowPrograms.h"
 #include "pictures/GUIWindowPictures.h"
 #include "windows/GUIWindowWeather.h"
 #include "video/dialogs/GUIDialogVideoSettings.h"
 #include "video/dialogs/GUIDialogAudioSubtitleSettings.h"
 #include "video/dialogs/GUIDialogVideoBookmarks.h"
-#include "settings/GUIDialogProfileSettings.h"
-#include "settings/GUIDialogLockSettings.h"
-#include "settings/GUIDialogContentSettings.h"
+#include "settings/dialogs/GUIDialogProfileSettings.h"
+#include "settings/dialogs/GUIDialogLockSettings.h"
+#include "settings/dialogs/GUIDialogContentSettings.h"
 #include "dialogs/GUIDialogBusy.h"
 #include "dialogs/GUIDialogKeyboardGeneric.h"
 #include "dialogs/GUIDialogYesNo.h"
@@ -1559,7 +1556,6 @@ void CApplication::StopWebServer()
       CLog::Log(LOGNOTICE, "Webserver: Stopped...");
       CZeroconf::GetInstance()->RemoveService("servers.webserver");
       CZeroconf::GetInstance()->RemoveService("servers.jsonrpc-http");
-      CZeroconf::GetInstance()->RemoveService("servers.webapi");
     } else
       CLog::Log(LOGWARNING, "Webserver: Failed to stop.");
   }
@@ -1590,7 +1586,7 @@ bool CApplication::StartAirplayServer()
         txt.push_back(std::make_pair("deviceid", "FF:FF:FF:FF:FF:F2"));
       }
       txt.push_back(std::make_pair("features", "0x77"));
-      txt.push_back(std::make_pair("model", "AppleTV2,1"));
+      txt.push_back(std::make_pair("model", "Xbmc,1"));
       txt.push_back(std::make_pair("srcvers", AIRPLAY_SERVER_VERSION_STR));
       CZeroconf::GetInstance()->PublishService("servers.airplay", "_airplay._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), listenPort, txt);
       ret = true;
@@ -2829,20 +2825,20 @@ bool CApplication::OnAction(const CAction &action)
     {
       VECPLAYERCORES cores;
       CFileItem item(*m_itemCurrentFile.get());
-      CPlayerCoreFactory::GetPlayers(item, cores);
-      PLAYERCOREID core = CPlayerCoreFactory::SelectPlayerDialog(cores);
+      CPlayerCoreFactory::Get().GetPlayers(item, cores);
+      PLAYERCOREID core = CPlayerCoreFactory::Get().SelectPlayerDialog(cores);
       if(core != EPC_NONE)
       {
         g_application.m_eForcedNextPlayer = core;
-        item.m_lStartOffset = GetTime() * 75;
+        item.m_lStartOffset = (int)(GetTime() * 75);
         PlayFile(item, true);
       }
     }
     else
     {
       VECPLAYERCORES cores;
-      CPlayerCoreFactory::GetRemotePlayers(cores);
-      PLAYERCOREID core = CPlayerCoreFactory::SelectPlayerDialog(cores);
+      CPlayerCoreFactory::Get().GetRemotePlayers(cores);
+      PLAYERCOREID core = CPlayerCoreFactory::Get().SelectPlayerDialog(cores);
       if(core != EPC_NONE)
       {
         CFileItem item;
@@ -3453,9 +3449,6 @@ bool CApplication::Cleanup()
     g_charsetConverter.clear();
     g_directoryCache.Clear();
     CButtonTranslator::GetInstance().Clear();
-    CLastfmScrobbler::RemoveInstance();
-    CLibrefmScrobbler::RemoveInstance();
-    CLastFmManager::RemoveInstance();
 #ifdef HAS_EVENT_SERVER
     CEventServer::RemoveInstance();
 #endif
@@ -3643,11 +3636,6 @@ bool CApplication::PlayMedia(const CFileItem& item, int iPlaylist)
       return PlayMedia(item_new, iPlaylist);
     return false;
   }
-  if (item.IsLastFM())
-  {
-    g_partyModeManager.Disable();
-    return CLastFmManager::GetInstance()->ChangeStation(item.GetAsUrl());
-  }
   if (item.IsSmartPlayList())
   {
     CFileItemList items;
@@ -3965,7 +3953,7 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
     if( m_eForcedNextPlayer != EPC_NONE )
       eNewCore = m_eForcedNextPlayer;
     else if( m_eCurrentPlayer == EPC_NONE )
-      eNewCore = CPlayerCoreFactory::GetDefaultPlayer(item);
+      eNewCore = CPlayerCoreFactory::Get().GetDefaultPlayer(item);
     else
       eNewCore = m_eCurrentPlayer;
   }
@@ -4022,7 +4010,7 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
     if (m_eForcedNextPlayer != EPC_NONE)
       eNewCore = m_eForcedNextPlayer;
     else
-      eNewCore = CPlayerCoreFactory::GetDefaultPlayer(item);
+      eNewCore = CPlayerCoreFactory::Get().GetDefaultPlayer(item);
   }
 
   // this really aught to be inside !bRestart, but since PlayStack
@@ -4077,12 +4065,21 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
   if (!m_pPlayer)
   {
     m_eCurrentPlayer = eNewCore;
-    m_pPlayer = CPlayerCoreFactory::CreatePlayer(eNewCore, *this);
+    m_pPlayer = CPlayerCoreFactory::Get().CreatePlayer(eNewCore, *this);
   }
 
   bool bResult;
   if (m_pPlayer)
   {
+    /* When playing video pause any low priority jobs, they will be unpaused  when playback stops.
+     * This should speed up player startup for files on internet filesystems (eg. webdav) and
+     * increase performance on low powered systems (Atom/ARM).
+     */
+    if (item.IsVideo())
+    {
+      CJobManager::GetInstance().Pause(CJob::PRIORITY_LOW); // Pause any low priority jobs
+    }
+
     // don't hold graphicscontext here since player
     // may wait on another thread, that requires gfx
     CSingleExit ex(g_graphicsContext);
@@ -4126,24 +4123,6 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart)
       if( options.fullscreen && g_renderManager.IsStarted()
        && g_windowManager.GetActiveWindow() != WINDOW_FULLSCREEN_VIDEO )
        SwitchToFullScreen();
-
-      if (!item.IsDVDImage() && !item.IsDVDFile())
-      {
-        CVideoInfoTag *details = m_itemCurrentFile->GetVideoInfoTag();
-        // Save information about the stream if we currently have no data
-        if (!details->HasStreamDetails() ||
-             details->m_streamDetails.GetVideoDuration() <= 0)
-        {
-          if (m_pPlayer->GetStreamDetails(details->m_streamDetails) && details->HasStreamDetails())
-          {
-            CVideoDatabase dbs;
-            dbs.Open();
-            dbs.SetStreamDetailsForFileId(details->m_streamDetails, details->m_iFileId);
-            dbs.Close();
-            CUtil::DeleteVideoDatabaseDirectoryCache();
-          }
-        }
-      }
     }
 #endif
     else
@@ -4189,9 +4168,6 @@ void CApplication::OnPlayBackEnded()
   if(m_bPlaybackStarting)
     return;
 
-  if (CJobManager::GetInstance().IsPaused(kJobTypeMediaFlags))
-    CJobManager::GetInstance().UnPause(kJobTypeMediaFlags);
-
   // informs python script currently running playback has ended
   // (does nothing if python is not loaded)
 #ifdef HAS_PYTHON
@@ -4202,12 +4178,6 @@ void CApplication::OnPlayBackEnded()
   data["end"] = true;
   CAnnouncementManager::Announce(Player, "xbmc", "OnStop", m_itemCurrentFile, data);
 
-  if (IsPlayingAudio())
-  {
-    CLastfmScrobbler::GetInstance()->SubmitQueue();
-    CLibrefmScrobbler::GetInstance()->SubmitQueue();
-  }
-
   CGUIMessage msg(GUI_MSG_PLAYBACK_ENDED, 0, 0);
   g_windowManager.SendThreadMessage(msg);
 }
@@ -4217,9 +4187,6 @@ void CApplication::OnPlayBackStarted()
   if(m_bPlaybackStarting)
     return;
 
-  if (!CJobManager::GetInstance().IsPaused(kJobTypeMediaFlags))
-    CJobManager::GetInstance().Pause(kJobTypeMediaFlags);
-
 #ifdef HAS_PYTHON
   // informs python script currently running playback has started
   // (does nothing if python is not loaded)
@@ -4238,12 +4205,6 @@ void CApplication::OnQueueNextItem()
   g_pythonParser.OnQueueNextItem(); // currently unimplemented
 #endif
 
-  if(IsPlayingAudio())
-  {
-    CLastfmScrobbler::GetInstance()->SubmitQueue();
-    CLibrefmScrobbler::GetInstance()->SubmitQueue();
-  }
-
   CGUIMessage msg(GUI_MSG_QUEUE_NEXT_ITEM, 0, 0);
   g_windowManager.SendThreadMessage(msg);
 }
@@ -4253,9 +4214,6 @@ void CApplication::OnPlayBackStopped()
   if(m_bPlaybackStarting)
     return;
 
-  if (CJobManager::GetInstance().IsPaused(kJobTypeMediaFlags))
-    CJobManager::GetInstance().UnPause(kJobTypeMediaFlags);
-
   // informs python script currently running playback has ended
   // (does nothing if python is not loaded)
 #ifdef HAS_PYTHON
@@ -4266,9 +4224,6 @@ void CApplication::OnPlayBackStopped()
   data["end"] = false;
   CAnnouncementManager::Announce(Player, "xbmc", "OnStop", m_itemCurrentFile, data);
 
-  CLastfmScrobbler::GetInstance()->SubmitQueue();
-  CLibrefmScrobbler::GetInstance()->SubmitQueue();
-
   CGUIMessage msg( GUI_MSG_PLAYBACK_STOPPED, 0, 0 );
   g_windowManager.SendThreadMessage(msg);
 }
@@ -4407,7 +4362,7 @@ void CApplication::SaveFileState(bool bForeground /* = false */)
         *m_stackFileItemToUpdate,
         m_progressTrackingVideoResumeBookmark,
         m_progressTrackingPlayCountUpdate);
-    CJobManager::GetInstance().AddJob(job, NULL);
+    CJobManager::GetInstance().AddJob(job, NULL, CJob::PRIORITY_NORMAL);
   }
 }
 
@@ -4440,15 +4395,20 @@ void CApplication::UpdateFileState()
         m_progressTrackingPlayCountUpdate = true;
       }
 
-      if (m_progressTrackingItem->IsVideo())
+      // Check whether we're *really* playing video else we may race when getting eg. stream details
+      if (IsPlayingVideo())
       {
-        if ((m_progressTrackingItem->IsDVDImage() || m_progressTrackingItem->IsDVDFile()) && m_pPlayer->GetTotalTime() > 15*60*1000)
+        // Special case for DVDs: Only extract streamdetails if title length > 15m. Should yield more correct info
+        if (!(m_progressTrackingItem->IsDVDImage() || m_progressTrackingItem->IsDVDFile()) || m_pPlayer->GetTotalTime() > 15*60*1000)
         {
-          m_progressTrackingItem->GetVideoInfoTag()->m_streamDetails.Reset();
-          m_pPlayer->GetStreamDetails(m_progressTrackingItem->GetVideoInfoTag()->m_streamDetails);
+          CStreamDetails details;
+          // Update with stream details from player, if any
+          if (m_pPlayer->GetStreamDetails(details))
+            m_progressTrackingItem->GetVideoInfoTag()->m_streamDetails = details;
         }
+
         // Update bookmark for save
-        m_progressTrackingVideoResumeBookmark.player = CPlayerCoreFactory::GetPlayerName(m_eCurrentPlayer);
+        m_progressTrackingVideoResumeBookmark.player = CPlayerCoreFactory::Get().GetPlayerName(m_eCurrentPlayer);
         m_progressTrackingVideoResumeBookmark.playerState = m_pPlayer->GetPlayerState();
         m_progressTrackingVideoResumeBookmark.thumbNailImage.Empty();
 
@@ -4821,7 +4781,6 @@ bool CApplication::OnMessage(CGUIMessage& message)
         *m_itemCurrentFile = *item;
       }
       g_infoManager.SetCurrentItem(*m_itemCurrentFile);
-      CLastFmManager::GetInstance()->OnSongChange(*m_itemCurrentFile);
       g_partyModeManager.OnSongChange(true);
 
       CVariant param;
@@ -4850,13 +4809,6 @@ bool CApplication::OnMessage(CGUIMessage& message)
             m_pKaraokeMgr->Start(m_itemCurrentFile->GetPath());
         }
 #endif
-        // Let scrobbler know about the track
-        const CMusicInfoTag* tag=g_infoManager.GetCurrentSongTag();
-        if (tag)
-        {
-          CLastfmScrobbler::GetInstance()->AddSong(*tag, CLastFmManager::GetInstance()->IsRadioEnabled());
-          CLibrefmScrobbler::GetInstance()->AddSong(*tag, CLastFmManager::GetInstance()->IsRadioEnabled());
-        }
       }
 
       return true;
@@ -4939,10 +4891,6 @@ bool CApplication::OnMessage(CGUIMessage& message)
       }
       else
       {
-        // stop lastfm
-        if (CLastFmManager::GetInstance()->IsRadioEnabled())
-          CLastFmManager::GetInstance()->StopRadio();
-
         // reset any forced player
         m_eForcedNextPlayer = EPC_NONE;
 
@@ -5073,7 +5021,7 @@ void CApplication::Process()
   if (g_application.m_bStop) return; //we're done, everything has been unloaded
 
   // check how far we are through playing the current item
-  // and do anything that needs doing (lastfm submission, playcount updates etc)
+  // and do anything that needs doing (playcount updates etc)
   CheckPlayingProgress();
 
   // update sound
@@ -5105,15 +5053,15 @@ void CApplication::ProcessSlow()
   }
 #endif
 
-  // Store our file state for use on close()
-  UpdateFileState();
-
-  if (IsPlayingAudio())
+  // Resume low priority jobs when current item is not video
+  if (!CurrentFileItem().IsVideo())
   {
-    CLastfmScrobbler::GetInstance()->UpdateStatus();
-    CLibrefmScrobbler::GetInstance()->UpdateStatus();
+    CJobManager::GetInstance().UnPause(CJob::PRIORITY_LOW);
   }
 
+  // Store our file state for use on close()
+  UpdateFileState();
+
   // Check if we need to activate the screensaver / DPMS.
   CheckScreenSaverAndDPMS();
 
@@ -5381,7 +5329,7 @@ int CApplication::GetSubtitleDelay() const
 
 int CApplication::GetAudioDelay() const
 {
-  // converts subtitle delay to a percentage
+  // converts audio delay to a percentage
   return int(((float)(g_settings.m_currentVideoSettings.m_AudioDelay + g_advancedSettings.m_videoAudioDelayRange)) / (2 * g_advancedSettings.m_videoAudioDelayRange)*100.0f + 0.5f);
 }
 
index 3195c49..34ed9af 100644 (file)
@@ -203,7 +203,6 @@ public:
   // Checks whether the screensaver and / or DPMS should become active.
   void CheckScreenSaverAndDPMS();
   void CheckPlayingProgress();
-  void CheckAudioScrobblerStatus();
   void ActivateScreenSaver(bool forceType = false);
 
   virtual void Process();
index 0350b03..08841e4 100644 (file)
@@ -65,6 +65,9 @@
 #include "windows/GUIWindowLoginScreen.h"
 
 #include "utils/GlobalsHandling.h"
+#if defined(TARGET_ANDROID)
+  #include "xbmc/android/activity/XBMCApp.h"
+#endif
 
 using namespace PVR;
 using namespace std;
@@ -805,6 +808,19 @@ void CApplicationMessenger::ProcessMessage(ThreadMessage *pMsg)
       CGUIWindowLoginScreen::LoadProfile(pMsg->dwParam1);
       break;
     }
+    case TMSG_START_ANDROID_ACTIVITY:
+    {
+#if defined(TARGET_ANDROID)
+      if (pMsg->params.size())
+      {
+        CXBMCApp::StartActivity(pMsg->params[0],
+                                pMsg->params.size() > 1 ? pMsg->params[1] : "",
+                                pMsg->params.size() > 2 ? pMsg->params[2] : "",
+                                pMsg->params.size() > 3 ? pMsg->params[3] : "");
+      }
+#endif
+      break;
+    }
   }
 }
 
@@ -1290,3 +1306,10 @@ void CApplicationMessenger::LoadProfile(unsigned int idx)
   tMsg.dwParam1 = idx;
   SendMessage(tMsg, false);
 }
+
+void CApplicationMessenger::StartAndroidActivity(const vector<CStdString> &params)
+{
+  ThreadMessage tMsg = {TMSG_START_ANDROID_ACTIVITY};
+  tMsg.params = params;
+  SendMessage(tMsg, false);
+}
index 66952f8..bf167c2 100644 (file)
@@ -101,6 +101,7 @@ namespace MUSIC_INFO
 #define TMSG_GUI_INFOBOOL             609
 #define TMSG_GUI_ADDON_DIALOG         610
 #define TMSG_GUI_MESSAGE              611
+#define TMSG_START_ANDROID_ACTIVITY   612
 
 #define TMSG_CALLBACK             800
 
@@ -241,6 +242,7 @@ public:
   
   bool SetupDisplay();
   bool DestroyDisplay();
+  void StartAndroidActivity(const std::vector<CStdString> &params);
 
   virtual ~CApplicationMessenger();
 private:
index 904b983..eaf8bd8 100644 (file)
@@ -288,7 +288,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
             item.m_lStartOffset = STARTOFFSET_RESUME;
 
             // get playername
-            CStdString hddvdplayer = CPlayerCoreFactory::GetPlayerName(CPlayerCoreFactory::GetDefaultPlayer(item));
+            CStdString hddvdplayer = CPlayerCoreFactory::Get().GetPlayerName(CPlayerCoreFactory::Get().GetDefaultPlayer(item));
             
             // Single *.xpl or *.ifo files require an external player to handle playback.
             // If no matching rule was found, DVDPlayer will be default player.
index 2d62ce3..af26cc8 100644 (file)
@@ -502,10 +502,11 @@ public:
   virtual ~DllDynamic();
   virtual bool Load();
   virtual void Unload();
-  virtual bool IsLoaded() { return m_dll!=NULL; }
+  virtual bool IsLoaded() const { return m_dll!=NULL; }
   bool CanLoad();
   bool EnableDelayedUnload(bool bOnOff);
   bool SetFile(const CStdString& strDllName);
+  const CStdString &GetFile() const { return m_strDllName; }
 
 protected:
   virtual bool ResolveExports()=0;
index e43afa2..3ed0399 100644 (file)
@@ -25,6 +25,7 @@
 #include "FileItem.h"
 #include "utils/XBMCTinyXML.h"
 #include "utils/log.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "settings/AdvancedSettings.h"
 #include "video/VideoInfoTag.h"
@@ -148,37 +149,20 @@ bool CFavourites::IsFavourite(CFileItem *item, int contextWindow)
   return items.Contains(GetExecutePath(item, contextWindow));
 }
 
-static CStdString Paramify(const CStdString& param)
-{
-  CStdString result(param);
-  result.Replace("\\", "\\\\");
-  result.Replace("\"", "\\\"");
-  return "\"" + result + "\"";
-}
-
-#ifdef UNIT_TESTING
-bool CFavourites::TestParamify()
-{
-  return (Paramify("test") == "\"test\"" &&
-          Paramify("test\"foo\"test") == "\"test\\\"foo\\\"test\"" &&
-          Paramify("C:\\foo\\bar\\") == "\"C:\\\\foo\\\\bar\\\\\"");
-}
-#endif
-
 CStdString CFavourites::GetExecutePath(const CFileItem *item, int contextWindow)
 {
   CStdString execute;
   if (item->m_bIsFolder && (g_advancedSettings.m_playlistAsFolders ||
                             !(item->IsSmartPlayList() || item->IsPlayList())))
-    execute.Format("ActivateWindow(%i,%s)", contextWindow, Paramify(item->GetPath()));
+    execute.Format("ActivateWindow(%i,%s)", contextWindow, StringUtils::Paramify(item->GetPath()).c_str());
   else if (item->IsScript())
-    execute.Format("RunScript(%s)", Paramify(item->GetPath().Mid(9)));
+    execute.Format("RunScript(%s)", StringUtils::Paramify(item->GetPath().Mid(9)).c_str());
   else  // assume a media file
   {
     if (item->IsVideoDb() && item->HasVideoInfoTag())
-      execute.Format("PlayMedia(%s)", Paramify(item->GetVideoInfoTag()->m_strFileNameAndPath));
+      execute.Format("PlayMedia(%s)", StringUtils::Paramify(item->GetVideoInfoTag()->m_strFileNameAndPath).c_str());
     else
-      execute.Format("PlayMedia(%s)", Paramify(item->GetPath()));
+      execute.Format("PlayMedia(%s)", StringUtils::Paramify(item->GetPath()).c_str());
   }
   return execute;
 }
index 3cb79ab..36ddd7b 100644 (file)
@@ -33,11 +33,6 @@ public:
   static bool AddOrRemove(CFileItem *item, int contextWindow);
   static bool Save(const CFileItemList& items);
   static bool IsFavourite(CFileItem *item, int contextWindow);
-
-#ifdef UNIT_TESTING
-  static bool TestParamify();
-#endif
-
 private:
   static CStdString GetExecutePath(const CFileItem *item, int contextWindow);
 };
index 480d504..882a29c 100644 (file)
@@ -842,7 +842,6 @@ bool CFileItem::IsAudio() const
   if (HasVideoInfoTag()) return false;
   if (HasPictureInfoTag()) return false;
   if (IsCDDA()) return true;
-  if (!m_bIsFolder && IsLastFM()) return true;
 
   CStdString extension;
   if( m_mimetype.Left(12).Equals("application/") )
@@ -866,7 +865,7 @@ bool CFileItem::IsAudio() const
 
 bool CFileItem::IsKaraoke() const
 {
-  if ( !IsAudio() || IsLastFM())
+  if ( !IsAudio())
     return false;
 
   return CKaraokeLyricsFactory::HasLyrics( m_strPath );
@@ -894,11 +893,6 @@ bool CFileItem::IsCUESheet() const
   return URIUtils::GetExtension(m_strPath).Equals(".cue", false);
 }
 
-bool CFileItem::IsLastFM() const
-{
-  return URIUtils::IsLastFM(m_strPath);
-}
-
 bool CFileItem::IsInternetStream(const bool bStrictCheck /* = false */) const
 {
   if (HasProperty("IsHTTPDirectory"))
@@ -1721,7 +1715,7 @@ void CFileItemList::Assign(const CFileItemList& itemlist, bool append)
   m_cacheToDisc = itemlist.m_cacheToDisc;
 }
 
-bool CFileItemList::Copy(const CFileItemList& items)
+bool CFileItemList::Copy(const CFileItemList& items, bool copyItems /* = true */)
 {
   // assign all CFileItem parts
   *(CFileItem*)this = *(CFileItem*)&items;
@@ -1736,11 +1730,14 @@ bool CFileItemList::Copy(const CFileItemList& items)
   m_sortOrder      = items.m_sortOrder;
   m_sortIgnoreFolders = items.m_sortIgnoreFolders;
 
-  // make a copy of each item
-  for (int i = 0; i < items.Size(); i++)
+  if (copyItems)
   {
-    CFileItemPtr newItem(new CFileItem(*items[i]));
-    Add(newItem);
+    // make a copy of each item
+    for (int i = 0; i < items.Size(); i++)
+    {
+      CFileItemPtr newItem(new CFileItem(*items[i]));
+      Add(newItem);
+    }
   }
 
   return true;
index 7eb92f3..3bc077a 100644 (file)
@@ -111,7 +111,6 @@ public:
   bool IsAudio() const;
   bool IsKaraoke() const;
   bool IsCUESheet() const;
-  bool IsLastFM() const;
   bool IsInternetStream(const bool bStrictCheck = false) const;
   bool IsPlayList() const;
   bool IsSmartPlayList() const;
@@ -475,7 +474,7 @@ public:
   bool IsEmpty() const;
   void Append(const CFileItemList& itemlist);
   void Assign(const CFileItemList& itemlist, bool append = false);
-  bool Copy  (const CFileItemList& item);
+  bool Copy  (const CFileItemList& item, bool copyItems = true);
   void Reserve(int iCount);
   void Sort(SORT_METHOD sortMethod, SortOrder sortOrder);
   /* \brief Sorts the items based on the given sorting options
index 271fa70..686f31d 100644 (file)
@@ -25,7 +25,6 @@
 #include "dialogs/GUIDialogProgress.h"
 #include "Application.h"
 #include "Util.h"
-#include "network/libscrobbler/lastfmscrobbler.h"
 #include "utils/URIUtils.h"
 #include "utils/Weather.h"
 #include "PartyModeManager.h"
@@ -36,7 +35,6 @@
 #include "utils/SystemInfo.h"
 #include "guilib/GUITextBox.h"
 #include "pictures/GUIWindowSlideShow.h"
-#include "music/LastFmManager.h"
 #include "pictures/PictureInfoTag.h"
 #include "music/tags/MusicInfoTag.h"
 #include "guilib/GUIWindowManager.h"
@@ -299,16 +297,6 @@ const infomap musicpartymode[] = {{ "enabled",           MUSICPM_ENABLED },
                                   { "relaxedsongspicked",MUSICPM_RELAXEDSONGSPICKED },
                                   { "randomsongspicked", MUSICPM_RANDOMSONGSPICKED }};
 
-const infomap audioscrobbler[] = {{ "enabled",           AUDIOSCROBBLER_ENABLED },
-                                  { "connectstate",      AUDIOSCROBBLER_CONN_STATE }, //labels from here
-                                  { "submitinterval",    AUDIOSCROBBLER_SUBMIT_INT },
-                                  { "filescached",       AUDIOSCROBBLER_FILES_CACHED },
-                                  { "submitstate",       AUDIOSCROBBLER_SUBMIT_STATE }};
-
-const infomap lastfm[] =         {{ "radioplaying",      LASTFM_RADIOPLAYING },
-                                  { "canlove",           LASTFM_CANLOVE},
-                                  { "canban",            LASTFM_CANBAN}};
-
 const infomap musicplayer[] =    {{ "title",            MUSICPLAYER_TITLE },
                                   { "album",            MUSICPLAYER_ALBUM },
                                   { "artist",           MUSICPLAYER_ARTIST },
@@ -802,22 +790,6 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
           return musicpartymode[i].val;
       }
     }
-    else if (cat.name == "audioscrobbler")
-    {
-      for (size_t i = 0; i < sizeof(audioscrobbler) / sizeof(infomap); i++)
-      {
-        if (prop.name == audioscrobbler[i].str)
-          return audioscrobbler[i].val;
-      }
-    }
-    else if (cat.name == "lastfm")
-    {
-      for (size_t i = 0; i < sizeof(lastfm) / sizeof(infomap); i++)
-      {
-        if (prop.name == lastfm[i].str)
-          return lastfm[i].val;
-      }
-    }
     else if (cat.name == "system")
     {
       for (size_t i = 0; i < sizeof(system_labels) / sizeof(infomap); i++)
@@ -1452,7 +1424,11 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
   break;
   case VIDEOPLAYER_VIDEO_CODEC:
     if(g_application.IsPlaying() && g_application.m_pPlayer)
-      strLabel = g_application.m_pPlayer->GetVideoCodecName();
+    {
+      SPlayerVideoStreamInfo info;
+      g_application.m_pPlayer->GetVideoStreamInfo(info);
+      strLabel = info.videoCodecName;
+    }
     break;
   case VIDEOPLAYER_VIDEO_RESOLUTION:
     if(g_application.IsPlaying() && g_application.m_pPlayer)
@@ -1460,19 +1436,27 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     break;
   case VIDEOPLAYER_AUDIO_CODEC:
     if(g_application.IsPlaying() && g_application.m_pPlayer)
-      strLabel = g_application.m_pPlayer->GetAudioCodecName();
+    {
+      SPlayerAudioStreamInfo info;
+      g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
+      strLabel = info.audioCodecName;
+    }
     break;
   case VIDEOPLAYER_VIDEO_ASPECT:
     if (g_application.IsPlaying() && g_application.m_pPlayer)
     {
-      float aspect;
-      g_application.m_pPlayer->GetVideoAspectRatio(aspect);
-      strLabel = CStreamDetails::VideoAspectToAspectDescription(aspect);
+      SPlayerVideoStreamInfo info;
+      g_application.m_pPlayer->GetVideoStreamInfo(info);
+      strLabel = CStreamDetails::VideoAspectToAspectDescription(info.videoAspectRatio);
     }
     break;
   case VIDEOPLAYER_AUDIO_CHANNELS:
     if(g_application.IsPlaying() && g_application.m_pPlayer)
-      strLabel.Format("%i", g_application.m_pPlayer->GetChannels());
+    {
+      SPlayerAudioStreamInfo info;
+      g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
+      strLabel.Format("%i", info.channels);
+    }
     break;
   case PLAYLIST_LENGTH:
   case PLAYLIST_POSITION:
@@ -1774,12 +1758,6 @@ CStdString CGUIInfoManager::GetLabel(int info, int contextWindow, CStdString *fa
     }
     break;
 
-  case AUDIOSCROBBLER_CONN_STATE:
-  case AUDIOSCROBBLER_SUBMIT_INT:
-  case AUDIOSCROBBLER_FILES_CACHED:
-  case AUDIOSCROBBLER_SUBMIT_STATE:
-    strLabel=GetAudioScrobblerLabel(info);
-    break;
   case VISUALISATION_PRESET:
     {
       CGUIMessage msg(GUI_MSG_GET_VISUALISATION, 0, 0);
@@ -2338,18 +2316,6 @@ bool CGUIInfoManager::GetBool(int condition1, int contextWindow, const CGUIListI
     case MUSICPM_ENABLED:
       bReturn = g_partyModeManager.IsEnabled();
     break;
-    case AUDIOSCROBBLER_ENABLED:
-      bReturn = CLastFmManager::GetInstance()->IsLastFmEnabled();
-    break;
-    case LASTFM_RADIOPLAYING:
-      bReturn = CLastFmManager::GetInstance()->IsRadioEnabled();
-      break;
-    case LASTFM_CANLOVE:
-      bReturn = CLastFmManager::GetInstance()->CanLove();
-      break;
-    case LASTFM_CANBAN:
-      bReturn = CLastFmManager::GetInstance()->CanBan();
-      break;
     case MUSICPLAYER_HASPREVIOUS:
       {
         // requires current playlist be PLAYLIST_MUSIC
@@ -3343,6 +3309,10 @@ CStdString CGUIInfoManager::GetPlaylistLabel(int item) const
 CStdString CGUIInfoManager::GetMusicLabel(int item)
 {
   if (!g_application.IsPlaying() || !m_currentFile->HasMusicInfoTag()) return "";
+
+  SPlayerAudioStreamInfo info;
+  g_application.m_pPlayer->GetAudioStreamInfo(g_application.m_pPlayer->GetAudioStream(), info);
+
   switch (item)
   {
   case MUSICPLAYER_PLAYLISTLEN:
@@ -3362,7 +3332,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
       float fTimeSpan = (float)(CTimeUtils::GetFrameTime() - m_lastMusicBitrateTime);
       if (fTimeSpan >= 500.0f)
       {
-        m_MusicBitrate = g_application.m_pPlayer->GetAudioBitrate();
+        m_MusicBitrate = info.bitrate;
         m_lastMusicBitrateTime = CTimeUtils::GetFrameTime();
       }
       CStdString strBitrate = "";
@@ -3374,9 +3344,9 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
   case MUSICPLAYER_CHANNELS:
     {
       CStdString strChannels = "";
-      if (g_application.m_pPlayer->GetChannels() > 0)
+      if (info.channels > 0)
       {
-        strChannels.Format("%i", g_application.m_pPlayer->GetChannels());
+        strChannels.Format("%i", info.channels);
       }
       return strChannels;
     }
@@ -3404,7 +3374,7 @@ CStdString CGUIInfoManager::GetMusicLabel(int item)
   case MUSICPLAYER_CODEC:
     {
       CStdString strCodec;
-      strCodec.Format("%s", g_application.m_pPlayer->GetAudioCodecName().c_str());
+      strCodec.Format("%s", info.audioCodecName);
       return strCodec;
     }
     break;
@@ -3986,27 +3956,6 @@ bool CGUIInfoManager::GetDisplayAfterSeek()
   return false;
 }
 
-CStdString CGUIInfoManager::GetAudioScrobblerLabel(int item)
-{
-  switch (item)
-  {
-  case AUDIOSCROBBLER_CONN_STATE:
-    return CLastfmScrobbler::GetInstance()->GetConnectionState();
-    break;
-  case AUDIOSCROBBLER_SUBMIT_INT:
-    return CLastfmScrobbler::GetInstance()->GetSubmitInterval();
-    break;
-  case AUDIOSCROBBLER_FILES_CACHED:
-    return CLastfmScrobbler::GetInstance()->GetFilesCached();
-    break;
-  case AUDIOSCROBBLER_SUBMIT_STATE:
-    return CLastfmScrobbler::GetInstance()->GetSubmitState();
-    break;
-  }
-
-  return "";
-}
-
 void CGUIInfoManager::Clear()
 {
   CSingleLock lock(m_critInfo);
@@ -5012,7 +4961,7 @@ void CGUIInfoManager::SetCurrentSlide(CFileItem &item)
 {
   if (m_currentSlide->GetPath() != item.GetPath())
   {
-    if (!item.HasPictureInfoTag() && !item.GetPictureInfoTag()->Loaded())
+    if (!item.GetPictureInfoTag()->Loaded()) // If picture metadata has not been loaded yet, load it now
       item.GetPictureInfoTag()->Load(item.GetPath());
     *m_currentSlide = item;
   }
index 0b03789..6a3410a 100644 (file)
@@ -269,15 +269,6 @@ namespace INFO
 #define VIDEOPLAYER_PARENTAL_RATING   307
 #define VIDEOPLAYER_HAS_EPG           308
 
-#define AUDIOSCROBBLER_ENABLED      325
-#define AUDIOSCROBBLER_CONN_STATE   326
-#define AUDIOSCROBBLER_SUBMIT_INT   327
-#define AUDIOSCROBBLER_FILES_CACHED 328
-#define AUDIOSCROBBLER_SUBMIT_STATE 329
-#define LASTFM_RADIOPLAYING         330
-#define LASTFM_CANLOVE              331
-#define LASTFM_CANBAN               332
-
 #define CONTAINER_CAN_FILTER         342
 #define CONTAINER_CAN_FILTERADVANCED 343
 #define CONTAINER_FILTERED           344
@@ -847,8 +838,6 @@ protected:
   int AddMultiInfo(const GUIInfo &info);
   int AddListItemProp(const CStdString &str, int offset=0);
 
-  CStdString GetAudioScrobblerLabel(int item);
-
   /*!
    * @brief Get the EPG tag that is currently active
    * @param tag The active tag
index 8f94b7c..4a70328 100644 (file)
@@ -25,8 +25,8 @@
 #include "guilib/GUIKeyboardFactory.h"
 #include "dialogs/GUIDialogNumeric.h"
 #include "dialogs/GUIDialogOK.h"
-#include "settings/GUIDialogLockSettings.h"
-#include "settings/GUIDialogProfileSettings.h"
+#include "settings/dialogs/GUIDialogLockSettings.h"
+#include "settings/dialogs/GUIDialogProfileSettings.h"
 #include "Util.h"
 #include "settings/Settings.h"
 #include "settings/GUISettings.h"
index 741354b..1a995f7 100644 (file)
@@ -1,5 +1,6 @@
 SRCS=Application.cpp \
      ApplicationMessenger.cpp \
+     AppParamParser.cpp \
      Autorun.cpp \
      AutoSwitch.cpp \
      BackgroundInfoLoader.cpp \
index bb503b2..953fd85 100644 (file)
@@ -183,7 +183,7 @@ int CNfoFile::Load(const CStdString& strFile)
 
 void CNfoFile::Close()
 {
-  delete m_doc;
+  delete[] m_doc;
   m_doc = NULL;
   m_scurl.Clear();
 }
index 8bba20b..bdb46fa 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include "PasswordManager.h"
-#include "settings/GUIDialogLockSettings.h"
+#include "settings/dialogs/GUIDialogLockSettings.h"
 #include "URL.h"
 #include "settings/Settings.h"
 #include "utils/XMLUtils.h"
index 5e7a0d0..b6adb28 100644 (file)
@@ -68,7 +68,7 @@ bool CPlayListPlayer::OnMessage(CGUIMessage &message)
     if (message.GetParam1() == GUI_MSG_UPDATE_ITEM && message.GetItem())
     {
       // update the items in our playlist(s) if necessary
-      for (int i = PLAYLIST_MUSIC; i != PLAYLIST_VIDEO; i++)
+      for (int i = PLAYLIST_MUSIC; i <= PLAYLIST_VIDEO; i++)
       {
         CPlayList &playlist = GetPlaylist(i);
         CFileItemPtr item = boost::static_pointer_cast<CFileItem>(message.GetItem());
index cabf629..e16b6cf 100644 (file)
@@ -299,14 +299,14 @@ void CTextureCache::OnCachingComplete(bool success, CTextureCacheJob *job)
 
 void CTextureCache::OnJobComplete(unsigned int jobID, bool success, CJob *job)
 {
-  if (strcmp(job->GetType(), "cacheimage") == 0)
+  if (strcmp(job->GetType(), kJobTypeCacheImage) == 0)
     OnCachingComplete(success, (CTextureCacheJob *)job);
   return CJobQueue::OnJobComplete(jobID, success, job);
 }
 
 void CTextureCache::OnJobProgress(unsigned int jobID, unsigned int progress, unsigned int total, const CJob *job)
 {
-  if (strcmp(job->GetType(), "cacheimage") == 0 && !progress)
+  if (strcmp(job->GetType(), kJobTypeCacheImage) == 0 && !progress)
   { // check our processing list
     {
       CSingleLock lock(m_processingSection);
index c18d373..254edc6 100644 (file)
@@ -64,7 +64,7 @@ public:
   CTextureCacheJob(const CStdString &url, const CStdString &oldHash = "");
   virtual ~CTextureCacheJob();
 
-  virtual const char* GetType() const { return "cacheimage"; };
+  virtual const char* GetType() const { return kJobTypeCacheImage; };
   virtual bool operator==(const CJob *job) const;
   virtual bool DoWork();
 
@@ -129,7 +129,7 @@ class CTextureDDSJob : public CJob
 public:
   CTextureDDSJob(const CStdString &original);
 
-  virtual const char* GetType() const { return "ddscompress"; };
+  virtual const char* GetType() const { return kJobTypeDDSCompress; };
   virtual bool operator==(const CJob *job) const;
   virtual bool DoWork();
 
index 8bd9d0f..6599e8d 100644 (file)
@@ -66,6 +66,9 @@ void CURL::Reset()
   m_strFileName.clear();
   m_strProtocol.clear();
   m_strFileType.clear();
+  m_strOptions.clear();
+  m_strProtocolOptions.clear();
+  m_options.Clear();
   m_iPort = 0;
 }
 
@@ -309,7 +312,6 @@ void CURL::Parse(const CStdString& strURL1)
     || m_strProtocol.CompareNoCase("musicdb") == 0
     || m_strProtocol.CompareNoCase("videodb") == 0
     || m_strProtocol.CompareNoCase("sources") == 0
-    || m_strProtocol.CompareNoCase("lastfm") == 0
     || m_strProtocol.CompareNoCase("pvr") == 0
     || m_strProtocol.Left(3).CompareNoCase("mem") == 0)
   {
@@ -752,7 +754,6 @@ CStdString CURL::TranslateProtocol(const CStdString& prot)
    || prot == "daap"
    || prot == "dav"
    || prot == "tuxbox"
-   || prot == "lastfm"
    || prot == "rss")
    return "http";
 
index 7701d7d..6ef1856 100644 (file)
@@ -146,15 +146,6 @@ CStdString CUtil::GetTitleFromPath(const CStdString& strFileNameAndPath, bool bI
       return items.m_strTitle;
   }
 
-  // LastFM
-  if (url.GetProtocol() == "lastfm")
-  {
-    if (strFilename.IsEmpty())
-      strFilename = g_localizeStrings.Get(15200);
-    else
-      strFilename = g_localizeStrings.Get(15200) + " - " + strFilename;
-  }
-
   // Shoutcast
   else if (url.GetProtocol() == "shout")
   {
@@ -1179,8 +1170,6 @@ int CUtil::GetMatchingSource(const CStdString& strPath1, VECSOURCES& VECSOURCES,
 
   if (checkURL.GetProtocol() == "shout")
     strPath = checkURL.GetHostName();
-  if (checkURL.GetProtocol() == "lastfm")
-    return 1;
   if (checkURL.GetProtocol() == "tuxbox")
     return 1;
   if (checkURL.GetProtocol() == "plugin")
@@ -1947,6 +1936,7 @@ void CUtil::ScanForExternalSubtitles(const CStdString& strMovie, std::vector<CSt
     for (int j=0; common_sub_dirs[j]; j++)
     {
       CStdString strPath2 = URIUtils::AddFileToFolder(strLookInPaths[i],common_sub_dirs[j]);
+      URIUtils::AddSlashAtEnd(strPath2);
       if (CDirectory::Exists(strPath2))
         strLookInPaths.push_back(strPath2);
     }
index c2d690b..83c9318 100644 (file)
@@ -26,6 +26,7 @@
 
 typedef void (*AddOnLogCallback)(void *addonData, const ADDON::addon_log_t loglevel, const char *msg);
 typedef void (*AddOnQueueNotification)(void *addonData, const ADDON::queue_msg_t type, const char *msg);
+typedef bool (*AddOnWakeOnLan)(const char* mac);
 typedef bool (*AddOnGetSetting)(void *addonData, const char *settingName, void *settingValue);
 typedef char* (*AddOnUnknownToUTF8)(const char *sourceDest);
 typedef char* (*AddOnGetLocalizedString)(const void* addonData, long dwCode);
@@ -56,6 +57,7 @@ typedef struct CB_AddOn
 {
   AddOnLogCallback        Log;
   AddOnQueueNotification  QueueNotification;
+  AddOnWakeOnLan          WakeOnLan;
   AddOnGetSetting         GetSetting;
   AddOnUnknownToUTF8      UnknownToUTF8;
   AddOnGetLocalizedString GetLocalizedString;
@@ -119,7 +121,9 @@ typedef GUIHANDLE   (*GUIWindow_GetControl_Button)(void *addonData, GUIHANDLE ha
 typedef GUIHANDLE   (*GUIWindow_GetControl_RadioButton)(void *addonData, GUIHANDLE handle, int controlId);
 typedef GUIHANDLE   (*GUIWindow_GetControl_Edit)(void *addonData, GUIHANDLE handle, int controlId);
 typedef GUIHANDLE   (*GUIWindow_GetControl_Progress)(void *addonData, GUIHANDLE handle, int controlId);
+typedef GUIHANDLE   (*GUIWindow_GetControl_RenderAddon)(void *addonData, GUIHANDLE handle, int controlId);
 typedef void        (*GUIWindow_SetControlLabel)(void *addonData, GUIHANDLE handle, int controlId, const char *label);
+typedef void        (*GUIWindow_MarkDirtyRegion)(void *addonData, GUIHANDLE handle);
 typedef void        (*GUIControl_Spin_SetVisible)(void *addonData, GUIHANDLE spinhandle, bool yesNo);
 typedef void        (*GUIControl_Spin_SetText)(void *addonData, GUIHANDLE spinhandle, const char *label);
 typedef void        (*GUIControl_Spin_Clear)(void *addonData, GUIHANDLE spinhandle);
@@ -146,6 +150,9 @@ typedef void        (*GUIListItem_SetInfo)(void *addonData, GUIHANDLE handle, co
 typedef void        (*GUIListItem_SetProperty)(void *addonData, GUIHANDLE handle, const char *key, const char *value);
 typedef const char* (*GUIListItem_GetProperty)(void *addonData, GUIHANDLE handle, const char *key);
 typedef void        (*GUIListItem_SetPath)(void *addonData, GUIHANDLE handle, const char *path);
+typedef void        (*GUIRenderAddon_SetCallbacks)(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*createCB)(GUIHANDLE,int,int,int,int,void*), void (*renderCB)(GUIHANDLE), void (*stopCB)(GUIHANDLE), bool (*dirtyCB)(GUIHANDLE));
+typedef void        (*GUIRenderAddon_Delete)(void *addonData, GUIHANDLE handle);
+typedef void        (*GUIRenderAddon_MarkDirty)(void *addonData, GUIHANDLE handle);
 
 typedef struct CB_GUILib
 {
@@ -185,7 +192,9 @@ typedef struct CB_GUILib
   GUIWindow_GetControl_RadioButton    Window_GetControl_RadioButton;
   GUIWindow_GetControl_Edit           Window_GetControl_Edit;
   GUIWindow_GetControl_Progress       Window_GetControl_Progress;
+  GUIWindow_GetControl_RenderAddon    Window_GetControl_RenderAddon;
   GUIWindow_SetControlLabel           Window_SetControlLabel;
+  GUIWindow_MarkDirtyRegion           Window_MarkDirtyRegion;
   GUIControl_Spin_SetVisible          Control_Spin_SetVisible;
   GUIControl_Spin_SetText             Control_Spin_SetText;
   GUIControl_Spin_Clear               Control_Spin_Clear;
@@ -212,6 +221,8 @@ typedef struct CB_GUILib
   GUIListItem_SetProperty             ListItem_SetProperty;
   GUIListItem_GetProperty             ListItem_GetProperty;
   GUIListItem_SetPath                 ListItem_SetPath;
+  GUIRenderAddon_SetCallbacks         RenderAddon_SetCallbacks;
+  GUIRenderAddon_Delete               RenderAddon_Delete;
 
 } CB_GUILib;
 
index 152c2c4..b0dcd0a 100644 (file)
@@ -28,6 +28,7 @@
 #include "filesystem/Directory.h"
 #include "utils/URIUtils.h"
 #include "FileItem.h"
+#include "network/Network.h"
 
 using namespace XFILE;
 
@@ -42,6 +43,7 @@ CAddonCallbacksAddon::CAddonCallbacksAddon(CAddon* addon)
   /* write XBMC addon-on specific add-on function addresses to the callback table */
   m_callbacks->Log                = AddOnLog;
   m_callbacks->QueueNotification  = QueueNotification;
+  m_callbacks->WakeOnLan          = WakeOnLan;
   m_callbacks->GetSetting         = GetAddonSetting;
   m_callbacks->UnknownToUTF8      = UnknownToUTF8;
   m_callbacks->GetLocalizedString = GetLocalizedString;
@@ -157,6 +159,11 @@ void CAddonCallbacksAddon::QueueNotification(void *addonData, const queue_msg_t
   }
 }
 
+bool CAddonCallbacksAddon::WakeOnLan(const char *mac)
+{
+  return g_application.getNetwork().WakeOnLan(mac);
+}
+
 bool CAddonCallbacksAddon::GetAddonSetting(void *addonData, const char *strSettingName, void *settingValue)
 {
   CAddonCallbacks* addon = (CAddonCallbacks*) addonData;
index 83d8361..9e0fd5a 100644 (file)
@@ -38,6 +38,7 @@ public:
   static void AddOnLog(void *addonData, const addon_log_t addonLogLevel, const char *strMessage);
   static bool GetAddonSetting(void *addonData, const char *strSettingName, void *settingValue);
   static void QueueNotification(void *addonData, const queue_msg_t type, const char *strMessage);
+  static bool WakeOnLan(const char *mac);
   static char* UnknownToUTF8(const char *strSource);
   static char* GetLocalizedString(const void* addonData, long dwCode);
   static char* GetDVDMenuLanguage(const void* addonData);
index 13da1e7..780f90c 100644 (file)
@@ -36,6 +36,7 @@
 #include "guilib/GUISettingsSliderControl.h"
 #include "guilib/GUIEditControl.h"
 #include "guilib/GUIProgressControl.h"
+#include "guilib/GUIRenderingControl.h"
 
 #define CONTROL_BTNVIEWASICONS  2
 #define CONTROL_BTNSORTBY       3
@@ -93,8 +94,10 @@ CAddonCallbacksGUI::CAddonCallbacksGUI(CAddon* addon)
   m_callbacks->Window_GetControl_RadioButton  = CAddonCallbacksGUI::Window_GetControl_RadioButton;
   m_callbacks->Window_GetControl_Edit         = CAddonCallbacksGUI::Window_GetControl_Edit;
   m_callbacks->Window_GetControl_Progress     = CAddonCallbacksGUI::Window_GetControl_Progress;
+  m_callbacks->Window_GetControl_RenderAddon  = CAddonCallbacksGUI::Window_GetControl_RenderAddon;
 
   m_callbacks->Window_SetControlLabel         = CAddonCallbacksGUI::Window_SetControlLabel;
+  m_callbacks->Window_MarkDirtyRegion         = CAddonCallbacksGUI::Window_MarkDirtyRegion;
 
   m_callbacks->Control_Spin_SetVisible        = CAddonCallbacksGUI::Control_Spin_SetVisible;
   m_callbacks->Control_Spin_SetText           = CAddonCallbacksGUI::Control_Spin_SetText;
@@ -125,6 +128,9 @@ CAddonCallbacksGUI::CAddonCallbacksGUI(CAddon* addon)
   m_callbacks->ListItem_SetProperty           = CAddonCallbacksGUI::ListItem_SetProperty;
   m_callbacks->ListItem_GetProperty           = CAddonCallbacksGUI::ListItem_GetProperty;
   m_callbacks->ListItem_SetPath               = CAddonCallbacksGUI::ListItem_SetPath;
+
+  m_callbacks->RenderAddon_SetCallbacks       = CAddonCallbacksGUI::RenderAddon_SetCallbacks;
+  m_callbacks->RenderAddon_Delete             = CAddonCallbacksGUI::RenderAddon_Delete;
 }
 
 CAddonCallbacksGUI::~CAddonCallbacksGUI()
@@ -927,6 +933,22 @@ GUIHANDLE CAddonCallbacksGUI::Window_GetControl_Progress(void *addonData, GUIHAN
   return pGUIControl;
 }
 
+GUIHANDLE CAddonCallbacksGUI::Window_GetControl_RenderAddon(void *addonData, GUIHANDLE handle, int controlId)
+{
+  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+  if (!helper || !handle)
+    return NULL;
+
+  CGUIAddonWindow *pAddonWindow = (CGUIAddonWindow*)handle;
+  CGUIControl* pGUIControl = (CGUIControl*)pAddonWindow->GetControl(controlId);
+  if (pGUIControl && pGUIControl->GetControlType() != CGUIControl::GUICONTROL_RENDERADDON)
+    return NULL;
+
+  CGUIAddonRenderingControl *pProxyControl;
+  pProxyControl = new CGUIAddonRenderingControl((CGUIRenderingControl*)pGUIControl);
+  return pProxyControl;
+}
+
 void CAddonCallbacksGUI::Window_SetControlLabel(void *addonData, GUIHANDLE handle, int controlId, const char *label)
 {
   CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
@@ -940,6 +962,17 @@ void CAddonCallbacksGUI::Window_SetControlLabel(void *addonData, GUIHANDLE handl
   pAddonWindow->OnMessage(msg);
 }
 
+void CAddonCallbacksGUI::Window_MarkDirtyRegion(void *addonData, GUIHANDLE handle)
+{
+  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+  if (!helper || !handle)
+    return;
+
+  CGUIAddonWindow *pAddonWindow = (CGUIAddonWindow*)handle;
+
+  pAddonWindow->MarkDirtyRegion();
+}
+
 void CAddonCallbacksGUI::Control_Spin_SetVisible(void *addonData, GUIHANDLE spinhandle, bool yesNo)
 {
   CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
@@ -1218,9 +1251,37 @@ void CAddonCallbacksGUI::ListItem_SetPath(void *addonData, GUIHANDLE handle, con
   ((CFileItem*)handle)->SetPath(path);
 }
 
+void CAddonCallbacksGUI::RenderAddon_SetCallbacks(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*createCB)(GUIHANDLE,int,int,int,int,void*), void (*renderCB)(GUIHANDLE), void (*stopCB)(GUIHANDLE), bool (*dirtyCB)(GUIHANDLE))
+{
+  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+  if (!helper || !handle)
+    return;
+
+  CGUIAddonRenderingControl *pAddonControl = (CGUIAddonRenderingControl*)handle;
+
+  Lock();
+  pAddonControl->m_clientHandle  = clienthandle;
+  pAddonControl->CBCreate        = createCB;
+  pAddonControl->CBRender        = renderCB;
+  pAddonControl->CBStop          = stopCB;
+  pAddonControl->CBDirty         = dirtyCB;
+  Unlock();
+
+  pAddonControl->m_pControl->InitCallback(pAddonControl);
+}
 
+void CAddonCallbacksGUI::RenderAddon_Delete(void *addonData, GUIHANDLE handle)
+{
+  CAddonCallbacks* helper = (CAddonCallbacks*) addonData;
+  if (!helper || !handle)
+    return;
 
+  CGUIAddonRenderingControl *pAddonControl = (CGUIAddonRenderingControl*)handle;
 
+  Lock();
+  pAddonControl->Delete();
+  Unlock();
+}
 
 
 
@@ -1246,13 +1307,11 @@ CGUIAddonWindow::~CGUIAddonWindow(void)
 
 bool CGUIAddonWindow::OnAction(const CAction &action)
 {
-  // do the base class window first, and the call to python after this
-  bool ret = CGUIWindow::OnAction(action);  // we don't currently want the mediawindow actions here
-  if (CBOnAction)
-  {
-    CBOnAction(m_clientHandle, action.GetID());
-  }
-  return ret;
+  // Let addon decide whether it wants to hande action first
+  if (CBOnAction && CBOnAction(m_clientHandle, action.GetID()))
+    return true;
+
+  return CGUIWindow::OnAction(action);
 }
 
 bool CGUIAddonWindow::OnMessage(CGUIMessage& message)
@@ -1293,6 +1352,16 @@ bool CGUIAddonWindow::OnMessage(CGUIMessage& message)
       }
     }
     break;
+
+    case GUI_MSG_FOCUSED:
+    {
+      if (HasID(message.GetSenderId()) && CBOnFocus)
+      {
+        CBOnFocus(m_clientHandle, message.GetControlId());
+      }
+    }
+    break;
+
     case GUI_MSG_CLICKED:
     {
       int iControl=message.GetSenderId();
@@ -1326,7 +1395,8 @@ bool CGUIAddonWindow::OnMessage(CGUIMessage& message)
                                                  message.GetParam1() == ACTION_MOUSE_LEFT_CLICK)) ||
                                                  !controlClicked->IsContainer())
           {
-            CBOnClick(m_clientHandle, iControl);
+            if (CBOnClick(m_clientHandle, iControl))
+              return true;
           }
           else if (controlClicked->IsContainer() && message.GetParam1() == ACTION_MOUSE_RIGHT_CLICK)
           {
@@ -1338,7 +1408,6 @@ bool CGUIAddonWindow::OnMessage(CGUIMessage& message)
 //            PyXBMC_AddPendingCall(Py_XBMC_Event_OnAction, inf);
 //            PulseActionEvent();
           }
-          return true;
         }
       }
     }
@@ -1537,4 +1606,61 @@ void CGUIAddonWindowDialog::Show_Internal(bool show /* = true */)
   }
 }
 
+CGUIAddonRenderingControl::CGUIAddonRenderingControl(CGUIRenderingControl *pControl)
+{
+  m_pControl = pControl;
+  m_refCount = 1;
+}
+
+bool CGUIAddonRenderingControl::Create(int x, int y, int w, int h, void *device)
+{
+  if (CBCreate)
+  {
+    if (CBCreate(m_clientHandle, x, y, w, h, device))
+    {
+      m_refCount++;
+      return true;
+    }
+  }
+  return false;
+}
+
+void CGUIAddonRenderingControl::Render()
+{
+  if (CBRender)
+  {
+    g_graphicsContext.BeginPaint();
+    CBRender(m_clientHandle);
+    g_graphicsContext.EndPaint();
+  }
+}
+
+void CGUIAddonRenderingControl::Stop()
+{
+  if (CBStop)
+  {
+    CBStop(m_clientHandle);
+  }
+  m_refCount--;
+  if (m_refCount <= 0)
+    delete this;
+}
+
+void CGUIAddonRenderingControl::Delete()
+{
+  m_refCount--;
+  if (m_refCount <= 0)
+    delete this;
+}
+
+bool CGUIAddonRenderingControl::IsDirty()
+{
+  bool ret = true;
+  if (CBDirty)
+  {
+    ret = CBDirty(m_clientHandle);
+  }
+  return ret;
+}
+
 }; /* namespace ADDON */
index edf04f8..6da862b 100644 (file)
 #include "AddonCallbacks.h"
 #include "windows/GUIMediaWindow.h"
 #include "threads/Event.h"
+#include "guilib/IRenderingCallback.h"
 
 class CGUISpinControlEx;
 class CGUIButtonControl;
 class CGUIRadioButtonControl;
 class CGUISettingsSliderControl;
 class CGUIEditControl;
+class CGUIRenderingControl;
 
 namespace ADDON
 {
@@ -79,7 +81,9 @@ public:
   static GUIHANDLE    Window_GetControl_RadioButton(void *addonData, GUIHANDLE handle, int controlId);
   static GUIHANDLE    Window_GetControl_Edit(void *addonData, GUIHANDLE handle, int controlId);
   static GUIHANDLE    Window_GetControl_Progress(void *addonData, GUIHANDLE handle, int controlId);
+  static GUIHANDLE    Window_GetControl_RenderAddon(void *addonData, GUIHANDLE handle, int controlId);
   static void         Window_SetControlLabel(void *addonData, GUIHANDLE handle, int controlId, const char *label);
+  static void         Window_MarkDirtyRegion(void *addonData, GUIHANDLE handle);
   static void         Control_Spin_SetVisible(void *addonData, GUIHANDLE spinhandle, bool yesNo);
   static void         Control_Spin_SetText(void *addonData, GUIHANDLE spinhandle, const char *label);
   static void         Control_Spin_Clear(void *addonData, GUIHANDLE spinhandle);
@@ -106,6 +110,9 @@ public:
   static void         ListItem_SetProperty(void *addonData, GUIHANDLE handle, const char *key, const char *value);
   static const char * ListItem_GetProperty(void *addonData, GUIHANDLE handle, const char *key);
   static void         ListItem_SetPath(void *addonData, GUIHANDLE handle, const char *path);
+  static void         RenderAddon_SetCallbacks(void *addonData, GUIHANDLE handle, GUIHANDLE clienthandle, bool (*createCB)(GUIHANDLE,int,int,int,int,void*), void (*renderCB)(GUIHANDLE), void (*stopCB)(GUIHANDLE), bool (*dirtyCB)(GUIHANDLE));
+  static void         RenderAddon_Delete(void *addonData, GUIHANDLE handle);
+  static void         RenderAddon_MarkDirty(void *addonData, GUIHANDLE handle);
 
 private:
   CB_GUILib    *m_callbacks;
@@ -178,4 +185,25 @@ private:
   bool             m_bRunning;
 };
 
+class CGUIAddonRenderingControl : public IRenderingCallback
+{
+friend class CAddonCallbacksGUI;
+public:
+  CGUIAddonRenderingControl(CGUIRenderingControl *pControl);
+  virtual bool Create(int x, int y, int w, int h, void *device);
+  virtual void Render();
+  virtual void Stop();
+  virtual bool IsDirty();
+  virtual void Delete();
+protected:
+  bool (*CBCreate) (GUIHANDLE cbhdl, int x, int y, int w, int h, void *device);
+  void (*CBRender)(GUIHANDLE cbhdl);
+  void (*CBStop)(GUIHANDLE cbhdl);
+  bool (*CBDirty)(GUIHANDLE cbhdl);
+
+  GUIHANDLE m_clientHandle;
+  CGUIRenderingControl *m_pControl;
+  int m_refCount;
+};
+
 }; /* namespace ADDON */
index 7e56a56..7e8dedc 100644 (file)
 #include "AddonManager.h"
 #include "AddonStatusHandler.h"
 #include "AddonCallbacks.h"
-#include "settings/GUIDialogSettings.h"
+#include "settings/dialogs/GUIDialogSettings.h"
 #include "utils/URIUtils.h"
 #include "filesystem/File.h"
 #include "filesystem/SpecialProtocol.h"
 #include "filesystem/Directory.h"
 #include "utils/log.h"
+#include "interfaces/IAnnouncer.h"
+#include "interfaces/AnnouncementManager.h"
 
 using namespace XFILE;
 
 namespace ADDON
 {
   template<class TheDll, typename TheStruct, typename TheProps>
-  class CAddonDll : public CAddon
+  class CAddonDll : public CAddon, public ANNOUNCEMENT::IAnnouncer
   {
   public:
     CAddonDll(const AddonProps &props);
@@ -55,6 +57,8 @@ namespace ADDON
 
     bool DllLoaded(void) const;
 
+    void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data);
+
   protected:
     void HandleException(std::exception &e, const char* context);
     bool Initialized() { return m_initialized; }
@@ -220,7 +224,10 @@ ADDON_STATUS CAddonDll<TheDll, TheStruct, TheProps>::Create()
   {
     status = m_pDll->Create(m_pHelpers->GetCallbacks(), m_pInfo);
     if (status == ADDON_STATUS_OK)
+    {
       m_initialized = true;
+      ANNOUNCEMENT::CAnnouncementManager::AddAnnouncer(this);
+    }
     else if ((status == ADDON_STATUS_NEED_SETTINGS) || (status == ADDON_STATUS_NEED_SAVEDSETTINGS))
     {
       m_needsavedsettings = (status == ADDON_STATUS_NEED_SAVEDSETTINGS);
@@ -285,6 +292,8 @@ void CAddonDll<TheDll, TheStruct, TheProps>::Stop()
 template<class TheDll, typename TheStruct, typename TheProps>
 void CAddonDll<TheDll, TheStruct, TheProps>::Destroy()
 {
+  ANNOUNCEMENT::CAnnouncementManager::RemoveAnnouncer(this);
+
   /* Unload library file */
   try
   {
@@ -521,6 +530,19 @@ ADDON_STATUS CAddonDll<TheDll, TheStruct, TheProps>::TransferSettings()
 }
 
 template<class TheDll, typename TheStruct, typename TheProps>
+void CAddonDll<TheDll, TheStruct, TheProps>::Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data)
+{
+  try
+  {
+    m_pDll->Announce(ANNOUNCEMENT::AnnouncementFlagToString(flag), sender, message, &data);
+  }
+  catch (std::exception &e)
+  {
+    HandleException(e, "m_pDll->Announce()");
+  }
+}
+
+template<class TheDll, typename TheStruct, typename TheProps>
 void CAddonDll<TheDll, TheStruct, TheProps>::HandleException(std::exception &e, const char* context)
 {
   m_initialized = false;
index d6a5bfd..b5ba7a0 100644 (file)
@@ -398,7 +398,7 @@ void CAddonInstaller::PrunePackageCache()
 {
   std::map<CStdString,CFileItemList*> packs;
   int64_t size = EnumeratePackageFolder(packs);
-  int64_t limit = g_advancedSettings.m_addonPackageFolderSize*1024*1024;
+  int64_t limit = (int64_t)g_advancedSettings.m_addonPackageFolderSize*1024*1024;
   if (size < limit)
     return;
 
index 769f0a6..0371082 100644 (file)
@@ -36,6 +36,7 @@ public:
   virtual unsigned int GetSettings(ADDON_StructSetting*** sSet)=0;
   virtual void FreeSettings()=0;
   virtual ADDON_STATUS SetSetting(const char *settingName, const void *settingValue) =0;
+  virtual void Announce(const char *flag, const char *sender, const char *message, const void *data) =0;
 };
 
 template <typename TheStruct, typename Props>
@@ -52,6 +53,7 @@ public:
   DEFINE_METHOD0(void, FreeSettings)
   DEFINE_METHOD2(ADDON_STATUS, SetSetting, (const char *p1, const void *p2))
   DEFINE_METHOD1(void, GetAddon, (TheStruct* p1))
+  DEFINE_METHOD4(void, Announce, (const char *p1, const char *p2, const char *p3, const void *p4))
   BEGIN_METHOD_RESOLVE()
     RESOLVE_METHOD_RENAME(get_addon,GetAddon)
     RESOLVE_METHOD_RENAME(ADDON_Create, Create)
@@ -62,6 +64,7 @@ public:
     RESOLVE_METHOD_RENAME(ADDON_SetSetting, SetSetting)
     RESOLVE_METHOD_RENAME(ADDON_GetSettings, GetSettings)
     RESOLVE_METHOD_RENAME(ADDON_FreeSettings, FreeSettings)
+    RESOLVE_METHOD_RENAME(ADDON_Announce, Announce)
   END_METHOD_RESOLVE()
 };
 
index 84c5034..418dcbc 100644 (file)
@@ -63,7 +63,7 @@ void CAudioBuffer::Set(const float* psBuffer, int iSize)
   for (int i = iSize; i < m_iLen; ++i) m_pBuffer[i] = 0;
 }
 
-bool CVisualisation::Create(int x, int y, int w, int h)
+bool CVisualisation::Create(int x, int y, int w, int h, void *device)
 {
   m_pInfo = new VIS_PROPS;
   #ifdef HAS_DX
index 7e03d4e..ed4ac83 100644 (file)
@@ -23,6 +23,7 @@
 #include "AddonDll.h"
 #include "cores/IAudioCallback.h"
 #include "include/xbmc_vis_types.h"
+#include "guilib/IRenderingCallback.h"
 
 #include <map>
 #include <list>
@@ -52,13 +53,14 @@ namespace ADDON
 {
   class CVisualisation : public CAddonDll<DllVisualisation, Visualisation, VIS_PROPS>
                        , public IAudioCallback
+                       , public IRenderingCallback
   {
   public:
     CVisualisation(const ADDON::AddonProps &props) : CAddonDll<DllVisualisation, Visualisation, VIS_PROPS>(props) {}
     CVisualisation(const cp_extension_t *ext) : CAddonDll<DllVisualisation, Visualisation, VIS_PROPS>(ext) {}
     virtual void OnInitialize(int iChannels, int iSamplesPerSec, int iBitsPerSample);
     virtual void OnAudioData(const float* pAudioData, int iAudioDataLength);
-    bool Create(int x, int y, int w, int h);
+    bool Create(int x, int y, int w, int h, void *device);
     void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, const CStdString strSongName);
     void AudioData(const float *pAudioData, int iAudioDataLength, float *pFreqData, int iFreqDataLength);
     void Render();
index 67e17c4..9402623 100644 (file)
@@ -46,6 +46,7 @@ extern "C" {
   unsigned int __declspec(dllexport) ADDON_GetSettings(ADDON_StructSetting ***sSet);
   ADDON_STATUS __declspec(dllexport) ADDON_SetSetting(const char *settingName, const void *settingValue);
   void         __declspec(dllexport) ADDON_FreeSettings();
+  void         __declspec(dllexport) ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data);
 
 #ifdef __cplusplus
 };
index 06e4e17..a40022b 100644 (file)
@@ -51,6 +51,22 @@ extern "C"
   const char* GetMininumPVRAPIVersion(void);
 
   /*!
+   * Get the XBMC_GUI_API_VERSION that was used to compile this add-on.
+   * Used to check if this add-on is compatible with XBMC.
+   * @return The XBMC_GUI_API_VERSION that was used to compile this add-on.
+   * @remarks Valid implementation required.
+   */
+  const char* GetGUIAPIVersion(void);
+
+  /*!
+   * Get the XBMC_GUI_MIN_API_VERSION that was used to compile this add-on.
+   * Used to check if this add-on is compatible with XBMC.
+   * @return The XBMC_GUI_MIN_API_VERSION that was used to compile this add-on.
+   * @remarks Valid implementation required.
+   */
+  const char* GetMininumGUIAPIVersion(void);
+
+  /*!
    * Get the list of features that this add-on provides.
    * Called by XBMC to query the add-on's capabilities.
    * Used to check which options should be presented in the UI, which methods to call, etc.
@@ -284,6 +300,16 @@ extern "C"
   */
   int GetRecordingLastPlayedPosition(const PVR_RECORDING& recording);
 
+  /*!
+  * Retrieve the edit decision list (EDL) of a recording on the backend.
+  * @param recording The recording.
+  * @param edl out: The function has to write the EDL list into this array.
+  * @param size in: The maximum size of the EDL, out: the actual size of the EDL.
+  * @return PVR_ERROR_NO_ERROR if the EDL was successfully read.
+  * @remarks Required if bSupportsRecordingEdl is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function.
+  */
+  PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY edl[], int *size);
+
   //@}
   /** @name PVR timer methods
    *  @remarks Only used by XBMC is bSupportsTimers is set to true.
@@ -556,6 +582,8 @@ extern "C"
   {
     pClient->GetPVRAPIVersion               = GetPVRAPIVersion;
     pClient->GetMininumPVRAPIVersion        = GetMininumPVRAPIVersion;
+    pClient->GetGUIAPIVersion               = GetGUIAPIVersion;
+    pClient->GetMininumGUIAPIVersion        = GetMininumGUIAPIVersion;
     pClient->GetAddonCapabilities           = GetAddonCapabilities;
     pClient->GetStreamProperties            = GetStreamProperties;
     pClient->GetConnectionString            = GetConnectionString;
@@ -586,6 +614,7 @@ extern "C"
     pClient->SetRecordingPlayCount          = SetRecordingPlayCount;
     pClient->SetRecordingLastPlayedPosition = SetRecordingLastPlayedPosition;
     pClient->GetRecordingLastPlayedPosition = GetRecordingLastPlayedPosition;
+    pClient->GetRecordingEdl                = GetRecordingEdl;
 
     pClient->GetTimersAmount                = GetTimersAmount;
     pClient->GetTimers                      = GetTimers;
index f10d8ec..17182df 100644 (file)
@@ -33,6 +33,7 @@
 #endif
 #endif
 #include <string.h>
+#include <stdint.h>
 
 #include "xbmc_addon_types.h"
 #include "xbmc_epg_types.h"
@@ -67,15 +68,16 @@ struct DemuxPacket;
 #define PVR_ADDON_URL_STRING_LENGTH          1024
 #define PVR_ADDON_DESC_STRING_LENGTH         1024
 #define PVR_ADDON_INPUT_FORMAT_STRING_LENGTH 32
+#define PVR_ADDON_EDL_LENGTH                 32
 
 /* using the default avformat's MAX_STREAMS value to be safe */
 #define PVR_STREAM_MAX_STREAMS 20
 
 /* current PVR API version */
-#define XBMC_PVR_API_VERSION "1.6.0"
+#define XBMC_PVR_API_VERSION "1.7.0"
 
 /* min. PVR API version */
-#define XBMC_PVR_MIN_API_VERSION "1.6.0"
+#define XBMC_PVR_MIN_API_VERSION "1.7.0"
 
 #ifdef __cplusplus
 extern "C" {
@@ -154,6 +156,7 @@ extern "C" {
     bool bSupportsRecordingFolders;     /*!< @brief true if the backend supports timers / recordings in folders. */
     bool bSupportsRecordingPlayCount;   /*!< @brief true if the backend supports play count for recordings. */
     bool bSupportsLastPlayedPosition;   /*!< @brief true if the backend supports store/retrieve of last played position for recordings. */
+    bool bSupportsRecordingEdl;         /*!< @brief true if the backend supports retrieving an edit decision list for recordings. */
   } ATTRIBUTE_PACKED PVR_ADDON_CAPABILITIES;
 
   /*!
@@ -285,15 +288,36 @@ extern "C" {
     int    iGenreType;                                    /*!< @brief (optional) genre type */
     int    iGenreSubType;                                 /*!< @brief (optional) genre sub type */
     int    iPlayCount;                                    /*!< @brief (optional) play count of this recording on the client */
+    int    iLastPlayedPosition;                           /*!< @brief (optional) last played position of this recording on the client */
   } ATTRIBUTE_PACKED PVR_RECORDING;
 
   /*!
+   * @brief Edit definition list (EDL)
+   */
+  typedef enum
+  {
+    PVR_EDL_TYPE_CUT      = 0, /*!< @brief cut (completly remove content) */
+    PVR_EDL_TYPE_MUTE     = 1, /*!< @brief mute audio */
+    PVR_EDL_TYPE_SCENE    = 2, /*!< @brief scene markers (chapter seeking) */
+    PVR_EDL_TYPE_COMBREAK = 3  /*!< @brief commercial breaks */
+  } PVR_EDL_TYPE;
+
+  typedef struct PVR_EDL_ENTRY
+  {
+    int64_t start;     // ms
+    int64_t end;       // ms
+    PVR_EDL_TYPE type;
+  } ATTRIBUTE_PACKED PVR_EDL_ENTRY;
+
+  /*!
    * @brief Structure to transfer the methods from xbmc_pvr_dll.h to XBMC
    */
   typedef struct PVRClient
   {
     const char*  (__cdecl* GetPVRAPIVersion)(void);
     const char*  (__cdecl* GetMininumPVRAPIVersion)(void);
+    const char*  (__cdecl* GetGUIAPIVersion)(void);
+    const char*  (__cdecl* GetMininumGUIAPIVersion)(void);
     PVR_ERROR    (__cdecl* GetAddonCapabilities)(PVR_ADDON_CAPABILITIES*);
     PVR_ERROR    (__cdecl* GetStreamProperties)(PVR_STREAM_PROPERTIES*);
     const char*  (__cdecl* GetBackendName)(void);
@@ -320,6 +344,7 @@ extern "C" {
     PVR_ERROR    (__cdecl* SetRecordingPlayCount)(const PVR_RECORDING&, int);
     PVR_ERROR    (__cdecl* SetRecordingLastPlayedPosition)(const PVR_RECORDING&, int);
     int          (__cdecl* GetRecordingLastPlayedPosition)(const PVR_RECORDING&);
+    PVR_ERROR    (__cdecl* GetRecordingEdl)(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*);
     int          (__cdecl* GetTimersAmount)(void);
     PVR_ERROR    (__cdecl* GetTimers)(ADDON_HANDLE);
     PVR_ERROR    (__cdecl* AddTimer)(const PVR_TIMER&);
index 0da759a..f269fd0 100644 (file)
  */
 
 #include "AndroidFeatures.h"
-#include "XBMCApp.h"
 #include "utils/log.h"
 
 #include <cpu-features.h>
+#include "JNIThreading.h"
 
 bool CAndroidFeatures::HasNeon()
 {
@@ -39,8 +39,7 @@ int CAndroidFeatures::GetVersion()
   {
     version = 0;
 
-    JNIEnv *jenv = NULL;
-    CXBMCApp::AttachCurrentThread(&jenv, NULL);
+    JNIEnv *jenv = xbmc_jnienv();
 
     jclass jcOsBuild = jenv->FindClass("android/os/Build$VERSION");
     if (jcOsBuild == NULL) 
@@ -59,7 +58,6 @@ int CAndroidFeatures::GetVersion()
     version = iSdkVersion;
 
     jenv->DeleteLocalRef(jcOsBuild);
-    CXBMCApp::DetachCurrentThread();
   }
   return version;
 }
index 26e99b5..0dcdf8b 100644 (file)
@@ -63,28 +63,6 @@ void CEventLoop::run(IActivityHandler &activityHandler, IInputHandler &inputHand
   }
 }
 
-void CEventLoop::activate()
-{
-  if (m_enabled || m_application->window == NULL)
-    return;
-
-  m_enabled = true;
-  if (m_activityHandler->onActivate() != ActivityOK)
-  {
-    CXBMCApp::android_printf("CEventLoop: IActivityHandler::onActivate() failed");
-    ANativeActivity_finish(m_application->activity);
-  }
-}
-
-void CEventLoop::deactivate()
-{
-  if (!m_enabled)
-    return;
-
-  m_activityHandler->onDeactivate();
-  m_enabled = false;
-}
-
 void CEventLoop::processActivity(int32_t command)
 {
   switch (command)
@@ -109,17 +87,14 @@ void CEventLoop::processActivity(int32_t command)
     case APP_CMD_TERM_WINDOW:
       // The window is being hidden or closed, clean it up.
       m_activityHandler->onDestroyWindow();
-      deactivate();
       break;
 
     case APP_CMD_GAINED_FOCUS:
-      activate();
       m_activityHandler->onGainFocus();
       break;
 
     case APP_CMD_LOST_FOCUS:
       m_activityHandler->onLostFocus();
-      deactivate();
       break;
 
     case APP_CMD_LOW_MEMORY:
@@ -141,7 +116,6 @@ void CEventLoop::processActivity(int32_t command)
 
     case APP_CMD_PAUSE:
       m_activityHandler->onPause();
-      deactivate();
       break;
 
     case APP_CMD_STOP:
index c65846b..dbaab58 100644 (file)
@@ -35,8 +35,6 @@ typedef enum
 class IActivityHandler
 {
 public:
-  virtual ActivityResult onActivate() = 0;
-  virtual void onDeactivate() = 0;
 
   virtual void onStart() {}
   virtual void onResume() {}
diff --git a/xbmc/android/activity/Intents.cpp b/xbmc/android/activity/Intents.cpp
new file mode 100644 (file)
index 0000000..2e437df
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+#include "Intents.h"
+#include "utils/log.h"
+#include "XBMCApp.h"
+#include "JNIThreading.h"
+
+CAndroidIntents::CAndroidIntents()
+{
+}
+
+void CAndroidIntents::ReceiveIntent(JNIEnv *env, const jobject &intent)
+{
+  std::string action = GetIntentAction(intent);
+  CLog::Log(LOGDEBUG,"CAndroidIntents::ReceiveIntent: %s", action.c_str());
+}
+
+std::string CAndroidIntents::GetIntentAction(const jobject &intent)
+{
+  std::string action;
+  JNIEnv* env = xbmc_jnienv();
+
+ if (!intent)
+    return "";
+
+  jclass cIntent = env->GetObjectClass(intent);
+
+  //action = intent.getAction()
+  jmethodID mgetAction = env->GetMethodID(cIntent, "getAction", "()Ljava/lang/String;");
+  env->DeleteLocalRef(cIntent);
+  jstring sAction = (jstring)env->CallObjectMethod(intent, mgetAction);
+  const char *nativeString = env->GetStringUTFChars(sAction, 0);
+  action = std::string(nativeString);
+
+  env->ReleaseStringUTFChars(sAction, nativeString);
+  return action;
+}
diff --git a/xbmc/android/activity/Intents.h b/xbmc/android/activity/Intents.h
new file mode 100644 (file)
index 0000000..381c6eb
--- /dev/null
@@ -0,0 +1,35 @@
+#pragma once
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <string>
+#include <jni.h>
+
+class CAndroidIntents
+{
+public:
+  void ReceiveIntent(JNIEnv *env, const jobject &intent);
+  static CAndroidIntents& getInstance() {static CAndroidIntents temp; return temp;};
+
+private:
+  CAndroidIntents();
+  CAndroidIntents(CAndroidIntents const&);
+  void operator=(CAndroidIntents const&);
+  std::string GetIntentAction(const jobject &intent);
+};
diff --git a/xbmc/android/activity/JNI.cpp b/xbmc/android/activity/JNI.cpp
new file mode 100644 (file)
index 0000000..38079ea
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <string>
+#include <jni.h>
+#include "Intents.h"
+
+extern "C"{
+
+  static void jni_ReceiveIntent(JNIEnv *env, jobject thiz, jobject intent)
+  {
+     CAndroidIntents::getInstance().ReceiveIntent(env, intent);
+  }
+
+  static JNINativeMethod jniMethods[] =
+  {
+    {"ReceiveIntent", "(Landroid/content/Intent;)V", (void*)jni_ReceiveIntent}
+  };
+
+  // This is a special function called when libxbmc is loaded. It sets up our
+  // internal functions so that we can use them in native code much more simply.
+  // It loads a array of methods, params, and function-pointers.
+  jint JNI_OnLoad(JavaVM* vm, void* reserved)
+  {
+    JNIEnv* env;
+    if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
+        return -1;
+    }
+    jclass jniClass = env->FindClass("org/xbmc/xbmc/XBMCBroadcastReceiver");
+    env->RegisterNatives(jniClass, jniMethods, sizeof(jniMethods) / sizeof(jniMethods[0]));
+
+    return JNI_VERSION_1_6;
+  }
+}
diff --git a/xbmc/android/activity/JNIThreading.cpp b/xbmc/android/activity/JNIThreading.cpp
new file mode 100644 (file)
index 0000000..ea7c708
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *      Some code borrowed from Dmitry Moskalchuk.
+ *
+ * Copyright (c) 2011-2012 Dmitry Moskalchuk <dm@crystax.net>.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ * 
+ *    1. Redistributions of source code must retain the above copyright notice, this list of
+ *       conditions and the following disclaimer.
+ * 
+ *    2. Redistributions in binary form must reproduce the above copyright notice, this list
+ *       of conditions and the following disclaimer in the documentation and/or other materials
+ *       provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY Dmitry Moskalchuk ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Dmitry Moskalchuk OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of Dmitry Moskalchuk.
+ */
+/*
+  This code is mostly borrowed from libcrystax. The functions and namespaces
+  were renamed to avoid collisions when linking against the originals.
+*/
+
+#include <jni.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <android/log.h>
+namespace xbmcjni
+{
+
+static JavaVM *s_jvm = NULL;
+static pthread_key_t s_jnienv_key;
+static pthread_once_t s_jnienv_key_once = PTHREAD_ONCE_INIT;
+
+JavaVM *jvm()
+{
+    return s_jvm;
+}
+
+static void jnienv_detach_thread(void *arg)
+{
+  if (!jvm())
+    return;
+  __android_log_print(ANDROID_LOG_VERBOSE, "XBMC","detaching thread");
+  jvm()->DetachCurrentThread();
+}
+
+static void jnienv_key_create()
+{
+    if (::pthread_key_create(&s_jnienv_key, &jnienv_detach_thread) != 0)
+        ::abort();
+}
+
+static bool save_jnienv(JNIEnv *env)
+{
+
+    ::pthread_once(&s_jnienv_key_once, &jnienv_key_create);
+
+    if (::pthread_setspecific(s_jnienv_key, env) != 0)
+        return false;
+    return true;
+}
+
+JNIEnv *jnienv()
+{
+    ::pthread_once(&s_jnienv_key_once, &jnienv_key_create);
+
+    JNIEnv *env = reinterpret_cast<JNIEnv *>(::pthread_getspecific(s_jnienv_key));
+    if (!env && jvm())
+    {
+        jvm()->AttachCurrentThread(&env, NULL);
+        if (!save_jnienv(env))
+            ::abort();
+    }
+    return env;
+}
+
+} // namespace xbmcjni
+
+JavaVM *xbmc_jvm()
+{
+    return ::xbmcjni::jvm();
+}
+
+JNIEnv *xbmc_jnienv()
+{
+    return ::xbmcjni::jnienv();
+}
+
+void xbmc_save_jnienv(JNIEnv *env)
+{
+    ::xbmcjni::save_jnienv(env);
+}
+
+jint xbmc_jni_on_load(JavaVM *vm, JNIEnv *env)
+{
+    jint jversion = JNI_VERSION_1_4;
+
+    if (!env)
+        return -1;
+
+    ::xbmcjni::s_jvm = vm;
+
+    // The main thread hands us an env. Attach and store it.
+    ::xbmcjni::jvm()->AttachCurrentThread(&env, NULL);
+    if (!::xbmcjni::save_jnienv(env))
+        return -1;
+
+    return jversion;
+}
+
+void xbmc_jni_on_unload()
+{
+  ::xbmcjni::jnienv_detach_thread(NULL);
+  ::xbmcjni::s_jvm = NULL;
+}
diff --git a/xbmc/android/activity/JNIThreading.h b/xbmc/android/activity/JNIThreading.h
new file mode 100644 (file)
index 0000000..e832679
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *      Some code borrowed from Dmitry Moskalchuk.
+ *
+ * Copyright (c) 2011-2012 Dmitry Moskalchuk <dm@crystax.net>.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ * 
+ *    1. Redistributions of source code must retain the above copyright notice, this list of
+ *       conditions and the following disclaimer.
+ * 
+ *    2. Redistributions in binary form must reproduce the above copyright notice, this list
+ *       of conditions and the following disclaimer in the documentation and/or other materials
+ *       provided with the distribution.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY Dmitry Moskalchuk ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Dmitry Moskalchuk OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of Dmitry Moskalchuk.
+ */
+
+#pragma once
+#include <jni.h>
+
+int xbmc_jni_on_load(JavaVM *vm, JNIEnv *env);
+void xbmc_jni_on_unload();
+
+/*
+ * Return pointer to application's Java VM.
+ * Return NULL if there is no JVM (standalone executable)
+ */
+JavaVM *xbmc_jvm();
+
+/*
+ * Return thread-specific JNIEnv pointer.
+ * Return NULL if there is no JVM (standalone executable)
+ */
+JNIEnv *xbmc_jnienv();
+
+/*
+ * Save specified JNIEnv to thread-specific storage.
+ * This value will then be returned on subsequent calls
+ * of crystax_jnienv()
+ */
+void xbmc_save_jnienv(JNIEnv *env);
index df82dcc..0282144 100644 (file)
@@ -16,6 +16,9 @@ SRCS      += AndroidMouse.cpp
 SRCS      += GraphicBuffer.cpp
 SRCS      += EventLoop.cpp
 SRCS      += XBMCApp.cpp
+SRCS      += JNI.cpp
+SRCS      += Intents.cpp
+SRCS      += JNIThreading.cpp
 
 OBJS      += $(APP_GLUE) $(CPU_OBJ)
 
index dd1fda7..c404619 100644 (file)
@@ -44,6 +44,7 @@
 #include "guilib/GUIWindowManager.h"
 #include "utils/log.h"
 #include "ApplicationMessenger.h"
+#include "JNIThreading.h"
 
 #define GIGABYTES       1073741824
 
@@ -63,178 +64,135 @@ CXBMCApp::CXBMCApp(ANativeActivity *nativeActivity)
   : m_wakeLock(NULL)
 {
   m_activity = nativeActivity;
-  
+  m_firstrun = true;
+  m_exiting=false;
   if (m_activity == NULL)
   {
     android_printf("CXBMCApp: invalid ANativeActivity instance");
     exit(1);
     return;
   }
-
-  m_state.appState = Uninitialized;
-
-  if (pthread_mutex_init(&m_state.mutex, NULL) != 0)
-  {
-    android_printf("CXBMCApp: pthread_mutex_init() failed");
-    m_state.appState = Error;
-    exit(1);
-    return;
-  }
-
 }
 
 CXBMCApp::~CXBMCApp()
 {
-  stop();
-
-  pthread_mutex_destroy(&m_state.mutex);
 }
 
-ActivityResult CXBMCApp::onActivate()
+void CXBMCApp::onStart()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-
-  switch (m_state.appState)
+  android_printf("%s: ", __PRETTY_FUNCTION__);
+  if (!m_firstrun)
   {
-    case Uninitialized:
-      acquireWakeLock();
-      
-      pthread_attr_t attr;
-      pthread_attr_init(&attr);
-      pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
-      pthread_create(&m_state.thread, &attr, thread_run<CXBMCApp, &CXBMCApp::run>, this);
-      pthread_attr_destroy(&attr);
-      break;
-      
-    case Unfocused:
-      XBMC_Pause(false);
-      setAppState(Rendering);
-      break;
-      
-    case Paused:
-      acquireWakeLock();
-      
-      XBMC_SetupDisplay();
-      XBMC_Pause(false);
-      setAppState(Rendering);
-      break;
-
-    case Initialized:
-    case Rendering:
-    case Stopping:
-    case Stopped:
-    case Error:
-    default:
-      break;
+    android_printf("%s: Already running, ignoring request to start", __PRETTY_FUNCTION__);
+    return;
   }
-  return ActivityOK;
-}
-
-void CXBMCApp::onDeactivate()
-{
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  // this is called on pause, stop and window destroy which
-  // require specific (and different) actions
-}
-
-void CXBMCApp::onStart()
-{
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  // wait for onCreateWindow() and onGainFocus()
+  pthread_attr_t attr;
+  pthread_attr_init(&attr);
+  pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+  pthread_create(&m_thread, &attr, thread_run<CXBMCApp, &CXBMCApp::run>, this);
+  pthread_attr_destroy(&attr);
 }
 
 void CXBMCApp::onResume()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  // wait for onCreateWindow() and onGainFocus()
+  android_printf("%s: ", __PRETTY_FUNCTION__);
 }
 
 void CXBMCApp::onPause()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  // wait for onDestroyWindow() and/or onLostFocus()
+  android_printf("%s: ", __PRETTY_FUNCTION__);
 }
 
 void CXBMCApp::onStop()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  // everything has been handled in onLostFocus() so wait
-  // if onDestroy() is called
+  android_printf("%s: ", __PRETTY_FUNCTION__);
 }
 
 void CXBMCApp::onDestroy()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  stop();
+  android_printf("%s", __PRETTY_FUNCTION__);
+
+  // If android is forcing us to stop, ask XBMC to exit then wait until it's
+  // been destroyed.
+  if (!m_exiting)
+  {
+    XBMC_Stop();
+    pthread_join(m_thread, NULL);
+    android_printf(" => XBMC finished");
+  }
+
+  if (m_wakeLock != NULL && m_activity != NULL)
+  {
+    JNIEnv* env = xbmc_jnienv();
+    env->DeleteGlobalRef(m_wakeLock);
+    m_wakeLock = NULL;
+  }
 }
 
 void CXBMCApp::onSaveState(void **data, size_t *size)
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
+  android_printf("%s: ", __PRETTY_FUNCTION__);
   // no need to save anything as XBMC is running in its own thread
 }
 
 void CXBMCApp::onConfigurationChanged()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
+  android_printf("%s: ", __PRETTY_FUNCTION__);
   // ignore any configuration changes like screen rotation etc
 }
 
 void CXBMCApp::onLowMemory()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
+  android_printf("%s: ", __PRETTY_FUNCTION__);
   // can't do much as we don't want to close completely
 }
 
 void CXBMCApp::onCreateWindow(ANativeWindow* window)
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
+  android_printf("%s: ", __PRETTY_FUNCTION__);
   if (window == NULL)
   {
     android_printf(" => invalid ANativeWindow object");
     return;
   }
   m_window = window;
+  acquireWakeLock();
+  if(!m_firstrun)
+  {
+    XBMC_SetupDisplay();
+    XBMC_Pause(false);
+  }
 }
 
 void CXBMCApp::onResizeWindow()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
+  android_printf("%s: ", __PRETTY_FUNCTION__);
   // no need to do anything because we are fixed in fullscreen landscape mode
 }
 
 void CXBMCApp::onDestroyWindow()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
+  android_printf("%s: ", __PRETTY_FUNCTION__);
 
-  if (m_state.appState < Paused)
+  // If we have exited XBMC, it no longer exists.
+  if (!m_exiting)
   {
     XBMC_DestroyDisplay();
-    setAppState(Paused);
-    releaseWakeLock();
+    XBMC_Pause(true);
   }
+
+  releaseWakeLock();
+  m_window=NULL;
 }
 
 void CXBMCApp::onGainFocus()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  // everything is handled in onActivate()
+  android_printf("%s: ", __PRETTY_FUNCTION__);
 }
 
 void CXBMCApp::onLostFocus()
 {
-  android_printf("%s: %d", __PRETTY_FUNCTION__, m_state.appState);
-  switch (m_state.appState)
-  {
-    case Initialized:
-    case Rendering:
-      XBMC_Pause(true);
-      setAppState(Unfocused);
-      break;
-
-    default:
-      break;
-  }
+  android_printf("%s: ", __PRETTY_FUNCTION__);
 }
 
 bool CXBMCApp::getWakeLock(JNIEnv *env)
@@ -281,8 +239,7 @@ void CXBMCApp::acquireWakeLock()
   if (m_activity == NULL)
     return;
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
 
   if (!getWakeLock(env))
   {
@@ -294,8 +251,6 @@ void CXBMCApp::acquireWakeLock()
   jmethodID midWakeLockAcquire = env->GetMethodID(cWakeLock, "acquire", "()V");
   env->CallVoidMethod(m_wakeLock, midWakeLockAcquire);
   env->DeleteLocalRef(cWakeLock);
-
-  DetachCurrentThread();
 }
 
 void CXBMCApp::releaseWakeLock()
@@ -303,9 +258,7 @@ void CXBMCApp::releaseWakeLock()
   if (m_activity == NULL)
     return;
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
-
+  JNIEnv* env = xbmc_jnienv();
   if (!getWakeLock(env))
   {
     android_printf("%s: unable to release a WakeLock");
@@ -316,75 +269,35 @@ void CXBMCApp::releaseWakeLock()
   jmethodID midWakeLockRelease = env->GetMethodID(cWakeLock, "release", "()V");
   env->CallVoidMethod(m_wakeLock, midWakeLockRelease);
   env->DeleteLocalRef(cWakeLock);
-
-  DetachCurrentThread();
 }
 
 void CXBMCApp::run()
 {
-    int status = 0;
-    setAppState(Initialized);
-
-    android_printf(" => running XBMC_Run...");
-    try
-    {
-      setAppState(Rendering);
-      status = XBMC_Run(true);
-      android_printf(" => XBMC_Run finished with %d", status);
-    }
-    catch(...)
-    {
-      android_printf("ERROR: Exception caught on main loop. Exiting");
-      setAppState(Error);
-    }
-
-  bool finishActivity = false;
-  pthread_mutex_lock(&m_state.mutex);
-  finishActivity = m_state.appState != Stopping;
-  m_state.appState = Stopped;
-  pthread_mutex_unlock(&m_state.mutex);
-  
-  if (finishActivity)
+  int status = 0;
+
+  android_printf(" => waiting for a window");
+  // Hack!
+  // TODO: Change EGL startup so that we can start headless, then create the
+  // window once android gives us a surface to play with.
+  while(!m_window)
+    usleep(1000);
+  m_firstrun=false;
+  android_printf(" => running XBMC_Run...");
+  try
   {
-    android_printf(" => calling ANativeActivity_finish()");
-    ANativeActivity_finish(m_activity);
+    status = XBMC_Run(true);
+    android_printf(" => XBMC_Run finished with %d", status);
   }
-}
-
-void CXBMCApp::stop()
-{
-  android_printf("%s", __PRETTY_FUNCTION__);
-
-  pthread_mutex_lock(&m_state.mutex);
-  if (m_state.appState < Stopped)
-  {
-    m_state.appState = Stopping;
-    pthread_mutex_unlock(&m_state.mutex);
-    
-    android_printf(" => executing XBMC_Stop");
-    XBMC_Stop();
-    android_printf(" => waiting for XBMC to finish");
-    pthread_join(m_state.thread, NULL);
-    android_printf(" => XBMC finished");
-  }
-  else
-    pthread_mutex_unlock(&m_state.mutex);
-  
-  if (m_wakeLock != NULL && m_activity != NULL)
+  catch(...)
   {
-    JNIEnv *env = NULL;
-    m_activity->vm->AttachCurrentThread(&env, NULL);
-    
-    env->DeleteGlobalRef(m_wakeLock);
-    m_wakeLock = NULL;
+    android_printf("ERROR: Exception caught on main loop. Exiting");
   }
-}
 
-void CXBMCApp::setAppState(AppState state)
-{
-  pthread_mutex_lock(&m_state.mutex);
-  m_state.appState = state;
-  pthread_mutex_unlock(&m_state.mutex);
+  // If we are have not been force by Android to exit, notify its finish routine.
+  // This will cause android to run through its teardown events, it calls:
+  // onPause(), onLostFocus(), onDestroyWindow(), onStop(), onDestroy().
+  ANativeActivity_finish(m_activity);
+  m_exiting=true;
 }
 
 void CXBMCApp::XBMC_Pause(bool pause)
@@ -414,24 +327,6 @@ bool CXBMCApp::XBMC_DestroyDisplay()
   return CApplicationMessenger::Get().DestroyDisplay();
 }
 
-int CXBMCApp::AttachCurrentThread(JNIEnv** p_env, void* thr_args /* = NULL */)
-{
-  // Until a thread is attached, it has no JNIEnv, and cannot make JNI calls.
-  // The JNIEnv is used for thread-local storage. For this reason,
-  //  you cannot share a JNIEnv between threads.
-  // If a thread is attached to JNIEnv and garbage collection is in progress,
-  //  or the debugger has issued a suspend request, Android will
-  //  pause the thread the next time it makes a JNI call.
-  return m_activity->vm->AttachCurrentThread(p_env, thr_args);
-}
-
-int CXBMCApp::DetachCurrentThread()
-{
-  // Threads attached through JNIEnv must
-  // call DetachCurrentThread before they exit
-  return m_activity->vm->DetachCurrentThread();
-}
-
 int CXBMCApp::SetBuffersGeometry(int width, int height, int format)
 {
   return ANativeWindow_setBuffersGeometry(m_window, width, height, format);
@@ -467,8 +362,7 @@ bool CXBMCApp::ListApplications(vector<androidPackage> *applications)
   if (!m_activity)
     return false;
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
   jobject oActivity = m_activity->clazz;
   jclass cActivity = env->GetObjectClass(oActivity);
 
@@ -531,7 +425,6 @@ bool CXBMCApp::ListApplications(vector<androidPackage> *applications)
     applications->push_back(desc);
   }
   env->DeleteLocalRef(oPackageManager);
-  DetachCurrentThread();
   return true;
 }
 
@@ -541,8 +434,7 @@ bool CXBMCApp::GetIconSize(const string &packageName, int *width, int *height)
     return false;
 
   jthrowable exc;
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
 
   jobject oActivity = m_activity->clazz;
   jclass cActivity = env->GetObjectClass(oActivity);
@@ -578,7 +470,6 @@ bool CXBMCApp::GetIconSize(const string &packageName, int *width, int *height)
     env->ExceptionDescribe();
     env->ExceptionClear();
     env->DeleteLocalRef(oBitmap);
-    DetachCurrentThread();
     return false;
   } 
   jclass cBitmap = env->GetObjectClass(oBitmap);
@@ -596,7 +487,6 @@ bool CXBMCApp::GetIconSize(const string &packageName, int *width, int *height)
     env->ExceptionDescribe();
     env->ExceptionClear();
     env->DeleteLocalRef(oBitmap);
-    DetachCurrentThread();
     return false;
   }
   // height = oBitmap.getHeight;
@@ -609,11 +499,8 @@ bool CXBMCApp::GetIconSize(const string &packageName, int *width, int *height)
     CLog::Log(LOGERROR, "CXBMCApp::GetIconSize Error getting icon height for %s. Exception follows:", packageName.c_str());
     env->ExceptionDescribe();
     env->ExceptionClear();
-    DetachCurrentThread();
     return false;
   }
-
-  DetachCurrentThread();
   return true;
 }
 
@@ -623,8 +510,7 @@ bool CXBMCApp::GetIcon(const string &packageName, void* buffer, unsigned int buf
     return false;
 
   jthrowable exc;
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
 
   CLog::Log(LOGERROR, "CXBMCApp::GetIconSize Looking for: %s", packageName.c_str());
 
@@ -659,7 +545,6 @@ bool CXBMCApp::GetIcon(const string &packageName, void* buffer, unsigned int buf
     CLog::Log(LOGERROR, "CXBMCApp::GetIcon Error getting icon for  %s. Exception follows:", packageName.c_str());
     env->ExceptionDescribe();
     env->ExceptionClear();
-    DetachCurrentThread();
     return false;
   }
   jobject oBitmap = env->CallObjectMethod(oBitmapDrawable, mgetBitmap);
@@ -679,10 +564,8 @@ bool CXBMCApp::GetIcon(const string &packageName, void* buffer, unsigned int buf
     CLog::Log(LOGERROR, "CXBMCApp::GetIcon Error copying icon for  %s. Exception follows:", packageName.c_str());
     env->ExceptionDescribe();
     env->ExceptionClear();
-    DetachCurrentThread();
     return false;
   }
-  DetachCurrentThread();
   return true;
 }
 
@@ -692,8 +575,7 @@ bool CXBMCApp::HasLaunchIntent(const string &package)
   if (!m_activity)
     return false;
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
 
   jthrowable exc;
   jobject oActivity = m_activity->clazz;
@@ -738,9 +620,8 @@ bool CXBMCApp::StartActivity(const string &package, const string &intent, const
   CLog::Log(LOGDEBUG, "CXBMCApp::StartActivity package: '%s' intent: '%s' dataType: '%s' dataURI: '%s'", package.c_str(), intent.c_str(), dataType.c_str(), dataURI.c_str());
 
   jthrowable exc;
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
-  
+  JNIEnv* env = xbmc_jnienv();
+
   jobject oActivity = m_activity->clazz;
   jclass cActivity = env->GetObjectClass(oActivity);
 
@@ -779,14 +660,12 @@ bool CXBMCApp::StartActivity(const string &package, const string &intent, const
       env->ExceptionDescribe();
       env->ExceptionClear();
       env->DeleteLocalRef(cActivity);
-      DetachCurrentThread();
       return false;
     }
     if (!oIntent)
     {
       CLog::Log(LOGERROR, "CXBMCApp::StartActivity %s has no Launch Intent", package.c_str());
       env->DeleteLocalRef(cActivity);
-      DetachCurrentThread();
       return false;
     }
   }
@@ -849,11 +728,8 @@ bool CXBMCApp::StartActivity(const string &package, const string &intent, const
     CLog::Log(LOGERROR, "CXBMCApp::StartActivity Failed to load %s. Exception follows:", package.c_str());
     env->ExceptionDescribe();
     env->ExceptionClear();
-    DetachCurrentThread();
     return false;
   }
-
-  DetachCurrentThread();
   return true;
 }
 
@@ -862,8 +738,8 @@ int CXBMCApp::GetBatteryLevel()
   if (m_activity == NULL)
     return -1;
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
+
   jobject oActivity = m_activity->clazz;
 
   // IntentFilter oIntentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
@@ -895,8 +771,6 @@ int CXBMCApp::GetBatteryLevel()
   env->DeleteLocalRef(oBatteryStatus);
   env->DeleteLocalRef(oIntentFilter);
 
-  DetachCurrentThread();
-
   if (iLevel <= 0 || iScale < 0)
     return iLevel;
 
@@ -908,8 +782,7 @@ bool CXBMCApp::GetExternalStorage(std::string &path, const std::string &type /*
   if (m_activity == NULL)
     return false;
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
 
   // check if external storage is available
   // String sStorageState = android.os.Environment.getExternalStorageState();
@@ -970,8 +843,6 @@ bool CXBMCApp::GetExternalStorage(std::string &path, const std::string &type /*
 
   env->DeleteLocalRef(cEnvironment);
 
-  DetachCurrentThread();
-
   return mounted && !path.empty();
 }
 
@@ -993,8 +864,7 @@ bool CXBMCApp::GetStorageUsage(const std::string &path, std::string &usage)
     return false;
   }
 
-  JNIEnv *env = NULL;
-  AttachCurrentThread(&env);
+  JNIEnv* env = xbmc_jnienv();
 
   // android.os.StatFs oStats = new android.os.StatFs(sPath);
   jclass cStatFs = env->FindClass("android/os/StatFs");
@@ -1018,8 +888,6 @@ bool CXBMCApp::GetStorageUsage(const std::string &path, std::string &usage)
   env->DeleteLocalRef(oStats);
   env->DeleteLocalRef(cStatFs);
 
-  DetachCurrentThread();
-
   if (iBlockSize <= 0 || iBlocksTotal <= 0 || iBlocksFree < 0)
     return false;
   
@@ -1048,10 +916,8 @@ int CXBMCApp::GetMaxSystemVolume()
   static int maxVolume = -1;
   if (maxVolume == -1)
   {
-    JNIEnv *env = NULL;
-    AttachCurrentThread(&env);
+    JNIEnv* env = xbmc_jnienv();
     maxVolume = GetMaxSystemVolume(env);
-    DetachCurrentThread();
   }
   return maxVolume;
 }
index 5a56152..7d9f0dd 100644 (file)
@@ -58,9 +58,6 @@ public:
 
   bool isValid() { return m_activity != NULL; }
 
-  ActivityResult onActivate();
-  void onDeactivate();
-
   void onStart();
   void onResume();
   void onPause();
@@ -100,13 +97,8 @@ public:
 
   static int GetDPI();
 protected:
-  // limit who can access AttachCurrentThread/DetachCurrentThread
+  // limit who can access Volume
   friend class CAESinkAUDIOTRACK;
-  friend class CAndroidFeatures;
-  friend class CFileAndroidApp;
-
-  static int AttachCurrentThread(JNIEnv** p_env, void* thr_args = NULL);
-  static int DetachCurrentThread();
 
   static int GetMaxSystemVolume(JNIEnv *env);
   static void SetSystemVolume(JNIEnv *env, float percent);
@@ -121,37 +113,11 @@ private:
 
   static ANativeActivity *m_activity;
   jobject m_wakeLock;
-  typedef enum {
-    // XBMC_Initialize hasn't been executed yet
-    Uninitialized,
-    // XBMC_Initialize has been successfully executed
-    Initialized,
-    // XBMC is currently rendering
-    Rendering,
-    // XBMC has stopped rendering because it has lost focus
-    // but it still has an EGLContext
-    Unfocused,
-    // XBMC has been paused/stopped and does not have an
-    // EGLContext
-    Paused,
-    // XBMC is being stopped
-    Stopping,
-    // XBMC has stopped
-    Stopped,
-    // An error has occured
-    Error
-  } AppState;
-
-  typedef struct {
-    pthread_t thread;
-    pthread_mutex_t mutex;
-    AppState appState;
-  } State;
-
-  State m_state;
   
-  void setAppState(AppState state);
-    
+  bool m_firstrun;
+  bool m_exiting;
+  pthread_t m_thread;
+  
   static ANativeWindow* m_window;
   
   void XBMC_Pause(bool pause);
index 2856e04..e107319 100644 (file)
 
 #include <android_native_app_glue.h>
 #include <jni.h>
+#include "JNIThreading.h"
 
 #include "EventLoop.h"
 #include "XBMCApp.h"
-
+#include <android/log.h>
 void setup_env(struct android_app* state)
 {
-  JavaVM* vm  = state->activity->vm;
-  JNIEnv* env = state->activity->env;
+  JNIEnv* env = xbmc_jnienv();
+  if (!env)
+  {
+    __android_log_print(ANDROID_LOG_VERBOSE, "XBMC","android_main: env is invalid");
+    exit(1);
+  }
   const char* temp;
 
-  vm->AttachCurrentThread(&env, NULL);
   jobject oActivity = state->activity->clazz;
   jclass cActivity = env->GetObjectClass(oActivity);
 
@@ -149,15 +153,14 @@ void setup_env(struct android_app* state)
     setenv("HOME", storagePath, 0);
   else
     setenv("HOME", getenv("XBMC_TEMP"), 0);
-
-  state->activity->vm->DetachCurrentThread();
 }
 
 extern void android_main(struct android_app* state)
 {
   // make sure that the linker doesn't strip out our glue
   app_dummy();
-
+  int val = xbmc_jni_on_load(state->activity->vm, state->activity->env);
+  __android_log_print(ANDROID_LOG_VERBOSE, "XBMC","xbmc_jni_on_load returned %i\n",val);
   setup_env(state);
   CEventLoop eventLoop(state);
   CXBMCApp xbmcApp(state->activity);
@@ -175,5 +178,6 @@ extern void android_main(struct android_app* state)
   // those loaded libs in the state they were in when we quit XBMC last time
   // which will lead to crashes because of global/static classes that haven't
   // been properly uninitialized
+  xbmc_jni_on_unload();
   exit(0);
 }
index 2278317..02f7b48 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <AudioToolbox/AudioToolbox.h>
 
-UInt32 CCoreAudioMixMap::m_deviceChannels = 0;
-
 CCoreAudioMixMap::CCoreAudioMixMap() :
   m_isValid(false)
 {
@@ -162,8 +160,6 @@ CCoreAudioMixMap *CCoreAudioMixMap::CreateMixMap(CAUOutputDevice  *audioUnit, AE
   CCoreAudioChannelLayout deviceLayout;
   if (!audioUnit->GetPreferredChannelLayout(deviceLayout))
     return NULL;
-    
-  m_deviceChannels = CCoreAudioChannelLayout::GetChannelCountForLayout(*deviceLayout);
 
   // When all channels on the output device are unknown take the gui layout
   //if(deviceLayout.AllChannelUnknown())
@@ -209,16 +205,48 @@ bool CCoreAudioMixMap::SetMixingMatrix(CAUMatrixMixer *mixerUnit,
   if (!mixerUnit || !inputFormat || !fmt)
     return false;
 
+  // Fetch the mixing unit size
+  UInt32 dims[2];
+  UInt32 size = sizeof(dims);
+  AudioUnitGetProperty(mixerUnit->GetUnit(),
+    kAudioUnitProperty_MatrixDimensions, kAudioUnitScope_Global, 0, dims, &size);
+
+  if(inputFormat->mChannelsPerFrame + channelOffset > dims[0])
+  {
+    CLog::Log(LOGERROR, "CCoreAudioMixMap::SetMixingMatrix - input format doesn't fit mixer size %u+%u > %u"
+                      , inputFormat->mChannelsPerFrame, channelOffset, dims[0]);
+    return false;
+  }
+
+  if(fmt->mChannelsPerFrame > dims[1])
+  {
+    CLog::Log(LOGERROR, "CCoreAudioMixMap::SetMixingMatrix - ouput format doesn't fit mixer size %u > %u"
+              , fmt->mChannelsPerFrame, dims[0]);
+    return false;
+  }
+
+  if(fmt->mChannelsPerFrame < dims[1])
+  {
+    CLog::Log(LOGWARNING, "CCoreAudioMixMap::SetMixingMatrix - ouput format doesn't specify all outputs %u < %u"
+              , fmt->mChannelsPerFrame, dims[0]);
+  }
+
   // Configure the mixing matrix
   Float32* val = (Float32*)*mixMap;
   for (UInt32 i = 0; i < inputFormat->mChannelsPerFrame; ++i)
   {
-    val = (Float32*)*mixMap + i*m_deviceChannels;
-    for (UInt32 j = 0; j < fmt->mChannelsPerFrame; ++j)
+    UInt32 j = 0;
+    for (; j < fmt->mChannelsPerFrame; ++j)
     {
       AudioUnitSetParameter(mixerUnit->GetUnit(),
         kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, *val++, 0);
     }
+    // zero out additional outputs from this input
+    for (; j < dims[1]; ++j)
+    {
+      AudioUnitSetParameter(mixerUnit->GetUnit(),
+        kMatrixMixerParam_Volume, kAudioUnitScope_Global, ( (i + channelOffset) << 16 ) | j, 0.0f, 0);
+    }
   }
 
   CLog::Log(LOGDEBUG, "CCoreAudioGraph::Open: "
index b612277..7965752 100644 (file)
@@ -52,7 +52,6 @@ private:
   Float32         *m_pMap;
   UInt32          m_inChannels;
   UInt32          m_outChannels;
-  static UInt32   m_deviceChannels;
   bool            m_isValid;
 };
 
index cfb7be5..6ec78c5 100644 (file)
@@ -728,7 +728,6 @@ void CSoftAE::PauseStream(CSoftAEStream *stream)
   CSingleLock streamLock(m_streamLock);
   RemoveStream(m_playingStreams, stream);
   stream->m_paused = true;
-  streamLock.Leave();
 
   m_reOpen = true;
   m_wake.Set();
@@ -874,7 +873,10 @@ IAEStream *CSoftAE::FreeStream(IAEStream *stream)
   RemoveStream(m_streams       , (CSoftAEStream*)stream);
   // Reopen is old behaviour. Not opening when masterstream stops means clipping on S/PDIF.
   if(!m_isSuspended && (m_masterStream == stream))
+  {
     m_reOpen = true;
+    m_masterStream = NULL;
+  }
 
   delete (CSoftAEStream*)stream;
   return NULL;
@@ -1058,11 +1060,11 @@ void CSoftAE::Run()
     bool restart = false;
 
     /* with the new non blocking implementation - we just reOpen here, when it tells reOpen */
-    if (!m_reOpen && (this->*m_outputStageFn)(hasAudio) > 0)
+    if ((this->*m_outputStageFn)(hasAudio) > 0)
       hasAudio = false; /* taken some audio - reset our silence flag */
 
     /* if we have enough room in the buffer */
-    if (!m_reOpen && m_buffer.Free() >= m_frameSize)
+    if (m_buffer.Free() >= m_frameSize)
     {
       /* take some data for our use from the buffer */
       uint8_t *out = (uint8_t*)m_buffer.Take(m_frameSize);
index 258dcac..a64beb1 100644 (file)
@@ -196,6 +196,13 @@ void CSoftAEStream::Initialize()
     m_ssrcData.data_out      = (float*)_aligned_malloc(m_format.m_frameSamples * (int)std::ceil(m_ssrcData.src_ratio) * sizeof(float), 16);
     m_ssrcData.output_frames = m_format.m_frames * (long)std::ceil(m_ssrcData.src_ratio);
     m_ssrcData.end_of_input  = 0;
+    // we must buffer the same amount as before but taking the source sample rate into account
+    // there is no reason to decrease the buffer for upsampling
+    if (m_internalRatio < 1)
+    {
+      m_waterLevel *= (1.0 / m_internalRatio);
+      m_refillBuffer = m_waterLevel;
+    }
   }
 
   m_limiter.SetSamplerate(AE.GetSampleRate());
index fe40d17..821bd2e 100644 (file)
@@ -38,7 +38,6 @@
 #endif
 
 #define ALSA_OPTIONS (SND_PCM_NONBLOCK | SND_PCM_NO_AUTO_FORMAT | SND_PCM_NO_AUTO_CHANNELS | SND_PCM_NO_AUTO_RESAMPLE)
-#define ALSA_PERIODS 16
 
 #define ALSA_MAX_CHANNELS 16
 static enum AEChannel ALSAChannelMap[ALSA_MAX_CHANNELS + 1] = {
@@ -328,59 +327,80 @@ bool CAESinkALSA::InitializeHW(AEAudioFormat &format)
     }
   }
 
-  unsigned int periods;
-
   snd_pcm_uframes_t periodSize, bufferSize;
   snd_pcm_hw_params_get_buffer_size_max(hw_params, &bufferSize);
+  snd_pcm_hw_params_get_period_size_max(hw_params, &periodSize, NULL);
+
+  /* 
+   We want to make sure, that we have approx 500 to 800 ms Buffer with 
+   a periodSize of approx 100 ms.
+   It is calced:
+   periodSize = sampleRate / 10 
+   buffersize = periodSize * 1 frame * 8.
+  */
+  periodSize  = std::min(periodSize, (snd_pcm_uframes_t) sampleRate / 10);
+  bufferSize  = std::min(bufferSize, (snd_pcm_uframes_t) periodSize * 8);
+  
+  /* 
+     According to upstream we should set buffer size first - so make sure it is always at least
+     double of period size to not get underruns
+  */
+  periodSize = std::min(periodSize, bufferSize / 2);
 
-  bufferSize  = std::min(bufferSize, (snd_pcm_uframes_t)8192);
-  periodSize  = bufferSize / ALSA_PERIODS;
-  periods     = ALSA_PERIODS;
-
-  CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, periods %u, bufferSize %lu", periodSize, periods, bufferSize);
+  CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Request: periodSize %lu, bufferSize %lu", periodSize, bufferSize);
 
-  /* work on a copy of the hw params */
   snd_pcm_hw_params_t *hw_params_copy;
   snd_pcm_hw_params_alloca(&hw_params_copy);
-
-  /* try to set the buffer size then the period size */
-  snd_pcm_hw_params_copy(hw_params_copy, hw_params);
-  snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize);
-  snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL);
-  snd_pcm_hw_params_set_periods_near    (m_pcm, hw_params_copy, &periods   , NULL);
-  if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
+  snd_pcm_hw_params_copy(hw_params_copy, hw_params); // copy what we have and is already working
+  
+  // first trying bufferSize, PeriodSize
+  // for more info see here:
+  // http://mailman.alsa-project.org/pipermail/alsa-devel/2009-September/021069.html
+  // the last three tries are done as within pulseaudio
+
+  // backup periodSize and bufferSize first. Restore them after every failed try
+  snd_pcm_uframes_t periodSizeTemp, bufferSizeTemp;
+  periodSizeTemp = periodSize;
+  bufferSizeTemp = bufferSize;
+  if (snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0
+    || snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0
+    || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
   {
-    /* try to set the period size then the buffer size */
-    snd_pcm_hw_params_copy(hw_params_copy, hw_params);
-    snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL);
-    snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize);
-    snd_pcm_hw_params_set_periods_near    (m_pcm, hw_params_copy, &periods   , NULL);
-    if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
+    bufferSize = bufferSizeTemp;
+    periodSize = periodSizeTemp;
+    // retry with PeriodSize, bufferSize
+    snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy
+    if (snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0
+      || snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0
+      || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
     {
-      /* try to just set the buffer size */
-      snd_pcm_hw_params_copy(hw_params_copy, hw_params);
-      snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize);
-      snd_pcm_hw_params_set_periods_near    (m_pcm, hw_params_copy, &periods   , NULL);
-      if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
+      // try only periodSize
+      periodSize = periodSizeTemp;
+      snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restore working copy
+      if(snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL) != 0 
+        || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
       {
-        /* try to just set the period size */
-        snd_pcm_hw_params_copy(hw_params_copy, hw_params);
-        snd_pcm_hw_params_set_period_size_near(m_pcm, hw_params_copy, &periodSize, NULL);
-        snd_pcm_hw_params_set_periods_near    (m_pcm, hw_params_copy, &periods   , NULL);
-        if (snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
+        // try only BufferSize
+        bufferSize = bufferSizeTemp;
+        snd_pcm_hw_params_copy(hw_params_copy, hw_params); // restory working copy
+        if (snd_pcm_hw_params_set_buffer_size_near(m_pcm, hw_params_copy, &bufferSize) != 0
+          || snd_pcm_hw_params(m_pcm, hw_params_copy) != 0)
         {
-          CLog::Log(LOGERROR, "CAESinkALSA::InitializeHW - Failed to set the parameters");
-          return false;
+          // set default that Alsa would choose
+          CLog::Log(LOGWARNING, "CAESinkAlsa::IntializeHW - Using default alsa values - set failed");
+          if (snd_pcm_hw_params(m_pcm, hw_params) != 0)
+          {
+            CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Could not init a valid sink");
+            return false;
+          }
         }
       }
+      // reread values when alsa default was kept
+      snd_pcm_get_params(m_pcm, &bufferSize, &periodSize);
     }
   }
-
-  snd_pcm_hw_params_get_period_size(hw_params_copy, &periodSize, NULL);
-  snd_pcm_hw_params_get_buffer_size(hw_params_copy, &bufferSize);
   
-
-  CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Got: periodSize %lu, periods %u, bufferSize %lu", periodSize, periods, bufferSize);
+  CLog::Log(LOGDEBUG, "CAESinkALSA::InitializeHW - Got: periodSize %lu, bufferSize %lu", periodSize, bufferSize);
 
   /* set the format parameters */
   format.m_sampleRate   = sampleRate;
index eec9698..349aa63 100644 (file)
@@ -32,6 +32,8 @@
 #if defined(__ARM_NEON__)
 #include <arm_neon.h>
 #include "utils/CPUInfo.h"
+#include "android/activity/JNIThreading.h"
+
 // LGPLv2 from PulseAudio
 // float values from AE are pre-clamped so we do not need to clamp again here
 static void pa_sconv_s16le_from_f32ne_neon(unsigned n, const float32_t *a, int16_t *b)
@@ -263,8 +265,7 @@ void CAESinkAUDIOTRACK::Process()
 {
   CLog::Log(LOGDEBUG, "CAESinkAUDIOTRACK::Process");
 
-  JNIEnv *jenv = NULL;
-  CXBMCApp::AttachCurrentThread(&jenv, NULL);
+  JNIEnv *jenv = xbmc_jnienv();
 
   jclass jcAudioTrack = jenv->FindClass("android/media/AudioTrack");
 
@@ -397,6 +398,4 @@ void CAESinkAUDIOTRACK::Process()
   jenv->DeleteLocalRef(jbuffer);
   jenv->DeleteLocalRef(joAudioTrack);
   jenv->DeleteLocalRef(jcAudioTrack);
-
-  CXBMCApp::DetachCurrentThread();
 }
index ac58eb6..39e3ea7 100644 (file)
@@ -603,7 +603,7 @@ void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bo
     if (SUCCEEDED(hr) && varName.blob.cbSize > 0)
     {
       WAVEFORMATEX* smpwfxex = (WAVEFORMATEX*)varName.blob.pBlobData;
-      deviceInfo.m_channels = layoutsByChCount[std::max(std::min(smpwfxex->nChannels, (WORD) 8), (WORD) 2)];
+      deviceInfo.m_channels = layoutsByChCount[std::max(std::min(smpwfxex->nChannels, (WORD) DS_SPEAKER_COUNT), (WORD) 2)];
       deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_FLOAT));
       deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AC3));
       deviceInfo.m_sampleRates.push_back(std::min(smpwfxex->nSamplesPerSec, (DWORD) 192000));
@@ -896,3 +896,15 @@ failed:
 
   return strDevName;
 }
+
+bool CAESinkDirectSound::SoftSuspend()
+{
+  Deinitialize();
+  return true;
+}
+
+bool CAESinkDirectSound::SoftResume()
+{
+  /* Return false to force re-init by engine */
+  return false;
+}
\ No newline at end of file
index dbf9618..1e6c63b 100644 (file)
@@ -43,6 +43,8 @@ public:
   virtual double       GetCacheTime       ();
   virtual double       GetCacheTotal      ();
   virtual unsigned int AddPackets         (uint8_t *data, unsigned int frames, bool hasAudio);
+  virtual bool         SoftSuspend        ();
+  virtual bool         SoftResume         ();
   static  std::string  GetDefaultDevice   ();
   static  void         EnumerateDevicesEx (AEDeviceInfoList &deviceInfoList, bool force = false);
 private:
index 5f86d34..2f003dc 100644 (file)
 
 #include "system.h"
 
-#include "AESinkNULL.h"
 #include <stdint.h>
 #include <limits.h>
 
-#include "guilib/LocalizeStrings.h"
-#include "dialogs/GUIDialogKaiToast.h"
-
-#include "Utils/AEUtil.h"
-#include "utils/StdString.h"
+#include "AESinkNULL.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
 #include "utils/log.h"
-#include "utils/MathUtils.h"
-#include "utils/TimeUtils.h"
-#include "settings/GUISettings.h"
 
-CAESinkNULL::CAESinkNULL() {
+CAESinkNULL::CAESinkNULL()
+  : CThread("nullsink"),
+    m_draining(false),
+    m_sink_frameSize(0),
+    m_sinkbuffer_size(0),
+    m_sinkbuffer_level(0),
+    m_sinkbuffer_sec_per_byte(0)
+{
 }
 
 CAESinkNULL::~CAESinkNULL()
@@ -43,56 +43,138 @@ CAESinkNULL::~CAESinkNULL()
 
 bool CAESinkNULL::Initialize(AEAudioFormat &format, std::string &device)
 {
-  m_msPerFrame           = 1000.0f / format.m_sampleRate;
-  m_ts                   = 0;
-
+  // setup for a 250ms sink feed from SoftAE 
   format.m_dataFormat    = AE_IS_RAW(format.m_dataFormat) ? AE_FMT_S16NE : AE_FMT_FLOAT;
-  format.m_frames        = format.m_sampleRate / 1000 * 500; /* 500ms */
+  format.m_frames        = format.m_sampleRate / 1000 * 250;
   format.m_frameSamples  = format.m_channelLayout.Count();
   format.m_frameSize     = format.m_frameSamples * (CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3);
-
-#if 0
-  /* FIXME, CAUSES A DEADLOCK */
-  /* display failure notification */
-  CGUIDialogKaiToast::QueueNotification(
-    CGUIDialogKaiToast::Error,
-    g_localizeStrings.Get(34402),
-    g_localizeStrings.Get(34403),
-    TOAST_DISPLAY_TIME,
-    false
-  );
-#endif
+  m_format = format;
+
+  // setup a pretend 500ms internal buffer
+  m_sink_frameSize = format.m_channelLayout.Count() * CAEUtil::DataFormatToBits(format.m_dataFormat) >> 3;
+  m_sinkbuffer_size = m_sink_frameSize * format.m_sampleRate / 2;
+  m_sinkbuffer_sec_per_byte = 1.0 / (double)(m_sink_frameSize * format.m_sampleRate);
+
+  m_draining = false;
+  m_wake.Reset();
+  m_inited.Reset();
+  Create();
+  if (!m_inited.WaitMSec(100))
+  {
+    while(!m_inited.WaitMSec(1))
+      Sleep(10);
+  }
 
   return true;
 }
 
 void CAESinkNULL::Deinitialize()
 {
+  // force m_bStop and set m_wake, if might be sleeping.
+  m_bStop = true;
+  StopThread();
 }
 
 bool CAESinkNULL::IsCompatible(const AEAudioFormat format, const std::string device)
 {
-  return false;
+  return ((m_format.m_sampleRate    == format.m_sampleRate) &&
+          (m_format.m_dataFormat    == format.m_dataFormat) &&
+          (m_format.m_channelLayout == format.m_channelLayout));
 }
 
 double CAESinkNULL::GetDelay()
 {
-  return std::max(0.0, (double)(m_ts - CurrentHostCounter()) / 1000000.0f);
+  double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer_level;
+  return sinkbuffer_seconds_to_empty;
+}
+
+double CAESinkNULL::GetCacheTime()
+{
+  double sinkbuffer_seconds_to_empty = m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer_level;
+  return sinkbuffer_seconds_to_empty;
+}
+
+double CAESinkNULL::GetCacheTotal()
+{
+  return m_sinkbuffer_sec_per_byte * (double)m_sinkbuffer_size;
 }
 
 unsigned int CAESinkNULL::AddPackets(uint8_t *data, unsigned int frames, bool hasAudio)
 {
-  float timeout = m_msPerFrame * frames;
-  m_ts = CurrentHostCounter() + MathUtils::round_int(timeout * 1000000.0f);
-  Sleep(MathUtils::round_int(timeout));
+  unsigned int max_frames = (m_sinkbuffer_size - m_sinkbuffer_level) / m_sink_frameSize;
+  if (frames > max_frames)
+    frames = max_frames;
+
+  if (hasAudio && frames)
+  {
+    m_sinkbuffer_level += frames * m_sink_frameSize;
+    m_wake.Set();
+  }
+  // AddPackets runs under a non-idled AE thread we must block or sleep.
+  // Trying to calc the optimal sleep is tricky so just a minimal sleep.
+  Sleep(10);
+
   return frames;
 }
 
 void CAESinkNULL::Drain()
 {
+  m_draining = true;
+  m_wake.Set();
 }
 
 void CAESinkNULL::EnumerateDevices (AEDeviceList &devices, bool passthrough)
 {
-  /* we never return any devices */
+  // we never return any devices
+}
+
+void CAESinkNULL::Process()
+{
+  CLog::Log(LOGDEBUG, "CAESinkNULL::Process");
+
+  // The object has been created and waiting to play,
+  m_inited.Set();
+  // yield to give other threads a chance to do some work.
+  Sleep(0);
+
+  SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);
+  while (!m_bStop)
+  {
+    if (m_draining)
+    {
+      // TODO: is it correct to not take data at the appropriate rate while draining?
+      m_sinkbuffer_level = 0;
+      m_draining = false;
+    }
+
+    // pretend we have a 64k audio buffer
+    unsigned int min_buffer_size = 64 * 1024;
+    unsigned int read_bytes = m_sinkbuffer_level;
+    if (read_bytes > min_buffer_size)
+      read_bytes = min_buffer_size;
+
+    if (read_bytes > 0)
+    {
+      // drain it
+      m_sinkbuffer_level -= read_bytes;
+
+      // we MUST drain at the correct audio sample rate
+      // or the NULL sink will not work right. So calc
+      // an approximate sleep time.
+      int frames_written = read_bytes / m_sink_frameSize;
+      double empty_ms = 1000.0 * (double)frames_written / m_format.m_sampleRate;
+      #if defined(_LINUX)
+        usleep(empty_ms * 1000.0);
+      #else
+        Sleep((int)empty_ms);
+      #endif
+    }
+
+    if (m_sinkbuffer_level == 0)
+    {
+      // sleep this audio thread, we will get woken when we have audio data.
+      m_wake.WaitMSec(250);
+    }
+  }
+  SetPriority(THREAD_PRIORITY_NORMAL);
 }
index e6413fc..12e20ed 100644 (file)
 
 #include "system.h"
 
-#include "Interfaces/AESink.h"
-#include <stdint.h>
+#include "cores/AudioEngine/Interfaces/AESink.h"
 
-class CAESinkNULL : public IAESink
+class CAESinkNULL : public CThread, public IAESink
 {
 public:
   virtual const char *GetName() { return "NULL"; }
@@ -32,18 +31,26 @@ public:
   CAESinkNULL();
   virtual ~CAESinkNULL();
 
-  virtual bool Initialize  (AEAudioFormat &format, std::string &device);
+  virtual bool Initialize(AEAudioFormat &format, std::string &device);
   virtual void Deinitialize();
   virtual bool IsCompatible(const AEAudioFormat format, const std::string device);
 
   virtual double       GetDelay        ();
-  virtual double       GetCacheTime    () { return 0.0; }
-  virtual double       GetCacheTotal   () { return 0.0; }
+  virtual double       GetCacheTime    ();
+  virtual double       GetCacheTotal   ();
   virtual unsigned int AddPackets      (uint8_t *data, unsigned int frames, bool hasAudio);
   virtual void         Drain           ();
 
   static void          EnumerateDevices(AEDeviceList &devices, bool passthrough);
 private:
-  int64_t m_ts;
-  float   m_msPerFrame;
+  virtual void         Process();
+
+  CEvent               m_wake;
+  CEvent               m_inited;
+  volatile bool        m_draining;
+  AEAudioFormat        m_format;
+  unsigned int         m_sink_frameSize;
+  unsigned int         m_sinkbuffer_size;  ///< total size of the buffer
+  unsigned int         m_sinkbuffer_level; ///< current level in the buffer
+  double               m_sinkbuffer_sec_per_byte;
 };
index a4e4755..97ec87b 100644 (file)
@@ -155,7 +155,7 @@ unsigned int CAEConvert::S16LE_Float(uint8_t* data, const unsigned int samples,
 {
   static const float mul = 1.0f / (INT16_MAX + 0.5f);
 
-#if defined(__ARM_NEON__) || defined(__VFP_FP__)
+#if defined(__ARM_NEON__) || (defined(__VFP_FP__) && !defined(__SOFTFP__))
   for (unsigned int i = 0; i < samples; i++)
   {
     __asm__ __volatile__ (
@@ -186,7 +186,7 @@ unsigned int CAEConvert::S16BE_Float(uint8_t* data, const unsigned int samples,
 {
   static const float mul = 1.0f / (INT16_MAX + 0.5f);
 
-#if defined(__ARM_NEON__) || defined(__VFP_FP__)
+#if defined(__ARM_NEON__) || (defined(__VFP_FP__) && !defined(__SOFTFP__))
   for (unsigned int i = 0; i < samples; i++)
   {
     __asm__ __volatile__ (
index 17c9d0c..3f78908 100644 (file)
@@ -179,7 +179,8 @@ public:
 #ifdef AE_RING_BUFFER_DEBUG
       CLog::Log(LOGDEBUG, "AERingBuffer: Reading from: %u size: %u space before: %u\n", m_iWritePos, size, space);
 #endif
-      memcpy(dest, &(m_Buffer[m_iReadPos]), size);
+      if (dest)
+        memcpy(dest, &(m_Buffer[m_iReadPos]), size);
       m_iReadPos+=size;
     }
     //need to wrap
@@ -190,8 +191,11 @@ public:
 #ifdef AE_RING_BUFFER_DEBUG
       CLog::Log(LOGDEBUG, "AERingBuffer: Reading from (split) first: %u second: %u size: %u space before: %u\n", first, second, size, space);
 #endif
-      memcpy(dest, &(m_Buffer[m_iReadPos]), first);
-      memcpy(&dest[first], &(m_Buffer[0]), second);
+      if (dest)
+      {
+        memcpy(dest, &(m_Buffer[m_iReadPos]), first);
+        memcpy(&dest[first], &(m_Buffer[0]), second);
+      }
       m_iReadPos = second;
     }
     //we can increase the read count now
index 89025a9..32db3b9 100644 (file)
@@ -971,7 +971,7 @@ extern "C"
 
     // locate next free directory
     int iDirSlot=0;
-    while ((vecDirsOpen[iDirSlot].curr_index != -1) && (iDirSlot<MAX_OPEN_DIRS)) iDirSlot++;
+    while ((iDirSlot<MAX_OPEN_DIRS) && (vecDirsOpen[iDirSlot].curr_index != -1)) iDirSlot++;
     if (iDirSlot >= MAX_OPEN_DIRS)
     {
       CLog::Log(LOGDEBUG, "Dll: Max open dirs reached");
index 10e1603..08c5aa2 100644 (file)
@@ -89,6 +89,44 @@ enum IPlayerSubtitleCapabilities
   IPC_SUBS_OFFSET
 };
 
+struct SPlayerAudioStreamInfo
+{
+  int bitrate;
+  int channels;
+  std::string language;
+  std::string name;
+  std::string audioCodecName;
+
+  SPlayerAudioStreamInfo()
+  {
+    bitrate = 0;
+    channels = 0;
+  }
+};
+
+struct SPlayerSubtitleStreamInfo
+{
+  std::string language;
+  std::string name;
+};
+
+struct SPlayerVideoStreamInfo
+{
+  int bitrate;
+  float videoAspectRatio;
+  std::string language;
+  std::string name;
+  std::string videoCodecName;
+  CRect SrcRect;
+  CRect DestRect;
+
+  SPlayerVideoStreamInfo()
+  {
+    bitrate = 0;
+    videoAspectRatio = 1.0f;
+  }
+};
+
 class IPlayer
 {
 public:
@@ -122,8 +160,6 @@ public:
   virtual void GetVideoInfo( CStdString& strVideoInfo) = 0;
   virtual void GetGeneralInfo( CStdString& strVideoInfo) = 0;
   virtual void Update(bool bPauseDrawing = false) = 0;
-  virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect) {}
-  virtual void GetVideoAspectRatio(float& fAR) { fAR = 1.0f; }
   virtual bool CanRecord() { return false;};
   virtual bool IsRecording() { return false;};
   virtual bool Record(bool bOnOff) { return false;};
@@ -135,19 +171,16 @@ public:
   virtual float GetSubTitleDelay()    { return 0.0f; }
   virtual int  GetSubtitleCount()     { return 0; }
   virtual int  GetSubtitle()          { return -1; }
-  virtual void GetSubtitleName(int iStream, CStdString &strStreamName){};
-  virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang){};
+  virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info){};
   virtual void SetSubtitle(int iStream){};
   virtual bool GetSubtitleVisible(){ return false;};
   virtual void SetSubtitleVisible(bool bVisible){};
-  virtual bool GetSubtitleExtension(CStdString &strSubtitleExtension){ return false;};
   virtual int  AddSubtitle(const CStdString& strSubPath) {return -1;};
 
   virtual int  GetAudioStreamCount()  { return 0; }
   virtual int  GetAudioStream()       { return -1; }
-  virtual void GetAudioStreamName(int iStream, CStdString &strStreamName){};
   virtual void SetAudioStream(int iStream){};
-  virtual void GetAudioStreamLanguage(int iStream, CStdString &strLanguage){};
+  virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info){};
 
   virtual TextCacheStruct_t* GetTeletextCache() { return NULL; };
   virtual void LoadPage(int p, int sp, unsigned char* buffer) {};
@@ -168,14 +201,10 @@ public:
    \brief total time in milliseconds
    */
   virtual int64_t GetTotalTime() { return 0; }
-  virtual int GetAudioBitrate(){ return 0;}
-  virtual int GetVideoBitrate(){ return 0;}
+  virtual void GetVideoStreamInfo(SPlayerVideoStreamInfo &info){};
   virtual int GetSourceBitrate(){ return 0;}
-  virtual int GetChannels(){ return 0;};
   virtual int GetBitsPerSample(){ return 0;};
   virtual int GetSampleRate(){ return 0;};
-  virtual CStdString GetAudioCodecName(){ return "";}
-  virtual CStdString GetVideoCodecName(){ return "";}
   virtual int GetPictureWidth(){ return 0;}
   virtual int GetPictureHeight(){ return 0;}
   virtual bool GetStreamDetails(CStreamDetails &details){ return false;}
index 1cf52d3..473e014 100644 (file)
@@ -3187,7 +3187,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature)
 {
   if(feature == RENDERFEATURE_BRIGHTNESS)
   {
-    if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoplayer.vdpaustudiolevel"))
+    if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoscreen.limitedrange"))
       return true;
 
     if (m_renderMethod & RENDER_VAAPI)
@@ -3200,7 +3200,7 @@ bool CLinuxRendererGL::Supports(ERENDERFEATURE feature)
   
   if(feature == RENDERFEATURE_CONTRAST)
   {
-    if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoplayer.vdpaustudiolevel"))
+    if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoscreen.limitedrange"))
       return true;
 
     if (m_renderMethod & RENDER_VAAPI)
index b7be35c..85f4446 100644 (file)
@@ -1352,7 +1352,7 @@ bool CLinuxRendererGLES::RenderCapture(CRenderCapture* capture)
   // OpenGLES returns in RGBA order but CRenderCapture needs BGRA order
   // XOR Swap RGBA -> BGRA
   unsigned char* pixels = (unsigned char*)capture->GetRenderBuffer();
-  for (int i = 0; i < capture->GetWidth() * capture->GetHeight(); i++, pixels+=4)
+  for (unsigned int i = 0; i < capture->GetWidth() * capture->GetHeight(); i++, pixels+=4)
   {
     std::swap(pixels[0], pixels[2]);
   }
index 9a0d2b9..3731a90 100644 (file)
@@ -374,7 +374,7 @@ COverlayGlyphGL::~COverlayGlyphGL()
 
 void COverlayGlyphGL::Render(SRenderState& state)
 {
-  if (m_texture == 0)
+  if ((m_texture == 0) || (m_count == 0))
     return;
 
   glEnable(GL_TEXTURE_2D);
@@ -433,21 +433,32 @@ void COverlayGlyphGL::Render(SRenderState& state)
   GLint colLoc  = g_Windowing.GUIShaderGetCol();
   GLint tex0Loc = g_Windowing.GUIShaderGetCoord0();
 
-  glVertexAttribPointer(posLoc,  3, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, x));
-  glVertexAttribPointer(colLoc,  4, GL_UNSIGNED_BYTE, GL_TRUE,  sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, r));
-  glVertexAttribPointer(tex0Loc, 2, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)m_vertex + offsetof(VERTEX, u));
+  // stack object until VBOs will be used
+  std::vector<VERTEX> vecVertices( 6 * m_count);
+  VERTEX *vertices = &vecVertices[0];
+
+  for (int i=0; i<m_count*4; i+=4)
+  {
+    *vertices++ = m_vertex[i];
+    *vertices++ = m_vertex[i+1];
+    *vertices++ = m_vertex[i+2];
+
+    *vertices++ = m_vertex[i+1];
+    *vertices++ = m_vertex[i+3];
+    *vertices++ = m_vertex[i+2];
+  }
+
+  vertices = &vecVertices[0];
+
+  glVertexAttribPointer(posLoc,  3, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, x));
+  glVertexAttribPointer(colLoc,  4, GL_UNSIGNED_BYTE, GL_TRUE,  sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, r));
+  glVertexAttribPointer(tex0Loc, 2, GL_FLOAT,         GL_FALSE, sizeof(VERTEX), (char*)vertices + offsetof(VERTEX, u));
 
   glEnableVertexAttribArray(posLoc);
   glEnableVertexAttribArray(colLoc);
   glEnableVertexAttribArray(tex0Loc);
 
-  // GLES2 version
-  // As using triangle strips, have to do in sets of 4.
-  // This is due to limitations of ES, in that tex/col has to be same size as ver!
-  for (int i=0; i<(m_count*4); i+=4)
-  {
-    glDrawArrays(GL_TRIANGLE_STRIP, i, 4);
-  }
+  glDrawArrays(GL_TRIANGLES, 0, vecVertices.size());
 
   glDisableVertexAttribArray(posLoc);
   glDisableVertexAttribArray(colLoc);
index 58f26b0..5b58f61 100644 (file)
@@ -24,6 +24,7 @@
 #include "YUV2RGBShader.h"
 #include "settings/AdvancedSettings.h"
 #include "guilib/TransformMatrix.h"
+#include "windowing/WindowingFactory.h"
 #include "utils/log.h"
 #if defined(HAS_GL) || defined(HAS_GLES)
 #include "utils/GLUtils.h"
@@ -106,8 +107,20 @@ void CalculateYUVMatrix(TransformMatrix &matrix
       coef.m[row][col] = conv[col][row];
   coef.identity = false;
 
+
+  if(g_Windowing.UseLimitedColor())
+  {
+    matrix *= TransformMatrix::CreateTranslation(+ 16.0f / 255
+                                               , + 16.0f / 255
+                                               , + 16.0f / 255);
+    matrix *= TransformMatrix::CreateScaler((235 - 16) / 255.0f
+                                          , (235 - 16) / 255.0f
+                                          , (235 - 16) / 255.0f);
+  }
+
   matrix *= coef;
   matrix *= TransformMatrix::CreateTranslation(0.0, -0.5, -0.5);
+
   if (!(flags & CONF_FLAGS_YUV_FULLRANGE))
   {
     matrix *= TransformMatrix::CreateScaler(255.0f / (235 - 16)
index 94c9a82..2c2a849 100644 (file)
@@ -27,6 +27,7 @@
 #include "GUIInfoManager.h"
 #include "video/VideoThumbLoader.h"
 #include "Util.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
 #include "cores/VideoRenderers/RenderFlags.h"
 #include "cores/VideoRenderers/RenderFormats.h"
 #include "cores/VideoRenderers/RenderManager.h"
@@ -845,25 +846,6 @@ int CAMLPlayer::GetAudioStream()
   return m_audio_index;
 }
 
-void CAMLPlayer::GetAudioStreamName(int iStream, CStdString &strStreamName)
-{
-  //CLog::Log(LOGDEBUG, "CAMLPlayer::GetAudioStreamName");
-  CSingleLock lock(m_aml_csection);
-
-  strStreamName.Format("Undefined");
-
-  if (iStream > (int)m_audio_streams.size() || iStream < 0)
-    return;
-
-  if ( m_audio_streams[iStream]->language.size())
-  {
-    CStdString name;
-    g_LangCodeExpander.Lookup( name, m_audio_streams[iStream]->language);
-    strStreamName = name;
-  }
-
-}
-
 void CAMLPlayer::SetAudioStream(int SetAudioStream)
 {
   //CLog::Log(LOGDEBUG, "CAMLPlayer::SetAudioStream");
@@ -925,35 +907,33 @@ int CAMLPlayer::GetSubtitle()
     return -1;
 }
 
-void CAMLPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
+void CAMLPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info)
 {
   CSingleLock lock(m_aml_csection);
 
-  strStreamName = "";
-
-  if (iStream > (int)m_subtitle_streams.size() || iStream < 0)
+  if (index > (int)m_subtitle_streams.size() -1 || index < 0)
     return;
 
   if (m_subtitle_streams[m_subtitle_index]->source == STREAM_SOURCE_NONE)
   {
-    if ( m_subtitle_streams[iStream]->language.size())
+    if ( m_subtitle_streams[index]->language.size())
     {
       CStdString name;
-      g_LangCodeExpander.Lookup(name, m_subtitle_streams[iStream]->language);
-      strStreamName = name;
+      g_LangCodeExpander.Lookup(name, m_subtitle_streams[index]->language);
+      info.name = name;
     }
     else
-      strStreamName = g_localizeStrings.Get(13205); // Unknown
+      info.name = g_localizeStrings.Get(13205); // Unknown
   }
   else
   {
     if(m_subtitle_streams[m_subtitle_index]->name.length() > 0)
-      strStreamName = m_subtitle_streams[m_subtitle_index]->name;
+      info.name = m_subtitle_streams[m_subtitle_index]->name;
     else
-      strStreamName = g_localizeStrings.Get(13205); // Unknown
+      info.name = g_localizeStrings.Get(13205); // Unknown
   }
   if (m_log_level > 5)
-    CLog::Log(LOGDEBUG, "CAMLPlayer::GetSubtitleName, iStream(%d)", iStream);
+    CLog::Log(LOGDEBUG, "CAMLPlayer::GetSubtitleName, iStream(%d)", index);
 }
  
 void CAMLPlayer::SetSubtitle(int iStream)
@@ -1015,16 +995,6 @@ void CAMLPlayer::Update(bool bPauseDrawing)
   g_renderManager.Update(bPauseDrawing);
 }
 
-void CAMLPlayer::GetVideoRect(CRect& SrcRect, CRect& DestRect)
-{
-  g_renderManager.GetVideoRect(SrcRect, DestRect);
-}
-
-void CAMLPlayer::GetVideoAspectRatio(float &fAR)
-{
-  fAR = g_renderManager.GetAspectRatio();
-}
-
 int CAMLPlayer::GetChapterCount()
 {
   return m_chapter_count;
@@ -1127,22 +1097,41 @@ __int64 CAMLPlayer::GetTotalTime()
   return m_duration_ms;
 }
 
-int CAMLPlayer::GetAudioBitrate()
+void CAMLPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
 {
   CSingleLock lock(m_aml_csection);
-  if (m_audio_streams.size() == 0 || m_audio_index > (int)(m_audio_streams.size() - 1))
-    return 0;
+  if (index < 0 || m_audio_streams.size() == 0 || index > (int)(m_audio_streams.size() - 1))
+    return;
+
+  info.bitrate = m_audio_streams[index]->bit_rate;
+
+  if ( m_audio_streams[index]->language.size())
+    info.language = m_audio_streams[index]->language;
+
+  info.channels = m_audio_streams[index]->channel;
 
-  return m_audio_streams[m_audio_index]->bit_rate;
+  info.audioCodecName = AudioCodecName(m_audio_streams[index]->format);
+
+  info.name.Format("Undefined");
+    
+  if ( m_audio_streams[index]->language.size())
+  {
+    CStdString name;
+    g_LangCodeExpander.Lookup( name, m_audio_streams[index]->language);
+    info.name = name;
+  }
 }
 
-int CAMLPlayer::GetVideoBitrate()
+void CAMLPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
 {
   CSingleLock lock(m_aml_csection);
   if (m_video_streams.size() == 0 || m_video_index > (int)(m_video_streams.size() - 1))
-    return 0;
+    return;
 
-  return m_video_streams[m_video_index]->bit_rate;
+  info.bitrate = m_video_streams[m_video_index]->bit_rate;
+  info.videoCodecName = VideoCodecName(m_video_streams[m_video_index]->format);
+  info.videoAspectRatio = g_renderManager.GetAspectRatio();
+  g_renderManager.GetVideoRect(info.SrcRect, info.DestRect);
 }
 
 int CAMLPlayer::GetSourceBitrate()
@@ -1151,15 +1140,6 @@ int CAMLPlayer::GetSourceBitrate()
   return 0;
 }
 
-int CAMLPlayer::GetChannels()
-{
-  CSingleLock lock(m_aml_csection);
-  if (m_audio_streams.size() == 0 || m_audio_index > (int)(m_audio_streams.size() - 1))
-    return 0;
-  
-  return m_audio_streams[m_audio_index]->channel;
-}
-
 int CAMLPlayer::GetBitsPerSample()
 {
   CLog::Log(LOGDEBUG, "CAMLPlayer::GetBitsPerSample");
@@ -1175,28 +1155,6 @@ int CAMLPlayer::GetSampleRate()
   return m_audio_streams[m_audio_index]->sample_rate;
 }
 
-CStdString CAMLPlayer::GetAudioCodecName()
-{
-  CStdString strAudioCodec = "";
-  if (m_audio_streams.size() == 0 || m_audio_index > (int)(m_audio_streams.size() - 1))
-    return strAudioCodec;
-
-  strAudioCodec = AudioCodecName(m_audio_streams[m_audio_index]->format);
-
-  return strAudioCodec;
-}
-
-CStdString CAMLPlayer::GetVideoCodecName()
-{
-  CStdString strVideoCodec = "";
-  if (m_video_streams.size() == 0 || m_video_index > (int)(m_video_streams.size() - 1))
-    return strVideoCodec;
-  
-  strVideoCodec = VideoCodecName(m_video_streams[m_video_index]->format);
-
-  return strVideoCodec;
-}
-
 int CAMLPlayer::GetPictureWidth()
 {
   //CLog::Log(LOGDEBUG, "CAMLPlayer::GetPictureWidth(%d)", m_video_width);
@@ -1306,9 +1264,7 @@ void CAMLPlayer::Process()
   CLog::Log(LOGNOTICE, "CAMLPlayer::Process");
   try
   {
-    CJobManager::GetInstance().Pause(kJobTypeMediaFlags);
-
-    if (CJobManager::GetInstance().IsProcessing(kJobTypeMediaFlags) > 0)
+    if (CJobManager::GetInstance().IsProcessing(CJob::PRIORITY_LOW))
     {
       if (!WaitForPausedThumbJobs(20000))
       {
@@ -1614,8 +1570,6 @@ void CAMLPlayer::Process()
 
   // reset ac3/dts passthough
   SetAudioPassThrough(AFORMAT_UNKNOWN);
-  // let thumbgen jobs resume.
-  CJobManager::GetInstance().UnPause(kJobTypeMediaFlags);
 
   if (m_log_level > 5)
     CLog::Log(LOGDEBUG, "CAMLPlayer::Process exit");
@@ -1721,7 +1675,7 @@ bool CAMLPlayer::WaitForPausedThumbJobs(int timeout_ms)
   // use m_bStop and Sleep so we can get canceled.
   while (!m_bStop && (timeout_ms > 0))
   {
-    if (CJobManager::GetInstance().IsProcessing(kJobTypeMediaFlags) > 0)
+    if (CJobManager::GetInstance().IsProcessing(CJob::PRIORITY_LOW))
     {
       Sleep(100);
       timeout_ms -= 100;
index e33973d..56557a8 100644 (file)
@@ -88,8 +88,6 @@ public:
   virtual void  GetVideoInfo(CStdString &strVideoInfo);
   virtual void  GetGeneralInfo(CStdString &strVideoInfo) {};
   virtual void  Update(bool bPauseDrawing);
-  virtual void  GetVideoRect(CRect& SrcRect, CRect& DestRect);
-  virtual void  GetVideoAspectRatio(float &fAR);
   virtual bool  CanRecord()                                       {return false;};
   virtual bool  IsRecording()                                     {return false;};
   virtual bool  Record(bool bOnOff)                               {return false;};
@@ -101,18 +99,15 @@ public:
   virtual float GetSubTitleDelay();
   virtual int   GetSubtitleCount();
   virtual int   GetSubtitle();
-  virtual void  GetSubtitleName(int iStream, CStdString &strStreamName);
+  virtual void  GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
   virtual void  SetSubtitle(int iStream);
   virtual bool  GetSubtitleVisible();
   virtual void  SetSubtitleVisible(bool bVisible);
-  virtual bool  GetSubtitleExtension(CStdString &strSubtitleExtension) { return false; }
   virtual int   AddSubtitle(const CStdString& strSubPath);
 
   virtual int   GetAudioStreamCount();
   virtual int   GetAudioStream();
-  virtual void  GetAudioStreamName(int iStream, CStdString &strStreamName);
   virtual void  SetAudioStream(int iStream);
-  virtual void  GetAudioStreamLanguage(int iStream, CStdString &strLanguage) {};
 
   virtual TextCacheStruct_t* GetTeletextCache()                   {return NULL;};
   virtual void  LoadPage(int p, int sp, unsigned char* buffer)    {};
@@ -126,14 +121,11 @@ public:
   virtual void  SeekTime(__int64 iTime = 0);
   virtual __int64 GetTime();
   virtual __int64 GetTotalTime();
-  virtual int   GetAudioBitrate();
-  virtual int   GetVideoBitrate();
+  virtual void  GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
+  virtual void  GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
   virtual int   GetSourceBitrate();
-  virtual int   GetChannels();
   virtual int   GetBitsPerSample();
   virtual int   GetSampleRate();
-  virtual CStdString GetAudioCodecName();
-  virtual CStdString GetVideoCodecName();
   virtual int   GetPictureWidth();
   virtual int   GetPictureHeight();
   virtual bool  GetStreamDetails(CStreamDetails &details);
index 8c87bc4..da8de1f 100644 (file)
@@ -103,6 +103,12 @@ public:
 
   bool IsOverlayType(DVDOverlayType type) { return (m_type == type); }
 
+  /**
+   * return a copy to DVDPlayerSubtitle in order to have hw resources cleared
+   * after rendering
+   */
+  virtual CDVDOverlay* Clone() { return Acquire(); }
+
   double iPTSStartTime;
   double iPTSStopTime;
   bool bForced; // display, no matter what
index bc90d68..e1cdf59 100644 (file)
@@ -20,6 +20,7 @@
  *
  */
 
+#include "PlatformDefs.h"
 #include "DVDOverlay.h"
 #include <string.h>
 #include <stdlib.h>
@@ -117,6 +118,11 @@ public:
     if(palette) free(palette);
   }
 
+  virtual CDVDOverlayImage* Clone()
+  {
+    return new CDVDOverlayImage(*this);
+  }
+
   BYTE* data_at(int sub_x, int sub_y) const
   {
     int bpp;
index 31deba1..f42c571 100644 (file)
@@ -37,10 +37,21 @@ public:
     libass->Acquire();
   }
 
+  CDVDOverlaySSA(CDVDOverlaySSA& src)
+    : CDVDOverlay(src)
+    , m_libass(src.m_libass)
+  {
+    m_libass->Acquire();
+  }
+
   ~CDVDOverlaySSA()
   {
     if(m_libass)
       SAFE_RELEASE(m_libass);
   }
 
+  virtual CDVDOverlaySSA* Clone()
+  {
+    return new CDVDOverlaySSA(*this);
+  }
 };
index 849a6e3..54e3bfa 100644 (file)
@@ -46,6 +46,12 @@ public:
       m_type = type;
     }
 
+    CElement(CElement& src)
+    {
+      pNext  = NULL;
+      m_type = src.m_type;
+    }
+
     virtual ~CElement()
     {
     }
@@ -71,6 +77,12 @@ public:
       }
     }
 
+    CElementText(CElementText& src)
+     : CElement(src)
+    {
+      m_text = strdup(src.m_text);
+    }
+
     virtual ~CElementText()
     {
       if (m_text) free(m_text);
@@ -81,12 +93,20 @@ public:
 
   class CElementProperty : public CElement
   {
+  public:
     CElementProperty() : CElement(ELEMENT_TYPE_PROPERTY)
     {
       bItalic = false;
       bBold = false;
     }
 
+    CElementProperty(CElementProperty& src)
+    : CElement(src)
+    {
+      bItalic = src.bItalic;
+      bBold   = src.bBold;
+    }
+
   public:
     bool bItalic;
     bool bBold;
@@ -99,6 +119,22 @@ public:
     m_pEnd = NULL;
   }
 
+  CDVDOverlayText(CDVDOverlayText& src)
+    : CDVDOverlay(src)
+  {
+    m_pHead = NULL;
+    m_pEnd = NULL;
+    for(CElement* e = src.m_pHead; e; e = e->pNext)
+    {
+      if(e->IsElementType(ELEMENT_TYPE_TEXT))
+        AddElement(new CElementText(*static_cast<CElementText*>(e)));
+      else if(e->IsElementType(ELEMENT_TYPE_PROPERTY))
+        AddElement(new CElementProperty(*static_cast<CElementProperty*>(e)));
+      else
+        AddElement(new CElement(*static_cast<CElement*>(e)));
+    }
+  }
+
   virtual ~CDVDOverlayText()
   {
     CElement* pTemp;
@@ -110,6 +146,11 @@ public:
     }
   }
 
+  virtual CDVDOverlayText* Clone()
+  {
+    return new CDVDOverlayText(*this);
+  }
+
   void AddElement(CDVDOverlayText::CElement* pElement)
   {
     pElement->pNext = NULL;
index 06eb6df..9433f9b 100644 (file)
@@ -138,6 +138,7 @@ CDVDVideoCodecFFmpeg::CDVDVideoCodecFFmpeg() : CDVDVideoCodec()
   m_iScreenHeight = 0;
   m_iOrientation = 0;
   m_bSoftware = false;
+  m_isHi10p = false;
   m_pHardware = NULL;
   m_iLastKeyframe = 0;
   m_dts = DVD_NOPTS_VALUE;
@@ -187,7 +188,10 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
       case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
       case FF_PROFILE_H264_HIGH_444_INTRA:
       case FF_PROFILE_H264_CAVLC_444:
+      // this is needed to not open the decoders
       m_bSoftware = true;
+      // this we need to enable multithreading for hi10p via advancedsettings
+      m_isHi10p = true;
       break;
     }
   }
@@ -247,8 +251,18 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
   m_pCodecContext->codec_tag = hints.codec_tag;
   /* Only allow slice threading, since frame threading is more
    * sensitive to changes in frame sizes, and it causes crashes
-   * during HW accell */
-  m_pCodecContext->thread_type = FF_THREAD_SLICE;
+   * during HW accell - so we unset it in this case.
+   *
+   * When we detect Hi10p and user did not disable hi10pmultithreading
+   * via advancedsettings.xml we keep the ffmpeg default thread type.
+   * */
+  if(m_isHi10p && !g_advancedSettings.m_videoDisableHi10pMultithreading)
+  {
+    CLog::Log(LOGDEBUG,"CDVDVideoCodecFFmpeg::Open() Keep default threading for Hi10p: %d",
+                        m_pCodecContext->thread_type);
+  }
+  else
+    m_pCodecContext->thread_type = FF_THREAD_SLICE;
 
 #if defined(TARGET_DARWIN_IOS)
   // ffmpeg with enabled neon will crash and burn if this is enabled
index 2d7abfd..e857a24 100644 (file)
@@ -114,6 +114,7 @@ protected:
 
   std::string m_name;
   bool              m_bSoftware;
+  bool  m_isHi10p;
   IHardwareDecoder *m_pHardware;
   int m_iLastKeyframe;
   double m_dts;
index 087c18a..3c916c4 100644 (file)
@@ -1571,7 +1571,10 @@ bool CProcessor::Render(CRect src, CRect dst, IDirect3DSurface9* target, REFEREN
 
   blt.DestFormat.VideoTransferFunction = DXVA2_VideoTransFunc_sRGB;
   blt.DestFormat.SampleFormat          = DXVA2_SampleProgressiveFrame;
-  blt.DestFormat.NominalRange          = DXVA2_NominalRange_0_255;
+  if(g_Windowing.UseLimitedColor())
+    blt.DestFormat.NominalRange          = DXVA2_NominalRange_16_235;
+  else
+    blt.DestFormat.NominalRange          = DXVA2_NominalRange_0_255;
   blt.Alpha = DXVA2_Fixed32OpaqueAlpha();
 
   blt.ProcAmpValues.Brightness = ConvertRange( m_brightness, g_settings.m_currentVideoSettings.m_Brightness
index d7e6f05..f8d6e19 100644 (file)
@@ -591,7 +591,7 @@ void CVDPAU::SetColor()
     vdp_st = vdp_generate_csc_matrix(&m_Procamp, VDP_COLOR_STANDARD_ITUR_BT_601, &m_CSCMatrix);
 
   VdpVideoMixerAttribute attributes[] = { VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX };
-  if (g_guiSettings.GetBool("videoplayer.vdpaustudiolevel"))
+  if (g_guiSettings.GetBool("videoscreen.limitedrange"))
   {
     void const * pm_CSCMatix[] = { &studioCSC };
     vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix);
index 3d071b5..1758a98 100644 (file)
@@ -103,14 +103,6 @@ void CSelectionStreams::Clear(StreamType type, StreamSource source)
   }
 }
 
-void CDVDPlayer::GetAudioStreamLanguage(int iStream, CStdString &strLanguage)
-{
-  strLanguage = "";
-  SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
-  if(s.language.length() > 0)
-    strLanguage = s.language;
-}
-
 SelectionStream& CSelectionStreams::Get(StreamType type, int index)
 {
   CSingleLock lock(m_section);
@@ -1717,7 +1709,17 @@ void CDVDPlayer::UpdateTimestamps(CCurrentStream& current, DemuxPacket* pPacket)
   || abs(current.dts - current.dts_state) > DVD_MSEC_TO_TIME(200))
   {
     current.dts_state = current.dts;
-    SendPlayerMessage(new CDVDMsgType<SPlayerState>(CDVDMsg::PLAYER_DISPLAYTIME, m_StateInput), current.player);
+    if (current.inited)
+    {
+      // make sure we send no outdated state to a/v players
+      UpdatePlayState(0);
+      SendPlayerMessage(new CDVDMsgType<SPlayerState>(CDVDMsg::PLAYER_DISPLAYTIME, m_StateInput), current.player);
+    }
+    else
+    {
+      CSingleLock lock(m_StateSection);
+      m_State = m_StateInput;
+    }
   }
 }
 
@@ -2041,6 +2043,9 @@ void CDVDPlayer::HandleMessages()
             if(!m_pSubtitleDemuxer->SeekTime(time, msg.GetBackward()))
               CLog::Log(LOGDEBUG, "failed to seek subtitle demuxer: %d, success", time);
           }
+          // dts after successful seek
+          m_StateInput.dts = start;
+
           FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate());
         }
         else
@@ -2674,24 +2679,25 @@ int CDVDPlayer::GetSubtitle()
   return m_SelectionStreams.IndexOf(STREAM_SUBTITLE, *this);
 }
 
-void CDVDPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
+void CDVDPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info)
 {
-  strStreamName = "";
-  SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+  if (index < 0 || index > (int) GetSubtitleCount() - 1)
+    return;
+
+  SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
   if(s.name.length() > 0)
-    strStreamName = s.name;
+    info.name = s.name;
   else
-    strStreamName = g_localizeStrings.Get(13205); // Unknown
+    info.name = g_localizeStrings.Get(13205); // Unknown
 
   if(s.type == STREAM_NONE)
-    strStreamName += "(Invalid)";
-}
+    info.name += "(Invalid)";
 
-void CDVDPlayer::GetSubtitleLanguage(int iStream, CStdString &strStreamLang)
-{
-  SelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+  CStdString strStreamLang;
   if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
-    strStreamLang = g_localizeStrings.Get(13205); // Unknown
+    info.language = g_localizeStrings.Get(13205); // Unknown
+  else
+    info.language = strStreamLang;
 }
 
 void CDVDPlayer::SetSubtitle(int iStream)
@@ -2731,19 +2737,6 @@ int CDVDPlayer::GetAudioStream()
   return m_SelectionStreams.IndexOf(STREAM_AUDIO, *this);
 }
 
-void CDVDPlayer::GetAudioStreamName(int iStream, CStdString& strStreamName)
-{
-  strStreamName = "";
-  SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
-  if(s.name.length() > 0)
-    strStreamName += s.name;
-  else
-    strStreamName += "Unknown";
-
-  if(s.type == STREAM_NONE)
-    strStreamName += " (Invalid)";
-}
-
 void CDVDPlayer::SetAudioStream(int iStream)
 {
   m_messenger.Put(new CDVDMsgPlayerSetAudioStream(iStream));
@@ -3228,6 +3221,11 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
     if(pts != DVD_NOPTS_VALUE)
       m_clock.Discontinuity(pts);
     UpdatePlayState(0);
+
+    // update state, buffers are flushed and it may take some time until
+    // we get an update from players
+    CSingleLock lock(m_StateSection);
+    m_State = m_StateInput;
   }
 }
 
@@ -3570,7 +3568,7 @@ bool CDVDPlayer::OnAction(const CAction &action)
       case ACTION_MOUSE_LEFT_CLICK:
         {
           CRect rs, rd;
-          GetVideoRect(rs, rd);
+          m_dvdPlayerVideo.GetVideoRect(rs, rd);
           CPoint pt(action.GetAmount(), action.GetAmount(1));
           if (!rd.PtInRect(pt))
             return false; // out of bounds
@@ -3795,14 +3793,16 @@ double CDVDPlayer::GetQueueTime()
   return max(a, v) * 8000.0 / 100;
 }
 
-int CDVDPlayer::GetAudioBitrate()
+void CDVDPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
 {
-  return m_dvdPlayerAudio.GetAudioBitrate();
-}
+  info.bitrate = m_dvdPlayerVideo.GetVideoBitrate();
 
-int CDVDPlayer::GetVideoBitrate()
-{
-  return m_dvdPlayerVideo.GetVideoBitrate();
+  CStdString retVal;
+  if (m_pDemuxer && (m_CurrentVideo.id != -1))
+    m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
+  info.videoCodecName = retVal;
+  info.videoAspectRatio = m_dvdPlayerVideo.GetAspectRatio();
+  m_dvdPlayerVideo.GetVideoRect(info.SrcRect, info.DestRect);
 }
 
 int CDVDPlayer::GetSourceBitrate()
@@ -3813,6 +3813,40 @@ int CDVDPlayer::GetSourceBitrate()
   return 0;
 }
 
+void CDVDPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
+{
+  if (index < 0 || index > GetAudioStreamCount() - 1 )
+    return;
+
+  if (index == GetAudioStream())
+    info.bitrate = m_dvdPlayerAudio.GetAudioBitrate();
+  else
+    info.bitrate = m_pDemuxer->GetStreamFromAudioId(index)->iBitRate;
+
+  SelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, index);
+  if(s.language.length() > 0)
+    info.language = s.language;
+
+  if(s.name.length() > 0)
+    info.name = s.name;
+  else
+    info.name += "Unknown";
+
+  if(s.type == STREAM_NONE)
+    info.name += " (Invalid)";
+
+  if (m_pDemuxer)
+  {
+    CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStreamFromAudioId(index));
+    if (stream)
+    {
+      info.channels = stream->iChannels;
+      CStdString codecName;
+      m_pDemuxer->GetStreamCodecName(stream->iId, codecName);
+      info.audioCodecName = codecName;
+    }
+  }
+}
 
 int CDVDPlayer::AddSubtitleFile(const std::string& filename, const std::string& subfilename, CDemuxStream::EFlags flags)
 {
@@ -3861,8 +3895,6 @@ void CDVDPlayer::UpdatePlayState(double timeout)
     state.dts = m_CurrentVideo.dts;
   else if(m_CurrentAudio.dts != DVD_NOPTS_VALUE)
     state.dts = m_CurrentAudio.dts;
-  else
-    state.dts = DVD_NOPTS_VALUE;
 
   if(m_pDemuxer)
   {
@@ -3934,7 +3966,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
 
   if (state.time_src == ETIMESOURCE_CLOCK)
     state.time_offset = m_offset_pts;
-  else
+  else if (state.dts != DVD_NOPTS_VALUE)
     state.time_offset = DVD_MSEC_TO_TIME(state.time) - state.dts;
 
   if (m_CurrentAudio.id >= 0 && m_pDemuxer)
@@ -4027,33 +4059,6 @@ bool CDVDPlayer::Record(bool bOnOff)
   return false;
 }
 
-int CDVDPlayer::GetChannels()
-{
-  if (m_pDemuxer && (m_CurrentAudio.id != -1))
-  {
-    CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStream(m_CurrentAudio.id));
-    if (stream)
-      return stream->iChannels;
-  }
-  return -1;
-}
-
-CStdString CDVDPlayer::GetAudioCodecName()
-{
-  CStdString retVal;
-  if (m_pDemuxer && (m_CurrentAudio.id != -1))
-    m_pDemuxer->GetStreamCodecName(m_CurrentAudio.id, retVal);
-  return retVal;
-}
-
-CStdString CDVDPlayer::GetVideoCodecName()
-{
-  CStdString retVal;
-  if (m_pDemuxer && (m_CurrentVideo.id != -1))
-    m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
-  return retVal;
-}
-
 int CDVDPlayer::GetPictureWidth()
 {
   if (m_pDemuxer && (m_CurrentVideo.id != -1))
@@ -4080,11 +4085,21 @@ bool CDVDPlayer::GetStreamDetails(CStreamDetails &details)
 {
   if (m_pDemuxer)
   {
-    bool result=CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, details);
+    bool result = CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, details);
     if (result && details.GetStreamCount(CStreamDetail::VIDEO) > 0) // this is more correct (dvds in particular)
     {
-      GetVideoAspectRatio(((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect);
-      ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_iDuration = GetTotalTime() / 1000;
+      /* 
+       * We can only obtain the aspect & duration from dvdplayer when the Process() thread is running
+       * and UpdatePlayState() has been called at least once. In this case dvdplayer duration/AR will
+       * return 0 and we'll have to fallback to the (less accurate) info from the demuxer.
+       */
+      float aspect = m_dvdPlayerVideo.GetAspectRatio();
+      if (aspect > 0.0f)
+        ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect = aspect;
+
+      int64_t duration = GetTotalTime() / 1000;
+      if (duration > 0)
+        ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_iDuration = duration;
     }
     return result;
   }
index ec09bc8..715f748 100644 (file)
@@ -193,8 +193,6 @@ public:
   virtual void GetVideoInfo(CStdString& strVideoInfo);
   virtual void GetGeneralInfo( CStdString& strVideoInfo);
   virtual void Update(bool bPauseDrawing)                       { m_dvdPlayerVideo.Update(bPauseDrawing); }
-  virtual void GetVideoRect(CRect& SrcRect, CRect& DestRect)    { m_dvdPlayerVideo.GetVideoRect(SrcRect, DestRect); }
-  virtual void GetVideoAspectRatio(float& fAR)                  { fAR = m_dvdPlayerVideo.GetAspectRatio(); }
   virtual bool CanRecord();
   virtual bool IsRecording();
   virtual bool CanPause();
@@ -206,19 +204,15 @@ public:
   virtual float GetSubTitleDelay();
   virtual int GetSubtitleCount();
   virtual int GetSubtitle();
-  virtual void GetSubtitleName(int iStream, CStdString &strStreamName);
-  virtual void GetSubtitleLanguage(int iStream, CStdString &strStreamLang);
+  virtual void GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
   virtual void SetSubtitle(int iStream);
   virtual bool GetSubtitleVisible();
   virtual void SetSubtitleVisible(bool bVisible);
-  virtual bool GetSubtitleExtension(CStdString &strSubtitleExtension) { return false; }
   virtual int  AddSubtitle(const CStdString& strSubPath);
 
   virtual int GetAudioStreamCount();
   virtual int GetAudioStream();
-  virtual void GetAudioStreamName(int iStream, CStdString &strStreamName);
   virtual void SetAudioStream(int iStream);
-  virtual void GetAudioStreamLanguage(int iStream, CStdString &strLanguage);
 
   virtual TextCacheStruct_t* GetTeletextCache();
   virtual void LoadPage(int p, int sp, unsigned char* buffer);
@@ -234,15 +228,13 @@ public:
   virtual void ToFFRW(int iSpeed);
   virtual bool OnAction(const CAction &action);
   virtual bool HasMenu();
-  virtual int GetAudioBitrate();
-  virtual int GetVideoBitrate();
+
   virtual int GetSourceBitrate();
-  virtual int GetChannels();
-  virtual CStdString GetAudioCodecName();
-  virtual CStdString GetVideoCodecName();
+  virtual void GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
   virtual int GetPictureWidth();
   virtual int GetPictureHeight();
   virtual bool GetStreamDetails(CStreamDetails &details);
+  virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
 
   virtual bool GetCurrentSubtitle(CStdString& strSubtitle);
 
index 29c8d57..540d890 100644 (file)
@@ -222,6 +222,7 @@ void CDVDPlayerSubtitle::Process(double pts)
     while(pOverlay)
     {
       m_pOverlayContainer->Add(pOverlay);
+      pOverlay->Release();
       pOverlay = m_pSubtitleFileParser->Parse(pts);
     }
 
index 944bf06..3cd1e95 100644 (file)
@@ -47,7 +47,13 @@ public:
     m_filename = strFile;
   }
   virtual ~CDVDSubtitleParserCollection() { }
-  virtual CDVDOverlay* Parse(double iPts) { return m_collection.Get(iPts); }
+  virtual CDVDOverlay* Parse(double iPts)
+  {
+    CDVDOverlay* o = m_collection.Get(iPts);
+    if(o == NULL)
+      return o;
+    return o->Clone();
+  }
   virtual void         Reset()            { m_collection.Reset(); }
   virtual void         Dispose()          { m_collection.Clear(); }
 
index e6e32e1..6ae8143 100644 (file)
@@ -28,6 +28,8 @@
 #include "utils/XBMCTinyXML.h"
 #include "PlatformDefs.h"
 #include "URL.h"
+#include "pvr/recordings/PVRRecordings.h"
+#include "pvr/PVRManager.h"
 
 extern "C"
 {
@@ -152,6 +154,17 @@ bool CEdl::ReadEditDecisionLists(const CStdString& strMovie, const float fFrameR
     bFound |= ReadMythCutList(strMovie, fFramesPerSecond);
   }
 
+  /*
+   * PVR Recordings
+   */
+  else if (URIUtils::IsPVRRecording(strMovie))
+  {
+    CLog::Log(LOGDEBUG, "%s - Checking for edit decision list (EDL) for PVR recording: %s",
+      __FUNCTION__, strMovie.c_str());
+
+    bFound = ReadPvr(strMovie);
+  }
+
   if (bFound)
   {
     MergeShortCommBreaks();
@@ -585,6 +598,71 @@ bool CEdl::ReadBeyondTV(const CStdString& strMovie)
   }
 }
 
+bool CEdl::ReadPvr(const CStdString &strMovie)
+{
+  if (!PVR::g_PVRManager.IsStarted())
+  {
+    CLog::Log(LOGERROR, "%s - PVR Manager not started, cannot read Edl for %s", __FUNCTION__, strMovie.c_str());
+    return false;
+  }
+
+  CFileItemPtr tag =  PVR::g_PVRRecordings->GetByPath(strMovie);
+  if (tag && tag->HasPVRRecordingInfoTag())
+  {
+    CLog::Log(LOGDEBUG, "%s - Reading Edl for recording: %s", __FUNCTION__, tag->GetPVRRecordingInfoTag()->m_strTitle.c_str());
+  }
+  else
+  {
+    CLog::Log(LOGERROR, "%s - Unable to find PVR recording: %s", __FUNCTION__, strMovie.c_str());
+    return false;
+  }
+
+  std::vector<PVR_EDL_ENTRY> edl = tag->GetPVRRecordingInfoTag()->GetEdl();
+  std::vector<PVR_EDL_ENTRY>::const_iterator it;
+  for (it = edl.begin(); it != edl.end(); ++it)
+  {
+    Cut cut;
+    cut.start = it->start;
+    cut.end = it->end;
+
+    switch (it->type)
+    {
+    case PVR_EDL_TYPE_CUT:
+      cut.action = CUT;
+      break;
+    case PVR_EDL_TYPE_MUTE:
+      cut.action = MUTE;
+      break;
+    case PVR_EDL_TYPE_SCENE:
+      //cut.action = SCENE;
+      //break;
+      CLog::Log(LOGINFO, "%s - Ignoring entry of type SCENE", __FUNCTION__);
+      continue;
+    case PVR_EDL_TYPE_COMBREAK:
+      cut.action = COMM_BREAK;
+      break;
+    default:
+      CLog::Log(LOGINFO, "%s - Ignoring entry of unknown type: %d", __FUNCTION__, it->type);
+      continue;
+    }
+
+    if (AddCut(cut))
+    {
+      CLog::Log(LOGDEBUG, "%s - Added break [%s - %s] found in PVRRecording for: %s.",
+        __FUNCTION__, MillisecondsToTimeString(cut.start).c_str(),
+        MillisecondsToTimeString(cut.end).c_str(), strMovie.c_str());
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "%s - Invalid break [%s - %s] found in PVRRecording for: %s. Continuing anyway.",
+        __FUNCTION__, MillisecondsToTimeString(cut.start).c_str(),
+        MillisecondsToTimeString(cut.end).c_str(), strMovie.c_str());
+    }
+  }
+
+ return !edl.empty();
+}
+
 bool CEdl::AddCut(Cut& cut)
 {
   if (cut.action != CUT && cut.action != MUTE && cut.action != COMM_BREAK)
index fe378bc..63b289c 100644 (file)
@@ -74,6 +74,7 @@ private:
   bool ReadComskip(const CStdString& strMovie, const float fFramesPerSecond);
   bool ReadVideoReDo(const CStdString& strMovie);
   bool ReadBeyondTV(const CStdString& strMovie);
+  bool ReadPvr(const CStdString& strMovie);
   bool ReadMythCommBreakList(const CStdString& strMovie, const float fFramesPerSecond);
   bool ReadMythCutList(const CStdString& strMovie, const float fFramesPerSecond);
 
diff --git a/xbmc/cores/omxplayer/DllOMX.h b/xbmc/cores/omxplayer/DllOMX.h
deleted file mode 100644 (file)
index 6c02c64..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#if defined(HAVE_OMXLIB)
-
-#if (defined HAVE_CONFIG_H) && (!defined WIN32)
-  #include "config.h"
-#endif
-#ifndef __GNUC__
-#pragma warning(push)
-#pragma warning(disable:4244)
-#endif
-
-#include "DynamicDll.h"
-#include "utils/log.h"
-
-#include <IL/OMX_Core.h>
-#include <IL/OMX_Component.h>
-#include <IL/OMX_Index.h>
-#include <IL/OMX_Image.h>
-#include <IL/OMX_Video.h>
-#include <IL/OMX_Broadcom.h>
-
-////////////////////////////////////////////////////////////////////////////////////////////
-
-class DllOMXInterface
-{
-public:
-  virtual ~DllOMXInterface() {}
-
-  virtual OMX_ERRORTYPE OMX_Init(void) = 0;
-  virtual OMX_ERRORTYPE OMX_Deinit(void) = 0;
-  virtual OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE *pHandle, OMX_STRING cComponentName, OMX_PTR pAppData, OMX_CALLBACKTYPE *pCallBacks) = 0;
-  virtual OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE hComponent) = 0;
-  virtual OMX_ERRORTYPE OMX_GetComponentsOfRole(OMX_STRING role, OMX_U32 *pNumComps, OMX_U8 **compNames) = 0;
-  virtual OMX_ERRORTYPE OMX_GetRolesOfComponent(OMX_STRING compName, OMX_U32 *pNumRoles, OMX_U8 **roles) = 0;
-  virtual OMX_ERRORTYPE OMX_ComponentNameEnum(OMX_STRING cComponentName, OMX_U32 nNameLength, OMX_U32 nIndex) = 0;
-  virtual OMX_ERRORTYPE OMX_SetupTunnel(OMX_HANDLETYPE hOutput, OMX_U32 nPortOutput, OMX_HANDLETYPE hInput, OMX_U32 nPortInput) = 0;
-
-};
-
-#if (defined USE_EXTERNAL_OMX)
-class DllOMX : public DllDynamic, DllOMXInterface
-{
-public:
-  virtual OMX_ERRORTYPE OMX_Init(void) 
-    { return ::OMX_Init(); };
-  virtual OMX_ERRORTYPE OMX_Deinit(void) 
-    { return ::OMX_Deinit(); };
-  virtual OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE *pHandle, OMX_STRING cComponentName, OMX_PTR pAppData, OMX_CALLBACKTYPE *pCallBacks)
-    { return ::OMX_GetHandle(pHandle, cComponentName, pAppData, pCallBacks); };
-  virtual OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE hComponent)
-    { return ::OMX_FreeHandle(hComponent); };
-  virtual OMX_ERRORTYPE OMX_GetComponentsOfRole(OMX_STRING role, OMX_U32 *pNumComps, OMX_U8 **compNames) 
-    { return ::OMX_GetComponentsOfRole(role, pNumComps, compNames); };
-  virtual OMX_ERRORTYPE OMX_GetRolesOfComponent(OMX_STRING compName, OMX_U32 *pNumRoles, OMX_U8 **roles)
-    { return ::OMX_GetRolesOfComponent(compName, pNumRoles, roles); };
-  virtual OMX_ERRORTYPE OMX_ComponentNameEnum(OMX_STRING cComponentName, OMX_U32 nNameLength, OMX_U32 nIndex)
-    { return ::OMX_ComponentNameEnum(cComponentName, nNameLength, nIndex); };
-  virtual OMX_ERRORTYPE OMX_SetupTunnel(OMX_HANDLETYPE hOutput, OMX_U32 nPortOutput, OMX_HANDLETYPE hInput, OMX_U32 nPortInput)
-    { return ::OMX_SetupTunnel(hOutput, nPortOutput, hInput, nPortInput); };
-  virtual bool ResolveExports() 
-    { return true; }
-  virtual bool Load() 
-  {
-    CLog::Log(LOGDEBUG, "DllOMX: Using omx system library");
-    return true;
-  }
-  virtual void Unload() {}
-};
-#else
-class DllOMX : public DllDynamic, DllOMXInterface
-{
-  //DECLARE_DLL_WRAPPER(DllLibOpenMax, "/usr/lib/libnvomx.so")
-  DECLARE_DLL_WRAPPER(DllOMX, "/opt/vc/lib/libopenmaxil.so")
-
-  DEFINE_METHOD0(OMX_ERRORTYPE, OMX_Init)
-  DEFINE_METHOD0(OMX_ERRORTYPE, OMX_Deinit)
-  DEFINE_METHOD4(OMX_ERRORTYPE, OMX_GetHandle, (OMX_HANDLETYPE *p1, OMX_STRING p2, OMX_PTR p3, OMX_CALLBACKTYPE *p4))
-  DEFINE_METHOD1(OMX_ERRORTYPE, OMX_FreeHandle, (OMX_HANDLETYPE p1))
-  DEFINE_METHOD3(OMX_ERRORTYPE, OMX_GetComponentsOfRole, (OMX_STRING p1, OMX_U32 *p2, OMX_U8 **p3))
-  DEFINE_METHOD3(OMX_ERRORTYPE, OMX_GetRolesOfComponent, (OMX_STRING p1, OMX_U32 *p2, OMX_U8 **p3))
-  DEFINE_METHOD3(OMX_ERRORTYPE, OMX_ComponentNameEnum, (OMX_STRING p1, OMX_U32 p2, OMX_U32 p3))
-  DEFINE_METHOD4(OMX_ERRORTYPE, OMX_SetupTunnel, (OMX_HANDLETYPE p1, OMX_U32 p2, OMX_HANDLETYPE p3, OMX_U32 p4));
-  BEGIN_METHOD_RESOLVE()
-    RESOLVE_METHOD(OMX_Init)
-    RESOLVE_METHOD(OMX_Deinit)
-    RESOLVE_METHOD(OMX_GetHandle)
-    RESOLVE_METHOD(OMX_FreeHandle)
-    RESOLVE_METHOD(OMX_GetComponentsOfRole)
-    RESOLVE_METHOD(OMX_GetRolesOfComponent)
-    RESOLVE_METHOD(OMX_ComponentNameEnum)
-    RESOLVE_METHOD(OMX_SetupTunnel)
-  END_METHOD_RESOLVE()
-
-public:
-  virtual bool Load()
-  {
-    return DllDynamic::Load();
-  }
-};
-#endif
-
-#endif
index 340bbb2..4420da2 100644 (file)
@@ -104,14 +104,6 @@ void COMXSelectionStreams::Clear(StreamType type, StreamSource source)
   }
 }
 
-void COMXPlayer::GetAudioStreamLanguage(int iStream, CStdString &strLanguage)
-{
-  strLanguage = "";
-  OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
-  if(s.language.length() > 0)
-    strLanguage = s.language;
-}
-
 OMXSelectionStream& COMXSelectionStreams::Get(StreamType type, int index)
 {
   CSingleLock lock(m_section);
@@ -1043,11 +1035,8 @@ void COMXPlayer::Process()
   if (!CachePVRStream())
     SetCaching(CACHESTATE_FLUSH);
 
-  // stop thumb jobs
-  CJobManager::GetInstance().Pause(kJobTypeMediaFlags);
-
   /*
-  if (CJobManager::GetInstance().IsProcessing(kJobTypeMediaFlags) > 0)
+  if (CJobManager::GetInstance().IsProcessing(CJob::PRIORITY_LOW))
   {
     if (!WaitForPausedThumbJobs(20000))
     {
@@ -1273,9 +1262,6 @@ void COMXPlayer::Process()
     // check if in a cut or commercial break that should be automatically skipped
     CheckAutoSceneSkip();
   }
-
-  // let thumbgen jobs resume.
-  CJobManager::GetInstance().UnPause(kJobTypeMediaFlags);
 }
 
 bool COMXPlayer::CheckDelayedChannelEntry(void)
@@ -2698,24 +2684,25 @@ int COMXPlayer::GetSubtitle()
   return m_SelectionStreams.IndexOf(STREAM_SUBTITLE, *this);
 }
 
-void COMXPlayer::GetSubtitleName(int iStream, CStdString &strStreamName)
+void COMXPlayer::GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info)
 {
-  strStreamName = "";
-  OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+  if (index < 0 || index > (int) GetSubtitleCount() - 1)
+    return;
+
+  OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, index);
   if(s.name.length() > 0)
-    strStreamName = s.name;
+    info.name = s.name;
   else
-    strStreamName = g_localizeStrings.Get(13205); // Unknown
+    info.name = g_localizeStrings.Get(13205); // Unknown
 
   if(s.type == STREAM_NONE)
-    strStreamName += "(Invalid)";
-}
+    info.name += "(Invalid)";
 
-void COMXPlayer::GetSubtitleLanguage(int iStream, CStdString &strStreamLang)
-{
-  OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_SUBTITLE, iStream);
+  CStdString strStreamLang;
   if (!g_LangCodeExpander.Lookup(strStreamLang, s.language))
-    strStreamLang = g_localizeStrings.Get(13205); // Unknown
+    info.language = g_localizeStrings.Get(13205); // Unknown
+  else
+    info.language = strStreamLang;
 }
 
 void COMXPlayer::SetSubtitle(int iStream)
@@ -2754,19 +2741,6 @@ int COMXPlayer::GetAudioStream()
 {
   return m_SelectionStreams.IndexOf(STREAM_AUDIO, *this);
 }
-
-void COMXPlayer::GetAudioStreamName(int iStream, CStdString &strStreamName)
-{
-  strStreamName = "";
-  OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, iStream);
-  if(s.name.length() > 0)
-    strStreamName += s.name;
-  else
-    strStreamName += "Unknown";
-
-  if(s.type == STREAM_NONE)
-    strStreamName += " (Invalid)";
-}
  
 void COMXPlayer::SetAudioStream(int iStream)
 {
@@ -3574,7 +3548,7 @@ bool COMXPlayer::OnAction(const CAction &action)
       case ACTION_MOUSE_LEFT_CLICK:
         {
           CRect rs, rd;
-          GetVideoRect(rs, rd);
+          g_renderManager.GetVideoRect(rs, rd);
           CPoint pt(action.GetAmount(), action.GetAmount(1));
           if (!rd.PtInRect(pt))
             return false; // out of bounds
@@ -3799,14 +3773,51 @@ double COMXPlayer::GetQueueTime()
   return max(a, v) * 8000.0 / 100;
 }
 
-int COMXPlayer::GetAudioBitrate()
+void COMXPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
 {
-  return m_player_audio.GetAudioBitrate();
+  if (index < 0 || index > GetAudioStreamCount() - 1)
+    return;
+
+  if (index == GetAudioStream())
+    info.bitrate = m_player_audio.GetAudioBitrate();
+  else
+    info.bitrate = m_pDemuxer->GetStreamFromAudioId(index)->iBitRate;
+
+  OMXSelectionStream& s = m_SelectionStreams.Get(STREAM_AUDIO, index);
+  if(s.language.length() > 0)
+    info.language = s.language;
+
+  if(s.name.length() > 0)
+    info.name = s.name;
+  else
+    info.name += "Unknown";
+
+  if(s.type == STREAM_NONE)
+    info.name += " (Invalid)";
+
+  if (m_pDemuxer)
+  {
+    CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStreamFromAudioId(index));
+    if (stream)
+    {
+      info.channels = stream->iChannels;
+      CStdString codecName;
+      m_pDemuxer->GetStreamCodecName(stream->iId, codecName);
+      info.audioCodecName = codecName;
+    }
+  }
 }
 
-int COMXPlayer::GetVideoBitrate()
+void COMXPlayer::GetVideoStreamInfo(SPlayerVideoStreamInfo &info)
 {
-  return m_player_video.GetVideoBitrate();
+  info.bitrate = m_player_video.GetVideoBitrate();
+
+  CStdString retVal;
+  if (m_pDemuxer && (m_CurrentVideo.id != -1))
+    m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
+  info.videoCodecName = retVal;
+  info.videoAspectRatio = g_renderManager.GetAspectRatio();
+  g_renderManager.GetVideoRect(info.SrcRect, info.DestRect);
 }
 
 int COMXPlayer::GetSourceBitrate()
@@ -4027,33 +4038,6 @@ bool COMXPlayer::Record(bool bOnOff)
   return false;
 }
 
-int COMXPlayer::GetChannels()
-{
-  if (m_pDemuxer && (m_CurrentAudio.id != -1))
-  {
-    CDemuxStreamAudio* stream = static_cast<CDemuxStreamAudio*>(m_pDemuxer->GetStream(m_CurrentAudio.id));
-    if (stream)
-      return stream->iChannels;
-  }
-  return -1;
-}
-
-CStdString COMXPlayer::GetAudioCodecName()
-{
-  CStdString retVal;
-  if (m_pDemuxer && (m_CurrentAudio.id != -1))
-    m_pDemuxer->GetStreamCodecName(m_CurrentAudio.id, retVal);
-  return retVal;
-}
-
-CStdString COMXPlayer::GetVideoCodecName()
-{
-  CStdString retVal;
-  if (m_pDemuxer && (m_CurrentVideo.id != -1))
-    m_pDemuxer->GetStreamCodecName(m_CurrentVideo.id, retVal);
-  return retVal;
-}
-
 int COMXPlayer::GetPictureWidth()
 {
   if (m_pDemuxer && (m_CurrentVideo.id != -1))
@@ -4083,7 +4067,7 @@ bool COMXPlayer::GetStreamDetails(CStreamDetails &details)
     bool result=CDVDFileInfo::DemuxerToStreamDetails(m_pInputStream, m_pDemuxer, details);
     if (result && details.GetStreamCount(CStreamDetail::VIDEO) > 0) // this is more correct (dvds in particular)
     {
-      GetVideoAspectRatio(((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect);
+      ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_fAspect = g_renderManager.GetAspectRatio();
       ((CStreamDetailVideo*)details.GetNthStream(CStreamDetail::VIDEO,0))->m_iDuration = GetTotalTime() / 1000;
     }
     return result;
@@ -4132,11 +4116,6 @@ bool COMXPlayer::CachePVRStream(void) const
       g_advancedSettings.m_bPVRCacheInDvdPlayer;
 }
 
-void COMXPlayer::GetVideoRect(CRect& SrcRect, CRect& DestRect)
-{
-  g_renderManager.GetVideoRect(SrcRect, DestRect);
-}
-
 void COMXPlayer::SetMute(bool bOnOff)
 {
   m_current_mute = bOnOff;
@@ -4154,7 +4133,7 @@ bool COMXPlayer::WaitForPausedThumbJobs(int timeout_ms)
   // use m_bStop and Sleep so we can get canceled.
   while (!m_bStop && (timeout_ms > 0))
   {
-    if (CJobManager::GetInstance().IsProcessing(kJobTypeMediaFlags) > 0)
+    if (CJobManager::GetInstance().IsProcessing(CJob::PRIORITY_LOW))
     {
       Sleep(100);
       timeout_ms -= 100;
@@ -4171,11 +4150,6 @@ void COMXPlayer::Update(bool bPauseDrawing)
   g_renderManager.Update(bPauseDrawing);
 }
 
-void COMXPlayer::GetVideoAspectRatio(float &fAR)
-{
-  fAR = g_renderManager.GetAspectRatio();
-}
-
 void COMXPlayer::GetRenderFeatures(std::vector<int> &renderFeatures)
 {
   renderFeatures.push_back(RENDERFEATURE_STRETCH);
index 39e41a4..40d9a05 100644 (file)
@@ -235,8 +235,6 @@ public:
   virtual void  GetVideoInfo(CStdString &strVideoInfo);
   virtual void  GetGeneralInfo(CStdString &strVideoInfo);
   virtual void  Update(bool bPauseDrawing);
-  virtual void  GetVideoRect(CRect& SrcRect, CRect& DestRect);
-  virtual void  GetVideoAspectRatio(float &fAR);
   virtual void  UpdateApplication(double timeout);
   virtual bool  CanRecord();
   virtual bool  IsRecording();
@@ -249,19 +247,15 @@ public:
   virtual float GetSubTitleDelay();
   virtual int   GetSubtitleCount();
   virtual int   GetSubtitle();
-  virtual void  GetSubtitleName(int iStream, CStdString &strStreamName);
-  virtual void  GetSubtitleLanguage(int iStream, CStdString &strStreamLang);
+  virtual void  GetSubtitleStreamInfo(int index, SPlayerSubtitleStreamInfo &info);
   virtual void  SetSubtitle(int iStream);
   virtual bool  GetSubtitleVisible();
   virtual void  SetSubtitleVisible(bool bVisible);
-  virtual bool  GetSubtitleExtension(CStdString &strSubtitleExtension) { return false; }
   virtual int   AddSubtitle(const CStdString& strSubPath);
 
   virtual int   GetAudioStreamCount();
   virtual int   GetAudioStream();
-  virtual void  GetAudioStreamName(int iStream, CStdString &strStreamName);
   virtual void  SetAudioStream(int iStream);
-  virtual void  GetAudioStreamLanguage(int iStream, CStdString &strLanguage);
 
   virtual TextCacheStruct_t* GetTeletextCache();
   virtual void  LoadPage(int p, int sp, unsigned char* buffer);
@@ -276,12 +270,9 @@ public:
   virtual int64_t GetTime();
   virtual int64_t GetTotalTime();
   virtual void  ToFFRW(int iSpeed = 0);
-  virtual int   GetAudioBitrate();
-  virtual int   GetVideoBitrate();
+  virtual void  GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
+  virtual void  GetVideoStreamInfo(SPlayerVideoStreamInfo &info);
   virtual int   GetSourceBitrate();
-  virtual int   GetChannels();
-  virtual CStdString GetAudioCodecName();
-  virtual CStdString GetVideoCodecName();
   virtual int   GetPictureWidth();
   virtual int   GetPictureHeight();
   virtual bool  GetStreamDetails(CStreamDetails &details);
index 58c3a4f..16ea6c3 100644 (file)
@@ -369,13 +369,9 @@ bool OMXPlayerAudio::Decode(DemuxPacket *pkt, bool bDropPacket)
 
       while(!m_bStop)
       {
+        // discard if flushing as clocks may be stopped and we'll never submit it
         if(m_flush)
-        {
-          CSingleLock lock(m_flushLock);
-          m_flush = false;
-          lock.Leave();
           break;
-        }
 
         if(m_omxAudio.GetSpace() < (unsigned int)pkt->iSize)
         {
@@ -420,12 +416,7 @@ bool OMXPlayerAudio::Decode(DemuxPacket *pkt, bool bDropPacket)
     while(!m_bStop)
     {
       if(m_flush)
-      {
-        CSingleLock lock(m_flushLock);
-        m_flush = false;
-        lock.Leave();
         break;
-      }
 
       if(m_omxAudio.GetSpace() < (unsigned int)pkt->iSize)
       {
@@ -544,6 +535,7 @@ void OMXPlayerAudio::Process()
       }
       else
         CLog::Log(LOGDEBUG, "COMXPlayerAudio - CDVDMsg::GENERAL_RESYNC(%f, 0)", m_audioClock);
+      m_flush = false;
     }
     else if (pMsg->IsType(CDVDMsg::GENERAL_RESET))
     {
@@ -627,7 +619,6 @@ void OMXPlayerAudio::Process()
 
 void OMXPlayerAudio::Flush()
 {
-  CSingleLock lock(m_flushLock);
   m_flush = true;
   m_messageQueue.Flush();
   m_messageQueue.Put( new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 1);
index d10133e..d6083e9 100644 (file)
@@ -42,7 +42,6 @@ using namespace std;
 class OMXPlayerAudio : public CThread
 {
 protected:
-  CCriticalSection      m_flushLock;
   CDVDMessageQueue      m_messageQueue;
   CDVDMessageQueue      &m_messageParent;
 
index ec7e7f6..3e27f4f 100644 (file)
@@ -83,9 +83,6 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock,
   m_iSubtitleDelay        = 0;
   m_FlipTimeStamp         = 0.0;
   m_bRenderSubs           = false;
-  m_width                 = 0;
-  m_height                = 0;
-  m_fps                   = 0.0f;
   m_flags                 = 0;
   m_bAllowFullscreen      = false;
   m_iCurrentPts           = DVD_NOPTS_VALUE;
@@ -98,12 +95,7 @@ OMXPlayerVideo::OMXPlayerVideo(OMXClock *av_clock,
   m_messageQueue.SetMaxDataSize(10 * 1024 * 1024);
   m_messageQueue.SetMaxTimeSize(8.0);
 
-  RESOLUTION res  = g_graphicsContext.GetVideoResolution();
-  m_video_width   = g_settings.m_ResInfo[res].iScreenWidth;
-  m_video_height  = g_settings.m_ResInfo[res].iScreenHeight;
-
   m_dst_rect.SetRect(0, 0, 0, 0);
-
 }
 
 OMXPlayerVideo::~OMXPlayerVideo()
@@ -122,9 +114,12 @@ bool OMXPlayerVideo::OpenStream(CDVDStreamInfo &hints)
   m_Deinterlace = ( g_settings.m_currentVideoSettings.m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF ) ? false : true;
   m_hdmi_clock_sync = (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF);
   m_started     = false;
+  m_flush       = false;
   m_stalled     = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
   m_autosync    = 1;
   m_iSleepEndTime = DVD_NOPTS_VALUE;
+  // force SetVideoRect to be called initially
+  m_dst_rect.SetRect(0, 0, 0, 0);
 
   m_audio_count = m_av_clock->HasAudio();
 
@@ -220,154 +215,45 @@ void OMXPlayerVideo::ProcessOverlays(int iGroupId, double pts)
   if (m_started)
     m_pOverlayContainer->CleanUp(pts - m_iSubtitleDelay);
 
-  enum EOverlay
-  { OVERLAY_AUTO // select mode auto
-  , OVERLAY_GPU  // render osd using gpu
-  , OVERLAY_BUF  // render osd on buffer
-  } render = OVERLAY_AUTO;
-
-  /*
-  if(m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SPU)
-    || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_IMAGE)
-    || m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) )
-      render = OVERLAY_BUF;
-  */
-
-  if(render == OVERLAY_BUF)
-  {
-    // rendering spu overlay types directly on video memory costs a lot of processing power.
-    // thus we allocate a temp picture, copy the original to it (needed because the same picture can be used more than once).
-    // then do all the rendering on that temp picture and finaly copy it to video memory.
-    // In almost all cases this is 5 or more times faster!.
-
-    if(m_pTempOverlayPicture && ( m_pTempOverlayPicture->iWidth  != m_width
-                               || m_pTempOverlayPicture->iHeight != m_height))
-    {
-      CDVDCodecUtils::FreePicture(m_pTempOverlayPicture);
-      m_pTempOverlayPicture = NULL;
-    }
-
-    if(!m_pTempOverlayPicture)
-      m_pTempOverlayPicture = CDVDCodecUtils::AllocatePicture(m_width, m_height);
-    if(!m_pTempOverlayPicture)
-      return;
-    m_pTempOverlayPicture->format = RENDER_FMT_YUV420P;
-  }
-
-  if(render == OVERLAY_AUTO)
-    render = OVERLAY_GPU;
-
   VecOverlays overlays;
 
-  {
-    CSingleLock lock(*m_pOverlayContainer);
-
-    VecOverlays* pVecOverlays = m_pOverlayContainer->GetOverlays();
-    VecOverlaysIter it = pVecOverlays->begin();
-
-    //Check all overlays and render those that should be rendered, based on time and forced
-    //Both forced and subs should check timeing, pts == 0 in the stillframe case
-    while (it != pVecOverlays->end())
-    {
-      CDVDOverlay* pOverlay = *it++;
-      if(!pOverlay->bForced && !m_bRenderSubs)
-        continue;
+  CSingleLock lock(*m_pOverlayContainer);
 
-      if(pOverlay->iGroupId != iGroupId)
-        continue;
+  VecOverlays* pVecOverlays = m_pOverlayContainer->GetOverlays();
+  VecOverlaysIter it = pVecOverlays->begin();
 
-      double pts2 = pOverlay->bForced ? pts : pts - m_iSubtitleDelay;
+  //Check all overlays and render those that should be rendered, based on time and forced
+  //Both forced and subs should check timeing, pts == 0 in the stillframe case
+  while (it != pVecOverlays->end())
+  {
+    CDVDOverlay* pOverlay = *it++;
+    if(!pOverlay->bForced && !m_bRenderSubs)
+      continue;
 
-      if((pOverlay->iPTSStartTime <= pts2 && (pOverlay->iPTSStopTime > pts2 || pOverlay->iPTSStopTime == 0LL)) || pts == 0)
-      {
-        if(pOverlay->IsOverlayType(DVDOVERLAY_TYPE_GROUP))
-          overlays.insert(overlays.end(), static_cast<CDVDOverlayGroup*>(pOverlay)->m_overlays.begin()
-                                        , static_cast<CDVDOverlayGroup*>(pOverlay)->m_overlays.end());
-        else
-          overlays.push_back(pOverlay);
+    if(pOverlay->iGroupId != iGroupId)
+      continue;
 
-      }
-    }
+    double pts2 = pOverlay->bForced ? pts : pts - m_iSubtitleDelay;
 
-    for(it = overlays.begin(); it != overlays.end(); ++it)
+    if((pOverlay->iPTSStartTime <= pts2 && (pOverlay->iPTSStopTime > pts2 || pOverlay->iPTSStopTime == 0LL)) || pts == 0)
     {
-      double pts2 = (*it)->bForced ? pts : pts - m_iSubtitleDelay;
-
-      if (render == OVERLAY_GPU)
-        g_renderManager.AddOverlay(*it, pts2);
-
-      /*
-      printf("subtitle : DVDOVERLAY_TYPE_SPU %d DVDOVERLAY_TYPE_IMAGE %d DVDOVERLAY_TYPE_SSA %d\n",
-         m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SPU),
-         m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_IMAGE),
-         m_pOverlayContainer->ContainsOverlayType(DVDOVERLAY_TYPE_SSA) );
-      */
-
-      if (render == OVERLAY_BUF)
-        CDVDOverlayRenderer::Render(m_pTempOverlayPicture, *it, pts2);
+      if(pOverlay->IsOverlayType(DVDOVERLAY_TYPE_GROUP))
+        overlays.insert(overlays.end(), static_cast<CDVDOverlayGroup*>(pOverlay)->m_overlays.begin()
+                                      , static_cast<CDVDOverlayGroup*>(pOverlay)->m_overlays.end());
+      else
+        overlays.push_back(pOverlay);
     }
   }
-}
-
-void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket)
-{
 
-  if (!g_renderManager.IsConfigured()
-    || m_video_width != m_width
-    || m_video_height != m_height
-    || m_fps != m_fFrameRate)
+  for(it = overlays.begin(); it != overlays.end(); ++it)
   {
-    m_width   = m_video_width;
-    m_height  = m_video_height;
-    m_fps     = m_fFrameRate;
-
-    unsigned flags = 0;
-    ERenderFormat format = RENDER_FMT_BYPASS;
-
-    if(m_bAllowFullscreen)
-    {
-      flags |= CONF_FLAGS_FULLSCREEN;
-      m_bAllowFullscreen = false; // only allow on first configure
-    }
-
-    if(m_flags & CONF_FLAGS_FORMAT_SBS)
-    {
-      if(g_Windowing.Support3D(m_video_width, m_video_height, D3DPRESENTFLAG_MODE3DSBS))
-      {
-        CLog::Log(LOGNOTICE, "3DSBS movie found");
-        flags |= CONF_FLAGS_FORMAT_SBS;
-      }
-    }
-    else if(m_flags & CONF_FLAGS_FORMAT_TB)
-    {
-      if(g_Windowing.Support3D(m_video_width, m_video_height, D3DPRESENTFLAG_MODE3DTB))
-      {
-        CLog::Log(LOGNOTICE, "3DTB movie found");
-        flags |= CONF_FLAGS_FORMAT_TB;
-      }
-    }
-
-    unsigned int iDisplayWidth  = m_hints.width;
-    unsigned int iDisplayHeight = m_hints.height;
-
-    /* use forced aspect if any */
-    if( m_fForcedAspectRatio != 0.0f )
-      iDisplayWidth = (int) (iDisplayHeight * m_fForcedAspectRatio);
-
-    CLog::Log(LOGDEBUG,"%s - change configuration. %dx%d. framerate: %4.2f. %dx%x format: BYPASS",
-        __FUNCTION__, m_width, m_height, m_fps, iDisplayWidth, iDisplayHeight);
-
-    if(!g_renderManager.Configure(m_hints.width, m_hints.height,
-          iDisplayWidth, iDisplayHeight, m_fps, flags, format, 0,
-          m_hints.orientation))
-    {
-      CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);
-      return;
-    }
-
-    g_renderManager.RegisterRenderUpdateCallBack((const void*)this, RenderUpdateCallBack);
+    double pts2 = (*it)->bForced ? pts : pts - m_iSubtitleDelay;
+    g_renderManager.AddOverlay(*it, pts2);
   }
+}
 
+void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket)
+{
   if (!g_renderManager.IsStarted()) {
     CLog::Log(LOGERROR, "%s - renderer not started", __FUNCTION__);
     return;
@@ -461,15 +347,15 @@ void OMXPlayerVideo::Output(int iGroupId, double pts, bool bDropPacket)
     m_iSleepEndTime = iCurrentClock + iSleepTime;
   }
 
-  if (!CThread::m_bStop && m_av_clock->GetAbsoluteClock(false) < m_iSleepEndTime)
+  if (!CThread::m_bStop && m_av_clock->GetAbsoluteClock(false) < m_iSleepEndTime + DVD_MSEC_TO_TIME(500))
     return;
 
-  m_iSleepEndTime = DVD_NOPTS_VALUE;
-
   double pts_media = m_av_clock->OMXMediaTime(false, false);
   ProcessOverlays(iGroupId, pts_media);
 
-  g_renderManager.FlipPage(CThread::m_bStop, pts_media / DVD_TIME_BASE, -1, FS_NONE);
+  g_renderManager.FlipPage(CThread::m_bStop, m_iSleepEndTime / DVD_TIME_BASE, -1, FS_NONE);
+
+  m_iSleepEndTime = DVD_NOPTS_VALUE;
 
   //m_av_clock->WaitAbsoluteClock((iCurrentClock + iSleepTime));
 }
@@ -580,17 +466,20 @@ void OMXPlayerVideo::Process()
       m_av_clock->OMXReset(false);
       m_av_clock->UnLock();
       m_started = false;
+      m_iSleepEndTime = DVD_NOPTS_VALUE;
     }
     else if (pMsg->IsType(CDVDMsg::GENERAL_FLUSH)) // private message sent by (COMXPlayerVideo::Flush())
     {
       CLog::Log(LOGDEBUG, "COMXPlayerVideo - CDVDMsg::GENERAL_FLUSH");
       m_stalled = true;
       m_started = false;
+      m_iSleepEndTime = DVD_NOPTS_VALUE;
       m_av_clock->Lock();
       m_av_clock->OMXStop(false);
       m_omxVideo.Reset();
       m_av_clock->OMXReset(false);
       m_av_clock->UnLock();
+      m_flush = false;
     }
     else if (pMsg->IsType(CDVDMsg::PLAYER_SETSPEED))
     {
@@ -631,6 +520,10 @@ void OMXPlayerVideo::Process()
 
       while (!m_bStop)
       {
+        // discard if flushing as clocks may be stopped and we'll never submit it
+        if (m_flush)
+           break;
+
         if((int)m_omxVideo.GetFreeSpace() < pPacket->iSize)
         {
           Sleep(10);
@@ -695,6 +588,7 @@ void OMXPlayerVideo::Process()
 
 void OMXPlayerVideo::Flush()
 {
+  m_flush = true;
   m_messageQueue.Flush();
   m_messageQueue.Put(new CDVDMsg(CDVDMsg::GENERAL_FLUSH), 1);
 }
@@ -722,6 +616,7 @@ bool OMXPlayerVideo::OpenDecoder()
   m_av_clock->OMXStop(false);
 
   bool bVideoDecoderOpen = m_omxVideo.Open(m_hints, m_av_clock, m_Deinterlace, m_hdmi_clock_sync);
+  m_omxVideo.RegisterResolutionUpdateCallBack((void *)this, ResolutionUpdateCallBack);
 
   if(!bVideoDecoderOpen)
   {
@@ -857,3 +752,62 @@ void OMXPlayerVideo::RenderUpdateCallBack(const void *ctx, const CRect &SrcRect,
   player->SetVideoRect(SrcRect, DestRect);
 }
 
+void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height)
+{
+  RESOLUTION res  = g_graphicsContext.GetVideoResolution();
+  uint32_t video_width   = g_settings.m_ResInfo[res].iScreenWidth;
+  uint32_t video_height  = g_settings.m_ResInfo[res].iScreenHeight;
+
+  unsigned flags = 0;
+  ERenderFormat format = RENDER_FMT_BYPASS;
+
+  if(m_bAllowFullscreen)
+  {
+    flags |= CONF_FLAGS_FULLSCREEN;
+    m_bAllowFullscreen = false; // only allow on first configure
+  }
+
+  if(m_flags & CONF_FLAGS_FORMAT_SBS)
+  {
+    if(g_Windowing.Support3D(video_width, video_height, D3DPRESENTFLAG_MODE3DSBS))
+    {
+      CLog::Log(LOGNOTICE, "3DSBS movie found");
+      flags |= CONF_FLAGS_FORMAT_SBS;
+    }
+  }
+  else if(m_flags & CONF_FLAGS_FORMAT_TB)
+  {
+    if(g_Windowing.Support3D(video_width, video_height, D3DPRESENTFLAG_MODE3DTB))
+    {
+      CLog::Log(LOGNOTICE, "3DTB movie found");
+      flags |= CONF_FLAGS_FORMAT_TB;
+    }
+  }
+
+  unsigned int iDisplayWidth  = width;
+  unsigned int iDisplayHeight = height;
+
+  /* use forced aspect if any */
+  if( m_fForcedAspectRatio != 0.0f )
+    iDisplayWidth = (int) (iDisplayHeight * m_fForcedAspectRatio);
+
+  CLog::Log(LOGDEBUG,"%s - change configuration. video:%dx%d. framerate: %4.2f. %dx%d format: BYPASS",
+      __FUNCTION__, video_width, video_height, m_fFrameRate, iDisplayWidth, iDisplayHeight);
+
+  if(!g_renderManager.Configure(width, height,
+        iDisplayWidth, iDisplayHeight, m_fFrameRate, flags, format, 0,
+        m_hints.orientation))
+  {
+    CLog::Log(LOGERROR, "%s - failed to configure renderer", __FUNCTION__);
+    return;
+  }
+
+  g_renderManager.RegisterRenderUpdateCallBack((const void*)this, RenderUpdateCallBack);
+}
+
+void OMXPlayerVideo::ResolutionUpdateCallBack(void *ctx, uint32_t width, uint32_t height)
+{
+  OMXPlayerVideo *player = static_cast<OMXPlayerVideo*>(ctx);
+  player->ResolutionUpdateCallBack(width, height);
+}
+
index cf05c1f..1931bf3 100644 (file)
@@ -61,6 +61,7 @@ protected:
   int                       m_audio_count;
   bool                      m_stalled;
   bool                      m_started;
+  bool                      m_flush;
   std::string               m_codecname;
   double                    m_droptime;
   double                    m_dropbase;
@@ -70,12 +71,7 @@ protected:
   bool                      m_bAllowFullscreen;
 
   float                     m_fForcedAspectRatio;
-  unsigned int              m_width;
-  unsigned int              m_height;
-  unsigned int              m_video_width;
-  unsigned int              m_video_height;
   unsigned                  m_flags;
-  float                     m_fps;
 
   CRect                     m_dst_rect;
   int                       m_view_mode;
@@ -133,5 +129,7 @@ public:
   int GetFreeSpace();
   void  SetVideoRect(const CRect &SrcRect, const CRect &DestRect);
   static void RenderUpdateCallBack(const void *ctx, const CRect &SrcRect, const CRect &DestRect);
+  void ResolutionUpdateCallBack(uint32_t width, uint32_t height);
+  static void ResolutionUpdateCallBack(void *ctx, uint32_t width, uint32_t height);
 };
 #endif
index 3417286..d4b8fbf 100644 (file)
@@ -86,7 +86,6 @@ COMXVideo::COMXVideo()
   m_video_codec_name  = "";
   m_deinterlace       = false;
   m_hdmi_clock_sync   = false;
-  m_first_frame       = true;
 }
 
 COMXVideo::~COMXVideo()
@@ -154,6 +153,9 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace, b
   OMX_ERRORTYPE omx_err   = OMX_ErrorNone;
   std::string decoder_name;
 
+  m_res_ctx           = NULL;
+  m_res_callback      = NULL;
+
   m_video_codec_name      = "";
   m_codingType            = OMX_VIDEO_CodingUnused;
 
@@ -697,7 +699,6 @@ bool COMXVideo::Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace, b
     CLASSNAME, __func__, m_omx_decoder.GetComponent(), m_omx_decoder.GetInputPort(), m_omx_decoder.GetOutputPort(),
     m_deinterlace, m_hdmi_clock_sync);
 
-  m_first_frame   = true;
   // start from assuming all recent frames had valid pts
   m_history_valid_pts = ~0;
 
@@ -736,8 +737,10 @@ void COMXVideo::Close()
   m_video_convert     = false;
   m_video_codec_name  = "";
   m_deinterlace       = false;
-  m_first_frame       = true;
   m_av_clock          = NULL;
+
+  m_res_ctx           = NULL;
+  m_res_callback      = NULL;
 }
 
 void COMXVideo::SetDropState(bool bDrop)
@@ -809,17 +812,12 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts)
         // only send dts on first frame to get nearly correct starttime
         if(pts == DVD_NOPTS_VALUE)
           pts = dts;
-        if(pts == DVD_NOPTS_VALUE)
-          omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN;
-        omx_buffer->nFlags = OMX_BUFFERFLAG_STARTTIME;
+        omx_buffer->nFlags |= OMX_BUFFERFLAG_STARTTIME;
         CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE);
         m_av_clock->VideoStart(false);
       }
-      else
-      {
-        if(pts == DVD_NOPTS_VALUE)
-          omx_buffer->nFlags = OMX_BUFFERFLAG_TIME_UNKNOWN;
-      }
+      if(pts == DVD_NOPTS_VALUE)
+        omx_buffer->nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN;
 
       omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts == DVD_NOPTS_VALUE) ? 0 : pts);
       omx_buffer->nFilledLen = (demuxer_bytes > omx_buffer->nAllocLen) ? omx_buffer->nAllocLen : demuxer_bytes;
@@ -851,57 +849,74 @@ int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts)
         }
       }
 
-      if(m_first_frame && m_deinterlace)
+      omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0);
+      if (omx_err == OMX_ErrorNone)
       {
         OMX_PARAM_PORTDEFINITIONTYPE port_image;
         OMX_INIT_STRUCTURE(port_image);
         port_image.nPortIndex = m_omx_decoder.GetOutputPort();
-
         omx_err = m_omx_decoder.GetParameter(OMX_IndexParamPortDefinition, &port_image);
         if(omx_err != OMX_ErrorNone)
-          CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamPortDefinition 1 omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
+        {
+          CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.GetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
+        }
+        // let OMXPlayerVideo know about resolution so it can inform RenderManager
+        if (m_res_callback)
+          m_res_callback(m_res_ctx, port_image.format.video.nFrameWidth, port_image.format.video.nFrameHeight);
+
+        m_omx_decoder.DisablePort(m_omx_decoder.GetOutputPort(), true);
+        m_omx_sched.DisablePort(m_omx_sched.GetInputPort(), true);
 
-        /* we assume when the sizes equal we have the first decoded frame */
-        if(port_image.format.video.nFrameWidth == m_decoded_width && port_image.format.video.nFrameHeight == m_decoded_height)
+        OMX_CONFIG_INTERLACETYPE interlace;
+        OMX_INIT_STRUCTURE(interlace);
+        interlace.nPortIndex = m_omx_decoder.GetOutputPort();
+        omx_err = m_omx_decoder.GetConfig(OMX_IndexConfigCommonInterlace, &interlace);
+        if(omx_err != OMX_ErrorNone)
         {
-          m_first_frame = false;
+          CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.GetConfig(OMX_IndexConfigCommonInterlace) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
+        }
 
-          omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged);
-          if(omx_err == OMX_ErrorStreamCorrupt)
+        if (m_deinterlace)
+        {
+          m_omx_image_fx.DisablePort(m_omx_image_fx.GetInputPort(), true);
+          port_image.nPortIndex = m_omx_image_fx.GetInputPort();
+          omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition, &port_image);
+          if(omx_err != OMX_ErrorNone)
           {
-            CLog::Log(LOGERROR, "%s::%s - image not unsupported\n", CLASSNAME, __func__);
-            return false;
+            CLog::Log(LOGERROR, "%s::%s - error m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
           }
-
-          m_omx_decoder.DisablePort(m_omx_decoder.GetOutputPort(), false);
-          m_omx_sched.DisablePort(m_omx_sched.GetInputPort(), false);
-
-          if(m_deinterlace)
+          omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged);
+          if(omx_err != OMX_ErrorNone)
           {
-            m_omx_image_fx.DisablePort(m_omx_image_fx.GetOutputPort(), false);
-            m_omx_image_fx.DisablePort(m_omx_image_fx.GetInputPort(), false);
-
-            port_image.nPortIndex = m_omx_image_fx.GetInputPort();
-            omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition, &port_image);
-            if(omx_err != OMX_ErrorNone)
-              CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamPortDefinition 2 omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
-
-            port_image.nPortIndex = m_omx_image_fx.GetOutputPort();
-            omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamPortDefinition, &port_image);
-            if(omx_err != OMX_ErrorNone)
-              CLog::Log(LOGERROR, "%s::%s - error OMX_IndexParamPortDefinition 3 omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
+             CLog::Log(LOGERROR, "%s::%s - error m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
           }
-
-          m_omx_decoder.EnablePort(m_omx_decoder.GetOutputPort(), false);
-
-          if(m_deinterlace)
+          port_image.nPortIndex = m_omx_image_fx.GetOutputPort();
+          omx_err = m_omx_image_fx.GetParameter(OMX_IndexParamPortDefinition, &port_image);
+          if(omx_err != OMX_ErrorNone)
           {
-            m_omx_image_fx.EnablePort(m_omx_image_fx.GetOutputPort(), false);
-            m_omx_image_fx.EnablePort(m_omx_image_fx.GetInputPort(), false);
+            CLog::Log(LOGERROR, "%s::%s - error m_omx_image_fx.GetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
           }
+          m_omx_image_fx.EnablePort(m_omx_image_fx.GetInputPort(), true);
 
-          m_omx_sched.EnablePort(m_omx_sched.GetInputPort(), false);
+          m_omx_image_fx.DisablePort(m_omx_image_fx.GetOutputPort(), true);
+        }
+        port_image.nPortIndex = m_omx_sched.GetInputPort();
+        omx_err = m_omx_sched.SetParameter(OMX_IndexParamPortDefinition, &port_image);
+        if(omx_err != OMX_ErrorNone)
+        {
+          CLog::Log(LOGERROR, "%s::%s - error m_omx_sched.SetParameter(OMX_IndexParamPortDefinition) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
+        }
+        omx_err = m_omx_sched.WaitForEvent(OMX_EventPortSettingsChanged);
+        if(omx_err != OMX_ErrorNone)
+        {
+           CLog::Log(LOGERROR, "%s::%s - error m_omx_sched.WaitForEvent(OMX_EventPortSettingsChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
+        }
+        if (m_deinterlace)
+        {
+          m_omx_image_fx.EnablePort(m_omx_image_fx.GetOutputPort(), true);
         }
+        m_omx_decoder.EnablePort(m_omx_decoder.GetOutputPort(), true);
+        m_omx_sched.EnablePort(m_omx_sched.GetInputPort(), true);
       }
     }
 
@@ -932,7 +947,6 @@ void COMXVideo::Reset(void)
 
   SendDecoderConfig();
 
-  m_first_frame   = true;
   */
 }
 
index 0afa56d..037f155 100644 (file)
@@ -36,6 +36,8 @@
 
 #define CLASSNAME "COMXVideo"
 
+typedef void (*ResolutionUpdateCallBackFn)(void *ctx, uint32_t width, uint32_t height);
+
 class COMXVideo
 {
 public:
@@ -45,6 +47,7 @@ public:
   // Required overrides
   bool SendDecoderConfig();
   bool Open(CDVDStreamInfo &hints, OMXClock *clock, bool deinterlace = false, bool hdmi_clock_sync = false);
+  void RegisterResolutionUpdateCallBack(void *ctx, ResolutionUpdateCallBackFn callback) { m_res_ctx = ctx; m_res_callback = callback; }
   void Close(void);
   unsigned int GetFreeSpace();
   unsigned int GetSize();
@@ -89,9 +92,9 @@ protected:
 
   bool              m_deinterlace;
   bool              m_hdmi_clock_sync;
-  bool              m_first_frame;
   uint32_t          m_history_valid_pts;
-
+  ResolutionUpdateCallBackFn m_res_callback;
+  void              *m_res_ctx;
   bool NaluFormatStartCodes(enum CodecID codec, uint8_t *in_extradata, int in_extrasize);
 };
 
index 8e546a1..7decb52 100644 (file)
@@ -150,7 +150,7 @@ ICodec* CodecFactory::CreateCodecDemux(const CStdString& strFile, const CStdStri
   else if (strContent.Equals("audio/flac") || strContent.Equals("audio/x-flac") || strContent.Equals("application/x-flac"))
     return new FLACCodec();
 
-  if (urlFile.GetProtocol() == "lastfm" || urlFile.GetProtocol() == "shout")
+  if (urlFile.GetProtocol() == "shout")
   {
     return new MP3Codec(); // if we got this far with internet radio - content-type was wrong. gamble on mp3.
   }
index 2ee2292..d49b83d 100644 (file)
@@ -174,7 +174,7 @@ bool MP3Codec::Init(const CStdString &strFile, unsigned int filecache)
   length = m_file.GetLength();
   if (length != 0)
   {
-    CTagLoaderTagLib tagLoaderTagLib; //opens the file so needs to be after m_file.Open or lastfm radio breaks.
+    CTagLoaderTagLib tagLoaderTagLib; //opens the file so needs to be after m_file.Open 
     bTags = tagLoaderTagLib.Load(strFile, m_tag);
 
     if (bTags)
index 8a57c55..69cbf26 100644 (file)
@@ -824,11 +824,6 @@ int PAPlayer::GetCacheLevel() const
   return m_playerGUIData.m_cacheLevel;
 }
 
-int PAPlayer::GetChannels()
-{
-  return m_playerGUIData.m_channelCount;
-}
-
 int PAPlayer::GetBitsPerSample()
 {
   return m_playerGUIData.m_bitsPerSample;
@@ -839,14 +834,11 @@ int PAPlayer::GetSampleRate()
   return m_playerGUIData.m_sampleRate;
 }
 
-CStdString PAPlayer::GetAudioCodecName()
-{
-  return m_playerGUIData.m_codec;
-}
-
-int PAPlayer::GetAudioBitrate()
+void PAPlayer::GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info)
 {
-  return m_playerGUIData.m_audioBitrate;
+  info.bitrate = m_playerGUIData.m_audioBitrate;
+  info.channels = m_playerGUIData.m_channelCount;
+  info.audioCodecName = m_playerGUIData.m_codec;
 }
 
 bool PAPlayer::CanSeek()
index 124bf28..a740f61 100644 (file)
@@ -63,11 +63,9 @@ public:
   virtual void ToFFRW(int iSpeed = 0);
   virtual int GetCacheLevel() const;
   virtual int64_t GetTotalTime();
-  virtual int GetAudioBitrate();
-  virtual int GetChannels();
+  virtual void GetAudioStreamInfo(int index, SPlayerAudioStreamInfo &info);
   virtual int GetBitsPerSample();
   virtual int GetSampleRate();
-  virtual CStdString GetAudioCodecName();
   virtual int64_t GetTime();
   virtual void SeekTime(int64_t iTime = 0);
   virtual bool SkipNext();
index 5150e95..949b103 100644 (file)
 
 using namespace AUTOPTR;
 
-std::vector<CPlayerCoreConfig *> CPlayerCoreFactory::s_vecCoreConfigs;
-std::vector<CPlayerSelectionRule *> CPlayerCoreFactory::s_vecCoreSelectionRules;
-static CCriticalSection s_section;
-
-
 CPlayerCoreFactory::CPlayerCoreFactory()
-{}
+{ }
+
 CPlayerCoreFactory::~CPlayerCoreFactory()
 {
-  for(std::vector<CPlayerCoreConfig *>::iterator it = s_vecCoreConfigs.begin(); it != s_vecCoreConfigs.end(); it++)
+  for(std::vector<CPlayerCoreConfig *>::iterator it = m_vecCoreConfigs.begin(); it != m_vecCoreConfigs.end(); it++)
     delete *it;
-  for(std::vector<CPlayerSelectionRule *>::iterator it = s_vecCoreSelectionRules.begin(); it != s_vecCoreSelectionRules.end(); it++)
+  for(std::vector<CPlayerSelectionRule *>::iterator it = m_vecCoreSelectionRules.begin(); it != m_vecCoreSelectionRules.end(); it++)
     delete *it;
 }
 
+CPlayerCoreFactory& CPlayerCoreFactory::Get()
+{
+  static CPlayerCoreFactory sPlayerCoreFactory;
+  return sPlayerCoreFactory;
+}
+
 /* generic function to make a vector unique, removes later duplicates */
 template<typename T> void unique (T &con)
 {
@@ -72,18 +74,18 @@ IPlayer* CPlayerCoreFactory::CreatePlayer(const CStdString& strCore, IPlayerCall
   return CreatePlayer( GetPlayerCore(strCore), callback );
 }
 
-IPlayer* CPlayerCoreFactory::CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback)
+IPlayer* CPlayerCoreFactory::CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback) const
 {
-  CSingleLock lock(s_section);
-  if (!s_vecCoreConfigs.size() || eCore-1 > s_vecCoreConfigs.size()-1)
+  CSingleLock lock(m_section);
+  if (!m_vecCoreConfigs.size() || eCore-1 > m_vecCoreConfigs.size()-1)
     return NULL;
 
-  return s_vecCoreConfigs[eCore-1]->CreatePlayer(callback);
+  return m_vecCoreConfigs[eCore-1]->CreatePlayer(callback);
 }
 
-PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const CStdString& strCoreName)
+PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const CStdString& strCoreName) const
 {
-  CSingleLock lock(s_section);
+  CSingleLock lock(m_section);
   if (!strCoreName.empty())
   {
     // Dereference "*default*player" aliases
@@ -93,9 +95,9 @@ PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const CStdString& strCoreName)
     else if (strCoreName.Equals("videodefaultdvdplayer", false)) strRealCoreName = g_advancedSettings.m_videoDefaultDVDPlayer;
     else strRealCoreName = strCoreName;
 
-    for(PLAYERCOREID i = 0; i < s_vecCoreConfigs.size(); i++)
+    for(PLAYERCOREID i = 0; i < m_vecCoreConfigs.size(); i++)
     {
-      if (s_vecCoreConfigs[i]->GetName().Equals(strRealCoreName, false))
+      if (m_vecCoreConfigs[i]->GetName().Equals(strRealCoreName, false))
         return i+1;
     }
     CLog::Log(LOGWARNING, "CPlayerCoreFactory::GetPlayerCore(%s): no such core: %s", strCoreName.c_str(), strRealCoreName.c_str());
@@ -103,58 +105,58 @@ PLAYERCOREID CPlayerCoreFactory::GetPlayerCore(const CStdString& strCoreName)
   return EPC_NONE;
 }
 
-CStdString CPlayerCoreFactory::GetPlayerName(const PLAYERCOREID eCore)
+CStdString CPlayerCoreFactory::GetPlayerName(const PLAYERCOREID eCore) const
 {
-  CSingleLock lock(s_section);
-  return s_vecCoreConfigs[eCore-1]->GetName();
+  CSingleLock lock(m_section);
+  return m_vecCoreConfigs[eCore-1]->GetName();
 }
 
-CPlayerCoreConfig* CPlayerCoreFactory::GetPlayerConfig(const CStdString& strCoreName)
+CPlayerCoreConfig* CPlayerCoreFactory::GetPlayerConfig(const CStdString& strCoreName) const
 {
-  CSingleLock lock(s_section);
+  CSingleLock lock(m_section);
   PLAYERCOREID id = GetPlayerCore(strCoreName);
-  if (id != EPC_NONE) return s_vecCoreConfigs[id-1];
+  if (id != EPC_NONE) return m_vecCoreConfigs[id-1];
   else return NULL;
 }
 
-void CPlayerCoreFactory::GetPlayers( VECPLAYERCORES &vecCores )
+void CPlayerCoreFactory::GetPlayers( VECPLAYERCORES &vecCores ) const
 {
-  CSingleLock lock(s_section);
-  for(unsigned int i = 0; i < s_vecCoreConfigs.size(); i++)
+  CSingleLock lock(m_section);
+  for(unsigned int i = 0; i < m_vecCoreConfigs.size(); i++)
   {
-    if(s_vecCoreConfigs[i]->m_eCore == EPC_NONE)
+    if(m_vecCoreConfigs[i]->m_eCore == EPC_NONE)
       continue;
-    if (s_vecCoreConfigs[i]->m_bPlaysAudio || s_vecCoreConfigs[i]->m_bPlaysVideo)
+    if (m_vecCoreConfigs[i]->m_bPlaysAudio || m_vecCoreConfigs[i]->m_bPlaysVideo)
       vecCores.push_back(i+1);
   }
 }
 
-void CPlayerCoreFactory::GetPlayers( VECPLAYERCORES &vecCores, const bool audio, const bool video )
+void CPlayerCoreFactory::GetPlayers( VECPLAYERCORES &vecCores, const bool audio, const bool video ) const
 {
-  CSingleLock lock(s_section);
+  CSingleLock lock(m_section);
   CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: for video=%d, audio=%d", video, audio);
 
-  for(unsigned int i = 0; i < s_vecCoreConfigs.size(); i++)
+  for(unsigned int i = 0; i < m_vecCoreConfigs.size(); i++)
   {
-    if(s_vecCoreConfigs[i]->m_eCore == EPC_NONE)
+    if(m_vecCoreConfigs[i]->m_eCore == EPC_NONE)
       continue;
-    if (audio == s_vecCoreConfigs[i]->m_bPlaysAudio && video == s_vecCoreConfigs[i]->m_bPlaysVideo)
+    if (audio == m_vecCoreConfigs[i]->m_bPlaysAudio && video == m_vecCoreConfigs[i]->m_bPlaysVideo)
     {
-      CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding player: %s (%d)", s_vecCoreConfigs[i]->m_name.c_str(), i+1);
+      CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding player: %s (%d)", m_vecCoreConfigs[i]->m_name.c_str(), i+1);
       vecCores.push_back(i+1);
     }
   }
 }
 
-void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores)
+void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores) const
 {
   CURL url(item.GetPath());
 
   CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers(%s)", item.GetPath().c_str());
 
   // Process rules
-  for(unsigned int i = 0; i < s_vecCoreSelectionRules.size(); i++)
-    s_vecCoreSelectionRules[i]->GetPlayers(item, vecCores);
+  for(unsigned int i = 0; i < m_vecCoreSelectionRules.size(); i++)
+    m_vecCoreSelectionRules[i]->GetPlayers(item, vecCores);
 
   CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: matched %"PRIuS" rules with players", vecCores.size());
 
@@ -232,18 +234,18 @@ void CPlayerCoreFactory::GetPlayers( const CFileItem& item, VECPLAYERCORES &vecC
   CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: added %"PRIuS" players", vecCores.size());
 }
 
-void CPlayerCoreFactory::GetRemotePlayers( VECPLAYERCORES &vecCores )
+void CPlayerCoreFactory::GetRemotePlayers( VECPLAYERCORES &vecCores ) const
 {
-  CSingleLock lock(s_section);
-  for(unsigned int i = 0; i < s_vecCoreConfigs.size(); i++)
+  CSingleLock lock(m_section);
+  for(unsigned int i = 0; i < m_vecCoreConfigs.size(); i++)
   {
-    if(s_vecCoreConfigs[i]->m_eCore != EPC_UPNPPLAYER)
+    if(m_vecCoreConfigs[i]->m_eCore != EPC_UPNPPLAYER)
       continue;
     vecCores.push_back(i+1);
   }
 }
 
-PLAYERCOREID CPlayerCoreFactory::GetDefaultPlayer( const CFileItem& item )
+PLAYERCOREID CPlayerCoreFactory::GetDefaultPlayer( const CFileItem& item ) const
 {
   VECPLAYERCORES vecCores;
   GetPlayers(item, vecCores);
@@ -254,7 +256,7 @@ PLAYERCOREID CPlayerCoreFactory::GetDefaultPlayer( const CFileItem& item )
   return EPC_NONE;
 }
 
-PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX, float posY)
+PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX, float posY) const
 {
   CContextButtons choices;
   if (vecCores.size())
@@ -277,51 +279,72 @@ PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(VECPLAYERCORES &vecCores, fl
   return EPC_NONE;
 }
 
-PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(float posX, float posY)
+PLAYERCOREID CPlayerCoreFactory::SelectPlayerDialog(float posX, float posY) const
 {
   VECPLAYERCORES vecCores;
   GetPlayers(vecCores);
   return SelectPlayerDialog(vecCores, posX, posY);
 }
 
-bool CPlayerCoreFactory::LoadConfiguration(TiXmlElement* pConfig, bool clear)
+bool CPlayerCoreFactory::LoadConfiguration(const std::string &file, bool clear)
 {
-  CSingleLock lock(s_section);
+  CSingleLock lock(m_section);
+  CLog::Log(LOGNOTICE, "Loading player core factory settings from %s.", file.c_str());
+  if (!XFILE::CFile::Exists(file))
+  { // tell the user it doesn't exist
+    CLog::Log(LOGNOTICE, "%s does not exist. Skipping.", file.c_str());
+    return false;
+  }
+
+  CXBMCTinyXML playerCoreFactoryXML;
+  if (!playerCoreFactoryXML.LoadFile(file))
+  {
+    CLog::Log(LOGERROR, "Error loading %s, Line %d (%s)", file.c_str(), playerCoreFactoryXML.ErrorRow(), playerCoreFactoryXML.ErrorDesc());
+    return false;
+  }
+
+  TiXmlElement *pConfig = playerCoreFactoryXML.RootElement();
+  if (pConfig == NULL)
+  {
+      CLog::Log(LOGERROR, "Error loading %s, Bad structure", file.c_str());
+      return false;
+  }
+
   if (clear)
   {
-    for(std::vector<CPlayerCoreConfig *>::iterator it = s_vecCoreConfigs.begin(); it != s_vecCoreConfigs.end(); it++)
+    for(std::vector<CPlayerCoreConfig *>::iterator it = m_vecCoreConfigs.begin(); it != m_vecCoreConfigs.end(); it++)
       delete *it;
-    s_vecCoreConfigs.clear();
+    m_vecCoreConfigs.clear();
     // Builtin players; hard-coded because re-ordering them would break scripts
     CPlayerCoreConfig* dvdplayer = new CPlayerCoreConfig("DVDPlayer", EPC_DVDPLAYER, NULL);
     dvdplayer->m_bPlaysAudio = dvdplayer->m_bPlaysVideo = true;
-    s_vecCoreConfigs.push_back(dvdplayer);
+    m_vecCoreConfigs.push_back(dvdplayer);
 
      // Don't remove this, its a placeholder for the old MPlayer core, it would break scripts
     CPlayerCoreConfig* mplayer = new CPlayerCoreConfig("oldmplayercore", EPC_DVDPLAYER, NULL);
-    s_vecCoreConfigs.push_back(mplayer);
+    m_vecCoreConfigs.push_back(mplayer);
 
     CPlayerCoreConfig* paplayer = new CPlayerCoreConfig("PAPlayer", EPC_PAPLAYER, NULL);
     paplayer->m_bPlaysAudio = true;
-    s_vecCoreConfigs.push_back(paplayer);
+    m_vecCoreConfigs.push_back(paplayer);
 
 #if defined(HAS_AMLPLAYER)
     CPlayerCoreConfig* amlplayer = new CPlayerCoreConfig("AMLPlayer", EPC_AMLPLAYER, NULL);
     amlplayer->m_bPlaysAudio = true;
     amlplayer->m_bPlaysVideo = true;
-    s_vecCoreConfigs.push_back(amlplayer);
+    m_vecCoreConfigs.push_back(amlplayer);
 #endif
 
 #if defined(HAS_OMXPLAYER)
     CPlayerCoreConfig* omxplayer = new CPlayerCoreConfig("OMXPlayer", EPC_OMXPLAYER, NULL);
     omxplayer->m_bPlaysAudio = true;
     omxplayer->m_bPlaysVideo = true;
-    s_vecCoreConfigs.push_back(omxplayer);
+    m_vecCoreConfigs.push_back(omxplayer);
 #endif
 
-    for(std::vector<CPlayerSelectionRule *>::iterator it = s_vecCoreSelectionRules.begin(); it != s_vecCoreSelectionRules.end(); it++)
+    for(std::vector<CPlayerSelectionRule *>::iterator it = m_vecCoreSelectionRules.begin(); it != m_vecCoreSelectionRules.end(); it++)
       delete *it;
-    s_vecCoreSelectionRules.clear();
+    m_vecCoreSelectionRules.clear();
   }
 
   if (!pConfig || strcmpi(pConfig->Value(),"playercorefactory") != 0)
@@ -348,7 +371,7 @@ bool CPlayerCoreFactory::LoadConfiguration(TiXmlElement* pConfig, bool clear)
 
       if (eCore != EPC_NONE)
       {
-        s_vecCoreConfigs.push_back(new CPlayerCoreConfig(name, eCore, pPlayer));
+        m_vecCoreConfigs.push_back(new CPlayerCoreConfig(name, eCore, pPlayer));
       }
 
       pPlayer = pPlayer->NextSiblingElement("player");
@@ -363,21 +386,21 @@ bool CPlayerCoreFactory::LoadConfiguration(TiXmlElement* pConfig, bool clear)
     {
       if (stricmp(szAction, "append") == 0)
       {
-        s_vecCoreSelectionRules.push_back(new CPlayerSelectionRule(pRule));
+        m_vecCoreSelectionRules.push_back(new CPlayerSelectionRule(pRule));
       }
       else if (stricmp(szAction, "prepend") == 0)
       {
-        s_vecCoreSelectionRules.insert(s_vecCoreSelectionRules.begin(), 1, new CPlayerSelectionRule(pRule));
+        m_vecCoreSelectionRules.insert(m_vecCoreSelectionRules.begin(), 1, new CPlayerSelectionRule(pRule));
       }
       else
       {
-        s_vecCoreSelectionRules.clear();
-        s_vecCoreSelectionRules.push_back(new CPlayerSelectionRule(pRule));
+        m_vecCoreSelectionRules.clear();
+        m_vecCoreSelectionRules.push_back(new CPlayerSelectionRule(pRule));
       }
     }
     else
     {
-      s_vecCoreSelectionRules.push_back(new CPlayerSelectionRule(pRule));
+      m_vecCoreSelectionRules.push_back(new CPlayerSelectionRule(pRule));
     }
 
     pRule = pRule->NextSiblingElement("rules");
@@ -391,10 +414,10 @@ bool CPlayerCoreFactory::LoadConfiguration(TiXmlElement* pConfig, bool clear)
 
 void CPlayerCoreFactory::OnPlayerDiscovered(const CStdString& id, const CStdString& name, EPLAYERCORES core)
 {
-  CSingleLock lock(s_section);
+  CSingleLock lock(m_section);
   std::vector<CPlayerCoreConfig *>::iterator it;
-  for(it  = s_vecCoreConfigs.begin();
-      it != s_vecCoreConfigs.end();
+  for(it  = m_vecCoreConfigs.begin();
+      it != m_vecCoreConfigs.end();
       it++)
   {
     if ((*it)->GetId() == id)
@@ -408,15 +431,15 @@ void CPlayerCoreFactory::OnPlayerDiscovered(const CStdString& id, const CStdStri
   CPlayerCoreConfig* player = new CPlayerCoreConfig(name, core, NULL, id);
   player->m_bPlaysAudio = true;
   player->m_bPlaysVideo = true;
-  s_vecCoreConfigs.push_back(player);
+  m_vecCoreConfigs.push_back(player);
 }
 
 void CPlayerCoreFactory::OnPlayerRemoved(const CStdString& id)
 {
-  CSingleLock lock(s_section);
+  CSingleLock lock(m_section);
   std::vector<CPlayerCoreConfig *>::iterator it;
-  for(it  = s_vecCoreConfigs.begin();
-      it != s_vecCoreConfigs.end();
+  for(it  = m_vecCoreConfigs.begin();
+      it != m_vecCoreConfigs.end();
       it++)
   {
     if ((*it)->GetId() == id)
index 19b41b8..97fc87e 100644 (file)
@@ -20,7 +20,8 @@
  *
  */
 
-#include "../IPlayer.h"
+#include "cores/IPlayer.h"
+#include "threads/CriticalSection.h"
 
 /*----------------------------------------------------------------------
 |   forward references
@@ -62,33 +63,38 @@ const PLAYERCOREID PCID_OMXPLAYER = EPC_OMXPLAYER;
 class CPlayerCoreFactory
 {
 public:
-  CPlayerCoreFactory();
-  virtual ~CPlayerCoreFactory();
+  static CPlayerCoreFactory& Get();
 
-  IPlayer* CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const;
+  PLAYERCOREID GetPlayerCore(const CStdString& strCoreName) const;
+  CPlayerCoreConfig* GetPlayerConfig(const CStdString& strCoreName) const;
+  CStdString GetPlayerName(const PLAYERCOREID eCore) const;
 
-  static PLAYERCOREID GetPlayerCore(const CStdString& strCoreName);
-  static CPlayerCoreConfig* GetPlayerConfig(const CStdString& strCoreName);
-  static CStdString GetPlayerName(const PLAYERCOREID eCore);
+  IPlayer* CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback) const;
+  IPlayer* CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const;
+  void GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores) const;   //Players supporting the specified file
+  void GetPlayers( VECPLAYERCORES &vecCores, bool audio, bool video ) const; //All audio players and/or video players
+  void GetPlayers( VECPLAYERCORES &vecCores ) const;                         //All players
 
-  static IPlayer* CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback);
-  static void GetPlayers( const CFileItem& item, VECPLAYERCORES &vecCores);   //Players supporting the specified file
-  static void GetPlayers( VECPLAYERCORES &vecCores, bool audio, bool video ); //All audio players and/or video players
-  static void GetPlayers( VECPLAYERCORES &vecCores );                         //All players
+  void GetRemotePlayers( VECPLAYERCORES &vecCores ) const;                   //All remote players we can attach to
 
-  static void GetRemotePlayers( VECPLAYERCORES &vecCores );                   //All remote players we can attach to
+  PLAYERCOREID GetDefaultPlayer( const CFileItem& item ) const;
 
-  static PLAYERCOREID GetDefaultPlayer( const CFileItem& item );
+  PLAYERCOREID SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX = 0, float posY = 0) const;
+  PLAYERCOREID SelectPlayerDialog(float posX, float posY) const;
 
-  static PLAYERCOREID SelectPlayerDialog(VECPLAYERCORES &vecCores, float posX = 0, float posY = 0);
-  static PLAYERCOREID SelectPlayerDialog(float posX, float posY);
+  bool LoadConfiguration(const std::string &file, bool clear);
 
-  static bool LoadConfiguration(TiXmlElement* pConfig, bool clear);
+  void OnPlayerDiscovered(const CStdString& id, const CStdString& name, EPLAYERCORES core);
+  void OnPlayerRemoved(const CStdString& id);
 
-  static void OnPlayerDiscovered(const CStdString& id, const CStdString& name, EPLAYERCORES core);
-  static void OnPlayerRemoved(const CStdString& id);
+protected:
+  CPlayerCoreFactory();
+  CPlayerCoreFactory(const CPlayerCoreFactory&);
+  CPlayerCoreFactory const& operator=(CPlayerCoreFactory const&);
+  virtual ~CPlayerCoreFactory();
 
 private:
-  static std::vector<CPlayerCoreConfig *> s_vecCoreConfigs;
-  static std::vector<CPlayerSelectionRule *> s_vecCoreSelectionRules;
+  std::vector<CPlayerCoreConfig *> m_vecCoreConfigs;
+  std::vector<CPlayerSelectionRule *> m_vecCoreSelectionRules;
+  CCriticalSection m_section;
 };
index 8b743c9..88cb26c 100644 (file)
@@ -44,6 +44,7 @@ void CPlayerSelectionRule::Initialize(TiXmlElement* pRule)
   CLog::Log(LOGDEBUG, "CPlayerSelectionRule::Initialize: creating rule: %s", m_name.c_str());
 
   m_tInternetStream = GetTristate(pRule->Attribute("internetstream"));
+  m_tRemote = GetTristate(pRule->Attribute("remote"));
   m_tAudio = GetTristate(pRule->Attribute("audio"));
   m_tVideo = GetTristate(pRule->Attribute("video"));
 
@@ -110,6 +111,7 @@ void CPlayerSelectionRule::GetPlayers(const CFileItem& item, VECPLAYERCORES &vec
   if (m_tAudio >= 0 && (m_tAudio > 0) != item.IsAudio()) return;
   if (m_tVideo >= 0 && (m_tVideo > 0) != item.IsVideo()) return;
   if (m_tInternetStream >= 0 && (m_tInternetStream > 0) != item.IsInternetStream()) return;
+  if (m_tRemote >= 0 && (m_tRemote > 0) != item.IsRemote()) return;
 
   if (m_tBD >= 0 && (m_tBD > 0) != (item.IsBDFile() && item.IsOnDVD())) return;
   if (m_tDVD >= 0 && (m_tDVD > 0) != item.IsDVD()) return;
@@ -166,7 +168,7 @@ PLAYERCOREID CPlayerSelectionRule::GetPlayerCore()
 {
   if (!m_playerCoreId)
   {
-    m_playerCoreId = CPlayerCoreFactory::GetPlayerCore(m_playerName);
+    m_playerCoreId = CPlayerCoreFactory::Get().GetPlayerCore(m_playerName);
   }
   return m_playerCoreId;
 }
index f3c8302..91543d4 100644 (file)
@@ -47,6 +47,7 @@ private:
   int m_tAudio;
   int m_tVideo;
   int m_tInternetStream;
+  int m_tRemote;
 
   int m_tBD;
   int m_tDVD;
index 4eb71b5..e508e97 100644 (file)
@@ -33,7 +33,6 @@ CGUIDialogCache::CGUIDialogCache(DWORD dwDelay, const CStdString& strHeader, con
   m_strHeader = strHeader;
   m_strLinePrev = strMsg;
   bSentCancel = false;
-  dwDelay = 0;
 
   m_pDlg = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
 
@@ -124,7 +123,7 @@ bool CGUIDialogCache::OnFileCallback(void* pContext, int ipercent, float avgSpee
 
 void CGUIDialogCache::Process()
 {
-  if (m_pDlg)
+  if (!m_pDlg)
     return;
 
   while( true )
index 4d4c2ad..95af415 100644 (file)
@@ -30,7 +30,7 @@
 #include "utils/URIUtils.h"
 #include "settings/GUISettings.h"
 #include "GUIDialogMediaSource.h"
-#include "settings/GUIDialogLockSettings.h"
+#include "settings/dialogs/GUIDialogLockSettings.h"
 #include "storage/MediaManager.h"
 #include "guilib/GUIWindowManager.h"
 #include "GUIDialogYesNo.h"
index 2fc0fc1..76fae8e 100644 (file)
@@ -25,7 +25,7 @@
 #include "DbUrl.h"
 #include "dbwrappers/Database.h"
 #include "playlists/SmartPlayList.h"
-#include "settings/GUIDialogSettings.h"
+#include "settings/dialogs/GUIDialogSettings.h"
 #include "threads/Timer.h"
 #include "utils/DatabaseUtils.h"
 #include "utils/StdString.h"
index ec831a4..6ffd02c 100644 (file)
@@ -32,7 +32,7 @@
 #include "PlatformDefs.h" //for PRIdS, PRId64
 #endif
 
-namespace XFILE {
+using namespace XFILE;
 
 CCacheStrategy::CCacheStrategy() : m_bEndOfInput(false)
 {
@@ -144,10 +144,11 @@ int CSimpleFileCache::WriteToCache(const char *pBuffer, size_t iSize)
     return CACHE_RC_ERROR;
   }
 
+  m_nWritePosition += iWritten;
+
   // when reader waits for data it will wait on the event.
   m_hDataAvailEvent->Set();
 
-  m_nWritePosition += iWritten;
   return iWritten;
 }
 
@@ -185,22 +186,16 @@ int64_t CSimpleFileCache::WaitForData(unsigned int iMinAvail, unsigned int iMill
     return GetAvailableRead();
 
   XbmcThreads::EndTime endTime(iMillis);
-  unsigned int millisLeft;
-  while ( !IsEndOfInput() && (millisLeft = endTime.MillisLeft()) > 0 )
+  while (!IsEndOfInput())
   {
     int64_t iAvail = GetAvailableRead();
     if (iAvail >= iMinAvail)
       return iAvail;
 
-    // busy look (sleep max 1 sec each round)
-    if (!m_hDataAvailEvent->WaitMSec(millisLeft>1000?millisLeft:1000 ))
-      return CACHE_RC_ERROR;
+    if (!m_hDataAvailEvent->WaitMSec(endTime.MillisLeft()))
+      return CACHE_RC_TIMEOUT;
   }
-
-  if( IsEndOfInput() )
-    return GetAvailableRead();
-
-  return CACHE_RC_TIMEOUT;
+  return GetAvailableRead();
 }
 
 int64_t CSimpleFileCache::Seek(int64_t iFilePosition)
@@ -217,7 +212,7 @@ int64_t CSimpleFileCache::Seek(int64_t iFilePosition)
   }
 
   int64_t nDiff = iTarget - m_nWritePosition;
-  if ( nDiff > 500000 || (nDiff > 0 && WaitForData((unsigned int)nDiff, 5000) == CACHE_RC_TIMEOUT)  ) {
+  if ( nDiff > 500000 || (nDiff > 0 && WaitForData((unsigned int)(iTarget - m_nReadPosition), 5000) == CACHE_RC_TIMEOUT)  ) {
     CLog::Log(LOGWARNING,"%s - attempt to seek past read data (seek to %"PRId64". max: %"PRId64". reset read pointer. (%"PRId64")", __FUNCTION__, iTarget, m_nWritePosition, iFilePosition);
     return  CACHE_RC_ERROR;
   }
@@ -252,4 +247,3 @@ void CSimpleFileCache::EndOfInput()
   m_hDataAvailEvent->Set();
 }
 
-}
index 4efe351..405e005 100644 (file)
@@ -169,7 +169,7 @@ int CCircularCache::ReadFromCache(char *buf, size_t len)
 int64_t CCircularCache::WaitForData(unsigned int minumum, unsigned int millis)
 {
   CSingleLock lock(m_sync);
-  uint64_t avail = m_end - m_cur;
+  int64_t avail = m_end - m_cur;
 
   if(millis == 0 || IsEndOfInput())
     return avail;
@@ -195,14 +195,14 @@ int64_t CCircularCache::Seek(int64_t pos)
 
   // if seek is a bit over what we have, try to wait a few seconds for the data to be available.
   // we try to avoid a (heavy) seek on the source
-  if ((uint64_t)pos >= m_end && (uint64_t)pos < m_end + 100000)
+  if (pos >= m_end && pos < m_end + 100000)
   {
     lock.Leave();
     WaitForData((size_t)(pos - m_cur), 5000);
     lock.Enter();
   }
 
-  if((uint64_t)pos >= m_beg && (uint64_t)pos <= m_end)
+  if(pos >= m_beg && pos <= m_end)
   {
     m_cur = pos;
     return pos;
index fece5a8..7b5025a 100644 (file)
@@ -44,9 +44,9 @@ public:
     virtual void Reset(int64_t pos) ;
 
 protected:
-    uint64_t          m_beg;       /**< index in file (not buffer) of beginning of valid data */
-    uint64_t          m_end;       /**< index in file (not buffer) of end of valid data */
-    uint64_t          m_cur;       /**< current reading index in file */
+    int64_t           m_beg;       /**< index in file (not buffer) of beginning of valid data */
+    int64_t           m_end;       /**< index in file (not buffer) of end of valid data */
+    int64_t           m_cur;       /**< current reading index in file */
     uint8_t          *m_buf;       /**< buffer holding data */
     size_t            m_size;      /**< size of data buffer used (m_buf) */
     size_t            m_size_back; /**< guaranteed size of back buffer (actual size can be smaller, or larger if front buffer doesn't need it) */
index 77428ca..2c1230f 100644 (file)
@@ -288,9 +288,22 @@ bool CCurlFile::CReadState::Seek(int64_t pos)
   return false;
 }
 
+void CCurlFile::CReadState::SetResume(void)
+{
+  /*
+   * Use RANGE method for resuming. We used to use RESUME_FROM_LARGE for this but some http servers
+   * require us to always send the range request header. If we don't the server may provide different
+   * content causing seeking to fail. Note that internally Curl will automatically handle this for FTP
+   * so we don't need to worry about that here.
+   */
+  char str[21];
+  sprintf(str, "%"PRId64"-", m_filePos);
+  g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RANGE, str);
+}
+
 long CCurlFile::CReadState::Connect(unsigned int size)
 {
-  g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos);
+  SetResume();
   g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle);
 
   m_bufferSize = size;
@@ -340,8 +353,7 @@ void CCurlFile::CReadState::Disconnect()
 
 CCurlFile::~CCurlFile()
 {
-  if (m_opened)
-    Close();
+  Close();
   delete m_state;
   g_curlInterface.Unload();
 }
@@ -467,7 +479,10 @@ void CCurlFile::SetCommonOptions(CReadState* state)
   g_curlInterface.easy_setopt(h, CURLOPT_FAILONERROR, 1);
 
   // enable support for icecast / shoutcast streams
-  m_curlAliasList = g_curlInterface.slist_append(m_curlAliasList, "ICY 200 OK");
+  if ( NULL == m_curlAliasList )
+    // m_curlAliasList is used only by this one place, but SetCommonOptions can
+    // be called multiple times, only append to list if it's empty.
+    m_curlAliasList = g_curlInterface.slist_append(m_curlAliasList, "ICY 200 OK");
   g_curlInterface.easy_setopt(h, CURLOPT_HTTP200ALIASES, m_curlAliasList);
 
   // never verify peer, we don't have any certificates to do this
@@ -573,6 +588,13 @@ void CCurlFile::SetCommonOptions(CReadState* state)
 
   // Set the lowspeed time very low as it seems Curl takes much longer to detect a lowspeed condition
   g_curlInterface.easy_setopt(h, CURLOPT_LOW_SPEED_TIME, m_lowspeedtime);
+
+  if (m_skipshout)
+    // For shoutcast file, content-length should not be set, and in libcurl there is a bug, if the
+    // cast file was 302 redirected then getinfo of CURLINFO_CONTENT_LENGTH_DOWNLOAD will return
+    // the 302 response's body length, which cause the next read request failed, so we ignore
+    // content-length for shoutcast file to workaround this.
+    g_curlInterface.easy_setopt(h, CURLOPT_IGNORE_CONTENT_LENGTH, 1);
 }
 
 void CCurlFile::SetRequestHeaders(CReadState* state)
@@ -920,7 +942,7 @@ bool CCurlFile::Open(const CURL& url)
   }
 
   m_multisession = false;
-  if(m_url.Left(5).Equals("http:") || m_url.Left(6).Equals("https:"))
+  if(url2.GetProtocol().Equals("http") || url2.GetProtocol().Equals("https"))
   {
     m_multisession = true;
     if(m_state->m_httpheader.GetValue("Server").Find("Portable SDK for UPnP devices") >= 0)
@@ -1086,7 +1108,11 @@ bool CCurlFile::Exists(const CURL& url)
   if(url2.GetProtocol() == "ftp")
   {
     g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FILETIME, 1);
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
+    // nocwd is less standard, will return empty list for non-existed remote dir on some ftp server, avoid it.
+    if (url2.GetFileName().Right(1).Equals("/"))
+      g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
+    else
+      g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
   }
 
   CURLcode result = g_curlInterface.easy_perform(m_state->m_easyHandle);
@@ -1211,8 +1237,11 @@ int CCurlFile::Stat(const CURL& url, struct __stat64* buffer)
 
   if(url2.GetProtocol() == "ftp")
   {
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FILETIME, 1);
-    g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
+    // nocwd is less standard, will return empty list for non-existed remote dir on some ftp server, avoid it.
+    if (url2.GetFileName().Right(1).Equals("/"))
+      g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
+    else
+      g_curlInterface.easy_setopt(m_state->m_easyHandle, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
   }
 
   CURLcode result = g_curlInterface.easy_perform(m_state->m_easyHandle);
@@ -1420,7 +1449,7 @@ bool CCurlFile::CReadState::FillBuffer(unsigned int want)
         CLog::Log(LOGWARNING, "%s: Reconnect, (re)try %i", __FUNCTION__, retry);
 
         // Connect + seek to current position (again)
-        g_curlInterface.easy_setopt(m_easyHandle, CURLOPT_RESUME_FROM_LARGE, m_filePos);
+        SetResume();
         g_curlInterface.multi_add_handle(m_multiHandle, m_easyHandle);
 
         // Return to the beginning of the loop:
index da12260..2bb8f54 100644 (file)
@@ -131,6 +131,7 @@ namespace XFILE
           bool         FillBuffer(unsigned int want);
           void         SetReadBuffer(const void* lpBuf, int64_t uiBufSize);
 
+          void         SetResume(void);
           long         Connect(unsigned int size);
           void         Disconnect();
       };
index c785ccf..148b262 100644 (file)
@@ -219,6 +219,7 @@ bool CDAVDirectory::Exists(const char* strPath)
   // on the server's configuration
   CStdString strRequest = "PROPFIND";
   dav.SetCustomRequest(strRequest);
+  dav.SetRequestHeader("depth", 0);
 
   CURL url(strPath);
   return dav.Exists(url);
index 0f5c393..73c3c3e 100644 (file)
@@ -36,7 +36,6 @@
 #include "LibraryDirectory.h"
 #include "AddonsDirectory.h"
 #include "SourcesDirectory.h"
-#include "LastFMDirectory.h"
 #include "FTPDirectory.h"
 #include "HTTPDirectory.h"
 #include "DAVDirectory.h"
@@ -169,7 +168,6 @@ IDirectory* CDirectoryFactory::Create(const CStdString& strPath)
 
   if( g_application.getNetwork().IsAvailable(true) )  // true to wait for the network (if possible)
   {
-    if (strProtocol == "lastfm") return new CLastFMDirectory();
     if (strProtocol == "tuxbox") return new CTuxBoxDirectory();
     if (strProtocol == "ftp" || strProtocol == "ftps") return new CFTPDirectory();
     if (strProtocol == "http" || strProtocol == "https") return new CHTTPDirectory();
index 6f3f664..00720cf 100644 (file)
@@ -100,7 +100,12 @@ bool CFTPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items
 
 bool CFTPDirectory::Exists(const char* strPath)
 {
+  // make sure ftp dir ends with slash,
+  // curl need to known it's a dir to check ftp directory existence.
+  CStdString file = strPath;
+  URIUtils::AddSlashAtEnd(file);
+
   CCurlFile ftp;
-  CURL url(strPath);
+  CURL url(file);
   return ftp.Exists(url);
 }
index 1483e31..40f4180 100644 (file)
@@ -30,7 +30,6 @@
 #include "HTTPFile.h"
 #include "DAVFile.h"
 #include "ShoutcastFile.h"
-#include "LastFMFile.h"
 #include "FileReaderFile.h"
 #ifdef HAS_FILESYSTEM_SMB
 #ifdef _WIN32
@@ -156,7 +155,6 @@ IFile* CFileFactory::CreateLoader(const CURL& url)
     else if (strProtocol == "sftp" || strProtocol == "ssh") return new CSFTPFile();
 #endif
     else if (strProtocol == "shout") return new CShoutcastFile();
-    else if (strProtocol == "lastfm") return new CLastFMFile();
     else if (strProtocol == "tuxbox") return new CTuxBoxFile();
     else if (strProtocol == "hdhomerun") return new CHomeRunFile();
     else if (strProtocol == "sling") return new CSlingboxFile();
diff --git a/xbmc/filesystem/LastFMDirectory.cpp b/xbmc/filesystem/LastFMDirectory.cpp
deleted file mode 100644 (file)
index 08092bd..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "LastFMDirectory.h"
-#include "DirectoryCache.h"
-#include "music/tags/MusicInfoTag.h"
-#include "URL.h"
-#include "guilib/GUIWindowManager.h"
-#include "dialogs/GUIDialogProgress.h"
-#include "settings/GUISettings.h"
-#include "FileItem.h"
-#include "CurlFile.h"
-#include "utils/StringUtils.h"
-#include "guilib/LocalizeStrings.h"
-#include "utils/log.h"
-
-using namespace MUSIC_INFO;
-using namespace XFILE;
-
-#define AUDIOSCROBBLER_BASE_URL      "http://ws.audioscrobbler.com/1.0/"
-
-CLastFMDirectory::CLastFMDirectory()
-{
-  m_Error = false;
-  m_Downloaded = false;
-}
-
-CLastFMDirectory::~CLastFMDirectory()
-{
-}
-
-CStdString CLastFMDirectory::BuildURLFromInfo()
-{
-  CStdString strURL = (CStdString)AUDIOSCROBBLER_BASE_URL;
-  strURL += m_objtype + "/" + m_encodedobjname + "/" + m_objrequest + ".xml";
-
-  return strURL;
-}
-
-bool CLastFMDirectory::RetrieveList(CStdString url)
-{
-  m_dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
-  if (m_dlgProgress)
-  {
-    m_dlgProgress->ShowProgressBar(false);
-    m_dlgProgress->SetHeading(2);
-    m_dlgProgress->SetLine(0, 15279);
-    m_dlgProgress->SetLine(1, m_objrequest);
-    m_dlgProgress->SetLine(2, m_objname);
-    m_dlgProgress->StartModal();
-    m_dlgProgress->Progress();
-  }
-
-  CThread thread(this, "CLastFMDirectory");
-  m_strSource = url;
-  m_strDestination = "special://temp/lastfm.xml";
-  thread.Create();
-
-  while (!m_Downloaded)
-  {
-    if (m_dlgProgress)
-    {
-      m_dlgProgress->Progress();
-
-      if (m_dlgProgress->IsCanceled())
-      {
-        m_http.Cancel();
-        thread.StopThread();
-        m_dlgProgress->Close();
-        return false;
-      }
-    }
-  }
-
-  if (m_dlgProgress && !m_dlgProgress->IsCanceled() && m_Error)
-  {
-    if (m_dlgProgress) m_dlgProgress->Close();
-    SetErrorDialog(257, 15280, 0, 0);
-    CLog::Log(LOGERROR, "Unable to retrieve list from last.fm");
-    return false;
-  }
-
-
-  if (!m_xmlDoc.LoadFile(m_strDestination))
-  {
-    if (m_dlgProgress) m_dlgProgress->Close();
-    SetErrorDialog(257, 15280, 0, 0);
-    CLog::Log(LOGERROR, "Error parsing file from audioscrobbler web services, Line %d\n%s", m_xmlDoc.ErrorRow(), m_xmlDoc.ErrorDesc());
-    return false;
-  }
-
-  if (m_dlgProgress) m_dlgProgress->Close();
-
-  return true;
-}
-
-void CLastFMDirectory::AddEntry(int iString, CStdString strPath, CStdString strIconPath, bool bFolder, CFileItemList &items)
-{
-  CStdString strLabel = g_localizeStrings.Get(iString);
-  strLabel.Replace("%name%", m_objname);
-  strLabel.Replace("%type%", m_objtype);
-  strLabel.Replace("%request%", m_objrequest);
-  strPath.Replace("%name%", m_encodedobjname);
-  strPath.Replace("%type%", m_objtype);
-  strPath.Replace("%request%", m_objrequest);
-
-  CFileItemPtr pItem(new CFileItem);
-  pItem->SetLabel(strLabel);
-  pItem->SetPath(strPath);
-  pItem->m_bIsFolder = bFolder;
-  pItem->SetLabelPreformated(true);
-  //the extra info is used in the mediawindows to determine which items are needed in the contextmenu
-  if (strPath.Find("lastfm://xbmc") >= 0)
-  {
-    pItem->SetCanQueue(false);
-    pItem->SetExtraInfo("lastfmitem");
-  }
-
-  items.Add(pItem);
-}
-
-void CLastFMDirectory::AddListEntry(const char *name, const char *artist, const char *count, const char *date, const char *icon, CStdString strPath, CFileItemList &items)
-{
-  CStdString strName;
-  CFileItemPtr pItem(new CFileItem);
-  CMusicInfoTag* musicinfotag = pItem->GetMusicInfoTag();
-  musicinfotag->SetTitle(name);
-
-  if (artist)
-  {
-    strName.Format("%s - %s", artist, name);
-    musicinfotag->SetArtist(artist);
-  }
-  else
-  {
-    strName = name;
-  }
-
-  if (count)
-  {
-    pItem->SetLabel2(count);
-    pItem->m_dwSize = _atoi64(count) * 100000000;
-
-    const char *dot;
-    if ((dot = (const char *)strstr(count, ".")))
-      pItem->m_dwSize += _atoi64(dot + 1);
-  }
-
-  pItem->SetLabel(strName);
-  pItem->SetPath(strPath);
-  pItem->m_bIsFolder = true;
-  pItem->SetLabelPreformated(true);
-
-  if (date)
-  {
-    LONGLONG ll = Int32x32To64(atoi(date), 10000000) + 116444736000000000LL;
-    FILETIME ft;
-
-    ft.dwLowDateTime = (DWORD)(ll & 0xFFFFFFFF);
-    ft.dwHighDateTime = (DWORD)(ll >> 32);
-
-    pItem->m_dateTime=ft;
-  }
-
-  pItem->SetCanQueue(false);
-  //the extra info is used in the mediawindows to determine which items are needed in the contextmenu
-  if (m_objname.Equals(g_guiSettings.GetString("scrobbler.lastfmusername")))
-  {
-    if (m_objrequest.Equals("recentbannedtracks"))
-    {
-      pItem->SetExtraInfo("lastfmbanned");
-    }
-    else if (m_objrequest.Equals("recentlovedtracks"))
-    {
-      pItem->SetExtraInfo("lastfmloved");
-    }
-  }
-  if (pItem->GetExtraInfo().IsEmpty() && strPath.Find("lastfm://xbmc") >= 0)
-  {
-    pItem->SetExtraInfo("lastfmitem");
-  }
-
-  // icons? would probably take too long to retrieve them all
-  items.Add(pItem);
-}
-
-bool CLastFMDirectory::ParseArtistList(CStdString url, CFileItemList &items)
-{
-  if (!RetrieveList(url))
-    return false;
-
-  TiXmlElement* pRootElement = m_xmlDoc.RootElement();
-
-  TiXmlElement* pEntry = pRootElement->FirstChildElement("artist");
-
-  while(pEntry)
-  {
-    TiXmlNode* name = pEntry->FirstChild("name");
-    TiXmlNode* count;
-    const char *countstr = NULL;
-    const char *namestr = NULL;
-
-    count = pEntry->FirstChild("count");
-    if (!count) count = pEntry->FirstChild("playcount");
-    if (!count) count = pEntry->FirstChild("match");
-    if (!count && pEntry->Attribute("count"))
-      countstr = pEntry->Attribute("count");
-    else if (count)
-      countstr = count->FirstChild()->Value();
-    
-    if (name)
-      namestr = name->FirstChild()->Value();
-    else
-      namestr = pEntry->Attribute("name");
-
-
-    if (namestr && countstr)
-      AddListEntry(namestr, NULL, countstr, NULL, NULL,
-          "lastfm://xbmc/artist/" + (CStdString)namestr + "/", items);
-
-    pEntry = pEntry->NextSiblingElement("artist");
-  }
-
-  m_xmlDoc.Clear();
-  return true;
-}
-
-bool CLastFMDirectory::ParseAlbumList(CStdString url, CFileItemList &items)
-{
-  if (!RetrieveList(url))
-    return false;
-
-  TiXmlElement* pRootElement = m_xmlDoc.RootElement();
-
-  TiXmlElement* pEntry = pRootElement->FirstChildElement("album");
-
-  while(pEntry)
-  {
-    const char *artist = pRootElement->Attribute("artist");
-    const char *name = NULL;
-    const char *count = NULL;
-
-    if (pEntry->Attribute("name"))
-      name = pEntry->Attribute("name");
-    else
-    {
-      TiXmlNode* nameNode = pEntry->FirstChild("name");
-      if (nameNode && nameNode->FirstChild())
-        name = nameNode->FirstChild()->Value();
-    }
-
-    TiXmlElement* artistElement = pEntry->FirstChildElement("artist");
-    if (artistElement && artistElement->Attribute("name"))
-      artist = artistElement->Attribute("name");
-    else
-    {
-      if (artistElement && artistElement->FirstChild())
-        artist = artistElement->FirstChild()->Value();
-    }
-
-    if (pEntry->Attribute("count"))
-      count = pEntry->Attribute("count");
-    else
-    {
-      TiXmlNode* countNode = pEntry->FirstChild("count");
-      if (!countNode) countNode = pEntry->FirstChild("playcount");
-      if (!countNode) countNode = pEntry->FirstChild("reach");
-      if (countNode)
-        count = countNode->FirstChild()->Value();
-    }
-
-    AddListEntry(name, artist, count, NULL, NULL,
-        "lastfm://xbmc/artist/" + (CStdString)artist + "/", items);
-
-    pEntry = pEntry->NextSiblingElement("album");
-  }
-
-  m_xmlDoc.Clear();
-  return true;
-}
-
-bool CLastFMDirectory::ParseUserList(CStdString url, CFileItemList &items)
-{
-  if (!RetrieveList(url))
-    return false;
-
-  TiXmlElement* pRootElement = m_xmlDoc.RootElement();
-
-  TiXmlElement* pEntry = pRootElement->FirstChildElement("user");
-
-  while(pEntry)
-  {
-    const char *name = pEntry->Attribute("username");
-
-    TiXmlNode* count;
-    count = pEntry->FirstChild("weight");
-    if (!count) count = pEntry->FirstChild("match");
-
-    if (name)
-    {
-      AddListEntry(name, NULL, (count && count->FirstChild()) ? count->FirstChild()->Value() : NULL, NULL, NULL,
-          "lastfm://xbmc/user/" + (CStdString)name + "/", items);
-    }
-
-    pEntry = pEntry->NextSiblingElement("user");
-  }
-
-  m_xmlDoc.Clear();
-  return true;
-}
-
-bool CLastFMDirectory::ParseTagList(CStdString url, CFileItemList &items)
-{
-  if (!RetrieveList(url))
-    return false;
-
-  TiXmlElement* pRootElement = m_xmlDoc.RootElement();
-
-  TiXmlElement* pEntry = pRootElement->FirstChildElement("tag");
-
-  while(pEntry)
-  {
-    TiXmlNode* name = pEntry->FirstChild("name");
-    TiXmlNode* count;
-    const char *countstr = NULL;
-    const char *namestr = NULL;
-
-    count = pEntry->FirstChild("count");
-    if (!count) count = pEntry->FirstChild("playcount");
-    if (!count) count = pEntry->FirstChild("match");
-    if (!count && pEntry->Attribute("count"))
-      countstr = pEntry->Attribute("count");
-    else if (count && count->FirstChild())
-      countstr = count->FirstChild()->Value();
-
-    if (name && name->FirstChild())
-      namestr = name->FirstChild()->Value();
-    else
-      namestr = pEntry->Attribute("name");
-
-    if (namestr && countstr)
-    {
-      AddListEntry(namestr, NULL, countstr, NULL, NULL,
-          "lastfm://xbmc/tag/" + (CStdString)namestr + "/", items);
-    }
-
-    pEntry = pEntry->NextSiblingElement("tag");
-  }
-
-  m_xmlDoc.Clear();
-  return true;
-}
-
-bool CLastFMDirectory::ParseTrackList(CStdString url, CFileItemList &items)
-{
-  if (!RetrieveList(url))
-    return false;
-
-  TiXmlElement* pRootElement = m_xmlDoc.RootElement();
-
-  TiXmlElement* pEntry = pRootElement->FirstChildElement("track");
-
-  while(pEntry)
-  {
-    TiXmlNode* name = pEntry->FirstChild("name");
-    TiXmlNode* artist = pEntry->FirstChild("artist");
-    TiXmlElement *date = pEntry->FirstChildElement("date");
-
-    TiXmlNode* count;
-    count = pEntry->FirstChild("count");
-    if (!count) count = pEntry->FirstChild("playcount");
-    if (!count) count = pEntry->FirstChild("match");
-
-    if (name)
-    {
-      if (artist)
-        AddListEntry(name->FirstChild()->Value(),
-            artist->FirstChild()->Value(),
-            (count) ? count->FirstChild()->Value() : ((date) ? date->FirstChild()->Value() : NULL),
-            (date) ? date->Attribute("uts") : NULL,
-            NULL, "lastfm://xbmc/artist/" + (CStdString)artist->FirstChild()->Value() + "/", items);
-      else
-        // no artist in xml, assuming we're retrieving track list for the artist in m_objname...
-        AddListEntry(name->FirstChild()->Value(),
-            m_objname.c_str(),
-            (count) ? count->FirstChild()->Value() : NULL,
-            NULL, NULL, "lastfm://xbmc/artist/" + m_objname + "/", items);
-    }
-    else
-    {
-      // no luck, try another way :)
-      const char *name = pEntry->Attribute("name");
-      const char *artist = pEntry->FirstChildElement("artist")->Attribute("name");
-      const char *count = pEntry->Attribute("count");
-
-      if (name)
-        AddListEntry(name, artist, count, NULL, NULL,
-            "lastfm://xbmc/artist/" + (CStdString)artist + "/", items);
-    }
-
-    pEntry = pEntry->NextSiblingElement("track");
-  }
-
-  m_xmlDoc.Clear();
-  return true;
-}
-
-bool CLastFMDirectory::SearchSimilarArtists(CFileItemList &items)
-{
-  CStdString strSearchTerm = "";
-
-  if (!GetKeyboardInput(15281, strSearchTerm))
-    return false;
-
-  m_objname = m_encodedobjname = strSearchTerm;
-  CURL::Encode(m_encodedobjname);
-  CURL::Decode(m_objname);
-
-  AddEntry(15267, "lastfm://artist/%name%/similarartists", "", false, items);
-  return ParseArtistList(BuildURLFromInfo(), items);
-}
-
-bool CLastFMDirectory::SearchSimilarTags(CFileItemList &items)
-{
-  CStdString strSearchTerm = "";
-
-  if (!GetKeyboardInput(15282, strSearchTerm))
-    return false;
-
-  m_objname = m_encodedobjname = strSearchTerm;
-  CURL::Encode(m_encodedobjname);
-  CURL::Decode(m_objname);
-
-  return ParseTagList(BuildURLFromInfo(), items);
-}
-
-bool CLastFMDirectory::GetArtistInfo(CFileItemList &items)
-{
-  if (m_objname == "*" && m_objrequest == "similar")
-    return SearchSimilarArtists(items);
-
-  if (m_objrequest == "similar")
-    return ParseArtistList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "topalbums")
-    return ParseAlbumList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "toptracks")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "toptags")
-    return ParseTagList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "fans")
-    return ParseUserList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "")
-  {
-    AddEntry(15261, "lastfm://xbmc/artist/%name%/similar/", "", true, items);
-    AddEntry(15262, "lastfm://xbmc/artist/%name%/topalbums/", "", true, items);
-    AddEntry(15263, "lastfm://xbmc/artist/%name%/toptracks/", "", true, items);
-    AddEntry(15264, "lastfm://xbmc/artist/%name%/toptags/", "", true, items);
-    AddEntry(15265, "lastfm://xbmc/artist/%name%/fans/", "", true, items);
-  }
-  else
-    return false;
-
-  return true;
-}
-
-bool CLastFMDirectory::GetUserInfo(CFileItemList &items)
-{
-  if (m_objrequest == "topartists")
-    return ParseArtistList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "topalbums")
-    return ParseAlbumList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "toptracks")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "toptags")
-    return ParseTagList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "tags")
-    return ParseTagList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "friends")
-    return ParseUserList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "neighbours")
-    return ParseUserList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "weeklyartistchart")
-    return ParseArtistList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "weeklyalbumchart")
-    return ParseAlbumList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "weeklytrackchart")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "recenttracks")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "recentlovedtracks")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "recentbannedtracks")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "")
-  {
-    AddEntry(15268, "lastfm://xbmc/user/%name%/topartists/", "", true, items);
-    AddEntry(15269, "lastfm://xbmc/user/%name%/topalbums/", "", true, items);
-    AddEntry(15270, "lastfm://xbmc/user/%name%/toptracks/", "", true, items);
-    AddEntry(15285, "lastfm://xbmc/user/%name%/tags/", "", true, items);
-    AddEntry(15271, "lastfm://xbmc/user/%name%/friends/", "", true, items);
-    AddEntry(15272, "lastfm://xbmc/user/%name%/neighbours/", "", true, items);
-    AddEntry(15273, "lastfm://xbmc/user/%name%/weeklyartistchart/", "", true, items);
-    AddEntry(15274, "lastfm://xbmc/user/%name%/weeklyalbumchart/", "", true, items);
-    AddEntry(15275, "lastfm://xbmc/user/%name%/weeklytrackchart/", "", true, items);
-    AddEntry(15283, "lastfm://xbmc/user/%name%/recenttracks/", "", true, items);
-    AddEntry(15293, "lastfm://xbmc/user/%name%/recentlovedtracks/", "", true, items);
-    AddEntry(15294, "lastfm://xbmc/user/%name%/recentbannedtracks/", "", true, items);
-  }
-  else
-    return false;
-
-  return true;
-}
-
-bool CLastFMDirectory::GetTagInfo(CFileItemList &items)
-{
-  if (m_objname == "*" && m_objrequest== "search")
-    return SearchSimilarTags(items);
-
-  if (m_objrequest == "topartists")
-    return ParseArtistList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "topalbums")
-    return ParseAlbumList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "toptracks")
-    return ParseTrackList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "toptags")
-    return ParseTagList(BuildURLFromInfo(), items);
-  else if (m_objrequest == "")
-  {
-    AddEntry(15257, "lastfm://xbmc/tag/%name%/topartists/", "", true, items);
-    AddEntry(15258, "lastfm://xbmc/tag/%name%/topalbums/", "", true, items);
-    AddEntry(15259, "lastfm://xbmc/tag/%name%/toptracks/", "", true, items);
-  }
-
-  return true;
-}
-
-bool CLastFMDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
-{
-  CStdString strURL = strPath;
-  CURL url(strURL);
-  strURL=url.GetFileName();
-
-  // parse the URL, finding object type, name, and requested info
-  CStdStringArray vecURLParts;
-
-  m_objtype = "";
-  m_objname = "";
-  m_objrequest = "";
-
-  switch(StringUtils::SplitString(strURL, "/", vecURLParts))
-  {
-  case 1:
-    // simple lastfm:// root URL...
-    g_directoryCache.ClearSubPaths("lastfm://");
-    break;
-  // the following fallthru's are on purpose
-  case 5:
-    m_objrequest = vecURLParts[3];
-  case 4:
-    m_objname = vecURLParts[2];
-    m_encodedobjname = vecURLParts[2];
-    CURL::Encode(m_encodedobjname);
-    CURL::Decode(m_objname);
-  case 3:
-    m_objtype = vecURLParts[1];
-  case 2:
-    if (vecURLParts[0] != "xbmc")
-      return false;
-    break;
-  default:
-    return false;
-  }
-
-  if (m_objtype == "user")
-    m_Error = GetUserInfo(items);
-  else if (m_objtype == "tag")
-    m_Error = GetTagInfo(items);
-  else if (m_objtype == "artist")
-    m_Error = GetArtistInfo(items);
-  else if (m_objtype == "")
-  {
-    AddEntry(15253, "lastfm://xbmc/artist/*/similar/", "", true, items);
-    AddEntry(15254, "lastfm://xbmc/tag/*/search/", "", true, items);
-    AddEntry(15256, "lastfm://xbmc/tag/xbmc/toptags/", "", true, items);
-    if (g_guiSettings.GetString("scrobbler.lastfmusername") != "")
-    {
-      m_encodedobjname = m_objname = g_guiSettings.GetString("scrobbler.lastfmusername");
-      CURL::Decode(m_encodedobjname);
-      AddEntry(15255, "lastfm://xbmc/user/%name%/", "", true, items);
-    }
-    return true;
-  }
-  else
-    return false;
-
-  return m_Error;
-}
-
-DIR_CACHE_TYPE CLastFMDirectory::GetCacheType(const CStdString& strPath) const
-{
-  if (strPath == "lastfm://")
-    return DIR_CACHE_ONCE;
-  return DIR_CACHE_ALWAYS;
-}
-
-void CLastFMDirectory::Run()
-{
-  XFILE::CCurlFile http;
-  if (!http.Download(m_strSource, m_strDestination))
-    m_Error=true;
-
-  m_Downloaded=true;
-}
diff --git a/xbmc/filesystem/LastFMDirectory.h b/xbmc/filesystem/LastFMDirectory.h
deleted file mode 100644 (file)
index 27d1342..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "IDirectory.h"
-#include "CurlFile.h"
-#include "utils/XBMCTinyXML.h"
-#include "threads/Thread.h"
-
-class CGUIDialogProgress;
-
-namespace XFILE
-{
-class CLastFMDirectory :
-      public IDirectory, public IRunnable
-{
-public:
-  CLastFMDirectory(void);
-  virtual ~CLastFMDirectory(void);
-  virtual bool GetDirectory(const CStdString& strPath, CFileItemList &items);
-  virtual void Run();
-
-  virtual bool IsAllowed(const CStdString &strFile) const { return true; };
-  virtual DIR_CACHE_TYPE GetCacheType(const CStdString& strPath) const;
-protected:
-  void AddEntry(int iString, CStdString strPath, CStdString strIconPath, bool bFolder, CFileItemList &items);
-  void AddListEntry(const char *name, const char *artist, const char *count, const char *date, const char *icon, CStdString strPath, CFileItemList &items);
-  CStdString BuildURLFromInfo();
-  bool RetrieveList(CStdString url);
-  bool ParseArtistList(CStdString url, CFileItemList &items);
-  bool ParseAlbumList(CStdString url, CFileItemList &items);
-  bool ParseUserList(CStdString url, CFileItemList &items);
-  bool ParseTagList(CStdString url, CFileItemList &items);
-  bool ParseTrackList(CStdString url, CFileItemList &items);
-
-  bool GetArtistInfo(CFileItemList &items);
-  bool GetUserInfo(CFileItemList &items);
-  bool GetTagInfo(CFileItemList &items);
-
-  bool SearchSimilarTags(CFileItemList &items);
-  bool SearchSimilarArtists(CFileItemList &items);
-
-  bool m_Error;
-  bool m_Downloaded;
-  CXBMCTinyXML m_xmlDoc;
-
-  XFILE::CCurlFile m_http;
-
-  CStdString m_objtype;
-  CStdString m_objname;
-  CStdString m_encodedobjname;
-  CStdString m_objrequest;
-
-  CStdString m_strSource;
-  CStdString m_strDestination;
-
-  CGUIDialogProgress* m_dlgProgress;
-};
-}
diff --git a/xbmc/filesystem/LastFMFile.cpp b/xbmc/filesystem/LastFMFile.cpp
deleted file mode 100644 (file)
index d3211f1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "LastFMFile.h"
-
-namespace XFILE
-{
-
-CLastFMFile::CLastFMFile() : CCurlFile()
-{
-  SetUserAgent("");
-  SetBufferSize(8192);
-}
-
-CLastFMFile::~CLastFMFile()
-{
-}
-
-}
-
diff --git a/xbmc/filesystem/LastFMFile.h b/xbmc/filesystem/LastFMFile.h
deleted file mode 100644 (file)
index cb58c3a..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "CurlFile.h"
-#include "utils/RingBuffer.h"
-
-namespace XFILE
-{
-
-  class CLastFMFile : public CCurlFile
-  {
-  public:
-    CLastFMFile();
-    virtual ~CLastFMFile();
-  protected:
-  };
-
-}
index 5b9b8b2..f73851a 100644 (file)
@@ -38,8 +38,6 @@ SRCS += ImageFile.cpp
 SRCS += iso9660.cpp
 SRCS += ISO9660Directory.cpp
 SRCS += ISOFile.cpp
-SRCS += LastFMDirectory.cpp
-SRCS += LastFMFile.cpp
 SRCS += LibraryDirectory.cpp
 SRCS += MemBufferCache.cpp
 SRCS += MultiPathDirectory.cpp
index fcf633e..059fdb1 100644 (file)
@@ -134,6 +134,7 @@ void CShoutcastFile::Close()
 {
   StopThread();
   delete[] m_buffer;
+  m_buffer = NULL;
   m_file.Close();
 }
 
index e08363f..5d86f9e 100644 (file)
@@ -64,7 +64,7 @@ bool CSourcesDirectory::GetDirectory(const VECSOURCES &sources, CFileItemList &i
   {
     const CMediaSource& share = sources[i];
     CFileItemPtr pItem(new CFileItem(share));
-    if (pItem->IsLastFM() || (pItem->GetPath().Left(14).Equals("musicsearch://")))
+    if (pItem->GetPath().Left(14).Equals("musicsearch://"))
       pItem->SetCanQueue(false);
     
     CStdString strIcon;
@@ -79,8 +79,7 @@ bool CSourcesDirectory::GetDirectory(const VECSOURCES &sources, CFileItemList &i
     }
     else if (pItem->GetPath().Left(9) == "addons://")
       strIcon = "DefaultHardDisk.png";
-    else if (pItem->IsLastFM()
-             || pItem->IsVideoDb()
+    else if (   pItem->IsVideoDb()
              || pItem->IsMusicDb()
              || pItem->IsPlugin()
              || pItem->GetPath() == "special://musicplaylists/"
index acac50e..941bdee 100644 (file)
@@ -452,7 +452,10 @@ SOCKET CVTPSession::GetStreamLive(int channel)
   CLog::Log(LOGDEBUG, "CVTPSession::GetStreamLive - local address %s:%s", namebuf, portbuf );
 
   if(!OpenStreamSocket(sock, address))
+  {
+    closesocket(sock);
     return INVALID_SOCKET;
+  }
 
   int port = ntohs(address.sin_port);
   int addr = ntohl(address.sin_addr.s_addr);
@@ -466,7 +469,10 @@ SOCKET CVTPSession::GetStreamLive(int channel)
                 , (port & 0x00FF)>>0);
 
   if(!SendCommand(buffer, code, result))
+  {
+    closesocket(sock);
     return 0;
+  }
 
   if(!AcceptStreamSocket(sock))
   {
index 29698d3..6526f1d 100644 (file)
@@ -1323,6 +1323,10 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
   {
     control = new CGUIVisualisationControl(parentID, id, posX, posY, width, height);
   }
+  else if (type == CGUIControl::GUICONTROL_RENDERADDON)
+  {
+    control = new CGUIRenderingControl(parentID, id, posX, posY, width, height);
+  }
 
   // things that apply to all controls
   if (control)
index 8f14ab9..4071c08 100644 (file)
@@ -27,6 +27,7 @@
 #include "utils/MathUtils.h"
 #include "utils/log.h"
 #include "windowing/WindowingFactory.h"
+#include "settings/GUISettings.h"
 
 #include <math.h>
 
@@ -735,12 +736,24 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c
   m_color = color;
   SVertex* v = m_vertex + m_vertex_count;
 
+  unsigned char r = GET_R(color)
+              , g = GET_G(color)
+              , b = GET_B(color)
+              , a = GET_A(color);
+
+  if(g_Windowing.UseLimitedColor())
+  {
+    r = (235 - 16) * r / 255;
+    g = (235 - 16) * g / 255;
+    b = (235 - 16) * b / 255;
+  }
+
   for(int i = 0; i < 4; i++)
   {
-    v[i].r = GET_R(color);
-    v[i].g = GET_G(color);
-    v[i].b = GET_B(color);
-    v[i].a = GET_A(color);
+    v[i].r = r;
+    v[i].g = g;
+    v[i].b = b;
+    v[i].a = a;
   }
 
 #if defined(HAS_GL) || defined(HAS_DX)
index 654ea00..197e2f0 100644 (file)
@@ -57,17 +57,33 @@ void CGUIFontTTFDX::Begin()
 
   if (m_nestedBeginCount == 0)
   {
+    int unit = 0;
     // just have to blit from our texture.
-    m_texture->BindToUnit(0);
-    pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); // only use diffuse
-    pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
-    pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
-    pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
-    pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
+    m_texture->BindToUnit(unit);
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); // only use diffuse
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);
+    unit++;
+
+    if(g_Windowing.UseLimitedColor())
+    {
+      pD3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP  , D3DTOP_ADD );
+      pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_CURRENT) ;
+#if(1)
+      pD3DDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_RGBA(16,16,16,0) );
+      pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_TFACTOR );
+#else
+      pD3DDevice->SetTextureStageState( unit, D3DTSS_CONSTANT , D3DCOLOR_RGBA(16,16,16,0) );
+      pD3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_CONSTANT );
+#endif
+      unit++;
+    }
 
     // no other texture stages needed
-    pD3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
-    pD3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP, D3DTOP_DISABLE);
+    pD3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
 
     pD3DDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
     pD3DDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
index 241f095..2de439f 100644 (file)
@@ -28,9 +28,7 @@
 #include "gui3d.h"
 #include "utils/log.h"
 #include "utils/GLUtils.h"
-#if HAS_GLES == 2
 #include "windowing/WindowingFactory.h"
-#endif
 
 // stuff for freetype
 #include <ft2build.h>
@@ -98,6 +96,26 @@ void CGUIFontTTFGL::Begin()
     glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
     glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     VerifyGLState();
+
+    if(g_Windowing.UseLimitedColor())
+    {
+      glActiveTexture(GL_TEXTURE1);
+      glBindTexture(GL_TEXTURE_2D, m_nTexture); // dummy bind
+      glEnable(GL_TEXTURE_2D);
+
+      const GLfloat rgba[4] = {16.0f / 255.0f, 16.0f / 255.0f, 16.0f / 255.0f, 0.0f};
+      glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_COMBINE);
+      glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba);
+      glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB      , GL_ADD);
+      glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB      , GL_PREVIOUS);
+      glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB      , GL_CONSTANT);
+      glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB     , GL_SRC_COLOR);
+      glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB     , GL_SRC_COLOR);
+      glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA    , GL_REPLACE);
+      glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA    , GL_PREVIOUS);
+      VerifyGLState();
+    }
+
 #else
     g_Windowing.EnableGUIShader(SM_FONTS);
 #endif
@@ -127,6 +145,9 @@ void CGUIFontTTFGL::End()
   glEnableClientState(GL_TEXTURE_COORD_ARRAY);
   glDrawArrays(GL_QUADS, 0, m_vertex_count);
   glPopClientAttrib();
+
+  glBindTexture(GL_TEXTURE_2D, 0);
+  glActiveTexture(GL_TEXTURE0);
 #else
   // GLES 2.0 version. Cannot draw quads. Convert to triangles.
   GLint posLoc  = g_Windowing.GUIShaderGetPos();
index 627171b..a019b95 100644 (file)
@@ -64,8 +64,8 @@ void CGUIKeyboardFactory::keyTypedCB(CGUIKeyboard *ref, const std::string &typed
       case FILTERING_NONE:
         break;
     }
+    ref->resetAutoCloseTimer();
   }
-  ref->resetAutoCloseTimer();
 }
 
 // Show keyboard with initial value (aTextString) and replace with result string.
@@ -112,7 +112,7 @@ bool CGUIKeyboardFactory::ShowAndGetInput(CStdString& aTextString, const CVarian
 
 bool CGUIKeyboardFactory::ShowAndGetInput(CStdString& aTextString, bool allowEmptyResult, unsigned int autoCloseMs /* = 0 */)
 {
-  return ShowAndGetInput(aTextString, "", allowEmptyResult, autoCloseMs) != 0;
+  return ShowAndGetInput(aTextString, "", allowEmptyResult, false, autoCloseMs);
 }
 
 // Shows keyboard and prompts for a password.
@@ -132,7 +132,7 @@ bool CGUIKeyboardFactory::ShowAndGetNewPassword(CStdString& newPassword, unsigne
 bool CGUIKeyboardFactory::ShowAndGetFilter(CStdString &filter, bool searching, unsigned int autoCloseMs /* = 0 */)
 {
   m_filtering = searching ? FILTERING_SEARCH : FILTERING_CURRENT;
-  bool ret = ShowAndGetInput(filter, searching ? 16017 : 16028, true, autoCloseMs);
+  bool ret = ShowAndGetInput(filter, searching ? 16017 : 16028, true, false, autoCloseMs);
   m_filtering = FILTERING_NONE;
   return ret;
 }
index b573ca9..6e51184 100644 (file)
 
 #include "GUIRenderingControl.h"
 #include "GUIUserMessages.h"
-#include "addons/Visualisation.h"
 #include "threads/SingleLock.h"
+#include "guilib/IRenderingCallback.h"
+#include "windowing/WindowingFactory.h"
 
 using namespace std;
-using namespace ADDON;
 
 #define LABEL_ROW1 10
 #define LABEL_ROW2 11
@@ -34,18 +34,20 @@ CGUIRenderingControl::CGUIRenderingControl(int parentID, int controlID, float po
     : CGUIControl(parentID, controlID, posX, posY, width, height)
 {
   ControlType = GUICONTROL_RENDERADDON;
+  m_callback = NULL;
 }
 
 CGUIRenderingControl::CGUIRenderingControl(const CGUIRenderingControl &from)
 : CGUIControl(from)
 {
   ControlType = GUICONTROL_RENDERADDON;
+  m_callback = NULL;
 }
 
-void CGUIRenderingControl::LoadAddon(const AddonPtr &addon)
+bool CGUIRenderingControl::InitCallback(IRenderingCallback *callback)
 {
-  if (!addon)
-    return;
+  if (!callback)
+    return false;
 
   CSingleLock lock(m_rendering);
   g_graphicsContext.CaptureStateBlock();
@@ -58,13 +60,17 @@ void CGUIRenderingControl::LoadAddon(const AddonPtr &addon)
   if (x + w > g_graphicsContext.GetWidth()) w = g_graphicsContext.GetWidth() - x;
   if (y + h > g_graphicsContext.GetHeight()) h = g_graphicsContext.GetHeight() - y;
 
-  VizPtr viz = boost::dynamic_pointer_cast<CVisualisation>(addon);
-  if (viz && viz->Create((int)(x+0.5f), (int)(y+0.5f), (int)(w+0.5f), (int)(h+0.5f)))
-  {
-    m_addon = viz;
-  }
+  void *device = NULL;
+#if HAS_DX
+  device = g_Windowing.Get3DDevice();
+#endif
+  if (callback->Create((int)(x+0.5f), (int)(y+0.5f), (int)(w+0.5f), (int)(h+0.5f), device))
+    m_callback = callback;
+  else
+    return false;
 
   g_graphicsContext.ApplyStateBlock();
+  return true;
 }
 
 void CGUIRenderingControl::UpdateVisibility(const CGUIListItem *item)
@@ -72,7 +78,7 @@ void CGUIRenderingControl::UpdateVisibility(const CGUIListItem *item)
   // if made invisible, start timer, only free addonptr after
   // some period, configurable by window class
   CGUIControl::UpdateVisibility(item);
-  if (!IsVisible() && m_addon)
+  if (!IsVisible() && m_callback)
     FreeResources();
 }
 
@@ -80,7 +86,7 @@ void CGUIRenderingControl::Process(unsigned int currentTime, CDirtyRegionList &d
 {
   // TODO Add processing to the addon so it could mark when actually changing
   CSingleLock lock(m_rendering);
-  if (m_addon)
+  if (m_callback && m_callback->IsDirty())
     MarkDirtyRegion();
 
   CGUIControl::Process(currentTime, dirtyregions);
@@ -89,14 +95,14 @@ void CGUIRenderingControl::Process(unsigned int currentTime, CDirtyRegionList &d
 void CGUIRenderingControl::Render()
 {
   CSingleLock lock(m_rendering);
-  if (m_addon)
+  if (m_callback)
   {
     // set the viewport - note: We currently don't have any control over how
     // the addon renders, so the best we can do is attempt to define
     // a viewport??
     g_graphicsContext.SetViewPort(m_posX, m_posY, m_width, m_height);
     g_graphicsContext.CaptureStateBlock();
-    m_addon->Render();
+    m_callback->Render();
     g_graphicsContext.ApplyStateBlock();
     g_graphicsContext.RestoreViewPort();
   }
@@ -106,13 +112,14 @@ void CGUIRenderingControl::Render()
 
 void CGUIRenderingControl::FreeResources(bool immediately)
 {
-  if (!m_addon) return;
-
   CSingleLock lock(m_rendering);
+
+  if (!m_callback) return;
+
   g_graphicsContext.CaptureStateBlock(); //TODO locking
-  m_addon->Stop();
+  m_callback->Stop();
   g_graphicsContext.ApplyStateBlock();
-  m_addon.reset();
+  m_callback = NULL;
 }
 
 bool CGUIRenderingControl::CanFocusFromPoint(const CPoint &point) const
index bea2140..4c7d531 100644 (file)
@@ -20,7 +20,8 @@
  */
 
 #include "GUIControl.h"
-#include "addons/IAddon.h"
+
+class IRenderingCallback;
 
 class CGUIRenderingControl : public CGUIControl
 {
@@ -35,9 +36,9 @@ public:
   virtual void FreeResources(bool immediately = false);
   virtual bool CanFocus() const { return false; }
   virtual bool CanFocusFromPoint(const CPoint &point) const;
-  void LoadAddon(const ADDON::AddonPtr &addon);
+  bool InitCallback(IRenderingCallback *callback);
 
 protected:
   CCriticalSection m_rendering;
-  ADDON::VizPtr m_addon;
+  IRenderingCallback *m_callback;
 };
index 7bd21d1..2dcf88b 100644 (file)
@@ -31,6 +31,7 @@ CGUITextureD3D::CGUITextureD3D(float posX, float posY, float width, float height
 
 void CGUITextureD3D::Begin(color_t color)
 {
+  int unit = 0;
   CBaseTexture* texture = m_texture.m_textures[m_currentFrame];
   LPDIRECT3DDEVICE9 p3DDevice = g_Windowing.Get3DDevice();
 
@@ -38,30 +39,50 @@ void CGUITextureD3D::Begin(color_t color)
   if (m_diffuse.size())
     m_diffuse.m_textures[0]->LoadToGPU();
   // Set state to render the image
-  texture->BindToUnit(0);
-  p3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
-  p3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
-  p3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
-  p3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
-  p3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
-  p3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
+  texture->BindToUnit(unit);
+  p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP  , D3DTOP_MODULATE );
+  p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_TEXTURE   );
+  p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_DIFFUSE   );
+  p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP  , D3DTOP_MODULATE );
+  p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE   );
+  p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE   );
+  unit++;
+
   if (m_diffuse.size())
   {
     m_diffuse.m_textures[0]->BindToUnit(1);
-    p3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
-    p3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
-    p3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE );
-    p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
-    p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG2, D3DTA_CURRENT );
-    p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
-    p3DDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_DISABLE);
-    p3DDevice->SetTextureStageState( 2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_TEXTURE   );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_CURRENT   );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP  , D3DTOP_MODULATE );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG1, D3DTA_TEXTURE   );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAARG2, D3DTA_CURRENT   );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP  , D3DTOP_MODULATE );
+    unit++;
   }
-  else
+
+  if(g_Windowing.UseLimitedColor())
   {
-    p3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
-    p3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+    m_col = D3DCOLOR_RGBA(GET_R(color) * (235 - 16) / 255
+                        , GET_G(color) * (235 - 16) / 255
+                        , GET_B(color) * (235 - 16) / 255
+                        , GET_A(color));
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP  , D3DTOP_ADD );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG1, D3DTA_CURRENT) ;
+#if(1)
+    p3DDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_RGBA(16,16,16, 0) );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_TFACTOR );
+#else
+    p3DDevice->SetTextureStageState( unit, D3DTSS_CONSTANT , D3DCOLOR_RGBA(16,16,16, 0) );
+    p3DDevice->SetTextureStageState( unit, D3DTSS_COLORARG2, D3DTA_CONSTANT );
+#endif
+    unit++;
   }
+  else
+    m_col = color;
+
+  p3DDevice->SetTextureStageState( unit, D3DTSS_COLOROP, D3DTOP_DISABLE);
+  p3DDevice->SetTextureStageState( unit, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
+
   p3DDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
   p3DDevice->SetRenderState( D3DRS_ALPHAREF, 0 );
   p3DDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
@@ -76,7 +97,6 @@ void CGUITextureD3D::Begin(color_t color)
   p3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE);
 
   p3DDevice->SetFVF( D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX2 );
-  m_col = color;
 }
 
 void CGUITextureD3D::End()
index e69993b..effd525 100644 (file)
@@ -26,6 +26,7 @@
 #include "utils/log.h"
 #include "utils/GLUtils.h"
 #include "guilib/Geometry.h"
+#include "windowing/WindowingFactory.h"
 
 #if defined(HAS_GL)
 
@@ -37,17 +38,23 @@ CGUITextureGL::CGUITextureGL(float posX, float posY, float width, float height,
 
 void CGUITextureGL::Begin(color_t color)
 {
-  m_col[0] = (GLubyte)GET_R(color);
-  m_col[1] = (GLubyte)GET_G(color);
-  m_col[2] = (GLubyte)GET_B(color);
-  m_col[3] = (GLubyte)GET_A(color);
+  int range, unit = 0;
+  if(g_Windowing.UseLimitedColor())
+    range = 235 - 16;
+  else
+    range = 255 -  0;
+
+  m_col[0] = GET_R(color) * range / 255;
+  m_col[1] = GET_G(color) * range / 255;
+  m_col[2] = GET_B(color) * range / 255;
+  m_col[3] = GET_A(color);
 
   CBaseTexture* texture = m_texture.m_textures[m_currentFrame];
   texture->LoadToGPU();
   if (m_diffuse.size())
     m_diffuse.m_textures[0]->LoadToGPU();
 
-  texture->BindToUnit(0);
+  texture->BindToUnit(unit++);
 
   glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
   glEnable(GL_BLEND);          // Turn Blending On
@@ -56,23 +63,53 @@ void CGUITextureGL::Begin(color_t color)
   // diffuse coloring
   glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
   glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
-  glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
+  glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
   glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
   glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
   glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+
+  glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+  glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
+  glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PRIMARY_COLOR);
+  glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+  glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
   VerifyGLState();
 
   if (m_diffuse.size())
   {
-    m_diffuse.m_textures[0]->BindToUnit(1);
+    m_diffuse.m_textures[0]->BindToUnit(unit++);
     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
     glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
-    glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE1);
+    glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
     glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
     glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
     glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
+
+    glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
+    glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
+    glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS);
+    glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+    glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
     VerifyGLState();
   }
+
+  if(g_Windowing.UseLimitedColor())
+  {
+    texture->BindToUnit(unit++); // dummy bind
+    const GLfloat rgba[4] = {16.0f / 255.0f, 16.0f / 255.0f, 16.0f / 255.0f, 0.0f};
+    glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE , GL_COMBINE);
+    glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba);
+    glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB      , GL_ADD);
+    glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB      , GL_PREVIOUS);
+    glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB      , GL_CONSTANT);
+    glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB     , GL_SRC_COLOR);
+    glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_RGB     , GL_SRC_COLOR);
+
+    glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA    , GL_REPLACE);
+    glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA    , GL_PREVIOUS);
+    VerifyGLState();
+  }
+
   //glDisable(GL_TEXTURE_2D); // uncomment these 2 lines to switch to wireframe rendering
   //glBegin(GL_LINE_LOOP);
   glBegin(GL_QUADS);
@@ -82,10 +119,8 @@ void CGUITextureGL::End()
 {
   glEnd();
   if (m_diffuse.size())
-  {
     glDisable(GL_TEXTURE_2D);
-    glActiveTextureARB(GL_TEXTURE0_ARB);
-  }
+  glActiveTexture(GL_TEXTURE0_ARB);
   glDisable(GL_TEXTURE_2D);
 }
 
index d9ce544..91e9c42 100644 (file)
@@ -25,6 +25,7 @@
 #include "addons/AddonManager.h"
 #include "addons/Visualisation.h"
 #include "utils/log.h"
+#include "guilib/IRenderingCallback.h"
 
 using namespace std;
 using namespace ADDON;
@@ -99,9 +100,14 @@ void CGUIVisualisationControl::Process(unsigned int currentTime, CDirtyRegionLis
 
     if (!m_addon && !m_bAttemptedLoad)
     {
-      AddonPtr viz;
-      if (ADDON::CAddonMgr::Get().GetDefault(ADDON_VIZ, viz))
-        LoadAddon(viz);
+      AddonPtr addon;
+      if (ADDON::CAddonMgr::Get().GetDefault(ADDON_VIZ, addon))
+      {
+        m_addon = boost::dynamic_pointer_cast<CVisualisation>(addon);
+        if (m_addon)
+          if (!InitCallback(m_addon.get()))
+            m_addon.reset();
+      }
 
       m_bAttemptedLoad = true;
     }
@@ -120,6 +126,7 @@ void CGUIVisualisationControl::FreeResources(bool immediately)
   g_windowManager.SendMessage(msg);
   CLog::Log(LOGDEBUG, "FreeVisualisation() started");
   CGUIRenderingControl::FreeResources(immediately);
+  m_addon.reset();
   CLog::Log(LOGDEBUG, "FreeVisualisation() done");
 }
 
index 58cf261..21e303e 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "GUIRenderingControl.h"
+#include "addons/IAddon.h"
 
 class CGUIVisualisationControl : public CGUIRenderingControl
 {
@@ -33,4 +34,5 @@ public:
   virtual bool OnMessage(CGUIMessage &message);
 private:
   bool m_bAttemptedLoad;
+  ADDON::VizPtr m_addon;
 };
index 9dffc65..f496946 100644 (file)
@@ -772,15 +772,7 @@ int CGUIWindowManager::GetTopMostModalDialogID(bool ignoreClosing /*= false*/) c
   return WINDOW_INVALID;
 }
 
-void CGUIWindowManager::SendThreadMessage(CGUIMessage& message)
-{
-  CSingleLock lock(m_critSection);
-
-  CGUIMessage* msg = new CGUIMessage(message);
-  m_vecThreadMessages.push_back( pair<CGUIMessage*,int>(msg,0) );
-}
-
-void CGUIWindowManager::SendThreadMessage(CGUIMessage& message, int window)
+void CGUIWindowManager::SendThreadMessage(CGUIMessage& message, int window /*= 0*/)
 {
   CSingleLock lock(m_critSection);
 
index e7f87cd..ec4db9e 100644 (file)
@@ -118,8 +118,7 @@ public:
   void RemoveDialog(int id);
   int GetTopMostModalDialogID(bool ignoreClosing = false) const;
 
-  void SendThreadMessage(CGUIMessage& message);
-  void SendThreadMessage(CGUIMessage& message, int window);
+  void SendThreadMessage(CGUIMessage& message, int window = 0);
   void DispatchThreadMessages();
   void AddMsgTarget( IMsgTargetCallback* pMsgTarget );
   int GetActiveWindow() const;
diff --git a/xbmc/guilib/IRenderingCallback.h b/xbmc/guilib/IRenderingCallback.h
new file mode 100644 (file)
index 0000000..0117880
--- /dev/null
@@ -0,0 +1,30 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2012 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+class IRenderingCallback
+{
+public:
+  virtual bool Create(int x, int y, int w, int h, void *device) = 0;
+  virtual void Render() = 0;
+  virtual void Stop() = 0;
+  virtual bool IsDirty() { return true; }
+};
index ac93aa4..1d5c277 100644 (file)
@@ -248,6 +248,7 @@ CJpegIO::~CJpegIO()
 void CJpegIO::Close()
 {
   free(m_inputBuff);
+  m_inputBuff = NULL;
   m_inputBuffSize = 0;
   ReleaseThumbnailBuffer();
 }
index d2f0f5e..7a430f3 100644 (file)
@@ -185,14 +185,10 @@ void CGLTexture::LoadToGPU()
 
 void CGLTexture::BindToUnit(unsigned int unit)
 {
-  // we support only 2 texture units at present
-#ifndef HAS_GLES
-  glActiveTexture((unit == 1) ? GL_TEXTURE1_ARB : GL_TEXTURE0_ARB);
+  glActiveTexture(GL_TEXTURE0 + unit);
   glBindTexture(GL_TEXTURE_2D, m_texture);
+#ifndef HAS_GLES
   glEnable(GL_TEXTURE_2D);
-#else // GLES
-  glActiveTexture((unit == 1) ? GL_TEXTURE1 : GL_TEXTURE0);
-  glBindTexture(GL_TEXTURE_2D, m_texture);
 #endif
 }
 
index 25536c1..5803ef1 100644 (file)
@@ -64,7 +64,7 @@ bool CXImage::LoadImageFromMemory(unsigned char* buffer, unsigned int bufSize, u
 
 bool CXImage::Decode(const unsigned char *pixels, unsigned int pitch, unsigned int format)
 {
-  if (m_image.width == 0 || m_image.width == 0 || !m_dll.IsLoaded())
+  if (m_image.width == 0 || m_image.height == 0 || !m_dll.IsLoaded())
     return false;
 
   unsigned int dstPitch = pitch;
@@ -128,4 +128,4 @@ void CXImage::ReleaseThumbnailBuffer()
 
   m_dll.FreeMemory(m_thumbnailbuffer);
   m_thumbnailbuffer = NULL;
-}
\ No newline at end of file
+}
index d5ff66a..c9ede3e 100644 (file)
@@ -352,7 +352,8 @@ static const ActionMapping windows[] =
         {"peripherals"              , WINDOW_DIALOG_PERIPHERAL_MANAGER},
         {"peripheralsettings"       , WINDOW_DIALOG_PERIPHERAL_SETTINGS},
         {"extendedprogressdialog"   , WINDOW_DIALOG_EXT_PROGRESS},
-        {"mediafilter"              , WINDOW_DIALOG_MEDIA_FILTER}};
+        {"mediafilter"              , WINDOW_DIALOG_MEDIA_FILTER},
+        {"addon"                    , WINDOW_ADDON_START}};
 
 static const ActionMapping mousecommands[] =
 {
@@ -908,6 +909,11 @@ int CButtonTranslator::GetFallbackWindow(int windowID)
     if (fallbackWindows[index].origin == windowID)
       return fallbackWindows[index].target;
   }
+  // for addon windows use WINDOW_ADDON_START
+  // because id is dynamic
+  if (windowID >= WINDOW_ADDON_START && windowID <= WINDOW_ADDON_END)
+    return WINDOW_ADDON_START;
+
   return -1;
 }
 
@@ -918,7 +924,14 @@ CAction CButtonTranslator::GetAction(int window, const CKey &key, bool fallback)
   int actionID = GetActionCode(window, key, strAction);
   // if it's invalid, try to get it from the global map
   if (actionID == 0 && fallback)
-    actionID = GetActionCode( -1, key, strAction);
+  {
+    int fallbackWindow = GetFallbackWindow(window);
+    if (fallbackWindow > -1)
+      actionID = GetActionCode(fallbackWindow, key, strAction);
+    // still no valid action? use global map
+    if (actionID == 0)
+      actionID = GetActionCode( -1, key, strAction);
+  }
   // Now fill our action structure
   CAction action(actionID, strAction, key);
   return action;
index a8f621d..b82da1a 100644 (file)
@@ -190,7 +190,10 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, c
       // TODO: Can be removed once this is properly handled when starting playback of a file
       item->SetProperty(LOOKUP_PROPERTY, false);
 
-      object["item"]["title"] = item->GetMusicInfoTag()->GetTitle();
+      CStdString title = item->GetMusicInfoTag()->GetTitle();
+      if (title.IsEmpty())
+        title = item->GetLabel();
+      object["item"]["title"] = title;
 
       if (item->GetMusicInfoTag()->GetTrackNumber() > 0)
         object["item"]["track"] = item->GetMusicInfoTag()->GetTrackNumber();
index dc98cff..27e942a 100644 (file)
@@ -43,7 +43,6 @@
 #include "addons/AddonInstaller.h"
 #include "addons/AddonManager.h"
 #include "addons/PluginSource.h"
-#include "music/LastFmManager.h"
 #include "utils/log.h"
 #include "storage/MediaManager.h"
 #include "utils/RssReader.h"
@@ -172,8 +171,6 @@ const BUILT_IN commands[] = {
   { "ExportLibrary",              true,   "Export the video/music library" },
   { "PageDown",                   true,   "Send a page down event to the pagecontrol with given id" },
   { "PageUp",                     true,   "Send a page up event to the pagecontrol with given id" },
-  { "LastFM.Love",                false,  "Add the current playing last.fm radio track to the last.fm loved tracks" },
-  { "LastFM.Ban",                 false,  "Ban the current playing last.fm radio track" },
   { "Container.Refresh",          false,  "Refresh current listing" },
   { "Container.Update",           false,  "Update current listing. Send Container.Update(path,replace) to reset the path history" },
   { "Container.NextViewMode",     false,  "Move to the next view type (and refresh the listing)" },
@@ -211,6 +208,9 @@ const BUILT_IN commands[] = {
   { "ToggleDebug",                false,  "Enables/disables debug mode" },
   { "StartPVRManager",            false,  "(Re)Starts the PVR manager" },
   { "StopPVRManager",             false,  "Stops the PVR manager" },
+#if defined(TARGET_ANDROID)
+  { "StartAndroidActivity",       true,   "Launch an Android native app with the given package name.  Optional parms (in order): intent, dataType, dataURI." },
+#endif
 };
 
 bool CBuiltins::HasCommand(const CStdString& execString)
@@ -874,7 +874,7 @@ int CBuiltins::Execute(const CStdString& execString)
   }
   else if (execute.Equals("playwith"))
   {
-    g_application.m_eForcedNextPlayer = CPlayerCoreFactory::GetPlayerCore(parameter);
+    g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().GetPlayerCore(parameter);
     g_application.OnAction(CAction(ACTION_PLAYER_PLAY));
   }
   else if (execute.Equals("mute"))
@@ -983,7 +983,9 @@ int CBuiltins::Execute(const CStdString& execString)
 
     if( g_alarmClock.IsRunning() )
       g_alarmClock.Stop(params[0],silent);
-
+    // no negative times not allowed, loop must have a positive time
+    if (seconds < 0 || (seconds == 0 && loop))
+      return false;
     g_alarmClock.Start(params[0], seconds, params[1], silent, loop);
   }
   else if (execute.Equals("notification"))
@@ -1395,14 +1397,6 @@ int CBuiltins::Execute(const CStdString& execString)
       }
     }
   }
-  else if (execute.Equals("lastfm.love"))
-  {
-    CLastFmManager::GetInstance()->Love(parameter.Equals("false") ? false : true);
-  }
-  else if (execute.Equals("lastfm.ban"))
-  {
-    CLastFmManager::GetInstance()->Ban(parameter.Equals("false") ? false : true);
-  }
   else if (execute.Equals("control.move") && params.size() > 1)
   {
     CGUIMessage message(GUI_MSG_MOVE_OFFSET, g_windowManager.GetFocusedWindow(), atoi(params[0].c_str()), atoi(params[1].c_str()));
@@ -1622,6 +1616,10 @@ int CBuiltins::Execute(const CStdString& execString)
   {
     g_application.StopPVRManager();
   }
+  else if (execute.Equals("StartAndroidActivity") && params.size() > 0)
+  {
+    CApplicationMessenger::Get().StartAndroidActivity(params);
+  }
   else
     return -1;
   return 0;
index 4a04ac5..d06b0c6 100644 (file)
@@ -27,6 +27,7 @@
 #include "ApplicationMessenger.h"
 #include "TextureCache.h"
 #include "filesystem/File.h"
+#include "utils/StringUtils.h"
 
 using namespace std;
 using namespace JSONRPC;
@@ -187,7 +188,7 @@ JSONRPC_STATUS CAddonsOperations::ExecuteAddon(const CStdString &method, ITransp
     {
       if (it != params.begin_array())
         argv += ",";
-      argv += it->asString();
+      argv += StringUtils::Paramify(it->asString());
     }
   }
   
index dd11617..708e234 100644 (file)
@@ -22,6 +22,7 @@
 #include "music/MusicDatabase.h"
 #include "FileItem.h"
 #include "Util.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "music/tags/MusicInfoTag.h"
 #include "music/Artist.h"
@@ -531,7 +532,7 @@ JSONRPC_STATUS CAudioLibrary::Scan(const CStdString &method, ITransportLayer *tr
   if (directory.empty())
     cmd = "updatelibrary(music)";
   else
-    cmd.Format("updatelibrary(music, %s)", directory.c_str());
+    cmd.Format("updatelibrary(music, %s)", StringUtils::Paramify(directory).c_str());
 
   CApplicationMessenger::Get().ExecBuiltIn(cmd);
   return ACK;
@@ -541,7 +542,7 @@ JSONRPC_STATUS CAudioLibrary::Export(const CStdString &method, ITransportLayer *
 {
   CStdString cmd;
   if (parameterObject["options"].isMember("path"))
-    cmd.Format("exportlibrary(music, false, %s)", parameterObject["options"]["path"].asString());
+    cmd.Format("exportlibrary(music, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()));
   else
     cmd.Format("exportlibrary(music, true, %s, %s)",
       parameterObject["options"]["images"].asBoolean() ? "true" : "false",
index bf33bbb..58efd23 100644 (file)
@@ -305,6 +305,11 @@ void CFileItemHandler::HandleFileItem(const char *ID, bool allowFile, const char
 
         if (!object.isMember("type"))
           object["type"] = "unknown";
+
+        if (item->m_bIsFolder)
+          object["filetype"] = "directory";
+        else 
+          object["filetype"] = "file";
       }
     }
 
index c575de6..cfc8717 100644 (file)
@@ -113,7 +113,7 @@ JSONRPC_STATUS CFileOperations::GetDirectory(const CStdString &method, ITranspor
 
   if (CDirectory::GetDirectory(strPath, items, extensions))
   {
-    CFileItemList filteredDirectories, filteredFiles;
+    CFileItemList filteredFiles;
     for (unsigned int i = 0; i < (unsigned int)items.Size(); i++)
     {
       if (CUtil::ExcludeFileOrFolder(items[i]->GetPath(), regexps))
@@ -131,9 +131,6 @@ JSONRPC_STATUS CFileOperations::GetDirectory(const CStdString &method, ITranspor
            media == "files" ||
            URIUtils::IsUPnP(items.GetPath()))
       {
-        if (items[i]->m_bIsFolder)
-          filteredDirectories.Add(items[i]);
-        else 
           filteredFiles.Add(items[i]);
       }
       else
@@ -141,16 +138,10 @@ JSONRPC_STATUS CFileOperations::GetDirectory(const CStdString &method, ITranspor
         CFileItemPtr fileItem(new CFileItem());
         if (FillFileItem(items[i], fileItem, media, parameterObject))
         {
-          if (items[i]->m_bIsFolder)
-            filteredDirectories.Add(fileItem);
-          else
             filteredFiles.Add(fileItem);
         }
         else
         {
-          if (items[i]->m_bIsFolder)
-            filteredDirectories.Add(items[i]);
-          else
             filteredFiles.Add(items[i]);
         }
       }
@@ -176,22 +167,7 @@ JSONRPC_STATUS CFileOperations::GetDirectory(const CStdString &method, ITranspor
     if (!hasFileField)
       param["properties"].append("file");
 
-    HandleFileItemList("id", true, "files", filteredDirectories, param, result);
-    for (unsigned int index = 0; index < result["files"].size(); index++)
-    {
-      result["files"][index]["filetype"] = "directory";
-    }
-    int count = (int)result["limits"]["total"].asInteger();
-
     HandleFileItemList("id", true, "files", filteredFiles, param, result);
-    for (unsigned int index = count; index < result["files"].size(); index++)
-    {
-      result["files"][index]["filetype"] = "file";
-    }
-    count += (int)result["limits"]["total"].asInteger();
-
-    result["limits"]["end"] = count;
-    result["limits"]["total"] = count;
 
     return OK;
   }
index 901e562..c629d62 100644 (file)
@@ -230,7 +230,14 @@ JSONRPC_STATUS CPlayerOperations::PlayPause(const CStdString &method, ITransport
         CBuiltins::Execute("playercontrol(play)");
       else
       {
-        if (parameterObject["play"].asBoolean() == g_application.IsPaused())
+        if (parameterObject["play"].asBoolean())
+        {
+          if (g_application.IsPaused())
+            CApplicationMessenger::Get().MediaPause();
+          else if (g_application.GetPlaySpeed() != 1)
+            g_application.SetPlaySpeed(1);
+        }
+        else if (!g_application.IsPaused())
           CApplicationMessenger::Get().MediaPause();
       }
       result["speed"] = g_application.IsPaused() ? 0 : g_application.GetPlaySpeed();
@@ -1354,17 +1361,15 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
           int index = g_application.m_pPlayer->GetAudioStream();
           if (index >= 0)
           {
+            SPlayerAudioStreamInfo info;
+            g_application.m_pPlayer->GetAudioStreamInfo(index, info);
+
             result["index"] = index;
-            CStdString value;
-            g_application.m_pPlayer->GetAudioStreamName(index, value);
-            result["name"] = value;
-            value.Empty();
-            g_application.m_pPlayer->GetAudioStreamLanguage(index, value);
-            result["language"] = value;
-
-            result["codec"] = g_application.m_pPlayer->GetAudioCodecName();
-            result["bitrate"] = g_application.m_pPlayer->GetAudioBitrate();
-            result["channels"] = g_application.m_pPlayer->GetChannels();
+            result["name"] = info.name;
+            result["language"] = info.language;
+            result["codec"] = info.audioCodecName;
+            result["bitrate"] = info.bitrate;
+            result["channels"] = info.channels;
           }
         }
         else
@@ -1387,14 +1392,13 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
         {
           for (int index = 0; index < g_application.m_pPlayer->GetAudioStreamCount(); index++)
           {
+            SPlayerAudioStreamInfo info;
+            g_application.m_pPlayer->GetAudioStreamInfo(index, info);
+
             CVariant audioStream(CVariant::VariantTypeObject);
             audioStream["index"] = index;
-            CStdString value;
-            g_application.m_pPlayer->GetAudioStreamName(index, value);
-            audioStream["name"] = value;
-            value.Empty();
-            g_application.m_pPlayer->GetAudioStreamLanguage(index, value);
-            audioStream["language"] = value;
+            audioStream["name"] = info.name;
+            audioStream["language"] = info.language;
 
             result.append(audioStream);
           }
@@ -1434,13 +1438,12 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
           int index = g_application.m_pPlayer->GetSubtitle();
           if (index >= 0)
           {
+            SPlayerSubtitleStreamInfo info;
+            g_application.m_pPlayer->GetSubtitleStreamInfo(index, info);
+
             result["index"] = index;
-            CStdString value;
-            g_application.m_pPlayer->GetSubtitleName(index, value);
-            result["name"] = value;
-            value.Empty();
-            g_application.m_pPlayer->GetSubtitleLanguage(index, value);
-            result["language"] = value;
+            result["name"] = info.name;
+            result["language"] = info.language;
           }
         }
         else
@@ -1464,14 +1467,13 @@ JSONRPC_STATUS CPlayerOperations::GetPropertyValue(PlayerType player, const CStd
         {
           for (int index = 0; index < g_application.m_pPlayer->GetSubtitleCount(); index++)
           {
+            SPlayerSubtitleStreamInfo info;
+            g_application.m_pPlayer->GetSubtitleStreamInfo(index, info);
+
             CVariant subtitle(CVariant::VariantTypeObject);
             subtitle["index"] = index;
-            CStdString value;
-            g_application.m_pPlayer->GetSubtitleName(index, value);
-            subtitle["name"] = value;
-            value.Empty();
-            g_application.m_pPlayer->GetSubtitleLanguage(index, value);
-            subtitle["language"] = value;
+            subtitle["name"] = info.name;
+            subtitle["language"] = info.language;
 
             result.append(subtitle);
           }
index 144b037..a446a0d 100644 (file)
@@ -22,7 +22,7 @@
 namespace JSONRPC
 {
   const char* const JSONRPC_SERVICE_ID          = "http://www.xbmc.org/jsonrpc/ServiceDescription.json";
-  const char* const JSONRPC_SERVICE_VERSION     = "6.0.1";
+  const char* const JSONRPC_SERVICE_VERSION     = "6.1.0";
   const char* const JSONRPC_SERVICE_DESCRIPTION = "JSON-RPC API of XBMC";
 
   const char* const JSONRPC_SERVICE_TYPES[] = {  
@@ -1135,7 +1135,8 @@ namespace JSONRPC
                 "\"xbmc.metadata.scraper.musicvideos\", \"xbmc.metadata.scraper.tvshows\", \"xbmc.ui.screensaver\","
                 "\"xbmc.player.musicviz\", \"xbmc.python.pluginsource\", \"xbmc.python.script\", \"xbmc.python.weather\","
                 "\"xbmc.python.subtitles\", \"xbmc.python.lyrics\", \"xbmc.gui.skin\", \"xbmc.gui.webinterface\","
-                "\"xbmc.addon.video\", \"xbmc.addon.audio\", \"xbmc.addon.image\", \"xbmc.addon.executable\", \"xbmc.service\" ],"
+                "\"xbmc.pvrclient\", \"xbmc.addon.video\", \"xbmc.addon.audio\", \"xbmc.addon.image\", \"xbmc.addon.executable\","
+                "\"xbmc.service\" ],"
       "\"default\": \"unknown\""
     "}",
     "\"Addon.Content\": {"
@@ -1794,7 +1795,8 @@ namespace JSONRPC
         "{ \"name\": \"directory\", \"type\": \"string\", \"required\": true },"
         "{ \"name\": \"media\", \"$ref\": \"Files.Media\", \"default\": \"files\" },"
         "{ \"name\": \"properties\", \"$ref\": \"List.Fields.Files\" },"
-        "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" }"
+        "{ \"name\": \"sort\", \"$ref\": \"List.Sort\" },"
+        "{ \"name\": \"limits\", \"$ref\": \"List.Limits\", \"description\": \"Limits are applied after getting the directory content thus retrieval is not faster when they are applied.\" }"
       "],"
       "\"returns\": {"
         "\"type\": \"object\","
index 4e710a3..60b8652 100644 (file)
@@ -22,6 +22,7 @@
 #include "ApplicationMessenger.h"
 #include "TextureCache.h"
 #include "Util.h"
+#include "utils/StringUtils.h"
 #include "utils/URIUtils.h"
 #include "video/VideoDatabase.h"
 
@@ -654,7 +655,7 @@ JSONRPC_STATUS CVideoLibrary::Scan(const CStdString &method, ITransportLayer *tr
   if (directory.empty())
     cmd = "updatelibrary(video)";
   else
-    cmd.Format("updatelibrary(video, %s)", directory.c_str());
+    cmd.Format("updatelibrary(video, %s)", StringUtils::Paramify(directory).c_str());
 
   CApplicationMessenger::Get().ExecBuiltIn(cmd);
   return ACK;
@@ -664,7 +665,7 @@ JSONRPC_STATUS CVideoLibrary::Export(const CStdString &method, ITransportLayer *
 {
   CStdString cmd;
   if (parameterObject["options"].isMember("path"))
-    cmd.Format("exportlibrary(video, false, %s)", parameterObject["options"]["path"].asString());
+    cmd.Format("exportlibrary(video, false, %s)", StringUtils::Paramify(parameterObject["options"]["path"].asString()));
   else
     cmd.Format("exportlibrary(video, true, %s, %s, %s)",
       parameterObject["options"]["images"].asBoolean() ? "true" : "false",
index 3800e61..d36ffe6 100644 (file)
       { "name": "directory", "type": "string", "required": true },
       { "name": "media", "$ref": "Files.Media", "default": "files" },
       { "name": "properties", "$ref": "List.Fields.Files" },
-      { "name": "sort", "$ref": "List.Sort" }
+      { "name": "sort", "$ref": "List.Sort" },
+      { "name": "limits", "$ref": "List.Limits", "description": "Limits are applied after getting the directory content thus retrieval is not faster when they are applied." }
     ],
     "returns": {
       "type": "object",
index b8994df..db4f4c3 100644 (file)
               "xbmc.metadata.scraper.musicvideos", "xbmc.metadata.scraper.tvshows", "xbmc.ui.screensaver",
               "xbmc.player.musicviz", "xbmc.python.pluginsource", "xbmc.python.script", "xbmc.python.weather",
               "xbmc.python.subtitles", "xbmc.python.lyrics", "xbmc.gui.skin", "xbmc.gui.webinterface",
-              "xbmc.addon.video", "xbmc.addon.audio", "xbmc.addon.image", "xbmc.addon.executable", "xbmc.service" ],
+              "xbmc.pvrclient", "xbmc.addon.video", "xbmc.addon.audio", "xbmc.addon.image", "xbmc.addon.executable",
+              "xbmc.service" ],
     "default": "unknown"
   },
   "Addon.Content": {
index 3b73b6c..f432de6 100644 (file)
@@ -442,7 +442,6 @@ namespace XBMCAddon
       }
       else if (strcmpi(type,"pictures") == 0)
       {
-        bool pictureTagLoaded = false;
         for (Dictionary::const_iterator it = infoLabels.begin(); it != infoLabels.end(); it++)
         {
           CStdString key = it->first;
@@ -468,11 +467,8 @@ namespace XBMCAddon
             if (!exifkey.Left(5).Equals("exif:") || exifkey.length() < 6) continue;
             int info = CPictureInfoTag::TranslateString(exifkey.Mid(5));
             item->GetPictureInfoTag()->SetInfo(info, value);
-            pictureTagLoaded = true;
           }
         }
-        if (pictureTagLoaded)
-          item->GetPictureInfoTag()->SetLoaded(true);
       }
     } // end ListItem::setInfo
 
index 62e5c25..d91d693 100644 (file)
@@ -393,9 +393,10 @@ namespace XBMCAddon
       TRACE;
       if (g_application.m_pPlayer)
       {
+        SPlayerSubtitleStreamInfo info;
+        g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
         int i = g_application.m_pPlayer->GetSubtitle();
-        CStdString strName;
-        g_application.m_pPlayer->GetSubtitleName(i, strName);
+        CStdString strName = info.name;
 
         if (strName == "Unknown(Invalid)")
           strName = "";
@@ -424,11 +425,12 @@ namespace XBMCAddon
         std::vector<String>* ret = new std::vector<String>(subtitleCount);
         for (int iStream=0; iStream < subtitleCount; iStream++)
         {
-          CStdString strName;
+          SPlayerSubtitleStreamInfo info;
+          g_application.m_pPlayer->GetSubtitleStreamInfo(iStream, info);
+
           CStdString FullLang;
-          g_application.m_pPlayer->GetSubtitleName(iStream, strName);
-          if (!g_LangCodeExpander.Lookup(FullLang, strName))
-            FullLang = strName;
+          if (!g_LangCodeExpander.Lookup(FullLang, info.name))
+            FullLang = info.name;
           (*ret)[iStream] = FullLang;
         }
         return ret;
@@ -457,13 +459,14 @@ namespace XBMCAddon
         int streamCount = g_application.m_pPlayer->GetAudioStreamCount();
         std::vector<String>* ret = new std::vector<String>(streamCount);
         for (int iStream=0; iStream < streamCount; iStream++)
-        {  
-          CStdString strName;
+        {
+          SPlayerAudioStreamInfo info;
+          g_application.m_pPlayer->GetAudioStreamInfo(iStream, info);
+
           CStdString FullLang;
-          g_application.m_pPlayer->GetAudioStreamLanguage(iStream, strName);
-          g_LangCodeExpander.Lookup(FullLang, strName);
+          g_LangCodeExpander.Lookup(FullLang, info.language);
           if (FullLang.IsEmpty())
-            g_application.m_pPlayer->GetAudioStreamName(iStream, FullLang);
+            FullLang = info.name;
           (*ret)[iStream] = FullLang;
         }
         return ret;
index 98da77c..7604e55 100644 (file)
@@ -275,8 +275,8 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess,
 
   if (fd == -1)
   {
-if (errno == 20)
-    CLog::Log(LOGWARNING,"%s, error %d opening file <%s>, flags:%x, mode:%x. ", __FUNCTION__, errno, lpFileName, flags, mode);
+    if (errno == 20)
+      CLog::Log(LOGWARNING,"%s, error %d opening file <%s>, flags:%x, mode:%x. ", __FUNCTION__, errno, lpFileName, flags, mode);
     return INVALID_HANDLE_VALUE;
   }
 
index 4ee13c3..349adea 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include "system.h"
-#include "settings/AppParamParser.h"
+#include "AppParamParser.h"
 #include "settings/AdvancedSettings.h"
 #include "FileItem.h"
 #include "Application.h"
index d9d8bd4..4c0f1b6 100644 (file)
@@ -552,8 +552,6 @@ void CGUIViewStateWindowMusicNav::AddOnlineShares()
   for (int i = 0; i < (int)g_settings.m_musicSources.size(); ++i)
   {
     CMediaSource share = g_settings.m_musicSources.at(i);
-    if (share.strPath.Find("lastfm://") == 0)//lastfm share
-      m_sources.push_back(share);
   }
 }
 
@@ -707,30 +705,3 @@ VECSOURCES& CGUIViewStateWindowMusicPlaylist::GetSources()
   // CGUIViewState::GetSources would add music plugins
   return m_sources;
 }
-
-CGUIViewStateMusicLastFM::CGUIViewStateMusicLastFM(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
-{
-  CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
-  CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
-
-  AddSortMethod(SORT_METHOD_UNSORTED, 571, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", ""));  // Userdefined, Userdefined | FolderName, empty
-  AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", ""));  // Userdefined, Userdefined | FolderName, empty
-  AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS(strTrackLeft, "%I", "%L", "%I"));  // Userdefined, Size | FolderName, Size
-
-  SetSortMethod(g_settings.m_viewStateMusicLastFM.m_sortMethod);
-  SetSortOrder(g_settings.m_viewStateMusicLastFM.m_sortOrder);
-
-  SetViewAsControl(DEFAULT_VIEW_LIST);
-  LoadViewState(items.GetPath(), WINDOW_MUSIC_FILES);
-}
-
-bool CGUIViewStateMusicLastFM::AutoPlayNextItem()
-{
-  return false;
-}
-
-void CGUIViewStateMusicLastFM::SaveViewState()
-{
-  SaveViewToDb(m_items.GetPath(), WINDOW_MUSIC_FILES, &g_settings.m_viewStateMusicLastFM);
-}
-
index 02cf96d..1d03506 100644 (file)
@@ -105,13 +105,3 @@ protected:
   virtual bool HideParentDirItems();
   virtual VECSOURCES& GetSources();
 };
-
-class CGUIViewStateMusicLastFM : public CGUIViewStateWindowMusic
-{
-public:
-  CGUIViewStateMusicLastFM(const CFileItemList& items);
-
-protected:
-  virtual bool AutoPlayNextItem();
-  virtual void SaveViewState();
-};
diff --git a/xbmc/music/LastFmManager.cpp b/xbmc/music/LastFmManager.cpp
deleted file mode 100644 (file)
index 597944f..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "threads/SystemClock.h"
-#include "LastFmManager.h"
-#include "Album.h"
-#include "Artist.h"
-#include "Application.h"
-#include "ApplicationMessenger.h"
-#include "PlayListPlayer.h"
-#include "playlists/PlayListFactory.h"
-#include "utils/md5.h"
-#include "filesystem/File.h"
-#include "filesystem/CurlFile.h"
-#include "GUIInfoManager.h"
-#include "MusicDatabase.h"
-#include "music/tags/MusicInfoTag.h"
-#include "URL.h"
-#include "guilib/GUIWindowManager.h"
-#include "dialogs/GUIDialogKaiToast.h"
-#include "dialogs/GUIDialogProgress.h"
-#include "dialogs/GUIDialogYesNo.h"
-#include "dialogs/GUIDialogOK.h"
-#include "settings/GUISettings.h"
-#include "GUIUserMessages.h"
-#include "playlists/PlayList.h"
-#include "utils/Crc32.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/Settings.h"
-#include "utils/StringUtils.h"
-#include "guilib/LocalizeStrings.h"
-#include "utils/XBMCTinyXML.h"
-#include "utils/TimeUtils.h"
-#include "threads/SingleLock.h"
-#include "utils/log.h"
-#include "utils/URIUtils.h"
-
-#include <sstream>
-
-using namespace std;
-using namespace MUSIC_INFO;
-using namespace PLAYLIST;
-using namespace XFILE;
-
-
-CLastFmManager* CLastFmManager::m_pInstance=NULL;
-
-CLastFmManager::CLastFmManager() : CThread("CLastFmManager")
-{
-}
-
-CLastFmManager::~CLastFmManager()
-{
-  StopThread();
-  CLog::Log(LOGINFO,"lastfm destroyed");
-}
-
-void CLastFmManager::RemoveInstance()
-{
-  if (m_pInstance)
-  {
-    delete m_pInstance;
-    m_pInstance=NULL;
-  }
-}
-
-CLastFmManager* CLastFmManager::GetInstance()
-{
-  if (!m_pInstance)
-    m_pInstance=new CLastFmManager;
-
-  return m_pInstance;
-}
-
-void CLastFmManager::Parameter(const CStdString& key, const CStdString& data, CStdString& value)
-{
-}
-
-bool CLastFmManager::RadioHandShake()
-{
-  return false;
-}
-
-void CLastFmManager::InitProgressDialog(const CStdString& strUrl)
-{
-}
-
-void CLastFmManager::UpdateProgressDialog(const int iStringID)
-{
-}
-
-void CLastFmManager::CloseProgressDialog()
-{
-}
-
-bool CLastFmManager::ChangeStation(const CURL& stationUrl)
-{
-  return false;
-}
-
-bool CLastFmManager::RequestRadioTracks()
-{
-  return false;
-}
-
-void CLastFmManager::CacheTrackThumb(const int nrInitialTracksToAdd)
-{
-}
-
-void CLastFmManager::AddToPlaylist(const int nrTracks)
-{
-}
-
-
-void CLastFmManager::OnSongChange(CFileItem& newSong)
-{
-}
-
-void CLastFmManager::Update()
-{
-}
-
-bool CLastFmManager::ReapSongs()
-{
-  return false;
-}
-
-bool CLastFmManager::MovePlaying()
-{
-  return false;
-}
-
-void CLastFmManager::SendUpdateMessage()
-{
-}
-
-void CLastFmManager::OnStartup()
-{
-}
-
-void CLastFmManager::Process()
-{
-}
-
-void CLastFmManager::StopRadio(bool bKillSession /*= true*/)
-{
-}
-
-void CLastFmManager::CreateMD5Hash(const CStdString& bufferToHash, CStdString& hash)
-{
-}
-
-bool CLastFmManager::CallXmlRpc(const CStdString& action, const CStdString& artist, const CStdString& title)
-{
-  return false;
-}
-
-bool CLastFmManager::Love(bool askConfirmation)
-{
-  return false;
-}
-
-bool CLastFmManager::Ban(bool askConfirmation)
-{
-  return false;
-}
-
-bool CLastFmManager::Love(const CMusicInfoTag& musicinfotag)
-{
-  return false;
-}
-
-bool CLastFmManager::Ban(const CMusicInfoTag& musicinfotag)
-{
-  return false;
-}
-
-bool CLastFmManager::Unlove(const CMusicInfoTag& musicinfotag, bool askConfirmation /*= true*/)
-{
-  return false;
-}
-
-bool CLastFmManager::Unban(const CMusicInfoTag& musicinfotag, bool askConfirmation /*= true*/)
-{
-  return false;
-}
-
-bool CLastFmManager::IsLastFmEnabled()
-{
-  return (
-    !g_guiSettings.GetString("scrobbler.lastfmusername").IsEmpty() &&
-    !g_guiSettings.GetString("scrobbler.lastfmpass").IsEmpty()
-  );
-}
-
-bool CLastFmManager::CanLove()
-{
-  return false;
-}
-
-bool CLastFmManager::CanBan()
-{
-  return false;
-}
-
-bool CLastFmManager::CanScrobble(const CFileItem &fileitem)
-{
-  return (
-    (!fileitem.IsInternetStream() && g_guiSettings.GetBool("scrobbler.lastfmsubmit"))
-  );
-}
diff --git a/xbmc/music/LastFmManager.h b/xbmc/music/LastFmManager.h
deleted file mode 100644 (file)
index f611725..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "threads/CriticalSection.h"
-#include "threads/Thread.h"
-#include "threads/Event.h"
-#include "PlayListPlayer.h"
-
-namespace PLAYLIST
-{
-  class CPlayList;
-  enum REPEAT_STATE;
-}
-
-namespace MUSIC_INFO
-{
-  class CMusicInfoTag;
-}
-
-class CURL;
-class CGUIDialogProgress;
-
-class CLastFmManager : CThread
-{
-public:
-  virtual ~CLastFmManager();
-  static void RemoveInstance();
-  static CLastFmManager* GetInstance();
-
-  //radio
-  bool ChangeStation(const CURL& stationUrl);
-  void StopRadio(bool bKillSession = true);
-  void OnSongChange(CFileItem& newSong);
-  bool IsRadioEnabled() {return !m_RadioSession.IsEmpty();}
-  bool IsLastFmEnabled();
-  bool Love(bool askConfirmation = true);
-  bool Ban(bool askConfirmation = true);
-  bool CanLove();
-  bool CanBan();
-  bool Unlove(const MUSIC_INFO::CMusicInfoTag& musicinfotag, bool askConfirmation = true);
-  bool Unban(const MUSIC_INFO::CMusicInfoTag& musicinfotag, bool askConfirmation = true);
-
-  //scrobbler
-  bool CanScrobble(const CFileItem &fileitem);
-protected:
-  virtual void Process();
-  virtual void OnStartup();
-
-private:
-  typedef struct
-  {
-    CFileItem* CurrentSong;
-    bool IsLoved;
-    bool IsBanned;
-  } LastFmManagerSong;
-
-  CLastFmManager();
-  static CLastFmManager* m_pInstance;
-
-  bool RadioHandShake();
-  bool RequestRadioTracks();
-  void CacheTrackThumb(const int nrInitialTracksToAdd);
-  void Parameter(const CStdString& key, const CStdString& data, CStdString& value);
-  bool ReapSongs();
-  bool MovePlaying();
-  void SendUpdateMessage();
-  void Update();
-  void AddToPlaylist(const int nrTracks);
-  bool CallXmlRpc(const CStdString& action, const CStdString& artist, const CStdString& title);
-  void CreateMD5Hash(const CStdString& bufferToHash, CStdString& hash);
-  bool Love(const MUSIC_INFO::CMusicInfoTag& musicinfotag);
-  bool Ban(const MUSIC_INFO::CMusicInfoTag& musicinfotag);
-
-  CStdString m_RadioUrl;
-  CStdString m_RadioSession;
-  CStdString m_RadioBaseUrl;
-  CStdString m_RadioBasePath;
-  CStdString m_RadioSubscriber;
-  CStdString m_RadioBanned;
-
-  LastFmManagerSong m_CurrentSong;
-
-  PLAYLIST::CPlayList* m_RadioTrackQueue;
-  CEvent m_hWorkerEvent;
-  CCriticalSection m_lockCache;
-  CCriticalSection m_lockPlaylist;
-
-  CGUIDialogProgress* dlgProgress;
-  void InitProgressDialog(const CStdString& strUrl);
-  void UpdateProgressDialog(const int iStringID);
-  void CloseProgressDialog();
-};
index 045a267..cd9d3fd 100644 (file)
@@ -1,7 +1,6 @@
 SRCS=Album.cpp \
      Artist.cpp \
      GUIViewStateMusic.cpp \
-     LastFmManager.cpp \
      MusicDatabase.cpp \
      MusicDbUrl.cpp \
      MusicInfoLoader.cpp \
index 0b6b972..8d877c9 100644 (file)
@@ -5010,7 +5010,8 @@ void CMusicDatabase::ImportKaraokeInfo(const CStdString & inputFile)
         if ( !m_pDS->query(strSQL.c_str()) )
         {
             RollbackTransaction();
-            progress->Close();
+            if (progress)
+              progress->Close();
             m_pDS->close();
             return;
         }
index aa1f9d9..bba7f98 100644 (file)
@@ -24,7 +24,6 @@
 #include "dialogs/GUIDialogFileBrowser.h"
 #include "GUIPassword.h"
 #include "music/MusicDatabase.h"
-#include "music/LastFmManager.h"
 #include "music/tags/MusicInfoTag.h"
 #include "URL.h"
 #include "filesystem/File.h"
@@ -51,7 +50,6 @@ using namespace XFILE;
 #define CONTROL_BTN_TRACKS       5
 #define CONTROL_BTN_REFRESH      6
 #define CONTROL_BTN_GET_THUMB   10
-#define CONTROL_BTN_LASTFM      11
 #define  CONTROL_BTN_GET_FANART 12
 
 #define CONTROL_LIST            50
@@ -126,15 +124,6 @@ bool CGUIDialogMusicInfo::OnMessage(CGUIMessage& message)
           return true;
         }
       }
-      else if (iControl == CONTROL_BTN_LASTFM)
-      {
-        CStdString strArtist = StringUtils::Join(m_album.artist, g_advancedSettings.m_musicItemSeparator);
-        CURL::Encode(strArtist);
-        CStdString strLink;
-        strLink.Format("lastfm://artist/%s/similarartists", strArtist.c_str());
-        CURL url(strLink);
-        CLastFmManager::GetInstance()->ChangeStation(url);
-      }
       else if (iControl == CONTROL_BTN_GET_FANART)
       {
         OnGetFanart();
@@ -307,16 +296,6 @@ void CGUIDialogMusicInfo::Update()
 
   // disable the GetThumb button if the user isn't allowed it
   CONTROL_ENABLE_ON_CONDITION(CONTROL_BTN_GET_THUMB, g_settings.GetCurrentProfile().canWriteDatabases() || g_passwordManager.bMasterUser);
-
-  if (!m_album.artist.empty() && CLastFmManager::GetInstance()->IsLastFmEnabled())
-  {
-    SET_CONTROL_VISIBLE(CONTROL_BTN_LASTFM);
-  }
-  else
-  {
-    SET_CONTROL_HIDDEN(CONTROL_BTN_LASTFM);
-  }
-
 }
 
 void CGUIDialogMusicInfo::SetLabel(int iControl, const CStdString& strLabel)
index 4b7eee1..5f43def 100644 (file)
@@ -44,7 +44,6 @@
 #include "music/dialogs/GUIDialogSongInfo.h"
 #include "addons/GUIDialogAddonInfo.h"
 #include "dialogs/GUIDialogSmartPlaylistEditor.h"
-#include "music/LastFmManager.h"
 #include "music/tags/MusicInfoTag.h"
 #include "guilib/GUIWindowManager.h"
 #include "dialogs/GUIDialogOK.h"
@@ -890,15 +889,7 @@ void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &but
     {
       if (!m_vecItems->IsPlugin() && (item->IsPlugin() || item->IsScript()))
         buttons.Add(CONTEXT_BUTTON_INFO,24003); // Add-on info
-      if (item->GetExtraInfo().Equals("lastfmloved"))
-      {
-        buttons.Add(CONTEXT_BUTTON_LASTFM_UNLOVE_ITEM, 15295); //unlove
-      }
-      else if (item->GetExtraInfo().Equals("lastfmbanned"))
-      {
-        buttons.Add(CONTEXT_BUTTON_LASTFM_UNBAN_ITEM, 15296); //unban
-      }
-      else if (item->CanQueue() && !item->IsAddonsPath() && !item->IsScript())
+      if (item->CanQueue() && !item->IsAddonsPath() && !item->IsScript())
       {
         buttons.Add(CONTEXT_BUTTON_QUEUE_ITEM, 13347); //queue
 
@@ -911,7 +902,7 @@ void CGUIWindowMusicBase::GetContextButtons(int itemNumber, CContextButtons &but
         else
         { // check what players we have, if we have multiple display play with option
           VECPLAYERCORES vecCores;
-          CPlayerCoreFactory::GetPlayers(*item, vecCores);
+          CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
           if (vecCores.size() >= 1)
             buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...
         }
@@ -985,8 +976,8 @@ bool CGUIWindowMusicBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
   case CONTEXT_BUTTON_PLAY_WITH:
     {
       VECPLAYERCORES vecCores;  // base class?
-      CPlayerCoreFactory::GetPlayers(*item, vecCores);
-      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
+      CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
+      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
       if( g_application.m_eForcedNextPlayer != EPC_NONE )
         OnClick(itemNumber);
       return true;
@@ -1013,20 +1004,6 @@ bool CGUIWindowMusicBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
   case CONTEXT_BUTTON_SETTINGS:
     g_windowManager.ActivateWindow(WINDOW_SETTINGS_MYMUSIC);
     return true;
-  case CONTEXT_BUTTON_LASTFM_UNBAN_ITEM:
-    if (CLastFmManager::GetInstance()->Unban(*item->GetMusicInfoTag()))
-    {
-      g_directoryCache.ClearDirectory(m_vecItems->GetPath());
-      Refresh(true);
-    }
-    return true;
-  case CONTEXT_BUTTON_LASTFM_UNLOVE_ITEM:
-    if (CLastFmManager::GetInstance()->Unlove(*item->GetMusicInfoTag()))
-    {
-      g_directoryCache.ClearDirectory(m_vecItems->GetPath());
-      Refresh(true);
-    }
-    return true;
   default:
     break;
   }
@@ -1173,7 +1150,7 @@ bool CGUIWindowMusicBase::OnPlayMedia(int iItem)
   CFileItemPtr pItem = m_vecItems->Get(iItem);
 
   // party mode
-  if (g_partyModeManager.IsEnabled() && !pItem->IsLastFM())
+  if (g_partyModeManager.IsEnabled())
   {
     CPlayList playlistTemp;
     playlistTemp.Add(pItem);
index 59c048c..fd218f5 100644 (file)
@@ -23,7 +23,7 @@
 #include "utils/URIUtils.h"
 #include "PlayListPlayer.h"
 #include "GUIPassword.h"
-#include "settings/GUIDialogContentSettings.h"
+#include "settings/dialogs/GUIDialogContentSettings.h"
 #include "filesystem/MusicDatabaseDirectory.h"
 #include "filesystem/VideoDatabaseDirectory.h"
 #include "PartyModeManager.h"
@@ -418,7 +418,7 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
   CFileItemPtr item;
   if (itemNumber >= 0 && itemNumber < m_vecItems->Size())
     item = m_vecItems->Get(itemNumber);
-  if (item && (item->GetExtraInfo().Find("lastfm") < 0)  && !item->GetPath().Left(14).Equals("addons://more/"))
+  if (item && !item->GetPath().Left(14).Equals("addons://more/"))
   {
     // are we in the playlists location?
     bool inPlaylists = m_vecItems->GetPath().Equals(CUtil::MusicPlaylistsLocation()) ||
@@ -427,7 +427,7 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
     CMusicDatabaseDirectory dir;
     // enable music info button on an album or on a song.
     if (item->IsAudio() && !item->IsPlayList() && !item->IsSmartPlayList() &&
-       !item->IsLastFM() && !item->m_bIsFolder)
+        !item->m_bIsFolder)
     {
       buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658);
     }
@@ -446,7 +446,7 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
     else if (!inPlaylists && (dir.HasAlbumInfo(item->GetPath())||
                               dir.IsArtistDir(item->GetPath())   )      &&
              !dir.IsAllItem(item->GetPath()) && !item->IsParentFolder() &&
-             !item->IsLastFM() && !item->IsPlugin() && !item->IsScript() &&
+             !item->IsPlugin() && !item->IsScript() &&
              !item->GetPath().Left(14).Equals("musicsearch://"))
     {
       if (dir.IsArtistDir(item->GetPath()))
@@ -458,7 +458,6 @@ void CGUIWindowMusicNav::GetContextButtons(int itemNumber, CContextButtons &butt
     // enable query all albums button only in album view
     if (dir.HasAlbumInfo(item->GetPath()) && !dir.IsAllItem(item->GetPath()) &&
         item->m_bIsFolder && !item->IsVideoDb() && !item->IsParentFolder()   &&
-       !item->IsLastFM()                                                     &&
        !item->IsPlugin() && !item->GetPath().Left(14).Equals("musicsearch://"))
     {
       buttons.Add(CONTEXT_BUTTON_INFO_ALL, 20059);
index 7ba70d2..2c68520 100644 (file)
@@ -25,7 +25,6 @@
 #include "Application.h"
 #include "PlayListPlayer.h"
 #include "PartyModeManager.h"
-#include "music/LastFmManager.h"
 #include "utils/LabelFormatter.h"
 #include "music/tags/MusicInfoTag.h"
 #include "guilib/GUIWindowManager.h"
@@ -365,7 +364,7 @@ void CGUIWindowMusicPlayList::UpdateButtons()
   CGUIWindowMusicBase::UpdateButtons();
 
   // Update playlist buttons
-  if (m_vecItems->Size() && !g_partyModeManager.IsEnabled() && !CLastFmManager::GetInstance()->IsRadioEnabled())
+  if (m_vecItems->Size() && !g_partyModeManager.IsEnabled())
   {
     CONTROL_ENABLE(CONTROL_BTNSHUFFLE);
     CONTROL_ENABLE(CONTROL_BTNSAVE);
@@ -516,12 +515,11 @@ void CGUIWindowMusicPlayList::GetContextButtons(int itemNumber, CContextButtons
     { // aren't in a move
       // check what players we have, if we have multiple display play with option
       VECPLAYERCORES vecCores;
-      CPlayerCoreFactory::GetPlayers(*item, vecCores);
+      CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
       if (vecCores.size() > 1)
         buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...
 
-      if (!item->IsLastFM())
-        buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
+      buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
       if (CFavourites::IsFavourite(item.get(), GetID()))
         buttons.Add(CONTEXT_BUTTON_ADD_FAVOURITE, 14077);     // Remove Favourite
       else
@@ -557,8 +555,8 @@ bool CGUIWindowMusicPlayList::OnContextButton(int itemNumber, CONTEXT_BUTTON but
         break;
 
       VECPLAYERCORES vecCores;  
-      CPlayerCoreFactory::GetPlayers(*item, vecCores);
-      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
+      CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
+      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
       if( g_application.m_eForcedNextPlayer != EPC_NONE )
         OnClick(itemNumber);
       return true;
index 098e53e..ec0ccdf 100644 (file)
@@ -254,7 +254,7 @@ void CGUIWindowMusicSongs::UpdateButtons()
 
   // Disable scan button if shoutcast
   if (m_vecItems->IsVirtualDirectoryRoot() ||
-      m_vecItems->IsLastFM() || m_vecItems->IsMusicDb())
+      m_vecItems->IsMusicDb())
   {
     CONTROL_DISABLE(CONTROL_BTNSCAN);
   }
@@ -318,9 +318,9 @@ void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &bu
         return;
       if (!item->IsPlayList() && !item->IsPlugin() && !item->IsScript())
       {
-        if (item->IsAudio() && !item->IsLastFM())
+        if (item->IsAudio())
           buttons.Add(CONTEXT_BUTTON_SONG_INFO, 658); // Song Info
-        else if (!item->IsParentFolder() && !item->IsLastFM() &&
+        else if (!item->IsParentFolder() &&
                  !item->GetPath().Left(3).Equals("new") && item->m_bIsFolder)
         {
 #if 0
@@ -363,7 +363,6 @@ void CGUIWindowMusicSongs::GetContextButtons(int itemNumber, CContextButtons &bu
     if (g_application.IsMusicScanning())
       buttons.Add(CONTEXT_BUTTON_STOP_SCANNING, 13353); // Stop Scanning
     else if (!inPlaylists && !m_vecItems->IsInternetStream()           &&
-             !item->IsLastFM()                                         &&
              !item->GetPath().Equals("add") && !item->IsParentFolder() &&
              !item->IsPlugin()                                         &&
              !item->GetPath().Left(9).Equals("addons://")              &&
index 9ca61f3..8cf73af 100644 (file)
@@ -119,7 +119,7 @@ const char *eventStrings[] = {"playing", "paused", "loading", "stopped"};
 "<key>features</key>\r\n"\
 "<integer>119</integer>\r\n"\
 "<key>model</key>\r\n"\
-"<string>AppleTV2,1</string>\r\n"\
+"<string>Xbmc,1</string>\r\n"\
 "<key>protovers</key>\r\n"\
 "<string>1.0</string>\r\n"\
 "<key>srcvers</key>\r\n"\
index 2f30773..49121fe 100644 (file)
@@ -524,6 +524,7 @@ bool CAirTunesServer::StartServer(int port, bool nonlocal, bool usePassword, con
     txt.push_back(std::make_pair("da",  "true"));
     txt.push_back(std::make_pair("vs",  "130.14"));
     txt.push_back(std::make_pair("md",  "0,1,2"));
+    txt.push_back(std::make_pair("am",  "Xbmc,1"));
 
     CZeroconf::GetInstance()->PublishService("servers.airtunes", "_raop._tcp", appName, port, txt);
   }
index 976056a..ef193b4 100644 (file)
@@ -22,8 +22,6 @@
 #include "Network.h"
 #include "Application.h"
 #include "ApplicationMessenger.h"
-#include "libscrobbler/lastfmscrobbler.h"
-#include "libscrobbler/librefmscrobbler.h"
 #include "utils/RssReader.h"
 #include "utils/log.h"
 #include "guilib/LocalizeStrings.h"
@@ -302,8 +300,6 @@ void CNetwork::StartServices()
 #ifdef HAS_AIRPLAY
   g_application.StartAirplayServer();
 #endif
-  CLastfmScrobbler::GetInstance()->Init();
-  CLibrefmScrobbler::GetInstance()->Init();
   g_rssManager.Start();
 }
 
@@ -320,8 +316,6 @@ void CNetwork::StopServices(bool bWait)
 #ifdef HAS_WEB_SERVER
     g_application.StopWebServer();
 #endif    
-    CLastfmScrobbler::GetInstance()->Term();
-    CLibrefmScrobbler::GetInstance()->Term();
     // smb.Deinit(); if any file is open over samba this will break.
 
     g_rssManager.Stop();
index 2d9fde0..e4b5984 100644 (file)
@@ -654,23 +654,28 @@ void CTCPServer::CWebSocketClient::Send(const char *data, unsigned int size)
 void CTCPServer::CWebSocketClient::PushBuffer(CTCPServer *host, const char *buffer, int length)
 {
   bool send;
-  const CWebSocketMessage *msg;
-  if ((msg = m_websocket->Handle(buffer, length, send)) != NULL && msg->IsComplete())
+  const CWebSocketMessage *msg = NULL;
+  size_t len = length;
+  do
   {
-    std::vector<const CWebSocketFrame *> frames = msg->GetFrames();
-    if (send)
-    {
-      for (unsigned int index = 0; index < frames.size(); index++)
-        Send(frames.at(index)->GetFrameData(), (unsigned int)frames.at(index)->GetFrameLength());
-    }
-    else
+    if ((msg = m_websocket->Handle(buffer, len, send)) != NULL && msg->IsComplete())
     {
-      for (unsigned int index = 0; index < frames.size(); index++)
-        CTCPClient::PushBuffer(host, frames.at(index)->GetApplicationData(), (int)frames.at(index)->GetLength());
-    }
+      std::vector<const CWebSocketFrame *> frames = msg->GetFrames();
+      if (send)
+      {
+        for (unsigned int index = 0; index < frames.size(); index++)
+          Send(frames.at(index)->GetFrameData(), (unsigned int)frames.at(index)->GetFrameLength());
+      }
+      else
+      {
+        for (unsigned int index = 0; index < frames.size(); index++)
+          CTCPClient::PushBuffer(host, frames.at(index)->GetApplicationData(), (int)frames.at(index)->GetLength());
+      }
 
-    delete msg;
+      delete msg;
+    }
   }
+  while (len > 0 && msg != NULL);
 
   if (m_websocket->GetState() == WebSocketStateClosed)
     Disconnect();
index 35102d9..71ce952 100644 (file)
@@ -541,20 +541,27 @@ void CWebServer::ContentReaderFreeCallback(void *cls)
 
 struct MHD_Daemon* CWebServer::StartMHD(unsigned int flags, int port)
 {
-  // WARNING: when using MHD_USE_THREAD_PER_CONNECTION, set MHD_OPTION_CONNECTION_TIMEOUT to something higher than 1
-  // otherwise on libmicrohttpd 0.4.4-1 it spins a busy loop
-
   unsigned int timeout = 60 * 60 * 24;
-  // MHD_USE_THREAD_PER_CONNECTION = one thread per connection
-  // MHD_USE_SELECT_INTERNALLY = use main thread for each connection, can only handle one request at a time [unless you set the thread pool size]
 
-  return MHD_start_daemon(flags,
+  return MHD_start_daemon(flags |
+#if (MHD_VERSION >= 0x00040002) && (MHD_VERSION < 0x00090B01)
+                          // use main thread for each connection, can only handle one request at a
+                          // time [unless you set the thread pool size]
+                          MHD_USE_SELECT_INTERNALLY
+#else
+                          // one thread per connection
+                          // WARNING: set MHD_OPTION_CONNECTION_TIMEOUT to something higher than 1
+                          // otherwise on libmicrohttpd 0.4.4-1 it spins a busy loop
+                          MHD_USE_THREAD_PER_CONNECTION
+#endif
+                          ,
                           port,
                           NULL,
                           NULL,
                           &CWebServer::AnswerToConnection,
                           this,
-#if (MHD_VERSION >= 0x00040002)
+
+#if (MHD_VERSION >= 0x00040002) && (MHD_VERSION < 0x00090B01)
                           MHD_OPTION_THREAD_POOL_SIZE, 4,
 #endif
                           MHD_OPTION_CONNECTION_LIMIT, 512,
@@ -568,7 +575,7 @@ bool CWebServer::Start(int port, const string &username, const string &password)
   SetCredentials(username, password);
   if (!m_running)
   {
-    m_daemon = StartMHD(MHD_USE_SELECT_INTERNALLY, port);
+    m_daemon = StartMHD(, port);
 
     m_running = m_daemon != NULL;
     if (m_running)
diff --git a/xbmc/network/libscrobbler/Makefile b/xbmc/network/libscrobbler/Makefile
deleted file mode 100644 (file)
index 6283b27..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-SRCS=lastfmscrobbler.cpp \
-     librefmscrobbler.cpp \
-     scrobbler.cpp \
-
-LIB=scrobbler.a
-
-include ../../../Makefile.include
--include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
diff --git a/xbmc/network/libscrobbler/errors.h b/xbmc/network/libscrobbler/errors.h
deleted file mode 100644 (file)
index 8c976c2..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    This file is part of libscrobbler.
-
-    libscrobbler is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    libscrobbler is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with libscrobbler; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-       Copyright Â© 2003 Russell Garrett (russ-scrobbler@garrett.co.uk)
-*/
-#ifndef _SCROBBLER_ERRORS_H
-#define _SCROBBLER_ERRORS_H
-
-class EScrobbler {
-public:
-       EScrobbler(){};
-       ~EScrobbler(){};
-
-       const char *getText() const { return "Unknown Error"; }
-};
-
-class EOutOfMemory : public EScrobbler {
-public:
-       const char *getText() const { return "Out of Memory"; }
-};
-
-#endif
-
diff --git a/xbmc/network/libscrobbler/lastfmscrobbler.cpp b/xbmc/network/libscrobbler/lastfmscrobbler.cpp
deleted file mode 100644 (file)
index 9cdb124..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "lastfmscrobbler.h"
-#include "threads/Atomics.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
-#include "utils/URIUtils.h"
-#include "guilib/LocalizeStrings.h"
-#include "dialogs/GUIDialogKaiToast.h"
-
-long CLastfmScrobbler::m_instanceLock = 0;
-CLastfmScrobbler *CLastfmScrobbler::m_pInstance = NULL;
-
-CLastfmScrobbler::CLastfmScrobbler()
-  : CScrobbler(LASTFM_SCROBBLER_HANDSHAKE_URL, LASTFM_SCROBBLER_LOG_PREFIX)
-{
-}
-
-CLastfmScrobbler::~CLastfmScrobbler()
-{
-  Term();
-}
-
-CLastfmScrobbler *CLastfmScrobbler::GetInstance()
-{
-  if (!m_pInstance) // Avoid spinning aimlessly
-  {
-    CAtomicSpinLock lock(m_instanceLock);
-    if (!m_pInstance)
-    {
-      m_pInstance = new CLastfmScrobbler;
-    }
-  }
-  return m_pInstance;
-}
-
-void CLastfmScrobbler::RemoveInstance()
-{
-  if (m_pInstance)
-  {
-    CAtomicSpinLock lock(m_instanceLock);
-    delete m_pInstance;
-    m_pInstance = NULL;
-  }
-}
-
-void CLastfmScrobbler::LoadCredentials()
-{
-  SetUsername(g_guiSettings.GetString("scrobbler.lastfmusername"));
-  SetPassword(g_guiSettings.GetString("scrobbler.lastfmpass"));
-}
-
-CStdString CLastfmScrobbler::GetJournalFileName()
-{
-  CStdString strFileName = g_settings.GetProfileUserDataFolder();
-  return URIUtils::AddFileToFolder(strFileName, "LastfmScrobbler.xml");
-}
-
-void CLastfmScrobbler::NotifyUser(int error)
-{
-  CStdString strText;
-  CStdString strAudioScrobbler;
-  switch (error)
-  {
-    case SCROBBLER_USER_ERROR_BADAUTH:
-      strText = g_localizeStrings.Get(15206);
-      m_bBadAuth = true;
-      strAudioScrobbler = g_localizeStrings.Get(15200);  // AudioScrobbler
-      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, strAudioScrobbler, strText, 10000);
-      break;
-    case SCROBBLER_USER_ERROR_BANNED:
-      strText = g_localizeStrings.Get(15205);
-      m_bBanned = true;
-      strAudioScrobbler = g_localizeStrings.Get(15200);  // AudioScrobbler
-      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, strAudioScrobbler, strText, 10000);
-      break;
-    default:
-      break;
-  }
-}
-
-bool CLastfmScrobbler::CanScrobble()
-{
-  return (!g_guiSettings.GetString("scrobbler.lastfmusername").IsEmpty()  &&
-          !g_guiSettings.GetString("scrobbler.lastfmpass").IsEmpty()  &&
-          g_guiSettings.GetBool("scrobbler.lastfmsubmit"));
-}
-
diff --git a/xbmc/network/libscrobbler/lastfmscrobbler.h b/xbmc/network/libscrobbler/lastfmscrobbler.h
deleted file mode 100644 (file)
index 9c52a90..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef LASTFM_SCROBBLER_H__
-#define LASTFM_SCROBBLER_H__
-
-#include "scrobbler.h"
-
-#define LASTFM_SCROBBLER_HANDSHAKE_URL  "post.audioscrobbler.com"
-#define LASTFM_SCROBBLER_LOG_PREFIX     "CLastfmScrobbler"
-
-class CLastfmScrobbler : public CScrobbler
-{
-private:
-  static long m_instanceLock;
-  static CLastfmScrobbler *m_pInstance;
-  virtual void LoadCredentials();
-  virtual void NotifyUser(int error);
-  virtual bool CanScrobble();
-  virtual CStdString GetJournalFileName();
-public:
-//  CLastfmScrobbler() : CScrobbler(LASTFM_SCROBBLER_HANDSHAKE_URL, LASTFM_SCROBBLER_LOG_PREFIX) {}
-//  virtual ~CLastfmScrobbler() {}
-  CLastfmScrobbler();
-  virtual ~CLastfmScrobbler();
-  static CLastfmScrobbler *GetInstance();
-  static void RemoveInstance();
-};
-
-#endif // LASTFM_SCROBBLER_H__
diff --git a/xbmc/network/libscrobbler/librefmscrobbler.cpp b/xbmc/network/libscrobbler/librefmscrobbler.cpp
deleted file mode 100644 (file)
index 1f4ecd4..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "librefmscrobbler.h"
-#include "threads/Atomics.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
-#include "utils/URIUtils.h"
-#include "guilib/LocalizeStrings.h"
-#include "dialogs/GUIDialogKaiToast.h"
-
-long CLibrefmScrobbler::m_instanceLock = 0;
-CLibrefmScrobbler *CLibrefmScrobbler::m_pInstance = NULL;
-
-CLibrefmScrobbler::CLibrefmScrobbler()
-  : CScrobbler(LIBREFM_SCROBBLER_HANDSHAKE_URL, LIBREFM_SCROBBLER_LOG_PREFIX)
-{
-}
-
-CLibrefmScrobbler::~CLibrefmScrobbler()
-{
-  Term();
-}
-
-CLibrefmScrobbler *CLibrefmScrobbler::GetInstance()
-{
-  if (!m_pInstance) // Avoid spinning aimlessly
-  {
-    CAtomicSpinLock lock(m_instanceLock);
-    if (!m_pInstance)
-    {
-      m_pInstance = new CLibrefmScrobbler;
-    }
-  }
-  return m_pInstance;
-}
-
-void CLibrefmScrobbler::RemoveInstance()
-{
-  if (m_pInstance)
-  {
-    CAtomicSpinLock lock(m_instanceLock);
-    delete m_pInstance;
-    m_pInstance = NULL;
-  }
-}
-
-void CLibrefmScrobbler::LoadCredentials()
-{
-  SetUsername(g_guiSettings.GetString("scrobbler.librefmusername"));
-  SetPassword(g_guiSettings.GetString("scrobbler.librefmpass"));
-}
-
-CStdString CLibrefmScrobbler::GetJournalFileName()
-{
-  CStdString strFileName = g_settings.GetProfileUserDataFolder();
-  return URIUtils::AddFileToFolder(strFileName, "LibrefmScrobbler.xml");
-}
-
-void CLibrefmScrobbler::NotifyUser(int error)
-{
-  CStdString strText;
-  CStdString strAudioScrobbler;
-  switch (error)
-  {
-    case SCROBBLER_USER_ERROR_BADAUTH:
-      strText = g_localizeStrings.Get(15206);
-      m_bBadAuth = true;
-      strAudioScrobbler = g_localizeStrings.Get(15220);  // Libre.fm
-      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, strAudioScrobbler, strText, 10000);
-      break;
-    case SCROBBLER_USER_ERROR_BANNED:
-      strText = g_localizeStrings.Get(15205);
-      m_bBanned = true;
-      strAudioScrobbler = g_localizeStrings.Get(15220);  // Libre.fm
-      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, strAudioScrobbler, strText, 10000);
-      break;
-    default:
-      break;
-  }
-}
-
-bool CLibrefmScrobbler::CanScrobble()
-{
-  return (!g_guiSettings.GetString("scrobbler.librefmusername").IsEmpty()  &&
-          !g_guiSettings.GetString("scrobbler.librefmpass").IsEmpty()  &&
-         g_guiSettings.GetBool("scrobbler.librefmsubmit"));
-}
-
diff --git a/xbmc/network/libscrobbler/librefmscrobbler.h b/xbmc/network/libscrobbler/librefmscrobbler.h
deleted file mode 100644 (file)
index 983dc18..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef LIBREFM_SCROBBLER_H__
-#define LIBREFM_SCROBBLER_H__
-
-#include "scrobbler.h"
-
-#define LIBREFM_SCROBBLER_HANDSHAKE_URL  "turtle.libre.fm"
-#define LIBREFM_SCROBBLER_LOG_PREFIX     "CLibrefmScrobbler"
-
-class CLibrefmScrobbler : public CScrobbler
-{
-private:
-  static long m_instanceLock;
-  static CLibrefmScrobbler *m_pInstance;
-  virtual void LoadCredentials();
-  virtual void NotifyUser(int error);
-  virtual bool CanScrobble();
-  virtual CStdString GetJournalFileName();
-public:
-  CLibrefmScrobbler();
-  virtual ~CLibrefmScrobbler();
-  static CLibrefmScrobbler *GetInstance();
-  static void RemoveInstance();
-};
-
-#endif // LIBREFM_SCROBBLER_H__
diff --git a/xbmc/network/libscrobbler/scrobbler.cpp b/xbmc/network/libscrobbler/scrobbler.cpp
deleted file mode 100644 (file)
index cf506fa..0000000
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "PlatformDefs.h"
-#include "scrobbler.h"
-#include "utils/md5.h"
-#include "utils/log.h"
-#include "utils/StringUtils.h"
-#include "Util.h"
-#include "music/tags/MusicInfoTag.h"
-#include "errors.h"
-#include "threads/Atomics.h"
-#include "settings/GUISettings.h"
-#include "settings/AdvancedSettings.h"
-#include "utils/XMLUtils.h"
-#include "Application.h"
-#include "threads/SingleLock.h"
-#include "guilib/LocalizeStrings.h"
-#include "filesystem/File.h"
-#include "filesystem/CurlFile.h"
-#include "URL.h"
-
-#define SCROBBLER_CLIENT              "xbm"
-//#define SCROBBLER_CLIENT              "tst"     // For testing ONLY!
-#define SCROBBLER_PROTOCOL            "1.2.1"
-#define SCROBBLER_CLIENT_VERSION      "0.2"
-#define SCROBBLER_JOURNAL_VERSION     1
-#define SCROBBLER_MAX_SUBMISSIONS     50        // API rule
-#define SCROBBLER_MIN_DURATION        30        // seconds. API rule
-#define SCROBBLER_ACTION_SUBMIT       1
-#define SCROBBLER_ACTION_NOWPLAYING   2
-
-CScrobbler::CScrobbler(const CStdString &strHandshakeURL, const CStdString &strLogPrefix)
-  : CThread("CScrobbler")
-{ 
-  m_bBanned         = false;
-  m_bBadAuth        = false;
-  m_pHttp           = NULL;
-  m_strHandshakeURL = strHandshakeURL;
-  m_strLogPrefix    = strLogPrefix;
-  ResetState();
-}
-
-CScrobbler::~CScrobbler()
-{
-}
-
-void CScrobbler::Init()
-{
-  if (!CanScrobble())
-    return;
-  ResetState();
-  LoadCredentials();
-  LoadJournal();
-  if (!IsRunning())
-    Create();
-}
-
-void CScrobbler::Term()
-{
-  StopThread();
-  SaveJournal();
-}
-
-void CScrobbler::AddSong(const MUSIC_INFO::CMusicInfoTag &tag, bool lastfmradio)
-{
-  ClearSubmissionState();
-
-  if (!CanScrobble() || !tag.Loaded())
-    return;
-
-  if (tag.GetArtist().empty() || tag.GetTitle().IsEmpty())
-    return;
-
-  // our tags are stored as UTF-8, so no conversion needed
-  m_CurrentTrack.length           = tag.GetDuration();
-  m_CurrentTrack.strArtist        = StringUtils::Join(tag.GetArtist(), g_advancedSettings.m_musicItemSeparator);
-  m_CurrentTrack.strAlbum         = tag.GetAlbum();
-  m_CurrentTrack.strTitle         = tag.GetTitle();
-  m_CurrentTrack.strMusicBrainzID = tag.GetMusicBrainzTrackID();
-  if (lastfmradio)  // TODO Set source more appropriately
-    m_CurrentTrack.strSource        = "L" + tag.GetComment();
-  else
-    m_CurrentTrack.strSource        = "P";
-  m_CurrentTrack.strRating        = "";
-  m_CurrentTrack.strLength.Format("%d", m_CurrentTrack.length);
-  m_CurrentTrack.strStartTime.Format("%d", time(NULL));
-  m_CurrentTrack.strTrackNum.Format("%d",tag.GetTrackNumber());
-  
-  CURL::Encode(m_CurrentTrack.strArtist); 
-  CURL::Encode(m_CurrentTrack.strTitle);
-  CURL::Encode(m_CurrentTrack.strAlbum);
-  CURL::Encode(m_CurrentTrack.strMusicBrainzID);
-
-  m_bNotified = false;
-  m_bSubmitted = !(lastfmradio ||
-      (!lastfmradio && g_guiSettings.GetBool("scrobbler.lastfmsubmit") && (m_CurrentTrack.length > SCROBBLER_MIN_DURATION || !m_CurrentTrack.strMusicBrainzID.IsEmpty())));
-}
-
-void CScrobbler::UpdateStatus()
-{
-  // Called from CApp::ProcessSlow() every ~500ms.
-  if (!CanScrobble())
-    return;
-  if (g_application.IsPaused() || (g_application.GetPlaySpeed() != 1))
-    return;
-
-  m_submissionTimer++;
-
-  // Try to notify Last.fm of our currently playing after ~5s of playback.
-  // Don't try too hard, this is optional and doesn't affect the users library.
-  if (!m_bNotified && m_submissionTimer >= 10)
-  {
-    m_bNotified = true; // Only try once
-    {
-      CSingleLock lock(m_actionLock);
-      m_action = SCROBBLER_ACTION_NOWPLAYING;
-    }
-    m_hEvent.Set();
-    return;
-  }
-
-  // Scrobble the track after 50% playback or 240s, whichever occurs first.
-  // Just toss it in the queue here. We'll try to submit the queue at the
-  // end of playback.
-  if (!m_bSubmitted &&
-      (m_submissionTimer > m_CurrentTrack.length || 
-       m_submissionTimer >= 480))
-  {
-    CSingleLock lock(m_queueLock);
-    m_bSubmitted = true;
-    m_vecSubmissionQueue.push_back(m_CurrentTrack);
-    lock.Leave(); 
-    SaveJournal();
-    CLog::Log(LOGDEBUG, "%s: Queued track for submission", m_strLogPrefix.c_str());
-  }
-}
-
-void CScrobbler::SubmitQueue()
-{
-  if (CanScrobble())
-  {
-    {
-      CSingleLock lock(m_actionLock);
-      m_action = SCROBBLER_ACTION_SUBMIT;
-    }
-    m_hEvent.Set();
-  }
-}
-
-void CScrobbler::SetUsername(const CStdString& strUser)
-{
-  if (strUser.IsEmpty())
-    return;
-
-  m_strUsername=strUser;
-  CURL::Encode(m_strUsername);
-  m_bBadAuth = false;
-}
-
-void CScrobbler::SetPassword(const CStdString& strPass)
-{
-  if (strPass.IsEmpty())
-    return;
-  m_strPasswordHash = strPass;
-  m_strPasswordHash.ToLower();
-  m_bBadAuth = false;
-}
-
-CStdString CScrobbler::GetConnectionState()
-{
-  if (!CanScrobble())
-    return "";
-  return (m_strSessionID.IsEmpty()) ?
-    g_localizeStrings.Get(15208) : g_localizeStrings.Get(15207);
-}
-
-CStdString CScrobbler::GetSubmitInterval()
-{
-  CStdString strInterval;
-  if (!CanScrobble())
-    return strInterval;
-  CStdString strFormat = g_localizeStrings.Get(15209);
-  int seconds = m_CurrentTrack.length - m_submissionTimer/2;
-  strInterval.Format(strFormat, std::max(seconds, m_failedHandshakeDelay));
-  return strInterval;
-}
-
-CStdString CScrobbler::GetFilesCached()
-{
-  CStdString strCachedTracks;
-  if (!CanScrobble())
-    return strCachedTracks;
-  CSingleLock lock(m_queueLock);
-  CStdString strFormat = g_localizeStrings.Get(15210);
-  strCachedTracks.Format(strFormat, m_vecSubmissionQueue.size());
-  return strCachedTracks;
-}
-
-CStdString CScrobbler::GetSubmitState()
-{
-  CStdString strState;
-  CStdString strFormat = g_localizeStrings.Get(15212);
-  if (!CanScrobble())
-    return strState;
-  if (m_bSubmitting)
-    strState = g_localizeStrings.Get(15211);
-  else if (!g_application.IsPlayingAudio() || m_bBadAuth || m_bBanned)
-    strState.Format(strFormat, 0);
-  else if (m_strSessionID.IsEmpty())
-    strState.Format(strFormat, m_failedHandshakeDelay);
-  else
-  {
-    int seconds = m_CurrentTrack.length - m_submissionTimer/2;
-    strState.Format(strFormat, std::max(0, seconds));
-  }
-  return strState;
-}
-
-void CScrobbler::ResetState()
-{
-  ClearSession();
-  ClearSubmissionState();
-  ClearErrorState();
-}
-
-void CScrobbler::ClearErrorState()
-{
-  m_hardErrorCount        = 0;
-  m_lastFailedHandshake   = 0;
-  m_failedHandshakeDelay  = 0;
-}
-
-void CScrobbler::ClearSubmissionState()
-{
-  m_bNotified             = true;  // Explicitly clear these when necessary
-  m_bSubmitting           = false;
-  m_bSubmitted            = true;
-  m_submissionTimer       = 0;
-  CSingleLock lock(m_actionLock);
-  m_action                = 0;
-}
-
-void CScrobbler::ClearSession()
-{
-  CLog::Log(LOGDEBUG, "%s: Clearing session.", m_strLogPrefix.c_str());
-  m_strSessionID.clear();
-}
-
-void CScrobbler::HandleHardError()
-{
-  CLog::Log(LOGDEBUG, "%s: A hard error has occurred.", m_strLogPrefix.c_str());
-  if (++m_hardErrorCount == 3)
-  {
-    CLog::Log(LOGDEBUG, "%s: Three consecuetive hard errors have "\
-        "occured. Forcing new handshake.", m_strLogPrefix.c_str());
-    ClearSession();
-  }
-}
-
-bool CScrobbler::LoadJournal()
-{
-  int                     journalVersion  = 0;
-  SubmissionJournalEntry  entry;
-  CXBMCTinyXML            xmlDoc;
-  CStdString              JournalFileName = GetJournalFileName();
-  CSingleLock             lock(m_queueLock);
-
-  m_vecSubmissionQueue.clear();
-  
-  if (!xmlDoc.LoadFile(JournalFileName))
-  {
-    CLog::Log(LOGDEBUG, "%s: %s, Line %d (%s)", m_strLogPrefix.c_str(), 
-        JournalFileName.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
-    return false;
-  }
-
-  TiXmlElement *pRoot = xmlDoc.RootElement();
-  if (strcmpi(pRoot->Value(), "asjournal") != 0)
-  {
-    CLog::Log(LOGDEBUG, "%s: %s missing <asjournal>", m_strLogPrefix.c_str(),
-        JournalFileName.c_str());
-    return false;
-  }
-
-  if (pRoot->Attribute("version"))
-    journalVersion = atoi(pRoot->Attribute("version"));
-
-  TiXmlNode *pNode = pRoot->FirstChild("entry");
-  for (; pNode; pNode = pNode->NextSibling("entry"))
-  {
-    entry.Clear();
-    XMLUtils::GetString(pNode, "artist", entry.strArtist);
-    XMLUtils::GetString(pNode, "album", entry.strAlbum);
-    XMLUtils::GetString(pNode, "title", entry.strTitle);
-    XMLUtils::GetString(pNode, "length", entry.strLength);
-    entry.length = atoi(entry.strLength.c_str());
-    XMLUtils::GetString(pNode, "starttime", entry.strStartTime);
-    XMLUtils::GetString(pNode, "musicbrainzid", entry.strMusicBrainzID);
-
-    if (journalVersion > 0)
-    {
-      XMLUtils::GetString(pNode, "tracknum", entry.strTrackNum);
-      XMLUtils::GetString(pNode, "source", entry.strSource);
-      XMLUtils::GetString(pNode, "rating", entry.strRating);
-    }
-    else
-    {
-      // Update from journal v0
-      // Convert start time stamp
-      struct tm starttm;
-      time_t startt;
-      if (!strptime(entry.strStartTime.c_str(), "%Y-%m-%d %H:%M:%S", &starttm))
-        continue;
-      if ((startt = mktime(&starttm)) == -1)
-        continue;
-      entry.strStartTime.Format("%d", startt);
-      // url encode entries
-      CURL::Encode(entry.strArtist); 
-      CURL::Encode(entry.strTitle);
-      CURL::Encode(entry.strAlbum);
-      CURL::Encode(entry.strMusicBrainzID);
-    }
-    m_vecSubmissionQueue.push_back(entry);
-  }
-
-  CLog::Log(LOGDEBUG, "%s: Journal loaded with %"PRIuS" entries.", m_strLogPrefix.c_str(),
-      m_vecSubmissionQueue.size());
-  return !m_vecSubmissionQueue.empty();
-}
-
-bool CScrobbler::SaveJournal()
-{
-  CSingleLock lock(m_queueLock);
-
-  if (m_vecSubmissionQueue.size() == 0)
-  {
-    if (XFILE::CFile::Exists(GetJournalFileName()))
-      XFILE::CFile::Delete(GetJournalFileName());
-    return true;
-  }
-  CStdString        strJournalVersion;
-  CXBMCTinyXML      xmlDoc;
-  TiXmlDeclaration  decl("1.0", "utf-8", "yes");
-  TiXmlElement      xmlRootElement("asjournal");
-  xmlDoc.InsertEndChild(decl);
-  strJournalVersion.Format("%d", SCROBBLER_JOURNAL_VERSION);
-  xmlRootElement.SetAttribute("version", strJournalVersion.c_str());
-  TiXmlNode *pRoot = xmlDoc.InsertEndChild(xmlRootElement);
-  if (!pRoot)
-    return false;
-
-  int i = 0;
-  SCROBBLERJOURNALITERATOR it = m_vecSubmissionQueue.begin();
-  for (; it != m_vecSubmissionQueue.end(); it++, i++)
-  {
-    TiXmlElement entryNode("entry");
-    TiXmlNode *pNode = pRoot->InsertEndChild(entryNode);
-    if (!pNode)
-      return false;
-    XMLUtils::SetString(pNode, "artist", it->strArtist);
-    XMLUtils::SetString(pNode, "album", it->strAlbum);
-    XMLUtils::SetString(pNode, "title", it->strTitle);
-    XMLUtils::SetString(pNode, "length", it->strLength);
-    XMLUtils::SetString(pNode, "starttime", it->strStartTime);
-    XMLUtils::SetString(pNode, "musicbrainzid", it->strMusicBrainzID);
-    XMLUtils::SetString(pNode, "tracknum", it->strTrackNum);
-    XMLUtils::SetString(pNode, "source", it->strSource);
-    XMLUtils::SetString(pNode, "rating", it->strRating);
-  }
-  lock.Leave();
-
-  CStdString FileName = GetJournalFileName();
-  CLog::Log(LOGDEBUG, "%s: Journal with %d entries saved to %s",
-      m_strLogPrefix.c_str(), i, FileName.c_str());
-  return xmlDoc.SaveFile(FileName);
-}
-
-bool CScrobbler::DoHandshake(time_t now)
-{
-  XBMC::XBMC_MD5    authToken;
-  CStdString        strAuthToken;
-  CStdString        strTimeStamp;
-  CStdString        strResponse;
-  CStdString        strHandshakeRequest;
-
-  // Create auth token. md5(md5(pass)+str(now))
-  strTimeStamp.Format("%d", now);
-  authToken.append(m_strPasswordHash + strTimeStamp);
-  authToken.getDigest(strAuthToken);
-  strAuthToken.ToLower();
-  
-  // Construct handshake URL.
-  strHandshakeRequest.Format("http://%s/?hs=true"\
-      "&p=%s&c=%s&v=%s&u=%s&t=%d&a=%s", m_strHandshakeURL.c_str(),
-      SCROBBLER_PROTOCOL, SCROBBLER_CLIENT, SCROBBLER_CLIENT_VERSION,
-      m_strUsername.c_str(), now, strAuthToken.c_str());
-  
-  // Make and handle request
-  if (m_pHttp->Get(strHandshakeRequest, strResponse) &&
-      HandleHandshake(strResponse))
-    return true;
-    
-  m_failedHandshakeDelay = // 60, 120, 240, ... 7200s
-    (m_failedHandshakeDelay) ? std::min(2*m_failedHandshakeDelay, 7200) : 60;
-  m_lastFailedHandshake = now;
-  if (!m_bBanned && !m_bBadAuth)
-    CLog::Log(LOGDEBUG, "%s: A hard error has occurred during "\
-        "handshake. Sleeping for %d minutes.",
-        m_strLogPrefix.c_str(), m_failedHandshakeDelay/60);
-  
-  return false;
-}
-
-bool CScrobbler::HandleHandshake(CStdString &strResponse)
-{
-  if (strResponse.IsEmpty())
-    return false;
-  
-  std::vector<CStdString> vecTokens;
-  CUtil::Tokenize(strResponse, vecTokens, " \n\r");
-
-  if (vecTokens[0] == "OK")
-  {
-    if (vecTokens.size() >= 4)
-    {
-      m_strSessionID      = vecTokens[1];
-      m_strNowPlayingURL  = vecTokens[2];
-      m_strSubmissionURL  = vecTokens[3];
-      CLog::Log(LOGDEBUG, "%s: Handshake succeeded!", m_strLogPrefix.c_str());
-      CLog::Log(LOGDEBUG, "%s: SessionID is %s", m_strLogPrefix.c_str(),
-          m_strSessionID.c_str());
-      CLog::Log(LOGDEBUG, "%s: NP URL is %s", m_strLogPrefix.c_str(),
-          m_strNowPlayingURL.c_str());
-      CLog::Log(LOGDEBUG, "%s: Submit URL is %s", m_strLogPrefix.c_str(),
-          m_strSubmissionURL.c_str());
-      ClearErrorState();
-      return true;
-    }
-    CLog::Log(LOGERROR, "%s: Handshake failed! Received malformed "\
-        "reply.", m_strLogPrefix.c_str());
-  }
-  else if (vecTokens[0] == "BANNED")
-  {
-    CLog::Log(LOGERROR, "%s: Handshake failed! Client is banned! "\
-        "Disabling submissions. Subsequent scrobbles will be cached. "\
-        "Please update your client to the newest version. ", m_strLogPrefix.c_str());
-    if (m_failedHandshakeDelay == 0)
-    {
-      NotifyUser(SCROBBLER_USER_ERROR_BANNED);
-    }
-  }
-  else if (vecTokens[0] == "BADAUTH")
-  {
-    CLog::Log(LOGERROR, "%s: Handshake failed! Authentication failed! "\
-        "Disabling submissions. Subsequent scrobbles will be cached. "\
-        "Please enter the correct credentials to re-enable scrobbling. ",
-        m_strLogPrefix.c_str());
-    if (m_failedHandshakeDelay == 0)
-    {
-      NotifyUser(SCROBBLER_USER_ERROR_BADAUTH);
-    }
-  }
-  else if (vecTokens[0] == "BADTIME")
-  {
-    CLog::Log(LOGDEBUG, "%s: Handshake failed! Timestamp is invalid! "\
-        "Disabling submissions. Subsequent scrobbles will be cached. "\
-        "Please correct the system time and restart the application. ",
-        m_strLogPrefix.c_str());
-  }
-  else if (vecTokens[0] == "FAILED")
-  {
-    CLog::Log(LOGDEBUG, "%s: Handshake failed! REASON: %s! ", m_strLogPrefix.c_str(), 
-        strResponse.c_str());
-  }
-  else
-    CLog::Log(LOGDEBUG, "%s: Handshake failed! REASON: Unspecified!", m_strLogPrefix.c_str());
-  
-  return false;
-}
-
-bool CScrobbler::DoNowPlayingNotification()
-{
-  CStdString        strNowPlayingRequest;
-  CStdString        strResponse;
-
-  // Construct now playing notification URL.
-  strNowPlayingRequest.Format("s=%s&a=%s&t=%s&b=%s&l=%d&n=%s&m=%s",
-      m_strSessionID.c_str(), m_CurrentTrack.strArtist.c_str(),
-      m_CurrentTrack.strTitle.c_str(), m_CurrentTrack.strAlbum.c_str(),
-      m_CurrentTrack.length, m_CurrentTrack.strTrackNum.c_str(),
-      m_CurrentTrack.strMusicBrainzID.c_str());
-
-  // Make and handle request
-  if (m_pHttp->Post(m_strNowPlayingURL, strNowPlayingRequest, strResponse) &&
-      HandleNowPlayingNotification(strResponse))
-    return true;
-  
-  HandleHardError();
-  return false;
-}
-
-bool CScrobbler::HandleNowPlayingNotification(CStdString &strResponse)
-{
-  if (strResponse.IsEmpty())
-    return false;
-  std::vector<CStdString> vecTokens;
-  CUtil::Tokenize(strResponse, vecTokens, " \n\r");
-
-  if (vecTokens[0] == "OK")
-  {
-    CLog::Log(LOGDEBUG, "%s: Now playing notification succeeded!", m_strLogPrefix.c_str());
-    ClearErrorState();
-    return true;
-  }
-  else if (vecTokens[0] == "BADSESSION")
-  {
-    CLog::Log(LOGDEBUG, "%s: Now playing notification failed! "\
-        "REASON: Bad session ID. Forcing new handshake.", m_strLogPrefix.c_str());
-    ClearSession();
-  }
-  else
-    CLog::Log(LOGDEBUG, "%s: Now playing notification failed! "\
-        "REASON: Unspecified.", m_strLogPrefix.c_str());
-
-  return false;
-}
-
-bool CScrobbler::DoSubmission()
-{
-  int               i;
-  int               numSubmissions;
-  CStdString        strSubmissionRequest;
-  CStdString        strSubmission;
-  CStdString        strResponse;
-  CSingleLock lock(m_queueLock);
-
-  // Construct submission URL.
-  numSubmissions = 
-    std::min((size_t)SCROBBLER_MAX_SUBMISSIONS, m_vecSubmissionQueue.size());
-  if (numSubmissions == 0)
-    return true;
-  strSubmissionRequest.Format("s=%s", m_strSessionID.c_str());
-  SCROBBLERJOURNALITERATOR it = m_vecSubmissionQueue.begin();
-  for (i = 0; it != m_vecSubmissionQueue.end() && i < numSubmissions; i++,it++)
-  {
-    strSubmission.Format("&a[%d]=%s&t[%d]=%s&i[%d]=%s&o[%d]=%s&r[%d]=%s",
-        i, it->strArtist.c_str(),     i, it->strTitle.c_str(),
-        i, it->strStartTime.c_str(),  i, it->strSource.c_str(),
-        i, it->strRating.c_str());
-    // Too many params, must be split (or hack CStdString)
-    strSubmission.Format("%s&l[%d]=%s&b[%d]=%s&n[%d]=%s&m[%d]=%s",
-        strSubmission.c_str(),        i, it->strLength.c_str(),
-        i, it->strAlbum.c_str(),      i, it->strTrackNum.c_str(),
-        i, it->strMusicBrainzID.c_str());
-    strSubmissionRequest += strSubmission;
-  }
-  
-  // Make and handle request
-  lock.Leave();
-  if (m_pHttp->Post(m_strSubmissionURL, strSubmissionRequest, strResponse) &&
-      HandleSubmission(strResponse))
-  {
-    lock.Enter();
-    SCROBBLERJOURNALITERATOR it = m_vecSubmissionQueue.begin();
-    m_vecSubmissionQueue.erase(it, it + i); // Remove submitted entries
-    lock.Leave();
-    SaveJournal();
-    return true;
-  }
-
-  HandleHardError();
-  return false;
-}
-
-bool CScrobbler::HandleSubmission(CStdString &strResponse)
-{
-  if (strResponse.IsEmpty())
-    return false;
-  
-  std::vector<CStdString> vecTokens;
-  CUtil::Tokenize(strResponse, vecTokens, " \n\r");
-
-  if (vecTokens[0] == "OK")
-  {
-    CLog::Log(LOGDEBUG, "%s: Submission succeeded!", m_strLogPrefix.c_str());
-    ClearErrorState();
-    return true;
-  }
-  else if (vecTokens[0] == "BADSESSION")
-  {
-    CLog::Log(LOGDEBUG, "%s: Submission failed! "\
-        "REASON: Bad session. Forcing new handshake.", m_strLogPrefix.c_str());
-    ClearSession();
-  }
-  else if (vecTokens[0] == "FAILED")
-  {
-    CLog::Log(LOGDEBUG, "%s: Submission failed! "\
-        "REASON: %s", m_strLogPrefix.c_str(), strResponse.c_str());
-  }
-  else
-    CLog::Log(LOGDEBUG, "%s: Submission failed! "\
-        "REASON: Unspecified.", m_strLogPrefix.c_str());
-
-  return false;
-}
-
-void CScrobbler::Process()
-{
-  CLog::Log(LOGDEBUG, "%s: Thread started.", m_strLogPrefix.c_str());
-  if (!m_pHttp)
-  {
-    // Hack since CCurlFile isn't threadsafe
-    if (!(m_pHttp = new XFILE::CCurlFile))
-      return;
-  }
-  while (!m_bStop)
-  {
-    AbortableWait(m_hEvent);
-    if (m_bStop)
-      break;
-    
-    if (m_strSessionID.IsEmpty())
-    {
-      time_t now = time(NULL);
-      // We need to handshake.
-      if (m_bBanned || m_bBadAuth ||
-          ((now - m_lastFailedHandshake) < m_failedHandshakeDelay))
-        continue;
-      if (!DoHandshake(now))
-        continue;
-    }
-    int action = 0;
-    {
-      CSingleLock lock(m_actionLock);
-      action = m_action;
-      m_action = 0;
-    }
-    if (action == SCROBBLER_ACTION_NOWPLAYING)
-      DoNowPlayingNotification();
-    else if (action == SCROBBLER_ACTION_SUBMIT)
-    {
-      m_bSubmitting = true;
-      DoSubmission();
-      m_bSubmitting = false;
-    }
-  }
-  delete m_pHttp; // More of aforementioned hack 
-  m_pHttp = NULL;
-  CLog::Log(LOGDEBUG, "%s: Thread ended.", m_strLogPrefix.c_str());
-}
-
-void CScrobbler::NotifyUser(int error)
-{
-}
-
-bool CScrobbler::CanScrobble()
-{
-  return false;
-}
-
-void CScrobbler::LoadCredentials()
-{
-  SetUsername("");
-  SetPassword("");
-}
-
-CStdString CScrobbler::GetJournalFileName()
-{
-  return "";
-}
-
diff --git a/xbmc/network/libscrobbler/scrobbler.h b/xbmc/network/libscrobbler/scrobbler.h
deleted file mode 100644 (file)
index d3abf05..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef LIBSCROBBLER_H__
-#define LIBSCROBBLER_H__
-
-#include <vector>
-#include "utils/StdString.h"
-#include "threads/Thread.h"
-#include "threads/CriticalSection.h"
-#include "threads/Event.h"
-
-#define SCROBBLER_USER_ERROR_BADAUTH  1
-#define SCROBBLER_USER_ERROR_BANNED   2
-
-namespace MUSIC_INFO
-{
-  class CMusicInfoTag;
-}
-
-namespace XFILE
-{
-  class CCurlFile;
-}
-
-/* The following structure describes an entry in the scrobbler submission
- * journal.  Declare members added purely for convenience at the top and
- * members which will actually be read/written from/to disk under a
- * version number comment.  Also, remember to bump the version macro in
- * scrobbler.cpp.
- */
-typedef struct SubmissionJournalEntry_s
-{
-  int        length;
-  // v0
-  CStdString strArtist;
-  CStdString strAlbum;
-  CStdString strTitle;
-  CStdString strLength;  // Required if strSource below is "P"
-  CStdString strStartTime;
-  CStdString strMusicBrainzID;
-  // v1
-  CStdString strTrackNum;
-  CStdString strSource;
-  /* strSource must be one of the following.
-   *  P: Chosen by the user (the most common value, unless you have a reason
-   *     for choosing otherwise, use this).
-   *  R: Non-personalised broadcast (e.g. Shoutcast, BBC Radio 1).
-   *  E: Personalised recommendation except Last.fm (e.g. Pandora, Launchcast).
-   *  L: Last.fm (any mode). In this case, the 5-digit Last.fm recommendation
-   *     key must be appended to this source ID to prove the validity of the
-   *     submission (for example, "o[0]=L1b48a").
-   *  U: Source unknown.
-   */
-  CStdString strRating;
-  /* strRating must be one of the following or empty.
-   *  L: Love (on any mode if the user has manually loved the track). This
-   *     implies a listen.
-   *  B: Ban (only if source=L). This implies a skip, and the client should
-   *     skip to the next track when a ban happens.
-   *  S: Skip (only if source=L)
-   *
-   *  NOTE: This will eventually replace the love/ban web service.
-   */
-  SubmissionJournalEntry_s() {}
-  SubmissionJournalEntry_s(const struct SubmissionJournalEntry_s& j)
-  {
-    strArtist         = j.strArtist;
-    strAlbum          = j.strAlbum;
-    strTitle          = j.strTitle;
-    strLength         = j.strLength;
-    strStartTime      = j.strStartTime;
-    strMusicBrainzID  = j.strMusicBrainzID;
-    strTrackNum       = j.strTrackNum;
-    strSource         = j.strSource;
-    strRating         = j.strRating;
-    length            = j.length;
-  }
-  void Clear()
-  {
-    strArtist.clear();
-    strAlbum.clear();
-    strTitle.clear();
-    strLength.clear();
-    strStartTime.clear();
-    strMusicBrainzID.clear();
-    strTrackNum.clear();
-    strSource = "P";
-    strRating.clear();
-    length = 0;
-  }
-} SubmissionJournalEntry;
-
-typedef std::vector<SubmissionJournalEntry>::iterator SCROBBLERJOURNALITERATOR;
-
-class CScrobbler : public CThread
-{
-protected:
-  bool m_bNotified;
-  bool m_bSubmitting;
-  bool m_bSubmitted;
-  bool m_bBanned;
-  bool m_bBadAuth;
-  int m_submissionTimer;
-  int m_hardErrorCount;
-  int m_failedHandshakeDelay;
-  int m_action;
-  time_t m_lastFailedHandshake;
-  CStdString m_strLogPrefix;
-  CStdString m_strUsername;
-  CStdString m_strPasswordHash;
-  CStdString m_strSessionID;
-  CStdString m_strHandshakeURL;
-  CStdString m_strNowPlayingURL;
-  CStdString m_strSubmissionURL;
-  CStdString m_strHandshakeTimeStamp;
-  SubmissionJournalEntry m_CurrentTrack;
-  CEvent m_hEvent;
-  XFILE::CCurlFile  *m_pHttp;
-  CCriticalSection  m_queueLock;
-  CCriticalSection  m_actionLock;
-  std::vector<SubmissionJournalEntry> m_vecSubmissionQueue;
-private:
-  void ResetState();
-  void ClearErrorState();
-  void ClearSubmissionState();
-  void ClearSession();
-  void HandleHardError();
-  bool LoadJournal();
-  bool SaveJournal();
-  bool DoHandshake(time_t now);
-  bool HandleHandshake(CStdString &strResponse);
-  bool DoNowPlayingNotification();
-  bool HandleNowPlayingNotification(CStdString &strResponse);
-  bool DoSubmission();
-  bool HandleSubmission(CStdString &strResponse);
-  virtual void Process();  // Shouldn't need over ridden by inheriting CScrobblers
-protected:
-  virtual void NotifyUser(int error);
-  virtual bool CanScrobble();
-  virtual void LoadCredentials();
-  virtual CStdString GetJournalFileName();
-
-public:
-  CScrobbler(const CStdString &strHandshakeURL, const CStdString &strLogPrefix = "CScrobbler");
-  virtual ~CScrobbler();
-  void Init();
-  void Term();
-  void AddSong(const MUSIC_INFO::CMusicInfoTag &tag, bool lastfmradio);
-  void UpdateStatus();
-  void SubmitQueue();
-  void SetUsername(const CStdString &strUser);
-  void SetPassword(const CStdString &strPass);
-  CStdString GetConnectionState();
-  CStdString GetSubmitInterval();
-  CStdString GetFilesCached();
-  CStdString GetSubmitState();
-};
-
-#endif // LIBSCROBBLER_H__
index dc7ce84..0130957 100644 (file)
@@ -539,6 +539,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void)
    iwr.u.data.length = sizeof(rangebuffer);
    iwr.u.data.flags = 0;
    strncpy(iwr.ifr_name, GetName().c_str(), IFNAMSIZ);
+   iwr.ifr_name[IFNAMSIZ - 1] = 0;
    if (ioctl(m_network->GetSocket(), SIOCGIWRANGE, &iwr) < 0)
    {
       CLog::Log(LOGWARNING, "%-8.16s  Driver has no Wireless Extension version information.",
@@ -549,6 +550,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void)
    // Scan for wireless access points
    memset(&iwr, 0, sizeof(iwr));
    strncpy(iwr.ifr_name, GetName().c_str(), IFNAMSIZ);
+   iwr.ifr_name[IFNAMSIZ - 1] = 0;
    if (ioctl(m_network->GetSocket(), SIOCSIWSCAN, &iwr) < 0)
    {
       CLog::Log(LOGWARNING, "Cannot initiate wireless scan: ioctl[SIOCSIWSCAN]: %s", strerror(errno));
@@ -574,6 +576,7 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void)
       }
 
       strncpy(iwr.ifr_name, GetName().c_str(), IFNAMSIZ);
+      iwr.ifr_name[IFNAMSIZ - 1] = 0;
       iwr.u.data.pointer = res_buf;
       iwr.u.data.length = res_buf_len;
       iwr.u.data.flags = 0;
@@ -645,8 +648,10 @@ std::vector<NetworkAccessPoint> CNetworkInterfaceLinux::GetAccessPoints(void)
             if (first)
                first = false;
             else
+            {
                result.push_back(NetworkAccessPoint(essId, quality, encryption));
                encryption = ENC_NONE;
+            }
             break;
 
          case SIOCGIWESSID:
index ac3ef30..f0ab298 100644 (file)
@@ -9,10 +9,11 @@ INCLUDES+=-I@abs_top_srcdir@/lib/libUPnP/Platinum/Source/Core \
           -I@abs_top_srcdir@/lib/libUPnP/Neptune/Source/Core
 
 SRCS= UPnP.cpp \
+      UPnPInternal.cpp \
       UPnPPlayer.cpp \
       UPnPRenderer.cpp \
       UPnPServer.cpp \
-      UPnPInternal.cpp
+      UPnPSettings.cpp \
 
 LIB=upnp.a
 
index 591590c..251482f 100644 (file)
@@ -25,6 +25,7 @@
 #include "UPnPInternal.h"
 #include "UPnPRenderer.h"
 #include "UPnPServer.h"
+#include "UPnPSettings.h"
 #include "utils/URIUtils.h"
 #include "Application.h"
 #include "ApplicationMessenger.h"
@@ -245,7 +246,7 @@ public:
 
   virtual bool OnMRAdded(PLT_DeviceDataReference& device )
   {
-    CPlayerCoreFactory::OnPlayerDiscovered((const char*)device->GetUUID()
+    CPlayerCoreFactory::Get().OnPlayerDiscovered((const char*)device->GetUUID()
                                           ,(const char*)device->GetFriendlyName()
                                           , EPC_UPNPPLAYER);
     return true;
@@ -253,7 +254,7 @@ public:
 
   virtual void OnMRRemoved(PLT_DeviceDataReference& device )
   {
-    CPlayerCoreFactory::OnPlayerRemoved((const char*)device->GetUUID());
+    CPlayerCoreFactory::Get().OnPlayerRemoved((const char*)device->GetUUID());
   }
 };
 
@@ -392,7 +393,7 @@ CUPnP::CreateServer(int port /* = 0 */)
 {
     CUPnPServer* device =
         new CUPnPServer(g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME),
-                        g_settings.m_UPnPUUIDServer.length()?g_settings.m_UPnPUUIDServer.c_str():NULL,
+                        CUPnPSettings::Get().GetServerUUID().length() ? CUPnPSettings::Get().GetServerUUID().c_str() : NULL,
                         port);
 
     // trying to set optional upnp values for XP UPnP UI Icons to detect us
@@ -424,37 +425,37 @@ CUPnP::StartServer()
     // load upnpserver.xml so that g_settings.m_vecUPnPMusiCMediaSources, etc.. are loaded
     CStdString filename;
     URIUtils::AddFileToFolder(g_settings.GetUserDataFolder(), "upnpserver.xml", filename);
-    g_settings.LoadUPnPXml(filename);
+    CUPnPSettings::Get().Load(filename);
 
     // create the server with a XBox compatible friendlyname and UUID from upnpserver.xml if found
-    m_ServerHolder->m_Device = CreateServer(g_settings.m_UPnPPortServer);
+    m_ServerHolder->m_Device = CreateServer(CUPnPSettings::Get().GetServerPort());
 
     // start server
     NPT_Result res = m_UPnP->AddDevice(m_ServerHolder->m_Device);
     if (NPT_FAILED(res)) {
         // if the upnp device port was not 0, it could have failed because
         // of port being in used, so restart with a random port
-        if (g_settings.m_UPnPPortServer > 0) m_ServerHolder->m_Device = CreateServer(0);
+        if (CUPnPSettings::Get().GetServerPort() > 0) m_ServerHolder->m_Device = CreateServer(0);
 
         res = m_UPnP->AddDevice(m_ServerHolder->m_Device);
     }
 
     // save port but don't overwrite saved settings if port was random
     if (NPT_SUCCEEDED(res)) {
-        if (g_settings.m_UPnPPortServer == 0) {
-            g_settings.m_UPnPPortServer = m_ServerHolder->m_Device->GetPort();
+        if (CUPnPSettings::Get().GetServerPort() == 0) {
+            CUPnPSettings::Get().SetServerPort(m_ServerHolder->m_Device->GetPort());
         }
         CUPnPServer::m_MaxReturnedItems = UPNP_DEFAULT_MAX_RETURNED_ITEMS;
-        if (g_settings.m_UPnPMaxReturnedItems > 0) {
+        if (CUPnPSettings::Get().GetMaximumReturnedItems() > 0) {
             // must be > UPNP_DEFAULT_MIN_RETURNED_ITEMS
-            CUPnPServer::m_MaxReturnedItems = max(UPNP_DEFAULT_MIN_RETURNED_ITEMS, g_settings.m_UPnPMaxReturnedItems);
+            CUPnPServer::m_MaxReturnedItems = max(UPNP_DEFAULT_MIN_RETURNED_ITEMS, CUPnPSettings::Get().GetMaximumReturnedItems());
         }
-        g_settings.m_UPnPMaxReturnedItems = CUPnPServer::m_MaxReturnedItems;
+        CUPnPSettings::Get().SetMaximumReturnedItems(CUPnPServer::m_MaxReturnedItems);
     }
 
     // save UUID
-    g_settings.m_UPnPUUIDServer = m_ServerHolder->m_Device->GetUUID();
-    g_settings.SaveUPnPXml(filename);
+    CUPnPSettings::Get().SetServerUUID(m_ServerHolder->m_Device->GetUUID().GetChars());
+    CUPnPSettings::Get().Save(filename);
 }
 
 /*----------------------------------------------------------------------
@@ -478,7 +479,7 @@ CUPnP::CreateRenderer(int port /* = 0 */)
     CUPnPRenderer* device =
         new CUPnPRenderer(g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME),
                           false,
-                          (g_settings.m_UPnPUUIDRenderer.length() ? g_settings.m_UPnPUUIDRenderer.c_str() : NULL),
+                          (CUPnPSettings::Get().GetRendererUUID().length() ? CUPnPSettings::Get().GetRendererUUID().c_str() : NULL),
                           port);
 
     device->m_PresentationURL =
@@ -504,27 +505,27 @@ void CUPnP::StartRenderer()
 
     CStdString filename;
     URIUtils::AddFileToFolder(g_settings.GetUserDataFolder(), "upnpserver.xml", filename);
-    g_settings.LoadUPnPXml(filename);
+    CUPnPSettings::Get().Load(filename);
 
-    m_RendererHolder->m_Device = CreateRenderer(g_settings.m_UPnPPortRenderer);
+    m_RendererHolder->m_Device = CreateRenderer(CUPnPSettings::Get().GetRendererPort());
 
     NPT_Result res = m_UPnP->AddDevice(m_RendererHolder->m_Device);
 
     // failed most likely because port is in use, try again with random port now
-    if (NPT_FAILED(res) && g_settings.m_UPnPPortRenderer != 0) {
+    if (NPT_FAILED(res) && CUPnPSettings::Get().GetRendererPort() != 0) {
         m_RendererHolder->m_Device = CreateRenderer(0);
 
         res = m_UPnP->AddDevice(m_RendererHolder->m_Device);
     }
 
     // save port but don't overwrite saved settings if random
-    if (NPT_SUCCEEDED(res) && g_settings.m_UPnPPortRenderer == 0) {
-        g_settings.m_UPnPPortRenderer = m_RendererHolder->m_Device->GetPort();
+    if (NPT_SUCCEEDED(res) && CUPnPSettings::Get().GetRendererPort() == 0) {
+        CUPnPSettings::Get().SetRendererPort(m_RendererHolder->m_Device->GetPort());
     }
 
     // save UUID
-    g_settings.m_UPnPUUIDRenderer = m_RendererHolder->m_Device->GetUUID();
-    g_settings.SaveUPnPXml(filename);
+    CUPnPSettings::Get().SetRendererUUID(m_RendererHolder->m_Device->GetUUID().GetChars());
+    CUPnPSettings::Get().Save(filename);
 }
 
 /*----------------------------------------------------------------------
index 267df26..b04b99d 100644 (file)
@@ -171,6 +171,7 @@ CUPnPPlayer::CUPnPPlayer(IPlayerCallback& callback, const char* uuid)
 CUPnPPlayer::~CUPnPPlayer()
 {
   CloseFile();
+  delete m_delegate;
 }
 
 static NPT_Result WaitOnEvent(CEvent& event, XbmcThreads::EndTime& timeout, CGUIDialogBusy*& dialog)
diff --git a/xbmc/network/upnp/UPnPSettings.cpp b/xbmc/network/upnp/UPnPSettings.cpp
new file mode 100644 (file)
index 0000000..70a8344
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "UPnPSettings.h"
+#include "filesystem/File.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+#include "utils/XMLUtils.h"
+
+#define XML_UPNP          "upnpserver"
+#define XML_SERVER_UUID   "UUID"
+#define XML_SERVER_PORT   "Port"
+#define XML_MAX_ITEMS     "MaxReturnedItems"
+#define XML_RENDERER_UUID "UUIDRenderer"
+#define XML_RENDERER_PORT "PortRenderer"
+
+using namespace std;
+using namespace XFILE;
+
+CUPnPSettings::CUPnPSettings()
+{
+  Clear();
+}
+
+CUPnPSettings::~CUPnPSettings()
+{
+  Clear();
+}
+
+CUPnPSettings& CUPnPSettings::Get()
+{
+  static CUPnPSettings sUPnPSettings;
+  return sUPnPSettings;
+}
+
+bool CUPnPSettings::Load(const std::string &file)
+{
+  Clear();
+
+  if (!CFile::Exists(file))
+    return false;
+  
+  CXBMCTinyXML doc;
+  if (!doc.LoadFile(file))
+  {
+    CLog::Log(LOGERROR, "CUPnPSettings: error loading %s, Line %d\n%s", file.c_str(), doc.ErrorRow(), doc.ErrorDesc());
+    return false;
+  }
+
+  TiXmlElement *pRootElement = doc.RootElement();
+  if (pRootElement == NULL || !StringUtils::EqualsNoCase(pRootElement->Value(), XML_UPNP))
+  {
+    CLog::Log(LOGERROR, "CUPnPSettings: error loading %s, no <upnpserver> node", file.c_str());
+    return false;
+  }
+
+  // load settings
+  XMLUtils::GetString(pRootElement, XML_SERVER_UUID, m_serverUUID);
+  XMLUtils::GetInt(pRootElement, XML_SERVER_PORT, m_serverPort);
+  XMLUtils::GetInt(pRootElement, XML_MAX_ITEMS, m_maxReturnedItems);
+  XMLUtils::GetString(pRootElement, XML_RENDERER_UUID, m_rendererUUID);
+  XMLUtils::GetInt(pRootElement, XML_RENDERER_PORT, m_rendererPort);
+
+  return true;
+}
+
+bool CUPnPSettings::Save(const std::string &file) const
+{
+  CXBMCTinyXML doc;
+  TiXmlElement xmlRootElement(XML_UPNP);
+  TiXmlNode *pRoot = doc.InsertEndChild(xmlRootElement);
+  if (pRoot == NULL)
+    return false;
+
+  XMLUtils::SetString(pRoot, XML_SERVER_UUID, m_serverUUID);
+  XMLUtils::SetInt(pRoot, XML_SERVER_PORT, m_serverPort);
+  XMLUtils::SetInt(pRoot, XML_MAX_ITEMS, m_maxReturnedItems);
+  XMLUtils::SetString(pRoot, XML_RENDERER_UUID, m_rendererUUID);
+  XMLUtils::SetInt(pRoot, XML_RENDERER_PORT, m_rendererPort);
+
+  // save the file
+  return doc.SaveFile(file);
+}
+
+void CUPnPSettings::Clear()
+{
+  m_serverUUID.clear();
+  m_serverPort = 0;
+  m_maxReturnedItems = 0;
+  m_rendererUUID.clear();
+  m_rendererPort = 0;
+}
diff --git a/xbmc/network/upnp/UPnPSettings.h b/xbmc/network/upnp/UPnPSettings.h
new file mode 100644 (file)
index 0000000..5ef2861
--- /dev/null
@@ -0,0 +1,57 @@
+#pragma once
+/*
+ *      Copyright (C) 2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <string>
+
+class CUPnPSettings
+{
+public:
+  static CUPnPSettings& Get();
+
+  bool Load(const std::string &file);
+  bool Save(const std::string &file) const;
+  void Clear();
+
+  const std::string& GetServerUUID() const { return m_serverUUID; }
+  int GetServerPort() const { return m_serverPort; }
+  int GetMaximumReturnedItems() const { return m_maxReturnedItems; }
+  const std::string& GetRendererUUID() const { return m_rendererUUID; }
+  int GetRendererPort() const { return m_rendererPort; }
+
+  void SetServerUUID(const std::string &uuid) { m_serverUUID = uuid; }
+  void SetServerPort(int port) { m_serverPort = port; }
+  void SetMaximumReturnedItems(int maximumReturnedItems) { m_maxReturnedItems = maximumReturnedItems; }
+  void SetRendererUUID(const std::string &uuid) { m_rendererUUID = uuid; }
+  void SetRendererPort(int port) { m_rendererPort = port; }
+
+protected:
+  CUPnPSettings();
+  CUPnPSettings(const CUPnPSettings&);
+  CUPnPSettings const& operator=(CUPnPSettings const&);
+  virtual ~CUPnPSettings();
+
+private:
+  std::string m_serverUUID;
+  int m_serverPort;
+  int m_maxReturnedItems;
+  std::string m_rendererUUID;
+  int m_rendererPort;
+};
index 94e7ab0..5008073 100644 (file)
@@ -80,11 +80,11 @@ CWebSocketFrame::CWebSocketFrame(const char* data, uint64_t length)
   // Get the MASK flag
   m_masked = ((m_data[1] & MASK_MASK) == MASK_MASK);
 
-  // Get the playload length
+  // Get the payload length
   m_length = (uint64_t)(m_data[1] & MASK_LENGTH);
-  if ((m_length <= 125 && length  < m_length + LENGTH_MIN) ||
-      (m_length == 126 && length < LENGTH_MIN + 2) ||
-      (m_length == 127 && length < LENGTH_MIN + 8))
+  if ((m_length <= 125 && m_lengthFrame  < m_length + LENGTH_MIN) ||
+      (m_length == 126 && m_lengthFrame < LENGTH_MIN + 2) ||
+      (m_length == 127 && m_lengthFrame < LENGTH_MIN + 8))
   {
     CLog::Log(LOGINFO, "WebSocket: Frame with invalid length received");
     reset();
@@ -110,7 +110,7 @@ CWebSocketFrame::CWebSocketFrame(const char* data, uint64_t length)
     offset = 8;
   }
 
-  if (length < LENGTH_MIN + offset + m_length)
+  if (m_lengthFrame < LENGTH_MIN + offset + m_length)
   {
     CLog::Log(LOGINFO, "WebSocket: Frame with invalid length received");
     reset();
@@ -124,12 +124,8 @@ CWebSocketFrame::CWebSocketFrame(const char* data, uint64_t length)
     offset += 4;
   }
 
-  if (length != LENGTH_MIN + offset + m_length)
-  {
-    CLog::Log(LOGINFO, "WebSocket: Frame with invalid length received");
-    reset();
-    return;
-  }
+  if (m_lengthFrame != LENGTH_MIN + offset + m_length)
+    m_lengthFrame = LENGTH_MIN + offset + m_length;
 
   // Get application data
   if (m_length > 0)
@@ -305,102 +301,122 @@ void CWebSocketMessage::Clear()
   m_frames.clear();
 }
 
-const CWebSocketMessage* CWebSocket::Handle(const char *buffer, size_t length, bool &send)
+const CWebSocketMessage* CWebSocket::Handle(const char* &buffer, size_t &length, bool &send)
 {
   send = false;
 
-  switch (m_state)
+  while (length > 0)
   {
-    case WebSocketStateConnected:
+    switch (m_state)
     {
-      CWebSocketFrame *frame = GetFrame(buffer, length);
-      if (!frame->IsValid())
+      case WebSocketStateConnected:
       {
-        CLog::Log(LOGINFO, "WebSocket: Invalid frame received");
-        delete frame;
-        return NULL;
-      }
-
-      if (frame->IsControlFrame())
-      {
-        if (!frame->IsFinal())
+        CWebSocketFrame *frame = GetFrame(buffer, length);
+        if (!frame->IsValid())
         {
+          CLog::Log(LOGINFO, "WebSocket: Invalid frame received");
           delete frame;
           return NULL;
         }
 
-        CWebSocketMessage *msg = NULL;
-        switch (frame->GetOpcode())
+        // adjust the length and the buffer values
+        length -= frame->GetFrameLength();
+        buffer += frame->GetFrameLength();
+
+        if (frame->IsControlFrame())
         {
-          case WebSocketPing:
-            msg = GetMessage();
-            if (msg != NULL)
-              msg->AddFrame(Pong(frame->GetApplicationData()));
-            break;
+          if (!frame->IsFinal())
+          {
+            delete frame;
+            return NULL;
+          }
+
+          CWebSocketMessage *msg = NULL;
+          switch (frame->GetOpcode())
+          {
+            case WebSocketPing:
+              msg = GetMessage();
+              if (msg != NULL)
+                msg->AddFrame(Pong(frame->GetApplicationData()));
+              break;
             
-          case WebSocketConnectionClose:
-            CLog::Log(LOGINFO, "WebSocket: connection closed by client");
-
-            msg = GetMessage();
-            if (msg != NULL)
-              msg->AddFrame(Close());
-
-            m_state = WebSocketStateClosed;
-            break;
-
-          case WebSocketContinuationFrame:
-          case WebSocketTextFrame:
-          case WebSocketBinaryFrame:
-          case WebSocketPong:
-          case WebSocketUnknownFrame:
-          default:
-            break;
+            case WebSocketConnectionClose:
+              CLog::Log(LOGINFO, "WebSocket: connection closed by client");
+
+              msg = GetMessage();
+              if (msg != NULL)
+                msg->AddFrame(Close());
+
+              m_state = WebSocketStateClosed;
+              break;
+
+            case WebSocketContinuationFrame:
+            case WebSocketTextFrame:
+            case WebSocketBinaryFrame:
+            case WebSocketPong:
+            case WebSocketUnknownFrame:
+            default:
+              break;
+          }
+
+          delete frame;
+
+          if (msg != NULL)
+            send = true;
+
+          return msg;
         }
 
-        delete frame;
+        if (m_message == NULL && (m_message = GetMessage()) == NULL)
+        {
+          CLog::Log(LOGINFO, "WebSocket: Could not allocate a new websocket message");
+          delete frame;
+          return NULL;
+        }
 
-        if (msg != NULL)
-          send = true;
+        m_message->AddFrame(frame);
+        if (!m_message->IsComplete())
+        {
+          if (length > 0)
+            continue;
+          else
+            return NULL;
+        }
 
+        CWebSocketMessage *msg = m_message;
+        m_message = NULL;
         return msg;
       }
 
-      if (m_message == NULL && (m_message = GetMessage()) == NULL)
+      case WebSocketStateClosing:
       {
-        CLog::Log(LOGINFO, "WebSocket: Could not allocate a new websocket message");
-        delete frame;
-        return NULL;
-      }
+        CWebSocketFrame *frame = GetFrame(buffer, length);
 
-      m_message->AddFrame(frame);
-      if (!m_message->IsComplete())
-        return NULL;
+        if (frame->IsValid())
+        {
+          // adjust the length and the buffer values
+          length -= frame->GetFrameLength();
+          buffer += frame->GetFrameLength();
+        }
 
-      CWebSocketMessage *msg = m_message;
-      m_message = NULL;
-      return msg;
-    }
+        if (!frame->IsValid() || frame->GetOpcode() == WebSocketConnectionClose)
+        {
+          CLog::Log(LOGINFO, "WebSocket: Invalid or unexpected frame received (only closing handshake expected)");
+          delete frame;
+          return NULL;
+        }
 
-    case WebSocketStateClosing:
-    {
-      CWebSocketFrame *frame = GetFrame(buffer, length);
-      if (!frame->IsValid() || frame->GetOpcode() == WebSocketConnectionClose)
-      {
-        CLog::Log(LOGINFO, "WebSocket: Invalid or unexpected frame received (only closing handshake expected)");
-        delete frame;
+        m_state = WebSocketStateClosed;
         return NULL;
       }
 
-      m_state = WebSocketStateClosed;
-      return NULL;
+      case WebSocketStateNotConnected:
+      case WebSocketStateClosed:
+      case WebSocketStateHandshaking:
+      default:
+        CLog::Log(LOGINFO, "WebSocket: No frame expected in the current state");
+        return NULL;
     }
-
-    case WebSocketStateNotConnected:
-    case WebSocketStateClosed:
-    case WebSocketStateHandshaking:
-    default:
-      CLog::Log(LOGINFO, "WebSocket: No frame expected in the current state");
-      return NULL;
   }
 
   return NULL;
index bbfaa89..e0d3cae 100644 (file)
@@ -122,7 +122,7 @@ public:
   WebSocketState GetState() { return m_state; }
 
   virtual bool Handshake(const char* data, size_t length, std::string &response) = 0;
-  virtual const CWebSocketMessage* Handle(const char *buffer, size_t length, bool &send);
+  virtual const CWebSocketMessage* Handle(const char* &buffer, size_t &length, bool &send);
   virtual const CWebSocketMessage* Send(WebSocketFrameOpcode opcode, const char* data = NULL, uint32_t length = 0);
   virtual const CWebSocketFrame* Ping(const char* data = NULL) const = 0;
   virtual const CWebSocketFrame* Pong(const char* data = NULL) const = 0;
index d182f78..9935a80 100644 (file)
@@ -177,7 +177,7 @@ int  GetDarwinFrameworkPath(bool forPython, char* path, uint32_t *pathsize)
   *pathsize = 0;
 
   // a) XBMC frappliance running under ATV2
-  Class XBMCfrapp = NSClassFromString(@"XBMCAppliance");
+  Class XBMCfrapp = NSClassFromString(@"XBMCATV2Detector");
   if (XBMCfrapp != NULL)
   {
     pathname = [[NSBundle bundleForClass:XBMCfrapp] pathForResource:@"Frameworks" ofType:@""];
@@ -234,7 +234,7 @@ int  GetDarwinExecutablePath(char* path, uint32_t *pathsize)
   NSString *pathname;
 
   // a) XBMC frappliance running under ATV2
-  Class XBMCfrapp = NSClassFromString(@"XBMCAppliance");
+  Class XBMCfrapp = NSClassFromString(@"XBMCATV2Detector");
   if (XBMCfrapp != NULL)
   {
     pathname = [[NSBundle bundleForClass:XBMCfrapp] pathForResource:@"XBMC" ofType:@""];
@@ -260,7 +260,7 @@ bool DarwinHasVideoToolboxDecoder(void)
 
   if (DecoderAvailable == -1)
   {
-    Class XBMCfrapp = NSClassFromString(@"XBMCAppliance");
+    Class XBMCfrapp = NSClassFromString(@"XBMCATV2Detector");
     if (XBMCfrapp != NULL)
     {
       // atv2 has seatbelt profile key removed so nothing to do here
index 6edc87a..db7b341 100644 (file)
@@ -31,6 +31,7 @@
 #undef BOOL
 
 #import <Foundation/Foundation.h>
+#include <objc/runtime.h>
 
 #import "IOSScreenManager.h"
 #import "XBMCController.h"
@@ -218,7 +219,8 @@ static CEvent screenChangeEvent;
 #if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_4_2
   res.size = screen.preferredMode.size;
 #else
-  res.size = [BRWindow interfaceFrame].size;
+  Class brwin = objc_getClass("BRWindow");
+  res.size = [brwin interfaceFrame].size;
 #endif
 #else
   //main screen is in portrait mode (physically) so exchange height and width
index ea70d17..3105d27 100644 (file)
@@ -40,5 +40,7 @@
        <string>4.1</string>
        <key>NSPrincipalClass</key>
        <string>XBMCAppliance</string>
+       <key>FRApplianceName</key>
+       <string>XBMC</string>
 </dict>
 </plist>
index e1e211d..981399f 100644 (file)
   XBMCTopShelfController *_topShelfController;
 }
 @property(nonatomic, readonly, retain) id topShelfController;
+
+- (id) initWithApplianceInfo:(id) applianceInfo;
+- (void) setTopShelfController:(id) topShelfControl;
+- (void) setApplianceCategories:(id) applianceCategories;
+- (void) XBMCfixUIDevice;
+- (id) init;
 @end
diff --git a/xbmc/osx/atv2/XBMCAppliance.m b/xbmc/osx/atv2/XBMCAppliance.m
deleted file mode 100644 (file)
index 9cf3377..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *      Copyright (C) 2010-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-#import <BackRow/BackRow.h>
-// objc-runtime.h is missing from iPhoneOS4.2SDK but present in iPhoneSimulator4.2.sdk
-// pull it from runtime system for now
-#import "/usr/include/objc/objc-runtime.h"
-
-#import "XBMCAppliance.h"
-#import "XBMCController.h"
-
-#define XBMCAppliance_CAT [BRApplianceCategory categoryWithName:@"XBMC" identifier:@"xbmc" preferredOrder:-5]
-
-// ATVVersionInfo declare to shut up compiler warning
-@interface ATVVersionInfo : NSObject
-{
-}
-+ (id)currentOSVersion;
-@end
-//--------------------------------------------------------------
-//--------------------------------------------------------------
-@interface BRTopShelfView (specialAdditions)
-//
-- (BRImageControl *)productImage;
-
-@end
-
-@implementation BRTopShelfView (specialAdditions)
-- (BRImageControl *)productImage
-{
-  Ivar ivar = object_getInstanceVariable(self, "_productImage", NULL);
-  id result = object_getIvar(self, ivar);
-  return result;
-}
-@end
-
-//--------------------------------------------------------------
-//--------------------------------------------------------------
-@interface XBMCTopShelfController : NSObject
-{
-}
-- (void) selectCategoryWithIdentifier:(id)identifier;
-- (id) topShelfView;
-// added in 4.1+
-- (void) refresh;
-@end
-
-@implementation XBMCTopShelfController
-//
-- (void) selectCategoryWithIdentifier:(id)identifier 
-{
-}
-
-- (BRTopShelfView *)topShelfView {
-       BRTopShelfView *topShelf = [[BRTopShelfView alloc] init];
-       BRImageControl *imageControl = [topShelf productImage];
-       BRImage *gpImage = [BRImage imageWithPath:[[NSBundle bundleForClass:[XBMCAppliance class]] pathForResource:@"XBMC" ofType:@"png"]];
-       [imageControl setImage:gpImage];
-       
-       return topShelf;
-}
-- (void) refresh
-{
-}
-@end
-
-//--------------------------------------------------------------
-//--------------------------------------------------------------
-@implementation XBMCAppliance
-@synthesize topShelfController=_topShelfController;
-
--(void)XBMCfixUIDevice
-{
-  // iOS 5.x has removed the internal load of UIKit in AppleTV app
-  // and there is an overlap of some UIKit and AppleTV methods.
-  // This voodoo seems to clear up the wonkiness. :)
-  Class cls = NSClassFromString(@"ATVVersionInfo");
-  if (cls != nil && [[cls currentOSVersion] rangeOfString:@"5."].location != NSNotFound)
-  {
-    id cd = nil;
-
-    @try
-    {
-      cd = [UIDevice currentDevice];
-    }
-    
-    @catch (NSException *e)
-    {
-      NSLog(@"exception: %@", e);
-    }
-    
-    @finally
-    {
-      //NSLog(@"will it work the second try?");
-      cd = [UIDevice currentDevice];
-      NSLog(@"current device fixed: %@", cd);
-    }
-  }
-}
-
--(id) init
-{
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-
-  if ((self = [super init]) != nil) 
-  {
-    _topShelfController = [[XBMCTopShelfController alloc] init];
-    _applianceCategories = [[NSArray alloc] initWithObjects:XBMCAppliance_CAT ,nil];
-       }
-
-  return self;
-}
-
-- (void) dealloc
-{
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-
-  [_applianceCategories release];
-  [_topShelfController release];
-
-       [super dealloc];
-}
-
-- (id) applianceCategories
-{
-       return _applianceCategories;
-}
-
-- (id) identifierForContentAlias:(id)contentAlias
-{
-       return @"xbmc";
-}
-
-- (id) selectCategoryWithIdentifier:(id)ident
-{
-       //NSLog(@"eglv2:selecteCategoryWithIdentifier: %@", ident);
-
-       return nil;
-}
-- (BOOL) handleObjectSelection:(id)fp8 userInfo:(id)fp12
-{
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-
-       return YES;
-}
-
-- (id) applianceSpecificControllerForIdentifier:(id)arg1 args:(id)arg2
-{
-  return nil;
-}
-- (BOOL) handlePlay:(id)play userInfo:(id)info
-{
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-
-  return YES;
-}
-
-- (id) controllerForIdentifier:(id)identifier args:(id)args
-{
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-  
-  [self XBMCfixUIDevice];
-  XBMCController *controller = [[[XBMCController alloc] init] autorelease];
-  //XBMCController *controller = [XBMCController sharedInstance];
-  return controller;
-}
-
-- (id) localizedSearchTitle { return @"xbmc"; }
-- (id) applianceName { return @"xbmc"; }
-- (id) moduleName { return @"xbmc"; }
-- (id) applianceKey { return @"xbmc"; }
-
-@end
-
diff --git a/xbmc/osx/atv2/XBMCAppliance.mm b/xbmc/osx/atv2/XBMCAppliance.mm
new file mode 100644 (file)
index 0000000..11eb530
--- /dev/null
@@ -0,0 +1,470 @@
+/*
+ *      Copyright (C) 2010-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+/* HowTo code in this file:
+ * Since AppleTV/iOS6.x (atv2 version 5.2) Apple removed the AppleTV.framework and put all those classes into the
+ * AppleTV.app. So we can't use standard obj-c coding here anymore. Instead we need to use the obj-c runtime
+ * functions for subclassing and adding methods to our instances during runtime (hooking).
+ * 
+ * 1. For implementing a method of a base class:
+ *  a) declare it in the form <XBMCAppliance$nameOfMethod> like the others 
+ *  b) these methods need to be static and have XBMCAppliance* self, SEL _cmd (replace XBMCAppliance with the class the method gets implemented for) as minimum params. 
+ *  c) add the method to the XBMCAppliance.h for getting rid of the compiler warnings of unresponsive selectors (declare the method like done in the baseclass).
+ *  d) in initApplianceRuntimeClasses exchange the base class implementation with ours by calling MSHookMessageEx
+ *  e) if we need to call the base class implementation as well we have to save the original implementation (see initWithApplianceInfo$Orig for reference)
+ *
+ * 2. For implementing a new method which is not part of the base class:
+ *  a) same as 1.a
+ *  b) same as 1.b
+ *  c) same as 1.c
+ *  d) in initApplianceRuntimeClasses add the method to our class via class_addMethod
+ *
+ * 3. Never access any BackRow classes directly - but always get the class via objc_getClass - if the class is used in multiple places 
+ *    save it as static (see BRApplianceCategoryCls)
+ * 
+ * 4. Keep the structure of this file based on the section comments (marked with // SECTIONCOMMENT).
+ * 5. really - obey 4.!
+ *
+ * 6. for adding class members use associated objects - see topShelfControllerKey
+ *
+ * For further reference see https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
+ */
+
+#import <Foundation/Foundation.h>
+#import <UIKit/UIKit.h>
+// objc-runtime.h is missing from iPhoneOS4.2SDK but present in iPhoneSimulator4.2.sdk
+// pull it from runtime system for now
+#import "/usr/include/objc/objc-runtime.h"
+
+#import "XBMCAppliance.h"
+#import "XBMCController.h"
+#include "substrate.h"
+
+// SECTIONCOMMENT
+// classes we need multiple times
+static Class BRApplianceCategoryCls;
+
+// category for ios5.x and higher is just a short text before xbmc auto starts
+#define XBMCAppliance_CAT_5andhigher [BRApplianceCategoryCls categoryWithName:@"XBMC is starting..." identifier:@"xbmc" preferredOrder:0]
+// category for ios4.x is the menu entry
+#define XBMCAppliance_CAT_4 [BRApplianceCategoryCls categoryWithName:@"XBMC" identifier:@"xbmc" preferredOrder:0]
+
+// SECTIONCOMMENT
+// forward declaration all referenced classes
+@class XBMCAppliance;
+@class BRTopShelfView;
+@class XBMCApplianceInfo;
+@class BRMainMenuImageControl;
+
+// SECTIONCOMMENT
+// orig method handlers we wanna call in hooked methods
+static id (*XBMCAppliance$initWithApplianceInfo$Orig)(XBMCAppliance*, SEL, id);
+static id (*XBMCAppliance$init$Orig)(XBMCAppliance*, SEL);
+static id (*XBMCAppliance$applianceInfo$Orig)(XBMCAppliance*, SEL);
+
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+// ATVVersionInfo declare to shut up compiler warning
+@interface ATVVersionInfo : NSObject
+{
+}
++ (id)currentOSVersion;
+
+@end
+
+@interface XBMCATV2Detector : NSObject{}
++ (BOOL) hasOldGui;
++ (BOOL) isIos5;
++ (BOOL) needsApplianceInfoHack;
+@end
+
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+// We need a real implementation (not a runtime generated one)
+// for getting our NSBundle instance by calling
+// [[NSBundle bundleForClass:objc_getClass("XBMCATV2Detector")]
+// so we just implement some usefull helpers here
+// and use those
+@implementation XBMCATV2Detector : NSObject{}
++ (BOOL) hasOldGui
+{
+  Class cls = NSClassFromString(@"ATVVersionInfo");  
+  if (cls != nil && [[cls currentOSVersion] rangeOfString:@"4."].location != NSNotFound)
+    return TRUE;
+  if (cls != nil && [[cls currentOSVersion] rangeOfString:@"5.0"].location != NSNotFound)
+    return TRUE;
+  return FALSE;
+}
+
++ (BOOL) isIos5
+{
+  Class cls = NSClassFromString(@"ATVVersionInfo");  
+  if (cls != nil && [[cls currentOSVersion] rangeOfString:@"5."].location != NSNotFound)
+    return TRUE;
+  return FALSE;
+}
+
++ (BOOL) needsApplianceInfoHack
+{
+  // if the runtime base class (BRBaseAppliance) doesn't have the initWithApplianceInfo selector
+  // we need to hack the appliance info in (id) applianceInfo (XBMCAppliance$applianceInfo)
+  if (class_respondsToSelector(objc_getClass("BRBaseAppliance"),@selector(initWithApplianceInfo:)))
+    return FALSE;
+  return TRUE;
+}
+@end
+
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+// XBMCApplication declare to shut up compiler warning of BRApplication
+@interface XBMCApplication : NSObject
+{
+}
+- (void)setFirstResponder:(id)responder;
+@end
+
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+@interface XBMCTopShelfController : NSObject
+{
+}
+- (void) selectCategoryWithIdentifier:(id)identifier;
+- (id) topShelfView;
+- (id) mainMenuShelfView;
+// added in 4.1+
+- (void) refresh;
+@end
+
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+@implementation XBMCTopShelfController
+
+- (void) selectCategoryWithIdentifier:(id)identifier 
+{
+}
+
+- (BRTopShelfView *)topShelfView 
+{
+  Class cls = objc_getClass("BRTopShelfView");
+  id topShelf = [[cls alloc] init];
+  
+  // diddle the topshelf logo on old gui
+  if ([XBMCATV2Detector hasOldGui])
+  {
+    Class cls = objc_getClass("BRImage");
+    BRImageControl *imageControl = (BRImageControl *)MSHookIvar<id>(topShelf, "_productImage");// hook the productImage so we can diddle with it
+    BRImage *gpImage = [cls imageWithPath:[[NSBundle bundleForClass:[XBMCATV2Detector class]] pathForResource:@"XBMC" ofType:@"png"]];
+    [imageControl setImage:gpImage];
+  }
+
+  return topShelf;
+}
+
+// this method is called with the new ios ui (ios 5.1 and higher)
+// its similar to the topshelf view on the opd ios gui
+// but its more mighty (thats we we need to dig one level deeper here)
+// to get our loogo visible
+- (id) mainMenuShelfView;
+{
+  Class BRTopShelfViewCls = objc_getClass("BRTopShelfView");
+  Class BRImageCls = objc_getClass("BRImage");
+
+  id topShelf = [[BRTopShelfViewCls alloc] init];
+  
+  // first hook into the mainMenuImageControl
+  // which is a wrapper for an image control
+  BRMainMenuImageControl *mainMenuImageControl = (BRMainMenuImageControl *)MSHookIvar<id>(topShelf, "_productImage");
+  // now get the image instance
+  BRImageControl *imageControl = (BRImageControl *)MSHookIvar<id>(mainMenuImageControl, "_content");// hook the image so we can diddle with it
+  
+  // load our logo into it
+  BRImage *gpImage = [BRImageCls imageWithPath:[[NSBundle bundleForClass:[XBMCATV2Detector class]] pathForResource:@"XBMC" ofType:@"png"]];
+  [imageControl setImage:gpImage];
+  return topShelf;
+}
+
+- (void) refresh
+{
+}
+@end
+
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+// SECTIONCOMMENT
+// since we can't inject ivars we need to use associated objects
+// these are the keys for XBMCAppliance
+//implementation XBMCAppliance
+static char topShelfControllerKey;
+static char applianceCategoriesKey;
+
+static NSString* XBMCApplianceInfo$key(XBMCApplianceInfo* self, SEL _cmd)
+{
+  return [[[NSBundle bundleForClass:objc_getClass("XBMCATV2Detector")] infoDictionary] objectForKey:(NSString*)kCFBundleIdentifierKey];
+}
+
+static NSString* XBMCApplianceInfo$name(XBMCApplianceInfo* self, SEL _cmd)
+{
+  return [[[NSBundle bundleForClass:objc_getClass("XBMCATV2Detector")] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey];
+}
+
+static id XBMCApplianceInfo$localizedStringsFileName(XBMCApplianceInfo* self, SEL _cmd)
+{
+  return @"xbmc";
+}
+
+static void XBMCAppliance$XBMCfixUIDevice(XBMCAppliance* self, SEL _cmd)
+{
+  // iOS 5.x has removed the internal load of UIKit in AppleTV app
+  // and there is an overlap of some UIKit and AppleTV methods.
+  // This voodoo seems to clear up the wonkiness. :)
+  if ([XBMCATV2Detector isIos5])
+ {
+    id cd = nil;
+
+   @try
+   {
+      cd = [UIDevice currentDevice];
+    }
+    
+   @catch (NSException *e)
+   {
+      NSLog(@"exception: %@", e);
+    }
+    
+   @finally
+   {     
+     //NSLog(@"will it work the second try?");
+      cd = [UIDevice currentDevice];
+      NSLog(@"current device fixed: %@", cd);
+    }
+  }
+}
+
+
+static id XBMCAppliance$init(XBMCAppliance* self, SEL _cmd)
+{
+   //NSLog(@"%s", __PRETTY_FUNCTION__);
+  if ([XBMCATV2Detector needsApplianceInfoHack])
+  {
+    NSLog(@"%s for ios 4", __PRETTY_FUNCTION__);
+    if ((self = XBMCAppliance$init$Orig(self, _cmd))!= nil)
+    {
+      id topShelfControl = [[XBMCTopShelfController alloc] init];
+      [self setTopShelfController:topShelfControl];
+      
+      NSArray *catArray = [[NSArray alloc] initWithObjects:XBMCAppliance_CAT_4,nil];
+      [self setApplianceCategories:catArray];
+      return self;
+    }    
+  }
+  else// ios >= 5
+  {
+    NSLog(@"%s for ios 5 and newer", __PRETTY_FUNCTION__);
+    return [self initWithApplianceInfo:nil]; // legacy for ios < 6
+  }
+  return self;
+}
+
+static id XBMCAppliance$identifierForContentAlias(XBMCAppliance* self, SEL _cmd, id contentAlias)
+{
+  return@"xbmc";
+}
+
+static BOOL XBMCAppliance$handleObjectSelection(XBMCAppliance* self, SEL _cmd, id fp8, id fp12)
+{
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
+  return YES;
+}              
+
+static id XBMCAppliance$applianceInfo(XBMCAppliance* self, SEL _cmd)
+{
+  //NSLog(@"%s", __PRETTY_FUNCTION)
+  
+  // load our plist into memory and merge it with
+  // the dict from the baseclass if needed
+  // cause ios seems to fail on that somehow (at least on 4.x)
+  if ([XBMCATV2Detector needsApplianceInfoHack] && self != nil)
+  {
+    id original = XBMCAppliance$applianceInfo$Orig(self, _cmd);
+    id info =  MSHookIvar<id>(original, "_info");// hook the infoDictionary so we can diddle with it
+    
+    NSString *plistPath = [[NSBundle bundleForClass:objc_getClass("XBMCATV2Detector")] pathForResource:@"Info" ofType:@"plist"];
+    NSString *bundlePath = [[NSBundle bundleForClass:objc_getClass("XBMCATV2Detector")] bundlePath];
+    NSMutableDictionary *ourInfoDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
+
+    if (ourInfoDict != nil && bundlePath != nil)
+    {
+      // inject this or we won't get shown up properly on ios4
+      [ourInfoDict setObject:bundlePath forKey:@"NSBundleInitialPath"];
+      
+      // add our plist info to the baseclass info and return it
+      [(NSMutableDictionary *)info addEntriesFromDictionary:ourInfoDict];
+      [ourInfoDict release];
+    }
+    return original;
+  }
+  else
+  {
+    Class cls = objc_getClass("XBMCApplianceInfo");
+    return [[[cls alloc] init] autorelease];
+  }
+  return nil;
+}
+
+
+static id XBMCAppliance$topShelfController(XBMCAppliance* self, SEL _cmd) 
+{ 
+  return objc_getAssociatedObject(self, &topShelfControllerKey);
+}
+
+
+static void XBMCAppliance$setTopShelfController(XBMCAppliance* self, SEL _cmd, id topShelfControl) 
+{ 
+  objc_setAssociatedObject(self, &topShelfControllerKey, topShelfControl, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+static id XBMCAppliance$applianceCategories(XBMCAppliance* self, SEL _cmd) 
+{
+  return objc_getAssociatedObject(self, &applianceCategoriesKey);
+}
+
+static void XBMCAppliance$setApplianceCategories(XBMCAppliance* self, SEL _cmd, id applianceCategories)
+{ 
+  objc_setAssociatedObject(self, &applianceCategoriesKey, applianceCategories, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+static id XBMCAppliance$initWithApplianceInfo(XBMCAppliance* self, SEL _cmd, id applianceInfo) 
+{ 
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
+  if((self = XBMCAppliance$initWithApplianceInfo$Orig(self, _cmd, applianceInfo)) != nil) 
+  {
+    id topShelfControl = [[XBMCTopShelfController alloc] init];
+    [self setTopShelfController:topShelfControl];
+
+    NSArray *catArray = [[NSArray alloc] initWithObjects:XBMCAppliance_CAT_5andhigher,nil];
+    [self setApplianceCategories:catArray];
+  } 
+  return self;
+}
+
+static id XBMCAppliance$controllerForIdentifier(XBMCAppliance* self, SEL _cmd, id identifier, id args)
+{
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
+  id menuController = nil;
+  Class cls = objc_getClass("BRApplication");
+  if ([identifier isEqualToString:@"xbmc"])
+  {
+    [self XBMCfixUIDevice];
+    menuController = [[objc_getClass("XBMCController") alloc] init];
+    if (menuController == nil)
+      NSLog(@"initialise controller - fail");
+  }
+  XBMCApplication *brapp = (XBMCApplication *)[cls sharedApplication];
+  [brapp setFirstResponder:menuController];
+  return menuController;
+}
+
+static void XBMCPopUpManager$_displayPopUp(BRPopUpManager *self, SEL _cmd, id up)
+{
+  // suppress all popups
+  NSLog(@"%s suppressing popup - for the sake of XBMC.", __PRETTY_FUNCTION__);
+}
+
+// helper function. If the given class responds to the selector
+// we hook via MSHookMessageEx
+// bCheckSuperClass <- indicates if the hookClass or ist superclass should be checked for hookSelector
+// return true if we hooked - else false
+static BOOL safeHook(Class hookClass, SEL hookSelector, IMP ourMethod, IMP *theirMethod, BOOL bCheckSuperClass = true)
+{
+  Class checkClass = class_getSuperclass(hookClass);
+  if (!bCheckSuperClass || !checkClass)
+    checkClass = hookClass;
+
+  if (class_respondsToSelector(checkClass, hookSelector))
+  {
+    MSHookMessageEx(hookClass, hookSelector, ourMethod, theirMethod);
+    return TRUE;
+  }
+  return FALSE;
+}
+
+// SECTIONCOMMENT
+// c'tor - this sets up our class at runtime by 
+// 1. subclassing from the base classes
+// 2. adding new methods to our class
+// 3. exchanging (hooking) base class methods with ours
+// 4. register the classes to the objc runtime system
+static __attribute__((constructor)) void initApplianceRuntimeClasses()
+{
+  // Hook into the popup manager and prevent any popups
+  // the problem with popups is that when they disappear XBMC is
+  // getting 100% transparent (invisible). This can be tested with
+  // the new bluetooth feature in ios6 when a keyboard is connected
+  // a popup is shown (its behind XBMCs window). When it disappears
+  // XBMC does so too.
+  safeHook(objc_getClass("BRPopUpManager"), @selector(_displayPopUp:), (IMP)&XBMCPopUpManager$_displayPopUp, nil, NO);
+  
+  // subclass BRApplianceInfo into XBMCApplianceInfo
+  Class XBMCApplianceInfoCls = objc_allocateClassPair(objc_getClass("BRApplianceInfo"), "XBMCApplianceInfo", 0);
+
+  // and hook up our methods (implementation of the base class methods)
+  // XBMCApplianceInfo::key
+  safeHook(XBMCApplianceInfoCls,@selector(key), (IMP)&XBMCApplianceInfo$key, nil);
+  // XBMCApplianceInfo::name
+  safeHook(XBMCApplianceInfoCls,@selector(name), (IMP)&XBMCApplianceInfo$name, nil);
+  // XBMCApplianceInfo::localizedStringsFileName
+  safeHook(XBMCApplianceInfoCls,@selector(localizedStringsFileName), (IMP)&XBMCApplianceInfo$localizedStringsFileName, nil);
+
+  // and register the class to the runtime
+  objc_registerClassPair(XBMCApplianceInfoCls);
+
+  // subclass BRBaseAppliance into XBMCAppliance
+  Class XBMCApplianceCls = objc_allocateClassPair(objc_getClass("BRBaseAppliance"), "XBMCAppliance", 0);
+  // add our custom methods which are not part of the baseclass
+  // XBMCAppliance::XBMCfixUIDevice
+  class_addMethod(XBMCApplianceCls,@selector(XBMCfixUIDevice), (IMP)XBMCAppliance$XBMCfixUIDevice, "v@:");
+  class_addMethod(XBMCApplianceCls,@selector(setTopShelfController:), (IMP)&XBMCAppliance$setTopShelfController, "v@:@");
+  class_addMethod(XBMCApplianceCls,@selector(setApplianceCategories:), (IMP)&XBMCAppliance$setApplianceCategories, "v@:@");
+
+  // and hook up our methods (implementation of the base class methods)
+  // XBMCAppliance::init
+  safeHook(XBMCApplianceCls,@selector(init), (IMP)&XBMCAppliance$init, (IMP*)&XBMCAppliance$init$Orig);
+  // XBMCAppliance::identifierForContentAlias
+  safeHook(XBMCApplianceCls,@selector(identifierForContentAlias:), (IMP)&XBMCAppliance$identifierForContentAlias, nil);
+  // XBMCAppliance::handleObjectSelection
+  safeHook(XBMCApplianceCls,@selector(handleObjectSelection:userInfo:), (IMP)&XBMCAppliance$handleObjectSelection, nil);
+  // XBMCAppliance::applianceInfo
+  safeHook(XBMCApplianceCls,@selector(applianceInfo), (IMP)&XBMCAppliance$applianceInfo, (IMP *)&XBMCAppliance$applianceInfo$Orig);
+  // XBMCAppliance::topShelfController
+  safeHook(XBMCApplianceCls,@selector(topShelfController), (IMP)&XBMCAppliance$topShelfController, nil);
+  // XBMCAppliance::applianceCategories
+  safeHook(XBMCApplianceCls,@selector(applianceCategories), (IMP)&XBMCAppliance$applianceCategories, nil);  
+  // XBMCAppliance::initWithApplianceInfo
+  safeHook(XBMCApplianceCls,@selector(initWithApplianceInfo:), (IMP)&XBMCAppliance$initWithApplianceInfo, (IMP*)&XBMCAppliance$initWithApplianceInfo$Orig);
+  // XBMCAppliance::controllerForIdentifier
+  safeHook(XBMCApplianceCls,@selector(controllerForIdentifier:args:), (IMP)&XBMCAppliance$controllerForIdentifier, nil);
+
+  // and register the class to the runtime
+  objc_registerClassPair(XBMCApplianceCls);
+  // save this as static for referencing it in the macro at the top of the file
+  BRApplianceCategoryCls = objc_getClass("BRApplianceCategory");
+}
\ No newline at end of file
index dc05ee7..67776e5 100644 (file)
 - (void) stopAnimation;
 - (bool) changeScreen: (unsigned int)screenIdx withMode:(UIScreenMode *)mode;
 - (void) activateScreen: (UIScreen *)screen;
-
+- (id) glView;
+- (void) setGlView:(id)view;
+- (BOOL) ATVClientEventFromBREvent:(id)event Repeatable:(bool *)isRepeatable ButtonState:(bool *)isPressed Result:(int *)xbmc_ir_key;
+- (void) setUserEvent:(int) eventId withHoldTime:(unsigned int) holdTime;
+- (void) startKeyPressTimer:(int) keyId;
+- (void) stopKeyPressTimer;
+- (void) setSystemSleepTimeout:(id) timeout;
+- (id) systemSleepTimeout;
+- (void) setKeyTimer:(id) timer;
+- (id) keyTimer;
+- (void) setSystemScreenSaverTimeout:(id) timeout;
+- (id) systemScreenSaverTimeout;
 
 @end
 
index 2d68817..bacd6b3 100644 (file)
  *
  */
 
+
+/* HowTo code in this file:
+ * Since AppleTV/iOS6.x (atv2 version 5.2) Apple removed the AppleTV.framework and put all those classes into the
+ * AppleTV.app. So we can't use standard obj-c coding here anymore. Instead we need to use the obj-c runtime
+ * functions for subclassing and adding methods to our instances during runtime (hooking).
+ * 
+ * 1. For implementing a method of a base class:
+ *  a) declare it in the form <XBMCController$nameOfMethod> like the others 
+ *  b) these methods need to be static and have XBMCController* self, SEL _cmd (replace XBMCAppliance with the class the method gets implemented for) as minimum params. 
+ *  c) add the method to the XBMCController.h for getting rid of the compiler warnings of unresponsive selectors (declare the method like done in the baseclass).
+ *  d) in initControllerRuntimeClasses exchange the base class implementation with ours by calling MSHookMessageEx
+ *  e) if we need to call the base class implementation as well we have to save the original implementation (see brEventAction$Orig for reference)
+ *
+ * 2. For implementing a new method which is not part of the base class:
+ *  a) same as 1.a
+ *  b) same as 1.b
+ *  c) same as 1.c
+ *  d) in initControllerRuntimeClasses add the method to our class via class_addMethod
+ *
+ * 3. Never access any BackRow classes directly - but always get the class via objc_getClass - if the class is used in multiple places 
+ *    save it as static (see BRWindowCls)
+ * 
+ * 4. Keep the structure of this file based on the section comments (marked with // SECTIONCOMMENT).
+ * 5. really - obey 4.!
+ *
+ * 6. for adding class members use associated objects - see timerKey
+ *
+ * For further reference see https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
+ */
+
 //hack around problem with xbmc's typedef int BOOL
 // and obj-c's typedef unsigned char BOOL
 #define BOOL XBMC_BOOL 
 
 #import <Foundation/Foundation.h>
 #import <UIKit/UIKit.h>
-#import <BackRow/BackRow.h>
 
 #import "XBMCController.h"
 #import "XBMCDebugHelpers.h"
 
+#import "IOSEAGLView.h"
+#import "IOSSCreenManager.h"
+#include "XBMC_keysym.h"
+#include "substrate.h"
+
 //start repeating after 0.5s
-#define REPEATED_KEYPRESS_DELAY_S     0.5
+#define REPEATED_KEYPRESS_DELAY_S 0.5
 //pause 0.01s (10ms) between keypresses
 #define REPEATED_KEYPRESS_PAUSE_S 0.01
 
@@ -58,7 +92,7 @@ typedef enum {
   ATV_ALUMINIUM_PLAY            = 12,
   ATV_ALUMINIUM_PLAY_H          = 11,
 
-  //newly added remote buttons  
+  //newly added remote buttons
   ATV_BUTTON_PAGEUP             = 13,
   ATV_BUTTON_PAGEDOWN           = 14,
   ATV_BUTTON_PAUSE              = 15,
@@ -102,6 +136,7 @@ typedef enum {
   ATV_INVALID_BUTTON
 } eATVClientEvent;
 
+
 typedef enum {
   // for originator kBREventOriginatorRemote
   kBREventRemoteActionMenu      = 1,
@@ -157,410 +192,504 @@ typedef enum {
   kBREventRemoteActionHoldDown,
 } BREventRemoteAction;
 
+
 XBMCController *g_xbmcController;
 
 //--------------------------------------------------------------
 // so we don't have to include AppleTV.frameworks/PrivateHeaders/ATVSettingsFacade.h
-@interface ATVSettingsFacade : BRSettingsFacade {}
+@interface XBMCSettingsFacade : NSObject
 -(int)screenSaverTimeout;
 -(void)setScreenSaverTimeout:(int) f_timeout;
 -(void)setSleepTimeout:(int)timeout;
 -(int)sleepTimeout;
+-(void)flushDiskChanges;
 @end
 
 // notification messages
 extern NSString* kBRScreenSaverActivated;
 extern NSString* kBRScreenSaverDismissed;
+
 //--------------------------------------------------------------
 //--------------------------------------------------------------
-@interface XBMCController (PrivateMethods)
-- (void) observeDefaultCenterStuff: (NSNotification *) notification;
-- (void) keyPressTimerCallback: (NSTimer*)theTimer;
-- (void) startKeyPressTimer: (int) keyId;
-- (void) stopKeyPressTimer;
-- (void) setUserEvent:(int) id withHoldTime:(unsigned int) holdTime;
-@end
+// SECTIONCOMMENT
+// orig method handlers we wanna call in hooked methods ([super method])
+static BOOL (*XBMCController$brEventAction$Orig)(XBMCController*, SEL, BREvent*);
+static id (*XBMCController$init$Orig)(XBMCController*, SEL);
+static void (*XBMCController$dealloc$Orig)(XBMCController*, SEL);
+static void (*XBMCController$controlWasActivated$Orig)(XBMCController*, SEL);
+static void (*XBMCController$controlWasDeactivated$Orig)(XBMCController*, SEL);
+
+// SECTIONCOMMENT
+// classes we need multiple times
+static Class BRWindowCls;
+
+int padding[16];//obsolete? - was commented with "credit is due here to SapphireCompatibilityClasses!!"
+  
+//--------------------------------------------------------------
+//--------------------------------------------------------------
+// SECTIONCOMMENT
+// since we can't inject ivars we need to use associated objects
+// these are the keys for XBMCController
+static char timerKey;
+static char glviewKey;
+static char screensaverKey;
+static char systemsleepKey;
+
 //
 //
-@implementation XBMCController
+// SECTIONCOMMENT
+//implementation XBMCController
+static id XBMCController$keyTimer(XBMCController* self, SEL _cmd) 
+{ 
+  return objc_getAssociatedObject(self, &timerKey);
+}
 
-/*
-+ (XBMCController*) sharedInstance
-{
-  // the instance of this class is stored here
-  static XBMCController *myInstance = nil;
+static void XBMCController$setKeyTimer(XBMCController* self, SEL _cmd, id timer) 
+{ 
+  objc_setAssociatedObject(self, &timerKey, timer, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
 
-  // check to see if an instance already exists
-  if (nil == myInstance)
-    myInstance  = [[[[self class] alloc] init] autorelease];
+static id XBMCController$glView(XBMCController* self, SEL _cmd) 
+{ 
+  return objc_getAssociatedObject(self, &glviewKey);
+}
+
+static void XBMCController$setGlView(XBMCController* self, SEL _cmd, id view) 
+{ 
+  objc_setAssociatedObject(self, &glviewKey, view, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
 
-  // return the instance of this class
-  return myInstance;
+static id XBMCController$systemScreenSaverTimeout(XBMCController* self, SEL _cmd) 
+{ 
+  return objc_getAssociatedObject(self, &screensaverKey);
 }
-*/
 
-- (void) applicationDidExit
+static void XBMCController$setSystemScreenSaverTimeout(XBMCController* self, SEL _cmd, id timeout) 
+{ 
+  objc_setAssociatedObject(self, &screensaverKey, timeout, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+static id XBMCController$systemSleepTimeout(XBMCController* self, SEL _cmd) 
+{ 
+  return objc_getAssociatedObject(self, &systemsleepKey);
+}
+
+static void XBMCController$setSystemSleepTimeout(XBMCController* self, SEL _cmd, id timeout) 
+{ 
+  objc_setAssociatedObject(self, &systemsleepKey, timeout, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+static void XBMCController$applicationDidExit(XBMCController* self, SEL _cmd) 
 {
-  [m_glView stopAnimation];
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
 
+  [[self glView] stopAnimation];
   [self enableScreenSaver];
   [self enableSystemSleep];
-
   [[self stack] popController];
 }
-- (void) initDisplayLink
+
+static void XBMCController$initDisplayLink(XBMCController* self, SEL _cmd) 
 {
-  [m_glView initDisplayLink];
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
+
+  [[self glView] initDisplayLink];
 }
-- (void) deinitDisplayLink
+
+static void XBMCController$deinitDisplayLink(XBMCController* self, SEL _cmd) 
 {
-  [m_glView deinitDisplayLink];
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
+
+  [[self glView] deinitDisplayLink];
 }
-- (double) getDisplayLinkFPS
+
+static double XBMCController$getDisplayLinkFPS(XBMCController* self, SEL _cmd) 
 {
-  return [m_glView getDisplayLinkFPS];
+  //NSLog(@"%s", __PRETTY_FUNCTION__);
+
+  return [[self glView] getDisplayLinkFPS];
 }
-- (void) setFramebuffer
-{
-  [m_glView setFramebuffer];
+
+static void XBMCController$setFramebuffer(XBMCController* self, SEL _cmd) 
+{   
+  [[self glView] setFramebuffer];
 }
-- (bool) presentFramebuffer
-{
-  return [m_glView presentFramebuffer];
+
+static bool XBMCController$presentFramebuffer(XBMCController* self, SEL _cmd) 
+{    
+  return [[self glView] presentFramebuffer];
 }
-- (CGSize) getScreenSize
+
+static CGSize XBMCController$getScreenSize(XBMCController* self, SEL _cmd) 
 {
   CGSize screensize;
-
-  screensize.width  = [BRWindow interfaceFrame].size.width;
-  screensize.height = [BRWindow interfaceFrame].size.height;
-
+  screensize.width  = [BRWindowCls interfaceFrame].size.width;
+  screensize.height = [BRWindowCls interfaceFrame].size.height;
   //NSLog(@"%s UpdateResolutions width=%f, height=%f", 
-       //      __PRETTY_FUNCTION__, screensize.width, screensize.height);
-
+  //__PRETTY_FUNCTION__, screensize.width, screensize.height);
   return screensize;
 }
-- (void) sendKey: (XBMCKey) key
+
+static void XBMCController$sendKey(XBMCController* self, SEL _cmd, XBMCKey key) 
 {
   //empty because its not used here. Only implemented for getting rid
   //of "may not respond to selector" compile warnings in IOSExternalTouchController
 }
 
-
-- (id) init
-{  
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-
-  self = [super init];
-  if ( !self )
-    return ( nil );
-
-  NSNotificationCenter *center;
-  // first the default notification center, which is all
-  // notifications that only happen inside of our program
-  center = [NSNotificationCenter defaultCenter];
-  [center addObserver: self
-    selector: @selector(observeDefaultCenterStuff:)
-    name: nil
-    object: nil];
-
-  m_glView = [[IOSEAGLView alloc] initWithFrame:[BRWindow interfaceFrame] withScreen:[UIScreen mainScreen]];
-  [[IOSScreenManager sharedInstance] setView:m_glView];
-
-  g_xbmcController = self;
-
+static id XBMCController$init(XBMCController* self, SEL _cmd) 
+{
+  if((self = XBMCController$init$Orig(self, _cmd)) != nil)  
+  {
+    //NSLog(@"%s", __PRETTY_FUNCTION__);
+
+    NSNotificationCenter *center;
+    // first the default notification center, which is all
+    // notifications that only happen inside of our program
+    center = [NSNotificationCenter defaultCenter];
+    [center addObserver: self
+      selector: @selector(observeDefaultCenterStuff:)
+      name: nil
+      object: nil];
+
+    IOSEAGLView *view = [[IOSEAGLView alloc] initWithFrame:[BRWindowCls interfaceFrame] withScreen:[UIScreen mainScreen]];
+    [self setGlView:view];
+    [[IOSScreenManager sharedInstance] setView:[self glView]];
+
+    g_xbmcController = self;
+  }
   return self;
 }
 
-- (void)dealloc
+static void XBMCController$dealloc(XBMCController* self, SEL _cmd) 
 {
   //NSLog(@"%s", __PRETTY_FUNCTION__);
-  [m_glView stopAnimation];
-  [m_glView release];
-
+  [[self glView] stopAnimation];
+  [[self glView] release];
 
   NSNotificationCenter *center;
   // take us off the default center for our app
   center = [NSNotificationCenter defaultCenter];
   [center removeObserver: self];
 
-  [super dealloc];
+  XBMCController$dealloc$Orig(self, _cmd);
 }
 
-- (void)controlWasActivated
+static void XBMCController$controlWasActivated(XBMCController* self, SEL _cmd) 
 {
   //NSLog(@"%s", __PRETTY_FUNCTION__);
-  
-  [super controlWasActivated];
+
+  XBMCController$controlWasActivated$Orig(self, _cmd);
 
   [self disableSystemSleep];
   [self disableScreenSaver];
-
+  
+  IOSEAGLView *view = [self glView];
   //inject our gles layer into the backrow root layer
-  [[BRWindow rootLayer] addSublayer:m_glView.layer];
+  [[BRWindowCls rootLayer] addSublayer:view.layer];
 
-  [m_glView startAnimation];
+  [[self glView] startAnimation];
 }
 
-- (void)controlWasDeactivated
+static void XBMCController$controlWasDeactivated(XBMCController* self, SEL _cmd) 
 {
   NSLog(@"XBMC was forced by FrontRow to exit via controlWasDeactivated");
 
-  [m_glView stopAnimation];
-  [m_glView.layer removeFromSuperlayer];
+  [[self glView] stopAnimation];
+  [[[self glView] layer] removeFromSuperlayer];
 
   [self enableScreenSaver];
   [self enableSystemSleep];
 
-  [super controlWasDeactivated];
+  XBMCController$controlWasDeactivated$Orig(self, _cmd);
 }
 
-- (BOOL) recreateOnReselect
-{ 
+static BOOL XBMCController$recreateOnReselect(XBMCController* self, SEL _cmd) 
+{
   //NSLog(@"%s", __PRETTY_FUNCTION__);
   return YES;
 }
 
-- (eATVClientEvent) ATVClientEventFromBREvent:(BREvent*) f_event 
-                    Repeatable:(bool &) isRepeatable
-                    ButtonState:(bool &) isPressed
+static void XBMCController$ATVClientEventFromBREvent(XBMCController* self, SEL _cmd, BREvent* f_event, bool * isRepeatable, bool * isPressed, int * result) 
 {
+  if(f_event == nil)// paranoia
+    return;
+
   int remoteAction = [f_event remoteAction];
   CLog::Log(LOGDEBUG,"XBMCPureController: Button press remoteAction = %i", remoteAction);
-  isRepeatable = false;
-  isPressed = false;
+  *isRepeatable = false;
+  *isPressed = false;
 
   switch (remoteAction)
   {
     // tap up
     case kBREventRemoteActionUp:
     case 65676:
-      isRepeatable = true;
+      *isRepeatable = true;
       if([f_event value] == 1)
-        isPressed = true;
-      return ATV_BUTTON_UP;
+        *isPressed = true;
+      *result = ATV_BUTTON_UP;
+      return;
 
     // tap down
     case kBREventRemoteActionDown:
     case 65677:
-      isRepeatable = true;
+      *isRepeatable = true;
       if([f_event value] == 1)
-        isPressed = true;
-      return ATV_BUTTON_DOWN;
-
+        *isPressed = true;
+      *result = ATV_BUTTON_DOWN;
+      return;
+    
     // tap left
     case kBREventRemoteActionLeft:
     case 65675:
-      isRepeatable = true;
+      *isRepeatable = true;
       if([f_event value] == 1)
-        isPressed = true;
-      return ATV_BUTTON_LEFT;
-
+        *isPressed = true;
+      *result = ATV_BUTTON_LEFT;
+      return;
+    
     // hold left
     case 786612:
       if([f_event value] == 1)
-        return ATV_LEARNED_REWIND;
+        *result = ATV_LEARNED_REWIND;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return;
+    
     // tap right
     case kBREventRemoteActionRight:
     case 65674:
-      isRepeatable = true;
+      *isRepeatable = true;
       if ([f_event value] == 1)
-        isPressed = true;
-      return ATV_BUTTON_RIGHT;
-
+        *isPressed = true;
+      *result = ATV_BUTTON_RIGHT;
+      return ;
+    
     // hold right
     case 786611:
       if ([f_event value] == 1)
-        return ATV_LEARNED_FORWARD;
+        *result = ATV_LEARNED_FORWARD;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return ;
+   
     // tap play
     case kBREventRemoteActionPlay:
     case 65673:
-      return ATV_BUTTON_PLAY;
-
+      *result = ATV_BUTTON_PLAY;
+      return ;
+    
     // hold play
     case kBREventRemoteActionPlayHold:
     case kBREventRemoteActionCenterHold:
     case kBREventRemoteActionCenterHold42:
     case 65668:
-      return ATV_BUTTON_PLAY_H;
-
+      *result = ATV_BUTTON_PLAY_H;
+      return ;
+    
     // menu
     case kBREventRemoteActionMenu:
     case 65670:
-      return ATV_BUTTON_MENU;
-
+      *result = ATV_BUTTON_MENU;
+      return ;
+    
     // hold menu
     case kBREventRemoteActionMenuHold:
     case 786496:
-      return ATV_BUTTON_MENU_H;
-
+      *result = ATV_BUTTON_MENU_H;
+      return ;
+    
     // learned play
     case 786608:
-      return ATV_LEARNED_PLAY;
-
+      *result = ATV_LEARNED_PLAY;
+      return ;
+    
     // learned pause
     case 786609:
-      return ATV_LEARNED_PAUSE;
-
+      *result = ATV_LEARNED_PAUSE;
+      return ;
+    
     // learned stop
     case 786615:
-      return ATV_LEARNED_STOP;
-
+      *result = ATV_LEARNED_STOP;
+      return ;
+    
     // learned next
     case 786613:
-      return ATV_LEARNED_NEXT;
-
+      *result = ATV_LEARNED_NEXT;
+      return ;
+    
     // learned previous
     case 786614:
-      return ATV_LEARNED_PREVIOUS;
-
+      *result = ATV_LEARNED_PREVIOUS;
+      return ;
+    
     // learned enter, like go into something
     case 786630:
-      return ATV_LEARNED_ENTER;
-
+      *result = ATV_LEARNED_ENTER;
+      return ;
+    
     // learned return, like go back
     case 786631:
-      return ATV_LEARNED_RETURN;
-
+      *result = ATV_LEARNED_RETURN;
+      return ;
+    
     // tap play on new Al IR remote
     case kBREventRemoteActionALPlay:
     case 786637:
-      return ATV_ALUMINIUM_PLAY;
+      *result = ATV_ALUMINIUM_PLAY;
+      return ;
 
     case kBREventRemoteActionKeyPress:
     case kBREventRemoteActionKeyPress42:
-      return ATV_BTKEYPRESS;
-
+      *result = ATV_BTKEYPRESS;
+      return ;
+    
     // PageUp
     case kBREventRemoteActionPageUp:
-      return ATV_BUTTON_PAGEUP;
-
+      *result = ATV_BUTTON_PAGEUP;
+      return ;
+    
     // PageDown
     case kBREventRemoteActionPageDown:
-      return ATV_BUTTON_PAGEDOWN;
-
+      *result = ATV_BUTTON_PAGEDOWN;
+      return ;
+    
     // Pause
     case kBREventRemoteActionPause:
-      return ATV_BUTTON_PAUSE;
-
+      *result = ATV_BUTTON_PAUSE;
+      return ;
+    
     // Play2
     case kBREventRemoteActionPlay2:
-      return ATV_BUTTON_PLAY2;
-
+      *result = ATV_BUTTON_PLAY2;
+      return ;
+    
     // Stop
     case kBREventRemoteActionStop:
-      return ATV_BUTTON_STOP;
-
+      *result = ATV_BUTTON_STOP;
+      return ;
+    
     // Fast Forward
     case kBREventRemoteActionFastFwd:
-      return ATV_BUTTON_FASTFWD;
-
+      *result = ATV_BUTTON_FASTFWD;
+      return ;
+    
     // Rewind
     case kBREventRemoteActionRewind:
-      return ATV_BUTTON_REWIND;
+      *result = ATV_BUTTON_REWIND;
+      return ;
 
     // Skip Forward
     case kBREventRemoteActionSkipFwd:
-      return ATV_BUTTON_SKIPFWD;
+      *result = ATV_BUTTON_SKIPFWD;
+      return ;
 
-    // Skip Back
+    // Skip Back      
     case kBREventRemoteActionSkipBack:
-      return ATV_BUTTON_SKIPBACK;
-
+      *result = ATV_BUTTON_SKIPBACK;
+      return ;
+    
     // Gesture Swipe Left
     case kBREventRemoteActionSwipeLeft:
       if ([f_event value] == 1)
-        return ATV_GESTURE_SWIPE_LEFT;
+        *result = ATV_GESTURE_SWIPE_LEFT;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return ;
+    
     // Gesture Swipe Right
     case kBREventRemoteActionSwipeRight:
       if ([f_event value] == 1)
-        return ATV_GESTURE_SWIPE_RIGHT;
+        *result = ATV_GESTURE_SWIPE_RIGHT;
       else
-        return ATV_INVALID_BUTTON;
+        *result = ATV_INVALID_BUTTON;
+      return ;
 
     // Gesture Swipe Up
     case kBREventRemoteActionSwipeUp:
       if ([f_event value] == 1)
-        return ATV_GESTURE_SWIPE_UP;
+        *result = ATV_GESTURE_SWIPE_UP;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return ;
+    
     // Gesture Swipe Down
     case kBREventRemoteActionSwipeDown:
       if ([f_event value] == 1)
-        return ATV_GESTURE_SWIPE_DOWN;
+        *result = ATV_GESTURE_SWIPE_DOWN;
       else
-        return ATV_INVALID_BUTTON;
+        *result = ATV_INVALID_BUTTON;
+      return;
 
     // Gesture Flick Left
     case kBREventRemoteActionFlickLeft:
       if ([f_event value] == 1)
-        return ATV_GESTURE_FLICK_LEFT;
+        *result = ATV_GESTURE_FLICK_LEFT;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return;
+    
     // Gesture Flick Right
     case kBREventRemoteActionFlickRight:
       if ([f_event value] == 1)
-        return ATV_GESTURE_FLICK_RIGHT;
+        *result = ATV_GESTURE_FLICK_RIGHT;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return;
+    
     // Gesture Flick Up
     case kBREventRemoteActionFlickUp:
       if ([f_event value] == 1)
-        return ATV_GESTURE_FLICK_UP;
+        *result = ATV_GESTURE_FLICK_UP;
       else
-        return ATV_INVALID_BUTTON;
-
+        *result = ATV_INVALID_BUTTON;
+      return;
+    
     // Gesture Flick Down
     case kBREventRemoteActionFlickDown:
       if ([f_event value] == 1)
-        return ATV_GESTURE_FLICK_DOWN;
+        *result = ATV_GESTURE_FLICK_DOWN;
       else
-        return ATV_INVALID_BUTTON;
-
-
+        *result = ATV_INVALID_BUTTON;
+      return;
 
     default:
       ELOG(@"XBMCPureController: Unknown button press remoteAction = %i", remoteAction);
-      return ATV_INVALID_BUTTON;
+      *result = ATV_INVALID_BUTTON;
   }
 }
 
-- (void)setUserEvent:(int) id withHoldTime:(unsigned int) holdTime
+static void XBMCController$setUserEvent(XBMCController* self, SEL _cmd, int eventId, unsigned int holdTime) 
 {
+  
   XBMC_Event newEvent;
   memset(&newEvent, 0, sizeof(newEvent));
 
   newEvent.type = XBMC_USEREVENT;
-  newEvent.jbutton.which = id;
+  newEvent.jbutton.which = eventId;
   newEvent.jbutton.holdTime = holdTime;
   CWinEventsIOS::MessagePush(&newEvent);
 }
 
-- (BOOL)brEventAction:(BREvent*)event
+
+static BOOL XBMCController$brEventAction(XBMCController* self, SEL _cmd, BREvent* event) 
 {
   //NSLog(@"%s", __PRETTY_FUNCTION__);
 
-       if ([m_glView isAnimating])
+  if ([[self glView] isAnimating])
   {
     BOOL is_handled = NO;
     bool isRepeatable = false;
     bool isPressed = false;
-    eATVClientEvent xbmc_ir_key = [self ATVClientEventFromBREvent:event 
-                                        Repeatable:isRepeatable
-                                        ButtonState:isPressed];
-    
+    int xbmc_ir_key = ATV_INVALID_BUTTON;
+    [self ATVClientEventFromBREvent:event 
+                                        Repeatable:&isRepeatable
+                                        ButtonState:&isPressed
+                                        Result:&xbmc_ir_key];
+
     if ( xbmc_ir_key != ATV_INVALID_BUTTON )
     {
       if (xbmc_ir_key == ATV_BTKEYPRESS && [event value] == 1)
@@ -579,7 +708,7 @@ extern NSString* kBRScreenSaverDismissed;
           const char* wstr = [key_nsstring cStringUsingEncoding:NSUTF16StringEncoding];
           //NSLog(@"%s, key: wstr[0] = %d, wstr[1] = %d", __PRETTY_FUNCTION__, wstr[0], wstr[1]);
 
-          if (wstr[0] != 92) // trap out "\" which toggle fullscreen/windowed
+          if (wstr[0] != 92) 
           {
             if (wstr[0] == 62 && wstr[1] == -9)
             {
@@ -607,8 +736,8 @@ extern NSString* kBRScreenSaverDismissed;
         {
           if(isPressed)
           {
-            [self setUserEvent:xbmc_ir_key withHoldTime:0]; //fire event
-            [self startKeyPressTimer:xbmc_ir_key];//start repeat timer
+            [self setUserEvent:xbmc_ir_key withHoldTime:0];
+            [self startKeyPressTimer:xbmc_ir_key];
           }
           else
           {
@@ -618,60 +747,62 @@ extern NSString* kBRScreenSaverDismissed;
         }
         else
         {
-          [self setUserEvent:xbmc_ir_key  withHoldTime:0];
+          [self setUserEvent:xbmc_ir_key withHoldTime:0];
         }
         is_handled = TRUE;
       }
     }
     return is_handled;
-       }
+  }
   else
   {
-               return [super brEventAction:event];
-       }
+    return XBMCController$brEventAction$Orig(self, _cmd, event);
+  }
 }
 
 #pragma mark -
 #pragma mark private helper methods
-- (void)startKeyPressTimer: (int) keyId
+static void XBMCController$startKeyPressTimer(XBMCController* self, SEL _cmd, int keyId) 
 { 
-  NSNumber *number = [NSNumber numberWithInt:keyId]; 
+  NSNumber *number = [NSNumber numberWithInt:keyId];
   NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSDate date], @"StartDate", 
                                                                   number, @"keyId", nil];
   
-  NSDate *fireDate = [NSDate dateWithTimeIntervalSinceNow:REPEATED_KEYPRESS_DELAY_S]; 
-
+  NSDate *fireDate = [NSDate dateWithTimeIntervalSinceNow:REPEATED_KEYPRESS_DELAY_S];
   [self stopKeyPressTimer];
-
+  
   //schedule repeated timer which starts after REPEATED_KEYPRESS_DELAY_S and fires
   //every REPEATED_KEYPRESS_PAUSE_S
-  m_keyTimer       = [[NSTimer alloc] initWithFireDate:fireDate 
+  NSTimer *timer       = [[NSTimer alloc] initWithFireDate:fireDate 
                                       interval:REPEATED_KEYPRESS_PAUSE_S 
                                       target:self 
                                       selector:@selector(keyPressTimerCallback:) 
                                       userInfo:dict 
-                                      repeats:YES]; 
+                                      repeats:YES];
   //schedule the timer to the runloop
-  NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; 
-  [runLoop addTimer:m_keyTimer forMode:NSDefaultRunLoopMode]; 
+  NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
+  [runLoop addTimer:timer forMode:NSDefaultRunLoopMode];
+  [self setKeyTimer:timer];
 } 
 
-- (void)stopKeyPressTimer
+static void XBMCController$stopKeyPressTimer(XBMCController* self, SEL _cmd) 
 {
-  if(m_keyTimer != nil)
+  if([self keyTimer] != nil)
   {
-    [m_keyTimer invalidate];
-    [m_keyTimer release];
-    m_keyTimer = nil;
+    [[self keyTimer] invalidate];
+    [[self keyTimer] release];
+    [self setKeyTimer:nil];
   }
 }
 
-- (void)keyPressTimerCallback:(NSTimer*)theTimer 
+static void XBMCController$keyPressTimerCallback(XBMCController* self, SEL _cmd, NSTimer* theTimer)  
 { 
   //if queue is empty - skip this timer event
   //for letting it process
   if(CWinEventsIOS::GetQueueSize())
     return;
+
   NSDate *startDate = [[theTimer userInfo] objectForKey:@"StartDate"];
   int keyId = [[[theTimer userInfo] objectForKey:@"keyId"] intValue];
   //calc the holdTime - timeIntervalSinceNow gives the
@@ -681,14 +812,13 @@ extern NSString* kBRScreenSaverDismissed;
   [self setUserEvent:keyId withHoldTime:(unsigned int)holdTime];
 } 
 
-//
-- (void)observeDefaultCenterStuff: (NSNotification *) notification
+static void XBMCController$observeDefaultCenterStuff(XBMCController* self, SEL _cmd, NSNotification * notification) 
 {
   //NSLog(@"default: %@", [notification name]);
 
   if ([notification name] == UIApplicationDidReceiveMemoryWarningNotification)
     NSLog(@"XBMC: %@", [notification name]);
-
+  
   //if ([notification name] == kBRScreenSaverActivated)
   //  [m_glView stopAnimation];
   
@@ -696,378 +826,578 @@ extern NSString* kBRScreenSaverDismissed;
   //  [m_glView startAnimation];
 }
 
-- (void) disableSystemSleep
+static void XBMCController$disableSystemSleep(XBMCController* self, SEL _cmd) 
 {
-  m_systemsleepTimeout = [[ATVSettingsFacade singleton] sleepTimeout];
-  [[ATVSettingsFacade singleton] setSleepTimeout: -1];
-  [[ATVSettingsFacade singleton] flushDiskChanges];
+  Class ATVSettingsFacadeCls = objc_getClass("ATVSettingsFacade");
+  XBMCSettingsFacade *single = (XBMCSettingsFacade *)[ATVSettingsFacadeCls singleton];
+
+  int tmpTimeout = [single sleepTimeout];
+  NSNumber *timeout = [NSNumber numberWithInt:tmpTimeout];
+  [self setSystemSleepTimeout:timeout];
+  [single setSleepTimeout: -1];
+  [single flushDiskChanges];
 }
 
-- (void) enableSystemSleep
+static void XBMCController$enableSystemSleep(XBMCController* self, SEL _cmd) 
 {
-  [[ATVSettingsFacade singleton] setSleepTimeout: m_systemsleepTimeout];
-  [[ATVSettingsFacade singleton] flushDiskChanges];
+  Class ATVSettingsFacadeCls = objc_getClass("ATVSettingsFacade");
+  int timeoutInt = [[self systemSleepTimeout] intValue];
+  [[ATVSettingsFacadeCls singleton] setSleepTimeout:timeoutInt];
+  [[ATVSettingsFacadeCls singleton] flushDiskChanges];
 }
 
-- (void) disableScreenSaver
+static void XBMCController$disableScreenSaver(XBMCController* self, SEL _cmd) 
 {
   //NSLog(@"%s", __PRETTY_FUNCTION__);
   //store screen saver state and disable it
 
-  m_screensaverTimeout = [[ATVSettingsFacade singleton] screenSaverTimeout];
-  [[ATVSettingsFacade singleton] setScreenSaverTimeout: -1];
-  [[ATVSettingsFacade singleton] flushDiskChanges];
+  Class ATVSettingsFacadeCls = objc_getClass("ATVSettingsFacade");
+  XBMCSettingsFacade *single = (XBMCSettingsFacade *)[ATVSettingsFacadeCls singleton];
+
+  int tmpTimeout = [single screenSaverTimeout];
+  NSNumber *timeout = [NSNumber numberWithInt:tmpTimeout];
+  [self setSystemScreenSaverTimeout:timeout];
+  [single setScreenSaverTimeout: -1];
+  [single flushDiskChanges];
 
   // breaks in 4.2.1 [[BRBackgroundTaskManager singleton] holdOffBackgroundTasks];
 }
 
-- (void) enableScreenSaver
+static void XBMCController$enableScreenSaver(XBMCController* self, SEL _cmd) 
 {
   //NSLog(@"%s", __PRETTY_FUNCTION__);
   //reset screen saver to user settings
+  Class ATVSettingsFacadeCls = objc_getClass("ATVSettingsFacade");
 
-  [[ATVSettingsFacade singleton] setScreenSaverTimeout: m_screensaverTimeout];
-  [[ATVSettingsFacade singleton] flushDiskChanges];
+  int timeoutInt = [[self systemScreenSaverTimeout] intValue];
+  [[ATVSettingsFacadeCls singleton] setScreenSaverTimeout:timeoutInt];
+  [[ATVSettingsFacadeCls singleton] flushDiskChanges];
 
   // breaks in 4.2.1 [[BRBackgroundTaskManager singleton] okToDoBackgroundProcessing];
 }
 
+/*
 - (XBMC_Event) translateCocoaToXBMCEvent: (unichar) c
 {
   XBMC_Event newEvent;
   memset(&newEvent, 0, sizeof(newEvent));
-/*
-  switch (c)
-  {
-    // Alt
-    case NSMenuFunctionKey: 
-          return "Alt";
-
-      // "Apps"
-      // "BrowserBack"
-      // "BrowserForward"
-      // "BrowserHome"
-      // "BrowserRefresh"
-      // "BrowserSearch"
-      // "BrowserStop"
-      // "CapsLock"
-
-      // "Clear"
-      case NSClearLineFunctionKey:
-          return "Clear";
-
-      // "CodeInput"
-      // "Compose"
-      // "Control"
-      // "Crsel"
-      // "Convert"
-      // "Copy"
-      // "Cut"
-
-      // "Down"
-      case NSDownArrowFunctionKey:
-          return "Down";
-      // "End"
-      case NSEndFunctionKey:
-          return "End";
-      // "Enter"
-      case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM
-          return "Enter";
-
-      // "EraseEof"
-
-      // "Execute"
-      case NSExecuteFunctionKey:
-          return "Execute";
-
-      // "Exsel"
-
-      // "F1"
-      case NSF1FunctionKey:
-          return "F1";
-      // "F2"
-      case NSF2FunctionKey:
-          return "F2";
-      // "F3"
-      case NSF3FunctionKey:
-          return "F3";
-      // "F4"
-      case NSF4FunctionKey:
-          return "F4";
-      // "F5"
-      case NSF5FunctionKey:
-          return "F5";
-      // "F6"
-      case NSF6FunctionKey:
-          return "F6";
-      // "F7"
-      case NSF7FunctionKey:
-          return "F7";
-      // "F8"
-      case NSF8FunctionKey:
-          return "F8";
-      // "F9"
-      case NSF9FunctionKey:
-          return "F9";
-      // "F10"
-      case NSF10FunctionKey:
-          return "F10";
-      // "F11"
-      case NSF11FunctionKey:
-          return "F11";
-      // "F12"
-      case NSF12FunctionKey:
-          return "F12";
-      // "F13"
-      case NSF13FunctionKey:
-          return "F13";
-      // "F14"
-      case NSF14FunctionKey:
-          return "F14";
-      // "F15"
-      case NSF15FunctionKey:
-          return "F15";
-      // "F16"
-      case NSF16FunctionKey:
-          return "F16";
-      // "F17"
-      case NSF17FunctionKey:
-          return "F17";
-      // "F18"
-      case NSF18FunctionKey:
-          return "F18";
-      // "F19"
-      case NSF19FunctionKey:
-          return "F19";
-      // "F20"
-      case NSF20FunctionKey:
-          return "F20";
-      // "F21"
-      case NSF21FunctionKey:
-          return "F21";
-      // "F22"
-      case NSF22FunctionKey:
-          return "F22";
-      // "F23"
-      case NSF23FunctionKey:
-          return "F23";
-      // "F24"
-      case NSF24FunctionKey:
-          return "F24";
-
-      // "FinalMode"
-
-      // "Find"
-      case NSFindFunctionKey:
-          return "Find";
-
-      // "FullWidth"
-      // "HalfWidth"
-      // "HangulMode"
-      // "HanjaMode"
-
-      // "Help"
-      case NSHelpFunctionKey:
-          return "Help";
-
-      // "Hiragana"
-
-      // "Home"
-      case NSHomeFunctionKey:
-          return "Home";
-      // "Insert"
-      case NSInsertFunctionKey:
-          return "Insert";
-
-      // "JapaneseHiragana"
-      // "JapaneseKatakana"
-      // "JapaneseRomaji"
-      // "JunjaMode"
-      // "KanaMode"
-      // "KanjiMode"
-      // "Katakana"
-      // "LaunchApplication1"
-      // "LaunchApplication2"
-      // "LaunchMail"
-
-      // "Left"
-      case NSLeftArrowFunctionKey:
-          return "Left";
-
-      // "Meta"
-      // "MediaNextTrack"
-      // "MediaPlayPause"
-      // "MediaPreviousTrack"
-      // "MediaStop"
-
-      // "ModeChange"
-      case NSModeSwitchFunctionKey:
-          return "ModeChange";
-
-      // "Nonconvert"
-      // "NumLock"
-
-      // "PageDown"
-      case NSPageDownFunctionKey:
-          return "PageDown";
-      // "PageUp"
-      case NSPageUpFunctionKey:
-          return "PageUp";
-
-      // "Paste"
-
-      // "Pause"
-      case NSPauseFunctionKey:
-          return "Pause";
-
-      // "Play"
-      // "PreviousCandidate"
-
-      // "PrintScreen"
-      case NSPrintScreenFunctionKey:
-          return "PrintScreen";
-
-      // "Process"
-      // "Props"
-
-      // "Right"
-      case NSRightArrowFunctionKey:
-          return "Right";
-
-      // "RomanCharacters"
-
-      // "Scroll"
-      case NSScrollLockFunctionKey:
-          return "Scroll";
-      // "Select"
-      case NSSelectFunctionKey:
-          return "Select";
-
-      // "SelectMedia"
-      // "Shift"
-
-      // "Stop"
-      case NSStopFunctionKey:
-          return "Stop";
-      // "Up"
-      case NSUpArrowFunctionKey:
-          return "Up";
-      // "Undo"
-      case NSUndoFunctionKey:
-          return "Undo";
-
-      // "VolumeDown"
-      // "VolumeMute"
-      // "VolumeUp"
-      // "Win"
-      // "Zoom"
-
-      // More function keys, not in the key identifier specification.
-      case NSF25FunctionKey:
-          return "F25";
-      case NSF26FunctionKey:
-          return "F26";
-      case NSF27FunctionKey:
-          return "F27";
-      case NSF28FunctionKey:
-          return "F28";
-      case NSF29FunctionKey:
-          return "F29";
-      case NSF30FunctionKey:
-          return "F30";
-      case NSF31FunctionKey:
-          return "F31";
-      case NSF32FunctionKey:
-          return "F32";
-      case NSF33FunctionKey:
-          return "F33";
-      case NSF34FunctionKey:
-          return "F34";
-      case NSF35FunctionKey:
-          return "F35";
-
-      // Turn 0x7F into 0x08, because backspace needs to always be 0x08.
-      case 0x7F:
-          XBMCK_BACKSPACE
-      // Standard says that DEL becomes U+007F.
-      case NSDeleteFunctionKey:
-          XBMCK_DELETE;
-          
-      // Always use 0x09 for tab instead of AppKit's backtab character.
-      case NSBackTabCharacter:
-          return "U+0009";
-
-      case NSBeginFunctionKey:
-      case NSBreakFunctionKey:
-      case NSClearDisplayFunctionKey:
-      case NSDeleteCharFunctionKey:
-      case NSDeleteLineFunctionKey:
-      case NSInsertCharFunctionKey:
-      case NSInsertLineFunctionKey:
-      case NSNextFunctionKey:
-      case NSPrevFunctionKey:
-      case NSPrintFunctionKey:
-      case NSRedoFunctionKey:
-      case NSResetFunctionKey:
-      case NSSysReqFunctionKey:
-      case NSSystemFunctionKey:
-      case NSUserFunctionKey:
+  
+   switch (c)
+   {
+   // Alt
+   case NSMenuFunctionKey: 
+   return "Alt";
+   
+   // "Apps"
+   // "BrowserBack"
+   // "BrowserForward"
+   // "BrowserHome"
+   // "BrowserRefresh"
+   // "BrowserSearch"
+   // "BrowserStop"
+   // "CapsLock"
+   
+   // "Clear"
+   case NSClearLineFunctionKey:
+   return "Clear";
+   
+   // "CodeInput"
+   // "Compose"
+   // "Control"
+   // "Crsel"
+   // "Convert"
+   // "Copy"
+   // "Cut"
+   
+   // "Down"
+   case NSDownArrowFunctionKey:
+   return "Down";
+   // "End"
+   case NSEndFunctionKey:
+   return "End";
+   // "Enter"
+   case 0x3: case 0xA: case 0xD: // Macintosh calls the one on the main keyboard Return, but Windows calls it Enter, so we'll do the same for the DOM
+   return "Enter";
+   
+   // "EraseEof"
+   
+   // "Execute"
+   case NSExecuteFunctionKey:
+   return "Execute";
+   
+   // "Exsel"
+   
+   // "F1"
+   case NSF1FunctionKey:
+   return "F1";
+   // "F2"
+   case NSF2FunctionKey:
+   return "F2";
+   // "F3"
+   case NSF3FunctionKey:
+   return "F3";
+   // "F4"
+   case NSF4FunctionKey:
+   return "F4";
+   // "F5"
+   case NSF5FunctionKey:
+   return "F5";
+   // "F6"
+   case NSF6FunctionKey:
+   return "F6";
+   // "F7"
+   case NSF7FunctionKey:
+   return "F7";
+   // "F8"
+   case NSF8FunctionKey:
+   return "F8";
+   // "F9"
+   case NSF9FunctionKey:
+   return "F9";
+   // "F10"
+   case NSF10FunctionKey:
+   return "F10";
+   // "F11"
+   case NSF11FunctionKey:
+   return "F11";
+   // "F12"
+   case NSF12FunctionKey:
+   return "F12";
+   // "F13"
+   case NSF13FunctionKey:
+   return "F13";
+   // "F14"
+   case NSF14FunctionKey:
+   return "F14";
+   // "F15"
+   case NSF15FunctionKey:
+   return "F15";
+   // "F16"
+   case NSF16FunctionKey:
+   return "F16";
+   // "F17"
+   case NSF17FunctionKey:
+   return "F17";
+   // "F18"
+   case NSF18FunctionKey:
+   return "F18";
+   // "F19"
+   case NSF19FunctionKey:
+   return "F19";
+   // "F20"
+   case NSF20FunctionKey:
+   return "F20";
+   // "F21"
+   case NSF21FunctionKey:
+   return "F21";
+   // "F22"
+   case NSF22FunctionKey:
+   return "F22";
+   // "F23"
+   case NSF23FunctionKey:
+   return "F23";
+   // "F24"
+   case NSF24FunctionKey:
+   return "F24";
+   
+   // "FinalMode"
+   
+   // "Find"
+   case NSFindFunctionKey:
+   return "Find";
+   
+   // "FullWidth"
+   // "HalfWidth"
+   // "HangulMode"
+   // "HanjaMode"
+   
+   // "Help"
+   case NSHelpFunctionKey:
+   return "Help";
+   
+   // "Hiragana"
+   
+   // "Home"
+   case NSHomeFunctionKey:
+   return "Home";
+   // "Insert"
+   case NSInsertFunctionKey:
+   return "Insert";
+   
+   // "JapaneseHiragana"
+   // "JapaneseKatakana"
+   // "JapaneseRomaji"
+   // "JunjaMode"
+   // "KanaMode"
+   // "KanjiMode"
+   // "Katakana"
+   // "LaunchApplication1"
+   // "LaunchApplication2"
+   // "LaunchMail"
+   
+   // "Left"
+   case NSLeftArrowFunctionKey:
+   return "Left";
+   
+   // "Meta"
+   // "MediaNextTrack"
+   // "MediaPlayPause"
+   // "MediaPreviousTrack"
+   // "MediaStop"
+   
+   // "ModeChange"
+   case NSModeSwitchFunctionKey:
+   return "ModeChange";
+   
+   // "Nonconvert"
+   // "NumLock"
+   
+   // "PageDown"
+   case NSPageDownFunctionKey:
+   return "PageDown";
+   // "PageUp"
+   case NSPageUpFunctionKey:
+   return "PageUp";
+   
+   // "Paste"
+   
+   // "Pause"
+   case NSPauseFunctionKey:
+   return "Pause";
+   
+   // "Play"
+   // "PreviousCandidate"
+   
+   // "PrintScreen"
+   case NSPrintScreenFunctionKey:
+   return "PrintScreen";
+   
+   // "Process"
+   // "Props"
+   
+   // "Right"
+   case NSRightArrowFunctionKey:
+   return "Right";
+   
+   // "RomanCharacters"
+   
+   // "Scroll"
+   case NSScrollLockFunctionKey:
+   return "Scroll";
+   // "Select"
+   case NSSelectFunctionKey:
+   return "Select";
+   
+   // "SelectMedia"
+   // "Shift"
+   
+   // "Stop"
+   case NSStopFunctionKey:
+   return "Stop";
+   // "Up"
+   case NSUpArrowFunctionKey:
+   return "Up";
+   // "Undo"
+   case NSUndoFunctionKey:
+   return "Undo";
+   
+   // "VolumeDown"
+   // "VolumeMute"
+   // "VolumeUp"
+   // "Win"
+   // "Zoom"
+   
+   // More function keys, not in the key identifier specification.
+   case NSF25FunctionKey:
+   return "F25";
+   case NSF26FunctionKey:
+   return "F26";
+   case NSF27FunctionKey:
+   return "F27";
+   case NSF28FunctionKey:
+   return "F28";
+   case NSF29FunctionKey:
+   return "F29";
+   case NSF30FunctionKey:
+   return "F30";
+   case NSF31FunctionKey:
+   return "F31";
+   case NSF32FunctionKey:
+   return "F32";
+   case NSF33FunctionKey:
+   return "F33";
+   case NSF34FunctionKey:
+   return "F34";
+   case NSF35FunctionKey:
+   return "F35";
+   
+   // Turn 0x7F into 0x08, because backspace needs to always be 0x08.
+   case 0x7F:
+   XBMCK_BACKSPACE
+   // Standard says that DEL becomes U+007F.
+   case NSDeleteFunctionKey:
+   XBMCK_DELETE;
+   
+   // Always use 0x09 for tab instead of AppKit's backtab character.
+   case NSBackTabCharacter:
+   return "U+0009";
+   
+   case NSBeginFunctionKey:
+   case NSBreakFunctionKey:
+   case NSClearDisplayFunctionKey:
+   case NSDeleteCharFunctionKey:
+   case NSDeleteLineFunctionKey:
+   case NSInsertCharFunctionKey:
+   case NSInsertLineFunctionKey:
+   case NSNextFunctionKey:
+   case NSPrevFunctionKey:
+   case NSPrintFunctionKey:
+   case NSRedoFunctionKey:
+   case NSResetFunctionKey:
+   case NSSysReqFunctionKey:
+   case NSSystemFunctionKey:
+   case NSUserFunctionKey:
           // FIXME: We should use something other than the vendor-area Unicode values for the above keys.
           // For now, just fall through to the default.
       default:
           return String::format("U+%04X", toASCIIUpper(c));
   }
-*/
   return newEvent;
-}
+}*/
 
 //--------------------------------------------------------------
-- (void)pauseAnimation
+static void XBMCController$pauseAnimation(XBMCController* self, SEL _cmd) 
 {
   XBMC_Event newEvent;
   memset(&newEvent, 0, sizeof(XBMC_Event));
-  
   newEvent.appcommand.type = XBMC_APPCOMMAND;
   newEvent.appcommand.action = ACTION_PLAYER_PLAYPAUSE;
   CWinEventsIOS::MessagePush(&newEvent);
   
-  /* Give player time to pause */
-  Sleep(2000);
-  //NSLog(@"%s", __PRETTY_FUNCTION__);
-  
-  [m_glView pauseAnimation];
-  
+  Sleep(2000); 
+  [[self glView] pauseAnimation];
 }
 //--------------------------------------------------------------
-- (void)resumeAnimation
+static void XBMCController$resumeAnimation(XBMCController* self, SEL _cmd) 
 {  
+  NSLog(@"%s", __PRETTY_FUNCTION__);
+
   XBMC_Event newEvent;
   memset(&newEvent, 0, sizeof(XBMC_Event));
-  
+
   newEvent.appcommand.type = XBMC_APPCOMMAND;
   newEvent.appcommand.action = ACTION_PLAYER_PLAY;
-  CWinEventsIOS::MessagePush(&newEvent);    
-  
-  [m_glView resumeAnimation];
+  CWinEventsIOS::MessagePush(&newEvent);
+  [[self glView] resumeAnimation];
 }
 //--------------------------------------------------------------
-- (void)startAnimation
+static void XBMCController$startAnimation(XBMCController* self, SEL _cmd) 
 {
-  [m_glView startAnimation];
+  NSLog(@"%s", __PRETTY_FUNCTION__);
+
+  [[self glView] startAnimation];
 }
 //--------------------------------------------------------------
-- (void)stopAnimation
+static void XBMCController$stopAnimation(XBMCController* self, SEL _cmd) 
 {
-  [m_glView stopAnimation];
+  NSLog(@"%s", __PRETTY_FUNCTION__);
+
+  [[self glView] stopAnimation];
 }
 //--------------------------------------------------------------
-- (bool) changeScreen: (unsigned int)screenIdx withMode:(UIScreenMode *)mode
+static bool XBMCController$changeScreen(XBMCController* self, SEL _cmd, unsigned int screenIdx, UIScreenMode * mode) 
 {
   return [[IOSScreenManager sharedInstance] changeScreen: screenIdx withMode: mode];
 }
 //--------------------------------------------------------------
-- (void) activateScreen: (UIScreen *)screen
+static void XBMCController$activateScreen(XBMCController* self, SEL _cmd, UIScreen * screen) 
 {
 }
-@end
 
+// SECTIONCOMMENT
+// c'tor - this sets up our class at runtime by 
+// 1. subclassing from the base classes
+// 2. adding new methods to our class
+// 3. exchanging (hooking) base class methods with ours
+// 4. register the classes to the objc runtime system
+static __attribute__((constructor)) void initControllerRuntimeClasses() 
+{
+  char _typeEncoding[1024];
+  unsigned int i = 0;
+
+  // subclass BRController into XBMCController
+  Class XBMCControllerCls = objc_allocateClassPair(objc_getClass("BRController"), "XBMCController", 0);
+  // add our custom methods which are not part of the baseclass
+  // XBMCController::keyTimer
+  class_addMethod(XBMCControllerCls, @selector(keyTimer), (IMP)&XBMCController$keyTimer, "@@:");
+  // XBMCController::setKeyTimer
+  class_addMethod(XBMCControllerCls, @selector(setKeyTimer:), (IMP)&XBMCController$setKeyTimer, "v@:@");
+  // XBMCController::glView
+  class_addMethod(XBMCControllerCls, @selector(glView), (IMP)&XBMCController$glView, "@@:");
+  // XBMCController::setGlView
+  class_addMethod(XBMCControllerCls, @selector(setGlView:), (IMP)&XBMCController$setGlView, "v@:@");
+  // XBMCController::systemScreenSaverTimeout
+  class_addMethod(XBMCControllerCls, @selector(systemScreenSaverTimeout), (IMP)&XBMCController$systemScreenSaverTimeout, "@@:");
+  // XBMCController::setSystemScreenSaverTimeout
+  class_addMethod(XBMCControllerCls, @selector(setSystemScreenSaverTimeout:), (IMP)&XBMCController$setSystemScreenSaverTimeout, "v@:@");
+  // XBMCController::systemSleepTimeout
+  class_addMethod(XBMCControllerCls, @selector(systemSleepTimeout), (IMP)&XBMCController$systemSleepTimeout, "@@:");
+  // XBMCController::setSystemSleepTimeout
+  class_addMethod(XBMCControllerCls, @selector(setSystemSleepTimeout:), (IMP)&XBMCController$setSystemSleepTimeout, "v@:@");
+  // XBMCController::applicationDidExit
+  class_addMethod(XBMCControllerCls, @selector(applicationDidExit), (IMP)&XBMCController$applicationDidExit, "v@:");
+  // XBMCController::initDisplayLink
+  class_addMethod(XBMCControllerCls, @selector(initDisplayLink), (IMP)&XBMCController$initDisplayLink, "v@:");
+  // XBMCController::deinitDisplayLink
+  class_addMethod(XBMCControllerCls, @selector(deinitDisplayLink), (IMP)&XBMCController$deinitDisplayLink, "v@:");
+  // XBMCController::getDisplayLinkFPS
+  class_addMethod(XBMCControllerCls, @selector(getDisplayLinkFPS), (IMP)&XBMCController$getDisplayLinkFPS, "d@:");
+  // XBMCController::setFramebuffer
+  class_addMethod(XBMCControllerCls, @selector(setFramebuffer), (IMP)&XBMCController$setFramebuffer, "v@:");
+  // XBMCController::presentFramebuffer
+  class_addMethod(XBMCControllerCls, @selector(presentFramebuffer), (IMP)&XBMCController$presentFramebuffer, "B@:");
+  // XBMCController::setUserEvent
+  class_addMethod(XBMCControllerCls, @selector(setUserEvent:withHoldTime:), (IMP)&XBMCController$setUserEvent, "v@:iI");  
+  // XBMCController::startKeyPressTimer
+  class_addMethod(XBMCControllerCls, @selector(startKeyPressTimer:), (IMP)&XBMCController$startKeyPressTimer, "v@:i");  
+  // XBMCController::stopKeyPressTimer
+  class_addMethod(XBMCControllerCls, @selector(stopKeyPressTimer), (IMP)&XBMCController$stopKeyPressTimer, "v@:");
+  // XBMCController::disableSystemSleep
+  class_addMethod(XBMCControllerCls, @selector(disableSystemSleep), (IMP)&XBMCController$disableSystemSleep, "v@:");
+  // XBMCController__enableSystemSleep
+  class_addMethod(XBMCControllerCls, @selector(enableSystemSleep), (IMP)&XBMCController$enableSystemSleep, "v@:");
+  // XBMCController::disableScreenSaver
+  class_addMethod(XBMCControllerCls, @selector(disableScreenSaver), (IMP)&XBMCController$disableScreenSaver, "v@:");
+  // XBMCController::enableScreenSaver
+  class_addMethod(XBMCControllerCls, @selector(enableScreenSaver), (IMP)&XBMCController$enableScreenSaver, "v@:");
+  // XBMCController::pauseAnimation
+  class_addMethod(XBMCControllerCls, @selector(pauseAnimation), (IMP)&XBMCController$pauseAnimation, "v@:");
+  // XBMCController::resumeAnimation
+  class_addMethod(XBMCControllerCls, @selector(resumeAnimation), (IMP)&XBMCController$resumeAnimation, "v@:");
+  // XBMCController::startAnimation
+  class_addMethod(XBMCControllerCls, @selector(startAnimation), (IMP)&XBMCController$startAnimation, "v@:");
+  // XBMCController::stopAnimation
+  class_addMethod(XBMCControllerCls, @selector(stopAnimation), (IMP)&XBMCController$stopAnimation, "v@:");
+
+  i = 0;
+  memcpy(_typeEncoding + i, @encode(CGSize), strlen(@encode(CGSize)));
+  i += strlen(@encode(CGSize));
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  _typeEncoding[i] = '\0';
+  // XBMCController::getScreenSize
+  class_addMethod(XBMCControllerCls, @selector(getScreenSize), (IMP)&XBMCController$getScreenSize, _typeEncoding);
+
+  i = 0;
+  _typeEncoding[i] = 'v';
+  i += 1;
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  memcpy(_typeEncoding + i, @encode(XBMCKey), strlen(@encode(XBMCKey)));
+  i += strlen(@encode(XBMCKey));
+  _typeEncoding[i] = '\0';
+  // XBMCController::sendKey
+  class_addMethod(XBMCControllerCls, @selector(sendKey:), (IMP)&XBMCController$sendKey, _typeEncoding);
+  i = 0;
+  _typeEncoding[i] = 'v';
+  i += 1;
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  memcpy(_typeEncoding + i, @encode(BREvent*), strlen(@encode(BREvent*)));
+  i += strlen(@encode(BREvent*));
+  _typeEncoding[i] = '^';
+  _typeEncoding[i + 1] = 'B';
+  i += 2;
+  _typeEncoding[i] = '^';
+  _typeEncoding[i + 1] = 'B';
+  i += 2;
+  _typeEncoding[i] = '^';
+  _typeEncoding[i + 1] = 'i';
+  i += 2;
+  _typeEncoding[i] = '\0';
+  // XBMCController::ATVClientEventFromBREvent
+  class_addMethod(XBMCControllerCls, @selector(ATVClientEventFromBREvent:Repeatable:ButtonState:Result:), (IMP)&XBMCController$ATVClientEventFromBREvent, _typeEncoding);
+
+  i = 0;
+  _typeEncoding[i] = 'v';
+  i += 1;
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  memcpy(_typeEncoding + i, @encode(NSTimer*), strlen(@encode(NSTimer*)));
+  i += strlen(@encode(NSTimer*));
+  _typeEncoding[i] = '\0';
+  // XBMCController::keyPressTimerCallback
+  class_addMethod(XBMCControllerCls, @selector(keyPressTimerCallback:), (IMP)&XBMCController$keyPressTimerCallback, _typeEncoding);
+  i = 0;
+  _typeEncoding[i] = 'v';
+  i += 1;
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  memcpy(_typeEncoding + i, @encode(NSNotification *), strlen(@encode(NSNotification *)));
+  i += strlen(@encode(NSNotification *));
+  _typeEncoding[i] = '\0';
+  // XBMCController:observeDefaultCenterStuff
+  class_addMethod(XBMCControllerCls, @selector(observeDefaultCenterStuff:), (IMP)&XBMCController$observeDefaultCenterStuff, _typeEncoding);
+
+  i = 0;
+  _typeEncoding[i] = 'B';
+  i += 1;
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  _typeEncoding[i] = 'I';
+  i += 1;
+  memcpy(_typeEncoding + i, @encode(UIScreenMode *), strlen(@encode(UIScreenMode *)));
+  i += strlen(@encode(UIScreenMode *));
+  _typeEncoding[i] = '\0';
+  // XBMCController::changeScreen
+  class_addMethod(XBMCControllerCls, @selector(changeScreen:withMode:), (IMP)&XBMCController$changeScreen, _typeEncoding);
+
+  i = 0;
+  _typeEncoding[i] = 'v';
+  i += 1;
+  _typeEncoding[i] = '@';
+  i += 1;
+  _typeEncoding[i] = ':';
+  i += 1;
+  memcpy(_typeEncoding + i, @encode(UIScreen *), strlen(@encode(UIScreen *)));
+  i += strlen(@encode(UIScreen *));
+  _typeEncoding[i] = '\0';
+  // XBMCController::activateScreen$
+  class_addMethod(XBMCControllerCls, @selector(activateScreen:), (IMP)&XBMCController$activateScreen, _typeEncoding);
+
+  // and hook up our methods (implementation of the base class methods)
+  // XBMCController::brEventAction
+  MSHookMessageEx(XBMCControllerCls, @selector(brEventAction:), (IMP)&XBMCController$brEventAction, (IMP*)&XBMCController$brEventAction$Orig); 
+  // XBMCController::init
+  MSHookMessageEx(XBMCControllerCls, @selector(init), (IMP)&XBMCController$init, (IMP*)&XBMCController$init$Orig);
+  // XBMCController::dealloc
+  MSHookMessageEx(XBMCControllerCls, @selector(dealloc), (IMP)&XBMCController$dealloc, (IMP*)&XBMCController$dealloc$Orig);
+  // XBMCController::controlWasActivated
+  MSHookMessageEx(XBMCControllerCls, @selector(controlWasActivated), (IMP)&XBMCController$controlWasActivated, (IMP*)&XBMCController$controlWasActivated$Orig);
+  // XBMCController::controlWasDeactivated
+  MSHookMessageEx(XBMCControllerCls, @selector(controlWasDeactivated), (IMP)&XBMCController$controlWasDeactivated, (IMP*)&XBMCController$controlWasDeactivated$Orig);
+  // XBMCController::recreateOnReselect
+  MSHookMessageEx(XBMCControllerCls, @selector(recreateOnReselect), (IMP)&XBMCController$recreateOnReselect, nil);
+
+  // and register the class to the runtime
+  objc_registerClassPair(XBMCControllerCls);
+  
+  // save this as static for referencing it in multiple methods
+  BRWindowCls = objc_getClass("BRWindow");
+}
diff --git a/xbmc/osx/atv2/substrate.h b/xbmc/osx/atv2/substrate.h
new file mode 100644 (file)
index 0000000..3cdb88b
--- /dev/null
@@ -0,0 +1,31 @@
+#include <string.h>
+#include <sys/types.h>
+#include <objc/runtime.h>
+#ifdef __cplusplus
+#define _default(x) = x
+extern "C" {
+#else
+#define _default(x)
+#endif
+typedef const void *MSImageRef;
+void MSHookFunction(void *symbol, void *replace, void **result);
+void *MSFindSymbol(const void *image, const char *name);
+MSImageRef MSGetImageByName(const char *file);
+
+#ifdef __APPLE__
+#ifdef __arm__
+IMP MSHookMessage(Class _class, SEL sel, IMP imp, const char *prefix _default(NULL));
+#endif
+void MSHookMessageEx(Class _class, SEL sel, IMP imp, IMP *result);
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+template <typename Type_> Type_ &MSHookIvar(id self, const char *name) {
+    Ivar ivar(class_getInstanceVariable(object_getClass(self), name));
+    void *pointer(ivar == NULL ? NULL : reinterpret_cast<char *>(self) + ivar_getOffset(ivar));
+    return *reinterpret_cast<Type_ *>(pointer);
+}
+
+
index 2ac2954..b0f17e9 100644 (file)
   BOOL _confirmed;
   CIOSKeyboard *_iosKeyboard;
   bool *_canceled;
+  BOOL _deactivated;
   UITextField *_textField;
   UILabel *_heading;
-  BOOL _keyboardIsShowing;
+  int _keyboardIsShowing; // 0: not, 1: will show, 2: showing
   CGFloat _kbHeight;
 }
 
index 0271266..37a60c0 100644 (file)
@@ -46,10 +46,11 @@ static CEvent keyboardFinishedEvent;
   if (self) 
   {
     _iosKeyboard = nil;
-    _keyboardIsShowing = NO;
+    _keyboardIsShowing = 0;
     _kbHeight = 0;
     _confirmed = NO;
     _canceled = NULL;
+    _deactivated = NO;
     
     self.text = [NSMutableString stringWithString:@""];
 
@@ -88,6 +89,10 @@ static CEvent keyboardFinishedEvent;
                                              selector:@selector(keyboardWillShow:)
                                                  name:UIKeyboardWillShowNotification
                                                object:nil];
+    [[NSNotificationCenter defaultCenter] addObserver:self
+                                             selector:@selector(keyboardDidShow:)
+                                                 name:UIKeyboardDidShowNotification
+                                               object:nil];
   }
   return self;
 }
@@ -113,7 +118,14 @@ static CEvent keyboardFinishedEvent;
   LOG(@"keyboardWillShow: keyboard frame: %@", NSStringFromCGRect(kbRect));
   _kbHeight = kbRect.size.width;
   [self setNeedsLayout];
-  _keyboardIsShowing = YES;
+  _keyboardIsShowing = 1;
+}
+
+-(void)keyboardDidShow:(NSNotification *) notification{
+  LOG(@"keyboardDidShow: deactivated: %d", _deactivated);
+  _keyboardIsShowing = 2;
+  if (_deactivated)
+    [self doDeactivate:nil];
 }
 
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
@@ -122,6 +134,14 @@ static CEvent keyboardFinishedEvent;
   [_textField resignFirstResponder];
 }
 
+- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
+{
+  LOG(@"%s: keyboard IsShowing %d", __PRETTY_FUNCTION__, _keyboardIsShowing);
+  // Do not break the keyboard show up process, else we will lost
+  // keyboard did hide notifaction.
+  return _keyboardIsShowing != 1;
+}
+
 - (void)textFieldDidEndEditing:(UITextField *)textField
 {
   PRINT_SIGNATURE();
@@ -139,7 +159,7 @@ static CEvent keyboardFinishedEvent;
 {
   PRINT_SIGNATURE();
   
-  _keyboardIsShowing = NO;
+  _keyboardIsShowing = 0;
 
   if (_textField.editing)
   {
@@ -156,6 +176,7 @@ static CEvent keyboardFinishedEvent;
   [g_xbmcController activateKeyboard:self];
   [_textField becomeFirstResponder];
   [self setNeedsLayout];
+  keyboardFinishedEvent.Reset();
 }
 
 - (void)activate
@@ -171,8 +192,6 @@ static CEvent keyboardFinishedEvent;
     return;
   }
 
-  keyboardFinishedEvent.Reset();
-
   // emulate a modale dialog here
   // we are waiting on the user finishing the keyboard
   // and have to process our app while doing that
@@ -191,7 +210,14 @@ static CEvent keyboardFinishedEvent;
 
 - (void) doDeactivate:(NSDictionary *)dict
 {
-  PRINT_SIGNATURE();
+  LOG(@"%s: keyboard IsShowing %d", __PRETTY_FUNCTION__, _keyboardIsShowing);
+  _deactivated = YES;
+  
+  // Do not break keyboard show up process, if so there's a bug of ios4 will not
+  // notify us keyboard hide.
+  if (_keyboardIsShowing == 1)
+    return;
+
   // invalidate our callback object
   if(_iosKeyboard)
   {
@@ -206,7 +232,7 @@ static CEvent keyboardFinishedEvent;
   [g_xbmcController deactivateKeyboard:self];
   
   // until keyboard did hide, we let the calling thread break loop
-  if (!_keyboardIsShowing)
+  if (0 == _keyboardIsShowing)
   {
     // no more notification we want to receive.
     [[NSNotificationCenter defaultCenter] removeObserver: self];
index c2e476a..914f8af 100644 (file)
@@ -159,6 +159,17 @@ extern NSString* kBRScreenSaverDismissed;
 //--------------------------------------------------------------
 - (void)createGestureRecognizers 
 {
+  //1 finger single tab - left mouse
+  UITapGestureRecognizer *singleFingerSingleTap = [[UITapGestureRecognizer alloc]
+                                                   initWithTarget:self action:@selector(handleSingleFingerSingleTap:)];
+
+  singleFingerSingleTap.delaysTouchesBegan = YES;
+  singleFingerSingleTap.numberOfTapsRequired = 1;
+  singleFingerSingleTap.numberOfTouchesRequired = 1;
+
+  [m_glView addGestureRecognizer:singleFingerSingleTap];
+  [singleFingerSingleTap release];
+
   //2 finger single tab - right mouse
   //single finger double tab delays single finger single tab - so we
   //go for 2 fingers here - so single finger single tap is instant
@@ -249,6 +260,7 @@ extern NSString* kBRScreenSaverDismissed;
                                                                    [sender scale], 0), WINDOW_INVALID,false);
         break;
       case UIGestureRecognizerStateEnded:
+      case UIGestureRecognizerStateCancelled:
         CApplicationMessenger::Get().SendAction(CAction(ACTION_GESTURE_END, 0, 0, 0,
                                                         0, 0), WINDOW_INVALID,false);
         break;
@@ -338,6 +350,12 @@ extern NSString* kBRScreenSaverDismissed;
       CApplicationMessenger::Get().SendAction(CAction(ACTION_GESTURE_END, 0, (float)velocity.x, (float)velocity.y, (int)lastGesturePoint.x, (int)lastGesturePoint.y),WINDOW_INVALID,false);
       touchBeginSignaled = false;
     }
+    else if( touchBeginSignaled && [sender state] == UIGestureRecognizerStateCancelled )
+    {
+      CApplicationMessenger::Get().SendAction(CAction(ACTION_GESTURE_END, 0, 0, 0,
+                                                      0, 0), WINDOW_INVALID,false);
+      touchBeginSignaled = false;
+    }
   }
 }
 //--------------------------------------------------------------
@@ -353,9 +371,6 @@ extern NSString* kBRScreenSaverDismissed;
 {
   XBMC_Event newEvent;
 
-  point.x *= screenScale;
-  point.y *= screenScale;
-
   memset(&newEvent, 0, sizeof(newEvent));
 
   newEvent.type = XBMC_MOUSEMOTION;
@@ -369,6 +384,36 @@ extern NSString* kBRScreenSaverDismissed;
   CWinEventsIOS::MessagePush(&newEvent);
 }
 //--------------------------------------------------------------
+- (IBAction)handleSingleFingerSingleTap:(UIGestureRecognizer *)sender 
+{
+  if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
+  {
+    CGPoint point = [sender locationOfTouch:0 inView:m_glView];
+    point.x *= screenScale;
+    point.y *= screenScale;
+    //NSLog(@"%s singleTap", __PRETTY_FUNCTION__);
+
+    [self postMouseMotionEvent:point];
+
+    XBMC_Event newEvent;
+    memset(&newEvent, 0, sizeof(newEvent));
+
+    newEvent.type = XBMC_MOUSEBUTTONDOWN;
+    newEvent.button.type = XBMC_MOUSEBUTTONDOWN;
+    newEvent.button.button = XBMC_BUTTON_LEFT;
+    newEvent.button.x = point.x;
+    newEvent.button.y = point.y;
+
+    CWinEventsIOS::MessagePush(&newEvent);
+
+    newEvent.type = XBMC_MOUSEBUTTONUP;
+    newEvent.button.type = XBMC_MOUSEBUTTONUP;
+    CWinEventsIOS::MessagePush(&newEvent);
+
+    memset(&lastEvent, 0x0, sizeof(XBMC_Event));
+  }
+}
+//--------------------------------------------------------------
 - (IBAction)handleDoubleFingerSingleTap:(UIGestureRecognizer *)sender 
 {
   if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
@@ -403,71 +448,39 @@ extern NSString* kBRScreenSaverDismissed;
 {
   if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
   {
+    CGPoint point = [sender locationOfTouch:0 inView:m_glView];
+    point.x *= screenScale;
+    point.y *= screenScale;
     if (sender.state == UIGestureRecognizerStateBegan)
     {
-      CGPoint point = [sender locationOfTouch:0 inView:m_glView];
       [self postMouseMotionEvent:point];//selects the current control
-    }
-
-    if (sender.state == UIGestureRecognizerStateEnded)
-    {
-      [self handleDoubleFingerSingleTap:sender];
-    }
-  }
-}
-//--------------------------------------------------------------
-- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
-{
-  if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
-  {
-    UITouch *touch = [touches anyObject];
-    
-    if( [touches count] == 1 && [touch tapCount] == 1)
-    {
-      lastGesturePoint = [touch locationInView:m_glView];    
-      [self postMouseMotionEvent:lastGesturePoint];//selects the current control
-
-      lastGesturePoint.x *= screenScale;
-      lastGesturePoint.y *= screenScale;  
       XBMC_Event newEvent;
       memset(&newEvent, 0, sizeof(newEvent));
-      
+
       newEvent.type = XBMC_MOUSEBUTTONDOWN;
       newEvent.button.type = XBMC_MOUSEBUTTONDOWN;
-      newEvent.button.button = XBMC_BUTTON_LEFT;
-      newEvent.button.x = lastGesturePoint.x;
-      newEvent.button.y = lastGesturePoint.y;  
-      CWinEventsIOS::MessagePush(&newEvent);    
-      
-      /* Store the tap action for later */
-      lastEvent = newEvent;
+      newEvent.button.button = XBMC_BUTTON_RIGHT;
+      newEvent.button.x = point.x;
+      newEvent.button.y = point.y;
+
+      CWinEventsIOS::MessagePush(&newEvent);
     }
-  }
-}
-//--------------------------------------------------------------
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
-{
-  
-}
-//--------------------------------------------------------------
-- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
-{
-  if( [m_glView isXBMCAlive] )//NO GESTURES BEFORE WE ARE UP AND RUNNING
-  {
-    UITouch *touch = [touches anyObject];
-    
-    if( [touches count] == 1 && [touch tapCount] == 1 )
+    else if (sender.state == UIGestureRecognizerStateChanged)
     {
-      XBMC_Event newEvent = lastEvent;
-      
+      [self postMouseMotionEvent:point];
+    }
+    else if (sender.state == UIGestureRecognizerStateEnded)
+    {
+      XBMC_Event newEvent;
+      memset(&newEvent, 0, sizeof(newEvent));
+
       newEvent.type = XBMC_MOUSEBUTTONUP;
       newEvent.button.type = XBMC_MOUSEBUTTONUP;
-      newEvent.button.button = XBMC_BUTTON_LEFT;
-      newEvent.button.x = lastGesturePoint.x;
-      newEvent.button.y = lastGesturePoint.y;
+      newEvent.button.button = XBMC_BUTTON_RIGHT;
+      newEvent.button.x = point.x;
+      newEvent.button.y = point.y;
+
       CWinEventsIOS::MessagePush(&newEvent);
-      
-      memset(&lastEvent, 0x0, sizeof(XBMC_Event));     
     }
   }
 }
index 897440b..0833ab1 100644 (file)
@@ -35,7 +35,8 @@ namespace PERIPHERALS
     PERIPHERAL_BUS_UNKNOWN = 0,
     PERIPHERAL_BUS_USB,
     PERIPHERAL_BUS_PCI,
-    PERIPHERAL_BUS_RPI
+    PERIPHERAL_BUS_RPI,
+    PERIPHERAL_BUS_CEC
   };
 
   enum PeripheralFeature
@@ -143,6 +144,8 @@ namespace PERIPHERALS
         return "pci";
       case PERIPHERAL_BUS_RPI:
         return "rpi";
+      case PERIPHERAL_BUS_CEC:
+        return "cec";
       default:
         return "unknown";
       }
@@ -159,6 +162,8 @@ namespace PERIPHERALS
         return PERIPHERAL_BUS_PCI;
       else if (strTypeLowerCase.Equals("rpi"))
         return PERIPHERAL_BUS_RPI;
+      else if (strTypeLowerCase.Equals("cec"))
+        return PERIPHERAL_BUS_CEC;
 
       return PERIPHERAL_BUS_UNKNOWN;
     };
@@ -180,4 +185,73 @@ namespace PERIPHERALS
       strHexString.Format("%04X", iVal);
     };
   };
+
+  class PeripheralScanResult
+  {
+  public:
+    PeripheralScanResult(const PeripheralBusType busType) :
+      m_type(PERIPHERAL_UNKNOWN),
+      m_iVendorId(0),
+      m_iProductId(0),
+      m_mappedType(PERIPHERAL_UNKNOWN),
+      m_busType(busType),
+      m_mappedBusType(busType),
+      m_iSequence(0) {}
+
+    PeripheralScanResult(void) :
+      m_type(PERIPHERAL_UNKNOWN),
+      m_iVendorId(0),
+      m_iProductId(0),
+      m_mappedType(PERIPHERAL_UNKNOWN),
+      m_busType(PERIPHERAL_BUS_UNKNOWN),
+      m_mappedBusType(PERIPHERAL_BUS_UNKNOWN),
+      m_iSequence(0) {}
+
+    bool operator ==(const PeripheralScanResult& right) const
+    {
+      return m_iVendorId  == right.m_iVendorId &&
+             m_iProductId == right.m_iProductId &&
+             m_type       == right.m_type &&
+             m_busType    == right.m_busType &&
+             m_strLocation.Equals(right.m_strLocation);
+    }
+
+    bool operator !=(const PeripheralScanResult& right) const
+    {
+      return !(*this == right);
+    }
+
+    PeripheralType    m_type;
+    CStdString        m_strLocation;
+    int               m_iVendorId;
+    int               m_iProductId;
+    PeripheralType    m_mappedType;
+    CStdString        m_strDeviceName;
+    PeripheralBusType m_busType;
+    PeripheralBusType m_mappedBusType;
+    unsigned int      m_iSequence; // when more than one adapter of the same type is found
+  };
+
+  struct PeripheralScanResults
+  {
+    bool GetDeviceOnLocation(const CStdString& strLocation, PeripheralScanResult* result) const
+    {
+      for (std::vector<PeripheralScanResult>::const_iterator it = m_results.begin(); it != m_results.end(); it++)
+      {
+        if ((*it).m_strLocation == strLocation)
+        {
+          *result = *it;
+          return true;
+        }
+      }
+      return false;
+    }
+
+    bool ContainsResult(const PeripheralScanResult& result) const
+    {
+      return std::find(m_results.begin(), m_results.end(), result) != m_results.end();
+    }
+
+    std::vector<PeripheralScanResult> m_results;
+  };
 }
index 07ae383..f770b6c 100644 (file)
@@ -31,8 +31,8 @@
 #include "bus/PeripheralBusUSB.h"
 #include "dialogs/GUIDialogPeripheralManager.h"
 
-#ifdef HAVE_CEC_RPI_API
-#include "bus/linux/PeripheralBusRPi.h"
+#if defined(HAVE_LIBCEC)
+#include "bus/virtual/PeripheralBusCEC.h"
 #endif
 
 #include "threads/SingleLock.h"
@@ -84,8 +84,8 @@ void CPeripherals::Initialise(void)
 #if defined(HAVE_PERIPHERAL_BUS_USB)
     m_busses.push_back(new CPeripheralBusUSB(this));
 #endif
-#ifdef HAVE_CEC_RPI_API
-    m_busses.push_back(new CPeripheralBusRPi(this));
+#if defined(HAVE_LIBCEC)
+    m_busses.push_back(new CPeripheralBusCEC(this));
 #endif
 
     /* initialise all known busses */
@@ -229,54 +229,50 @@ bool CPeripherals::HasPeripheralWithFeature(const PeripheralFeature feature, Per
   return (GetPeripheralsWithFeature(dummy, feature, busType) > 0);
 }
 
-CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralType type, const CStdString &strLocation, int iVendorId /* = 0 */, int iProductId /* = 0 */)
+CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result)
 {
   CPeripheral *peripheral = NULL;
+  PeripheralScanResult mappedResult = result;
+  if (mappedResult.m_busType == PERIPHERAL_BUS_UNKNOWN)
+    mappedResult.m_busType = bus.Type();
+
   /* check whether there's something mapped in peripherals.xml */
-  PeripheralType mappedType = type;
-  CStdString strDeviceName;
-  int iMappingPtr = GetMappingForDevice(bus, type, iVendorId, iProductId);
-  bool bHasMapping(iMappingPtr >= 0);
-  if (bHasMapping)
-  {
-    mappedType    = m_mappings[iMappingPtr].m_mappedTo;
-    strDeviceName = m_mappings[iMappingPtr].m_strDeviceName;
-  }
-  else
+  if (!GetMappingForDevice(bus, mappedResult))
   {
     /* don't create instances for devices that aren't mapped in peripherals.xml */
     return NULL;
   }
 
-  switch(mappedType)
+  switch(mappedResult.m_mappedType)
   {
   case PERIPHERAL_HID:
-    peripheral = new CPeripheralHID(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralHID(mappedResult);
     break;
 
   case PERIPHERAL_NIC:
-    peripheral = new CPeripheralNIC(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralNIC(mappedResult);
     break;
 
   case PERIPHERAL_DISK:
-    peripheral = new CPeripheralDisk(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralDisk(mappedResult);
     break;
 
   case PERIPHERAL_NYXBOARD:
-    peripheral = new CPeripheralNyxboard(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralNyxboard(mappedResult);
     break;
 
   case PERIPHERAL_TUNER:
-    peripheral = new CPeripheralTuner(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralTuner(mappedResult);
     break;
 
   case PERIPHERAL_BLUETOOTH:
-    peripheral = new CPeripheralBluetooth(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralBluetooth(mappedResult);
     break;
 
   case PERIPHERAL_CEC:
 #if defined(HAVE_LIBCEC)
-    peripheral = new CPeripheralCecAdapter(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    if (bus.Type() == PERIPHERAL_BUS_CEC)
+      peripheral = new CPeripheralCecAdapter(mappedResult);
 #else
     if (!m_bMissingLibCecWarningDisplayed)
     {
@@ -288,7 +284,7 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera
     break;
 
   case PERIPHERAL_IMON:
-    peripheral = new CPeripheralImon(type, bus.Type(), strLocation, strDeviceName, iVendorId, iProductId);
+    peripheral = new CPeripheralImon(mappedResult);
     break;
 
   default:
@@ -305,7 +301,7 @@ CPeripheral *CPeripherals::CreatePeripheral(CPeripheralBus &bus, const Periphera
     }
     else
     {
-      CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, strLocation.c_str());
+      CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, mappedResult.m_strLocation.c_str());
       delete peripheral;
       peripheral = NULL;
     }
@@ -340,7 +336,7 @@ void CPeripherals::OnDeviceDeleted(const CPeripheralBus &bus, const CPeripheral
   CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(35006), peripheral.DeviceName());
 }
 
-int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const
+bool CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const
 {
   /* check all mappings in the order in which they are defined in peripherals.xml */
   for (unsigned int iMappingPtr = 0; iMappingPtr < m_mappings.size(); iMappingPtr++)
@@ -355,24 +351,26 @@ int CPeripherals::GetMappingForDevice(const CPeripheralBus &bus, const Periphera
     else
     {
       for (unsigned int i = 0; i < mapping.m_PeripheralID.size(); i++)
-        if (mapping.m_PeripheralID[i].m_iVendorId == iVendorId && mapping.m_PeripheralID[i].m_iProductId == iProductId)
+        if (mapping.m_PeripheralID[i].m_iVendorId == result.m_iVendorId && mapping.m_PeripheralID[i].m_iProductId == result.m_iProductId)
           bProductMatch = true;
     }
 
     bool bBusMatch = (mapping.m_busType == PERIPHERAL_BUS_UNKNOWN || mapping.m_busType == bus.Type());
-    bool bClassMatch = (mapping.m_class == PERIPHERAL_UNKNOWN || mapping.m_class == classType);
+    bool bClassMatch = (mapping.m_class == PERIPHERAL_UNKNOWN || mapping.m_class == result.m_type);
 
     if (bProductMatch && bBusMatch && bClassMatch)
     {
       CStdString strVendorId, strProductId;
-      PeripheralTypeTranslator::FormatHexString(iVendorId, strVendorId);
-      PeripheralTypeTranslator::FormatHexString(iProductId, strProductId);
+      PeripheralTypeTranslator::FormatHexString(result.m_iVendorId, strVendorId);
+      PeripheralTypeTranslator::FormatHexString(result.m_iProductId, strProductId);
       CLog::Log(LOGDEBUG, "%s - device (%s:%s) mapped to %s (type = %s)", __FUNCTION__, strVendorId.c_str(), strProductId.c_str(), mapping.m_strDeviceName.c_str(), PeripheralTypeTranslator::TypeToString(mapping.m_mappedTo));
-      return iMappingPtr;
+      result.m_mappedType    = m_mappings[iMappingPtr].m_mappedTo;
+      result.m_strDeviceName = m_mappings[iMappingPtr].m_strDeviceName;
+      return true;
     }
   }
 
-  return -1;
+  return false;
 }
 
 void CPeripherals::GetSettingsFromMapping(CPeripheral &peripheral) const
index ca41a3e..e212049 100644 (file)
@@ -111,11 +111,10 @@ namespace PERIPHERALS
     /*!
      * @brief Creates a new instance of a peripheral.
      * @param bus The bus on which this peripheral is present.
-     * @param type The type of the new peripheral.
-     * @param strLocation The location on the bus.
+     * @param result The scan result from the device scanning code.
      * @return The new peripheral or NULL if it could not be created.
      */
-    CPeripheral *CreatePeripheral(CPeripheralBus &bus, const PeripheralType type, const CStdString &strLocation, int iVendorId = 0, int iProductId = 0);
+    CPeripheral *CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result);
 
     /*!
      * @brief Add the settings that are defined in the mappings file to the peripheral (if there is anything defined).
@@ -200,7 +199,7 @@ namespace PERIPHERALS
   private:
     CPeripherals(void);
     bool LoadMappings(void);
-    int GetMappingForDevice(const CPeripheralBus &bus, const PeripheralType classType, int iVendorId, int iProductId) const;
+    bool GetMappingForDevice(const CPeripheralBus &bus, PeripheralScanResult& result) const;
     static void GetSettingsFromMappingsFile(TiXmlElement *xmlNode, std::map<CStdString, CSetting *> &m_settings);
 
     bool                                 m_bInitialised;
index 01fa4e2..2262e4a 100644 (file)
@@ -12,8 +12,8 @@ ifeq ($(findstring osx,@ARCH@),osx)
 SRCS += osx/PeripheralBusUSB.cpp
 endif
 
-ifeq (@USE_CEC_RPI_API@,1)
-SRCS += linux/PeripheralBusRPi.cpp
+ifeq (@USE_LIBCEC@,1)
+SRCS += virtual/PeripheralBusCEC.cpp
 endif
 
 LIB = peripheral-bus.a
index b0d3790..ea35eac 100644 (file)
@@ -29,65 +29,6 @@ using namespace PERIPHERALS;
 
 #define PERIPHERAL_DEFAULT_RESCAN_INTERVAL 1000
 
-bool PeripheralScanResult::operator ==(const PeripheralScanResult &right) const
-{
-  return m_iVendorId == right.m_iVendorId &&
-      m_iProductId == right.m_iProductId &&
-      m_type == right.m_type &&
-      m_strLocation.Equals(right.m_strLocation);
-}
-
-bool PeripheralScanResult::operator !=(const PeripheralScanResult &right) const
-{
-  return !(*this == right);
-}
-
-bool PeripheralScanResult::operator ==(const CPeripheral &right) const
-{
-  return m_iVendorId == right.VendorId() &&
-      m_iProductId == right.ProductId() &&
-      m_type == right.Type() &&
-      m_strLocation.Equals(right.Location());
-}
-
-bool PeripheralScanResult::operator !=(const CPeripheral &right) const
-{
-  return !(*this == right);
-}
-
-bool PeripheralScanResults::GetDeviceOnLocation(const CStdString &strLocation, PeripheralScanResult *result) const
-{
-  bool bReturn(false);
-
-  for (unsigned int iDevicePtr = 0; iDevicePtr < m_results.size(); iDevicePtr++)
-  {
-    if (m_results.at(iDevicePtr).m_strLocation == strLocation)
-    {
-      *result = m_results.at(iDevicePtr);
-      bReturn = true;
-      break;
-    }
-  }
-
-  return bReturn;
-}
-
-bool PeripheralScanResults::ContainsResult(const PeripheralScanResult &result) const
-{
-  bool bReturn(false);
-
-  for (unsigned int iDevicePtr = 0; iDevicePtr < m_results.size(); iDevicePtr++)
-  {
-    if (m_results.at(iDevicePtr) == result)
-    {
-      bReturn = true;
-      break;
-    }
-  }
-
-  return bReturn;
-}
-
 CPeripheralBus::CPeripheralBus(CPeripherals *manager, PeripheralBusType type) :
     CThread("XBMC Peripherals"),
     m_iRescanTime(PERIPHERAL_DEFAULT_RESCAN_INTERVAL),
@@ -137,9 +78,9 @@ void CPeripheralBus::UnregisterRemovedDevices(const PeripheralScanResults &resul
   for (int iDevicePtr = (int) m_peripherals.size() - 1; iDevicePtr >= 0; iDevicePtr--)
   {
     CPeripheral *peripheral = m_peripherals.at(iDevicePtr);
-    PeripheralScanResult updatedDevice;
+    PeripheralScanResult updatedDevice(m_type);
     if (!results.GetDeviceOnLocation(peripheral->Location(), &updatedDevice) ||
-        updatedDevice != *peripheral)
+        *peripheral != updatedDevice)
     {
       /* device removed */
       removedPeripherals.push_back(peripheral);
@@ -170,9 +111,9 @@ void CPeripheralBus::RegisterNewDevices(const PeripheralScanResults &results)
   CSingleLock lock(m_critSection);
   for (unsigned int iResultPtr = 0; iResultPtr < results.m_results.size(); iResultPtr++)
   {
-    PeripheralScanResult result = results.m_results.at(iResultPtr);
+    const PeripheralScanResult& result = results.m_results.at(iResultPtr);
     if (!HasPeripheral(result.m_strLocation))
-      g_peripherals.CreatePeripheral(*this, result.m_type, result.m_strLocation, result.m_iVendorId, result.m_iProductId);
+      g_peripherals.CreatePeripheral(*this, result);
   }
 }
 
@@ -246,6 +187,20 @@ int CPeripheralBus::GetPeripheralsWithFeature(vector<CPeripheral *> &results, co
   return iReturn;
 }
 
+size_t CPeripheralBus::GetNumberOfPeripheralsWithId(const int iVendorId, const int iProductId) const
+{
+  int iReturn(0);
+  CSingleLock lock(m_critSection);
+  for (unsigned int iPeripheralPtr = 0; iPeripheralPtr < m_peripherals.size(); iPeripheralPtr++)
+  {
+    if (m_peripherals.at(iPeripheralPtr)->VendorId() == iVendorId &&
+        m_peripherals.at(iPeripheralPtr)->ProductId() == iProductId)
+      iReturn++;
+  }
+
+  return iReturn;
+}
+
 void CPeripheralBus::Process(void)
 {
   while (!m_bStop)
index 749dd23..cc368ac 100644 (file)
@@ -31,28 +31,6 @@ namespace PERIPHERALS
 {
   class CPeripherals;
 
-  struct PeripheralScanResult
-  {
-    bool operator ==(const PeripheralScanResult &right) const;
-    bool operator !=(const PeripheralScanResult &right) const;
-
-    bool operator ==(const CPeripheral &right) const;
-    bool operator !=(const CPeripheral &right) const;
-
-    PeripheralType m_type;
-    CStdString     m_strLocation;
-    int            m_iVendorId;
-    int            m_iProductId;
-  };
-
-  struct PeripheralScanResults
-  {
-    bool GetDeviceOnLocation(const CStdString &strLocation, PeripheralScanResult *result) const;
-    bool ContainsResult(const PeripheralScanResult &result) const;
-
-    std::vector<PeripheralScanResult> m_results;
-  };
-
   /*!
    * @class CPeripheralBus
    * This represents a bus on the system. By default, this bus instance will scan for changes every second.
@@ -100,6 +78,7 @@ namespace PERIPHERALS
     virtual int GetPeripheralsWithFeature(std::vector<CPeripheral *> &results, const PeripheralFeature feature) const;
 
     virtual size_t GetNumberOfPeripherals() const;
+    virtual size_t GetNumberOfPeripheralsWithId(const int iVendorId, const int iProductId) const;
 
     /*!
      * @brief Get all features that are supported by devices on this bus.
diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp b/xbmc/peripherals/bus/linux/PeripheralBusRPi.cpp
deleted file mode 100644 (file)
index 7d49faa..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "PeripheralBusRPi.h"
-#include <libcec/cectypes.h>
-
-extern "C" {
-#include <interface/vmcs_host/vc_cecservice.h>
-#include <interface/vchiq_arm/vchiq_if.h>
-}
-
-using namespace PERIPHERALS;
-
-#define RPI_PERIPHERAL_BUS_VID 0x2708
-#define RPI_PERIPHERAL_CEC_PID 0x1001
-
-CPeripheralBusRPi::CPeripheralBusRPi(CPeripherals *manager) :
-    CPeripheralBus(manager, PERIPHERAL_BUS_RPI)
-{
-  m_bNeedsPolling = false;
-}
-
-bool CPeripheralBusRPi::PerformDeviceScan(PeripheralScanResults &results)
-{
-  if (FindAdapter())
-  {
-    PeripheralScanResult result;
-    result.m_iVendorId   = RPI_PERIPHERAL_BUS_VID;
-    result.m_iProductId  = RPI_PERIPHERAL_CEC_PID;
-    result.m_type        = PERIPHERAL_CEC;
-    result.m_strLocation = CEC_RPI_VIRTUAL_COM;
-
-    if (!results.ContainsResult(result))
-      results.m_results.push_back(result);
-  }
-
-  return true;
-}
-
-bool CPeripheralBusRPi::FindAdapter(void)
-{
-  uint8_t iResult;
-
-  VCHI_INSTANCE_T vchiq_instance;
-  if ((iResult = vchi_initialise(&vchiq_instance)) != VCHIQ_SUCCESS)
-    return false;
-
-  if ((iResult = vchi_connect(NULL, 0, vchiq_instance)) != VCHIQ_SUCCESS)
-    return false;
-
-  return true;
-}
diff --git a/xbmc/peripherals/bus/linux/PeripheralBusRPi.h b/xbmc/peripherals/bus/linux/PeripheralBusRPi.h
deleted file mode 100644 (file)
index 413239f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "peripherals/bus/PeripheralBus.h"
-#include "peripherals/devices/Peripheral.h"
-
-namespace PERIPHERALS
-{
-  class CPeripherals;
-
-  class CPeripheralBusRPi : public CPeripheralBus
-  {
-  public:
-    CPeripheralBusRPi(CPeripherals *manager);
-    virtual ~CPeripheralBusRPi(void) {};
-
-    bool PerformDeviceScan(PeripheralScanResults &results);
-
-  private:
-    bool FindAdapter(void);
-  };
-}
index 2001bb9..bfc2a0a 100644 (file)
@@ -43,7 +43,7 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results)
     struct usb_device *dev;
     for (dev = bus->devices; dev; dev = dev->next)
     {
-      PeripheralScanResult result;
+      PeripheralScanResult result(m_type);
       result.m_iVendorId  = dev->descriptor.idVendor;
       result.m_iProductId = dev->descriptor.idProduct;
       result.m_type       = (dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE && dev->descriptor.bNumConfigurations > 0 &&
@@ -55,6 +55,7 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results)
 #else
       result.m_strLocation.Format("/bus%s/dev%s", bus->dirname, dev->filename);
 #endif
+      result.m_iSequence   = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId);
       if (!results.ContainsResult(result))
         results.m_results.push_back(result);
     }
index 6d6ee7b..411a8b9 100644 (file)
@@ -152,12 +152,12 @@ bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results)
         iClass = USB_CLASS_HID;
       }
 
-      PeripheralScanResult result;
+      PeripheralScanResult result(m_type);
       result.m_iVendorId   = PeripheralTypeTranslator::HexStringToInt(udev_device_get_sysattr_value(dev, "idVendor"));
       result.m_iProductId  = PeripheralTypeTranslator::HexStringToInt(udev_device_get_sysattr_value(dev, "idProduct"));
       result.m_type        = GetType(iClass);
       result.m_strLocation = udev_device_get_syspath(dev);
-
+      result.m_iSequence   = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId);
       if (!results.ContainsResult(result))
         results.m_results.push_back(result);
     }
index 8a8dade..81508ca 100644 (file)
@@ -267,6 +267,7 @@ void CPeripheralBusUSB::DeviceAttachCallback(CPeripheralBusUSB* refCon, io_itera
         else
           privateDataRef->result.m_type = refCon->GetType(bDeviceClass);
 
+        privateDataRef->result.m_iSequence = refCon->GetNumberOfPeripheralsWithId(privateDataRef->result.m_iVendorId, privateDataRef->result.m_iProductId);
         if (!refCon->m_scan_results.ContainsResult(privateDataRef->result))
         {
           // register this usb device for an interest notification callback. 
diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.cpp
new file mode 100644 (file)
index 0000000..81e7558
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ *      Copyright (C) 2005-2012 Team XBMC
+ *      http://xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "system.h"
+#if defined(HAVE_LIBCEC)
+#include "PeripheralBusCEC.h"
+#include "peripherals/Peripherals.h"
+#include "utils/log.h"
+#include "DynamicDll.h"
+
+#include <libcec/cec.h>
+
+using namespace PERIPHERALS;
+using namespace CEC;
+using namespace std;
+
+class DllLibCECInterface
+{
+public:
+  virtual ~DllLibCECInterface() {}
+  virtual ICECAdapter* CECInitialise(libcec_configuration *configuration)=0;
+  virtual void*        CECDestroy(ICECAdapter *adapter)=0;
+};
+
+class PERIPHERALS::DllLibCEC : public DllDynamic, DllLibCECInterface
+{
+  DECLARE_DLL_WRAPPER(DllLibCEC, DLL_PATH_LIBCEC)
+
+  DEFINE_METHOD1(ICECAdapter*, CECInitialise, (libcec_configuration *p1))
+  DEFINE_METHOD1(void*       , CECDestroy,    (ICECAdapter *p1))
+
+  BEGIN_METHOD_RESOLVE()
+    RESOLVE_METHOD_RENAME(CECInitialise,  CECInitialise)
+    RESOLVE_METHOD_RENAME(CECDestroy, CECDestroy)
+  END_METHOD_RESOLVE()
+};
+
+CPeripheralBusCEC::CPeripheralBusCEC(CPeripherals *manager) :
+    CPeripheralBus(manager, PERIPHERAL_BUS_CEC),
+    m_dll(new DllLibCEC),
+    m_cecAdapter(NULL)
+{
+  m_iRescanTime = 1000;
+  if (!m_dll->Load() || !m_dll->IsLoaded())
+  {
+    delete m_dll;
+    m_dll = NULL;
+  }
+  else
+  {
+    m_cecAdapter = m_dll->CECInitialise(&m_configuration);
+  }
+}
+
+CPeripheralBusCEC::~CPeripheralBusCEC(void)
+{
+  if (m_dll && m_cecAdapter)
+    m_dll->CECDestroy(m_cecAdapter);
+  delete m_dll;
+}
+
+bool CPeripheralBusCEC::PerformDeviceScan(PeripheralScanResults &results)
+{
+  if (!m_dll || !m_cecAdapter)
+    return false;
+
+  cec_adapter_descriptor deviceList[10];
+  int8_t iFound = m_cecAdapter->DetectAdapters(deviceList, 10, NULL, true);
+
+  for (uint8_t iDevicePtr = 0; iDevicePtr < iFound; iDevicePtr++)
+  {
+    PeripheralScanResult result(m_type);
+    result.m_iVendorId   = deviceList[iDevicePtr].iVendorId;
+    result.m_iProductId  = deviceList[iDevicePtr].iProductId;
+    result.m_strLocation = deviceList[iDevicePtr].strComPath;
+    result.m_type        = PERIPHERAL_CEC;
+
+    // override the bus type, so users don't have to reconfigure their adapters
+    switch(deviceList[iDevicePtr].adapterType)
+    {
+    case ADAPTERTYPE_P8_EXTERNAL:
+    case ADAPTERTYPE_P8_DAUGHTERBOARD:
+      result.m_mappedBusType = PERIPHERAL_BUS_USB;
+      break;
+    case ADAPTERTYPE_RPI:
+      result.m_mappedBusType = PERIPHERAL_BUS_RPI;
+      break;
+    default:
+      break;
+    }
+
+    result.m_iSequence = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId);
+    if (!results.ContainsResult(result))
+      results.m_results.push_back(result);
+  }
+  return true;
+}
+
+#endif
diff --git a/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h b/xbmc/peripherals/bus/virtual/PeripheralBusCEC.h
new file mode 100644 (file)
index 0000000..acba01a
--- /dev/null
@@ -0,0 +1,57 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "peripherals/bus/PeripheralBus.h"
+#include "peripherals/devices/Peripheral.h"
+
+// undefine macro isset, it collides with function in cectypes.h
+#ifdef isset
+#undef isset
+#endif
+#include <libcec/cectypes.h>
+
+namespace CEC
+{
+  class ICECAdapter;
+}
+
+namespace PERIPHERALS
+{
+  class CPeripherals;
+  class DllLibCEC;
+
+  class CPeripheralBusCEC : public CPeripheralBus
+  {
+  public:
+    CPeripheralBusCEC(CPeripherals *manager);
+    virtual ~CPeripheralBusCEC(void);
+
+    /*!
+     * @see PeripheralBus::PerformDeviceScan()
+     */
+    bool PerformDeviceScan(PeripheralScanResults &results);
+
+  private:
+    DllLibCEC*                m_dll;
+    CEC::ICECAdapter*         m_cecAdapter;
+    CEC::libcec_configuration m_configuration;
+  };
+}
index cf23030..e77cb7b 100644 (file)
@@ -104,14 +104,15 @@ bool CPeripheralBusUSB::PerformDeviceScan(const GUID *guid, const PeripheralType
 
         if ((strTmp.Find("&mi_") < 0) || (strTmp.Find("&mi_00") >= 0))
         {
-          PeripheralScanResult prevDevice;
+          PeripheralScanResult prevDevice(m_type);
           if (!results.GetDeviceOnLocation(devicedetailData->DevicePath, &prevDevice))
           {
-            PeripheralScanResult result;
+            PeripheralScanResult result(m_type);
             result.m_strLocation  = devicedetailData->DevicePath;
             result.m_type         = type;
             result.m_iVendorId    = PeripheralTypeTranslator::HexStringToInt(strVendorId.c_str());
             result.m_iProductId   = PeripheralTypeTranslator::HexStringToInt(strProductId.c_str());
+            result.m_iSequence    = GetNumberOfPeripheralsWithId(result.m_iVendorId, result.m_iProductId);
 
             if (!results.ContainsResult(result))
               results.m_results.push_back(result);
index 13b63f1..03bd167 100644 (file)
@@ -38,39 +38,23 @@ struct SortBySettingsOrder
   }
 };
 
-CPeripheral::CPeripheral(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  m_type(type),
-  m_busType(busType),
-  m_strLocation(strLocation),
-  m_strDeviceName(strDeviceName),
+CPeripheral::CPeripheral(const PeripheralScanResult& scanResult) :
+  m_type(scanResult.m_mappedType),
+  m_busType(scanResult.m_busType),
+  m_mappedBusType(scanResult.m_mappedBusType),
+  m_strLocation(scanResult.m_strLocation),
+  m_strDeviceName(scanResult.m_strDeviceName),
   m_strFileLocation(StringUtils::EmptyString),
-  m_iVendorId(iVendorId),
-  m_iProductId(iProductId),
-  m_strVersionInfo(g_localizeStrings.Get(13205)), // "unknown"
-  m_bInitialised(false),
-  m_bHidden(false),
-  m_bError(false)
-{
-  PeripheralTypeTranslator::FormatHexString(iVendorId, m_strVendorId);
-  PeripheralTypeTranslator::FormatHexString(iProductId, m_strProductId);
-  m_strFileLocation.Format("peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(busType), strLocation.c_str());
-}
-
-CPeripheral::CPeripheral(void) :
-  m_type(PERIPHERAL_UNKNOWN),
-  m_busType(PERIPHERAL_BUS_UNKNOWN),
-  m_strLocation(StringUtils::EmptyString),
-  m_strDeviceName(StringUtils::EmptyString),
-  m_strFileLocation(StringUtils::EmptyString),
-  m_iVendorId(0),
-  m_strVendorId("0000"),
-  m_iProductId(0),
-  m_strProductId("0000"),
+  m_iVendorId(scanResult.m_iVendorId),
+  m_iProductId(scanResult.m_iProductId),
   m_strVersionInfo(g_localizeStrings.Get(13205)), // "unknown"
   m_bInitialised(false),
   m_bHidden(false),
   m_bError(false)
 {
+  PeripheralTypeTranslator::FormatHexString(scanResult.m_iVendorId, m_strVendorId);
+  PeripheralTypeTranslator::FormatHexString(scanResult.m_iProductId, m_strProductId);
+  m_strFileLocation.Format(scanResult.m_iSequence > 0 ? "peripherals://%s/%s_%d.dev" : "peripherals://%s/%s.dev", PeripheralTypeTranslator::BusTypeToString(scanResult.m_busType), scanResult.m_strLocation.c_str(), scanResult.m_iSequence);
 }
 
 CPeripheral::~CPeripheral(void)
@@ -146,7 +130,7 @@ bool CPeripheral::Initialise(void)
     return bReturn;
 
   g_peripherals.GetSettingsFromMapping(*this);
-  m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_busType), m_strVendorId.c_str(), m_strProductId.c_str());
+  m_strSettingsFile.Format("special://profile/peripheral_data/%s_%s_%s.xml", PeripheralTypeTranslator::BusTypeToString(m_mappedBusType), m_strVendorId.c_str(), m_strProductId.c_str());
   LoadPersistedSettings();
 
   for (unsigned int iFeaturePtr = 0; iFeaturePtr < m_features.size(); iFeaturePtr++)
@@ -535,3 +519,13 @@ void CPeripheral::ClearSettings(void)
   }
   m_settings.clear();
 }
+
+bool CPeripheral::operator ==(const PeripheralScanResult& right) const
+{
+  return m_strLocation.Equals(right.m_strLocation);
+}
+
+bool CPeripheral::operator !=(const PeripheralScanResult& right) const
+{
+  return !(*this == right);
+}
index 4ca16ae..443f91d 100644 (file)
@@ -34,12 +34,13 @@ namespace PERIPHERALS
     friend class CGUIDialogPeripheralSettings;
 
   public:
-    CPeripheral(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
-    CPeripheral(void);
+    CPeripheral(const PeripheralScanResult& scanResult);
     virtual ~CPeripheral(void);
 
     bool operator ==(const CPeripheral &right) const;
     bool operator !=(const CPeripheral &right) const;
+    bool operator ==(const PeripheralScanResult& right) const;
+    bool operator !=(const PeripheralScanResult& right) const;
 
     const CStdString &FileLocation(void) const     { return m_strFileLocation; }
     const CStdString &Location(void) const         { return m_strLocation; }
@@ -158,6 +159,7 @@ namespace PERIPHERALS
 
     PeripheralType                   m_type;
     PeripheralBusType                m_busType;
+    PeripheralBusType                m_mappedBusType;
     CStdString                       m_strLocation;
     CStdString                       m_strDeviceName;
     CStdString                       m_strSettingsFile;
index 342f482..c48aa91 100644 (file)
@@ -23,8 +23,8 @@
 
 using namespace PERIPHERALS;
 
-CPeripheralBluetooth::CPeripheralBluetooth(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheral(type, busType, strLocation, strDeviceName, iVendorId, iProductId)
+CPeripheralBluetooth::CPeripheralBluetooth(const PeripheralScanResult& scanResult) :
+  CPeripheral(scanResult)
 {
   m_features.push_back(FEATURE_BLUETOOTH);
 }
index d4831ff..292df34 100644 (file)
@@ -26,7 +26,7 @@ namespace PERIPHERALS
   class CPeripheralBluetooth : public CPeripheral
   {
   public:
-    CPeripheralBluetooth(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralBluetooth(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralBluetooth(void) {};
   };
 }
index 616d0f8..dd98b3a 100644 (file)
@@ -80,8 +80,8 @@ class DllLibCEC : public DllDynamic, DllLibCECInterface
   END_METHOD_RESOLVE()
 };
 
-CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheralHID(type, busType, strLocation, strDeviceName, iVendorId, iProductId),
+CPeripheralCecAdapter::CPeripheralCecAdapter(const PeripheralScanResult& scanResult) :
+  CPeripheralHID(scanResult),
   CThread("CEC Adapter"),
   m_dll(NULL),
   m_cecAdapter(NULL)
@@ -98,6 +98,7 @@ CPeripheralCecAdapter::~CPeripheralCecAdapter(void)
     m_bStop = true;
   }
 
+  SAFE_DELETE(m_queryThread);
   StopThread(true);
 
   if (m_dll && m_cecAdapter)
@@ -430,8 +431,7 @@ void CPeripheralCecAdapter::Process(void)
       Sleep(5);
   }
 
-  delete m_queryThread;
-  m_queryThread = NULL;
+  SAFE_DELETE(m_queryThread);
 
   bool bSendStandbyCommands(false);
   {
@@ -1255,8 +1255,7 @@ int CPeripheralCecAdapter::CecLogMessage(void *cbParam, const cec_log_message me
 
 bool CPeripheralCecAdapter::TranslateComPort(CStdString &strLocation)
 {
-  if ((strLocation.Left(18).Equals("peripherals://usb/") ||
-         strLocation.Left(18).Equals("peripherals://rpi/")) &&
+  if ((strLocation.Left(18).Equals("peripherals://cec/")) &&
        strLocation.Right(4).Equals(".dev"))
   {
     strLocation = strLocation.Right(strLocation.length() - 18);
index 7654300..33a6e49 100644 (file)
@@ -86,7 +86,7 @@ namespace PERIPHERALS
     friend class CPeripheralCecAdapterUpdateThread;
 
   public:
-    CPeripheralCecAdapter(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralCecAdapter(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralCecAdapter(void);
 
     void Announce(ANNOUNCEMENT::AnnouncementFlag flag, const char *sender, const char *message, const CVariant &data);
index 5183fdd..6587f88 100644 (file)
@@ -23,8 +23,9 @@
 
 using namespace PERIPHERALS;
 
-CPeripheralDisk::CPeripheralDisk(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35003) : strDeviceName, iVendorId, iProductId)
+CPeripheralDisk::CPeripheralDisk(const PeripheralScanResult& scanResult) :
+  CPeripheral(scanResult)
 {
+  m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35003) : scanResult.m_strDeviceName;
   m_features.push_back(FEATURE_DISK);
 }
index 712fe62..432b7f7 100644 (file)
@@ -26,7 +26,7 @@ namespace PERIPHERALS
   class CPeripheralDisk : public CPeripheral
   {
   public:
-    CPeripheralDisk(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralDisk(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralDisk(void) {};
   };
 }
index a6295b4..11f6254 100644 (file)
 using namespace PERIPHERALS;
 using namespace std;
 
-CPeripheralHID::CPeripheralHID(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : strDeviceName, iVendorId, iProductId),
+CPeripheralHID::CPeripheralHID(const PeripheralScanResult& scanResult) :
+  CPeripheral(scanResult),
   m_bInitialised(false)
 {
+  m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : scanResult.m_strDeviceName;
   m_features.push_back(FEATURE_HID);
 }
 
index 8095ab9..41c1a24 100644 (file)
@@ -27,7 +27,7 @@ namespace PERIPHERALS
   class CPeripheralHID : public CPeripheral
   {
   public:
-    CPeripheralHID(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralHID(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralHID(void);
     virtual bool InitialiseFeature(const PeripheralFeature feature);
     virtual bool LookupSymAndUnicode(XBMC_keysym &keysym, uint8_t *key, char *unicode) { return false; }
index 0609835..1f2b034 100644 (file)
@@ -37,8 +37,8 @@ using namespace std;
 volatile long CPeripheralImon::m_lCountOfImonsConflictWithDInput = 0;
 
 
-CPeripheralImon::CPeripheralImon(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheralHID(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35001) : strDeviceName, iVendorId, iProductId)
+CPeripheralImon::CPeripheralImon(const PeripheralScanResult& scanResult) :
+  CPeripheralHID(scanResult)
 {
   m_features.push_back(FEATURE_IMON);
   m_bImonConflictsWithDInput = false;
index 1891270..f8e40ff 100644 (file)
@@ -26,7 +26,7 @@ namespace PERIPHERALS
   class CPeripheralImon : public CPeripheralHID
   {
   public:
-    CPeripheralImon(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralImon(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralImon(void) {}
     virtual bool InitialiseFeature(const PeripheralFeature feature);
     virtual void OnSettingChanged(const CStdString &strChangedSetting);
index 97f891f..4e8ca2e 100644 (file)
@@ -25,8 +25,9 @@
 using namespace PERIPHERALS;
 using namespace std;
 
-CPeripheralNIC::CPeripheralNIC(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheral(type, busType, strLocation, strDeviceName.IsEmpty() ? g_localizeStrings.Get(35002) : strDeviceName, iVendorId, iProductId)
+CPeripheralNIC::CPeripheralNIC(const PeripheralScanResult& scanResult) :
+  CPeripheral(scanResult)
 {
+  m_strDeviceName = scanResult.m_strDeviceName.IsEmpty() ? g_localizeStrings.Get(35002) : scanResult.m_strDeviceName;
   m_features.push_back(FEATURE_NIC);
 }
index bce9c58..e31e7f1 100644 (file)
@@ -26,7 +26,7 @@ namespace PERIPHERALS
   class CPeripheralNIC : public CPeripheral
   {
   public:
-    CPeripheralNIC(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralNIC(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralNIC(void) {};
   };
 }
index 8a8b3d6..dd64dea 100644 (file)
@@ -27,8 +27,8 @@
 using namespace PERIPHERALS;
 using namespace std;
 
-CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheralHID(type, busType, strLocation, strDeviceName, iVendorId, iProductId)
+CPeripheralNyxboard::CPeripheralNyxboard(const PeripheralScanResult& scanResult) :
+  CPeripheralHID(scanResult)
 {
   m_features.push_back(FEATURE_NYXBOARD);
 }
index e82bf00..6648e42 100644 (file)
@@ -26,7 +26,7 @@ namespace PERIPHERALS
   class CPeripheralNyxboard : public CPeripheralHID
   {
   public:
-    CPeripheralNyxboard(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralNyxboard(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralNyxboard(void) {};
     virtual bool LookupSymAndUnicode(XBMC_keysym &keysym, uint8_t *key, char *unicode);
   };
index e372ff1..65504b0 100644 (file)
@@ -23,8 +23,8 @@
 
 using namespace PERIPHERALS;
 
-CPeripheralTuner::CPeripheralTuner(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId) :
-  CPeripheral(type, busType, strLocation, strDeviceName, iVendorId, iProductId)
+CPeripheralTuner::CPeripheralTuner(const PeripheralScanResult& scanResult) :
+  CPeripheral(scanResult)
 {
   m_features.push_back(FEATURE_TUNER);
 }
index dd804a7..8749378 100644 (file)
@@ -26,7 +26,7 @@ namespace PERIPHERALS
   class CPeripheralTuner : public CPeripheral
   {
   public:
-    CPeripheralTuner(const PeripheralType type, const PeripheralBusType busType, const CStdString &strLocation, const CStdString &strDeviceName, int iVendorId, int iProductId);
+    CPeripheralTuner(const PeripheralScanResult& scanResult);
     virtual ~CPeripheralTuner(void) {};
   };
 }
index 16f98a8..6c8fc81 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include "guilib/GUIDialog.h"
-#include "settings/GUIDialogSettings.h"
+#include "settings/dialogs/GUIDialogSettings.h"
 #include "FileItem.h"
 
 namespace PERIPHERALS
index 83d033a..2bc734e 100644 (file)
@@ -31,6 +31,7 @@ void CPictureInfoTag::Reset()
   memset(&m_exifInfo, 0, sizeof(m_exifInfo));
   memset(&m_iptcInfo, 0, sizeof(m_iptcInfo));
   m_isLoaded = false;
+  m_isInfoSetExternally = false;
 }
 
 const CPictureInfoTag& CPictureInfoTag::operator=(const CPictureInfoTag& right)
@@ -39,6 +40,7 @@ const CPictureInfoTag& CPictureInfoTag::operator=(const CPictureInfoTag& right)
   memcpy(&m_exifInfo, &right.m_exifInfo, sizeof(m_exifInfo));
   memcpy(&m_iptcInfo, &right.m_iptcInfo, sizeof(m_iptcInfo));
   m_isLoaded = right.m_isLoaded;
+  m_isInfoSetExternally = right.m_isInfoSetExternally;
   return *this;
 }
 
@@ -61,6 +63,7 @@ void CPictureInfoTag::Archive(CArchive& ar)
   if (ar.IsStoring())
   {
     ar << m_isLoaded;
+    ar << m_isInfoSetExternally;
     ar << m_exifInfo.ApertureFNumber;
     ar << CStdString(m_exifInfo.CameraMake);
     ar << CStdString(m_exifInfo.CameraModel);
@@ -124,6 +127,7 @@ void CPictureInfoTag::Archive(CArchive& ar)
   else
   {
     ar >> m_isLoaded;
+    ar >> m_isInfoSetExternally;
     ar >> m_exifInfo.ApertureFNumber;
     GetStringFromArchive(ar, m_exifInfo.CameraMake, sizeof(m_exifInfo.CameraMake));
     GetStringFromArchive(ar, m_exifInfo.CameraModel, sizeof(m_exifInfo.CameraModel));
@@ -267,7 +271,7 @@ void CPictureInfoTag::GetStringFromArchive(CArchive &ar, char *string, size_t le
 
 const CStdString CPictureInfoTag::GetInfo(int info) const
 {
-  if (!m_isLoaded)
+  if (!m_isLoaded && !m_isInfoSetExternally) // If no metadata has been loaded from the picture file or set with SetInfo(), just return
     return "";
 
   CStdString value;
@@ -590,21 +594,17 @@ void CPictureInfoTag::SetInfo(int info, const CStdString& value)
       {
         m_exifInfo.Width = atoi(dimension[0].c_str());
         m_exifInfo.Height = atoi(dimension[1].c_str());
+        m_isInfoSetExternally = true; // Set the internal state to show metadata has been set by call to SetInfo
       }
       break;
     }
   case SLIDE_EXIF_DATE_TIME:
     {
       strcpy(m_exifInfo.DateTime, value.c_str());
+      m_isInfoSetExternally = true; // Set the internal state to show metadata has been set by call to SetInfo
       break;
     }
   default:
     break;
   }
 }
-
-void CPictureInfoTag::SetLoaded(bool loaded)
-{
-  m_isLoaded = loaded;
-}
-
index 0c56e31..67cc9eb 100644 (file)
@@ -100,12 +100,12 @@ public:
   static int TranslateString(const CStdString &info);
 
   void SetInfo(int info, const CStdString& value);
-  void SetLoaded(bool loaded = true);
 
 private:
   void GetStringFromArchive(CArchive &ar, char *string, size_t length);
   ExifInfo_t m_exifInfo;
   IPTCInfo_t m_iptcInfo;
-  bool       m_isLoaded;
+  bool       m_isLoaded;             // Set to true if metadata has been loaded from the picture file successfully
+  bool       m_isInfoSetExternally;  // Set to true if metadata has been set by an external call to SetInfo
 };
 
index 5da4331..fb0c78c 100644 (file)
@@ -490,7 +490,9 @@ void CPlayList::UpdateItem(const CFileItem *item)
     CFileItemPtr playlistItem = *it;
     if (playlistItem->IsSamePath(item))
     {
+      CStdString temp = playlistItem->GetPath(); // save path, it may have been altered
       *playlistItem = *item;
+      playlistItem->SetPath(temp);
       break;
     }
   }
index 17dabdc..be4e293 100644 (file)
@@ -37,9 +37,6 @@ CPlayList* CPlayListFactory::Create(const CStdString& filename)
 
 CPlayList* CPlayListFactory::Create(const CFileItem& item)
 {
-  if(item.IsLastFM()) //lastfm is always a stream, and just silly to check content
-    return NULL;
-
   if( item.IsInternetStream() )
   {
     CStdString strMimeType = item.GetMimeType();
index d32deba..f0d4c52 100644 (file)
@@ -178,15 +178,17 @@ void CPVRClient::WriteClientRecordingInfo(const CPVRRecording &xbmcRecording, PV
 
   memset(&addonRecording, 0, sizeof(addonRecording));
 
-  addonRecording.recordingTime  = recTime - g_advancedSettings.m_iPVRTimeCorrection;
+  addonRecording.recordingTime       = recTime - g_advancedSettings.m_iPVRTimeCorrection;
   strncpy(addonRecording.strRecordingId, xbmcRecording.m_strRecordingId.c_str(), sizeof(addonRecording.strRecordingId) - 1);
   strncpy(addonRecording.strTitle, xbmcRecording.m_strTitle.c_str(), sizeof(addonRecording.strTitle) - 1);
   strncpy(addonRecording.strPlotOutline, xbmcRecording.m_strPlotOutline.c_str(), sizeof(addonRecording.strPlotOutline) - 1);
   strncpy(addonRecording.strPlot, xbmcRecording.m_strPlot.c_str(), sizeof(addonRecording.strPlot) - 1);
   strncpy(addonRecording.strChannelName, xbmcRecording.m_strChannelName.c_str(), sizeof(addonRecording.strChannelName) - 1);
-  addonRecording.iDuration      = xbmcRecording.GetDuration();
-  addonRecording.iPriority      = xbmcRecording.m_iPriority;
-  addonRecording.iLifetime      = xbmcRecording.m_iLifetime;
+  addonRecording.iDuration           = xbmcRecording.GetDuration();
+  addonRecording.iPriority           = xbmcRecording.m_iPriority;
+  addonRecording.iLifetime           = xbmcRecording.m_iLifetime;
+  addonRecording.iPlayCount          = xbmcRecording.m_playCount;
+  addonRecording.iLastPlayedPosition = (int)xbmcRecording.m_resumePoint.timeInSeconds;
   strncpy(addonRecording.strDirectory, xbmcRecording.m_strDirectory.c_str(), sizeof(addonRecording.strDirectory) - 1);
   strncpy(addonRecording.strStreamURL, xbmcRecording.m_strStreamURL.c_str(), sizeof(addonRecording.strStreamURL) - 1);
   strncpy(addonRecording.strIconPath, xbmcRecording.m_strIconPath.c_str(), sizeof(addonRecording.strIconPath) - 1);
@@ -257,6 +259,13 @@ bool CPVRClient::IsCompatibleAPIVersion(const ADDON::AddonVersion &minVersion, c
   return (version >= myMinVersion && minVersion <= myVersion);
 }
 
+bool CPVRClient::IsCompatibleGUIAPIVersion(const ADDON::AddonVersion &minVersion, const ADDON::AddonVersion &version)
+{
+  AddonVersion myMinVersion = AddonVersion(XBMC_GUI_MIN_API_VERSION);
+  AddonVersion myVersion = AddonVersion(XBMC_GUI_API_VERSION);
+  return (version >= myMinVersion && minVersion <= myVersion);
+}
+
 bool CPVRClient::CheckAPIVersion(void)
 {
   /* check the API version */
@@ -270,6 +279,18 @@ bool CPVRClient::CheckAPIVersion(void)
     return false;
   }
 
+  /* check the GUI API version */
+  AddonVersion guiVersion = AddonVersion("0.0.0");
+  minVersion = AddonVersion(XBMC_GUI_MIN_API_VERSION);
+  try { guiVersion = AddonVersion(m_pStruct->GetGUIAPIVersion()); }
+  catch (exception &e) { LogException(e, "GetGUIAPIVersion()"); return false;  }
+
+  if (!IsCompatibleGUIAPIVersion(minVersion, guiVersion))
+  {
+    CLog::Log(LOGERROR, "PVR - Add-on '%s' is using an incompatible GUI API version. XBMC minimum GUI API version = '%s', add-on GUI API version '%s'", Name().c_str(), minVersion.c_str(), guiVersion.c_str());
+    return false;
+  }
+
   return true;
 }
 
@@ -698,6 +719,40 @@ int CPVRClient::GetRecordingLastPlayedPosition(const CPVRRecording &recording)
   return iReturn;
 }
 
+std::vector<PVR_EDL_ENTRY> CPVRClient::GetRecordingEdl(const CPVRRecording &recording)
+{
+  std::vector<PVR_EDL_ENTRY> edl;
+  if (!m_bReadyToUse)
+    return edl;
+
+  if (!m_addonCapabilities.bSupportsRecordingEdl)
+    return edl;
+
+  try
+  {
+    PVR_RECORDING tag;
+    WriteClientRecordingInfo(recording, tag);
+
+    PVR_EDL_ENTRY edl_array[PVR_ADDON_EDL_LENGTH];
+    int size = PVR_ADDON_EDL_LENGTH;
+    PVR_ERROR retval = m_pStruct->GetRecordingEdl(tag, edl_array, &size);
+    if (retval == PVR_ERROR_NO_ERROR)
+    {
+      edl.reserve(size);
+      for (int i = 0; i < size; ++i)
+      {
+        edl.push_back(edl_array[i]);
+      }
+    }
+  }
+  catch (exception &e)
+  {
+    LogException(e, __FUNCTION__);
+  }
+
+  return edl;
+}
+
 int CPVRClient::GetTimersAmount(void)
 {
   int iReturn(-EINVAL);
@@ -1152,6 +1207,11 @@ bool CPVRClient::SupportsRecordingPlayCount(void) const
   return m_addonCapabilities.bSupportsRecordingPlayCount;
 }
 
+bool CPVRClient::SupportsRecordingEdl(void) const
+{
+  return m_addonCapabilities.bSupportsRecordingEdl;
+}
+
 bool CPVRClient::SupportsTimers(void) const
 {
   return m_addonCapabilities.bSupportsTimers;
index e428ee1..161b0a9 100644 (file)
@@ -267,6 +267,13 @@ namespace PVR
     */
     int GetRecordingLastPlayedPosition(const CPVRRecording &recording);
 
+    /*!
+    * @brief Retrieve the edit decision list (EDL) from the backend.
+    * @param recording The recording.
+    * @return The edit decision list (empty on error).
+    */
+    std::vector<PVR_EDL_ENTRY> GetRecordingEdl(const CPVRRecording &recording);
+
     //@}
     /** @name PVR timer methods */
     //@{
@@ -460,6 +467,7 @@ namespace PVR
     bool SupportsRecordings(void) const;
     bool SupportsRecordingFolders(void) const;
     bool SupportsRecordingPlayCount(void) const;
+    bool SupportsRecordingEdl(void) const;
     bool SupportsTimers(void) const;
     bool SupportsTV(void) const;
     bool HandlesDemuxing(void) const;
@@ -512,6 +520,14 @@ namespace PVR
     static bool IsCompatibleAPIVersion(const ADDON::AddonVersion &minVersion, const ADDON::AddonVersion &version);
 
     /*!
+     * @brief Checks whether the provided GUI API version is compatible with XBMC
+     * @param minVersion The add-on's XBMC_GUI_MIN_API_VERSION version
+     * @param version The add-on's XBMC_GUI_API_VERSION version
+     * @return True when compatible, false otherwise
+     */
+    static bool IsCompatibleGUIAPIVersion(const ADDON::AddonVersion &minVersion, const ADDON::AddonVersion &version);
+
+    /*!
      * @brief Request the API version from the add-on, and check if it's compatible
      * @return True when compatible, false otherwise.
      */
index d7cbfb4..8a0cc1b 100644 (file)
@@ -531,6 +531,17 @@ bool CPVRClients::SetRecordingPlayCount(const CPVRRecording &recording, int coun
   return *error == PVR_ERROR_NO_ERROR;
 }
 
+std::vector<PVR_EDL_ENTRY> CPVRClients::GetRecordingEdl(const CPVRRecording &recording)
+{
+  PVR_CLIENT client;
+  if (GetConnectedClient(recording.m_iClientId, client) && client->SupportsRecordingEdl())
+    return client->GetRecordingEdl(recording);
+  else
+    CLog::Log(LOGERROR, "PVR - %s - client %d does not support getting Edl", __FUNCTION__, recording.m_iClientId);
+
+  return std::vector<PVR_EDL_ENTRY>();
+}
+
 bool CPVRClients::IsRecordingOnPlayingChannel(void) const
 {
   CPVRChannelPtr currentChannel;
@@ -1220,6 +1231,12 @@ bool CPVRClients::SupportsRecordingPlayCount(int iClientId) const
   return GetConnectedClient(iClientId, client) && client->SupportsRecordingPlayCount();
 }
 
+bool CPVRClients::SupportsRecordingEdl(int iClientId) const
+{
+  PVR_CLIENT client;
+  return GetConnectedClient(iClientId, client) && client->SupportsRecordingEdl();
+}
+
 bool CPVRClients::SupportsTimers(int iClientId) const
 {
   PVR_CLIENT client;
index 731ebbc..d515ebd 100644 (file)
@@ -427,6 +427,13 @@ namespace PVR
     int GetRecordingLastPlayedPosition(const CPVRRecording &recording);
 
     /*!
+    * @brief Retrieve the edit decision list (EDL) from the backend.
+    * @param recording The recording.
+    * @return The edit decision list (empty on error).
+    */
+    std::vector<PVR_EDL_ENTRY> GetRecordingEdl(const CPVRRecording &recording);
+
+    /*!
      * @brief Check whether there is an active recording on the current channel.
      * @return True if there is, false otherwise.
      */
@@ -546,6 +553,7 @@ namespace PVR
     bool SupportsRadio(int iClientId) const;
     bool SupportsRecordingFolders(int iClientId) const;
     bool SupportsRecordingPlayCount(int iClientId) const;
+    bool SupportsRecordingEdl(int iClientId) const;
     bool SupportsTimers(int iClientId) const;
     bool SupportsTV(int iClientId) const;
     bool HandlesDemuxing(int iClientId) const;
index b45dd17..1a627a5 100644 (file)
@@ -99,7 +99,7 @@ CPVRChannel::CPVRChannel(const PVR_CHANNEL &channel, unsigned int iClientId)
   m_strFileNameAndPath      = StringUtils::EmptyString;
   m_bIsVirtual              = false;
   m_iLastWatched            = 0;
-  m_bEPGEnabled             = true;
+  m_bEPGEnabled             = !channel.bIsHidden;
   m_strEPGScraper           = "client";
   m_iEpgId                  = -1;
   m_bEPGCreated             = false;
@@ -268,6 +268,7 @@ bool CPVRChannel::SetHidden(bool bIsHidden)
   {
     /* update the hidden flag */
     m_bIsHidden = bIsHidden;
+       m_bEPGEnabled = !bIsHidden;
     SetChanged();
     m_bChanged = true;
 
index 1d9bca3..55911e5 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 #include "XBDateTime.h"
-#include "settings/GUIDialogSettings.h"
+#include "settings/dialogs/GUIDialogSettings.h"
 #include "guilib/GUIListItem.h"
 
 class CFileItem;
index 05e3a16..5afa5b3 100644 (file)
@@ -42,23 +42,25 @@ CPVRRecording::CPVRRecording(const PVR_RECORDING &recording, unsigned int iClien
 {
   Reset();
 
-  m_strRecordingId    = recording.strRecordingId;
-  m_strTitle          = recording.strTitle;
-  m_iClientId         = iClientId;
-  m_recordingTime     = recording.recordingTime + g_advancedSettings.m_iPVRTimeCorrection;
-  m_duration          = CDateTimeSpan(0, 0, recording.iDuration / 60, recording.iDuration % 60);
-  m_iPriority         = recording.iPriority;
-  m_iLifetime         = recording.iLifetime;
-  m_strDirectory      = recording.strDirectory;
-  m_strPlot           = recording.strPlot;
-  m_strPlotOutline    = recording.strPlotOutline;
-  m_strStreamURL      = recording.strStreamURL;
-  m_strChannelName    = recording.strChannelName;
-  m_genre             = StringUtils::Split(CEpg::ConvertGenreIdToString(recording.iGenreType, recording.iGenreSubType), g_advancedSettings.m_videoItemSeparator);
-  m_playCount         = recording.iPlayCount;
-  m_strIconPath       = recording.strIconPath;
-  m_strThumbnailPath  = recording.strThumbnailPath;
-  m_strFanartPath     = recording.strFanartPath;
+  m_strRecordingId                 = recording.strRecordingId;
+  m_strTitle                       = recording.strTitle;
+  m_iClientId                      = iClientId;
+  m_recordingTime                  = recording.recordingTime + g_advancedSettings.m_iPVRTimeCorrection;
+  m_duration                       = CDateTimeSpan(0, 0, recording.iDuration / 60, recording.iDuration % 60);
+  m_iPriority                      = recording.iPriority;
+  m_iLifetime                      = recording.iLifetime;
+  m_strDirectory                   = recording.strDirectory;
+  m_strPlot                        = recording.strPlot;
+  m_strPlotOutline                 = recording.strPlotOutline;
+  m_strStreamURL                   = recording.strStreamURL;
+  m_strChannelName                 = recording.strChannelName;
+  m_genre                          = StringUtils::Split(CEpg::ConvertGenreIdToString(recording.iGenreType, recording.iGenreSubType), g_advancedSettings.m_videoItemSeparator);
+  m_playCount                      = recording.iPlayCount;
+  m_resumePoint.timeInSeconds      = recording.iLastPlayedPosition;
+  m_resumePoint.totalTimeInSeconds = recording.iDuration;
+  m_strIconPath                    = recording.strIconPath;
+  m_strThumbnailPath               = recording.strThumbnailPath;
+  m_strFanartPath                  = recording.strFanartPath;
 }
 
 bool CPVRRecording::operator ==(const CPVRRecording& right) const
@@ -166,18 +168,10 @@ void CPVRRecording::UpdateMetadata(void)
     }
   }
 
-  if ((g_PVRClients->SupportsLastPlayedPosition(m_iClientId)))
+  if (!g_PVRClients->SupportsLastPlayedPosition(m_iClientId))
   {
-    int iPosition = g_PVRClients->GetRecordingLastPlayedPosition(*this);
-    if (iPosition > 0)
-    {
-      m_resumePoint.timeInSeconds      = iPosition;
-      m_resumePoint.totalTimeInSeconds = (double)GetDuration();
-    }
-  }
-  else if (!m_bGotMetaData && db.Open())
-  {
-    db.GetResumeBookMark(m_strFileNameAndPath, m_resumePoint);
+    if (!m_bGotMetaData && db.Open())
+      db.GetResumeBookMark(m_strFileNameAndPath, m_resumePoint);
   }
 
   m_bGotMetaData = true;
@@ -191,6 +185,12 @@ bool CPVRRecording::IncrementPlayCount()
 bool CPVRRecording::SetLastPlayedPosition(int lastplayedposition)
 {
   PVR_ERROR error;
+
+  CBookmark bookmark;
+  bookmark.timeInSeconds = lastplayedposition;
+  bookmark.totalTimeInSeconds = (double)GetDuration();
+  m_resumePoint = bookmark;
+
   if (g_PVRClients->SupportsLastPlayedPosition(m_iClientId) &&
       !g_PVRClients->SetRecordingLastPlayedPosition(*this, lastplayedposition, &error))
   {
@@ -212,6 +212,15 @@ int CPVRRecording::GetLastPlayedPosition() const
   return rc;
 }
 
+std::vector<PVR_EDL_ENTRY> CPVRRecording::GetEdl() const
+{
+  if (g_PVRClients->SupportsRecordingEdl(m_iClientId))
+  {
+    return g_PVRClients->GetRecordingEdl(*this);
+  }
+  return std::vector<PVR_EDL_ENTRY>();
+}
+
 void CPVRRecording::DisplayError(PVR_ERROR err) const
 {
   if (err == PVR_ERROR_SERVER_ERROR)
@@ -246,6 +255,12 @@ void CPVRRecording::Update(const CPVRRecording &tag)
   if (g_PVRClients->SupportsRecordingPlayCount(m_iClientId))
     m_playCount       = tag.m_playCount;
 
+  if (g_PVRClients->SupportsLastPlayedPosition(m_iClientId))
+  {
+    m_resumePoint.timeInSeconds = tag.m_resumePoint.timeInSeconds;
+    m_resumePoint.totalTimeInSeconds = tag.m_resumePoint.totalTimeInSeconds;
+  }
+
   CStdString strShow;
   strShow.Format("%s - ", g_localizeStrings.Get(20364).c_str());
   if (m_strPlotOutline.Left(strShow.size()).Equals(strShow))
index e988ef2..a6f1392 100644 (file)
@@ -114,6 +114,12 @@ namespace PVR
     int GetLastPlayedPosition() const;
 
     /*!
+     * @brief Retrieve the edit decision list (EDL) of a recording on the backend.
+     * @return The edit decision list (empty on error)
+     */
+    std::vector<PVR_EDL_ENTRY> GetEdl() const;
+
+    /*!
      * @brief Get the resume point and play count from the server (if supported) or the database
      * @param bookmark The bookmark to update
      */
index f473ee1..eb69ba6 100644 (file)
@@ -68,7 +68,7 @@ void CGUIWindowPVR::SetActiveView(CGUIWindowPVRCommon *window)
   CSingleLock lock(m_critSection);
 
   if ((!window && m_currentSubwindow) || (window && !m_currentSubwindow) ||
-      (window->GetWindowId() != m_currentSubwindow->GetWindowId()))
+      (window && m_currentSubwindow && window->GetWindowId() != m_currentSubwindow->GetWindowId()))
   {
     // switched views, save current history
     if (m_currentSubwindow)
index b81e12f..d5e7ad6 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-#include "settings/GUIWindowTestPattern.h"
+#include "settings/windows/GUIWindowTestPattern.h"
 
 class CGUIWindowTestPatternDX : public CGUIWindowTestPattern
 {
index e659eff..78e41c0 100644 (file)
@@ -22,7 +22,7 @@
  *
  */
 
-#include "settings/GUIWindowTestPattern.h"
+#include "settings/windows/GUIWindowTestPattern.h"
 
 class CGUIWindowTestPatternGL : public CGUIWindowTestPattern
 {
index c1868be..bee5391 100644 (file)
@@ -460,6 +460,10 @@ void ADDON_FreeSettings()
 {
 }
 
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
 void GetInfo(SCR_INFO *info)
 {
 }
index f42cb75..89ef745 100644 (file)
@@ -381,6 +381,10 @@ void ADDON_FreeSettings()
 {
 }
 
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
 void GetInfo(SCR_INFO *info)
 {
 }
index f177a4f..323bb7e 100644 (file)
@@ -315,6 +315,10 @@ void ADDON_FreeSettings()
 {
 }
 
+void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
 void GetInfo(SCR_INFO *info)
 {
 }
index 677e56e..a85006b 100644 (file)
@@ -112,6 +112,7 @@ void CAdvancedSettings::Initialize()
   m_DXVANoDeintProcForProgressive = false;
   m_videoFpsDetect = 1;
   m_videoDefaultLatency = 0.0;
+  m_videoDisableHi10pMultithreading = false;
 
   m_musicUseTimeSeeking = true;
   m_musicTimeSeekForward = 10;
@@ -493,6 +494,7 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
     XMLUtils::GetBoolean(pElement,"enablehighqualityhwscalers", m_videoEnableHighQualityHwScalers);
     XMLUtils::GetFloat(pElement,"autoscalemaxfps",m_videoAutoScaleMaxFps, 0.0f, 1000.0f);
     XMLUtils::GetBoolean(pElement,"allowmpeg4vdpau",m_videoAllowMpeg4VDPAU);
+    XMLUtils::GetBoolean(pElement,"disablehi10pmultithreading",m_videoDisableHi10pMultithreading);
     XMLUtils::GetBoolean(pElement,"allowmpeg4vaapi",m_videoAllowMpeg4VAAPI);    
     XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace);
     XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1);
index 9d3714e..4bc7cb0 100644 (file)
@@ -164,6 +164,7 @@ class CAdvancedSettings
     bool m_DXVAForceProcessorRenderer;
     bool m_DXVANoDeintProcForProgressive;
     int  m_videoFpsDetect;
+    bool m_videoDisableHi10pMultithreading;
 
     CStdString m_videoDefaultPlayer;
     CStdString m_videoDefaultDVDPlayer;
diff --git a/xbmc/settings/AppParamParser.cpp b/xbmc/settings/AppParamParser.cpp
deleted file mode 100644 (file)
index f7aae37..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "AppParamParser.h"
-#include "AdvancedSettings.h"
-#include "GUIInfoManager.h"
-#include "PlayListPlayer.h"
-#include "FileItem.h"
-#include "Application.h"
-#include "ApplicationMessenger.h"
-#include "utils/log.h"
-#ifdef TARGET_WINDOWS
-#include "WIN32Util.h"
-#endif
-#ifdef HAS_LIRC
-#include "input/linux/LIRC.h"
-#endif
-#ifndef TARGET_WINDOWS
-#include "linux/XTimeUtils.h"
-#endif
-
-CAppParamParser::CAppParamParser()
-{
-  m_testmode = false;
-}
-
-void CAppParamParser::Parse(const char* argv[], int nArgs)
-{
-  if (nArgs > 1)
-  {
-    for (int i = 1; i < nArgs; i++)
-    {
-      ParseArg(argv[i]);
-#ifdef HAS_LIRC
-      if (strnicmp(argv[i], "-l", 2) == 0 || strnicmp(argv[i], "--lircdev", 9) == 0)
-      {
-        // check the next arg with the proper value.
-        int next=i+1;
-        if (next < nArgs)
-        {
-          if ((argv[next][0] != '-' ) && (argv[next][0] == '/' ))
-          {
-            g_RemoteControl.setDeviceName(argv[next]);
-            i++;
-          }
-        }
-      }
-      else if (strnicmp(argv[i], "-n", 2) == 0 || strnicmp(argv[i], "--nolirc", 8) == 0)
-         g_RemoteControl.setUsed(false);
-#endif
-      if (stricmp(argv[i], "-d") == 0)
-      {
-        if (i + 1 < nArgs)
-        {
-          int sleeptime = atoi(argv[i + 1]);
-          if (sleeptime > 0 && sleeptime < 360)
-            Sleep(sleeptime*1000);
-        }
-        i++;
-      }
-    }
-  }
-  PlayPlaylist();
-}
-
-void CAppParamParser::DisplayVersion()
-{
-  printf("XBMC Media Center %s\n", g_infoManager.GetVersion().c_str());
-  printf("Copyright (C) 2005-2013 Team XBMC - http://www.xbmc.org\n");
-  exit(0);
-}
-
-void CAppParamParser::DisplayHelp()
-{
-  printf("Usage: xbmc [OPTION]... [FILE]...\n\n");
-  printf("Arguments:\n");
-  printf("  -d <n>\t\tdelay <n> seconds before starting\n");
-  printf("  -fs\t\t\tRuns XBMC in full screen\n");
-  printf("  --standalone\t\tXBMC runs in a stand alone environment without a window \n");
-  printf("\t\t\tmanager and supporting applications. For example, that\n");
-  printf("\t\t\tenables network settings.\n");
-  printf("  -p or --portable\tXBMC will look for configurations in install folder instead of ~/.xbmc\n");
-  printf("  --legacy-res\t\tEnables screen resolutions such as PAL, NTSC, etc.\n");
-#ifdef HAS_LIRC
-  printf("  -l or --lircdev\tLircDevice to use default is "LIRC_DEVICE" .\n");
-  printf("  -n or --nolirc\tdo not use Lirc, i.e. no remote input.\n");
-#endif
-  printf("  --debug\t\tEnable debug logging\n");
-  printf("  --version\t\tPrint version information\n");
-  printf("  --test\t\tEnable test mode. [FILE] required.\n");
-  printf("  --settings=<filename>\t\tLoads specified file after advancedsettings.xml replacing any settings specified\n");
-  printf("  \t\t\t\tspecified file must exist in special://xbmc/system/\n");
-  exit(0);
-}
-
-void CAppParamParser::EnableDebugMode()
-{
-  g_advancedSettings.m_logLevel     = LOG_LEVEL_DEBUG;
-  g_advancedSettings.m_logLevelHint = LOG_LEVEL_DEBUG;
-  CLog::SetLogLevel(g_advancedSettings.m_logLevel);
-}
-
-void CAppParamParser::ParseArg(const CStdString &arg)
-{
-  if (arg == "-fs" || arg == "--fullscreen")
-    g_advancedSettings.m_startFullScreen = true;
-  else if (arg == "-h" || arg == "--help")
-    DisplayHelp();
-  else if (arg == "-v" || arg == "--version")
-    DisplayVersion();
-  else if (arg == "--standalone")
-    g_application.SetStandAlone(true);
-  else if (arg == "-p" || arg  == "--portable")
-    g_application.EnablePlatformDirectories(false);
-  else if (arg == "--debug")
-    EnableDebugMode();
-  else if (arg == "--legacy-res")
-    g_application.SetEnableLegacyRes(true);
-  else if (arg == "--test")
-    m_testmode = true;
-  else if (arg.substr(0, 11) == "--settings=")
-    g_advancedSettings.AddSettingsFile(arg.substr(11));
-  else if (arg.length() != 0 && arg[0] != '-')
-  {
-    if (m_testmode)
-      g_application.SetEnableTestMode(true);
-    CFileItemPtr pItem(new CFileItem(arg));
-    pItem->SetPath(arg);
-    m_playlist.Add(pItem);
-  }
-}
-
-void CAppParamParser::PlayPlaylist()
-{
-  if (m_playlist.Size() > 0)
-  {
-    g_playlistPlayer.Add(0, m_playlist);
-    g_playlistPlayer.SetCurrentPlaylist(0);
-  }
-
-  ThreadMessage tMsg = {TMSG_PLAYLISTPLAYER_PLAY, (DWORD) -1};
-  CApplicationMessenger::Get().SendMessage(tMsg, false);
-}
\ No newline at end of file
diff --git a/xbmc/settings/AppParamParser.h b/xbmc/settings/AppParamParser.h
deleted file mode 100644 (file)
index 78d6174..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "utils/StdString.h"
-#include "FileItem.h"
-
-class CAppParamParser
-{
-  public:
-    CAppParamParser();
-    void Parse(const char* argv[], int nArgs);
-
-  private:
-    bool m_testmode;
-    CFileItemList m_playlist;
-    void ParseArg(const CStdString &arg);
-    void DisplayHelp();
-    void DisplayVersion();
-    void EnableDebugMode();
-    void PlayPlaylist();
-};
diff --git a/xbmc/settings/GUIDialogContentSettings.cpp b/xbmc/settings/GUIDialogContentSettings.cpp
deleted file mode 100644 (file)
index 6bb5c2c..0000000
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogContentSettings.h"
-#include "addons/GUIDialogAddonSettings.h"
-#include "GUISettings.h"
-#include "guilib/GUIWindowManager.h"
-#include "addons/IAddon.h"
-#include "FileItem.h"
-#include "video/VideoDatabase.h"
-#include "video/VideoInfoScanner.h"
-#include "GUISettings.h"
-#include "interfaces/Builtins.h"
-#include "filesystem/AddonsDirectory.h"
-#include "dialogs/GUIDialogKaiToast.h"
-
-#include <climits>
-
-#define CONTROL_CONTENT_TYPE        3
-#define CONTROL_SCRAPER_LIST        4
-#define CONTROL_SCRAPER_SETTINGS    6
-#define CONTROL_START              30
-
-using namespace std;
-using namespace ADDON;
-
-CGUIDialogContentSettings::CGUIDialogContentSettings(void)
-  : CGUIDialogSettings(WINDOW_DIALOG_CONTENT_SETTINGS, "DialogContentSettings.xml"), m_origContent(CONTENT_NONE)
-{
-  m_bNeedSave = false;
-  m_content = CONTENT_NONE;
-  m_vecItems = new CFileItemList;
-}
-
-CGUIDialogContentSettings::~CGUIDialogContentSettings(void)
-{
-  delete m_vecItems;
-}
-
-bool CGUIDialogContentSettings::OnMessage(CGUIMessage &message)
-{
-  switch (message.GetMessage())
-  {
-  case GUI_MSG_WINDOW_DEINIT:
-    {
-      m_scrapers.clear();
-      m_vecItems->Clear();
-      CGUIDialogSettings::OnMessage(message);
-    }
-    break;
-
-  case GUI_MSG_CLICKED:
-    int iControl = message.GetSenderId();
-
-    if (iControl == CONTROL_CONTENT_TYPE)
-    {
-      CGUIMessage msg(GUI_MSG_ITEM_SELECTED,GetID(), CONTROL_CONTENT_TYPE);
-      g_windowManager.SendMessage(msg);
-      m_content = (CONTENT_TYPE) msg.GetParam1();
-      SetupPage();
-    }
-    if (iControl == CONTROL_SCRAPER_LIST)
-    {
-      // we handle only select actions
-      int action = message.GetParam1();
-      if (!(action == ACTION_SELECT_ITEM || action == ACTION_MOUSE_LEFT_CLICK))
-        break;
-
-      CGUIMessage msg(GUI_MSG_ITEM_SELECTED,GetID(), CONTROL_SCRAPER_LIST);
-      g_windowManager.SendMessage(msg);
-      int iSelected = msg.GetParam1();
-      if (iSelected == m_vecItems->Size() - 1)
-      { // Get More... item.
-        // This is tricky - ideally we want to completely save the state of this dialog,
-        // close it while linking to the addon manager, then reopen it on return.
-        // For now, we just close the dialog + send the GetPath() to open the addons window
-        CStdString content = m_vecItems->Get(iSelected)->GetPath().Mid(14);
-        OnCancel();
-        Close();
-        CBuiltins::Execute("ActivateWindow(AddonBrowser,addons://all/xbmc.metadata.scraper." + content + ",return)");
-        return true;
-      }
-      AddonPtr last = m_scraper;
-      m_scraper = m_scrapers[m_content][iSelected];
-      m_lastSelected[m_content] = m_scraper;
-
-      if (m_scraper != last)
-        SetupPage();
-
-      if (m_scraper != last)
-        m_bNeedSave = true;
-      CONTROL_ENABLE_ON_CONDITION(CONTROL_SCRAPER_SETTINGS, m_scraper->HasSettings());
-      SET_CONTROL_FOCUS(CONTROL_START,0);
-    }
-    if (iControl == CONTROL_SCRAPER_SETTINGS)
-    {
-      if (CGUIDialogAddonSettings::ShowAndGetInput(m_scraper, false))
-        m_bNeedSave = true;
-      return m_bNeedSave;
-    }
-  }
-  return CGUIDialogSettings::OnMessage(message);
-}
-
-void CGUIDialogContentSettings::SetupPage()
-{
-  CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_SCRAPER_LIST);
-  OnMessage(msgReset);
-  m_vecItems->Clear();
-  if (m_content == CONTENT_NONE)
-  {
-    m_bShowScanSettings = false;
-    SET_CONTROL_HIDDEN(CONTROL_SCRAPER_LIST);
-    CONTROL_DISABLE(CONTROL_SCRAPER_SETTINGS);
-  }
-  else
-  {
-    FillListControl();
-    SET_CONTROL_VISIBLE(CONTROL_SCRAPER_LIST);
-    if (m_scraper && m_scraper->Enabled())
-    {
-      m_bShowScanSettings = true;
-      ScraperPtr scraper = boost::dynamic_pointer_cast<CScraper>(m_scraper);
-      if (scraper && scraper->Supports(m_content) && scraper->HasSettings())
-        CONTROL_ENABLE(CONTROL_SCRAPER_SETTINGS);
-    }
-    else
-      CONTROL_DISABLE(CONTROL_SCRAPER_SETTINGS);
-  }
-
-  CreateSettings();
-  CGUIDialogSettings::SetupPage();
-  SET_CONTROL_VISIBLE(CONTROL_CONTENT_TYPE);
-}
-
-void CGUIDialogContentSettings::CreateSettings()
-{
-  // crappy setting dependencies part 1
-  m_settings.clear();
-  switch (m_content)
-  {
-  case CONTENT_TVSHOWS:
-    {
-      AddBool(1,20379,&m_bSingleItem, m_bShowScanSettings);
-      AddBool(2,20432,&m_bNoUpdate, m_bShowScanSettings);
-    }
-    break;
-  case CONTENT_MOVIES:
-    {
-      AddBool(1,20329,&m_bUseDirNames, m_bShowScanSettings);
-      AddBool(2,20346,&m_bScanRecursive, m_bShowScanSettings && ((m_bUseDirNames && !m_bSingleItem) || !m_bUseDirNames));
-      AddBool(3,20383,&m_bSingleItem, m_bShowScanSettings && (m_bUseDirNames && !m_bScanRecursive));
-      AddBool(4,20432,&m_bNoUpdate, m_bShowScanSettings);
-    }
-    break;
-  case CONTENT_MUSICVIDEOS:
-    {
-      AddBool(1,20330,&m_bUseDirNames, m_bShowScanSettings);
-      AddBool(2,20346,&m_bScanRecursive, m_bShowScanSettings && ((m_bUseDirNames && !m_bSingleItem) || !m_bUseDirNames));
-      AddBool(3,20383,&m_bSingleItem, m_bShowScanSettings && (m_bUseDirNames && !m_bScanRecursive));
-      AddBool(4,20432,&m_bNoUpdate, m_bShowScanSettings);
-    }
-    break;
-  case CONTENT_ALBUMS:
-  case CONTENT_ARTISTS:
-    break;
-  case CONTENT_NONE:
-  default:
-    {
-      AddBool(1,20380,&m_bExclude, !m_bShowScanSettings);
-    }
-  }
-}
-
-void CGUIDialogContentSettings::OnSettingChanged(SettingInfo &setting)
-{
-  CreateSettings();
-
-  // crappy setting dependencies part 2
-  if (m_content == CONTENT_MOVIES)
-  {
-    if (setting.id == 2) // use dir names
-    {
-      m_bSingleItem = false;
-      UpdateSetting(3); // scan recursively
-      UpdateSetting(4); // single item
-    }
-    else if (setting.id == 3)
-    {
-      m_bSingleItem = false;
-      UpdateSetting(4);
-    }
-    else if (setting.id == 4)
-    {
-      m_bScanRecursive = false;
-      UpdateSetting(3);
-    }
-  }
-  m_bNeedSave = true;
-}
-
-void CGUIDialogContentSettings::OnOkay()
-{ // watch for content change, but same scraper
-  if (m_content != m_origContent)
-    m_bNeedSave = true;
-}
-
-void CGUIDialogContentSettings::OnCancel()
-{
-  m_bNeedSave = false;
-}
-
-void CGUIDialogContentSettings::OnInitWindow()
-{
-  m_lastSelected.clear();
-  // save our current scraper (if any)
-  if (m_scraper)
-    m_lastSelected[m_content] = m_scraper;
-  FillContentTypes();
-  m_bNeedSave = false;
-  CGUIDialogSettings::OnInitWindow();
-}
-
-void CGUIDialogContentSettings::FillContentTypes()
-{
-  CGUIMessage msg(GUI_MSG_LABEL_RESET,GetID(),CONTROL_CONTENT_TYPE);
-  g_windowManager.SendMessage(msg);
-
-  if (m_content == CONTENT_ALBUMS || m_content == CONTENT_ARTISTS)
-  {
-    FillContentTypes(m_content);
-  }
-  else
-  {
-    FillContentTypes(CONTENT_MOVIES);
-    FillContentTypes(CONTENT_TVSHOWS);
-    FillContentTypes(CONTENT_MUSICVIDEOS);
-
-    // add 'None' to spinner
-    CGUIMessage msg2(GUI_MSG_LABEL_ADD,GetID(),CONTROL_CONTENT_TYPE);
-    msg2.SetLabel(TranslateContent(CONTENT_NONE, true));
-    msg2.SetParam1((int) CONTENT_NONE);
-    g_windowManager.SendMessage(msg2);
-  }
-
-  CONTROL_SELECT_ITEM(CONTROL_CONTENT_TYPE, (int) m_content);
-}
-
-void CGUIDialogContentSettings::FillContentTypes(const CONTENT_TYPE &content)
-{
-  // grab all scrapers which support this content-type
-  VECADDONS addons;
-  TYPE type = ScraperTypeFromContent(content);
-  if (!CAddonMgr::Get().GetAddons(type, addons))
-    return;
-
-  AddonPtr addon;
-  CStdString defaultID;
-  if (CAddonMgr::Get().GetDefault(type, addon))
-    defaultID = addon->ID();
-
-  for (IVECADDONS it = addons.begin(); it != addons.end(); it++)
-  {
-    bool isDefault = ((*it)->ID() == defaultID);
-    map<CONTENT_TYPE,VECADDONS>::iterator iter=m_scrapers.find(content);
-
-    AddonPtr scraper = (*it)->Clone((*it));
-
-    if (m_scraper && m_scraper->ID() == (*it)->ID())
-    { // don't overwrite preconfigured scraper
-      scraper = m_scraper;
-    }
-
-    if (iter != m_scrapers.end())
-    {
-      if (isDefault)
-        iter->second.insert(iter->second.begin(), scraper);
-      else
-        iter->second.push_back(scraper);
-    }
-    else
-    {
-      VECADDONS vec;
-      vec.push_back(scraper);
-      m_scrapers.insert(make_pair(content,vec));
-    }
-  }
-
-  // add CONTENT type to spinner
-  CGUIMessage msg(GUI_MSG_LABEL_ADD,GetID(),CONTROL_CONTENT_TYPE);
-  msg.SetLabel(TranslateContent(content, true));
-  msg.SetParam1((int) content);
-  g_windowManager.SendMessage(msg);
-}
-
-void CGUIDialogContentSettings::FillListControl()
-{
-  int iIndex=0;
-  int selectedIndex = 0;
-
-  if (m_lastSelected.find(m_content) != m_lastSelected.end())
-    m_scraper = m_lastSelected[m_content];
-  else
-    CAddonMgr::Get().GetDefault(ScraperTypeFromContent(m_content), m_scraper);
-
-  for (IVECADDONS iter=m_scrapers.find(m_content)->second.begin();iter!=m_scrapers.find(m_content)->second.end();++iter)
-  {
-    CFileItemPtr item(new CFileItem((*iter)->Name()));
-    item->SetPath((*iter)->ID());
-    item->SetArt("thumb", (*iter)->Icon());
-    if (m_scraper && (*iter)->ID() == m_scraper->ID())
-    {
-      item->Select(true);
-      selectedIndex = iIndex;
-    }
-    m_vecItems->Add(item);
-    iIndex++;
-  }
-
-  // add the "Get More..." item
-  m_vecItems->Add(XFILE::CAddonsDirectory::GetMoreItem(TranslateContent(m_content)));
-
-  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_SCRAPER_LIST, 0, 0, m_vecItems);
-  OnMessage(msg);
-  CGUIMessage msg2(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_SCRAPER_LIST, selectedIndex);
-  OnMessage(msg2);
-}
-
-CFileItemPtr CGUIDialogContentSettings::GetCurrentListItem(int offset)
-{
-  int currentItem = -1;
-  if(m_bExclude)
-    return CFileItemPtr();
-  for (int i=0;i<m_vecItems->Size();++i )
-  {
-    if (m_vecItems->Get(i)->IsSelected())
-    {
-      currentItem = i;
-      break;
-    }
-  }
-
-  if (currentItem == -1)
-    return CFileItemPtr();
-
-  int item = (currentItem + offset) % m_vecItems->Size();
-  if (item < 0) item += m_vecItems->Size();
-  return m_vecItems->Get(item);
-}
-
-bool CGUIDialogContentSettings::ShowForDirectory(const CStdString& strDirectory, ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings)
-{
-  CVideoDatabase database;
-  database.Open();
-  scraper = database.GetScraperForPath(strDirectory, settings);
-  bool bResult = Show(scraper,settings);
-  if (bResult)
-    database.SetScraperForPath(strDirectory,scraper,settings);
-
-  return bResult;
-}
-
-bool CGUIDialogContentSettings::Show(ADDON::ScraperPtr& scraper, CONTENT_TYPE musicContext/*=CONTENT_NONE*/)
-{
-  VIDEO::SScanSettings dummy;
-  return Show(scraper,dummy,musicContext);
-}
-
-bool CGUIDialogContentSettings::Show(ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings, CONTENT_TYPE musicContext/*=CONTENT_NONE*/)
-{
-  CGUIDialogContentSettings *dialog = (CGUIDialogContentSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTENT_SETTINGS);
-  if (!dialog)
-    return false;
-
-  if (scraper)
-  {
-    dialog->m_content = musicContext != CONTENT_NONE ? musicContext : scraper->Content();
-    dialog->m_origContent = dialog->m_content;
-    dialog->m_scraper = scraper;
-    // toast selected but disabled scrapers
-    if (!scraper->Enabled())
-      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24023), scraper->Name(), 2000, true);
-  }
-
-  dialog->m_bScanRecursive = (settings.recurse > 0 && !settings.parent_name) || (settings.recurse > 1 && settings.parent_name);
-  dialog->m_bUseDirNames   = settings.parent_name;
-  dialog->m_bExclude       = settings.exclude;
-  dialog->m_bSingleItem    = settings.parent_name_root;
-  dialog->m_bNoUpdate      = settings.noupdate;
-  dialog->m_bNeedSave = false;
-  dialog->DoModal();
-  if (dialog->m_bNeedSave)
-  {
-    scraper = boost::dynamic_pointer_cast<CScraper>(dialog->m_scraper);
-    CONTENT_TYPE content = dialog->m_content;
-    if (!scraper || content == CONTENT_NONE)
-    {
-      scraper.reset();
-      settings.exclude = dialog->m_bExclude;
-    }
-    else
-    {
-      settings.exclude = false;
-      settings.noupdate = dialog->m_bNoUpdate;
-      scraper->SetPathSettings(content, "");
-
-      if (content == CONTENT_TVSHOWS)
-      {
-        settings.parent_name = dialog->m_bSingleItem;
-        settings.parent_name_root = dialog->m_bSingleItem;
-        settings.recurse = 0;
-      }
-      else if (content == CONTENT_MOVIES)
-      {
-        if (dialog->m_bUseDirNames)
-        {
-          settings.parent_name = true;
-          settings.parent_name_root = false;
-          settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 1;
-
-          if (dialog->m_bSingleItem)
-          {
-            settings.parent_name_root = true;
-            settings.recurse = 0;
-          }
-        }
-        else
-        {
-          settings.parent_name = false;
-          settings.parent_name_root = false;
-          settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0;
-        }
-      }
-      else if (content == CONTENT_MUSICVIDEOS)
-      {
-        if (dialog->m_bUseDirNames)
-        {
-          settings.parent_name = true;
-          settings.parent_name_root = false;
-          settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 1;
-
-          if (dialog->m_bSingleItem)
-          {
-            settings.parent_name_root = true;
-            settings.recurse = 0;
-          }
-        }
-        else
-         {
-           settings.parent_name = false;
-           settings.parent_name_root = false;
-           settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0;
-         }
-      }
-    }
-  }
-
-  dialog->m_scraper.reset();
-  dialog->m_content = dialog->m_origContent = CONTENT_NONE;
-  return dialog->m_bNeedSave;
-}
-
diff --git a/xbmc/settings/GUIDialogContentSettings.h b/xbmc/settings/GUIDialogContentSettings.h
deleted file mode 100644 (file)
index cb4c70d..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogSettings.h"
-#include "addons/Scraper.h"
-#include "addons/AddonManager.h"
-#include <vector>
-
-namespace VIDEO
-{
-  struct SScanSettings;
-}
-class CFileItemList;
-
-class CGUIDialogContentSettings : public CGUIDialogSettings
-{
-public:
-  CGUIDialogContentSettings(void);
-  virtual ~CGUIDialogContentSettings(void);
-  virtual bool OnMessage(CGUIMessage& message);
-
-  static bool Show(ADDON::ScraperPtr& scraper, CONTENT_TYPE musicContext = CONTENT_NONE);
-  static bool Show(ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings, CONTENT_TYPE musicContext = CONTENT_NONE);
-  static bool ShowForDirectory(const CStdString& strDirectory, ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings);
-  virtual bool HasListItems() const { return true; };
-  virtual CFileItemPtr GetCurrentListItem(int offset = 0);
-protected:
-  virtual void OnOkay();
-  virtual void OnCancel();
-  virtual void OnInitWindow();
-  virtual void SetupPage();
-  virtual void CreateSettings();
-  void FillContentTypes();
-  void FillContentTypes(const CONTENT_TYPE& content);
-  void AddContentType(const CONTENT_TYPE& content);
-  void FillListControl();
-  virtual void OnSettingChanged(SettingInfo& setting);
-
-  bool m_bNeedSave;
-
-  bool m_bShowScanSettings;
-  bool m_bScanRecursive;
-  bool m_bUseDirNames;
-  bool m_bSingleItem;
-  bool m_bExclude;
-  bool m_bNoUpdate;
-  std::map<CONTENT_TYPE, ADDON::VECADDONS> m_scrapers;
-  std::map<CONTENT_TYPE, ADDON::AddonPtr>  m_lastSelected;
-  CFileItemList* m_vecItems;
-
-  CStdString m_strContentType;
-  ADDON::AddonPtr m_scraper;
-  CStdString m_defaultScraper;
-  CONTENT_TYPE m_content;
-  CONTENT_TYPE m_origContent;
-};
diff --git a/xbmc/settings/GUIDialogLockSettings.cpp b/xbmc/settings/GUIDialogLockSettings.cpp
deleted file mode 100644 (file)
index ce734a3..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogLockSettings.h"
-#include "dialogs/GUIDialogNumeric.h"
-#include "guilib/GUIKeyboardFactory.h"
-#include "dialogs/GUIDialogGamepad.h"
-#include "dialogs/GUIDialogContextMenu.h"
-#include "guilib/GUIWindowManager.h"
-#include "URL.h"
-#include "guilib/LocalizeStrings.h"
-
-CGUIDialogLockSettings::CGUIDialogLockSettings(void)
-    : CGUIDialogSettings(WINDOW_DIALOG_LOCK_SETTINGS, "LockSettings.xml")
-{
-}
-
-CGUIDialogLockSettings::~CGUIDialogLockSettings(void)
-
-{
-}
-
-void CGUIDialogLockSettings::OnCancel()
-{
-  m_bChanged = false;
-}
-
-void CGUIDialogLockSettings::SetupPage()
-{
-  CGUIDialogSettings::SetupPage();
-  // update our settings label
-  if (m_bGetUser)
-  {
-    CStdString strLabel;
-    CStdString strLabel2=m_strURL;
-    CURL::Decode(strLabel2);
-    strLabel.Format(g_localizeStrings.Get(20152),strLabel2.c_str());
-    SET_CONTROL_LABEL(2,strLabel);
-  }
-  else
-    SET_CONTROL_LABEL(2,g_localizeStrings.Get(20066));
-  SET_CONTROL_HIDDEN(3);
-}
-
-void CGUIDialogLockSettings::EnableDetails(bool bEnable)
-{
-  for (int i=2;i<9;++i)
-  {
-    m_settings[i].enabled = bEnable || !m_bConditionalDetails;
-    UpdateSetting(i+1);
-  }
-}
-
-void CGUIDialogLockSettings::CreateSettings()
-{
-  // clear out any old settings
-  m_settings.clear();
-  // create our settings
-  if (m_bGetUser)
-  {
-    AddButton(1,20142);
-    if (!m_strUser.IsEmpty())
-      m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
-    AddButton(2,12326);
-    if (!m_locks.code.IsEmpty())
-      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
-    if (m_saveUserDetails)
-      AddBool(3, 13423, m_saveUserDetails);
-    return;
-  }
-  AddButton(1,m_iButtonLabel);
-  if (m_locks.mode > LOCK_MODE_QWERTY)
-    m_locks.mode = LOCK_MODE_EVERYONE;
-  if (m_locks.mode != LOCK_MODE_EVERYONE)
-    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
-  else
-    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
-
-  if (m_bDetails)
-  {
-    AddSeparator(2);
-    AddBool(3,20038,&m_locks.music);
-    AddBool(4,20039,&m_locks.video);
-    AddBool(5,20040,&m_locks.pictures);
-    AddBool(6,20041,&m_locks.programs);
-    AddBool(7,20042,&m_locks.files);
-    AddBool(8,20043,&m_locks.settings);
-    AddBool(9,24090,&m_locks.addonManager);
-    EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
-  }
-}
-
-void CGUIDialogLockSettings::OnSettingChanged(SettingInfo &setting)
-{
-  // check and update anything that needs it
-  if (setting.id == 1)
-  {
-    if (m_bGetUser)
-    {
-      CStdString strHeading;
-      CStdString strDecodeUrl = m_strURL;
-      CURL::Decode(strDecodeUrl);
-      strHeading.Format("%s %s",g_localizeStrings.Get(14062).c_str(),strDecodeUrl.c_str());
-      if (CGUIKeyboardFactory::ShowAndGetInput(m_strUser,strHeading,true))
-      {
-        m_bChanged = true;
-        m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
-        UpdateSetting(1);
-      }
-      return;
-    }
-    CContextButtons choices;
-    choices.Add(1, 1223);
-    choices.Add(2, 12337);
-    choices.Add(3, 12338);
-    choices.Add(4, 12339);
-    
-    int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
-
-    CStdString newPassword;
-    LockType iLockMode = LOCK_MODE_UNKNOWN;
-    bool bResult = false;
-    switch(choice)
-    {
-    case 1:
-      iLockMode = LOCK_MODE_EVERYONE; //Disabled! Need check routine!!!
-      bResult = true;
-      break;
-    case 2:
-      iLockMode = LOCK_MODE_NUMERIC;
-      bResult = CGUIDialogNumeric::ShowAndVerifyNewPassword(newPassword);
-      break;
-    case 3:
-      iLockMode = LOCK_MODE_GAMEPAD;
-      bResult = CGUIDialogGamepad::ShowAndVerifyNewPassword(newPassword);
-      break;
-    case 4:
-      iLockMode = LOCK_MODE_QWERTY;
-      bResult = CGUIKeyboardFactory::ShowAndVerifyNewPassword(newPassword);
-      break;
-    default:
-      break;
-    }
-    if (bResult)
-    {
-      if (iLockMode == LOCK_MODE_EVERYONE)
-        newPassword = "-";
-      m_locks.code = newPassword;
-      if (m_locks.code == "-")
-        iLockMode = LOCK_MODE_EVERYONE;
-      m_locks.mode = iLockMode;
-      if (m_bDetails)
-        EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
-      m_bChanged = true;
-      if (m_locks.mode != LOCK_MODE_EVERYONE)
-        setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
-      else
-        setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
-
-      UpdateSetting(1);
-    }
-  }
-  if (setting.id == 2 && m_bGetUser)
-  {
-    CStdString strHeading;
-    CStdString strDecodeUrl = m_strURL;
-    CURL::Decode(strDecodeUrl);
-    strHeading.Format("%s %s",g_localizeStrings.Get(20143).c_str(),strDecodeUrl.c_str());
-    if (CGUIKeyboardFactory::ShowAndGetInput(m_locks.code,strHeading,true,true))
-    {
-      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
-      m_bChanged = true;
-      UpdateSetting(2);
-    }
-    return;
-  }
-  if (setting.id > 1)
-    m_bChanged = true;
-}
-
-bool CGUIDialogLockSettings::ShowAndGetUserAndPassword(CStdString& strUser, CStdString& strPassword, const CStdString& strURL, bool *saveUserDetails)
-{
-  CGUIDialogLockSettings *dialog = (CGUIDialogLockSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_LOCK_SETTINGS);
-  if (!dialog) return false;
-  dialog->m_bGetUser = true;
-  dialog->m_locks.code = strPassword;
-  dialog->m_strUser = strUser;
-  dialog->m_strURL = strURL;
-  dialog->m_bChanged = false;
-  dialog->m_saveUserDetails = saveUserDetails;
-  dialog->DoModal();
-  if (dialog->m_bChanged)
-  {
-    strUser = dialog->m_strUser;
-    strPassword = dialog->m_locks.code;
-    return true;
-  }
-
-  return false;
-}
-
-bool CGUIDialogLockSettings::ShowAndGetLock(LockType& iLockMode, CStdString& strPassword, int iHeader)
-{
-  CProfile::CLock locks(iLockMode, strPassword);
-  if (ShowAndGetLock(locks, iHeader, false, false))
-  {
-    locks.Validate();
-    iLockMode = locks.mode;
-    strPassword = locks.code;
-    return true;
-  }
-  return false;
-}
-
-bool CGUIDialogLockSettings::ShowAndGetLock(CProfile::CLock &locks, int iButtonLabel, bool bConditional, bool bDetails)
-{
-  CGUIDialogLockSettings *dialog = (CGUIDialogLockSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_LOCK_SETTINGS);
-  if (!dialog) return false;
-  dialog->m_locks = locks;
-  dialog->m_iButtonLabel = iButtonLabel;
-  dialog->m_bChanged = false;
-  dialog->m_bGetUser = false;
-  dialog->m_bConditionalDetails = bConditional;
-  dialog->m_bDetails = bDetails;
-  dialog->DoModal();
-  if (dialog->m_bChanged)
-  {
-    locks = dialog->m_locks;
-    return true;
-  }
-
-  return false;
-}
diff --git a/xbmc/settings/GUIDialogLockSettings.h b/xbmc/settings/GUIDialogLockSettings.h
deleted file mode 100644 (file)
index 216880c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogSettings.h"
-#include "GUIPassword.h"
-#include "Profile.h"
-
-class CGUIDialogLockSettings : public CGUIDialogSettings
-{
-public:
-  CGUIDialogLockSettings(void);
-  virtual ~CGUIDialogLockSettings(void);
-  static bool ShowAndGetLock(LockType& iLockMode, CStdString& strPassword, int iHeader=20091);
-  static bool ShowAndGetLock(CProfile::CLock &locks, int iButtonLabel = 20091, bool bConditional = false, bool bDetails = true);
-  static bool ShowAndGetUserAndPassword(CStdString& strUser, CStdString& strPassword, const CStdString& strURL, bool *saveUserDetails);
-protected:
-  virtual void OnCancel();
-  virtual void SetupPage();
-  virtual void CreateSettings();
-  virtual void OnSettingChanged(SettingInfo &setting);
-  void EnableDetails(bool bEnable);
-
-  CProfile::CLock m_locks;
-  CStdString m_strUser;
-  CStdString m_strURL;
-  bool m_bChanged;
-  bool m_bDetails;
-  bool m_bConditionalDetails;
-  bool m_bGetUser;
-  int m_iButtonLabel;
-  bool *m_saveUserDetails;
-};
-
-
diff --git a/xbmc/settings/GUIDialogProfileSettings.cpp b/xbmc/settings/GUIDialogProfileSettings.cpp
deleted file mode 100644 (file)
index 052cb11..0000000
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogProfileSettings.h"
-#include "dialogs/GUIDialogFileBrowser.h"
-#include "guilib/GUIKeyboardFactory.h"
-#include "GUIDialogLockSettings.h"
-#include "guilib/GUIImage.h"
-#include "guilib/GUIWindowManager.h"
-#include "storage/MediaManager.h"
-#include "Util.h"
-#include "utils/URIUtils.h"
-#include "GUIPassword.h"
-#include "dialogs/GUIDialogYesNo.h"
-#include "filesystem/Directory.h"
-#include "filesystem/File.h"
-#include "FileItem.h"
-#include "Settings.h"
-#include "GUISettings.h"
-#include "guilib/LocalizeStrings.h"
-#include "TextureCache.h"
-
-using namespace XFILE;
-
-#define CONTROL_PROFILE_IMAGE       2
-#define CONTROL_START              30
-
-CGUIDialogProfileSettings::CGUIDialogProfileSettings(void)
-    : CGUIDialogSettings(WINDOW_DIALOG_PROFILE_SETTINGS, "ProfileSettings.xml")
-{
-  m_bNeedSave = false;
-}
-
-CGUIDialogProfileSettings::~CGUIDialogProfileSettings(void)
-{
-}
-
-bool CGUIDialogProfileSettings::OnMessage(CGUIMessage &message)
-{
-  if (message.GetMessage() == GUI_MSG_CLICKED)
-  {
-    int iControl = message.GetSenderId();
-    if (iControl == 500)
-      Close();
-    if (iControl == 501)
-    {
-      m_bNeedSave = false;
-      Close();
-    }
-  }
-  return CGUIDialogSettings::OnMessage(message);
-}
-
-void CGUIDialogProfileSettings::OnWindowLoaded()
-{
-  CGUIDialogSettings::OnWindowLoaded();
-  CGUIImage *pImage = (CGUIImage*)GetControl(2);
-  m_strDefaultImage = pImage ? pImage->GetFileName() : "";
-}
-
-void CGUIDialogProfileSettings::SetupPage()
-{
-  CGUIDialogSettings::SetupPage();
-  SET_CONTROL_LABEL(1000,m_strName);
-  SET_CONTROL_LABEL(1001,m_strDirectory);
-  CGUIImage *pImage = (CGUIImage*)GetControl(2);
-  if (pImage)
-    pImage->SetFileName(!m_strThumb.IsEmpty() ? m_strThumb : m_strDefaultImage);
-}
-
-void CGUIDialogProfileSettings::CreateSettings()
-{
-  // clear out any old settings
-  m_settings.clear();
-
-  AddButton(1,20093);
-  AddButton(2,20065);
-  if (!m_bIsDefault && m_bShowDetails)
-    AddButton(3,20070);
-
-  if (m_bShowDetails)
-    AddButton(4,20066);
-  if (!m_bShowDetails && m_locks.mode == LOCK_MODE_EVERYONE && g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
-    AddButton(4,20066);
-
-  if (!m_bIsDefault && m_bShowDetails)
-  {
-    SettingInfo setting;
-    setting.id = 5;
-    setting.name = g_localizeStrings.Get(20060);
-    setting.data = &m_iDbMode;
-    setting.type = SettingInfo::SPIN;
-    setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20062)));
-    setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20063)));
-    setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20061)));
-    if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
-      setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20107)));
-
-    m_settings.push_back(setting);
-
-    SettingInfo setting2;
-    setting2.id = 6;
-    setting2.name = g_localizeStrings.Get(20094);
-    setting2.data = &m_iSourcesMode;
-    setting2.type = SettingInfo::SPIN;
-    setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20062)));
-    setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20063)));
-    setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20061)));
-    if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
-      setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20107)));
-
-    m_settings.push_back(setting2);
-  }
-}
-
-void CGUIDialogProfileSettings::OnSettingChanged(unsigned int num)
-{
-  // setting has changed - update anything that needs it
-  if (num >= m_settings.size()) return;
-  OnSettingChanged(m_settings.at(num));
-}
-
-void CGUIDialogProfileSettings::OnSettingChanged(SettingInfo &setting)
-{
-  // check and update anything that needs it
-  if (setting.id == 1)
-  {
-    if (CGUIKeyboardFactory::ShowAndGetInput(m_strName,g_localizeStrings.Get(20093),false))
-    {
-      m_bNeedSave = true;
-      SET_CONTROL_LABEL(1000,m_strName);
-    }
-  }
-  if (setting.id == 2)
-  {
-    CStdString strThumb;
-    VECSOURCES shares;
-    g_mediaManager.GetLocalDrives(shares);
-    CFileItemList items;
-    if (!m_strThumb.IsEmpty())
-    {
-      CFileItemPtr item(new CFileItem("thumb://Current", false));
-      item->SetArt("thumb", m_strThumb);
-      item->SetLabel(g_localizeStrings.Get(20016));
-      items.Add(item);
-    }
-    CFileItemPtr item(new CFileItem("thumb://None", false));
-    item->SetArt("thumb", m_strDefaultImage);
-    item->SetLabel(g_localizeStrings.Get(20018));
-    items.Add(item);
-    if (CGUIDialogFileBrowser::ShowAndGetImage(items,shares,g_localizeStrings.Get(1030),strThumb) &&
-        !strThumb.Equals("thumb://Current"))
-    {
-      m_bNeedSave = true;
-      m_strThumb = strThumb.Equals("thumb://None") ? "" : strThumb;
-
-      CGUIImage *pImage = (CGUIImage*)GetControl(2);
-      if (pImage)
-      {
-        pImage->SetFileName("");
-        pImage->SetInvalid();
-        pImage->SetFileName(!m_strThumb.IsEmpty() ? m_strThumb : m_strDefaultImage);
-      }
-    }
-  }
-  if (setting.id == 3)
-  {
-    if (OnProfilePath(m_strDirectory, m_bIsDefault))
-    {
-      m_bNeedSave = true;
-      SET_CONTROL_LABEL(1001,m_strDirectory);
-    }
-  }
-
-  if (setting.id == 4)
-  {
-    if (m_bShowDetails)
-    {
-      if (g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE && !m_bIsDefault)
-      {
-        if (CGUIDialogYesNo::ShowAndGetInput(20066,20118,20119,20022))
-          g_passwordManager.SetMasterLockMode(false);
-        if (g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE)
-          return;
-      }
-      if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_bIsDefault ? 12360 : 20068, g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE || m_bIsDefault))
-        m_bNeedSave = true;
-    }
-    else
-    {
-      if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_bIsDefault ? 12360 : 20068, false, false))
-        m_bNeedSave = true;
-    }
-  }
-  if (setting.id > 4)
-    m_bNeedSave = true;
-}
-
-void CGUIDialogProfileSettings::OnCancel()
-{
-  m_bNeedSave = false;
-}
-
-bool CGUIDialogProfileSettings::OnProfilePath(CStdString &dir, bool isDefault)
-{
-  VECSOURCES shares;
-  CMediaSource share;
-  share.strName = "Profiles";
-  share.strPath = "special://masterprofile/profiles/";
-  shares.push_back(share);
-  CStdString strDirectory;
-  if (dir.IsEmpty())
-    strDirectory = share.strPath;
-  else
-    strDirectory = URIUtils::AddFileToFolder("special://masterprofile/", dir);
-  if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares,g_localizeStrings.Get(657),strDirectory,true))
-  {
-    dir = strDirectory;
-    if (!isDefault)
-      dir.erase(0,24);
-    return true;
-  }
-  return false;
-}
-
-bool CGUIDialogProfileSettings::ShowForProfile(unsigned int iProfile, bool firstLogin)
-{
-  CGUIDialogProfileSettings *dialog = (CGUIDialogProfileSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_PROFILE_SETTINGS);
-  if (!dialog) return false;
-  if (iProfile == 0)
-    dialog->m_bIsDefault = true;
-  else
-    dialog->m_bIsDefault = false;
-  if (firstLogin && iProfile > g_settings.GetNumProfiles())
-    return false;
-
-  dialog->m_bNeedSave = false;
-  dialog->m_bShowDetails = !firstLogin;
-  dialog->SetProperty("heading", g_localizeStrings.Get(firstLogin ? 20255 : 20067));
-
-  const CProfile *profile = g_settings.GetProfile(iProfile);
-
-  if (!profile)
-  { // defaults
-    dialog->m_strName.Empty();
-    dialog->m_iDbMode = 2;
-    dialog->m_iSourcesMode = 2;
-    dialog->m_locks = CProfile::CLock();
-
-    bool bLock = g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser;
-    dialog->m_locks.addonManager = bLock;
-    dialog->m_locks.settings = bLock;
-    dialog->m_locks.files = bLock;
-
-    dialog->m_strDirectory.Empty();
-    dialog->m_strThumb.Empty();
-    // prompt for a name
-    if (!CGUIKeyboardFactory::ShowAndGetInput(dialog->m_strName,g_localizeStrings.Get(20093),false) || dialog->m_strName.IsEmpty())
-      return false;
-    // create a default path
-    CStdString defaultDir = URIUtils::AddFileToFolder("profiles",CUtil::MakeLegalFileName(dialog->m_strName));
-    URIUtils::AddSlashAtEnd(defaultDir);
-    CDirectory::Create(URIUtils::AddFileToFolder("special://masterprofile/", defaultDir));
-    // prompt for the user to change it if they want
-    CStdString userDir = defaultDir;
-    if (dialog->OnProfilePath(userDir, false)) // can't be the master user
-    {
-      if (userDir.Left(defaultDir.GetLength()) != defaultDir) // user chose a different folder
-        CDirectory::Remove(URIUtils::AddFileToFolder("special://masterprofile/", defaultDir));
-    }
-    dialog->m_strDirectory = userDir;
-    dialog->m_bNeedSave = true;
-  }
-  else
-  {
-    dialog->m_strName = profile->getName();
-    dialog->m_strThumb = profile->getThumb();
-    dialog->m_strDirectory = profile->getDirectory();
-    dialog->m_iDbMode = profile->canWriteDatabases()?0:1;
-    dialog->m_iSourcesMode = profile->canWriteSources()?0:1;
-    if (profile->hasDatabases())
-      dialog->m_iDbMode += 2;
-    if (profile->hasSources())
-      dialog->m_iSourcesMode += 2;
-
-    dialog->m_locks = profile->GetLocks();
-  }
-  dialog->DoModal();
-  if (dialog->m_bNeedSave)
-  {
-    if (iProfile >= g_settings.GetNumProfiles())
-    {
-      if (dialog->m_strName.IsEmpty() || dialog->m_strDirectory.IsEmpty())
-        return false;
-      /*CStdString strLabel;
-      strLabel.Format(g_localizeStrings.Get(20047),dialog->m_strName);
-      if (!CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(20058),strLabel,dialog->m_strDirectory,""))
-      {
-        CDirectory::Remove(URIUtils::AddFileToFolder(g_settings.GetUserDataFolder(), dialog->m_strDirectory));
-        return false;
-      }*/
-
-      // check for old profile settings
-      CProfile profile(dialog->m_strDirectory,dialog->m_strName,g_settings.GetNextProfileId());
-      g_settings.AddProfile(profile);
-      bool bExists = CFile::Exists(URIUtils::AddFileToFolder("special://masterprofile/",
-                                                          dialog->m_strDirectory+"/guisettings.xml"));
-
-      if (bExists)
-        if (!CGUIDialogYesNo::ShowAndGetInput(20058,20104,20105,20022))
-          bExists = false;
-
-      if (!bExists)
-      {
-        // save new profile guisettings
-        if (CGUIDialogYesNo::ShowAndGetInput(20058,20048,20102,20022,20044,20064))
-        {
-          CFile::Cache(URIUtils::AddFileToFolder("special://masterprofile/","guisettings.xml"),
-                       URIUtils::AddFileToFolder("special://masterprofile/",
-                                              dialog->m_strDirectory+"/guisettings.xml"));
-        }
-        else
-        {
-          // create some new settings
-          CGUISettings localSettings;
-          localSettings.Initialize();
-          CStdString path = URIUtils::AddFileToFolder("special://masterprofile/", dialog->m_strDirectory);
-          path = URIUtils::AddFileToFolder(path, "guisettings.xml");
-          CSettings settings;
-          settings.Initialize();
-          settings.SaveSettings(path, &localSettings);
-        }
-      }
-
-      bExists = CFile::Exists(URIUtils::AddFileToFolder("special://masterprofile/",
-                                                     dialog->m_strDirectory+"/sources.xml"));
-      if (bExists)
-        if (!CGUIDialogYesNo::ShowAndGetInput(20058,20106,20105,20022))
-          bExists = false;
-
-      if (!bExists)
-      {
-        if ((dialog->m_iSourcesMode & 2) == 2)
-          if (CGUIDialogYesNo::ShowAndGetInput(20058,20071,20102,20022,20044,20064))
-          {
-            CFile::Cache(URIUtils::AddFileToFolder("special://masterprofile/","sources.xml"),
-                         URIUtils::AddFileToFolder("special://masterprofile/",
-                         dialog->m_strDirectory+"/sources.xml"));
-          }
-      }
-    }
-
-    /*if (!dialog->m_bIsNewUser)
-      if (!CGUIDialogYesNo::ShowAndGetInput(20067,20103,20022,20022))
-        return false;*/
-
-    CProfile *profile = g_settings.GetProfile(iProfile);
-    assert(profile);
-    profile->setName(dialog->m_strName);
-    profile->setDirectory(dialog->m_strDirectory);
-    profile->setThumb(dialog->m_strThumb);
-    profile->setWriteDatabases(!((dialog->m_iDbMode & 1) == 1));
-    profile->setWriteSources(!((dialog->m_iSourcesMode & 1) == 1));
-    profile->setDatabases((dialog->m_iDbMode & 2) == 2);
-    profile->setSources((dialog->m_iSourcesMode & 2) == 2);
-    profile->SetLocks(dialog->m_locks);
-
-    g_settings.SaveProfiles(PROFILES_FILE);
-    return true;
-  }
-
-  return !dialog->m_bNeedSave;
-}
-
diff --git a/xbmc/settings/GUIDialogProfileSettings.h b/xbmc/settings/GUIDialogProfileSettings.h
deleted file mode 100644 (file)
index e7b1c47..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogSettings.h"
-#include "MediaSource.h"
-#include "Profile.h"
-
-class CGUIDialogProfileSettings : public CGUIDialogSettings
-{
-public:
-  CGUIDialogProfileSettings(void);
-  virtual ~CGUIDialogProfileSettings(void);
-  virtual bool OnMessage(CGUIMessage &message);
-
-  static bool ShowForProfile(unsigned int iProfile, bool firstLogin = false);
-protected:
-  virtual void OnCancel();
-  virtual void OnWindowLoaded();
-  virtual void SetupPage();
-  virtual void CreateSettings();
-  void OnSettingChanged(unsigned int setting);
-  virtual void OnSettingChanged(SettingInfo &setting);
-
-  /*! \brief Prompt for a change in profile path
-   \param dir Current directory for the profile, new profile directory will be returned here
-   \param isDefault whether this is the default profile or not
-   \return true if the profile path has been changed, false otherwise.
-   */
-  bool OnProfilePath(CStdString &dir, bool isDefault);
-
-  bool m_bNeedSave;
-  CStdString m_strName;
-  CStdString m_strThumb;
-  CStdString m_strDirectory;
-  int m_iSourcesMode;
-  int m_iDbMode;
-  bool m_bIsDefault;
-  bool m_bIsNewUser;
-  bool m_bShowDetails;
-
-  CProfile::CLock m_locks;
-  CStdString m_strDefaultImage;
-};
-
diff --git a/xbmc/settings/GUIDialogSettings.cpp b/xbmc/settings/GUIDialogSettings.cpp
deleted file mode 100644 (file)
index e834c09..0000000
+++ /dev/null
@@ -1,692 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIDialogSettings.h"
-#include "guilib/GUIEditControl.h"
-#include "guilib/GUISpinControlEx.h"
-#include "guilib/GUIRadioButtonControl.h"
-#include "guilib/GUISettingsSliderControl.h"
-#include "guilib/GUIImage.h"
-#include "guilib/GUIControlGroupList.h"
-#include "guilib/LocalizeStrings.h"
-#include "GUISettings.h"
-#include "utils/log.h"
-#include "guilib/GUIKeyboardFactory.h"
-
-#define CONTROL_GROUP_LIST          5
-#define CONTROL_SETTINGS_LABEL      2
-#define CONTROL_NONE_AVAILABLE      3
-#define CONTROL_DEFAULT_BUTTON      7
-#define CONTROL_DEFAULT_RADIOBUTTON 8
-#define CONTROL_DEFAULT_SPIN        9
-#define CONTROL_DEFAULT_SLIDER     10
-#define CONTROL_DEFAULT_SEPARATOR  11
-#define CONTROL_DEFAULT_EDIT       12
-#define CONTROL_DEFAULT_EDIT_NUM   13
-#define CONTROL_OKAY_BUTTON        28
-#define CONTROL_CANCEL_BUTTON      29
-#define CONTROL_START              30
-#define CONTROL_PAGE               60
-
-using namespace std;
-
-CGUIDialogSettings::CGUIDialogSettings(int id, const char *xmlFile)
-    : CGUIDialog(id, xmlFile)
-{
-  m_pOriginalEdit = NULL;
-  m_pOriginalEditNum = NULL;
-  m_pOriginalSpin = NULL;
-  m_pOriginalRadioButton = NULL;
-  m_pOriginalSettingsButton = NULL;
-  m_pOriginalSlider = NULL;
-  m_pOriginalSeparator = NULL;
-  m_usePopupSliders = false;
-  m_loadType = KEEP_IN_MEMORY;
-}
-
-CGUIDialogSettings::~CGUIDialogSettings(void)
-{
-}
-
-bool CGUIDialogSettings::OnMessage(CGUIMessage &message)
-{
-  switch (message.GetMessage())
-  {
-  case GUI_MSG_CLICKED:
-    {
-      unsigned int iControl = message.GetSenderId();
-      if (iControl >= CONTROL_OKAY_BUTTON && iControl < CONTROL_PAGE)
-        OnClick(iControl);
-      return true;
-    }
-    break;
-  case GUI_MSG_WINDOW_DEINIT:
-    {
-      CGUIDialog::OnMessage(message);
-      FreeControls();
-      m_settings.clear();
-      return true;
-    }
-    break;
-  }
-  return CGUIDialog::OnMessage(message);
-}
-
-void CGUIDialogSettings::SetupPage()
-{
-  // cleanup first, if necessary
-  FreeControls();
-  m_pOriginalEdit = (CGUIEditControl*)GetControl(CONTROL_DEFAULT_EDIT);
-  m_pOriginalEditNum = (CGUIEditControl*)GetControl(CONTROL_DEFAULT_EDIT_NUM);
-  m_pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN);
-  m_pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON);
-  m_pOriginalSettingsButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON);
-  m_pOriginalSlider = (CGUISettingsSliderControl *)GetControl(CONTROL_DEFAULT_SLIDER);
-  m_pOriginalSeparator = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR);
-  if (m_pOriginalEdit) m_pOriginalEdit->SetVisible(false);
-  if (m_pOriginalEditNum) m_pOriginalEditNum->SetVisible(false);
-  if (m_pOriginalSpin) m_pOriginalSpin->SetVisible(false);
-  if (m_pOriginalRadioButton) m_pOriginalRadioButton->SetVisible(false);
-  if (m_pOriginalSettingsButton) m_pOriginalSettingsButton->SetVisible(false);
-  if (m_pOriginalSlider) m_pOriginalSlider->SetVisible(false);
-  if (m_pOriginalSeparator) m_pOriginalSeparator->SetVisible(false);
-
-  // update our settings label
-  if (GetID() == WINDOW_DIALOG_PVR_TIMER_SETTING)
-  {
-    SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(19057));
-  }
-  else
-  {
-  SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(13395 + GetID() - WINDOW_DIALOG_VIDEO_OSD_SETTINGS));
-  }
-
-  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
-  if (!group)
-    return;
-
-  if (!m_settings.size())
-  { // no settings available
-    SET_CONTROL_VISIBLE(CONTROL_NONE_AVAILABLE);
-    return;
-  }
-  else
-  {
-    SET_CONTROL_HIDDEN(CONTROL_NONE_AVAILABLE);
-  }
-
-  // create our controls
-  for (unsigned int i = 0; i < m_settings.size(); i++)
-  {
-    SettingInfo &setting = m_settings.at(i);
-    AddSetting(setting, group->GetWidth(), CONTROL_START + i);
-  }
-}
-
-void CGUIDialogSettings::EnableSettings(unsigned int id, bool enabled)
-{
-  for (unsigned int i = 0; i < m_settings.size(); i++)
-  {
-    if (m_settings[i].id != id)
-      continue;
-    m_settings[i].enabled = enabled;
-    if (enabled)
-    {
-      CONTROL_ENABLE(i + CONTROL_START);
-    }
-    else
-    {
-      CONTROL_DISABLE(i + CONTROL_START);
-    }
-    return;
-  }
-  CLog::Log(LOGWARNING, "%s - Invalid setting specified", __FUNCTION__);
-}
-
-void CGUIDialogSettings::UpdateSetting(unsigned int id)
-{
-  unsigned int settingNum = (unsigned int)-1;
-  for (unsigned int i = 0; i < m_settings.size(); i++)
-  {
-    if (m_settings[i].id == id)
-    {
-      settingNum = i;
-      break;
-    }
-  }
-  if(settingNum == (unsigned int)-1)
-    return;
-
-  SettingInfo &setting = m_settings.at(settingNum);
-  unsigned int controlID = settingNum + CONTROL_START;
-  if (setting.type == SettingInfo::SPIN)
-  {
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
-    if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
-  }
-  else if (setting.type == SettingInfo::CHECK)
-  {
-    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
-    if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
-  }
-  else if (setting.type == SettingInfo::CHECK_UCHAR)
-  {
-    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
-    if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
-  }
-  else if (setting.type == SettingInfo::SLIDER)
-  {
-    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
-    if (pControl && setting.data)
-    {
-      float value = *(float *)setting.data;
-      pControl->SetFloatValue(value);
-      if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(value, setting.interval));
-    }
-  }
-  else if (setting.type == SettingInfo::BUTTON_DIALOG)
-  {
-    SET_CONTROL_LABEL(controlID,setting.name);
-    CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(controlID);
-    if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
-  }
-  else if (setting.type == SettingInfo::EDIT)
-  {
-    SET_CONTROL_LABEL(controlID, setting.name);
-    if (setting.data) SET_CONTROL_LABEL2(controlID, string(*(CStdString *)setting.data));
-  }
-  else if (setting.type == SettingInfo::EDIT_NUM)
-  {
-    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
-    if (pControl && setting.data) {
-      CStdString strIndex;
-      strIndex.Format("%i", *(int *)setting.data);
-      pControl->SetLabel2(strIndex);
-    }
-  }
-  else if (setting.type == SettingInfo::STRING)
-  {
-    SET_CONTROL_LABEL(controlID, setting.name);
-    string strNewValue = string(*(CStdString *)setting.data);
-    if (strNewValue.empty())
-      strNewValue = "-";
-    SET_CONTROL_LABEL2(controlID, strNewValue);
-  }
-  else if (setting.type == SettingInfo::RANGE)
-  {
-    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
-    float** value = (float **)setting.data;
-    if (pControl && setting.data)
-    {
-      pControl->SetFloatValue(*(value[0]), CGUISliderControl::RangeSelectorLower);
-      pControl->SetFloatValue(*(value[1]), CGUISliderControl::RangeSelectorUpper);
-      if (setting.formatFunction.range) pControl->SetTextValue(setting.formatFunction.range(*(value[0]), *(value[1]), setting.interval));
-    }
-  }
-
-  if (setting.enabled)
-  {
-    CONTROL_ENABLE(controlID);
-  }
-  else
-  {
-    CONTROL_DISABLE(controlID);
-  }
-}
-
-bool CGUIDialogSettings::OnBack(int actionID)
-{
-  OnCancel();
-  return CGUIDialog::OnBack(actionID);
-}
-
-void CGUIDialogSettings::OnClick(int iID)
-{
-  if (iID == CONTROL_OKAY_BUTTON)
-  {
-    OnOkay();
-    Close();
-    return;
-  }
-  if (iID == CONTROL_CANCEL_BUTTON)
-  {
-    OnCancel();
-    Close();
-    return;
-  }
-  unsigned int settingNum = iID - CONTROL_START;
-  if (settingNum >= m_settings.size()) return;
-  SettingInfo &setting = m_settings.at(settingNum);
-  if (setting.type == SettingInfo::SPIN)
-  {
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID);
-    if (setting.data) *(int *)setting.data = pControl->GetValue();
-  }
-  else if (setting.type == SettingInfo::BUTTON_DIALOG)
-  {
-    CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(iID);
-    if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
-  }
-  else if (setting.type == SettingInfo::EDIT)
-  {
-    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
-    if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
-  }
-  else if (setting.type == SettingInfo::EDIT_NUM)
-  {
-    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
-    if (setting.data) {
-        CStdString strIndex = pControl->GetLabel2();
-        *(int *)setting.data = atol(strIndex.c_str());
-    }
-  }
-  else if (setting.type == SettingInfo::CHECK)
-  {
-    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
-    if (setting.data) *(bool *)setting.data = pControl->IsSelected();
-  }
-  else if (setting.type == SettingInfo::CHECK_UCHAR)
-  {
-    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
-    if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0;
-  }
-  else if (setting.type == SettingInfo::SLIDER)
-  {
-    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
-    if (setting.data) *(float *)setting.data = pControl->GetFloatValue();
-    if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(pControl->GetFloatValue(), setting.interval));
-  }
-  else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data)
-  { // we're using popup sliders
-    CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting);
-    if (setting.formatFunction.standard)
-      SET_CONTROL_LABEL2(iID, setting.formatFunction.standard(*(float *)setting.data, setting.interval));
-  }
-  else if (setting.type == SettingInfo::STRING)
-  {
-    CGUIKeyboardFactory::ShowAndGetInput(*(CStdString *) setting.data, true);
-    string strNewValue = string(*(CStdString *)setting.data);
-    if (strNewValue.empty())
-      strNewValue = "-";
-    SET_CONTROL_LABEL2(iID, strNewValue);
-  }
-  else if (setting.type == SettingInfo::RANGE)
-  {
-    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
-    if (setting.data)
-    {
-      *((float **)setting.data)[0] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower);
-      *((float **)setting.data)[1] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper);
-    }
-    if (setting.formatFunction.range)
-      pControl->SetTextValue(setting.formatFunction.range(pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower), 
-                                                          pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper),
-                                                          setting.interval));
-  }
-  OnSettingChanged(setting);
-}
-
-void CGUIDialogSettings::FreeControls()
-{
-  // just clear our group list
-  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
-  if (group)
-  {
-    group->FreeResources();
-    group->ClearAll();
-  }
-}
-
-void CGUIDialogSettings::AddSetting(SettingInfo &setting, float width, int iControlID)
-{
-  CGUIControl *pControl = NULL;
-  if (setting.type == SettingInfo::BUTTON_DIALOG && m_pOriginalSettingsButton)
-  {
-    pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
-    if (!pControl) return ;
-    ((CGUIButtonControl *)pControl)->SetLabel(setting.name);
-    pControl->SetWidth(width);
-       if (setting.data) ((CGUIButtonControl *)pControl)->SetLabel2(*(CStdString *)setting.data);
-  }
-  else if (setting.type == SettingInfo::BUTTON && m_pOriginalSettingsButton)
-  {
-    pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
-    if (!pControl) return ;
-    ((CGUIButtonControl *)pControl)->SetLabel(setting.name);
-    if (setting.formatFunction.standard)
-      ((CGUIButtonControl *)pControl)->SetLabel2(setting.formatFunction.standard(*(float *)setting.data, setting.interval));
-    pControl->SetWidth(width);
-  }
-  else if (setting.type == SettingInfo::EDIT && m_pOriginalEdit)
-  {
-    pControl = new CGUIEditControl(*m_pOriginalEdit);
-    if (!pControl) return ;
-    ((CGUIEditControl *)pControl)->SetLabel(setting.name);
-    pControl->SetWidth(width);
-    if (setting.data) ((CGUIEditControl *)pControl)->SetLabel2(*(CStdString *)setting.data);
-  }
-  else if (setting.type == SettingInfo::EDIT_NUM && m_pOriginalEditNum)
-  {
-    pControl = new CGUIEditControl(*m_pOriginalEditNum);
-    if (!pControl) return ;
-    ((CGUIEditControl *)pControl)->SetLabel(setting.name);
-    pControl->SetWidth(width);
-    ((CGUIEditControl *)pControl)->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, 0);
-    if (setting.data) {
-        CStdString strIndex;
-        strIndex.Format("%i", *(int *)setting.data);
-        ((CGUIEditControl *)pControl)->SetLabel2(strIndex);
-    }
-  }
-  else if (setting.type == SettingInfo::SEPARATOR && m_pOriginalSeparator)
-  {
-    pControl = new CGUIImage(*m_pOriginalSeparator);
-    if (!pControl) return ;
-    pControl->SetWidth(width);
-  }
-  else if (setting.type == SettingInfo::CHECK || setting.type == SettingInfo::CHECK_UCHAR)
-  {
-    if (!m_pOriginalRadioButton) return;
-    pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
-    if (!pControl) return ;
-    ((CGUIRadioButtonControl *)pControl)->SetLabel(setting.name);
-    pControl->SetWidth(width);
-    if (setting.data) ((CGUIRadioButtonControl *)pControl)->SetSelected(*(bool *)setting.data == 1);
-  }
-  else if (setting.type == SettingInfo::SPIN && setting.entry.size() > 0 && m_pOriginalSpin)
-  {
-    pControl = new CGUISpinControlEx(*m_pOriginalSpin);
-    if (!pControl) return ;
-    pControl->SetWidth(width);
-    ((CGUISpinControlEx *)pControl)->SetText(setting.name);
-    pControl->SetWidth(width);
-    for (unsigned int i = 0; i < setting.entry.size(); i++)
-      ((CGUISpinControlEx *)pControl)->AddLabel(setting.entry[i].second, setting.entry[i].first);
-    if (setting.data) ((CGUISpinControlEx *)pControl)->SetValue(*(int *)setting.data);
-  }
-  else if (setting.type == SettingInfo::SLIDER)
-  {
-    if (!m_pOriginalSlider) return;
-    pControl = new CGUISettingsSliderControl(*m_pOriginalSlider);
-    if (!pControl) return ;
-    pControl->SetWidth(width);
-    ((CGUISettingsSliderControl *)pControl)->SetText(setting.name);
-    if (setting.formatFunction.standard)
-      ((CGUISettingsSliderControl *)pControl)->SetTextValue(setting.formatFunction.standard(*(float *)setting.data, setting.interval));
-    ((CGUISettingsSliderControl *)pControl)->SetType(SPIN_CONTROL_TYPE_FLOAT);
-    ((CGUISettingsSliderControl *)pControl)->SetFloatRange(setting.min, setting.max);
-    ((CGUISettingsSliderControl *)pControl)->SetFloatInterval(setting.interval);
-    if (setting.data) ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*(float *)setting.data);
-  }
-  else if (setting.type == SettingInfo::STRING && m_pOriginalSettingsButton)
-  {
-    pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
-    if (!pControl) return ;
-    ((CGUIButtonControl *)pControl)->SetLabel(setting.name);
-    string strValue = string(*(CStdString *)setting.data);
-    if (strValue.empty())
-      strValue = "-";
-    ((CGUIButtonControl *)pControl)->SetLabel2(strValue);
-    pControl->SetWidth(width);
-  }
-  else if (setting.type == SettingInfo::RANGE)
-  {
-    if (!m_pOriginalSlider) return;
-    pControl = new CGUISettingsSliderControl(*m_pOriginalSlider);
-    if (!pControl) return ;
-    pControl->SetWidth(width);
-    ((CGUISettingsSliderControl *)pControl)->SetText(setting.name);
-    if (setting.formatFunction.range)
-      ((CGUISettingsSliderControl *)pControl)->SetTextValue(setting.formatFunction.range(*((float **)setting.data)[0], *((float **)setting.data)[1], setting.interval));
-    ((CGUISettingsSliderControl *)pControl)->SetType(SPIN_CONTROL_TYPE_FLOAT);
-    ((CGUISettingsSliderControl *)pControl)->SetRangeSelection(true);
-    ((CGUISettingsSliderControl *)pControl)->SetFloatRange(setting.min, setting.max);
-    ((CGUISettingsSliderControl *)pControl)->SetFloatInterval(setting.interval);
-    if (setting.data)
-    {
-      ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*((float **)setting.data)[0], CGUISliderControl::RangeSelectorLower);
-      ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*((float **)setting.data)[1], CGUISliderControl::RangeSelectorUpper);
-    }
-  }
-  if (!pControl) return;
-
-  pControl->SetID(iControlID);
-  pControl->SetVisible(true);
-  pControl->SetEnabled(setting.enabled);
-  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
-  if (group)
-  {
-    pControl->AllocResources();
-    group->AddControl(pControl);
-  }
-  else
-    delete pControl;
-}
-
-void CGUIDialogSettings::AddEdit(unsigned int id, int label, CStdString *str, bool enabled)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::EDIT;
-  setting.enabled  = enabled;
-  setting.data = str;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddNumEdit(unsigned int id, int label, int *current, bool enabled)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::EDIT_NUM;
-  setting.enabled  = enabled;
-  setting.data = current;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddButton(unsigned int id, int label, float *current, float min, float interval, float max, FORMATFUNCTION function)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::BUTTON;
-  setting.data = current;
-  setting.min = min;
-  setting.max = max;
-  setting.interval = interval;
-  setting.formatFunction.standard = function;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddButton(unsigned int id, int label, CStdString *str, bool bOn)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::BUTTON_DIALOG;
-  setting.enabled  = bOn;
-  setting.data = str;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddString(unsigned int id, int label, CStdString *current)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::STRING;
-  setting.data = current;
-  setting.enabled = true;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddBool(unsigned int id, int label, bool *on, bool enabled)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::CHECK;
-  setting.data = on;
-  setting.enabled = enabled;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsigned int max, const SETTINGSTRINGS &entries)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::SPIN;
-  setting.data = current;
-  for (unsigned int i = 0; i < max; i++)
-    setting.entry.push_back(make_pair(i, entries[i]));
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsigned int max, const int *entries)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::SPIN;
-  setting.data = current;
-  for (unsigned int i = 0; i < max; i++)
-    setting.entry.push_back(make_pair(i, g_localizeStrings.Get(entries[i])));
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsigned int min, unsigned int max, const char* minLabel)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::SPIN;
-  setting.data = current;
-  for (unsigned int i = min; i <= max; i++)
-  {
-    CStdString format;
-    if (i == min && minLabel)
-      format = minLabel;
-    else
-      format.Format("%i", i);
-    setting.entry.push_back(make_pair(i, format));
-  }
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, vector<pair<int, CStdString> > &values)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::SPIN;
-  setting.data = current;
-  setting.entry = values;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, vector<pair<int, int> > &values)
-{
-  vector<pair<int, CStdString> > entries;
-  for(unsigned i = 0; i < values.size(); i++)
-    entries.push_back(make_pair(values[i].first, g_localizeStrings.Get(values[i].second)));
-  AddSpin(id, label, current, entries);
-}
-
-void CGUIDialogSettings::AddSlider(unsigned int id, int label, float *current, float min, float interval, float max, FORMATFUNCTION function, bool allowPopup /* = true*/)
-{
-  if (m_usePopupSliders && allowPopup)
-  {
-    AddButton(id, label, current, min, interval, max, function);
-    return;
-  }
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::SLIDER;
-  setting.min = min;
-  setting.interval = interval;
-  setting.max = max;
-  setting.data = current;
-  setting.formatFunction.standard = function;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddRangeSlider(unsigned int id, int label, float *currentLower, float* currentUpper, float min, float interval, float max, RANGEFORMATFUNCTION function)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.name = g_localizeStrings.Get(label);
-  setting.type = SettingInfo::RANGE;
-  setting.min = min;
-  setting.interval = interval;
-  setting.max = max;
-
-  float** data = new float*[2];
-  data[0] = currentLower;
-  data[1] = currentUpper;
-  setting.data = data;
-
-  setting.formatFunction.range = function;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::AddSeparator(unsigned int id)
-{
-  SettingInfo setting;
-  setting.id = id;
-  setting.type = SettingInfo::SEPARATOR;
-  setting.data = NULL;
-  m_settings.push_back(setting);
-}
-
-void CGUIDialogSettings::OnInitWindow()
-{
-  CreateSettings();
-  SetInitialVisibility();
-  SetupPage();
-  // set the default focus control
-  m_lastControlID = CONTROL_START;
-  CGUIDialog::OnInitWindow();
-}
-
-void CGUIDialogSettings::OnSliderChange(void *data, CGUISliderControl *slider)
-{
-  if (!data || !slider)
-    return;
-
-  SettingInfo *setting = (SettingInfo *)data;
-  if (setting->type == SettingInfo::SLIDER || (setting->type == SettingInfo::BUTTON && m_usePopupSliders && !slider->GetRangeSelection()))
-  {
-    *(float *)setting->data = slider->GetFloatValue();
-    OnSettingChanged(*setting);
-    if (setting->formatFunction.standard)
-      slider->SetTextValue(setting->formatFunction.standard(slider->GetFloatValue(), setting->interval));
-  }
-  else if (setting->type == SettingInfo::RANGE || (setting->type == SettingInfo::BUTTON && m_usePopupSliders && slider->GetRangeSelection()))
-  {
-    *((float **)setting->data)[0] = slider->GetFloatValue(CGUISliderControl::RangeSelectorLower);
-    *((float **)setting->data)[1] = slider->GetFloatValue(CGUISliderControl::RangeSelectorUpper);
-    OnSettingChanged(*setting);
-    if (setting->formatFunction.range)
-      slider->SetTextValue(setting->formatFunction.range(slider->GetFloatValue(CGUISliderControl::RangeSelectorLower), slider->GetFloatValue(CGUISliderControl::RangeSelectorUpper), setting->interval));
-  }
-}
diff --git a/xbmc/settings/GUIDialogSettings.h b/xbmc/settings/GUIDialogSettings.h
deleted file mode 100644 (file)
index 6202011..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "guilib/GUIDialog.h"
-#include "dialogs/GUIDialogSlider.h"
-
-class CGUISpinControlEx;
-class CGUIButtonControl;
-class CGUIRadioButtonControl;
-class CGUISettingsSliderControl;
-class CGUIEditControl;
-class CGUIImage;
-class CGUIEditControl;
-
-typedef std::vector<CStdString> SETTINGSTRINGS;
-typedef CStdString (*FORMATFUNCTION) (float value, float min);
-typedef CStdString (*RANGEFORMATFUNCTION) (float valueLower, float valueUpper, float min);
-
-class SettingInfo
-{
-public:
-  enum SETTING_TYPE { NONE=0, EDIT, EDIT_NUM, BUTTON, BUTTON_DIALOG, CHECK, CHECK_UCHAR, SPIN, SLIDER, SEPARATOR, STRING, RANGE };
-  SettingInfo()
-  {
-    id = 0;
-    data = NULL;
-    type = NONE;
-    enabled = true;
-    min = 0;
-    max = 0;
-    interval = 0;
-    formatFunction.standard = NULL;
-  };
-  SETTING_TYPE type;
-  CStdString name;
-  unsigned int id;
-  void *data;
-  float min;
-  float max;
-  float interval;
-  union
-  {
-    FORMATFUNCTION standard;
-    RANGEFORMATFUNCTION range;
-  } formatFunction;
-  std::vector<std::pair<int, CStdString> > entry;
-  bool enabled;
-};
-
-class CGUIDialogSettings :
-      public CGUIDialog, public ISliderCallback
-{
-public:
-  CGUIDialogSettings(int id, const char *xmlFile);
-  virtual ~CGUIDialogSettings(void);
-  virtual bool OnMessage(CGUIMessage &message);
-
-  virtual void OnSliderChange(void *data, CGUISliderControl *slider);
-protected:
-  virtual void OnOkay() {};
-  virtual void OnCancel() {};
-  virtual bool OnBack(int actionID);
-  virtual void OnInitWindow();
-  virtual void SetupPage();
-  virtual void CreateSettings() {};
-  void UpdateSetting(unsigned int setting);
-  void EnableSettings(unsigned int setting, bool enabled);
-  virtual void OnSettingChanged(SettingInfo &setting) {};
-  void FreeControls();
-  void OnClick(int iControlID);
-
-  void AddSetting(SettingInfo &setting, float width, int iControlID);
-
-  void AddEdit(unsigned int id, int label, CStdString *str, bool enabled = true);
-  void AddNumEdit(unsigned int id, int label, int *current, bool enabled = true);
-  void AddButton(unsigned int id, int label, float *current = NULL, float min = 0, float interval = 0, float max = 0, FORMATFUNCTION function = NULL);
-  void AddButton(unsigned int it, int label, CStdString *str, bool bOn=true);
-  void AddBool(unsigned int id, int label, bool *on, bool enabled = true);
-  void AddSpin(unsigned int id, int label, int *current, unsigned int max, const SETTINGSTRINGS &entries);
-  void AddString(unsigned int id, int label, CStdString *current);
-  void AddSpin(unsigned int id, int label, int *current, unsigned int max, const int *entries);
-  void AddSpin(unsigned int id, int label, int *current, unsigned int min, unsigned int max, const char* minLabel = NULL);
-  void AddSpin(unsigned int id, int label, int *current, std::vector<std::pair<int, CStdString> > &values);
-  void AddSpin(unsigned int id, int label, int *current, std::vector<std::pair<int, int> > &values);
-  void AddSlider(unsigned int id, int label, float *current, float min, float interval, float max, FORMATFUNCTION formatFunction, bool allowPopup = true);
-  void AddRangeSlider(unsigned int id, int label, float *currentLower, float* currentUpper, float min, float interval, float max, RANGEFORMATFUNCTION formatFunction);
-  void AddSeparator(unsigned int id);
-
-  CGUIEditControl *m_pOriginalEdit;
-  CGUIEditControl *m_pOriginalEditNum;
-  CGUISpinControlEx *m_pOriginalSpin;
-  CGUIRadioButtonControl *m_pOriginalRadioButton;
-  CGUIButtonControl *m_pOriginalSettingsButton;
-  CGUISettingsSliderControl *m_pOriginalSlider;
-  CGUIImage *m_pOriginalSeparator;
-
-  std::vector<SettingInfo> m_settings;
-
-  bool m_usePopupSliders;
-};
index e92a82d..8dba6d3 100644 (file)
@@ -329,15 +329,6 @@ void CGUISettings::Initialize()
   AddString(NULL, "musicfiles.librarytrackformatright", 13387, "", EDIT_CONTROL_INPUT, false, 16016);
   AddBool(mf, "musicfiles.findremotethumbs", 14059, true);
 
-  CSettingsCategory* scr = AddCategory(SETTINGS_MUSIC, "scrobbler", 15221);
-  AddBool(scr, "scrobbler.lastfmsubmit", 15201, false);
-  AddString(scr,"scrobbler.lastfmusername", 15202, "", EDIT_CONTROL_INPUT, false, 15202);
-  AddString(scr,"scrobbler.lastfmpass", 15203, "", EDIT_CONTROL_MD5_INPUT, false, 15203);
-  AddSeparator(scr, "scrobbler.sep1");
-  AddBool(scr, "scrobbler.librefmsubmit", 15217, false);
-  AddString(scr, "scrobbler.librefmusername", 15218, "", EDIT_CONTROL_INPUT, false, 15218);
-  AddString(scr, "scrobbler.librefmpass", 15219, "", EDIT_CONTROL_MD5_INPUT, false, 15219);
-
   CSettingsCategory* acd = AddCategory(SETTINGS_MUSIC, "audiocds", 620);
   map<int,int> autocd;
   autocd.insert(make_pair(16018, AUTOCD_NONE));
@@ -433,6 +424,7 @@ void CGUISettings::Initialize()
 #else
   AddBool(vs, "videoscreen.blankdisplays", 13130, false);
 #endif
+
   AddSeparator(vs, "videoscreen.sep1");
 #endif
 
@@ -451,6 +443,12 @@ void CGUISettings::Initialize()
   AddString(vs, "videoscreen.testpattern",226,"", BUTTON_CONTROL_STANDARD);
 #endif
 
+#if defined(HAS_GL) || defined(HAS_DX)
+  AddBool(vs  , "videoscreen.limitedrange", 36042, false);
+#else
+  AddBool(NULL, "videoscreen.limitedrange", 36042, false);
+#endif
+
   CSettingsCategory* ao = AddCategory(SETTINGS_SYSTEM, "audiooutput", 772);
 
   map<int,int> audiomode;
@@ -768,7 +766,7 @@ void CGUISettings::Initialize()
   AddSeparator(vp, "videoplayer.sep1.5");
 #ifdef HAVE_LIBVDPAU
   AddBool(NULL, "videoplayer.vdpauUpscalingLevel", 13121, false);
-  AddBool(vp, "videoplayer.vdpaustudiolevel", 13122, false);
+  AddBool(NULL, "videoplayer.vdpaustudiolevel", 0, false); //depreciated
 #endif
 #endif
   AddSeparator(vp, "videoplayer.sep5");
@@ -1411,6 +1409,13 @@ void CGUISettings::LoadXML(TiXmlElement *pRootElement, bool hideSettings /* = fa
     SetInt("videoscreen.vsync", VSYNC_ALWAYS);
   }
 #endif
+
+  // map old vpdau color range, to now global setting
+  if (GetBool("videoplayer.vdpaustudiolevel"))
+  {
+    SetBool("videoscreen.limitedrange", true);
+    SetBool("videoplayer.vdpaustudiolevel", false);
+  }
  // DXMERGE: This might have been useful?
  // g_videoConfig.SetVSyncMode((VSYNC)GetInt("videoscreen.vsync"));
 
diff --git a/xbmc/settings/GUIWindowSettings.cpp b/xbmc/settings/GUIWindowSettings.cpp
deleted file mode 100644 (file)
index 2aa675f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "system.h"
-#include "GUIWindowSettings.h"
-#include "guilib/Key.h"
-
-CGUIWindowSettings::CGUIWindowSettings(void)
-    : CGUIWindow(WINDOW_SETTINGS_MENU, "Settings.xml")
-{
-  m_loadType = KEEP_IN_MEMORY;
-}
-
-CGUIWindowSettings::~CGUIWindowSettings(void)
-{
-}
diff --git a/xbmc/settings/GUIWindowSettings.h b/xbmc/settings/GUIWindowSettings.h
deleted file mode 100644 (file)
index 6030222..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "guilib/GUIWindow.h"
-
-class CGUIWindowSettings :
-      public CGUIWindow
-{
-public:
-  CGUIWindowSettings(void);
-  virtual ~CGUIWindowSettings(void);
-};
diff --git a/xbmc/settings/GUIWindowSettingsCategory.cpp b/xbmc/settings/GUIWindowSettingsCategory.cpp
deleted file mode 100644 (file)
index cb94f01..0000000
+++ /dev/null
@@ -1,2994 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "system.h"
-#include "GUIUserMessages.h"
-#include "GUIWindowSettingsCategory.h"
-#include "Application.h"
-#include "ApplicationMessenger.h"
-#include "interfaces/Builtins.h"
-#include "input/KeyboardLayoutConfiguration.h"
-#include "filesystem/Directory.h"
-#include "Util.h"
-#include "guilib/GUISpinControlEx.h"
-#include "guilib/GUIRadioButtonControl.h"
-#include "guilib/GUIEditControl.h"
-#include "guilib/GUIImage.h"
-#include "utils/Weather.h"
-#include "music/MusicDatabase.h"
-#include "video/VideoDatabase.h"
-#include "view/ViewDatabase.h"
-#include "PlayListPlayer.h"
-#include "addons/Skin.h"
-#include "guilib/GUIAudioManager.h"
-#include "network/libscrobbler/lastfmscrobbler.h"
-#include "network/libscrobbler/librefmscrobbler.h"
-#include "GUIPassword.h"
-#include "GUIInfoManager.h"
-#include "dialogs/GUIDialogGamepad.h"
-#include "dialogs/GUIDialogNumeric.h"
-#include "dialogs/GUIDialogFileBrowser.h"
-#include "addons/GUIDialogAddonSettings.h"
-#include "addons/GUIWindowAddonBrowser.h"
-#include "dialogs/GUIDialogContextMenu.h"
-#include "dialogs/GUIDialogYesNo.h"
-#include "dialogs/GUIDialogOK.h"
-#include "dialogs/GUIDialogProgress.h"
-#include "dialogs/GUIDialogKaiToast.h"
-#include "addons/Visualisation.h"
-#include "addons/AddonManager.h"
-#include "addons/AddonInstaller.h"
-#include "storage/MediaManager.h"
-#include "network/Network.h"
-#include "guilib/GUIControlGroupList.h"
-#include "guilib/GUIWindowManager.h"
-#include "guilib/GUIFontManager.h"
-#include "cores/AudioEngine/AEFactory.h"
-#ifdef _LINUX
-#include "LinuxTimezone.h"
-#include <dlfcn.h>
-#ifdef HAS_HAL
-#include "HALManager.h"
-#endif
-#endif
-#if defined(TARGET_DARWIN_OSX)
-#include "osx/XBMCHelper.h"
-#endif
-#include "network/GUIDialogAccessPoints.h"
-#include "filesystem/Directory.h"
-
-#include "FileItem.h"
-#include "guilib/GUIToggleButtonControl.h"
-#include "filesystem/SpecialProtocol.h"
-
-#include "network/Zeroconf.h"
-#include "peripherals/Peripherals.h"
-#include "peripherals/dialogs/GUIDialogPeripheralManager.h"
-#include "peripherals/devices/PeripheralImon.h"
-
-#ifdef _WIN32
-#include "WIN32Util.h"
-#endif
-#include <map>
-#include "Settings.h"
-#include "AdvancedSettings.h"
-#include "input/MouseStat.h"
-#if defined(TARGET_WINDOWS)
-#include "input/windows/WINJoystick.h"
-#elif defined(HAS_SDL_JOYSTICK)
-#include "input/SDLJoystick.h"
-#endif
-#include "guilib/LocalizeStrings.h"
-#include "LangInfo.h"
-#include "utils/StringUtils.h"
-#include "utils/URIUtils.h"
-#include "utils/SystemInfo.h"
-#include "windowing/WindowingFactory.h"
-#include "pvr/dialogs/GUIDialogPVRChannelManager.h"
-#include "pvr/PVRManager.h"
-#include "pvr/addons/PVRClients.h"
-
-#if defined(HAVE_LIBCRYSTALHD)
-#include "cores/dvdplayer/DVDCodecs/Video/CrystalHD.h"
-#endif
-
-#if defined(HAS_AIRPLAY)
-#include "network/AirPlayServer.h"
-#endif
-
-#if defined(HAS_WEB_SERVER)
-#include "network/WebServer.h"
-#endif
-
-using namespace std;
-using namespace XFILE;
-using namespace ADDON;
-using namespace PVR;
-using namespace PERIPHERALS;
-
-#define CONTROL_GROUP_BUTTONS           0
-#define CONTROL_GROUP_SETTINGS          1
-#define CONTROL_SETTINGS_LABEL          2
-#define CATEGORY_GROUP_ID               3
-#define SETTINGS_GROUP_ID               5
-#define CONTROL_DEFAULT_BUTTON          7
-#define CONTROL_DEFAULT_RADIOBUTTON     8
-#define CONTROL_DEFAULT_SPIN            9
-#define CONTROL_DEFAULT_CATEGORY_BUTTON 10
-#define CONTROL_DEFAULT_SEPARATOR       11
-#define CONTROL_DEFAULT_EDIT            12
-#define CONTROL_START_BUTTONS           -100
-#define CONTROL_START_CONTROL           -80
-
-CGUIWindowSettingsCategory::CGUIWindowSettingsCategory(void)
-    : CGUIWindow(WINDOW_SETTINGS_MYPICTURES, "SettingsCategory.xml")
-{
-  m_loadType = KEEP_IN_MEMORY;
-  m_pOriginalSpin = NULL;
-  m_pOriginalRadioButton = NULL;
-  m_pOriginalButton = NULL;
-  m_pOriginalCategoryButton = NULL;
-  m_pOriginalImage = NULL;
-  m_pOriginalEdit = NULL;
-  // set the correct ID range...
-  m_idRange.clear();
-  m_idRange.push_back(WINDOW_SETTINGS_MYPICTURES);
-  m_idRange.push_back(WINDOW_SETTINGS_MYPROGRAMS);
-  m_idRange.push_back(WINDOW_SETTINGS_MYWEATHER);
-  m_idRange.push_back(WINDOW_SETTINGS_MYMUSIC);
-  m_idRange.push_back(WINDOW_SETTINGS_SYSTEM);
-  m_idRange.push_back(WINDOW_SETTINGS_MYVIDEOS);
-  m_idRange.push_back(WINDOW_SETTINGS_SERVICE);
-  m_idRange.push_back(WINDOW_SETTINGS_APPEARANCE);
-  m_idRange.push_back(WINDOW_SETTINGS_MYPVR);
-
-  m_iScreen = 0;
-  m_strOldTrackFormat = "";
-  m_strOldTrackFormatRight = "";
-  m_returningFromSkinLoad = false;
-  m_delayedSetting.reset();
-}
-
-CGUIWindowSettingsCategory::~CGUIWindowSettingsCategory(void)
-{
-  FreeControls();
-  delete m_pOriginalEdit;
-}
-
-bool CGUIWindowSettingsCategory::OnBack(int actionID)
-{
-  g_settings.Save();
-  m_lastControlID = 0; // don't save the control as we go to a different window each time
-  return CGUIWindow::OnBack(actionID);
-}
-
-bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
-{
-  switch (message.GetMessage())
-  {
-  case GUI_MSG_CLICKED:
-    {
-      unsigned int iControl = message.GetSenderId();
-      for (unsigned int i = 0; i < m_vecSettings.size(); i++)
-      {
-        if (m_vecSettings[i]->GetID() == (int)iControl)
-          OnClick(m_vecSettings[i]);
-      }
-    }
-    break;
-  case GUI_MSG_FOCUSED:
-    {
-      CGUIWindow::OnMessage(message);
-      int focusedControl = GetFocusedControlID();
-      if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_vecSections.size()) &&
-          focusedControl - CONTROL_START_BUTTONS != m_iSection && !m_returningFromSkinLoad)
-      {
-        // changing section, check for updates and cancel any delayed changes
-        m_delayedSetting.reset();
-        CheckForUpdates();
-
-        if (m_vecSections[focusedControl-CONTROL_START_BUTTONS]->m_strCategory == "masterlock")
-        {
-          if (!g_passwordManager.IsMasterLockUnlocked(true))
-          { // unable to go to this category - focus the previous one
-            SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iSection, 0);
-            return false;
-          }
-        }
-        if (m_vecSections[focusedControl-CONTROL_START_BUTTONS]->m_strCategory == "pvrparental")
-        {
-          if (!g_PVRManager.CheckParentalPIN(g_localizeStrings.Get(19262).c_str()))
-          { // unable to go to this category - focus the previous one
-            SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iSection, 0);
-            return false;
-          }
-        }
-
-        m_iSection = focusedControl - CONTROL_START_BUTTONS;
-
-        CreateSettings();
-      }
-      return true;
-    }
-    break;
-  case GUI_MSG_LOAD_SKIN:
-    {
-      if (IsActive())
-        m_returningFromSkinLoad = true;
-    }
-    break;
-  case GUI_MSG_WINDOW_INIT:
-    {
-      m_delayedSetting.reset();
-      if (message.GetParam1() != WINDOW_INVALID && !m_returningFromSkinLoad)
-      { // coming to this window first time (ie not returning back from some other window)
-        // so we reset our section and control states
-        m_iSection = 0;
-        ResetControlStates();
-      }
-      m_iScreen = (int)message.GetParam2() - (int)CGUIWindow::GetID();
-      CGUIWindow::OnMessage(message);
-      m_returningFromSkinLoad = false;
-      return true;
-    }
-    break;
-  case GUI_MSG_UPDATE_ITEM:
-    if (m_delayedSetting)
-    {
-      OnSettingChanged(m_delayedSetting);
-      m_delayedSetting.reset();
-      return true;
-    }
-    break;
-  case GUI_MSG_UPDATE:
-    if (HasID(message.GetSenderId()))
-    {
-      int focusedControl = GetFocusedControlID();
-      CreateSettings();
-      SET_CONTROL_FOCUS(focusedControl, 0);
-    }
-    break;
-  case GUI_MSG_NOTIFY_ALL:
-    {
-      if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE)
-      {
-        // Cancel delayed setting - it's only used for res changing anyway
-        m_delayedSetting.reset();
-        if (IsActive() && g_guiSettings.GetResolution() != g_graphicsContext.GetVideoResolution())
-        {
-          g_guiSettings.SetResolution(g_graphicsContext.GetVideoResolution());
-          CreateSettings();
-        }
-      }
-    }
-    break;
-  case GUI_MSG_WINDOW_DEINIT:
-    {
-      m_delayedSetting.reset();
-
-      CheckForUpdates();
-      CGUIWindow::OnMessage(message);
-      FreeControls();
-      return true;
-    }
-    break;
-  }
-  return CGUIWindow::OnMessage(message);
-}
-
-void CGUIWindowSettingsCategory::SetupControls()
-{
-  // cleanup first, if necessary
-  FreeControls();
-  m_pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN);
-  m_pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON);
-  m_pOriginalCategoryButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_CATEGORY_BUTTON);
-  m_pOriginalButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON);
-  m_pOriginalImage = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR);
-  if (!m_pOriginalCategoryButton || !m_pOriginalSpin || !m_pOriginalRadioButton || !m_pOriginalButton)
-    return ;
-  m_pOriginalEdit = (CGUIEditControl *)GetControl(CONTROL_DEFAULT_EDIT);
-  if (!m_pOriginalEdit || m_pOriginalEdit->GetControlType() != CGUIControl::GUICONTROL_EDIT)
-  {
-    delete m_pOriginalEdit;
-    m_pOriginalEdit = new CGUIEditControl(*m_pOriginalButton);
-  }
-  m_pOriginalSpin->SetVisible(false);
-  m_pOriginalRadioButton->SetVisible(false);
-  m_pOriginalButton->SetVisible(false);
-  m_pOriginalCategoryButton->SetVisible(false);
-  m_pOriginalEdit->SetVisible(false);
-  if (m_pOriginalImage) m_pOriginalImage->SetVisible(false);
-  // setup our control groups...
-  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CATEGORY_GROUP_ID);
-  if (!group)
-    return;
-  // get a list of different sections
-  CSettingsGroup *pSettingsGroup = g_guiSettings.GetGroup(m_iScreen);
-  if (!pSettingsGroup) return ;
-  // update the screen string
-  SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, pSettingsGroup->GetLabelID());
-  // get the categories we need
-  pSettingsGroup->GetCategories(m_vecSections);
-  // run through and create our buttons...
-  int j=0;
-  for (unsigned int i = 0; i < m_vecSections.size(); i++)
-  {
-    if (m_vecSections[i]->m_labelID == 12360 && !g_settings.IsMasterUser())
-      continue;
-    CGUIButtonControl *pButton = NULL;
-    if (m_pOriginalCategoryButton->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)
-      pButton = new CGUIToggleButtonControl(*(CGUIToggleButtonControl *)m_pOriginalCategoryButton);
-    else
-      pButton = new CGUIButtonControl(*m_pOriginalCategoryButton);
-    pButton->SetLabel(g_localizeStrings.Get(m_vecSections[i]->m_labelID));
-    pButton->SetID(CONTROL_START_BUTTONS + j);
-    pButton->SetVisible(true);
-    pButton->AllocResources();
-    group->AddControl(pButton);
-    j++;
-  }
-  if (m_iSection < 0 || m_iSection >= (int)m_vecSections.size())
-    m_iSection = 0;
-  CreateSettings();
-  // set focus correctly
-  m_defaultControl = CONTROL_START_BUTTONS;
-}
-
-CGUIControl* CGUIWindowSettingsCategory::AddIntBasedSpinControl(CSetting *pSetting, float groupWidth, int &iControlID)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, groupWidth, iControlID);
-  if (!pSettingInt->m_entries.empty())
-  {
-    for (map<int,int>::iterator it=pSettingInt->m_entries.begin(); it != pSettingInt->m_entries.end();++it)
-      pControl->AddLabel(g_localizeStrings.Get(it->first), it->second);
-    pControl->SetValue(pSettingInt->GetData());
-  }
-  return pControl;
-}
-
-void CGUIWindowSettingsCategory::CreateSettings()
-{
-  FreeSettingsControls();
-
-  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
-  if (!group)
-    return;
-  vecSettings settings;
-  g_guiSettings.GetSettingsGroup(m_vecSections[m_iSection], settings);
-  int iControlID = CONTROL_START_CONTROL;
-  for (unsigned int i = 0; i < settings.size(); i++)
-  {
-    CSetting *pSetting = settings[i];
-    CStdString strSetting = pSetting->GetSetting();
-    if (pSetting->GetType() == SETTINGS_TYPE_INT)
-    {
-      CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddIntBasedSpinControl(pSetting, group->GetWidth(), iControlID);
-      CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-      if (strSetting.Equals("videoplayer.pauseafterrefreshchange"))
-      {
-        pControl->AddLabel(g_localizeStrings.Get(13551), 0);
-
-        for (int i = 1; i <= MAXREFRESHCHANGEDELAY; i++)
-        {
-          CStdString delayText;
-          delayText.Format(g_localizeStrings.Get(13553).c_str(), (double)i / 10.0);
-          pControl->AddLabel(delayText, i);
-        }
-        pControl->SetValue(pSettingInt->GetData());
-      }
-      else if (strSetting.Equals("subtitles.color"))
-      {
-        for (int i = SUBTITLE_COLOR_START; i <= SUBTITLE_COLOR_END; i++)
-          pControl->AddLabel(g_localizeStrings.Get(760 + i), i);
-        pControl->SetValue(pSettingInt->GetData());
-      }
-      else if (strSetting.Equals("lookandfeel.startupwindow"))
-        FillInStartupWindow(pSetting);
-      else if (strSetting.Equals("subtitles.height") || strSetting.Equals("karaoke.fontheight") )
-        FillInSubtitleHeights(pSetting, pControl);
-      else if (strSetting.Equals("videoscreen.screen"))
-        FillInScreens(strSetting, g_guiSettings.GetResolution());
-      else if (strSetting.Equals("videoscreen.resolution"))
-        FillInResolutions(strSetting, g_guiSettings.GetInt("videoscreen.screen"), g_guiSettings.GetResolution(), false);
-      else if (strSetting.Equals("epg.defaultguideview"))
-        FillInEpgGuideView(pSetting);
-      else if (strSetting.Equals("pvrplayback.startlast"))
-        FillInPvrStartLastChannel(pSetting);
-      continue;
-    }
-#ifdef HAS_WEB_SERVER
-    else if (strSetting.Equals("services.webserverport"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      BaseSettingControlPtr control = GetSetting(pSetting->GetSetting());
-      control->SetDelayed();
-      continue;
-    }
-#endif
-    else if (strSetting.Equals("services.esport"))
-    {
-#ifdef HAS_EVENT_SERVER
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      BaseSettingControlPtr control = GetSetting(pSetting->GetSetting());
-      control->SetDelayed();
-      continue;
-#endif
-    }
-    else if (strSetting.Equals("network.httpproxyport"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      BaseSettingControlPtr control = GetSetting(pSetting->GetSetting());
-      control->SetDelayed();
-      continue;
-    }
-    else if (strSetting.Equals("subtitles.font") || strSetting.Equals("karaoke.font") )
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInSubtitleFonts(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("subtitles.charset") || strSetting.Equals("locale.charset") || strSetting.Equals("karaoke.charset"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInCharSets(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("lookandfeel.font"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInSkinFonts(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("lookandfeel.soundskin"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInSoundSkins(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("locale.language"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      GetSetting(pSetting->GetSetting())->SetDelayed();
-      FillInLanguages(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("locale.audiolanguage") || strSetting.Equals("locale.subtitlelanguage"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      vector<CStdString> languages;
-      languages.push_back(g_localizeStrings.Get(308));
-      languages.push_back(g_localizeStrings.Get(309));
-      vector<CStdString> languageKeys;
-      languageKeys.push_back("original");
-      languageKeys.push_back("default");
-      FillInLanguages(pSetting, languages, languageKeys);
-      continue;
-    }
-#ifdef _LINUX
-    else if (strSetting.Equals("locale.timezonecountry"))
-    {
-      CStdString myTimezoneCountry = g_guiSettings.GetString("locale.timezonecountry");
-      int myTimezeoneCountryIndex = 0;
-
-      CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, group->GetWidth(), iControlID);
-      vector<CStdString> countries = g_timezone.GetCounties();
-      for (unsigned int i=0; i < countries.size(); i++)
-      {
-        if (countries[i] == myTimezoneCountry)
-           myTimezeoneCountryIndex = i;
-        pControl->AddLabel(countries[i], i);
-      }
-      pControl->SetValue(myTimezeoneCountryIndex);
-      continue;
-    }
-    else if (strSetting.Equals("locale.timezone"))
-    {
-      CStdString myTimezoneCountry = g_guiSettings.GetString("locale.timezonecountry");
-      CStdString myTimezone = g_guiSettings.GetString("locale.timezone");
-      int myTimezoneIndex = 0;
-
-      CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, group->GetWidth(), iControlID);
-      pControl->Clear();
-      vector<CStdString> timezones = g_timezone.GetTimezonesByCountry(myTimezoneCountry);
-      for (unsigned int i=0; i < timezones.size(); i++)
-      {
-        if (timezones[i] == myTimezone)
-           myTimezoneIndex = i;
-        pControl->AddLabel(timezones[i], i);
-      }
-      pControl->SetValue(myTimezoneIndex);
-      continue;
-    }
-#endif
-    else if (strSetting.Equals("videoscreen.screenmode"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInRefreshRates(strSetting, g_guiSettings.GetResolution(), false);
-      continue;
-    }
-    else if (strSetting.Equals("lookandfeel.skintheme"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInSkinThemes(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("lookandfeel.skincolors"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInSkinColors(pSetting);
-      continue;
-    }
-    /*
-    FIXME: setting is hidden in GUI because not supported properly.
-    else if (strSetting.Equals("videoplayer.displayresolution") || strSetting.Equals("pictures.displayresolution"))
-    {
-      FillInResolutions(pSetting);
-    }
-    */
-    else if (strSetting.Equals("locale.country"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInRegions(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("network.interface"))
-    {
-      FillInNetworkInterfaces(pSetting, group->GetWidth(), iControlID);
-      continue;
-    }
-    else if (strSetting.Equals("audiooutput.audiodevice"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInAudioDevices(pSetting);
-      continue;
-    }
-    else if (strSetting.Equals("audiooutput.passthroughdevice"))
-    {
-      AddSetting(pSetting, group->GetWidth(), iControlID);
-      FillInAudioDevices(pSetting,true);
-      continue;
-    }
-    AddSetting(pSetting, group->GetWidth(), iControlID);
-  }
-
-  if (m_vecSections[m_iSection]->m_strCategory == "network")
-     NetworkInterfaceChanged();
-
-  // update our settings (turns controls on/off as appropriate)
-  UpdateSettings();
-}
-
-void CGUIWindowSettingsCategory::UpdateSettings()
-{
-  for (unsigned int i = 0; i < m_vecSettings.size(); i++)
-  {
-    BaseSettingControlPtr pSettingControl = m_vecSettings[i];
-    pSettingControl->Update();
-    CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
-#ifdef HAVE_LIBVDPAU
-    if (strSetting.Equals("videoplayer.vdpauUpscalingLevel"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-      {
-        pControl->SetEnabled(true);
-      }
-    }
-    else
-#endif
-    if (strSetting.Equals("videoscreen.resolution"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-        pControl->SetEnabled(g_guiSettings.GetInt("videoscreen.screen") != DM_WINDOWED);
-    }
-    else if (strSetting.Equals("videoscreen.screenmode"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-        pControl->SetEnabled(g_guiSettings.GetInt("videoscreen.screen") != DM_WINDOWED);
-    }
-    else if (strSetting.Equals("videoscreen.fakefullscreen"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-        pControl->SetEnabled(g_guiSettings.GetInt("videoscreen.screen") != DM_WINDOWED);
-    }
-#if defined(TARGET_DARWIN_OSX) || defined(_WIN32)
-    else if (strSetting.Equals("videoscreen.blankdisplays"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-      {
-        if (g_Windowing.IsFullScreen())
-          pControl->SetEnabled(true);
-        else
-          pControl->SetEnabled(false);
-      }
-    }
-#endif
-#if defined(TARGET_DARWIN_OSX)
-    else if (strSetting.Equals("input.appleremotemode"))
-    {
-      int remoteMode = g_guiSettings.GetInt("input.appleremotemode");
-
-      // if it's not disabled, start the event server or else apple remote won't work
-      if ( remoteMode != APPLE_REMOTE_DISABLED )
-      {
-        g_guiSettings.SetBool("services.esenabled", true);
-        if (!g_application.StartEventServer())
-          CGUIDialogKaiToast::QueueNotification("DefaultIconWarning.png", g_localizeStrings.Get(33102), g_localizeStrings.Get(33100));
-      }
-
-      // if XBMC helper is running, prompt user before effecting change
-      if ( XBMCHelper::GetInstance().IsRunning() && XBMCHelper::GetInstance().GetMode()!=remoteMode )
-      {
-        bool cancelled;
-        if (!CGUIDialogYesNo::ShowAndGetInput(13144, 13145, 13146, 13147, -1, -1, cancelled, 10000))
-        {
-          // user declined, restore previous spinner state and appleremote mode
-          CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-          g_guiSettings.SetInt("input.appleremotemode", XBMCHelper::GetInstance().GetMode());
-          pControl->SetValue(XBMCHelper::GetInstance().GetMode());
-        }
-        else
-        {
-          // reload configuration
-          XBMCHelper::GetInstance().Configure();
-        }
-      }
-      else
-      {
-        // set new configuration.
-        XBMCHelper::GetInstance().Configure();
-      }
-
-      if (XBMCHelper::GetInstance().ErrorStarting() == true)
-      {
-        // inform user about error
-        CGUIDialogOK::ShowAndGetInput(13620, 13621, 20022, 20022);
-
-        // reset spinner to disabled state
-        CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-        pControl->SetValue(APPLE_REMOTE_DISABLED);
-      }
-    }
-    else if (strSetting.Equals("input.appleremotealwayson"))
-     {
-       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-       if (pControl)
-       {
-         int value = g_guiSettings.GetInt("input.appleremotemode");
-         if (value != APPLE_REMOTE_DISABLED)
-           pControl->SetEnabled(true);
-         else
-           pControl->SetEnabled(false);
-       }
-     }
-     else if (strSetting.Equals("input.appleremotesequencetime"))
-     {
-       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-       if (pControl)
-       {
-         int value = g_guiSettings.GetInt("input.appleremotemode");
-         if (value == APPLE_REMOTE_UNIVERSAL)
-           pControl->SetEnabled(true);
-         else
-           pControl->SetEnabled(false);
-       }
-     }
-#endif
-    else if (strSetting.Equals("filelists.allowfiledeletion"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(!g_settings.GetCurrentProfile().filesLocked() || g_passwordManager.bMasterUser);
-    }
-    else if (strSetting.Equals("filelists.showaddsourcebuttons"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_settings.GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser);
-    }
-    else if (strSetting.Equals("masterlock.startuplock"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE);
-    }
-    else if (strSetting.Equals("pvrmanager.channelscan"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("pvrmanager.enabled") && g_PVRClients && g_PVRClients->GetClientsSupportingChannelScan().size() > 0);
-    }
-    else if (strSetting.Equals("pvrmanager.channelmanager") || strSetting.Equals("pvrmenu.searchicons"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("pvrmanager.enabled"));
-    }
-    else if (!strSetting.Equals("pvrparental.enabled") &&
-        (strSetting.Equals("pvrparental.pin") || strSetting.Equals("pvrparental.duration")))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("pvrparental.enabled"));
-    }
-    else if (!strSetting.Equals("services.esenabled")
-             && strSetting.Left(11).Equals("services.es"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("services.esenabled"));
-    }
-    else if (strSetting.Equals("services.upnpannounce"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      pControl->SetEnabled(g_guiSettings.GetBool("services.upnpserver"));
-    }
-    else if (strSetting.Equals("audiocds.quality"))
-    { // only visible if we are doing non-WAV ripping
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_WAV &&
-                                         g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_FLAC);
-    }
-    else if (strSetting.Equals("audiocds.bitrate"))
-    { // only visible if we are ripping to CBR
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_WAV &&
-                                         g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_FLAC &&
-                                         g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_CBR);
-    }
-    else if (strSetting.Equals("audiocds.compressionlevel"))
-    { // only visible if we are doing FLAC ripping
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") == CDDARIP_ENCODER_FLAC);
-    }
-    else if (
-             strSetting.Equals("audiooutput.passthroughdevice") ||
-             strSetting.Equals("audiooutput.ac3passthrough") ||
-             strSetting.Equals("audiooutput.dtspassthrough") ||
-             strSetting.Equals("audiooutput.passthroughaac"))
-    { // only visible if we are in digital mode
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")));
-    }
-    else if (
-             strSetting.Equals("audiooutput.multichannellpcm" ) ||
-             strSetting.Equals("audiooutput.truehdpassthrough") ||
-             strSetting.Equals("audiooutput.dtshdpassthrough" ))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-      {
-        if (strSetting.Equals("audiooutput.dtshdpassthrough") && !g_guiSettings.GetBool("audiooutput.dtspassthrough"))
-          pControl->SetEnabled(false);
-        else
-          pControl->SetEnabled(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI);
-      }
-    }
-    else if (strSetting.Equals("musicplayer.crossfadealbumtracks"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("musicplayer.crossfade") > 0);
-    }
-#ifdef HAS_WEB_SERVER
-    else if (strSetting.Equals("services.webserverusername") ||
-             strSetting.Equals("services.webserverpassword"))
-    {
-      CGUIEditControl *pControl = (CGUIEditControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-        pControl->SetEnabled(g_guiSettings.GetBool("services.webserver"));
-    }
-#endif
-#ifdef HAS_AIRPLAY
-    else if ( strSetting.Equals("services.airplaypassword") ||
-              strSetting.Equals("services.useairplaypassword"))
-    {
-      if (strSetting.Equals("services.airplaypassword"))
-      {
-        CGUIEditControl *pControl = (CGUIEditControl *)GetControl(pSettingControl->GetID());
-        if (pControl)
-          pControl->SetEnabled(g_guiSettings.GetBool("services.useairplaypassword"));
-      }
-      else//useairplaypassword
-      {
-        CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(pSettingControl->GetID());
-        if (pControl)
-          pControl->SetEnabled(g_guiSettings.GetBool("services.airplay"));
-      }
-
-      //set credentials to airplay server
-      if (g_guiSettings.GetBool("services.airplay"))
-      {
-        CStdString password = g_guiSettings.GetString("services.airplaypassword");
-        CAirPlayServer::SetCredentials(g_guiSettings.GetBool("services.useairplaypassword"),
-                                       password);
-      }
-    }
-#endif//HAS_AIRPLAY
-    else if (strSetting.Equals("network.ipaddress") || strSetting.Equals("network.subnet") || strSetting.Equals("network.gateway") || strSetting.Equals("network.dns"))
-    {
-#ifdef _LINUX
-      bool enabled = (geteuid() == 0);
-#else
-      bool enabled = false;
-#endif
-      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
-      if (pControl1)
-         enabled = (pControl1->GetValue() == NETWORK_STATIC);
-
-       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-       if (pControl) pControl->SetEnabled(enabled);
-    }
-    else if (strSetting.Equals("network.assignment"))
-    {
-      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
-#ifdef HAS_LINUX_NETWORK
-      if (pControl1)
-         pControl1->SetEnabled(geteuid() == 0);
-#endif
-    }
-    else if (strSetting.Equals("network.essid") || strSetting.Equals("network.enc") || strSetting.Equals("network.key"))
-    {
-      // Get network information
-      CGUISpinControlEx *ifaceControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
-      CStdString ifaceName = ifaceControl->GetLabel();
-      CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
-      bool bIsWireless = iface->IsWireless();
-
-#ifdef HAS_LINUX_NETWORK
-      bool enabled = bIsWireless && (geteuid() == 0);
-#else
-      bool enabled = bIsWireless;
-#endif
-      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
-      if (pControl1)
-         enabled &= (pControl1->GetValue() != NETWORK_DISABLED);
-
-      if (strSetting.Equals("network.key"))
-      {
-         pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
-         if (pControl1) enabled &= (pControl1->GetValue() != ENC_NONE);
-      }
-
-       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-       if (pControl) pControl->SetEnabled(enabled);
-    }
-    else if (strSetting.Equals("network.httpproxyserver")   || strSetting.Equals("network.httpproxyport") ||
-             strSetting.Equals("network.httpproxyusername") || strSetting.Equals("network.httpproxypassword") ||
-             strSetting.Equals("network.httpproxytype"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("network.usehttpproxy"));
-    }
-#ifdef HAS_LINUX_NETWORK
-    else if (strSetting.Equals("network.key"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
-      if (pControl && pControl1)
-         pControl->SetEnabled(!pControl1->IsDisabled() && pControl1->GetValue() > 0);
-    }
-    else if (strSetting.Equals("network.save"))
-    {
-      CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(pSettingControl->GetID());
-      pControl->SetEnabled(geteuid() == 0);
-    }
-#endif
-    else if (strSetting.Equals("scrobbler.lastfmusername") || strSetting.Equals("scrobbler.lastfmpass"))
-    {
-      CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("scrobbler.lastfmsubmit"));
-    }
-    else if (strSetting.Equals("scrobbler.librefmusername") || strSetting.Equals("scrobbler.librefmpass"))
-    {
-      CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("scrobbler.librefmsubmit"));
-    }
-    else if (strSetting.Equals("subtitles.color") || strSetting.Equals("subtitles.style") || strSetting.Equals("subtitles.charset"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID());
-      pControl->SetEnabled(CUtil::IsUsingTTFSubtitles());
-    }
-    else if (strSetting.Equals("locale.charset"))
-    { // TODO: Determine whether we are using a TTF font or not.
-      //   CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      //   if (pControl) pControl->SetEnabled(g_guiSettings.GetString("lookandfeel.font").Right(4) == ".ttf");
-    }
-    else if (strSetting.Equals("screensaver.settings"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      AddonPtr addon;
-      if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
-        pControl->SetEnabled(addon->HasSettings());
-      else
-        pControl->SetEnabled(false);
-    }
-    else if (strSetting.Equals("screensaver.preview")           ||
-             strSetting.Equals("screensaver.time")              ||
-             strSetting.Equals("screensaver.usedimonpause")     ||
-             strSetting.Equals("screensaver.usemusicvisinstead"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID());
-      pControl->SetEnabled(!g_guiSettings.GetString("screensaver.mode").IsEmpty());
-      if (strSetting.Equals("screensaver.usedimonpause") && g_guiSettings.GetString("screensaver.mode").Equals("screensaver.xbmc.builtin.dim"))
-        pControl->SetEnabled(false);
-    }
-    else if (strSetting.Equals("musicfiles.trackformat"))
-    {
-      if (m_strOldTrackFormat != g_guiSettings.GetString("musicfiles.trackformat"))
-      {
-        CUtil::DeleteMusicDatabaseDirectoryCache();
-        m_strOldTrackFormat = g_guiSettings.GetString("musicfiles.trackformat");
-      }
-    }
-    else if (strSetting.Equals("musicfiles.trackformatright"))
-    {
-      if (m_strOldTrackFormatRight != g_guiSettings.GetString("musicfiles.trackformatright"))
-      {
-        CUtil::DeleteMusicDatabaseDirectoryCache();
-        m_strOldTrackFormatRight = g_guiSettings.GetString("musicfiles.trackformatright");
-      }
-    }
-    else if (strSetting.Equals("audiocds.recordingpath") || strSetting.Equals("debug.screenshotpath"))
-    {
-      CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(pSettingControl->GetID());
-      if (pControl && g_guiSettings.GetString(strSetting, false).IsEmpty())
-        pControl->SetLabel2("");
-    }
-    else if (strSetting.Equals("lookandfeel.rssedit"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      pControl->SetEnabled(g_guiSettings.GetBool("lookandfeel.enablerssfeeds"));
-    }
-    else if (strSetting.Equals("lookandfeel.skinsettings"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      pControl->SetEnabled(g_SkinInfo->HasSkinFile("SkinSettings.xml"));
-    }
-    else if (strSetting.Equals("videoplayer.pauseafterrefreshchange"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF);
-    }
-    else if (strSetting.Equals("videoplayer.synctype"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("videoplayer.usedisplayasclock"));
-    }
-    else if (strSetting.Equals("videoplayer.maxspeedadjust"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-      {
-        bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) &&
-            (g_guiSettings.GetInt("videoplayer.synctype") == SYNC_RESAMPLE);
-        pControl->SetEnabled(enabled);
-      }
-    }
-    else if (strSetting.Equals("videoplayer.resamplequality"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-      {
-        bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) &&
-            (g_guiSettings.GetInt("videoplayer.synctype") == SYNC_RESAMPLE);
-        pControl->SetEnabled(enabled);
-      }
-    }
-    else if (strSetting.Equals("weather.addonsettings"))
-    {
-      AddonPtr addon;
-      if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("weather.addon"), addon, ADDON_SCRIPT_WEATHER))
-      {
-        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-        if (pControl)
-          pControl->SetEnabled(addon->HasSettings());
-      }
-    }
-    else if (strSetting.Equals("input.peripherals"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-        pControl->SetEnabled(g_peripherals.GetNumberOfPeripherals() > 0);
-    }
-    else if (strSetting.Equals("input.enablejoystick"))
-    {
-      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-      if (pControl)
-        pControl->SetEnabled(CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0);
-    }
-  }
-
-  g_guiSettings.SetChanged();
-  g_guiSettings.NotifyObservers(ObservableMessageGuiSettings);
-}
-
-void CGUIWindowSettingsCategory::OnClick(BaseSettingControlPtr pSettingControl)
-{
-  CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
-  if (strSetting.Equals("weather.addonsettings"))
-  {
-    CStdString name = g_guiSettings.GetString("weather.addon");
-    AddonPtr addon;
-    if (CAddonMgr::Get().GetAddon(name, addon, ADDON_SCRIPT_WEATHER))
-    { // TODO: maybe have ShowAndGetInput return a bool if settings changed, then only reset weather if true.
-      CGUIDialogAddonSettings::ShowAndGetInput(addon);
-      g_weatherManager.Refresh();
-    }
-  }
-  else if (strSetting.Equals("lookandfeel.rssedit"))
-  {
-    AddonPtr addon;
-    CAddonMgr::Get().GetAddon("script.rss.editor",addon);
-    if (!addon)
-    {
-      if (!CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(24076), g_localizeStrings.Get(24100),"RSS Editor",g_localizeStrings.Get(24101)))
-        return;
-      CAddonInstaller::Get().Install("script.rss.editor", true, "", false);
-    }
-    CBuiltins::Execute("RunScript(script.rss.editor)");
-  }
-  else if (pSettingControl->GetSetting()->GetType() == SETTINGS_TYPE_ADDON)
-  { // prompt for the addon
-    CSettingAddon *setting = (CSettingAddon *)pSettingControl->GetSetting();
-    CStdString addonID = setting->GetData();
-    if (CGUIWindowAddonBrowser::SelectAddonID(setting->m_type, addonID, setting->m_type == ADDON_SCREENSAVER || setting->m_type == ADDON_VIZ || setting->m_type == ADDON_SCRIPT_WEATHER) == 1)
-      setting->SetData(addonID);
-    else
-      return;
-  }
-  else if (strSetting.Equals("input.peripherals"))
-  {
-    CGUIDialogPeripheralManager *dialog = (CGUIDialogPeripheralManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_MANAGER);
-    if (dialog)
-      dialog->DoModal();
-    // refresh settings
-    UpdateSettings();
-    return;
-  }
-
-  // if OnClick() returns false, the setting hasn't changed or doesn't
-  // require immediate update
-  if (!pSettingControl->OnClick())
-  {
-    UpdateSettings();
-    if (!pSettingControl->IsDelayed())
-      return;
-  }
-
-  if (pSettingControl->IsDelayed())
-  { // delayed setting
-    m_delayedSetting = pSettingControl;
-    m_delayedTimer.StartZero();
-  }
-  else
-    OnSettingChanged(pSettingControl);
-}
-
-void CGUIWindowSettingsCategory::CheckForUpdates()
-{
-  for (unsigned int i = 0; i < m_vecSettings.size(); i++)
-  {
-    BaseSettingControlPtr pSettingControl = m_vecSettings[i];
-    if (pSettingControl->NeedsUpdate())
-    {
-      OnSettingChanged(pSettingControl);
-      pSettingControl->Reset();
-    }
-  }
-}
-
-void CGUIWindowSettingsCategory::OnSettingChanged(BaseSettingControlPtr pSettingControl)
-{
-  CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
-
-  // ok, now check the various special things we need to do
-  if (pSettingControl->GetSetting()->GetType() == SETTINGS_TYPE_ADDON)
-  {
-    CSettingAddon *pSettingAddon = (CSettingAddon*)pSettingControl->GetSetting();
-    if (pSettingAddon->m_type == ADDON_SKIN)
-    {
-      g_application.ReloadSkin();
-    }
-    else if (pSettingAddon->m_type == ADDON_SCRIPT_WEATHER)
-    {
-      g_weatherManager.Refresh();
-    }
-  }
-  else if (strSetting.Equals("musicplayer.visualisation"))
-  { // new visualisation choosen...
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    if (pControl->GetValue() == 0)
-      pSettingString->SetData("None");
-    else
-      pSettingString->SetData(pControl->GetCurrentLabel());
-  }
-  else if (strSetting.Equals("debug.showloginfo"))
-  {
-    g_advancedSettings.SetDebugMode(g_guiSettings.GetBool("debug.showloginfo"));
-  }
-  /*else if (strSetting.Equals("musicfiles.repeat"))
-  {
-    g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC_TEMP, g_guiSettings.GetBool("musicfiles.repeat") ? PLAYLIST::REPEAT_ALL : PLAYLIST::REPEAT_NONE);
-  }*/
-  else if (strSetting.Equals("musiclibrary.cleanup"))
-  {
-    CMusicDatabase musicdatabase;
-    musicdatabase.Clean();
-    CUtil::DeleteMusicDatabaseDirectoryCache();
-  }
-  else if (strSetting.Equals("videolibrary.cleanup"))
-  {
-    if (CGUIDialogYesNo::ShowAndGetInput(313, 333, 0, 0))
-      g_application.StartVideoCleanup();
-  }
-  else if (strSetting.Equals("videolibrary.export"))
-    CBuiltins::Execute("exportlibrary(video)");
-  else if (strSetting.Equals("musiclibrary.export"))
-    CBuiltins::Execute("exportlibrary(music)");
-  else if (strSetting.Equals("karaoke.export") )
-  {
-    CContextButtons choices;
-    choices.Add(1, g_localizeStrings.Get(22034));
-    choices.Add(2, g_localizeStrings.Get(22035));
-
-    int retVal = CGUIDialogContextMenu::ShowAndGetChoice(choices);
-    if ( retVal > 0 )
-    {
-      CStdString path(g_settings.GetDatabaseFolder());
-      VECSOURCES shares;
-      g_mediaManager.GetLocalDrives(shares);
-      if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(661), path, true))
-      {
-        CMusicDatabase musicdatabase;
-        musicdatabase.Open();
-
-        if ( retVal == 1 )
-        {
-          URIUtils::AddFileToFolder(path, "karaoke.html", path);
-          musicdatabase.ExportKaraokeInfo( path, true );
-        }
-        else
-        {
-          URIUtils::AddFileToFolder(path, "karaoke.csv", path);
-          musicdatabase.ExportKaraokeInfo( path, false );
-        }
-        musicdatabase.Close();
-      }
-    }
-  }
-  else if (strSetting.Equals("videolibrary.import"))
-  {
-    CStdString path;
-    VECSOURCES shares;
-    g_mediaManager.GetLocalDrives(shares);
-    if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(651) , path))
-    {
-      CVideoDatabase videodatabase;
-      videodatabase.Open();
-      videodatabase.ImportFromXML(path);
-      videodatabase.Close();
-    }
-  }
-  else if (strSetting.Equals("musiclibrary.import"))
-  {
-    CStdString path;
-    VECSOURCES shares;
-    g_mediaManager.GetLocalDrives(shares);
-    if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "musicdb.xml", g_localizeStrings.Get(651) , path))
-    {
-      CMusicDatabase musicdatabase;
-      musicdatabase.Open();
-      musicdatabase.ImportFromXML(path);
-      musicdatabase.Close();
-    }
-  }
-  else if (strSetting.Equals("karaoke.importcsv"))
-  {
-    CStdString path(g_settings.GetDatabaseFolder());
-    VECSOURCES shares;
-    g_mediaManager.GetLocalDrives(shares);
-    if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "karaoke.csv", g_localizeStrings.Get(651) , path))
-    {
-      CMusicDatabase musicdatabase;
-      musicdatabase.Open();
-      musicdatabase.ImportKaraokeInfo(path);
-      musicdatabase.Close();
-    }
-  }
-  else if (strSetting.Equals("scrobbler.lastfmsubmit") || strSetting.Equals("scrobbler.lastfmusername") || strSetting.Equals("scrobbler.lastfmpass"))
-  {
-    CStdString strPassword=g_guiSettings.GetString("scrobbler.lastfmpass");
-    CStdString strUserName=g_guiSettings.GetString("scrobbler.lastfmusername");
-    if (g_guiSettings.GetBool("scrobbler.lastfmsubmit") &&
-         !strUserName.IsEmpty() && !strPassword.IsEmpty())
-    {
-      CLastfmScrobbler::GetInstance()->Init();
-    }
-    else
-    {
-      CLastfmScrobbler::GetInstance()->Term();
-    }
-  }
-  else if (strSetting.Equals("scrobbler.librefmsubmit") || strSetting.Equals("scrobbler.librefmusername") || strSetting.Equals("scrobbler.librefmpass"))
-  {
-    CStdString strPassword=g_guiSettings.GetString("scrobbler.librefmpass");
-    CStdString strUserName=g_guiSettings.GetString("scrobbler.librefmusername");
-    if (g_guiSettings.GetBool("scrobbler.librefmsubmit") &&
-         !strUserName.IsEmpty() && !strPassword.IsEmpty())
-    {
-      CLibrefmScrobbler::GetInstance()->Init();
-    }
-    else
-    {
-      CLibrefmScrobbler::GetInstance()->Term();
-    }
-  }
-  else if (strSetting.Left(22).Equals("MusicPlayer.ReplayGain"))
-  { // Update our replaygain settings
-    g_guiSettings.m_replayGain.iType = g_guiSettings.GetInt("musicplayer.replaygaintype");
-    g_guiSettings.m_replayGain.iPreAmp = g_guiSettings.GetInt("musicplayer.replaygainpreamp");
-    g_guiSettings.m_replayGain.iNoGainPreAmp = g_guiSettings.GetInt("musicplayer.replaygainnogainpreamp");
-    g_guiSettings.m_replayGain.bAvoidClipping = g_guiSettings.GetBool("musicplayer.replaygainavoidclipping");
-  }
-#ifdef HAS_WEB_SERVER
-  else if ( strSetting.Equals("services.webserver") || strSetting.Equals("services.webserverport"))
-  {
-    if (strSetting.Equals("services.webserverport"))
-      ValidatePortNumber(pSettingControl, "8080", "80");
-    g_application.StopWebServer();
-    if (g_guiSettings.GetBool("services.webserver"))
-      if (!g_application.StartWebServer())
-      {
-        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33101), "", g_localizeStrings.Get(33100), "");
-        g_guiSettings.SetBool("services.webserver", false);
-      }
-  }
-  else if (strSetting.Equals("services.webserverusername") || strSetting.Equals("services.webserverpassword"))
-  {
-    g_application.m_WebServer.SetCredentials(g_guiSettings.GetString("services.webserverusername"), g_guiSettings.GetString("services.webserverpassword"));
-  }
-#endif
-  else if (strSetting.Equals("services.zeroconf"))
-  {
-#ifdef HAS_ZEROCONF
-    //ifdef zeroconf here because it's only found in guisettings if defined
-    if(g_guiSettings.GetBool("services.zeroconf"))
-    {
-      CZeroconf::GetInstance()->Stop();
-      CZeroconf::GetInstance()->Start();
-    }
-#ifdef HAS_AIRPLAY
-    else
-    {
-      g_application.StopAirplayServer(true);
-      g_guiSettings.SetBool("services.airplay", false);
-      CZeroconf::GetInstance()->Stop();
-    }
-#endif
-#endif
-  }
-  else if (strSetting.Equals("services.airplay"))
-  {
-#ifdef HAS_AIRPLAY
-    if (g_guiSettings.GetBool("services.airplay"))
-    {
-#ifdef HAS_ZEROCONF
-      // AirPlay needs zeroconf
-      if(!g_guiSettings.GetBool("services.zeroconf"))
-      {
-        g_guiSettings.SetBool("services.zeroconf", true);
-        CZeroconf::GetInstance()->Stop();
-        CZeroconf::GetInstance()->Start();
-      }
-#endif //HAS_ZEROCONF
-      g_application.StartAirplayServer();//will stop the server before internal
-    }
-    else
-      g_application.StopAirplayServer(true);//will stop the server before internal
-#endif//HAS_AIRPLAY
-  }
-  else if (strSetting.Equals("network.ipaddress"))
-  {
-    if (g_guiSettings.GetInt("network.assignment") == NETWORK_STATIC)
-    {
-      CStdString strDefault = g_guiSettings.GetString("network.ipaddress").Left(g_guiSettings.GetString("network.ipaddress").ReverseFind('.'))+".1";
-      if (g_guiSettings.GetString("network.gateway").Equals("0.0.0.0"))
-        g_guiSettings.SetString("network.gateway",strDefault);
-      if (g_guiSettings.GetString("network.dns").Equals("0.0.0.0"))
-        g_guiSettings.SetString("network.dns",strDefault);
-
-    }
-  }
-
-  else if (strSetting.Equals("network.httpproxyport"))
-  {
-    ValidatePortNumber(pSettingControl, "8080", "8080", false);
-  }
-  else if (strSetting.Equals("videoplayer.calibrate") || strSetting.Equals("videoscreen.guicalibration"))
-  { // activate the video calibration screen
-    g_windowManager.ActivateWindow(WINDOW_SCREEN_CALIBRATION);
-  }
-  else if (strSetting.Equals("videoscreen.testpattern"))
-  { // activate the test pattern
-    g_windowManager.ActivateWindow(WINDOW_TEST_PATTERN);
-  }
-  else if (strSetting.Equals("subtitles.height"))
-  {
-    if (!CUtil::IsUsingTTFSubtitles())
-    {
-      CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-      ((CSettingInt *)pSettingControl->GetSetting())->FromString(pControl->GetCurrentLabel());
-    }
-  }
-  else if (strSetting.Equals("subtitles.font"))
-  {
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    pSettingString->SetData(pControl->GetCurrentLabel());
-    CSetting *pSetting = (CSetting *)g_guiSettings.GetSetting("subtitles.height");
-    FillInSubtitleHeights(pSetting, (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID()));
-  }
-  else if (strSetting.Equals("subtitles.charset"))
-  {
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    CStdString newCharset="DEFAULT";
-    if (pControl->GetValue()!=0)
-     newCharset = g_charsetConverter.getCharsetNameByLabel(pControl->GetCurrentLabel());
-    if (newCharset != "" && (newCharset != pSettingString->GetData() || newCharset=="DEFAULT"))
-    {
-      pSettingString->SetData(newCharset);
-      g_charsetConverter.reset();
-    }
-  }
-  else if (strSetting.Equals("karaoke.fontheight"))
-  {
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    ((CSettingInt *)pSettingControl->GetSetting())->FromString(pControl->GetCurrentLabel());
-  }
-  else if (strSetting.Equals("karaoke.font"))
-  {
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    pSettingString->SetData(pControl->GetCurrentLabel());
-    CSetting *pSetting = (CSetting *)g_guiSettings.GetSetting("karaoke.fontheight");
-    FillInSubtitleHeights(pSetting, (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID()));
-  }
-  else if (strSetting.Equals("karaoke.charset"))
-  {
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    CStdString newCharset="DEFAULT";
-    if (pControl->GetValue()!=0)
-      newCharset = g_charsetConverter.getCharsetNameByLabel(pControl->GetCurrentLabel());
-    if (newCharset != "" && (newCharset != pSettingString->GetData() || newCharset=="DEFAULT"))
-    {
-      pSettingString->SetData(newCharset);
-      g_charsetConverter.reset();
-    }
-  }
-  else if (strSetting.Equals("locale.charset"))
-  {
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    CStdString newCharset="DEFAULT";
-    if (pControl->GetValue()!=0)
-     newCharset = g_charsetConverter.getCharsetNameByLabel(pControl->GetCurrentLabel());
-    if (newCharset != "" && (newCharset != pSettingString->GetData() || newCharset=="DEFAULT"))
-    {
-      pSettingString->SetData(newCharset);
-      g_charsetConverter.reset();
-    }
-  }
-  else if (strSetting.Equals("lookandfeel.font"))
-  { // new font choosen...
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    CStdString strSkinFontSet = m_SkinFontSetIDs[pControl->GetCurrentLabel()];
-    if (strSkinFontSet != ".svn" && strSkinFontSet != g_guiSettings.GetString("lookandfeel.font"))
-    {
-      g_guiSettings.SetString("lookandfeel.font", strSkinFontSet);
-      g_application.ReloadSkin();
-    }
-  }
-  else if (strSetting.Equals("lookandfeel.soundskin"))
-  { // new sound skin choosen...
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    if (pControl->GetValue()==0)
-      g_guiSettings.SetString("lookandfeel.soundskin", "OFF");
-    else if (pControl->GetValue()==1)
-      g_guiSettings.SetString("lookandfeel.soundskin", "SKINDEFAULT");
-    else
-      g_guiSettings.SetString("lookandfeel.soundskin", pControl->GetCurrentLabel());
-
-    g_audioManager.Enable(true);
-    g_audioManager.Load();
-  }
-  else if (strSetting.Equals("lookandfeel.skinsettings"))
-  {
-    g_windowManager.ActivateWindow(WINDOW_SKIN_SETTINGS);
-  }
-  else if (strSetting.Equals("input.enablemouse"))
-  {
-    g_Mouse.SetEnabled(g_guiSettings.GetBool("input.enablemouse"));
-  }
-  else if (strSetting.Equals("input.enablejoystick"))
-  {
-#if defined(HAS_SDL_JOYSTICK)
-    g_Joystick.SetEnabled(g_guiSettings.GetBool("input.enablejoystick")  
-        && CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0);
-#endif
-  }
-  else if (strSetting.Equals("videoscreen.screen"))
-  {
-    DisplayMode mode = g_guiSettings.GetInt("videoscreen.screen");
-    // Cascade
-    FillInResolutions("videoscreen.resolution", mode, RES_DESKTOP, true);
-  }
-  else if (strSetting.Equals("videoscreen.resolution"))
-  {
-    RESOLUTION nextRes = (RESOLUTION) g_guiSettings.GetInt("videoscreen.resolution");
-    // Cascade
-    FillInRefreshRates("videoscreen.screenmode", nextRes, true);
-  }
-  else if (strSetting.Equals("videoscreen.screenmode"))
-  {
-    int iControlID = pSettingControl->GetID();
-    CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
-    g_windowManager.SendMessage(msg);
-    RESOLUTION nextRes = (RESOLUTION)msg.GetParam1();
-
-    OnRefreshRateChanged(nextRes);
-  }
-  else if (strSetting.Equals("videoscreen.vsync"))
-  {
-    int iControlID = pSettingControl->GetID();
-    CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
-    g_windowManager.SendMessage(msg);
-// DXMERGE: This may be useful
-//    g_videoConfig.SetVSyncMode((VSYNC)msg.GetParam1());
-  }
-  else if (strSetting.Equals("videoscreen.fakefullscreen"))
-  {
-    if (g_graphicsContext.IsFullScreenRoot())
-      g_graphicsContext.SetVideoResolution(g_graphicsContext.GetVideoResolution(), true);
-  }
-  else if (strSetting.Equals("locale.audiolanguage"))
-  { // new audio language chosen...
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    int iLanguage = pControl->GetValue();
-    if (iLanguage < 2)
-    {
-      if (iLanguage < 1)
-        g_guiSettings.SetString(strSetting, "original");
-      else
-        g_guiSettings.SetString(strSetting, "default");
-      g_langInfo.SetAudioLanguage("");
-    }
-    else
-    {
-      CStdString strLanguage = pControl->GetCurrentLabel();
-      if (strLanguage != pSettingString->GetData())
-      {
-        g_guiSettings.SetString(strSetting, strLanguage);
-        g_langInfo.SetAudioLanguage(strLanguage);
-      }
-    }
-  }
-  else if (strSetting.Equals("locale.subtitlelanguage"))
-  { // new subtitle language chosen...
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    int iLanguage = pControl->GetValue();
-    if (iLanguage < 2)
-    {
-      if (iLanguage < 1)
-        g_guiSettings.SetString(strSetting, "original");
-      else
-        g_guiSettings.SetString(strSetting, "default");
-      g_langInfo.SetSubtitleLanguage("");
-    }
-    else
-    {
-      CStdString strLanguage = pControl->GetCurrentLabel();
-      if (strLanguage != pSettingString->GetData())
-      {
-        g_guiSettings.SetString(strSetting, strLanguage);
-        g_langInfo.SetSubtitleLanguage(strLanguage);
-      }
-    }
-  }
-  else if (strSetting.Equals("locale.language"))
-  { // new language chosen...
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    CStdString strLanguage = pControl->GetCurrentLabel();
-    if (strLanguage != ".svn" && strLanguage != pSettingString->GetData())
-      g_guiSettings.SetLanguage(strLanguage);
-
-    // user set language, no longer use the TV's language
-    vector<CPeripheral *> cecDevices;
-    if (g_peripherals.GetPeripheralsWithFeature(cecDevices, FEATURE_CEC) > 0)
-    {
-      for (vector<CPeripheral *>::iterator it = cecDevices.begin(); it != cecDevices.end(); it++)
-        (*it)->SetSetting("use_tv_menu_language", false);
-    }
-  }
-  else if (strSetting.Equals("lookandfeel.skintheme"))
-  { //a new Theme was chosen
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-
-    CStdString strSkinTheme;
-
-    if (pControl->GetValue() == 0) // Use default theme
-      strSkinTheme = "SKINDEFAULT";
-    else
-      strSkinTheme = pControl->GetCurrentLabel();
-
-    if (strSkinTheme != pSettingString->GetData())
-    {
-      g_guiSettings.SetString("lookandfeel.skintheme", strSkinTheme);
-      // also set the default color theme
-      CStdString colorTheme(URIUtils::ReplaceExtension(strSkinTheme, ".xml"));
-      if (colorTheme.Equals("Textures.xml"))
-        colorTheme = "defaults.xml";
-      g_guiSettings.SetString("lookandfeel.skincolors", colorTheme);
-      g_application.ReloadSkin();
-    }
-  }
-  else if (strSetting.Equals("lookandfeel.skincolors"))
-  { //a new color was chosen
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-
-    CStdString strSkinColor;
-
-    if (pControl->GetValue() == 0) // Use default colors
-      strSkinColor = "SKINDEFAULT";
-    else
-      strSkinColor = pControl->GetCurrentLabel() + ".xml";
-
-    if (strSkinColor != pSettingString->GetData())
-    {
-      g_guiSettings.SetString("lookandfeel.skincolors", strSkinColor);
-      g_application.ReloadSkin();
-    }
-  }
-  else if (strSetting.Equals("videoplayer.displayresolution"))
-  {
-    CSettingInt *pSettingInt = (CSettingInt *)pSettingControl->GetSetting();
-    int iControlID = pSettingControl->GetID();
-    CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
-    g_windowManager.SendMessage(msg);
-    pSettingInt->SetData(msg.GetParam1());
-  }
-  else if (strSetting.Equals("videoscreen.flickerfilter") || strSetting.Equals("videoscreen.soften"))
-  { // reset display
-    g_graphicsContext.SetVideoResolution(g_guiSettings.m_LookAndFeelResolution);
-  }
-  else if (strSetting.Equals("screensaver.preview"))
-  {
-    g_application.ActivateScreenSaver(true);
-  }
-  else if (strSetting.Equals("screensaver.settings"))
-  {
-    AddonPtr addon;
-    if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
-      CGUIDialogAddonSettings::ShowAndGetInput(addon);
-  }
-  else if (strSetting.Equals("debug.screenshotpath") || strSetting.Equals("audiocds.recordingpath") || strSetting.Equals("subtitles.custompath") || strSetting.Equals("pvrmenu.iconpath"))
-  {
-    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
-    CStdString path = g_guiSettings.GetString(strSetting,false);
-    VECSOURCES shares;
-
-    bool bWriteOnly = true;
-
-    if (strSetting.Equals("pvrmenu.iconpath"))
-    {
-      bWriteOnly = false;
-    }
-    else if (strSetting.Equals("subtitles.custompath"))
-    {
-      bWriteOnly = false;
-      shares = g_settings.m_videoSources;
-    }
-
-    g_mediaManager.GetNetworkLocations(shares);
-    g_mediaManager.GetLocalDrives(shares);
-
-    UpdateSettings();
-
-    if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(pSettingString->m_iHeadingString), path, bWriteOnly))
-    {
-      pSettingString->SetData(path);
-    }
-  }
-  else if (strSetting.Left(22).Equals("MusicPlayer.ReplayGain"))
-  { // Update our replaygain settings
-    g_guiSettings.m_replayGain.iType = g_guiSettings.GetInt("musicplayer.replaygaintype");
-    g_guiSettings.m_replayGain.iPreAmp = g_guiSettings.GetInt("musicplayer.replaygainpreamp");
-    g_guiSettings.m_replayGain.iNoGainPreAmp = g_guiSettings.GetInt("musicplayer.replaygainnogainpreamp");
-    g_guiSettings.m_replayGain.bAvoidClipping = g_guiSettings.GetBool("musicplayer.replaygainavoidclipping");
-  }
-  else if (strSetting.Equals("locale.country"))
-  {
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-
-    const CStdString& strRegion=pControl->GetCurrentLabel();
-    g_langInfo.SetCurrentRegion(strRegion);
-    g_guiSettings.SetString("locale.country", strRegion);
-    g_weatherManager.Refresh(); // need to reset our weather, as temperatures need re-translating.
-  }
-  else if (strSetting.Equals("smb.winsserver") || strSetting.Equals("smb.workgroup") )
-  {
-    if (g_guiSettings.GetString("smb.winsserver") == "0.0.0.0")
-      g_guiSettings.SetString("smb.winsserver", "");
-
-    /* okey we really don't need to restarat, only deinit samba, but that could be damn hard if something is playing*/
-    //TODO - General way of handling setting changes that require restart
-
-    if (CGUIDialogYesNo::ShowAndGetInput(14038, 14039, 14040, -1, -1))
-    {
-      g_settings.Save();
-      CApplicationMessenger::Get().RestartApp();
-    }
-  }
-  else if (strSetting.Equals("services.upnpserver"))
-  {
-#ifdef HAS_UPNP
-    if (g_guiSettings.GetBool("services.upnpserver"))
-      g_application.StartUPnPServer();
-    else
-      g_application.StopUPnPServer();
-#endif
-  }
-  else if (strSetting.Equals("services.upnprenderer"))
-  {
-#ifdef HAS_UPNP
-    if (g_guiSettings.GetBool("services.upnprenderer"))
-      g_application.StartUPnPRenderer();
-    else
-      g_application.StopUPnPRenderer();
-#endif
-  }
-  else if (strSetting.Equals("services.upnpcontroller"))
-  {
-#ifdef HAS_UPNP
-    g_application.StopUPnPClient(); /* always stop and restart */
-    if (g_guiSettings.GetBool("services.upnpcontroller"))
-      g_application.StartUPnPClient();
-#endif
-  }
-  else if (strSetting.Equals("services.esenabled"))
-  {
-#ifdef HAS_EVENT_SERVER
-    if (g_guiSettings.GetBool("services.esenabled"))
-    {
-      if (!g_application.StartEventServer())
-      {
-        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
-        g_guiSettings.SetBool("services.esenabled", false);
-        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-        if (pControl) pControl->SetEnabled(false);
-      }
-    }
-    else
-    {
-      if (!g_application.StopEventServer(true, true))
-      {
-        g_guiSettings.SetBool("services.esenabled", true);
-        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-        if (pControl) pControl->SetEnabled(true);
-      }
-    }
-#endif
-#ifdef HAS_JSONRPC
-    if (g_guiSettings.GetBool("services.esenabled"))
-    {
-      if (!g_application.StartJSONRPCServer())
-        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33103), "", g_localizeStrings.Get(33100), "");
-    }
-    else
-      g_application.StopJSONRPCServer(false);
-#endif
-  }
-  else if (strSetting.Equals("services.esport"))
-  {
-#ifdef HAS_EVENT_SERVER
-    ValidatePortNumber(pSettingControl, "9777", "9777");
-    //restart eventserver without asking user
-    if (g_application.StopEventServer(true, false))
-    {
-      if (!g_application.StartEventServer())
-        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
-    }
-#if defined(TARGET_DARWIN_OSX)
-    //reconfigure XBMCHelper for port changes
-    XBMCHelper::GetInstance().Configure();
-#endif
-#endif
-  }
-  else if (strSetting.Equals("services.esallinterfaces"))
-  {
-#ifdef HAS_EVENT_SERVER
-    if (g_guiSettings.GetBool("services.esenabled"))
-    {
-      if (g_application.StopEventServer(true, true))
-      {
-        if (!g_application.StartEventServer())
-          CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
-      }
-      else
-      {
-        g_guiSettings.SetBool("services.esenabled", true);
-        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
-        if (pControl) pControl->SetEnabled(true);
-      }
-    }
-#endif
-#ifdef HAS_JSONRPC
-    if (g_guiSettings.GetBool("services.esenabled"))
-    {
-      if (!g_application.StartJSONRPCServer())
-        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33103), "", g_localizeStrings.Get(33100), "");
-    }
-    else
-      g_application.StopJSONRPCServer(false);
-#endif
-  }
-  else if (strSetting.Equals("services.esinitialdelay") ||
-           strSetting.Equals("services.escontinuousdelay"))
-  {
-#ifdef HAS_EVENT_SERVER
-    if (g_guiSettings.GetBool("services.esenabled"))
-    {
-      g_application.RefreshEventServer();
-    }
-#endif
-  }
-  else if (strSetting.Equals("pvrmanager.enabled"))
-  {
-    if (g_guiSettings.GetBool("pvrmanager.enabled"))
-      CApplicationMessenger::Get().ExecBuiltIn("XBMC.StartPVRManager", false);
-    else
-      CApplicationMessenger::Get().ExecBuiltIn("XBMC.StopPVRManager", false);
-  }
-  else if (strSetting.Equals("masterlock.lockcode"))
-  {
-    // Now Prompt User to enter the old and then the new MasterCode!
-    if(g_passwordManager.SetMasterLockMode())
-    {
-      // We asked for the master password and saved the new one!
-      // Nothing todo here
-    }
-  }
-  else if (strSetting.Equals("network.interface"))
-  {
-     NetworkInterfaceChanged();
-  }
-#ifdef HAS_LINUX_NETWORK
-  else if (strSetting.Equals("network.save"))
-  {
-     NetworkAssignment iAssignment;
-     CStdString sIPAddress;
-     CStdString sNetworkMask;
-     CStdString sDefaultGateway;
-     CStdString sWirelessNetwork;
-     CStdString sWirelessKey;
-     CStdString sDns;
-     EncMode iWirelessEnc;
-     CStdString ifaceName;
-
-     CGUISpinControlEx *ifaceControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
-     ifaceName = ifaceControl->GetLabel();
-     CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
-
-     // Update controls with information
-     CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
-     if (pControl1) iAssignment = (NetworkAssignment) pControl1->GetValue();
-     CGUIButtonControl* pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.ipaddress")->GetID());
-     if (pControl2) sIPAddress = pControl2->GetLabel2();
-     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.subnet")->GetID());
-     if (pControl2) sNetworkMask = pControl2->GetLabel2();
-     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.gateway")->GetID());
-     if (pControl2) sDefaultGateway = pControl2->GetLabel2();
-     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.dns")->GetID());
-     if (pControl2) sDns = pControl2->GetLabel2();
-     pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
-     if (pControl1) iWirelessEnc = (EncMode) pControl1->GetValue();
-     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.essid")->GetID());
-     if (pControl2) sWirelessNetwork = pControl2->GetLabel2();
-     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.key")->GetID());
-     if (pControl2) sWirelessKey = pControl2->GetLabel2();
-
-     CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
-     pDlgProgress->SetLine(0, "");
-     pDlgProgress->SetLine(1, g_localizeStrings.Get(784));
-     pDlgProgress->SetLine(2, "");
-     pDlgProgress->StartModal();
-     pDlgProgress->Progress();
-
-     std::vector<CStdString> nameServers;
-     nameServers.push_back(sDns);
-     g_application.getNetwork().SetNameServers(nameServers);
-     iface->SetSettings(iAssignment, sIPAddress, sNetworkMask, sDefaultGateway, sWirelessNetwork, sWirelessKey, iWirelessEnc);
-
-     pDlgProgress->Close();
-
-     if (iAssignment == NETWORK_DISABLED)
-        CGUIDialogOK::ShowAndGetInput(0, 788, 0, 0);
-     else if (iface->IsConnected())
-        CGUIDialogOK::ShowAndGetInput(0, 785, 0, 0);
-     else
-        CGUIDialogOK::ShowAndGetInput(0, 786, 0, 0);
-  }
-  else if (strSetting.Equals("network.essid"))
-  {
-    CGUIDialogAccessPoints *dialog = (CGUIDialogAccessPoints *)g_windowManager.GetWindow(WINDOW_DIALOG_ACCESS_POINTS);
-    if (dialog)
-    {
-       CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
-       dialog->SetInterfaceName(pControl->GetLabel());
-       dialog->DoModal();
-
-       if (dialog->WasItemSelected())
-       {
-          CGUIButtonControl* pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.essid")->GetID());
-          if (pControl2) pControl2->SetLabel2(dialog->GetSelectedAccessPointEssId());
-          pControl = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
-          if (pControl) pControl->SetValue(dialog->GetSelectedAccessPointEncMode());
-       }
-    }
-  }
-#endif
-#ifdef _LINUX
-  else if (strSetting.Equals("locale.timezonecountry"))
-  {
-    CGUISpinControlEx *pControlCountry = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-    CStdString country = pControlCountry->GetCurrentLabel();
-
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezone")->GetID());
-    pControl->Clear();
-    vector<CStdString> timezones = g_timezone.GetTimezonesByCountry(country);
-    for (unsigned int i=0; i < timezones.size(); i++)
-    {
-      pControl->AddLabel(timezones[i], i);
-    }
-
-    g_timezone.SetTimezone(pControl->GetLabel());
-    g_guiSettings.SetString("locale.timezonecountry",pControlCountry->GetLabel().c_str());
-
-    CGUISpinControlEx *tzControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezone")->GetID());
-    g_guiSettings.SetString("locale.timezone", tzControl->GetLabel().c_str());
-
-    CDateTime::ResetTimezoneBias();
-  }
-  else  if (strSetting.Equals("locale.timezone"))
-  {
-     CGUISpinControlEx *tzControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezone")->GetID());
-     g_timezone.SetTimezone(tzControl->GetLabel());
-     g_guiSettings.SetString("locale.timezone", tzControl->GetLabel().c_str());
-
-     tzControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezonecountry")->GetID());
-     g_guiSettings.SetString("locale.timezonecountry", tzControl->GetLabel().c_str());
-
-     CDateTime::ResetTimezoneBias();
-  }
-#endif
-  else if (strSetting.Equals("lookandfeel.skinzoom"))
-  {
-    g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE);
-  }
-  else if (strSetting.Equals("videolibrary.flattentvshows") ||
-           strSetting.Equals("videolibrary.removeduplicates") ||
-           strSetting.Equals("videolibrary.groupmoviesets"))
-  {
-    CUtil::DeleteVideoDatabaseDirectoryCache();
-  }
-  else if (strSetting.Equals("pvrmenu.searchicons") && g_PVRManager.IsStarted())
-  {
-    g_PVRManager.SearchMissingChannelIcons();
-  }
-  else if (strSetting.Equals("pvrmanager.resetdb"))
-  {
-    if (g_PVRManager.CheckParentalPIN(g_localizeStrings.Get(19262).c_str()) &&
-        CGUIDialogYesNo::ShowAndGetInput(19098, 19186, 750, 0))
-    {
-      CDateTime::ResetTimezoneBias();
-      g_PVRManager.ResetDatabase(false);
-    }
-  }
-  else if (strSetting.Equals("epg.resetepg"))
-  {
-    if (CGUIDialogYesNo::ShowAndGetInput(19098, 19188, 750, 0))
-    {
-      CDateTime::ResetTimezoneBias();
-      g_PVRManager.ResetDatabase(true);
-    }
-  }
-  else if (strSetting.Equals("pvrmanager.channelscan") && g_PVRManager.IsStarted())
-  {
-    if (CGUIDialogYesNo::ShowAndGetInput(19098, 19118, 19194, 0))
-      g_PVRManager.StartChannelScan();
-  }
-  else if (strSetting.Equals("pvrmanager.channelmanager") && g_PVRManager.IsStarted())
-  {
-    CGUIDialogPVRChannelManager *dialog = (CGUIDialogPVRChannelManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_CHANNEL_MANAGER);
-    if (dialog)
-    {
-       dialog->DoModal();
-    }
-  }
-  else if (strSetting.Equals("pvrclient.menuhook") && g_PVRManager.IsStarted())
-  {
-    g_PVRManager.Get().Clients()->ProcessMenuHooks(-1, PVR_MENUHOOK_SETTING);
-  }
-  else if (strSetting.compare(0, 12, "audiooutput.") == 0)
-  {
-    if (strSetting.Equals("audiooutput.audiodevice"))
-    {
-      CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-#if defined(TARGET_DARWIN)
-      // save the sinkname - since we don't have sinks on osx
-      // we need to get the fitting sinkname for the device label from the
-      // factory
-      std::string label2sink = pControl->GetCurrentLabel();
-      CAEFactory::VerifyOutputDevice(label2sink, false);
-      g_guiSettings.SetString("audiooutput.audiodevice", label2sink.c_str());
-#else
-      g_guiSettings.SetString("audiooutput.audiodevice", m_AnalogAudioSinkMap[pControl->GetCurrentLabel()]);
-#endif
-    }
-#if !defined(TARGET_DARWIN)
-    else if (strSetting.Equals("audiooutput.passthroughdevice"))
-    {
-      CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
-      g_guiSettings.SetString("audiooutput.passthroughdevice", m_DigitalAudioSinkMap[pControl->GetCurrentLabel()]);
-    }
-#endif
-    else if (strSetting.Equals("audiooutput.guisoundmode"))
-    {
-      CAEFactory::SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
-    }
-
-    CAEFactory::OnSettingsChange(strSetting);
-  }
-  else if (strSetting.Equals("pvrparental.enabled"))
-  {
-    if (g_guiSettings.GetBool("pvrparental.enabled") && g_guiSettings.GetString("pvrparental.pin").GetLength() == 0)
-    {
-      CStdString newPassword = "";
-      bool bNewPassword = CGUIDialogNumeric::ShowAndVerifyNewPassword(newPassword);
-      if (bNewPassword)
-      {
-        // password set... save it
-        g_guiSettings.SetString("pvrparental.pin", newPassword);
-      }
-      else
-      {
-        // password not set... disable parental
-        g_guiSettings.SetBool("pvrparental.enabled", false);
-      }
-    }
-  }
-
-  UpdateSettings();
-}
-
-void CGUIWindowSettingsCategory::FreeControls()
-{
-  // clear the category group
-  CGUIControlGroupList *control = (CGUIControlGroupList *)GetControl(CATEGORY_GROUP_ID);
-  if (control)
-  {
-    control->FreeResources();
-    control->ClearAll();
-  }
-  m_vecSections.clear();
-  FreeSettingsControls();
-}
-
-void CGUIWindowSettingsCategory::FreeSettingsControls()
-{
-  // clear the settings group
-  CGUIControlGroupList *control = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
-  if (control)
-  {
-    control->FreeResources();
-    control->ClearAll();
-  }
-
-  for (int i = 0; (size_t)i < m_vecSettings.size(); i++)
-    m_vecSettings[i]->Clear();
-
-  m_vecSettings.clear();
-}
-
-CGUIControl* CGUIWindowSettingsCategory::AddSetting(CSetting *pSetting, float width, int &iControlID)
-{
-  if (!pSetting->IsVisible()) return NULL;  // not displayed in current session
-  BaseSettingControlPtr pSettingControl;
-  CGUIControl *pControl = NULL;
-  if (pSetting->GetControlType() == CHECKMARK_CONTROL)
-  {
-    pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
-    if (!pControl) return NULL;
-    ((CGUIRadioButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
-    pControl->SetWidth(width);
-    pSettingControl.reset(new CRadioButtonSettingControl((CGUIRadioButtonControl *)pControl, iControlID, pSetting));
-  }
-  else if (pSetting->GetControlType() == SPIN_CONTROL_FLOAT || pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || pSetting->GetControlType() == SPIN_CONTROL_TEXT || pSetting->GetControlType() == SPIN_CONTROL_INT)
-  {
-    pControl = new CGUISpinControlEx(*m_pOriginalSpin);
-    if (!pControl) return NULL;
-    pControl->SetWidth(width);
-    ((CGUISpinControlEx *)pControl)->SetText(g_localizeStrings.Get(pSetting->GetLabel()));
-    pSettingControl.reset(new CSpinExSettingControl((CGUISpinControlEx *)pControl, iControlID, pSetting));
-  }
-  else if (pSetting->GetControlType() == SEPARATOR_CONTROL && m_pOriginalImage)
-  {
-    pControl = new CGUIImage(*m_pOriginalImage);
-    if (!pControl) return NULL;
-    pControl->SetWidth(width);
-    pSettingControl.reset(new CSeparatorSettingControl((CGUIImage *)pControl, iControlID, pSetting));
-  }
-  else if (pSetting->GetControlType() == EDIT_CONTROL_INPUT ||
-           pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_INPUT ||
-           pSetting->GetControlType() == EDIT_CONTROL_MD5_INPUT ||
-           pSetting->GetControlType() == EDIT_CONTROL_NUMBER_INPUT ||
-           pSetting->GetControlType() == EDIT_CONTROL_IP_INPUT ||
-           pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_NUMBER_VERIFY_NEW )
-  {
-    pControl = new CGUIEditControl(*m_pOriginalEdit);
-    if (!pControl) return NULL;
-    ((CGUIEditControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
-    pControl->SetWidth(width);
-    pSettingControl.reset(new CEditSettingControl((CGUIEditControl *)pControl, iControlID, pSetting));
-  }
-  else if (pSetting->GetControlType() != SEPARATOR_CONTROL) // button control
-  {
-    pControl = new CGUIButtonControl(*m_pOriginalButton);
-    if (!pControl) return NULL;
-    ((CGUIButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
-    pControl->SetWidth(width);
-    pSettingControl.reset(new CButtonSettingControl((CGUIButtonControl *)pControl, iControlID, pSetting));
-  }
-  if (!pControl)
-  {
-    pSettingControl.reset();
-    return NULL;
-  }
-  pControl->SetID(iControlID++);
-  pControl->SetVisible(true);
-  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
-  if (group)
-  {
-    pControl->AllocResources();
-    group->AddControl(pControl);
-  }
-  m_vecSettings.push_back(pSettingControl);
-  return pControl;
-}
-
-void CGUIWindowSettingsCategory::FrameMove()
-{
-  if (m_delayedSetting && m_delayedTimer.GetElapsedMilliseconds() > 3000)
-  { // we send a thread message so that it's processed the following frame (some settings won't
-    // like being changed during Render())
-    CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID());
-    g_windowManager.SendThreadMessage(message, GetID());
-    m_delayedTimer.Stop();
-  }
-  CGUIWindow::FrameMove();
-}
-
-void CGUIWindowSettingsCategory::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
-{
-  // update alpha status of current button
-  bool bAlphaFaded = false;
-  CGUIControl *control = GetFirstFocusableControl(CONTROL_START_BUTTONS + m_iSection);
-  if (control && !control->HasFocus())
-  {
-    if (control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
-    {
-      control->SetFocus(true);
-      ((CGUIButtonControl *)control)->SetAlpha(0x80);
-      bAlphaFaded = true;
-    }
-    else if (control->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)
-    {
-      control->SetFocus(true);
-      ((CGUIButtonControl *)control)->SetSelected(true);
-      bAlphaFaded = true;
-    }
-  }
-  CGUIWindow::DoProcess(currentTime, dirtyregions);
-  if (bAlphaFaded)
-  {
-    control->SetFocus(false);
-    if (control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
-      ((CGUIButtonControl *)control)->SetAlpha(0xFF);
-    else
-      ((CGUIButtonControl *)control)->SetSelected(false);
-  }
-}
-
-void CGUIWindowSettingsCategory::Render()
-{
-  CGUIWindow::Render();
-}
-
-void CGUIWindowSettingsCategory::FillInSubtitleHeights(CSetting *pSetting, CGUISpinControlEx *pControl)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
-  pControl->Clear();
-  if (CUtil::IsUsingTTFSubtitles())
-  { // easy - just fill as per usual
-    CStdString strLabel;
-    for (int i = pSettingInt->m_iMin; i <= pSettingInt->m_iMax; i += pSettingInt->m_iStep)
-    {
-      if (pSettingInt->m_iFormat > -1)
-      {
-        CStdString strFormat = g_localizeStrings.Get(pSettingInt->m_iFormat);
-        strLabel.Format(strFormat, i);
-      }
-      else
-        strLabel.Format(pSettingInt->m_strFormat, i);
-      pControl->AddLabel(strLabel, i);
-    }
-    pControl->SetValue(pSettingInt->GetData());
-  }
-}
-
-void CGUIWindowSettingsCategory::FillInSubtitleFonts(CSetting *pSetting)
-{
-  CSettingString *pSettingString = (CSettingString*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
-  pControl->Clear();
-  int iCurrentFont = 0;
-  int iFont = 0;
-
-  // find TTF fonts
-  {
-    CFileItemList items;
-    CFileItemList items2;
-    CDirectory::GetDirectory("special://home/media/Fonts/", items2);
-
-    if (CDirectory::GetDirectory("special://xbmc/media/Fonts/", items))
-    {
-      items.Append(items2);
-      for (int i = 0; i < items.Size(); ++i)
-      {
-        CFileItemPtr pItem = items[i];
-
-        if (!pItem->m_bIsFolder)
-        {
-
-          if ( !URIUtils::GetExtension(pItem->GetLabel()).Equals(".ttf") ) continue;
-          if (pItem->GetLabel().Equals(pSettingString->GetData(), false))
-            iCurrentFont = iFont;
-
-          pControl->AddLabel(pItem->GetLabel(), iFont++);
-        }
-
-      }
-    }
-  }
-  pControl->SetValue(iCurrentFont);
-}
-
-void CGUIWindowSettingsCategory::FillInSkinFonts(CSetting *pSetting)
-{
-  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
-  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
-  pControl->Clear();
-  setting->SetDelayed();
-
-  m_SkinFontSetIDs.clear();
-  int iSkinFontSet = 0;
-
-  CStdString strPath = g_SkinInfo->GetSkinPath("Font.xml");
-
-  CXBMCTinyXML xmlDoc;
-  if (!xmlDoc.LoadFile(strPath))
-  {
-    CLog::Log(LOGERROR, "Couldn't load %s", strPath.c_str());
-    return ;
-  }
-
-  TiXmlElement* pRootElement = xmlDoc.RootElement();
-
-  CStdString strValue = pRootElement->Value();
-  if (strValue != CStdString("fonts"))
-  {
-    CLog::Log(LOGERROR, "file %s doesnt start with <fonts>", strPath.c_str());
-    return ;
-  }
-
-  const TiXmlNode *pChild = pRootElement->FirstChild();
-  strValue = pChild->Value();
-  if (strValue == "fontset")
-  {
-    while (pChild)
-    {
-      strValue = pChild->Value();
-      if (strValue == "fontset")
-      {
-        const char* idAttr = ((TiXmlElement*) pChild)->Attribute("id");
-        const char* idLocAttr = ((TiXmlElement*) pChild)->Attribute("idloc");
-        const char* unicodeAttr = ((TiXmlElement*) pChild)->Attribute("unicode");
-
-        bool isUnicode=(unicodeAttr && stricmp(unicodeAttr, "true") == 0);
-
-        bool isAllowed=true;
-        if (g_langInfo.ForceUnicodeFont() && !isUnicode)
-          isAllowed=false;
-
-        if (idAttr != NULL && isAllowed)
-        {
-          if (idLocAttr)
-          {
-            pControl->AddLabel(g_localizeStrings.Get(atoi(idLocAttr)), iSkinFontSet);
-            m_SkinFontSetIDs[g_localizeStrings.Get(atoi(idLocAttr))] = idAttr;
-          }
-          else
-          {
-            pControl->AddLabel(idAttr, iSkinFontSet);
-            m_SkinFontSetIDs[idAttr] = idAttr;
-          }
-          if (strcmpi(idAttr, g_guiSettings.GetString("lookandfeel.font").c_str()) == 0)
-            pControl->SetValue(iSkinFontSet);
-          iSkinFontSet++;
-        }
-      }
-      pChild = pChild->NextSibling();
-    }
-
-  }
-  else
-  {
-    // Since no fontset is defined, there is no selection of a fontset, so disable the component
-    pControl->AddLabel(g_localizeStrings.Get(13278), 1);
-    pControl->SetValue(1);
-    pControl->SetEnabled(false);
-  }
-}
-
-void CGUIWindowSettingsCategory::FillInSoundSkins(CSetting *pSetting)
-{
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
-  pControl->Clear();
-  pControl->SetShowRange(true);
-
-  //find skins...
-  CFileItemList items;
-  CDirectory::GetDirectory("special://xbmc/sounds/", items);
-  CDirectory::GetDirectory("special://home/sounds/", items);
-
-  int iCurrentSoundSkin = 0;
-  int iSoundSkin = 0;
-  vector<CStdString> vecSoundSkins;
-  int i;
-  for (i = 0; i < items.Size(); ++i)
-  {
-    CFileItemPtr pItem = items[i];
-    if (pItem->m_bIsFolder)
-    {
-      if (strcmpi(pItem->GetLabel().c_str(), ".svn") == 0) continue;
-      if (strcmpi(pItem->GetLabel().c_str(), "fonts") == 0) continue;
-      if (strcmpi(pItem->GetLabel().c_str(), "media") == 0) continue;
-      vecSoundSkins.push_back(pItem->GetLabel());
-    }
-  }
-
-  pControl->AddLabel(g_localizeStrings.Get(474), iSoundSkin++); // Off
-  pControl->AddLabel(g_localizeStrings.Get(15109), iSoundSkin++); // Skin Default
-
-  if (g_guiSettings.GetString("lookandfeel.soundskin")=="SKINDEFAULT")
-    iCurrentSoundSkin=1;
-
-  sort(vecSoundSkins.begin(), vecSoundSkins.end(), sortstringbyname());
-  for (i = 0; i < (int) vecSoundSkins.size(); ++i)
-  {
-    CStdString strSkin = vecSoundSkins[i];
-    if (strcmpi(strSkin.c_str(), g_guiSettings.GetString("lookandfeel.soundskin").c_str()) == 0)
-    {
-      iCurrentSoundSkin = iSoundSkin;
-    }
-    pControl->AddLabel(strSkin, iSoundSkin++);
-  }
-  pControl->SetValue(iCurrentSoundSkin);
-  return ;
-}
-
-void CGUIWindowSettingsCategory::FillInCharSets(CSetting *pSetting)
-{
-  CSettingString *pSettingString = (CSettingString*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
-  pControl->Clear();
-  int iCurrentCharset = 0;
-  vector<CStdString> vecCharsets = g_charsetConverter.getCharsetLabels();
-
-  CStdString strCurrentCharsetLabel="DEFAULT";
-  if (pSettingString->GetData()!="DEFAULT")
-    strCurrentCharsetLabel = g_charsetConverter.getCharsetLabelByName(pSettingString->GetData());
-
-  sort(vecCharsets.begin(), vecCharsets.end(), sortstringbyname());
-
-  vecCharsets.insert(vecCharsets.begin(), g_localizeStrings.Get(13278)); // "Default"
-
-  bool bIsAuto=(pSettingString->GetData()=="DEFAULT");
-
-  for (int i = 0; i < (int) vecCharsets.size(); ++i)
-  {
-    CStdString strCharsetLabel = vecCharsets[i];
-
-    if (!bIsAuto && strCharsetLabel == strCurrentCharsetLabel)
-      iCurrentCharset = i;
-
-    pControl->AddLabel(strCharsetLabel, i);
-  }
-
-  pControl->SetValue(iCurrentCharset);
-}
-
-DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RESOLUTION res)
-{
-  DisplayMode mode;
-  if (res == RES_WINDOW)
-    mode = DM_WINDOWED;
-  else
-    mode = g_settings.m_ResInfo[res].iScreen;
-
-  // we expect "videoscreen.screen" but it might be hidden on some platforms,
-  // so check that we actually have a visable control.
-  BaseSettingControlPtr control = GetSetting(strSetting);
-  if (control)
-  {
-    control->SetDelayed();
-    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
-    pControl->Clear();
-
-    CStdString strScreen;
-    if (g_advancedSettings.m_canWindowed)
-      pControl->AddLabel(g_localizeStrings.Get(242), -1);
-
-    for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++)
-    {
-      strScreen.Format(g_localizeStrings.Get(241), g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen + 1);
-      pControl->AddLabel(strScreen, g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen);
-    }
-    pControl->SetValue(mode);
-    g_guiSettings.SetInt("videoscreen.screen", mode);
-  }
-
-  return mode;
-}
-
-void CGUIWindowSettingsCategory::FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange)
-{
-  BaseSettingControlPtr control = GetSetting(strSetting);
-  control->SetDelayed();
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
-
-  pControl->Clear();
-
-  RESOLUTION spinres = RES_INVALID; // index of the resolution in the spinner that has same screen/width/height as res
-
-  if (mode == DM_WINDOWED)
-  {
-    pControl->AddLabel(g_localizeStrings.Get(242), RES_WINDOW);
-    spinres = RES_WINDOW;
-  }
-  else
-  {
-    vector<RESOLUTION_WHR> resolutions = g_Windowing.ScreenResolutions(mode);
-
-    for (unsigned int idx = 0; idx < resolutions.size(); idx++)
-    {
-      CStdString strRes;
-      strRes.Format("%dx%d%s", resolutions[idx].width, resolutions[idx].height,
-        (resolutions[idx].interlaced == D3DPRESENTFLAG_INTERLACED) ? "i" : "p");
-      pControl->AddLabel(strRes, resolutions[idx].ResInfo_Index);
-
-      RESOLUTION_INFO res1 = g_settings.m_ResInfo[res];
-      RESOLUTION_INFO res2 = g_settings.m_ResInfo[resolutions[idx].ResInfo_Index];
-      if (   res1.iScreen == res2.iScreen
-          && res1.iScreenWidth  == res2.iScreenWidth
-          && res1.iScreenHeight == res2.iScreenHeight
-          && (res1.dwFlags & D3DPRESENTFLAG_INTERLACED) == (res2.dwFlags & D3DPRESENTFLAG_INTERLACED))
-        spinres = (RESOLUTION) resolutions[idx].ResInfo_Index;
-    }
-  }
-
-  if (UserChange)
-  {
-    // Auto-select the windowed or desktop resolution of the screen
-    int autoresolution = RES_DESKTOP;
-    if (mode == DM_WINDOWED)
-    {
-      autoresolution = RES_WINDOW;
-    }
-    else
-    {
-      for (int idx=0; idx < g_Windowing.GetNumScreens(); idx++)
-        if (g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen == mode)
-        {
-          autoresolution = RES_DESKTOP + idx;
-          break;
-        }
-    }
-    pControl->SetValue(autoresolution);
-
-    // Cascade
-    FillInRefreshRates("videoscreen.screenmode", (RESOLUTION) autoresolution, true);
-  }
-  else
-  {
-    // select the entry equivalent to the resolution passed by the res parameter
-    pControl->SetValue(spinres);
-  }
-}
-
-void CGUIWindowSettingsCategory::FillInRefreshRates(CStdString strSetting, RESOLUTION res, bool UserChange)
-{
-  // The only meaningful parts of res here are iScreen, iScreenWidth, iScreenHeight
-
-  vector<REFRESHRATE> refreshrates;
-  if (res > RES_WINDOW)
-    refreshrates = g_Windowing.RefreshRates(g_settings.m_ResInfo[res].iScreen,
-      g_settings.m_ResInfo[res].iScreenWidth,
-      g_settings.m_ResInfo[res].iScreenHeight,
-      g_settings.m_ResInfo[res].dwFlags);
-
-  // The control setting doesn't exist when not in standalone mode, don't manipulate it
-  BaseSettingControlPtr control = GetSetting(strSetting);
-  CGUISpinControlEx *pControl= NULL;
-
-  // Populate
-  if (control)
-  {
-    control->SetDelayed();
-    pControl = (CGUISpinControlEx *)GetControl(control->GetID());
-    pControl->Clear();
-
-    if (res == RES_WINDOW)
-    {
-      pControl->AddLabel(g_localizeStrings.Get(242), RES_WINDOW);
-    }
-    else
-    {
-      for (unsigned int idx = 0; idx < refreshrates.size(); idx++)
-      {
-        CStdString strRR;
-        strRR.Format("%.02f", refreshrates[idx].RefreshRate);
-        pControl->AddLabel(strRR, refreshrates[idx].ResInfo_Index);
-      }
-    }
-  }
-
-  // Select a rate
-  if (UserChange)
-  {
-    RESOLUTION newresolution;
-    if (res == RES_WINDOW)
-      newresolution = RES_WINDOW;
-    else
-      newresolution = (RESOLUTION) g_Windowing.DefaultRefreshRate(g_settings.m_ResInfo[res].iScreen, refreshrates).ResInfo_Index;
-
-    if (pControl)
-      pControl->SetValue(newresolution);
-
-    OnRefreshRateChanged(newresolution);
-  }
-  else
-  {
-    if (pControl)
-      pControl->SetValue(res);
-  }
-}
-
-void CGUIWindowSettingsCategory::OnRefreshRateChanged(RESOLUTION nextRes)
-{
-  RESOLUTION lastRes = g_graphicsContext.GetVideoResolution();
-  bool cancelled = false;
-
-  g_guiSettings.SetResolution(nextRes);
-  g_graphicsContext.SetVideoResolution(nextRes);
-
-  if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000))
-  {
-    g_guiSettings.SetResolution(lastRes);
-    g_graphicsContext.SetVideoResolution(lastRes);
-
-    DisplayMode mode = FillInScreens("videoscreen.screen", lastRes);
-    FillInResolutions("videoscreen.resolution", mode, lastRes, false);
-    FillInRefreshRates("videoscreen.screenmode", lastRes, false);
-  }
-}
-
-void CGUIWindowSettingsCategory::FillInLanguages(CSetting *pSetting, const std::vector<CStdString> &languages /* = std::vector<CStdString>() */, const std::vector<CStdString> &languageKeys /* = std::vector<CStdString>() */)
-{
-  CSettingString *pSettingString = (CSettingString *)pSetting;
-  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
-  pControl->Clear();
-
-  //find languages...
-  CFileItemList items;
-  CDirectory::GetDirectory("special://xbmc/language/", items);
-
-  int iCurrentLang = 0;
-  vector<CStdString> vecLanguage;
-  for (int i = 0; i < items.Size(); ++i)
-  {
-    CFileItemPtr pItem = items[i];
-    if (pItem->m_bIsFolder)
-    {
-      if (strcmpi(pItem->GetLabel().c_str(), ".svn") == 0) continue;
-      if (strcmpi(pItem->GetLabel().c_str(), "fonts") == 0) continue;
-      if (strcmpi(pItem->GetLabel().c_str(), "media") == 0) continue;
-      vecLanguage.push_back(pItem->GetLabel());
-    }
-  }
-
-  sort(vecLanguage.begin(), vecLanguage.end(), sortstringbyname());
-  // Add language options passed by parameter at the beginning
-  if (languages.size() > 0)
-    vecLanguage.insert(vecLanguage.begin(), languages.begin(), languages.begin() + languages.size());
-  for (unsigned int i = 0; i < vecLanguage.size(); ++i)
-  {
-    CStdString strLanguage = vecLanguage[i];
-    if ((i < languageKeys.size() && strcmpi(languageKeys[i].c_str(), pSettingString->GetData().c_str()) == 0) ||
-        strcmpi(strLanguage.c_str(), pSettingString->GetData().c_str()) == 0)
-      iCurrentLang = i;
-    pControl->AddLabel(strLanguage, i);
-  }
-
-  pControl->SetValue(iCurrentLang);
-}
-
-void CGUIWindowSettingsCategory::FillInRegions(CSetting *pSetting)
-{
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
-  pControl->Clear();
-
-  int iCurrentRegion=0;
-  CStdStringArray regions;
-  g_langInfo.GetRegionNames(regions);
-
-  CStdString strCurrentRegion=g_langInfo.GetCurrentRegion();
-
-  sort(regions.begin(), regions.end(), sortstringbyname());
-
-  for (int i = 0; i < (int) regions.size(); ++i)
-  {
-    const CStdString& strRegion = regions[i];
-
-    if (strRegion == strCurrentRegion)
-      iCurrentRegion = i;
-
-    pControl->AddLabel(strRegion, i);
-  }
-
-  pControl->SetValue(iCurrentRegion);
-}
-
-BaseSettingControlPtr CGUIWindowSettingsCategory::GetSetting(const CStdString &strSetting)
-{
-  for (unsigned int i = 0; i < m_vecSettings.size(); i++)
-  {
-    if (m_vecSettings[i]->GetSetting()->GetSetting() == strSetting)
-      return m_vecSettings[i];
-  }
-  return BaseSettingControlPtr();
-}
-
-void CGUIWindowSettingsCategory::FillInSkinThemes(CSetting *pSetting)
-{
-  // There is a default theme (just Textures.xpr/xbt)
-  // any other *.xpr|*.xbt files are additional themes on top of this one.
-  CSettingString *pSettingString = (CSettingString *)pSetting;
-  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
-  CStdString strSettingString = g_guiSettings.GetString("lookandfeel.skintheme");
-  setting->SetDelayed();
-
-  // Clear and add. the Default Label
-  pControl->Clear();
-  pControl->SetShowRange(true);
-  pControl->AddLabel(g_localizeStrings.Get(15109), 0); // "SKINDEFAULT" The standard Textures.xpr/xbt will be used
-
-  CStdString strDefaultTheme = pSettingString->GetData();
-
-  // Search for Themes in the Current skin!
-  vector<CStdString> vecTheme;
-  CUtil::GetSkinThemes(vecTheme);
-
-  // Remove the extension from the current Theme (backward compat)
-  URIUtils::RemoveExtension(strSettingString);
-
-  // Sort the Themes for GUI and list them
-  int iCurrentTheme = 0;
-  for (int i = 0; i < (int) vecTheme.size(); ++i)
-  {
-    CStdString strTheme = vecTheme[i];
-    // Is the Current Theme our Used Theme! If yes set the ID!
-    if (strTheme.CompareNoCase(strSettingString) == 0 )
-      iCurrentTheme = i + 1; // 1: #of Predefined Theme [Label]
-    pControl->AddLabel(strTheme, i + 1);
-  }
-  // Set the Choosen Theme
-  pControl->SetValue(iCurrentTheme);
-}
-
-void CGUIWindowSettingsCategory::FillInSkinColors(CSetting *pSetting)
-{
-  // There is a default theme (just defaults.xml)
-  // any other *.xml files are additional color themes on top of this one.
-  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
-  CStdString strSettingString = g_guiSettings.GetString("lookandfeel.skincolors");
-  setting->SetDelayed();
-
-  // Clear and add. the Default Label
-  pControl->Clear();
-  pControl->SetShowRange(true);
-  pControl->AddLabel(g_localizeStrings.Get(15109), 0); // "SKINDEFAULT"! The standard defaults.xml will be used!
-
-  // Search for colors in the Current skin!
-  vector<CStdString> vecColors;
-
-  CStdString strPath;
-  URIUtils::AddFileToFolder(g_SkinInfo->Path(),"colors",strPath);
-
-  CFileItemList items;
-  CDirectory::GetDirectory(CSpecialProtocol::TranslatePathConvertCase(strPath), items, ".xml");
-  // Search for Themes in the Current skin!
-  for (int i = 0; i < items.Size(); ++i)
-  {
-    CFileItemPtr pItem = items[i];
-    if (!pItem->m_bIsFolder && pItem->GetLabel().CompareNoCase("defaults.xml") != 0)
-    { // not the default one
-      CStdString strLabel = pItem->GetLabel();
-      vecColors.push_back(strLabel.Mid(0, strLabel.size() - 4));
-    }
-  }
-  sort(vecColors.begin(), vecColors.end(), sortstringbyname());
-
-  // Remove the .xml extension from the Themes
-  if (URIUtils::GetExtension(strSettingString) == ".xml")
-    URIUtils::RemoveExtension(strSettingString);
-
-  int iCurrentColor = 0;
-  for (int i = 0; i < (int) vecColors.size(); ++i)
-  {
-    CStdString strColor = vecColors[i];
-    // Is the Current Theme our Used Theme! If yes set the ID!
-    if (strColor.CompareNoCase(strSettingString) == 0 )
-      iCurrentColor = i + 1; // 1: #of Predefined Theme [Label]
-    pControl->AddLabel(strColor, i + 1);
-  }
-  // Set the Choosen Theme
-  pControl->SetValue(iCurrentColor);
-}
-
-void CGUIWindowSettingsCategory::FillInStartupWindow(CSetting *pSetting)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->Clear();
-
-  const vector<CSkinInfo::CStartupWindow> &startupWindows = g_SkinInfo->GetStartupWindows();
-
-  // TODO: How should we localize this?
-  // In the long run there is no way to do it really without the skin having some
-  // translation information built in to it, which isn't really feasible.
-
-  // Alternatively we could lookup the strings in the english strings file to get
-  // their id and then get the string from that
-
-  // easier would be to have the skinner use the "name" as the label number.
-
-  // eg <window id="0">513</window>
-
-  bool currentSettingFound(false);
-  for (vector<CSkinInfo::CStartupWindow>::const_iterator it = startupWindows.begin(); it != startupWindows.end(); it++)
-  {
-    CStdString windowName((*it).m_name);
-    if (StringUtils::IsNaturalNumber(windowName))
-      windowName = g_localizeStrings.Get(atoi(windowName.c_str()));
-    int windowID((*it).m_id);
-    pControl->AddLabel(windowName, windowID);
-    if (pSettingInt->GetData() == windowID)
-      currentSettingFound = true;
-  }
-
-  // ok, now check whether our current option is one of these
-  // and set it's value
-  if (!currentSettingFound)
-  { // nope - set it to the "default" option - the first one
-    pSettingInt->SetData(startupWindows[0].m_id);
-  }
-  pControl->SetValue(pSettingInt->GetData());
-}
-
-void CGUIWindowSettingsCategory::OnInitWindow()
-{
-  m_strOldTrackFormat = g_guiSettings.GetString("musicfiles.trackformat");
-  m_strOldTrackFormatRight = g_guiSettings.GetString("musicfiles.trackformatright");
-  SetupControls();
-  CGUIWindow::OnInitWindow();
-}
-
-void CGUIWindowSettingsCategory::FillInViewModes(CSetting *pSetting, int windowID)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->AddLabel("Auto", DEFAULT_VIEW_AUTO);
-  bool found(false);
-  int foundType = 0;
-  CGUIWindow *window = g_windowManager.GetWindow(windowID);
-  if (window)
-  {
-    window->Initialize();
-    for (int i = 50; i < 60; i++)
-    {
-      IGUIContainer *control = (IGUIContainer *)window->GetControl(i);
-      if (control)
-      {
-        int type = (control->GetType() << 16) | i;
-        pControl->AddLabel(control->GetLabel(), type);
-        if (type == pSettingInt->GetData())
-          found = true;
-        else if ((type >> 16) == (pSettingInt->GetData() >> 16))
-          foundType = type;
-      }
-    }
-    window->ClearAll();
-  }
-  if (!found)
-    pSettingInt->SetData(foundType ? foundType : (DEFAULT_VIEW_AUTO));
-  pControl->SetValue(pSettingInt->GetData());
-}
-
-void CGUIWindowSettingsCategory::FillInSortMethods(CSetting *pSetting, int windowID)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  CFileItemList items("C:");
-  CGUIViewState *state = CGUIViewState::GetViewState(windowID, items);
-  if (state)
-  {
-    bool found(false);
-    vector< pair<int,int> > sortMethods;
-    state->GetSortMethods(sortMethods);
-    for (unsigned int i = 0; i < sortMethods.size(); i++)
-    {
-      pControl->AddLabel(g_localizeStrings.Get(sortMethods[i].second), sortMethods[i].first);
-      if (sortMethods[i].first == pSettingInt->GetData())
-        found = true;
-    }
-    if (!found && sortMethods.size())
-      pSettingInt->SetData(sortMethods[0].first);
-  }
-  pControl->SetValue(pSettingInt->GetData());
-  delete state;
-}
-
-void CGUIWindowSettingsCategory::FillInNetworkInterfaces(CSetting *pSetting, float groupWidth, int &iControlID)
-{
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, groupWidth, iControlID);
-  pControl->Clear();
-
-  // query list of interfaces
-  vector<CStdString> vecInterfaces;
-  std::vector<CNetworkInterface*>& ifaces = g_application.getNetwork().GetInterfaceList();
-  std::vector<CNetworkInterface*>::const_iterator iter = ifaces.begin();
-  while (iter != ifaces.end())
-  {
-    CNetworkInterface* iface = *iter;
-    vecInterfaces.push_back(iface->GetName());
-    ++iter;
-  }
-  sort(vecInterfaces.begin(), vecInterfaces.end(), sortstringbyname());
-
-  int iInterface = 0;
-  for (unsigned int i = 0; i < vecInterfaces.size(); ++i)
-    pControl->AddLabel(vecInterfaces[i], iInterface++);
-}
-
-void CGUIWindowSettingsCategory::FillInEpgGuideView(CSetting *pSetting)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->Clear();
-
-  pControl->AddLabel(g_localizeStrings.Get(19029), GUIDE_VIEW_CHANNEL);
-  pControl->AddLabel(g_localizeStrings.Get(19030), GUIDE_VIEW_NOW);
-  pControl->AddLabel(g_localizeStrings.Get(19031), GUIDE_VIEW_NEXT);
-  pControl->AddLabel(g_localizeStrings.Get(19032), GUIDE_VIEW_TIMELINE);
-
-  pControl->SetValue(pSettingInt->GetData());
-}
-
-void CGUIWindowSettingsCategory::FillInPvrStartLastChannel(CSetting *pSetting)
-{
-  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->Clear();
-
-  pControl->AddLabel(g_localizeStrings.Get(106),   START_LAST_CHANNEL_OFF);
-  pControl->AddLabel(g_localizeStrings.Get(19190), START_LAST_CHANNEL_MIN);
-  pControl->AddLabel(g_localizeStrings.Get(107),   START_LAST_CHANNEL_ON);
-
-  pControl->SetValue(pSettingInt->GetData());
-}
-
-void CGUIWindowSettingsCategory::FillInAudioDevices(CSetting* pSetting, bool Passthrough)
-{
-  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
-  pControl->Clear();
-
-  CStdString currentDevice = Passthrough ? g_guiSettings.GetString("audiooutput.passthroughdevice") : g_guiSettings.GetString("audiooutput.audiodevice");
-
-  if (Passthrough)
-  {
-    m_DigitalAudioSinkMap.clear();
-    m_DigitalAudioSinkMap["Error - no devices found"] = "null:";
-  }
-  else
-  {
-    m_AnalogAudioSinkMap.clear();
-    m_AnalogAudioSinkMap["Error - no devices found"] = "null:";
-  }
-
-  int selectedValue = -1;
-  AEDeviceList sinkList;
-  CAEFactory::EnumerateOutputDevices(sinkList, Passthrough);
-#if !defined(TARGET_DARWIN)
-  if (sinkList.size()==0)
-  {
-    pControl->AddLabel("Error - no devices found", 0);
-    selectedValue = 0;
-  }
-  else
-  {
-#endif
-    AEDeviceList::const_iterator iter = sinkList.begin();
-    for (int i=0; iter != sinkList.end(); iter++)
-    {
-      CStdString label = (*iter).first;
-      CStdString sink  = (*iter).second;
-      pControl->AddLabel(label.c_str(), i);
-
-      if (currentDevice.Equals(sink))
-        selectedValue = i;
-
-      if (Passthrough)
-        m_DigitalAudioSinkMap[label] = sink;
-      else
-        m_AnalogAudioSinkMap[label] = sink;
-
-      i++;
-    }
-
-#if !defined(TARGET_DARWIN)
-  }
-#endif
-
-  if (selectedValue < 0)
-  {
-    CLog::Log(LOGWARNING, "Failed to find previously selected audio sink");
-    pControl->SetValue(0);
-    if (!Passthrough)
-      ((CSettingString*)pSetting)->SetData(m_AnalogAudioSinkMap[pControl->GetCurrentLabel()]);
-    else
-      ((CSettingString*)pSetting)->SetData(m_DigitalAudioSinkMap[pControl->GetCurrentLabel()]);
-  }
-  else
-    pControl->SetValue(selectedValue);
-}
-
-void CGUIWindowSettingsCategory::NetworkInterfaceChanged(void)
-{
-#if 0
-   NetworkAssignment iAssignment;
-   CStdString sIPAddress;
-   CStdString sNetworkMask;
-   CStdString sDefaultGateway;
-   CStdString sWirelessNetwork;
-   CStdString sWirelessKey;
-   EncMode iWirelessEnc;
-   bool bIsWireless;
-   CStdString ifaceName;
-
-   // Get network information
-   CGUISpinControlEx *ifaceControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
-   ifaceName = ifaceControl->GetLabel();
-   CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
-   iface->GetSettings(iAssignment, sIPAddress, sNetworkMask, sDefaultGateway, sWirelessNetwork, sWirelessKey, iWirelessEnc);
-   bIsWireless = iface->IsWireless();
-
-   CStdString dns;
-   std::vector<CStdString> dnss = g_application.getNetwork().GetNameServers();
-   if (dnss.size() >= 1)
-      dns = dnss[0];
-
-   // Update controls with information
-   CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
-   if (pControl1) pControl1->SetValue(iAssignment);
-   GetSetting("network.dns")->GetSetting()->FromString(dns);
-   if (iAssignment == NETWORK_STATIC || iAssignment == NETWORK_DISABLED)
-   {
-     GetSetting("network.ipaddress")->GetSetting()->FromString(sIPAddress);
-     GetSetting("network.subnet")->GetSetting()->FromString(sNetworkMask);
-     GetSetting("network.gateway")->GetSetting()->FromString(sDefaultGateway);
-   }
-   else
-   {
-     GetSetting("network.ipaddress")->GetSetting()->FromString(iface->GetCurrentIPAddress());
-     GetSetting("network.subnet")->GetSetting()->FromString(iface->GetCurrentNetmask());
-     GetSetting("network.gateway")->GetSetting()->FromString(iface->GetCurrentDefaultGateway());
-   }
-
-   pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
-   if (pControl1) pControl1->SetValue(iWirelessEnc);
-
-   if (bIsWireless)
-   {
-      GetSetting("network.essid")->GetSetting()->FromString(sWirelessNetwork);
-      GetSetting("network.key")->GetSetting()->FromString(sWirelessKey);
-   }
-   else
-   {
-      GetSetting("network.essid")->GetSetting()->FromString("");
-      GetSetting("network.key")->GetSetting()->FromString("");
-   }
-#endif
-}
-
-void CGUIWindowSettingsCategory::ValidatePortNumber(BaseSettingControlPtr pSettingControl, const CStdString& userPort, const CStdString& privPort, bool listening/*=true*/)
-{
-  CSettingString *pSetting = (CSettingString *)pSettingControl->GetSetting();
-  // check that it's a valid port
-  int port = atoi(pSetting->GetData().c_str());
-#ifdef _LINUX
-  if (listening && !CUtil::CanBindPrivileged() && (port < 1024 || port > 65535))
-  {
-    CGUIDialogOK::ShowAndGetInput(257, 850, 852, -1);
-    pSetting->SetData(userPort.c_str());
-  }
-  else
-#endif
-  if (port <= 0 || port > 65535)
-  {
-    CGUIDialogOK::ShowAndGetInput(257, 850, 851, -1);
-    pSetting->SetData(privPort.c_str());
-  }
-}
diff --git a/xbmc/settings/GUIWindowSettingsCategory.h b/xbmc/settings/GUIWindowSettingsCategory.h
deleted file mode 100644 (file)
index b1504f8..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "guilib/GUIWindow.h"
-#include "SettingsControls.h"
-#include "GUISettings.h"
-#include "utils/Stopwatch.h"
-
-typedef boost::shared_ptr<CBaseSettingControl> BaseSettingControlPtr;
-
-class CGUIWindowSettingsCategory :
-      public CGUIWindow
-{
-public:
-  CGUIWindowSettingsCategory(void);
-  virtual ~CGUIWindowSettingsCategory(void);
-  virtual bool OnMessage(CGUIMessage &message);
-  virtual bool OnBack(int actionID);
-  virtual void FrameMove();
-  virtual void Render();
-  virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions);
-  virtual int GetID() const { return CGUIWindow::GetID() + m_iScreen; };
-
-protected:
-  virtual void OnInitWindow();
-
-  void CheckNetworkSettings();
-  void FillInSubtitleHeights(CSetting *pSetting, CGUISpinControlEx *pControl);
-  void FillInSubtitleFonts(CSetting *pSetting);
-  void FillInCharSets(CSetting *pSetting);
-  void FillInSkinFonts(CSetting *pSetting);
-  void FillInSoundSkins(CSetting *pSetting);
-  void FillInLanguages(CSetting *pSetting, const std::vector<CStdString> &languages = std::vector<CStdString>(), const std::vector<CStdString> &languageKeys = std::vector<CStdString>());
-  DisplayMode FillInScreens(CStdString strSetting, RESOLUTION res);
-  void FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange);
-  void FillInRefreshRates(CStdString strSetting, RESOLUTION res, bool UserChange);
-  void OnRefreshRateChanged(RESOLUTION resolution);
-  void FillInRegions(CSetting *pSetting);
-  void FillInStartupWindow(CSetting *pSetting);
-  void FillInViewModes(CSetting *pSetting, int windowID);
-  void FillInSortMethods(CSetting *pSetting, int windowID);
-  void FillInEpgGuideView(CSetting *pSetting);
-  void FillInPvrStartLastChannel(CSetting *pSetting);
-
-  void FillInSkinThemes(CSetting *pSetting);
-  void FillInSkinColors(CSetting *pSetting);
-
-  void FillInNetworkInterfaces(CSetting *pSetting, float groupWidth, int &iControlID);
-  void NetworkInterfaceChanged(void);
-
-  void FillInAudioDevices(CSetting* pSetting, bool Passthrough = false);
-
-  virtual void SetupControls();
-  CGUIControl* AddIntBasedSpinControl(CSetting *pSetting, float groupWidth, int &iControlID);
-  void CreateSettings();
-  void UpdateSettings();
-  void CheckForUpdates();
-  void FreeSettingsControls();
-  virtual void FreeControls();
-  virtual void OnClick(BaseSettingControlPtr pSettingControl);
-  virtual void OnSettingChanged(BaseSettingControlPtr pSettingControl);
-  CGUIControl* AddSetting(CSetting *pSetting, float width, int &iControlID);
-  BaseSettingControlPtr GetSetting(const CStdString &strSetting);
-
-  void ValidatePortNumber(BaseSettingControlPtr pSettingControl, const CStdString& userPort, const CStdString& privPort, bool listening=true);
-
-  std::vector<BaseSettingControlPtr> m_vecSettings;
-  int m_iSection;
-  int m_iScreen;
-  vecSettingsCategory m_vecSections;
-  CGUISpinControlEx *m_pOriginalSpin;
-  CGUIRadioButtonControl *m_pOriginalRadioButton;
-  CGUIButtonControl *m_pOriginalCategoryButton;
-  CGUIButtonControl *m_pOriginalButton;
-  CGUIEditControl *m_pOriginalEdit;
-  CGUIImage *m_pOriginalImage;
-
-  CStdString m_strErrorMessage;
-
-  CStdString m_strOldTrackFormat;
-  CStdString m_strOldTrackFormatRight;
-
-  std::map<CStdString, CStdString> m_AnalogAudioSinkMap;
-  std::map<CStdString, CStdString> m_DigitalAudioSinkMap;
-  std::map<CStdString, CStdString> m_SkinFontSetIDs;
-
-  bool m_returningFromSkinLoad; // true if we are returning from loading the skin
-
-  boost::shared_ptr<CBaseSettingControl> m_delayedSetting; ///< Current delayed setting \sa CBaseSettingControl::SetDelayed()
-  CStopWatch           m_delayedTimer;   ///< Delayed setting timer
-};
-
diff --git a/xbmc/settings/GUIWindowSettingsProfile.cpp b/xbmc/settings/GUIWindowSettingsProfile.cpp
deleted file mode 100644 (file)
index 357dcf6..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIWindowSettingsProfile.h"
-#include "windows/GUIWindowFileManager.h"
-#include "Profile.h"
-#include "Application.h"
-#include "dialogs/GUIDialogContextMenu.h"
-#include "GUIDialogProfileSettings.h"
-#include "network/Network.h"
-#include "utils/URIUtils.h"
-#include "utils/Weather.h"
-#include "GUIPassword.h"
-#include "windows/GUIWindowLoginScreen.h"
-#include "guilib/GUIWindowManager.h"
-#include "filesystem/Directory.h"
-#include "FileItem.h"
-#include "Settings.h"
-#include "guilib/LocalizeStrings.h"
-
-using namespace XFILE;
-
-#define CONTROL_PROFILES 2
-#define CONTROL_LASTLOADED_PROFILE 3
-#define CONTROL_LOGINSCREEN 4
-
-CGUIWindowSettingsProfile::CGUIWindowSettingsProfile(void)
-    : CGUIWindow(WINDOW_SETTINGS_PROFILES, "SettingsProfile.xml")
-{
-  m_listItems = new CFileItemList;
-  m_loadType = KEEP_IN_MEMORY;
-}
-
-CGUIWindowSettingsProfile::~CGUIWindowSettingsProfile(void)
-{
-  delete m_listItems;
-}
-
-int CGUIWindowSettingsProfile::GetSelectedItem()
-{
-  CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_PROFILES);
-  g_windowManager.SendMessage(msg);
-
-  return msg.GetParam1();
-}
-
-void CGUIWindowSettingsProfile::OnPopupMenu(int iItem)
-{
-  if (iItem == (int)g_settings.GetNumProfiles())
-    return;
-
-  // popup the context menu
-  CContextButtons choices;
-  choices.Add(1, 20092); // Load profile
-  if (iItem > 0)
-    choices.Add(2, 117); // Delete
-
-  int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
-  if (choice == 1)
-  {
-    unsigned iCtrlID = GetFocusedControlID();
-    g_application.StopPlaying();
-    CGUIMessage msg2(GUI_MSG_ITEM_SELECTED, g_windowManager.GetActiveWindow(), iCtrlID);
-    g_windowManager.SendMessage(msg2);
-    g_application.getNetwork().NetworkMessage(CNetwork::SERVICES_DOWN,1);
-    g_settings.LoadMasterForLogin();
-    CGUIWindowLoginScreen::LoadProfile(iItem);
-    return;
-  }
-
-  if (choice == 2)
-  {
-    if (g_settings.DeleteProfile(iItem))
-      iItem--;
-  }
-
-  LoadList();
-  CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(),CONTROL_PROFILES,iItem);
-  OnMessage(msg);
-}
-
-bool CGUIWindowSettingsProfile::OnMessage(CGUIMessage& message)
-{
-  switch ( message.GetMessage() )
-  {
-  case GUI_MSG_WINDOW_DEINIT:
-    {
-      CGUIWindow::OnMessage(message);
-      ClearListItems();
-      return true;
-    }
-    break;
-
-  case GUI_MSG_CLICKED:
-    {
-      int iControl = message.GetSenderId();
-      if (iControl == CONTROL_PROFILES)
-      {
-        int iAction = message.GetParam1();
-        if (
-          iAction == ACTION_SELECT_ITEM ||
-          iAction == ACTION_MOUSE_LEFT_CLICK ||
-          iAction == ACTION_CONTEXT_MENU ||
-          iAction == ACTION_MOUSE_RIGHT_CLICK
-        )
-        {
-          CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_PROFILES);
-          g_windowManager.SendMessage(msg);
-          int iItem = msg.GetParam1();
-          if (iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_RIGHT_CLICK)
-          {
-            //contextmenu
-            if (iItem <= (int)g_settings.GetNumProfiles() - 1)
-            {
-              OnPopupMenu(iItem);
-            }
-            return true;
-          }
-          else if (iItem < (int)g_settings.GetNumProfiles())
-          {
-            if (CGUIDialogProfileSettings::ShowForProfile(iItem))
-            {
-              LoadList();
-              CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), 2,iItem);
-              g_windowManager.SendMessage(msg);
-
-              return true;
-            }
-
-            return false;
-          }
-          else if (iItem > (int)g_settings.GetNumProfiles() - 1)
-          {
-            CDirectory::Create(URIUtils::AddFileToFolder(g_settings.GetUserDataFolder(),"profiles"));
-            if (CGUIDialogProfileSettings::ShowForProfile(g_settings.GetNumProfiles()))
-            {
-              LoadList();
-              CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), 2,iItem);
-              g_windowManager.SendMessage(msg);
-              return true;
-            }
-
-            return false;
-          }
-        }
-      }
-      else if (iControl == CONTROL_LOGINSCREEN)
-      {
-        g_settings.ToggleLoginScreen();
-        g_settings.SaveProfiles(PROFILES_FILE);
-        return true;
-      }
-    }
-    break;
-  }
-
-  return CGUIWindow::OnMessage(message);
-}
-
-void CGUIWindowSettingsProfile::LoadList()
-{
-  ClearListItems();
-
-  for (unsigned int i = 0; i < g_settings.GetNumProfiles(); i++)
-  {
-    const CProfile *profile = g_settings.GetProfile(i);
-    CFileItemPtr item(new CFileItem(profile->getName()));
-    item->SetLabel2(profile->getDate());
-    item->SetArt("thumb", profile->getThumb());
-    item->SetOverlayImage(profile->getLockMode() == LOCK_MODE_EVERYONE ? CGUIListItem::ICON_OVERLAY_NONE : CGUIListItem::ICON_OVERLAY_LOCKED);
-    m_listItems->Add(item);
-  }
-  {
-    CFileItemPtr item(new CFileItem(g_localizeStrings.Get(20058)));
-    m_listItems->Add(item);
-  }
-  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_PROFILES, 0, 0, m_listItems);
-  OnMessage(msg);
-
-  if (g_settings.UsingLoginScreen())
-  {
-    CONTROL_SELECT(CONTROL_LOGINSCREEN);
-  }
-  else
-  {
-    CONTROL_DESELECT(CONTROL_LOGINSCREEN);
-  }
-}
-
-void CGUIWindowSettingsProfile::ClearListItems()
-{
-  CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PROFILES);
-  g_windowManager.SendMessage(msg);
-
-  m_listItems->Clear();
-}
-
-void CGUIWindowSettingsProfile::OnInitWindow()
-{
-  LoadList();
-  CGUIWindow::OnInitWindow();
-}
-
diff --git a/xbmc/settings/GUIWindowSettingsProfile.h b/xbmc/settings/GUIWindowSettingsProfile.h
deleted file mode 100644 (file)
index 2e41ce5..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "guilib/GUIWindow.h"
-
-class CGUIWindowSettingsProfile :
-      public CGUIWindow
-{
-public:
-  CGUIWindowSettingsProfile(void);
-  virtual ~CGUIWindowSettingsProfile(void);
-  virtual bool OnMessage(CGUIMessage& message);
-
-protected:
-  virtual void OnInitWindow();
-  CFileItemList *m_listItems;
-
-  void OnPopupMenu(int iItem);
-  void DoRename(int iItem);
-  void DoOverwrite(int iItem);
-  int GetSelectedItem();
-  void LoadList();
-  void SetLastLoaded();
-  void ClearListItems();
-};
diff --git a/xbmc/settings/GUIWindowSettingsScreenCalibration.cpp b/xbmc/settings/GUIWindowSettingsScreenCalibration.cpp
deleted file mode 100644 (file)
index 4aaab54..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "system.h"
-#include "GUIWindowSettingsScreenCalibration.h"
-#include "guilib/GUIMoverControl.h"
-#include "guilib/GUIResizeControl.h"
-#ifdef HAS_VIDEO_PLAYBACK
-#include "cores/VideoRenderers/RenderManager.h"
-#endif
-#include "Application.h"
-#include "Settings.h"
-#include "GUISettings.h"
-#include "guilib/GUIWindowManager.h"
-#include "dialogs/GUIDialogYesNo.h"
-#include "guilib/LocalizeStrings.h"
-#include "utils/log.h"
-#include "windowing/WindowingFactory.h"
-
-using namespace std;
-
-#define CONTROL_LABEL_ROW1  2
-#define CONTROL_LABEL_ROW2  3
-#define CONTROL_TOP_LEFT  8
-#define CONTROL_BOTTOM_RIGHT 9
-#define CONTROL_SUBTITLES  10
-#define CONTROL_PIXEL_RATIO  11
-#define CONTROL_VIDEO   20
-#define CONTROL_NONE   0
-
-CGUIWindowSettingsScreenCalibration::CGUIWindowSettingsScreenCalibration(void)
-    : CGUIWindow(WINDOW_SCREEN_CALIBRATION, "SettingsScreenCalibration.xml")
-{
-  m_needsScaling = false;         // we handle all the scaling
-}
-
-CGUIWindowSettingsScreenCalibration::~CGUIWindowSettingsScreenCalibration(void)
-{}
-
-
-bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
-{
-  switch (action.GetID())
-  {
-  case ACTION_CALIBRATE_SWAP_ARROWS:
-    {
-      NextControl();
-      return true;
-    }
-    break;
-
-  case ACTION_CALIBRATE_RESET:
-    {
-      CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
-      pDialog->SetHeading(20325);
-      CStdString strText;
-      strText.Format(g_localizeStrings.Get(20326).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].strMode.c_str());
-      pDialog->SetLine(0, strText);
-      pDialog->SetLine(1, 20327);
-      pDialog->SetChoice(0, 222);
-      pDialog->SetChoice(1, 186);
-      pDialog->DoModal();
-      if (pDialog->IsConfirmed())
-      {
-        g_graphicsContext.ResetScreenParameters(m_Res[m_iCurRes]);
-        ResetControls();
-      }
-      return true;
-    }
-    break;
-
-  case ACTION_CHANGE_RESOLUTION:
-    // choose the next resolution in our list
-    {
-      m_iCurRes = (m_iCurRes+1) % m_Res.size();
-      g_graphicsContext.SetVideoResolution(m_Res[m_iCurRes]);
-      ResetControls();
-      return true;
-    }
-    break;
-  }
-  return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
-}
-
-void CGUIWindowSettingsScreenCalibration::AllocResources(bool forceLoad)
-{
-  CGUIWindow::AllocResources(forceLoad);
-}
-
-void CGUIWindowSettingsScreenCalibration::FreeResources(bool forceUnload)
-{
-  CGUIWindow::FreeResources(forceUnload);
-}
-
-
-bool CGUIWindowSettingsScreenCalibration::OnMessage(CGUIMessage& message)
-{
-  switch ( message.GetMessage() )
-  {
-  case GUI_MSG_WINDOW_DEINIT:
-    {
-      g_settings.UpdateCalibrations();
-      g_settings.Save();
-      g_graphicsContext.SetCalibrating(false);
-      g_windowManager.ShowOverlay(OVERLAY_STATE_SHOWN);
-      // reset our screen resolution to what it was initially
-      g_graphicsContext.SetVideoResolution(g_guiSettings.m_LookAndFeelResolution);
-      // Inform the player so we can update the resolution
-#ifdef HAS_VIDEO_PLAYBACK
-      g_renderManager.Update(false);
-#endif
-      g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE);
-    }
-    break;
-
-  case GUI_MSG_WINDOW_INIT:
-    {
-      CGUIWindow::OnMessage(message);
-      g_windowManager.ShowOverlay(OVERLAY_STATE_HIDDEN);
-      g_graphicsContext.SetCalibrating(true);
-
-      // Get the allowable resolutions that we can calibrate...
-      m_Res.clear();
-      if (g_application.IsPlayingVideo())
-      { // don't allow resolution switching if we are playing a video
-
-#ifdef HAS_VIDEO_PLAYBACK
-        RESOLUTION res = g_renderManager.GetResolution();
-        g_graphicsContext.SetVideoResolution(res);
-        // Inform the renderer so we can update the resolution
-        g_renderManager.Update(false);
-#endif
-
-        m_iCurRes = 0;
-        m_Res.push_back(g_graphicsContext.GetVideoResolution());
-        SET_CONTROL_VISIBLE(CONTROL_VIDEO);
-      }
-      else
-      {
-        SET_CONTROL_HIDDEN(CONTROL_VIDEO);
-        m_iCurRes = (unsigned int)-1;
-        g_graphicsContext.GetAllowedResolutions(m_Res);
-        // find our starting resolution
-        m_iCurRes = FindCurrentResolution();
-      }
-      if (m_iCurRes==(unsigned int)-1)
-      {
-        CLog::Log(LOGERROR, "CALIBRATION: Reported current resolution: %d", (int)g_graphicsContext.GetVideoResolution());
-        CLog::Log(LOGERROR, "CALIBRATION: Could not determine current resolution, falling back to default");
-        m_iCurRes = 0;
-      }
-
-      // Setup the first control
-      m_iControl = CONTROL_TOP_LEFT;
-      ResetControls();
-      return true;
-    }
-    break;
-  case GUI_MSG_CLICKED:
-    {
-      // clicked - change the control...
-      NextControl();
-    }
-    break;
-  case GUI_MSG_NOTIFY_ALL:
-    {
-      if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE)
-      {
-        m_iCurRes = FindCurrentResolution();
-      }
-    }
-    break;
-  }
-  return CGUIWindow::OnMessage(message);
-}
-
-unsigned int CGUIWindowSettingsScreenCalibration::FindCurrentResolution()
-{
-  RESOLUTION curRes = g_graphicsContext.GetVideoResolution();
-  for (unsigned int i = 0; i < m_Res.size(); i++)
-  {
-    // If it's a CUSTOM (monitor) resolution, then g_graphicsContext.GetAllowedResolutions()
-    // returns just one entry with CUSTOM in it. Update that entry to point to the current
-    // CUSTOM resolution.
-    if (curRes>=RES_CUSTOM)
-    {
-      if (m_Res[i]==RES_CUSTOM)
-      {
-        m_Res[i] = curRes;
-        return i;
-      }
-    }
-    else if (m_Res[i] == g_graphicsContext.GetVideoResolution())
-      return i;
-  }
-  return 0;
-}
-
-void CGUIWindowSettingsScreenCalibration::NextControl()
-{ // set the old control invisible and not focused, and choose the next control
-  CGUIControl *pControl = (CGUIControl *)GetControl(m_iControl);
-  if (pControl)
-  {
-    pControl->SetVisible(false);
-    pControl->SetFocus(false);
-  }
-  // switch to the next control
-  m_iControl++;
-  if (m_iControl > CONTROL_PIXEL_RATIO)
-    m_iControl = CONTROL_TOP_LEFT;
-  // enable the new control
-  EnableControl(m_iControl);
-}
-
-void CGUIWindowSettingsScreenCalibration::EnableControl(int iControl)
-{
-  SET_CONTROL_VISIBLE(CONTROL_TOP_LEFT);
-  SET_CONTROL_VISIBLE(CONTROL_BOTTOM_RIGHT);
-  SET_CONTROL_VISIBLE(CONTROL_SUBTITLES);
-  SET_CONTROL_VISIBLE(CONTROL_PIXEL_RATIO);
-  SET_CONTROL_FOCUS(iControl, 0);
-}
-
-void CGUIWindowSettingsScreenCalibration::ResetControls()
-{
-  // disable the video control, so that our other controls take mouse clicks etc.
-  CONTROL_DISABLE(CONTROL_VIDEO);
-  // disable the UI calibration for our controls
-  // and set their limits
-  // also, set them to invisible if they don't have focus
-  CGUIMoverControl *pControl = (CGUIMoverControl*)GetControl(CONTROL_TOP_LEFT);
-  if (pControl)
-  {
-    pControl->SetLimits( -g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth / 4,
-                         -g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight / 4,
-                         g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth / 4,
-                         g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight / 4);
-    pControl->SetPosition((float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.left,
-                          (float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.top);
-    pControl->SetLocation(g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.left,
-                          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.top, false);
-  }
-  pControl = (CGUIMoverControl*)GetControl(CONTROL_BOTTOM_RIGHT);
-  if (pControl)
-  {
-    pControl->SetLimits(g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*3 / 4,
-                        g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*3 / 4,
-                        g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*5 / 4,
-                        g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*5 / 4);
-    pControl->SetPosition((float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.right - (int)pControl->GetWidth(),
-                          (float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.bottom - (int)pControl->GetHeight());
-    pControl->SetLocation(g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.right,
-                          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.bottom, false);
-  }
-  // Subtitles and OSD controls can only move up and down
-  pControl = (CGUIMoverControl*)GetControl(CONTROL_SUBTITLES);
-  if (pControl)
-  {
-    pControl->SetLimits(0, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*3 / 4,
-                        0, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*5 / 4);
-    pControl->SetPosition((g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pControl->GetWidth()) * 0.5f,
-                          g_settings.m_ResInfo[m_Res[m_iCurRes]].iSubtitles - pControl->GetHeight());
-    pControl->SetLocation(0, g_settings.m_ResInfo[m_Res[m_iCurRes]].iSubtitles, false);
-  }
-  // lastly the pixel ratio control...
-  CGUIResizeControl *pResize = (CGUIResizeControl*)GetControl(CONTROL_PIXEL_RATIO);
-  if (pResize)
-  {
-    pResize->SetLimits(g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*0.25f, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*0.5f,
-                       g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*0.75f, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*0.5f);
-    pResize->SetHeight(g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight * 0.5f);
-    pResize->SetWidth(pResize->GetHeight() / g_settings.m_ResInfo[m_Res[m_iCurRes]].fPixelRatio);
-    pResize->SetPosition((g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pResize->GetWidth()) / 2,
-                         (g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight - pResize->GetHeight()) / 2);
-  }
-  // Enable the default control
-  EnableControl(m_iControl);
-}
-
-void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
-{
-  CStdString strStatus;
-  if (iControl == CONTROL_PIXEL_RATIO)
-  {
-    CGUIResizeControl *pControl = (CGUIResizeControl*)GetControl(CONTROL_PIXEL_RATIO);
-    if (pControl)
-    {
-      float fWidth = (float)pControl->GetWidth();
-      float fHeight = (float)pControl->GetHeight();
-      g_settings.m_ResInfo[m_Res[m_iCurRes]].fPixelRatio = fHeight / fWidth;
-      // recenter our control...
-      pControl->SetPosition((g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pControl->GetWidth()) / 2,
-                            (g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight - pControl->GetHeight()) / 2);
-      strStatus.Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].fPixelRatio);
-      SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 278);
-    }
-  }
-  else
-  {
-    CGUIMoverControl *pControl = (CGUIMoverControl*)GetControl(iControl);
-    if (pControl)
-    {
-      switch (iControl)
-      {
-      case CONTROL_TOP_LEFT:
-        {
-          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.left = pControl->GetXLocation();
-          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.top = pControl->GetYLocation();
-          strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
-          SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
-        }
-        break;
-
-      case CONTROL_BOTTOM_RIGHT:
-        {
-          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.right = pControl->GetXLocation();
-          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.bottom = pControl->GetYLocation();
-          int iXOff1 = g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pControl->GetXLocation();
-          int iYOff1 = g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight - pControl->GetYLocation();
-          strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
-          SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
-        }
-        break;
-
-      case CONTROL_SUBTITLES:
-        {
-          g_settings.m_ResInfo[m_Res[m_iCurRes]].iSubtitles = pControl->GetYLocation();
-          strStatus.Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
-          SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 277);
-        }
-        break;
-      }
-    }
-  }
-  // set the label control correctly
-  CStdString strText;
-  if (g_Windowing.IsFullScreen())
-    strText.Format("%ix%i@%.2f - %s | %s", g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenWidth,
-      g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenHeight, g_settings.m_ResInfo[m_Res[m_iCurRes]].fRefreshRate,
-      g_localizeStrings.Get(244).c_str(), strStatus.c_str());
-  else
-    strText.Format("%ix%i - %s | %s", g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenWidth,
-      g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenHeight,
-      g_localizeStrings.Get(242).c_str(), strStatus.c_str());
-
-  SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, strText);
-}
-
-void CGUIWindowSettingsScreenCalibration::FrameMove()
-{
-  //  g_Windowing.Get3DDevice()->Clear(0, NULL, D3DCLEAR_TARGET, 0, 0, 0);
-  m_iControl = GetFocusedControlID();
-  if (m_iControl >= 0)
-  {
-    UpdateFromControl(m_iControl);
-  }
-  else
-  {
-    SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, "");
-    SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, "");
-  }
-  CGUIWindow::FrameMove();
-}
-
-void CGUIWindowSettingsScreenCalibration::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
-{
-  MarkDirtyRegion();
-
-  for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
-    SET_CONTROL_HIDDEN(i);
-
-  m_needsScaling = true;
-  CGUIWindow::DoProcess(currentTime, dirtyregions);
-  m_needsScaling = false;
-
-  g_graphicsContext.SetRenderingResolution(m_Res[m_iCurRes], false);
-  g_graphicsContext.AddGUITransform();
-
-  // process the movers etc.
-  for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
-  {
-    SET_CONTROL_VISIBLE(i);
-    CGUIControl *control = (CGUIControl *)GetControl(i);
-    if (control)
-      control->DoProcess(currentTime, dirtyregions);
-  }
-  g_graphicsContext.RemoveTransform();
-}
-
-void CGUIWindowSettingsScreenCalibration::DoRender()
-{
-  // we set that we need scaling here to render so that anything else on screen scales correctly
-  m_needsScaling = true;
-  CGUIWindow::DoRender();
-  m_needsScaling = false;
-}
diff --git a/xbmc/settings/GUIWindowSettingsScreenCalibration.h b/xbmc/settings/GUIWindowSettingsScreenCalibration.h
deleted file mode 100644 (file)
index 2ac9d9d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "guilib/GUIWindow.h"
-
-class CGUIWindowSettingsScreenCalibration : public CGUIWindow
-{
-public:
-  CGUIWindowSettingsScreenCalibration(void);
-  virtual ~CGUIWindowSettingsScreenCalibration(void);
-  virtual bool OnMessage(CGUIMessage& message);
-  virtual bool OnAction(const CAction &action);
-  virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions);
-  virtual void FrameMove();
-  virtual void DoRender();
-  virtual void AllocResources(bool forceLoad = false);
-  virtual void FreeResources(bool forceUnLoad = false);
-
-protected:
-  unsigned int FindCurrentResolution();
-  void NextControl();
-  void ResetControls();
-  void EnableControl(int iControl);
-  void UpdateFromControl(int iControl);
-  UINT m_iCurRes;
-  std::vector<RESOLUTION> m_Res;
-  int m_iControl;
-  float m_fPixelRatioBoxHeight;
-};
diff --git a/xbmc/settings/GUIWindowTestPattern.cpp b/xbmc/settings/GUIWindowTestPattern.cpp
deleted file mode 100644 (file)
index c8b36da..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *      Test patterns designed by Ofer LaOr - hometheater.co.il
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "GUIWindowTestPattern.h"
-#include "settings/Settings.h"
-#include "guilib/GUIWindowManager.h"
-#include "guilib/Key.h"
-
-CGUIWindowTestPattern::CGUIWindowTestPattern(void)
-    : CGUIWindow(WINDOW_TEST_PATTERN, "")
-{
-  m_needsScaling = false;
-}
-
-CGUIWindowTestPattern::~CGUIWindowTestPattern(void)
-{}
-
-
-bool CGUIWindowTestPattern::OnAction(const CAction &action)
-{
-  switch (action.GetID())
-  {
-  case ACTION_MOVE_UP:
-  case ACTION_MOVE_LEFT:
-    m_pattern = m_pattern > 0 ? m_pattern - 1 : TEST_PATTERNS_COUNT - 1;
-    SetInvalid();
-    return true;
-
-  case ACTION_MOVE_DOWN:
-  case ACTION_MOVE_RIGHT:
-    m_pattern = (m_pattern + 1) % TEST_PATTERNS_COUNT;
-    SetInvalid();
-    return true;
-  }
-  return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
-}
-
-bool CGUIWindowTestPattern::OnMessage(CGUIMessage& message)
-{
-  switch (message.GetMessage())
-  {
-  case GUI_MSG_WINDOW_INIT:
-    m_pattern = 0;
-    m_bounceDirectionX = 1;
-    m_bounceDirectionY = 1;
-    m_bounceX = 0;
-    m_bounceY = 0;
-    m_blinkFrame = 0;
-    break;
-
-  }
-  return CGUIWindow::OnMessage(message);
-}
-
-void CGUIWindowTestPattern::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
-{
-  if (m_pattern == 0 || m_pattern == 4)
-    MarkDirtyRegion();
-  CGUIWindow::Process(currentTime, dirtyregions);
-  m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
-}
-
-void CGUIWindowTestPattern::Render()
-{
-  BeginRender();
-
-  int top = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.top;
-  int bottom = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.bottom;
-  int left = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.left;
-  int right = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.right;
-
-  switch (m_pattern)
-  {
-    case 0:
-      DrawContrastBrightnessPattern(top, left, bottom, right);
-      break;
-
-    case 1:
-      DrawVerticalLines(top, left, bottom, right);
-      break;
-
-    case 2:
-      DrawHorizontalLines(top, left, bottom, right);
-      break;
-
-    case 3:
-      DrawCheckers(top, left, bottom, right);
-      break;
-
-    case 4:
-      DrawBouncingRectangle(top, left, bottom, right);
-      break;
-  }
-
-  EndRender();
-
-  CGUIWindow::Render();
-}
-
diff --git a/xbmc/settings/GUIWindowTestPattern.h b/xbmc/settings/GUIWindowTestPattern.h
deleted file mode 100644 (file)
index d2069bd..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *      Test patterns designed by Ofer LaOr - hometheater.co.il
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "guilib/GUIWindow.h"
-
-#define TEST_PATTERNS_COUNT 5
-#define TEST_PATTERNS_BOUNCE_SQUARE_SIZE 100
-#define TEST_PATTERNS_BLINK_CYCLE 100
-
-class CGUIWindowTestPattern : public CGUIWindow
-{
-public:
-  CGUIWindowTestPattern(void);
-  virtual ~CGUIWindowTestPattern(void);
-  virtual bool OnMessage(CGUIMessage& message);
-  virtual bool OnAction(const CAction &action);
-  virtual void Render();
-  virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
-
-protected:
-  virtual void DrawVerticalLines(int top, int left, int bottom, int right) = 0;
-  virtual void DrawHorizontalLines(int top, int left, int bottom, int right) = 0;
-  virtual void DrawCheckers(int top, int left, int bottom, int right) = 0;
-  virtual void DrawBouncingRectangle(int top, int left, int bottom, int right) = 0;
-  virtual void DrawContrastBrightnessPattern(int top, int left, int bottom, int right) = 0;
-  virtual void DrawCircle(int originX, int originY, int radius) = 0;
-  virtual void BeginRender() = 0;
-  virtual void EndRender() = 0;
-
-  int m_pattern;
-  int m_bounceX;
-  int m_bounceY;
-  int m_bounceDirectionX;
-  int m_bounceDirectionY;
-  int m_blinkFrame;
-};
-
-
index 5607b19..d77b7e9 100644 (file)
@@ -1,17 +1,6 @@
 SRCS=AdvancedSettings.cpp \
-     AppParamParser.cpp \
-     GUIDialogContentSettings.cpp \
-     GUIDialogLockSettings.cpp \
-     GUIDialogProfileSettings.cpp \
-     GUIDialogSettings.cpp \
      GUISettings.cpp \
-     GUIWindowSettings.cpp \
-     GUIWindowSettingsCategory.cpp \
-     GUIWindowSettingsProfile.cpp \
-     GUIWindowSettingsScreenCalibration.cpp \
-     GUIWindowTestPattern.cpp \
      Profile.cpp \
-     SettingsControls.cpp \
      Settings.cpp \
      VideoSettings.cpp \
 
index 3db721a..8e939eb 100644 (file)
@@ -55,6 +55,7 @@
 #include "filesystem/File.h"
 #include "filesystem/DirectoryCache.h"
 #include "DatabaseManager.h"
+#include "network/upnp/UPnPSettings.h"
 
 using namespace std;
 using namespace XFILE;
@@ -700,7 +701,6 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
     GetViewState(pElement, "musicnavartists", m_viewStateMusicNavArtists);
     GetViewState(pElement, "musicnavalbums", m_viewStateMusicNavAlbums);
     GetViewState(pElement, "musicnavsongs", m_viewStateMusicNavSongs);
-    GetViewState(pElement, "musiclastfm", m_viewStateMusicLastFM);
     GetViewState(pElement, "videonavactors", m_viewStateVideoNavActors);
     GetViewState(pElement, "videonavyears", m_viewStateVideoNavYears);
     GetViewState(pElement, "videonavgenres", m_viewStateVideoNavGenres);
@@ -789,8 +789,8 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
   LoadSkinSettings(pRootElement);
 
   // Configure the PlayerCoreFactory
-  LoadPlayerCoreFactorySettings("special://xbmc/system/playercorefactory.xml", true);
-  LoadPlayerCoreFactorySettings(GetUserDataItem("playercorefactory.xml"), false);
+  CPlayerCoreFactory::Get().LoadConfiguration("special://xbmc/system/playercorefactory.xml", true);
+  CPlayerCoreFactory::Get().LoadConfiguration(GetUserDataItem("playercorefactory.xml"), false);
 
   // Advanced settings
   g_advancedSettings.Load();
@@ -819,25 +819,6 @@ bool CSettings::LoadSettings(const CStdString& strSettingsFile)
   return true;
 }
 
-bool CSettings::LoadPlayerCoreFactorySettings(const CStdString& fileStr, bool clear)
-{
-  CLog::Log(LOGNOTICE, "Loading player core factory settings from %s.", fileStr.c_str());
-  if (!CFile::Exists(fileStr))
-  { // tell the user it doesn't exist
-    CLog::Log(LOGNOTICE, "%s does not exist. Skipping.", fileStr.c_str());
-    return false;
-  }
-
-  CXBMCTinyXML playerCoreFactoryXML;
-  if (!playerCoreFactoryXML.LoadFile(fileStr))
-  {
-    CLog::Log(LOGERROR, "Error loading %s, Line %d (%s)", fileStr.c_str(), playerCoreFactoryXML.ErrorRow(), playerCoreFactoryXML.ErrorDesc());
-    return false;
-  }
-
-  return CPlayerCoreFactory::LoadConfiguration(playerCoreFactoryXML.RootElement(), clear);
-}
-
 bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *localSettings /* = NULL */) const
 {
   CXBMCTinyXML xmlDoc;
@@ -895,7 +876,6 @@ bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *lo
     SetViewState(pNode, "musicnavartists", m_viewStateMusicNavArtists);
     SetViewState(pNode, "musicnavalbums", m_viewStateMusicNavAlbums);
     SetViewState(pNode, "musicnavsongs", m_viewStateMusicNavSongs);
-    SetViewState(pNode, "musiclastfm", m_viewStateMusicLastFM);
     SetViewState(pNode, "videonavactors", m_viewStateVideoNavActors);
     SetViewState(pNode, "videonavyears", m_viewStateVideoNavYears);
     SetViewState(pNode, "videonavgenres", m_viewStateVideoNavGenres);
@@ -1149,60 +1129,6 @@ bool CSettings::SaveProfiles(const CStdString& profilesFile) const
   return xmlDoc.SaveFile(profilesFile);
 }
 
-bool CSettings::LoadUPnPXml(const CStdString& strSettingsFile)
-{
-  CXBMCTinyXML UPnPDoc;
-
-  if (!CFile::Exists(strSettingsFile))
-  { // set defaults, or assume no rss feeds??
-    return false;
-  }
-  if (!UPnPDoc.LoadFile(strSettingsFile))
-  {
-    CLog::Log(LOGERROR, "Error loading %s, Line %d\n%s", strSettingsFile.c_str(), UPnPDoc.ErrorRow(), UPnPDoc.ErrorDesc());
-    return false;
-  }
-
-  TiXmlElement *pRootElement = UPnPDoc.RootElement();
-  if (!pRootElement || strcmpi(pRootElement->Value(),"upnpserver") != 0)
-  {
-    CLog::Log(LOGERROR, "Error loading %s, no <upnpserver> node", strSettingsFile.c_str());
-    return false;
-  }
-  // load settings
-
-  // default values for ports
-  m_UPnPPortServer = 0;
-  m_UPnPPortRenderer = 0;
-  m_UPnPMaxReturnedItems = 0;
-
-  XMLUtils::GetString(pRootElement, "UUID", m_UPnPUUIDServer);
-  XMLUtils::GetInt(pRootElement, "Port", m_UPnPPortServer);
-  XMLUtils::GetInt(pRootElement, "MaxReturnedItems", m_UPnPMaxReturnedItems);
-  XMLUtils::GetString(pRootElement, "UUIDRenderer", m_UPnPUUIDRenderer);
-  XMLUtils::GetInt(pRootElement, "PortRenderer", m_UPnPPortRenderer);
-
-  return true;
-}
-
-bool CSettings::SaveUPnPXml(const CStdString& strSettingsFile) const
-{
-  CXBMCTinyXML xmlDoc;
-  TiXmlElement xmlRootElement("upnpserver");
-  TiXmlNode *pRoot = xmlDoc.InsertEndChild(xmlRootElement);
-  if (!pRoot) return false;
-
-  // create a new Element for UUID
-  XMLUtils::SetString(pRoot, "UUID", m_UPnPUUIDServer);
-  XMLUtils::SetInt(pRoot, "Port", m_UPnPPortServer);
-  XMLUtils::SetInt(pRoot, "MaxReturnedItems", m_UPnPMaxReturnedItems);
-  XMLUtils::SetString(pRoot, "UUIDRenderer", m_UPnPUUIDRenderer);
-  XMLUtils::SetInt(pRoot, "PortRenderer", m_UPnPPortRenderer);
-
-  // save the file
-  return xmlDoc.SaveFile(strSettingsFile);
-}
-
 bool CSettings::UpdateShare(const CStdString &type, const CStdString oldName, const CMediaSource &share)
 {
   VECSOURCES *pShares = GetSourcesFromType(type);
@@ -1499,11 +1425,10 @@ void CSettings::Clear()
   m_defaultFileSource.clear();
   m_defaultMusicLibSource.clear();
 
-  m_UPnPUUIDServer.clear();
-  m_UPnPUUIDRenderer.clear();
-
   m_ResInfo.clear();
   m_Calibrations.clear();
+
+  CUPnPSettings::Get().Clear();
 }
 
 int CSettings::TranslateSkinString(const CStdString &setting)
index f79c85a..fd44a0f 100644 (file)
@@ -170,7 +170,6 @@ public:
   CViewState m_viewStateMusicNavArtists;
   CViewState m_viewStateMusicNavAlbums;
   CViewState m_viewStateMusicNavSongs;
-  CViewState m_viewStateMusicLastFM;
   CViewState m_viewStateVideoNavActors;
   CViewState m_viewStateVideoNavYears;
   CViewState m_viewStateVideoNavGenres;
@@ -240,12 +239,6 @@ public:
   CStdString m_defaultFileSource;
   CStdString m_defaultMusicLibSource;
 
-  CStdString m_UPnPUUIDServer;
-  int        m_UPnPPortServer;
-  int        m_UPnPMaxReturnedItems;
-  CStdString m_UPnPUUIDRenderer;
-  int        m_UPnPPortRenderer;
-
   int        m_musicNeedsUpdate; ///< if a database update means an update is required (set to the version number of the db)
   int        m_videoNeedsUpdate; ///< if a database update means an update is required (set to the version number of the db)
 
@@ -347,9 +340,6 @@ public:
 
   CStdString GetSettingsFile() const;
 
-  bool LoadUPnPXml(const CStdString& strSettingsFile);
-  bool SaveUPnPXml(const CStdString& strSettingsFile) const;
-
   /*! \brief Load the user profile information from disk
    Loads the profiles.xml file and creates the list of profiles. If no profiles
    exist, a master user is created.  Should be called after special://masterprofile/
@@ -394,8 +384,6 @@ protected:
   bool LoadSettings(const CStdString& strSettingsFile);
 //  bool SaveSettings(const CStdString& strSettingsFile) const;
 
-  bool LoadPlayerCoreFactorySettings(const CStdString& fileStr, bool clear);
-
   // skin activated settings
   void LoadSkinSettings(const TiXmlElement* pElement);
   void SaveSkinSettings(TiXmlNode *pElement) const;
diff --git a/xbmc/settings/SettingsControls.cpp b/xbmc/settings/SettingsControls.cpp
deleted file mode 100644 (file)
index 5e72f96..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "SettingsControls.h"
-#include "guilib/GUIRadioButtonControl.h"
-#include "guilib/GUISpinControlEx.h"
-#include "guilib/GUIEditControl.h"
-#include "Util.h"
-#include "dialogs/GUIDialogOK.h"
-#include "GUISettings.h"
-#include "guilib/GUIImage.h"
-#include "guilib/LocalizeStrings.h"
-#include "addons/AddonManager.h"
-
-CBaseSettingControl::CBaseSettingControl(int id, CSetting *pSetting)
-{
-  m_id = id;
-  m_pSetting = pSetting;
-  m_delayed = false;
-}
-
-CRadioButtonSettingControl::CRadioButtonSettingControl(CGUIRadioButtonControl *pRadioButton, int id, CSetting *pSetting)
-    : CBaseSettingControl(id, pSetting)
-{
-  m_pRadioButton = pRadioButton;
-  m_pRadioButton->SetID(id);
-  Update();
-}
-
-CRadioButtonSettingControl::~CRadioButtonSettingControl()
-{}
-
-bool CRadioButtonSettingControl::OnClick()
-{
-  ((CSettingBool *)m_pSetting)->SetData(!((CSettingBool *)m_pSetting)->GetData());
-  return true;
-}
-
-void CRadioButtonSettingControl::Update()
-{
-  if (m_pRadioButton)
-    m_pRadioButton->SetSelected(((CSettingBool *)m_pSetting)->GetData());
-}
-
-CSpinExSettingControl::CSpinExSettingControl(CGUISpinControlEx *pSpin, int id, CSetting *pSetting)
-    : CBaseSettingControl(id, pSetting)
-{
-  m_pSpin = pSpin;
-  m_pSpin->SetID(id);
-  if (pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
-  {
-    CSettingFloat *pSettingFloat = (CSettingFloat *)pSetting;
-    m_pSpin->SetType(SPIN_CONTROL_TYPE_FLOAT);
-    m_pSpin->SetFloatRange(pSettingFloat->m_fMin, pSettingFloat->m_fMax);
-    m_pSpin->SetFloatInterval(pSettingFloat->m_fStep);
-  }
-  else if (pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || pSetting->GetControlType() == SPIN_CONTROL_INT)
-  {
-    CSettingInt *pSettingInt = (CSettingInt *)pSetting;
-    m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
-    m_pSpin->Clear();
-    CStdString strLabel;
-    int i = pSettingInt->m_iMin;
-    if (pSettingInt->m_iLabelMin>-1)
-    {
-      strLabel=g_localizeStrings.Get(pSettingInt->m_iLabelMin);
-      m_pSpin->AddLabel(strLabel, pSettingInt->m_iMin);
-      i += pSettingInt->m_iStep;
-    }
-    for (; i <= pSettingInt->m_iMax; i += pSettingInt->m_iStep)
-    {
-      if (pSettingInt->m_iFormat > -1)
-      {
-        CStdString strFormat = g_localizeStrings.Get(pSettingInt->m_iFormat);
-        strLabel.Format(strFormat, i);
-      }
-      else
-        strLabel.Format(pSettingInt->m_strFormat, i);
-      m_pSpin->AddLabel(strLabel, i);
-    }
-  }
-  else // if (pSetting->GetControlType() == SPIN_CONTROL_TEXT)
-  {
-    m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
-    m_pSpin->Clear();
-  }
-  Update();
-}
-
-CSpinExSettingControl::~CSpinExSettingControl()
-{}
-
-bool CSpinExSettingControl::OnClick()
-{
-  // TODO: Should really check for a change here (as end of spincontrols may
-  //       cause no change)
-  if (m_pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
-    ((CSettingFloat *)m_pSetting)->SetData(m_pSpin->GetFloatValue());
-  else
-  {
-    if (m_pSetting->GetType() == SETTINGS_TYPE_INT)
-    {
-      CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
-      pSettingInt->SetData(m_pSpin->GetValue());
-    }
-  }
-  return true;
-}
-
-void CSpinExSettingControl::Update()
-{
-  if (!m_pSpin)
-    return;
-  if (m_pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
-  {
-    CSettingFloat *pSettingFloat = (CSettingFloat *)m_pSetting;
-    m_pSpin->SetFloatValue(pSettingFloat->GetData());
-  }
-  else if (m_pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || m_pSetting->GetControlType() == SPIN_CONTROL_INT)
-  {
-    CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
-    m_pSpin->SetValue(pSettingInt->GetData());
-  }
-}
-
-CButtonSettingControl::CButtonSettingControl(CGUIButtonControl *pButton, int id, CSetting *pSetting)
-    : CBaseSettingControl(id, pSetting)
-{
-  m_pButton = pButton;
-  m_pButton->SetID(id);
-  Update();
-}
-
-CButtonSettingControl::~CButtonSettingControl()
-{}
-
-bool CButtonSettingControl::OnClick()
-{
-  // this is pretty much a no-op as all click action is done in the calling class
-  Update();
-  return true;
-}
-
-void CButtonSettingControl::Update()
-{
-  CStdString strText = ((CSettingString *)m_pSetting)->GetData();
-  if (m_pSetting->GetType() == SETTINGS_TYPE_ADDON)
-  {
-    ADDON::AddonPtr addon;
-    if (ADDON::CAddonMgr::Get().GetAddon(strText, addon))
-      strText = addon->Name();
-    if (strText.IsEmpty())
-      strText = g_localizeStrings.Get(231); // None
-  }
-  else if (m_pSetting->GetControlType() == BUTTON_CONTROL_PATH_INPUT)
-  {
-    CStdString shortPath;
-    if (CUtil::MakeShortenPath(strText, shortPath, 30 ))
-      strText = shortPath;
-  }
-  else if (m_pSetting->GetControlType() == BUTTON_CONTROL_STANDARD)
-    return;
-  if (m_pButton)
-    m_pButton->SetLabel2(strText);
-}
-
-CEditSettingControl::CEditSettingControl(CGUIEditControl *pEdit, int id, CSetting *pSetting)
-    : CBaseSettingControl(id, pSetting)
-{
-  m_needsUpdate = false;
-  m_pEdit = pEdit;
-  m_pEdit->SetID(id);
-  int heading = ((CSettingString *)m_pSetting)->m_iHeadingString;
-  if (heading < 0) heading = 0;
-  if (pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_INPUT)
-    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD, heading);
-  else if (pSetting->GetControlType() == EDIT_CONTROL_MD5_INPUT)
-    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD_MD5, heading);    
-  else if (pSetting->GetControlType() == EDIT_CONTROL_IP_INPUT)
-    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_IPADDRESS, heading);
-  else if (pSetting->GetControlType() == EDIT_CONTROL_NUMBER_INPUT)
-    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, heading);
-  else if (pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_NUMBER_VERIFY_NEW)
-    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW, heading);
-  else
-    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, heading);
-  Update();
-}
-
-CEditSettingControl::~CEditSettingControl()
-{
-}
-
-bool CEditSettingControl::OnClick()
-{
-  // update our string
-  ((CSettingString *)m_pSetting)->SetData(m_pEdit->GetLabel2());
-  // we update on exit only
-  m_needsUpdate = true;
-  return false;
-}
-
-void CEditSettingControl::Update()
-{
-  if (!m_needsUpdate && m_pEdit)
-    m_pEdit->SetLabel2(((CSettingString *)m_pSetting)->GetData());
-}
-
-bool CEditSettingControl::IsValidIPAddress(const CStdString &strIP)
-{
-  const char* s = strIP.c_str();
-  bool legalFormat = true;
-  bool numSet = false;
-  int num = 0;
-  int dots = 0;
-
-  while (*s != '\0')
-  {
-    if (*s == '.')
-    {
-      ++dots;
-
-      // There must be a number before a .
-      if (!numSet)
-      {
-        legalFormat = false;
-        break;
-      }
-
-      if (num > 255)
-      {
-        legalFormat = false;
-        break;
-      }
-
-      num = 0;
-      numSet = false;
-    }
-    else if (*s >= '0' && *s <= '9')
-    {
-      num = (num * 10) + (*s - '0');
-      numSet = true;
-    }
-    else
-    {
-      legalFormat = false;
-      break;
-    }
-
-    ++s;
-  }
-
-  if (legalFormat)
-  {
-    if (!numSet)
-    {
-      legalFormat = false;
-    }
-
-    if (num > 255 || dots != 3)
-    {
-      legalFormat = false;
-    }
-  }
-
-  if (!legalFormat)
-    CGUIDialogOK::ShowAndGetInput(257, 724, 725, 0);
-
-  return legalFormat;
-}
-
-CSeparatorSettingControl::CSeparatorSettingControl(CGUIImage *pImage, int id, CSetting *pSetting)
-    : CBaseSettingControl(id, pSetting)
-{
-  m_pImage = pImage;
-  m_pImage->SetID(id);
-}
-
-CSeparatorSettingControl::~CSeparatorSettingControl()
-{}
-
diff --git a/xbmc/settings/SettingsControls.h b/xbmc/settings/SettingsControls.h
deleted file mode 100644 (file)
index d7ffdeb..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#pragma once
-/*
- *      Copyright (C) 2005-2013 Team XBMC
- *      http://www.xbmc.org
- *
- *  This Program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2, or (at your option)
- *  any later version.
- *
- *  This Program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with XBMC; see the file COPYING.  If not, see
- *  <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "utils/StdString.h"
-
-class CGUIImage;
-class CGUISpinControlEx;
-class CGUIEditControl;
-class CGUIButtonControl;
-class CGUIRadioButtonControl;
-
-class CSetting;
-
-class CBaseSettingControl
-{
-public:
-  CBaseSettingControl(int id, CSetting *pSetting);
-  virtual ~CBaseSettingControl() {}
-  virtual bool OnClick() { return false; };
-  virtual void Update() {};
-  int GetID() { return m_id; };
-  CSetting* GetSetting() { return m_pSetting; };
-  virtual bool NeedsUpdate() { return false; };   ///< Returns true if the control needs an update
-  virtual void Reset() {}; ///< Resets the NeedsUpdate() state
-  virtual void Clear()=0;  ///< Clears the attached control
-
-  /*!
-   \brief Specifies that this setting should update after a delay
-   Useful for settings that have options to navigate through
-   and may take a while, or require additional input to update
-   once the final setting is chosen.  Settings default to updating
-   instantly.
-   \sa IsDelayed()
-   */
-  void SetDelayed() { m_delayed = true; };
-
-  /*!
-   \brief Returns whether this setting should have delayed update
-   \return true if the setting's update should be delayed
-   \sa SetDelayed()
-   */
-  bool IsDelayed() const { return m_delayed; };
-protected:
-  int m_id;
-  CSetting* m_pSetting;
-  bool m_delayed;
-};
-
-class CRadioButtonSettingControl : public CBaseSettingControl
-{
-public:
-  CRadioButtonSettingControl(CGUIRadioButtonControl* pRadioButton, int id, CSetting *pSetting);
-  virtual ~CRadioButtonSettingControl();
-  virtual bool OnClick();
-  virtual void Update();
-  virtual void Clear() { m_pRadioButton = NULL; }
-  void Select(bool bSelect);
-private:
-  CGUIRadioButtonControl *m_pRadioButton;
-};
-
-class CSpinExSettingControl : public CBaseSettingControl
-{
-public:
-  CSpinExSettingControl(CGUISpinControlEx* pSpin, int id, CSetting *pSetting);
-  virtual ~CSpinExSettingControl();
-  virtual bool OnClick();
-  virtual void Update();
-  virtual void Clear() { m_pSpin = NULL; }
-private:
-  CGUISpinControlEx *m_pSpin;
-};
-
-class CButtonSettingControl : public CBaseSettingControl
-{
-public:
-  CButtonSettingControl(CGUIButtonControl* pButton, int id, CSetting *pSetting);
-  virtual ~CButtonSettingControl();
-  virtual bool OnClick();
-  virtual void Update();
-  virtual void Clear() { m_pButton = NULL; }
-private:
-  CGUIButtonControl *m_pButton;
-};
-
-class CEditSettingControl : public CBaseSettingControl
-{
-public:
-  CEditSettingControl(CGUIEditControl* pButton, int id, CSetting *pSetting);
-  virtual ~CEditSettingControl();
-  virtual bool OnClick();
-  virtual void Update();
-  virtual bool NeedsUpdate() { return m_needsUpdate; };
-  virtual void Reset() { m_needsUpdate = false; };
-  virtual void Clear() { m_pEdit = NULL; }
-private:
-  bool IsValidIPAddress(const CStdString &strIP);
-  CGUIEditControl *m_pEdit;
-  bool m_needsUpdate;
-};
-
-class CSeparatorSettingControl : public CBaseSettingControl
-{
-public:
-  CSeparatorSettingControl(CGUIImage* pImage, int id, CSetting *pSetting);
-  virtual ~CSeparatorSettingControl();
-  virtual bool OnClick() { return false; };
-  virtual void Update() {};
-  virtual void Clear() { m_pImage = NULL; }
-private:
-  CGUIImage *m_pImage;
-};
diff --git a/xbmc/settings/dialogs/GUIDialogContentSettings.cpp b/xbmc/settings/dialogs/GUIDialogContentSettings.cpp
new file mode 100644 (file)
index 0000000..8a0b0ab
--- /dev/null
@@ -0,0 +1,478 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogContentSettings.h"
+#include "addons/GUIDialogAddonSettings.h"
+#include "settings/GUISettings.h"
+#include "guilib/GUIWindowManager.h"
+#include "addons/IAddon.h"
+#include "FileItem.h"
+#include "video/VideoDatabase.h"
+#include "video/VideoInfoScanner.h"
+#include "interfaces/Builtins.h"
+#include "filesystem/AddonsDirectory.h"
+#include "dialogs/GUIDialogKaiToast.h"
+
+#include <climits>
+
+#define CONTROL_CONTENT_TYPE        3
+#define CONTROL_SCRAPER_LIST        4
+#define CONTROL_SCRAPER_SETTINGS    6
+#define CONTROL_START              30
+
+using namespace std;
+using namespace ADDON;
+
+CGUIDialogContentSettings::CGUIDialogContentSettings(void)
+  : CGUIDialogSettings(WINDOW_DIALOG_CONTENT_SETTINGS, "DialogContentSettings.xml"), m_origContent(CONTENT_NONE)
+{
+  m_bNeedSave = false;
+  m_content = CONTENT_NONE;
+  m_vecItems = new CFileItemList;
+}
+
+CGUIDialogContentSettings::~CGUIDialogContentSettings(void)
+{
+  delete m_vecItems;
+}
+
+bool CGUIDialogContentSettings::OnMessage(CGUIMessage &message)
+{
+  switch (message.GetMessage())
+  {
+  case GUI_MSG_WINDOW_DEINIT:
+    {
+      m_scrapers.clear();
+      m_vecItems->Clear();
+      CGUIDialogSettings::OnMessage(message);
+    }
+    break;
+
+  case GUI_MSG_CLICKED:
+    int iControl = message.GetSenderId();
+
+    if (iControl == CONTROL_CONTENT_TYPE)
+    {
+      CGUIMessage msg(GUI_MSG_ITEM_SELECTED,GetID(), CONTROL_CONTENT_TYPE);
+      g_windowManager.SendMessage(msg);
+      m_content = (CONTENT_TYPE) msg.GetParam1();
+      SetupPage();
+    }
+    if (iControl == CONTROL_SCRAPER_LIST)
+    {
+      // we handle only select actions
+      int action = message.GetParam1();
+      if (!(action == ACTION_SELECT_ITEM || action == ACTION_MOUSE_LEFT_CLICK))
+        break;
+
+      CGUIMessage msg(GUI_MSG_ITEM_SELECTED,GetID(), CONTROL_SCRAPER_LIST);
+      g_windowManager.SendMessage(msg);
+      int iSelected = msg.GetParam1();
+      if (iSelected == m_vecItems->Size() - 1)
+      { // Get More... item.
+        // This is tricky - ideally we want to completely save the state of this dialog,
+        // close it while linking to the addon manager, then reopen it on return.
+        // For now, we just close the dialog + send the GetPath() to open the addons window
+        CStdString content = m_vecItems->Get(iSelected)->GetPath().Mid(14);
+        OnCancel();
+        Close();
+        CBuiltins::Execute("ActivateWindow(AddonBrowser,addons://all/xbmc.metadata.scraper." + content + ",return)");
+        return true;
+      }
+      AddonPtr last = m_scraper;
+      m_scraper = m_scrapers[m_content][iSelected];
+      m_lastSelected[m_content] = m_scraper;
+
+      if (m_scraper != last)
+        SetupPage();
+
+      if (m_scraper != last)
+        m_bNeedSave = true;
+      CONTROL_ENABLE_ON_CONDITION(CONTROL_SCRAPER_SETTINGS, m_scraper->HasSettings());
+      SET_CONTROL_FOCUS(CONTROL_START,0);
+    }
+    if (iControl == CONTROL_SCRAPER_SETTINGS)
+    {
+      if (CGUIDialogAddonSettings::ShowAndGetInput(m_scraper, false))
+        m_bNeedSave = true;
+      return m_bNeedSave;
+    }
+  }
+  return CGUIDialogSettings::OnMessage(message);
+}
+
+void CGUIDialogContentSettings::SetupPage()
+{
+  CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_SCRAPER_LIST);
+  OnMessage(msgReset);
+  m_vecItems->Clear();
+  if (m_content == CONTENT_NONE)
+  {
+    m_bShowScanSettings = false;
+    SET_CONTROL_HIDDEN(CONTROL_SCRAPER_LIST);
+    CONTROL_DISABLE(CONTROL_SCRAPER_SETTINGS);
+  }
+  else
+  {
+    FillListControl();
+    SET_CONTROL_VISIBLE(CONTROL_SCRAPER_LIST);
+    if (m_scraper && m_scraper->Enabled())
+    {
+      m_bShowScanSettings = true;
+      ScraperPtr scraper = boost::dynamic_pointer_cast<CScraper>(m_scraper);
+      if (scraper && scraper->Supports(m_content) && scraper->HasSettings())
+        CONTROL_ENABLE(CONTROL_SCRAPER_SETTINGS);
+    }
+    else
+      CONTROL_DISABLE(CONTROL_SCRAPER_SETTINGS);
+  }
+
+  CreateSettings();
+  CGUIDialogSettings::SetupPage();
+  SET_CONTROL_VISIBLE(CONTROL_CONTENT_TYPE);
+}
+
+void CGUIDialogContentSettings::CreateSettings()
+{
+  // crappy setting dependencies part 1
+  m_settings.clear();
+  switch (m_content)
+  {
+  case CONTENT_TVSHOWS:
+    {
+      AddBool(1,20379,&m_bSingleItem, m_bShowScanSettings);
+      AddBool(2,20432,&m_bNoUpdate, m_bShowScanSettings);
+    }
+    break;
+  case CONTENT_MOVIES:
+    {
+      AddBool(1,20329,&m_bUseDirNames, m_bShowScanSettings);
+      AddBool(2,20346,&m_bScanRecursive, m_bShowScanSettings && ((m_bUseDirNames && !m_bSingleItem) || !m_bUseDirNames));
+      AddBool(3,20383,&m_bSingleItem, m_bShowScanSettings && (m_bUseDirNames && !m_bScanRecursive));
+      AddBool(4,20432,&m_bNoUpdate, m_bShowScanSettings);
+    }
+    break;
+  case CONTENT_MUSICVIDEOS:
+    {
+      AddBool(1,20330,&m_bUseDirNames, m_bShowScanSettings);
+      AddBool(2,20346,&m_bScanRecursive, m_bShowScanSettings && ((m_bUseDirNames && !m_bSingleItem) || !m_bUseDirNames));
+      AddBool(3,20383,&m_bSingleItem, m_bShowScanSettings && (m_bUseDirNames && !m_bScanRecursive));
+      AddBool(4,20432,&m_bNoUpdate, m_bShowScanSettings);
+    }
+    break;
+  case CONTENT_ALBUMS:
+  case CONTENT_ARTISTS:
+    break;
+  case CONTENT_NONE:
+  default:
+    {
+      AddBool(1,20380,&m_bExclude, !m_bShowScanSettings);
+    }
+  }
+}
+
+void CGUIDialogContentSettings::OnSettingChanged(SettingInfo &setting)
+{
+  CreateSettings();
+
+  // crappy setting dependencies part 2
+  if (m_content == CONTENT_MOVIES)
+  {
+    if (setting.id == 2) // use dir names
+    {
+      m_bSingleItem = false;
+      UpdateSetting(3); // scan recursively
+      UpdateSetting(4); // single item
+    }
+    else if (setting.id == 3)
+    {
+      m_bSingleItem = false;
+      UpdateSetting(4);
+    }
+    else if (setting.id == 4)
+    {
+      m_bScanRecursive = false;
+      UpdateSetting(3);
+    }
+  }
+  m_bNeedSave = true;
+}
+
+void CGUIDialogContentSettings::OnOkay()
+{ // watch for content change, but same scraper
+  if (m_content != m_origContent)
+    m_bNeedSave = true;
+}
+
+void CGUIDialogContentSettings::OnCancel()
+{
+  m_bNeedSave = false;
+}
+
+void CGUIDialogContentSettings::OnInitWindow()
+{
+  m_lastSelected.clear();
+  // save our current scraper (if any)
+  if (m_scraper)
+    m_lastSelected[m_content] = m_scraper;
+  FillContentTypes();
+  m_bNeedSave = false;
+  CGUIDialogSettings::OnInitWindow();
+}
+
+void CGUIDialogContentSettings::FillContentTypes()
+{
+  CGUIMessage msg(GUI_MSG_LABEL_RESET,GetID(),CONTROL_CONTENT_TYPE);
+  g_windowManager.SendMessage(msg);
+
+  if (m_content == CONTENT_ALBUMS || m_content == CONTENT_ARTISTS)
+  {
+    FillContentTypes(m_content);
+  }
+  else
+  {
+    FillContentTypes(CONTENT_MOVIES);
+    FillContentTypes(CONTENT_TVSHOWS);
+    FillContentTypes(CONTENT_MUSICVIDEOS);
+
+    // add 'None' to spinner
+    CGUIMessage msg2(GUI_MSG_LABEL_ADD,GetID(),CONTROL_CONTENT_TYPE);
+    msg2.SetLabel(TranslateContent(CONTENT_NONE, true));
+    msg2.SetParam1((int) CONTENT_NONE);
+    g_windowManager.SendMessage(msg2);
+  }
+
+  CONTROL_SELECT_ITEM(CONTROL_CONTENT_TYPE, (int) m_content);
+}
+
+void CGUIDialogContentSettings::FillContentTypes(const CONTENT_TYPE &content)
+{
+  // grab all scrapers which support this content-type
+  VECADDONS addons;
+  TYPE type = ScraperTypeFromContent(content);
+  if (!CAddonMgr::Get().GetAddons(type, addons))
+    return;
+
+  AddonPtr addon;
+  CStdString defaultID;
+  if (CAddonMgr::Get().GetDefault(type, addon))
+    defaultID = addon->ID();
+
+  for (IVECADDONS it = addons.begin(); it != addons.end(); it++)
+  {
+    bool isDefault = ((*it)->ID() == defaultID);
+    map<CONTENT_TYPE,VECADDONS>::iterator iter=m_scrapers.find(content);
+
+    AddonPtr scraper = (*it)->Clone((*it));
+
+    if (m_scraper && m_scraper->ID() == (*it)->ID())
+    { // don't overwrite preconfigured scraper
+      scraper = m_scraper;
+    }
+
+    if (iter != m_scrapers.end())
+    {
+      if (isDefault)
+        iter->second.insert(iter->second.begin(), scraper);
+      else
+        iter->second.push_back(scraper);
+    }
+    else
+    {
+      VECADDONS vec;
+      vec.push_back(scraper);
+      m_scrapers.insert(make_pair(content,vec));
+    }
+  }
+
+  // add CONTENT type to spinner
+  CGUIMessage msg(GUI_MSG_LABEL_ADD,GetID(),CONTROL_CONTENT_TYPE);
+  msg.SetLabel(TranslateContent(content, true));
+  msg.SetParam1((int) content);
+  g_windowManager.SendMessage(msg);
+}
+
+void CGUIDialogContentSettings::FillListControl()
+{
+  int iIndex=0;
+  int selectedIndex = 0;
+
+  if (m_lastSelected.find(m_content) != m_lastSelected.end())
+    m_scraper = m_lastSelected[m_content];
+  else
+    CAddonMgr::Get().GetDefault(ScraperTypeFromContent(m_content), m_scraper);
+
+  for (IVECADDONS iter=m_scrapers.find(m_content)->second.begin();iter!=m_scrapers.find(m_content)->second.end();++iter)
+  {
+    CFileItemPtr item(new CFileItem((*iter)->Name()));
+    item->SetPath((*iter)->ID());
+    item->SetArt("thumb", (*iter)->Icon());
+    if (m_scraper && (*iter)->ID() == m_scraper->ID())
+    {
+      item->Select(true);
+      selectedIndex = iIndex;
+    }
+    m_vecItems->Add(item);
+    iIndex++;
+  }
+
+  // add the "Get More..." item
+  m_vecItems->Add(XFILE::CAddonsDirectory::GetMoreItem(TranslateContent(m_content)));
+
+  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_SCRAPER_LIST, 0, 0, m_vecItems);
+  OnMessage(msg);
+  CGUIMessage msg2(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_SCRAPER_LIST, selectedIndex);
+  OnMessage(msg2);
+}
+
+CFileItemPtr CGUIDialogContentSettings::GetCurrentListItem(int offset)
+{
+  int currentItem = -1;
+  if(m_bExclude)
+    return CFileItemPtr();
+  for (int i=0;i<m_vecItems->Size();++i )
+  {
+    if (m_vecItems->Get(i)->IsSelected())
+    {
+      currentItem = i;
+      break;
+    }
+  }
+
+  if (currentItem == -1)
+    return CFileItemPtr();
+
+  int item = (currentItem + offset) % m_vecItems->Size();
+  if (item < 0) item += m_vecItems->Size();
+  return m_vecItems->Get(item);
+}
+
+bool CGUIDialogContentSettings::ShowForDirectory(const CStdString& strDirectory, ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings)
+{
+  CVideoDatabase database;
+  database.Open();
+  scraper = database.GetScraperForPath(strDirectory, settings);
+  bool bResult = Show(scraper,settings);
+  if (bResult)
+    database.SetScraperForPath(strDirectory,scraper,settings);
+
+  return bResult;
+}
+
+bool CGUIDialogContentSettings::Show(ADDON::ScraperPtr& scraper, CONTENT_TYPE musicContext/*=CONTENT_NONE*/)
+{
+  VIDEO::SScanSettings dummy;
+  return Show(scraper,dummy,musicContext);
+}
+
+bool CGUIDialogContentSettings::Show(ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings, CONTENT_TYPE musicContext/*=CONTENT_NONE*/)
+{
+  CGUIDialogContentSettings *dialog = (CGUIDialogContentSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_CONTENT_SETTINGS);
+  if (!dialog)
+    return false;
+
+  if (scraper)
+  {
+    dialog->m_content = musicContext != CONTENT_NONE ? musicContext : scraper->Content();
+    dialog->m_origContent = dialog->m_content;
+    dialog->m_scraper = scraper;
+    // toast selected but disabled scrapers
+    if (!scraper->Enabled())
+      CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24023), scraper->Name(), 2000, true);
+  }
+
+  dialog->m_bScanRecursive = (settings.recurse > 0 && !settings.parent_name) || (settings.recurse > 1 && settings.parent_name);
+  dialog->m_bUseDirNames   = settings.parent_name;
+  dialog->m_bExclude       = settings.exclude;
+  dialog->m_bSingleItem    = settings.parent_name_root;
+  dialog->m_bNoUpdate      = settings.noupdate;
+  dialog->m_bNeedSave = false;
+  dialog->DoModal();
+  if (dialog->m_bNeedSave)
+  {
+    scraper = boost::dynamic_pointer_cast<CScraper>(dialog->m_scraper);
+    CONTENT_TYPE content = dialog->m_content;
+    if (!scraper || content == CONTENT_NONE)
+    {
+      scraper.reset();
+      settings.exclude = dialog->m_bExclude;
+    }
+    else
+    {
+      settings.exclude = false;
+      settings.noupdate = dialog->m_bNoUpdate;
+      scraper->SetPathSettings(content, "");
+
+      if (content == CONTENT_TVSHOWS)
+      {
+        settings.parent_name = dialog->m_bSingleItem;
+        settings.parent_name_root = dialog->m_bSingleItem;
+        settings.recurse = 0;
+      }
+      else if (content == CONTENT_MOVIES)
+      {
+        if (dialog->m_bUseDirNames)
+        {
+          settings.parent_name = true;
+          settings.parent_name_root = false;
+          settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 1;
+
+          if (dialog->m_bSingleItem)
+          {
+            settings.parent_name_root = true;
+            settings.recurse = 0;
+          }
+        }
+        else
+        {
+          settings.parent_name = false;
+          settings.parent_name_root = false;
+          settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0;
+        }
+      }
+      else if (content == CONTENT_MUSICVIDEOS)
+      {
+        if (dialog->m_bUseDirNames)
+        {
+          settings.parent_name = true;
+          settings.parent_name_root = false;
+          settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 1;
+
+          if (dialog->m_bSingleItem)
+          {
+            settings.parent_name_root = true;
+            settings.recurse = 0;
+          }
+        }
+        else
+         {
+           settings.parent_name = false;
+           settings.parent_name_root = false;
+           settings.recurse = dialog->m_bScanRecursive ? INT_MAX : 0;
+         }
+      }
+    }
+  }
+
+  dialog->m_scraper.reset();
+  dialog->m_content = dialog->m_origContent = CONTENT_NONE;
+  return dialog->m_bNeedSave;
+}
+
diff --git a/xbmc/settings/dialogs/GUIDialogContentSettings.h b/xbmc/settings/dialogs/GUIDialogContentSettings.h
new file mode 100644 (file)
index 0000000..fbb7b9f
--- /dev/null
@@ -0,0 +1,76 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <vector>
+
+#include "addons/Scraper.h"
+#include "addons/AddonManager.h"
+#include "settings/dialogs/GUIDialogSettings.h"
+
+namespace VIDEO
+{
+  struct SScanSettings;
+}
+class CFileItemList;
+
+class CGUIDialogContentSettings : public CGUIDialogSettings
+{
+public:
+  CGUIDialogContentSettings(void);
+  virtual ~CGUIDialogContentSettings(void);
+  virtual bool OnMessage(CGUIMessage& message);
+
+  static bool Show(ADDON::ScraperPtr& scraper, CONTENT_TYPE musicContext = CONTENT_NONE);
+  static bool Show(ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings, CONTENT_TYPE musicContext = CONTENT_NONE);
+  static bool ShowForDirectory(const CStdString& strDirectory, ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings);
+  virtual bool HasListItems() const { return true; };
+  virtual CFileItemPtr GetCurrentListItem(int offset = 0);
+protected:
+  virtual void OnOkay();
+  virtual void OnCancel();
+  virtual void OnInitWindow();
+  virtual void SetupPage();
+  virtual void CreateSettings();
+  void FillContentTypes();
+  void FillContentTypes(const CONTENT_TYPE& content);
+  void AddContentType(const CONTENT_TYPE& content);
+  void FillListControl();
+  virtual void OnSettingChanged(SettingInfo& setting);
+
+  bool m_bNeedSave;
+
+  bool m_bShowScanSettings;
+  bool m_bScanRecursive;
+  bool m_bUseDirNames;
+  bool m_bSingleItem;
+  bool m_bExclude;
+  bool m_bNoUpdate;
+  std::map<CONTENT_TYPE, ADDON::VECADDONS> m_scrapers;
+  std::map<CONTENT_TYPE, ADDON::AddonPtr>  m_lastSelected;
+  CFileItemList* m_vecItems;
+
+  CStdString m_strContentType;
+  ADDON::AddonPtr m_scraper;
+  CStdString m_defaultScraper;
+  CONTENT_TYPE m_content;
+  CONTENT_TYPE m_origContent;
+};
diff --git a/xbmc/settings/dialogs/GUIDialogLockSettings.cpp b/xbmc/settings/dialogs/GUIDialogLockSettings.cpp
new file mode 100644 (file)
index 0000000..ce734a3
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogLockSettings.h"
+#include "dialogs/GUIDialogNumeric.h"
+#include "guilib/GUIKeyboardFactory.h"
+#include "dialogs/GUIDialogGamepad.h"
+#include "dialogs/GUIDialogContextMenu.h"
+#include "guilib/GUIWindowManager.h"
+#include "URL.h"
+#include "guilib/LocalizeStrings.h"
+
+CGUIDialogLockSettings::CGUIDialogLockSettings(void)
+    : CGUIDialogSettings(WINDOW_DIALOG_LOCK_SETTINGS, "LockSettings.xml")
+{
+}
+
+CGUIDialogLockSettings::~CGUIDialogLockSettings(void)
+
+{
+}
+
+void CGUIDialogLockSettings::OnCancel()
+{
+  m_bChanged = false;
+}
+
+void CGUIDialogLockSettings::SetupPage()
+{
+  CGUIDialogSettings::SetupPage();
+  // update our settings label
+  if (m_bGetUser)
+  {
+    CStdString strLabel;
+    CStdString strLabel2=m_strURL;
+    CURL::Decode(strLabel2);
+    strLabel.Format(g_localizeStrings.Get(20152),strLabel2.c_str());
+    SET_CONTROL_LABEL(2,strLabel);
+  }
+  else
+    SET_CONTROL_LABEL(2,g_localizeStrings.Get(20066));
+  SET_CONTROL_HIDDEN(3);
+}
+
+void CGUIDialogLockSettings::EnableDetails(bool bEnable)
+{
+  for (int i=2;i<9;++i)
+  {
+    m_settings[i].enabled = bEnable || !m_bConditionalDetails;
+    UpdateSetting(i+1);
+  }
+}
+
+void CGUIDialogLockSettings::CreateSettings()
+{
+  // clear out any old settings
+  m_settings.clear();
+  // create our settings
+  if (m_bGetUser)
+  {
+    AddButton(1,20142);
+    if (!m_strUser.IsEmpty())
+      m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
+    AddButton(2,12326);
+    if (!m_locks.code.IsEmpty())
+      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
+    if (m_saveUserDetails)
+      AddBool(3, 13423, m_saveUserDetails);
+    return;
+  }
+  AddButton(1,m_iButtonLabel);
+  if (m_locks.mode > LOCK_MODE_QWERTY)
+    m_locks.mode = LOCK_MODE_EVERYONE;
+  if (m_locks.mode != LOCK_MODE_EVERYONE)
+    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
+  else
+    m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
+
+  if (m_bDetails)
+  {
+    AddSeparator(2);
+    AddBool(3,20038,&m_locks.music);
+    AddBool(4,20039,&m_locks.video);
+    AddBool(5,20040,&m_locks.pictures);
+    AddBool(6,20041,&m_locks.programs);
+    AddBool(7,20042,&m_locks.files);
+    AddBool(8,20043,&m_locks.settings);
+    AddBool(9,24090,&m_locks.addonManager);
+    EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
+  }
+}
+
+void CGUIDialogLockSettings::OnSettingChanged(SettingInfo &setting)
+{
+  // check and update anything that needs it
+  if (setting.id == 1)
+  {
+    if (m_bGetUser)
+    {
+      CStdString strHeading;
+      CStdString strDecodeUrl = m_strURL;
+      CURL::Decode(strDecodeUrl);
+      strHeading.Format("%s %s",g_localizeStrings.Get(14062).c_str(),strDecodeUrl.c_str());
+      if (CGUIKeyboardFactory::ShowAndGetInput(m_strUser,strHeading,true))
+      {
+        m_bChanged = true;
+        m_settings[0].name.Format("%s (%s)",g_localizeStrings.Get(20142).c_str(),m_strUser.c_str());
+        UpdateSetting(1);
+      }
+      return;
+    }
+    CContextButtons choices;
+    choices.Add(1, 1223);
+    choices.Add(2, 12337);
+    choices.Add(3, 12338);
+    choices.Add(4, 12339);
+    
+    int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
+
+    CStdString newPassword;
+    LockType iLockMode = LOCK_MODE_UNKNOWN;
+    bool bResult = false;
+    switch(choice)
+    {
+    case 1:
+      iLockMode = LOCK_MODE_EVERYONE; //Disabled! Need check routine!!!
+      bResult = true;
+      break;
+    case 2:
+      iLockMode = LOCK_MODE_NUMERIC;
+      bResult = CGUIDialogNumeric::ShowAndVerifyNewPassword(newPassword);
+      break;
+    case 3:
+      iLockMode = LOCK_MODE_GAMEPAD;
+      bResult = CGUIDialogGamepad::ShowAndVerifyNewPassword(newPassword);
+      break;
+    case 4:
+      iLockMode = LOCK_MODE_QWERTY;
+      bResult = CGUIKeyboardFactory::ShowAndVerifyNewPassword(newPassword);
+      break;
+    default:
+      break;
+    }
+    if (bResult)
+    {
+      if (iLockMode == LOCK_MODE_EVERYONE)
+        newPassword = "-";
+      m_locks.code = newPassword;
+      if (m_locks.code == "-")
+        iLockMode = LOCK_MODE_EVERYONE;
+      m_locks.mode = iLockMode;
+      if (m_bDetails)
+        EnableDetails(m_locks.mode != LOCK_MODE_EVERYONE);
+      m_bChanged = true;
+      if (m_locks.mode != LOCK_MODE_EVERYONE)
+        setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(12336+m_locks.mode).c_str());
+      else
+        setting.name.Format("%s (%s)",g_localizeStrings.Get(m_iButtonLabel).c_str(),g_localizeStrings.Get(1223).c_str());
+
+      UpdateSetting(1);
+    }
+  }
+  if (setting.id == 2 && m_bGetUser)
+  {
+    CStdString strHeading;
+    CStdString strDecodeUrl = m_strURL;
+    CURL::Decode(strDecodeUrl);
+    strHeading.Format("%s %s",g_localizeStrings.Get(20143).c_str(),strDecodeUrl.c_str());
+    if (CGUIKeyboardFactory::ShowAndGetInput(m_locks.code,strHeading,true,true))
+    {
+      m_settings[1].name.Format("%s (%s)",g_localizeStrings.Get(12326).c_str(),g_localizeStrings.Get(20141).c_str());
+      m_bChanged = true;
+      UpdateSetting(2);
+    }
+    return;
+  }
+  if (setting.id > 1)
+    m_bChanged = true;
+}
+
+bool CGUIDialogLockSettings::ShowAndGetUserAndPassword(CStdString& strUser, CStdString& strPassword, const CStdString& strURL, bool *saveUserDetails)
+{
+  CGUIDialogLockSettings *dialog = (CGUIDialogLockSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_LOCK_SETTINGS);
+  if (!dialog) return false;
+  dialog->m_bGetUser = true;
+  dialog->m_locks.code = strPassword;
+  dialog->m_strUser = strUser;
+  dialog->m_strURL = strURL;
+  dialog->m_bChanged = false;
+  dialog->m_saveUserDetails = saveUserDetails;
+  dialog->DoModal();
+  if (dialog->m_bChanged)
+  {
+    strUser = dialog->m_strUser;
+    strPassword = dialog->m_locks.code;
+    return true;
+  }
+
+  return false;
+}
+
+bool CGUIDialogLockSettings::ShowAndGetLock(LockType& iLockMode, CStdString& strPassword, int iHeader)
+{
+  CProfile::CLock locks(iLockMode, strPassword);
+  if (ShowAndGetLock(locks, iHeader, false, false))
+  {
+    locks.Validate();
+    iLockMode = locks.mode;
+    strPassword = locks.code;
+    return true;
+  }
+  return false;
+}
+
+bool CGUIDialogLockSettings::ShowAndGetLock(CProfile::CLock &locks, int iButtonLabel, bool bConditional, bool bDetails)
+{
+  CGUIDialogLockSettings *dialog = (CGUIDialogLockSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_LOCK_SETTINGS);
+  if (!dialog) return false;
+  dialog->m_locks = locks;
+  dialog->m_iButtonLabel = iButtonLabel;
+  dialog->m_bChanged = false;
+  dialog->m_bGetUser = false;
+  dialog->m_bConditionalDetails = bConditional;
+  dialog->m_bDetails = bDetails;
+  dialog->DoModal();
+  if (dialog->m_bChanged)
+  {
+    locks = dialog->m_locks;
+    return true;
+  }
+
+  return false;
+}
diff --git a/xbmc/settings/dialogs/GUIDialogLockSettings.h b/xbmc/settings/dialogs/GUIDialogLockSettings.h
new file mode 100644 (file)
index 0000000..cf6bdd9
--- /dev/null
@@ -0,0 +1,53 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIPassword.h"
+#include "settings/Profile.h"
+#include "settings/dialogs/GUIDialogSettings.h"
+
+class CGUIDialogLockSettings : public CGUIDialogSettings
+{
+public:
+  CGUIDialogLockSettings(void);
+  virtual ~CGUIDialogLockSettings(void);
+  static bool ShowAndGetLock(LockType& iLockMode, CStdString& strPassword, int iHeader=20091);
+  static bool ShowAndGetLock(CProfile::CLock &locks, int iButtonLabel = 20091, bool bConditional = false, bool bDetails = true);
+  static bool ShowAndGetUserAndPassword(CStdString& strUser, CStdString& strPassword, const CStdString& strURL, bool *saveUserDetails);
+protected:
+  virtual void OnCancel();
+  virtual void SetupPage();
+  virtual void CreateSettings();
+  virtual void OnSettingChanged(SettingInfo &setting);
+  void EnableDetails(bool bEnable);
+
+  CProfile::CLock m_locks;
+  CStdString m_strUser;
+  CStdString m_strURL;
+  bool m_bChanged;
+  bool m_bDetails;
+  bool m_bConditionalDetails;
+  bool m_bGetUser;
+  int m_iButtonLabel;
+  bool *m_saveUserDetails;
+};
+
+
diff --git a/xbmc/settings/dialogs/GUIDialogProfileSettings.cpp b/xbmc/settings/dialogs/GUIDialogProfileSettings.cpp
new file mode 100644 (file)
index 0000000..7eb06da
--- /dev/null
@@ -0,0 +1,391 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogProfileSettings.h"
+#include "dialogs/GUIDialogFileBrowser.h"
+#include "guilib/GUIKeyboardFactory.h"
+#include "settings/dialogs/GUIDialogLockSettings.h"
+#include "guilib/GUIImage.h"
+#include "guilib/GUIWindowManager.h"
+#include "storage/MediaManager.h"
+#include "Util.h"
+#include "utils/URIUtils.h"
+#include "GUIPassword.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "filesystem/Directory.h"
+#include "filesystem/File.h"
+#include "FileItem.h"
+#include "settings/Settings.h"
+#include "settings/GUISettings.h"
+#include "guilib/LocalizeStrings.h"
+#include "TextureCache.h"
+
+using namespace XFILE;
+
+#define CONTROL_PROFILE_IMAGE       2
+#define CONTROL_START              30
+
+CGUIDialogProfileSettings::CGUIDialogProfileSettings(void)
+    : CGUIDialogSettings(WINDOW_DIALOG_PROFILE_SETTINGS, "ProfileSettings.xml")
+{
+  m_bNeedSave = false;
+}
+
+CGUIDialogProfileSettings::~CGUIDialogProfileSettings(void)
+{
+}
+
+bool CGUIDialogProfileSettings::OnMessage(CGUIMessage &message)
+{
+  if (message.GetMessage() == GUI_MSG_CLICKED)
+  {
+    int iControl = message.GetSenderId();
+    if (iControl == 500)
+      Close();
+    if (iControl == 501)
+    {
+      m_bNeedSave = false;
+      Close();
+    }
+  }
+  return CGUIDialogSettings::OnMessage(message);
+}
+
+void CGUIDialogProfileSettings::OnWindowLoaded()
+{
+  CGUIDialogSettings::OnWindowLoaded();
+  CGUIImage *pImage = (CGUIImage*)GetControl(2);
+  m_strDefaultImage = pImage ? pImage->GetFileName() : "";
+}
+
+void CGUIDialogProfileSettings::SetupPage()
+{
+  CGUIDialogSettings::SetupPage();
+  SET_CONTROL_LABEL(1000,m_strName);
+  SET_CONTROL_LABEL(1001,m_strDirectory);
+  CGUIImage *pImage = (CGUIImage*)GetControl(2);
+  if (pImage)
+    pImage->SetFileName(!m_strThumb.IsEmpty() ? m_strThumb : m_strDefaultImage);
+}
+
+void CGUIDialogProfileSettings::CreateSettings()
+{
+  // clear out any old settings
+  m_settings.clear();
+
+  AddButton(1,20093);
+  AddButton(2,20065);
+  if (!m_bIsDefault && m_bShowDetails)
+    AddButton(3,20070);
+
+  if (m_bShowDetails)
+    AddButton(4,20066);
+  if (!m_bShowDetails && m_locks.mode == LOCK_MODE_EVERYONE && g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
+    AddButton(4,20066);
+
+  if (!m_bIsDefault && m_bShowDetails)
+  {
+    SettingInfo setting;
+    setting.id = 5;
+    setting.name = g_localizeStrings.Get(20060);
+    setting.data = &m_iDbMode;
+    setting.type = SettingInfo::SPIN;
+    setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20062)));
+    setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20063)));
+    setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20061)));
+    if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
+      setting.entry.push_back(make_pair(setting.entry.size(), g_localizeStrings.Get(20107)));
+
+    m_settings.push_back(setting);
+
+    SettingInfo setting2;
+    setting2.id = 6;
+    setting2.name = g_localizeStrings.Get(20094);
+    setting2.data = &m_iSourcesMode;
+    setting2.type = SettingInfo::SPIN;
+    setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20062)));
+    setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20063)));
+    setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20061)));
+    if (g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE)
+      setting2.entry.push_back(make_pair(setting2.entry.size(), g_localizeStrings.Get(20107)));
+
+    m_settings.push_back(setting2);
+  }
+}
+
+void CGUIDialogProfileSettings::OnSettingChanged(unsigned int num)
+{
+  // setting has changed - update anything that needs it
+  if (num >= m_settings.size()) return;
+  OnSettingChanged(m_settings.at(num));
+}
+
+void CGUIDialogProfileSettings::OnSettingChanged(SettingInfo &setting)
+{
+  // check and update anything that needs it
+  if (setting.id == 1)
+  {
+    if (CGUIKeyboardFactory::ShowAndGetInput(m_strName,g_localizeStrings.Get(20093),false))
+    {
+      m_bNeedSave = true;
+      SET_CONTROL_LABEL(1000,m_strName);
+    }
+  }
+  if (setting.id == 2)
+  {
+    CStdString strThumb;
+    VECSOURCES shares;
+    g_mediaManager.GetLocalDrives(shares);
+    CFileItemList items;
+    if (!m_strThumb.IsEmpty())
+    {
+      CFileItemPtr item(new CFileItem("thumb://Current", false));
+      item->SetArt("thumb", m_strThumb);
+      item->SetLabel(g_localizeStrings.Get(20016));
+      items.Add(item);
+    }
+    CFileItemPtr item(new CFileItem("thumb://None", false));
+    item->SetArt("thumb", m_strDefaultImage);
+    item->SetLabel(g_localizeStrings.Get(20018));
+    items.Add(item);
+    if (CGUIDialogFileBrowser::ShowAndGetImage(items,shares,g_localizeStrings.Get(1030),strThumb) &&
+        !strThumb.Equals("thumb://Current"))
+    {
+      m_bNeedSave = true;
+      m_strThumb = strThumb.Equals("thumb://None") ? "" : strThumb;
+
+      CGUIImage *pImage = (CGUIImage*)GetControl(2);
+      if (pImage)
+      {
+        pImage->SetFileName("");
+        pImage->SetInvalid();
+        pImage->SetFileName(!m_strThumb.IsEmpty() ? m_strThumb : m_strDefaultImage);
+      }
+    }
+  }
+  if (setting.id == 3)
+  {
+    if (OnProfilePath(m_strDirectory, m_bIsDefault))
+    {
+      m_bNeedSave = true;
+      SET_CONTROL_LABEL(1001,m_strDirectory);
+    }
+  }
+
+  if (setting.id == 4)
+  {
+    if (m_bShowDetails)
+    {
+      if (g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE && !m_bIsDefault)
+      {
+        if (CGUIDialogYesNo::ShowAndGetInput(20066,20118,20119,20022))
+          g_passwordManager.SetMasterLockMode(false);
+        if (g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE)
+          return;
+      }
+      if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_bIsDefault ? 12360 : 20068, g_settings.GetMasterProfile().getLockMode() == LOCK_MODE_EVERYONE || m_bIsDefault))
+        m_bNeedSave = true;
+    }
+    else
+    {
+      if (CGUIDialogLockSettings::ShowAndGetLock(m_locks, m_bIsDefault ? 12360 : 20068, false, false))
+        m_bNeedSave = true;
+    }
+  }
+  if (setting.id > 4)
+    m_bNeedSave = true;
+}
+
+void CGUIDialogProfileSettings::OnCancel()
+{
+  m_bNeedSave = false;
+}
+
+bool CGUIDialogProfileSettings::OnProfilePath(CStdString &dir, bool isDefault)
+{
+  VECSOURCES shares;
+  CMediaSource share;
+  share.strName = "Profiles";
+  share.strPath = "special://masterprofile/profiles/";
+  shares.push_back(share);
+  CStdString strDirectory;
+  if (dir.IsEmpty())
+    strDirectory = share.strPath;
+  else
+    strDirectory = URIUtils::AddFileToFolder("special://masterprofile/", dir);
+  if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares,g_localizeStrings.Get(657),strDirectory,true))
+  {
+    dir = strDirectory;
+    if (!isDefault)
+      dir.erase(0,24);
+    return true;
+  }
+  return false;
+}
+
+bool CGUIDialogProfileSettings::ShowForProfile(unsigned int iProfile, bool firstLogin)
+{
+  CGUIDialogProfileSettings *dialog = (CGUIDialogProfileSettings *)g_windowManager.GetWindow(WINDOW_DIALOG_PROFILE_SETTINGS);
+  if (!dialog) return false;
+  if (iProfile == 0)
+    dialog->m_bIsDefault = true;
+  else
+    dialog->m_bIsDefault = false;
+  if (firstLogin && iProfile > g_settings.GetNumProfiles())
+    return false;
+
+  dialog->m_bNeedSave = false;
+  dialog->m_bShowDetails = !firstLogin;
+  dialog->SetProperty("heading", g_localizeStrings.Get(firstLogin ? 20255 : 20067));
+
+  const CProfile *profile = g_settings.GetProfile(iProfile);
+
+  if (!profile)
+  { // defaults
+    dialog->m_strName.Empty();
+    dialog->m_iDbMode = 2;
+    dialog->m_iSourcesMode = 2;
+    dialog->m_locks = CProfile::CLock();
+
+    bool bLock = g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE && !g_passwordManager.bMasterUser;
+    dialog->m_locks.addonManager = bLock;
+    dialog->m_locks.settings = bLock;
+    dialog->m_locks.files = bLock;
+
+    dialog->m_strDirectory.Empty();
+    dialog->m_strThumb.Empty();
+    // prompt for a name
+    if (!CGUIKeyboardFactory::ShowAndGetInput(dialog->m_strName,g_localizeStrings.Get(20093),false) || dialog->m_strName.IsEmpty())
+      return false;
+    // create a default path
+    CStdString defaultDir = URIUtils::AddFileToFolder("profiles",CUtil::MakeLegalFileName(dialog->m_strName));
+    URIUtils::AddSlashAtEnd(defaultDir);
+    CDirectory::Create(URIUtils::AddFileToFolder("special://masterprofile/", defaultDir));
+    // prompt for the user to change it if they want
+    CStdString userDir = defaultDir;
+    if (dialog->OnProfilePath(userDir, false)) // can't be the master user
+    {
+      if (userDir.Left(defaultDir.GetLength()) != defaultDir) // user chose a different folder
+        CDirectory::Remove(URIUtils::AddFileToFolder("special://masterprofile/", defaultDir));
+    }
+    dialog->m_strDirectory = userDir;
+    dialog->m_bNeedSave = true;
+  }
+  else
+  {
+    dialog->m_strName = profile->getName();
+    dialog->m_strThumb = profile->getThumb();
+    dialog->m_strDirectory = profile->getDirectory();
+    dialog->m_iDbMode = profile->canWriteDatabases()?0:1;
+    dialog->m_iSourcesMode = profile->canWriteSources()?0:1;
+    if (profile->hasDatabases())
+      dialog->m_iDbMode += 2;
+    if (profile->hasSources())
+      dialog->m_iSourcesMode += 2;
+
+    dialog->m_locks = profile->GetLocks();
+  }
+  dialog->DoModal();
+  if (dialog->m_bNeedSave)
+  {
+    if (iProfile >= g_settings.GetNumProfiles())
+    {
+      if (dialog->m_strName.IsEmpty() || dialog->m_strDirectory.IsEmpty())
+        return false;
+      /*CStdString strLabel;
+      strLabel.Format(g_localizeStrings.Get(20047),dialog->m_strName);
+      if (!CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(20058),strLabel,dialog->m_strDirectory,""))
+      {
+        CDirectory::Remove(URIUtils::AddFileToFolder(g_settings.GetUserDataFolder(), dialog->m_strDirectory));
+        return false;
+      }*/
+
+      // check for old profile settings
+      CProfile profile(dialog->m_strDirectory,dialog->m_strName,g_settings.GetNextProfileId());
+      g_settings.AddProfile(profile);
+      bool bExists = CFile::Exists(URIUtils::AddFileToFolder("special://masterprofile/",
+                                                          dialog->m_strDirectory+"/guisettings.xml"));
+
+      if (bExists)
+        if (!CGUIDialogYesNo::ShowAndGetInput(20058,20104,20105,20022))
+          bExists = false;
+
+      if (!bExists)
+      {
+        // save new profile guisettings
+        if (CGUIDialogYesNo::ShowAndGetInput(20058,20048,20102,20022,20044,20064))
+        {
+          CFile::Cache(URIUtils::AddFileToFolder("special://masterprofile/","guisettings.xml"),
+                       URIUtils::AddFileToFolder("special://masterprofile/",
+                                              dialog->m_strDirectory+"/guisettings.xml"));
+        }
+        else
+        {
+          // create some new settings
+          CGUISettings localSettings;
+          localSettings.Initialize();
+          CStdString path = URIUtils::AddFileToFolder("special://masterprofile/", dialog->m_strDirectory);
+          path = URIUtils::AddFileToFolder(path, "guisettings.xml");
+          CSettings settings;
+          settings.Initialize();
+          settings.SaveSettings(path, &localSettings);
+        }
+      }
+
+      bExists = CFile::Exists(URIUtils::AddFileToFolder("special://masterprofile/",
+                                                     dialog->m_strDirectory+"/sources.xml"));
+      if (bExists)
+        if (!CGUIDialogYesNo::ShowAndGetInput(20058,20106,20105,20022))
+          bExists = false;
+
+      if (!bExists)
+      {
+        if ((dialog->m_iSourcesMode & 2) == 2)
+          if (CGUIDialogYesNo::ShowAndGetInput(20058,20071,20102,20022,20044,20064))
+          {
+            CFile::Cache(URIUtils::AddFileToFolder("special://masterprofile/","sources.xml"),
+                         URIUtils::AddFileToFolder("special://masterprofile/",
+                         dialog->m_strDirectory+"/sources.xml"));
+          }
+      }
+    }
+
+    /*if (!dialog->m_bIsNewUser)
+      if (!CGUIDialogYesNo::ShowAndGetInput(20067,20103,20022,20022))
+        return false;*/
+
+    CProfile *profile = g_settings.GetProfile(iProfile);
+    assert(profile);
+    profile->setName(dialog->m_strName);
+    profile->setDirectory(dialog->m_strDirectory);
+    profile->setThumb(dialog->m_strThumb);
+    profile->setWriteDatabases(!((dialog->m_iDbMode & 1) == 1));
+    profile->setWriteSources(!((dialog->m_iSourcesMode & 1) == 1));
+    profile->setDatabases((dialog->m_iDbMode & 2) == 2);
+    profile->setSources((dialog->m_iSourcesMode & 2) == 2);
+    profile->SetLocks(dialog->m_locks);
+
+    g_settings.SaveProfiles(PROFILES_FILE);
+    return true;
+  }
+
+  return !dialog->m_bNeedSave;
+}
+
diff --git a/xbmc/settings/dialogs/GUIDialogProfileSettings.h b/xbmc/settings/dialogs/GUIDialogProfileSettings.h
new file mode 100644 (file)
index 0000000..0ce9c10
--- /dev/null
@@ -0,0 +1,63 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "MediaSource.h"
+#include "settings/Profile.h"
+#include "settings/dialogs/GUIDialogSettings.h"
+
+class CGUIDialogProfileSettings : public CGUIDialogSettings
+{
+public:
+  CGUIDialogProfileSettings(void);
+  virtual ~CGUIDialogProfileSettings(void);
+  virtual bool OnMessage(CGUIMessage &message);
+
+  static bool ShowForProfile(unsigned int iProfile, bool firstLogin = false);
+protected:
+  virtual void OnCancel();
+  virtual void OnWindowLoaded();
+  virtual void SetupPage();
+  virtual void CreateSettings();
+  void OnSettingChanged(unsigned int setting);
+  virtual void OnSettingChanged(SettingInfo &setting);
+
+  /*! \brief Prompt for a change in profile path
+   \param dir Current directory for the profile, new profile directory will be returned here
+   \param isDefault whether this is the default profile or not
+   \return true if the profile path has been changed, false otherwise.
+   */
+  bool OnProfilePath(CStdString &dir, bool isDefault);
+
+  bool m_bNeedSave;
+  CStdString m_strName;
+  CStdString m_strThumb;
+  CStdString m_strDirectory;
+  int m_iSourcesMode;
+  int m_iDbMode;
+  bool m_bIsDefault;
+  bool m_bIsNewUser;
+  bool m_bShowDetails;
+
+  CProfile::CLock m_locks;
+  CStdString m_strDefaultImage;
+};
+
diff --git a/xbmc/settings/dialogs/GUIDialogSettings.cpp b/xbmc/settings/dialogs/GUIDialogSettings.cpp
new file mode 100644 (file)
index 0000000..ce737e5
--- /dev/null
@@ -0,0 +1,692 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogSettings.h"
+#include "guilib/GUIEditControl.h"
+#include "guilib/GUISpinControlEx.h"
+#include "guilib/GUIRadioButtonControl.h"
+#include "guilib/GUISettingsSliderControl.h"
+#include "guilib/GUIImage.h"
+#include "guilib/GUIControlGroupList.h"
+#include "guilib/LocalizeStrings.h"
+#include "settings/GUISettings.h"
+#include "utils/log.h"
+#include "guilib/GUIKeyboardFactory.h"
+
+#define CONTROL_GROUP_LIST          5
+#define CONTROL_SETTINGS_LABEL      2
+#define CONTROL_NONE_AVAILABLE      3
+#define CONTROL_DEFAULT_BUTTON      7
+#define CONTROL_DEFAULT_RADIOBUTTON 8
+#define CONTROL_DEFAULT_SPIN        9
+#define CONTROL_DEFAULT_SLIDER     10
+#define CONTROL_DEFAULT_SEPARATOR  11
+#define CONTROL_DEFAULT_EDIT       12
+#define CONTROL_DEFAULT_EDIT_NUM   13
+#define CONTROL_OKAY_BUTTON        28
+#define CONTROL_CANCEL_BUTTON      29
+#define CONTROL_START              30
+#define CONTROL_PAGE               60
+
+using namespace std;
+
+CGUIDialogSettings::CGUIDialogSettings(int id, const char *xmlFile)
+    : CGUIDialog(id, xmlFile)
+{
+  m_pOriginalEdit = NULL;
+  m_pOriginalEditNum = NULL;
+  m_pOriginalSpin = NULL;
+  m_pOriginalRadioButton = NULL;
+  m_pOriginalSettingsButton = NULL;
+  m_pOriginalSlider = NULL;
+  m_pOriginalSeparator = NULL;
+  m_usePopupSliders = false;
+  m_loadType = KEEP_IN_MEMORY;
+}
+
+CGUIDialogSettings::~CGUIDialogSettings(void)
+{
+}
+
+bool CGUIDialogSettings::OnMessage(CGUIMessage &message)
+{
+  switch (message.GetMessage())
+  {
+  case GUI_MSG_CLICKED:
+    {
+      unsigned int iControl = message.GetSenderId();
+      if (iControl >= CONTROL_OKAY_BUTTON && iControl < CONTROL_PAGE)
+        OnClick(iControl);
+      return true;
+    }
+    break;
+  case GUI_MSG_WINDOW_DEINIT:
+    {
+      CGUIDialog::OnMessage(message);
+      FreeControls();
+      m_settings.clear();
+      return true;
+    }
+    break;
+  }
+  return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogSettings::SetupPage()
+{
+  // cleanup first, if necessary
+  FreeControls();
+  m_pOriginalEdit = (CGUIEditControl*)GetControl(CONTROL_DEFAULT_EDIT);
+  m_pOriginalEditNum = (CGUIEditControl*)GetControl(CONTROL_DEFAULT_EDIT_NUM);
+  m_pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN);
+  m_pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON);
+  m_pOriginalSettingsButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON);
+  m_pOriginalSlider = (CGUISettingsSliderControl *)GetControl(CONTROL_DEFAULT_SLIDER);
+  m_pOriginalSeparator = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR);
+  if (m_pOriginalEdit) m_pOriginalEdit->SetVisible(false);
+  if (m_pOriginalEditNum) m_pOriginalEditNum->SetVisible(false);
+  if (m_pOriginalSpin) m_pOriginalSpin->SetVisible(false);
+  if (m_pOriginalRadioButton) m_pOriginalRadioButton->SetVisible(false);
+  if (m_pOriginalSettingsButton) m_pOriginalSettingsButton->SetVisible(false);
+  if (m_pOriginalSlider) m_pOriginalSlider->SetVisible(false);
+  if (m_pOriginalSeparator) m_pOriginalSeparator->SetVisible(false);
+
+  // update our settings label
+  if (GetID() == WINDOW_DIALOG_PVR_TIMER_SETTING)
+  {
+    SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(19057));
+  }
+  else
+  {
+  SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, g_localizeStrings.Get(13395 + GetID() - WINDOW_DIALOG_VIDEO_OSD_SETTINGS));
+  }
+
+  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
+  if (!group)
+    return;
+
+  if (!m_settings.size())
+  { // no settings available
+    SET_CONTROL_VISIBLE(CONTROL_NONE_AVAILABLE);
+    return;
+  }
+  else
+  {
+    SET_CONTROL_HIDDEN(CONTROL_NONE_AVAILABLE);
+  }
+
+  // create our controls
+  for (unsigned int i = 0; i < m_settings.size(); i++)
+  {
+    SettingInfo &setting = m_settings.at(i);
+    AddSetting(setting, group->GetWidth(), CONTROL_START + i);
+  }
+}
+
+void CGUIDialogSettings::EnableSettings(unsigned int id, bool enabled)
+{
+  for (unsigned int i = 0; i < m_settings.size(); i++)
+  {
+    if (m_settings[i].id != id)
+      continue;
+    m_settings[i].enabled = enabled;
+    if (enabled)
+    {
+      CONTROL_ENABLE(i + CONTROL_START);
+    }
+    else
+    {
+      CONTROL_DISABLE(i + CONTROL_START);
+    }
+    return;
+  }
+  CLog::Log(LOGWARNING, "%s - Invalid setting specified", __FUNCTION__);
+}
+
+void CGUIDialogSettings::UpdateSetting(unsigned int id)
+{
+  unsigned int settingNum = (unsigned int)-1;
+  for (unsigned int i = 0; i < m_settings.size(); i++)
+  {
+    if (m_settings[i].id == id)
+    {
+      settingNum = i;
+      break;
+    }
+  }
+  if(settingNum == (unsigned int)-1)
+    return;
+
+  SettingInfo &setting = m_settings.at(settingNum);
+  unsigned int controlID = settingNum + CONTROL_START;
+  if (setting.type == SettingInfo::SPIN)
+  {
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(controlID);
+    if (pControl && setting.data) pControl->SetValue(*(int *)setting.data);
+  }
+  else if (setting.type == SettingInfo::CHECK)
+  {
+    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
+    if (pControl && setting.data) pControl->SetSelected(*(bool *)setting.data);
+  }
+  else if (setting.type == SettingInfo::CHECK_UCHAR)
+  {
+    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(controlID);
+    if (pControl && setting.data) pControl->SetSelected(*(unsigned char*)setting.data ? true : false);
+  }
+  else if (setting.type == SettingInfo::SLIDER)
+  {
+    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
+    if (pControl && setting.data)
+    {
+      float value = *(float *)setting.data;
+      pControl->SetFloatValue(value);
+      if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(value, setting.interval));
+    }
+  }
+  else if (setting.type == SettingInfo::BUTTON_DIALOG)
+  {
+    SET_CONTROL_LABEL(controlID,setting.name);
+    CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(controlID);
+    if (pControl && setting.data) pControl->SetLabel2(*(CStdString *)setting.data);
+  }
+  else if (setting.type == SettingInfo::EDIT)
+  {
+    SET_CONTROL_LABEL(controlID, setting.name);
+    if (setting.data) SET_CONTROL_LABEL2(controlID, string(*(CStdString *)setting.data));
+  }
+  else if (setting.type == SettingInfo::EDIT_NUM)
+  {
+    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(controlID);
+    if (pControl && setting.data) {
+      CStdString strIndex;
+      strIndex.Format("%i", *(int *)setting.data);
+      pControl->SetLabel2(strIndex);
+    }
+  }
+  else if (setting.type == SettingInfo::STRING)
+  {
+    SET_CONTROL_LABEL(controlID, setting.name);
+    string strNewValue = string(*(CStdString *)setting.data);
+    if (strNewValue.empty())
+      strNewValue = "-";
+    SET_CONTROL_LABEL2(controlID, strNewValue);
+  }
+  else if (setting.type == SettingInfo::RANGE)
+  {
+    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(controlID);
+    float** value = (float **)setting.data;
+    if (pControl && setting.data)
+    {
+      pControl->SetFloatValue(*(value[0]), CGUISliderControl::RangeSelectorLower);
+      pControl->SetFloatValue(*(value[1]), CGUISliderControl::RangeSelectorUpper);
+      if (setting.formatFunction.range) pControl->SetTextValue(setting.formatFunction.range(*(value[0]), *(value[1]), setting.interval));
+    }
+  }
+
+  if (setting.enabled)
+  {
+    CONTROL_ENABLE(controlID);
+  }
+  else
+  {
+    CONTROL_DISABLE(controlID);
+  }
+}
+
+bool CGUIDialogSettings::OnBack(int actionID)
+{
+  OnCancel();
+  return CGUIDialog::OnBack(actionID);
+}
+
+void CGUIDialogSettings::OnClick(int iID)
+{
+  if (iID == CONTROL_OKAY_BUTTON)
+  {
+    OnOkay();
+    Close();
+    return;
+  }
+  if (iID == CONTROL_CANCEL_BUTTON)
+  {
+    OnCancel();
+    Close();
+    return;
+  }
+  unsigned int settingNum = iID - CONTROL_START;
+  if (settingNum >= m_settings.size()) return;
+  SettingInfo &setting = m_settings.at(settingNum);
+  if (setting.type == SettingInfo::SPIN)
+  {
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID);
+    if (setting.data) *(int *)setting.data = pControl->GetValue();
+  }
+  else if (setting.type == SettingInfo::BUTTON_DIALOG)
+  {
+    CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(iID);
+    if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
+  }
+  else if (setting.type == SettingInfo::EDIT)
+  {
+    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
+    if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2();
+  }
+  else if (setting.type == SettingInfo::EDIT_NUM)
+  {
+    CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID);
+    if (setting.data) {
+        CStdString strIndex = pControl->GetLabel2();
+        *(int *)setting.data = atol(strIndex.c_str());
+    }
+  }
+  else if (setting.type == SettingInfo::CHECK)
+  {
+    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
+    if (setting.data) *(bool *)setting.data = pControl->IsSelected();
+  }
+  else if (setting.type == SettingInfo::CHECK_UCHAR)
+  {
+    CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID);
+    if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0;
+  }
+  else if (setting.type == SettingInfo::SLIDER)
+  {
+    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
+    if (setting.data) *(float *)setting.data = pControl->GetFloatValue();
+    if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(pControl->GetFloatValue(), setting.interval));
+  }
+  else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data)
+  { // we're using popup sliders
+    CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting);
+    if (setting.formatFunction.standard)
+      SET_CONTROL_LABEL2(iID, setting.formatFunction.standard(*(float *)setting.data, setting.interval));
+  }
+  else if (setting.type == SettingInfo::STRING)
+  {
+    CGUIKeyboardFactory::ShowAndGetInput(*(CStdString *) setting.data, true);
+    string strNewValue = string(*(CStdString *)setting.data);
+    if (strNewValue.empty())
+      strNewValue = "-";
+    SET_CONTROL_LABEL2(iID, strNewValue);
+  }
+  else if (setting.type == SettingInfo::RANGE)
+  {
+    CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID);
+    if (setting.data)
+    {
+      *((float **)setting.data)[0] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower);
+      *((float **)setting.data)[1] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper);
+    }
+    if (setting.formatFunction.range)
+      pControl->SetTextValue(setting.formatFunction.range(pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower), 
+                                                          pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper),
+                                                          setting.interval));
+  }
+  OnSettingChanged(setting);
+}
+
+void CGUIDialogSettings::FreeControls()
+{
+  // just clear our group list
+  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
+  if (group)
+  {
+    group->FreeResources();
+    group->ClearAll();
+  }
+}
+
+void CGUIDialogSettings::AddSetting(SettingInfo &setting, float width, int iControlID)
+{
+  CGUIControl *pControl = NULL;
+  if (setting.type == SettingInfo::BUTTON_DIALOG && m_pOriginalSettingsButton)
+  {
+    pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
+    if (!pControl) return ;
+    ((CGUIButtonControl *)pControl)->SetLabel(setting.name);
+    pControl->SetWidth(width);
+       if (setting.data) ((CGUIButtonControl *)pControl)->SetLabel2(*(CStdString *)setting.data);
+  }
+  else if (setting.type == SettingInfo::BUTTON && m_pOriginalSettingsButton)
+  {
+    pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
+    if (!pControl) return ;
+    ((CGUIButtonControl *)pControl)->SetLabel(setting.name);
+    if (setting.formatFunction.standard)
+      ((CGUIButtonControl *)pControl)->SetLabel2(setting.formatFunction.standard(*(float *)setting.data, setting.interval));
+    pControl->SetWidth(width);
+  }
+  else if (setting.type == SettingInfo::EDIT && m_pOriginalEdit)
+  {
+    pControl = new CGUIEditControl(*m_pOriginalEdit);
+    if (!pControl) return ;
+    ((CGUIEditControl *)pControl)->SetLabel(setting.name);
+    pControl->SetWidth(width);
+    if (setting.data) ((CGUIEditControl *)pControl)->SetLabel2(*(CStdString *)setting.data);
+  }
+  else if (setting.type == SettingInfo::EDIT_NUM && m_pOriginalEditNum)
+  {
+    pControl = new CGUIEditControl(*m_pOriginalEditNum);
+    if (!pControl) return ;
+    ((CGUIEditControl *)pControl)->SetLabel(setting.name);
+    pControl->SetWidth(width);
+    ((CGUIEditControl *)pControl)->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, 0);
+    if (setting.data) {
+        CStdString strIndex;
+        strIndex.Format("%i", *(int *)setting.data);
+        ((CGUIEditControl *)pControl)->SetLabel2(strIndex);
+    }
+  }
+  else if (setting.type == SettingInfo::SEPARATOR && m_pOriginalSeparator)
+  {
+    pControl = new CGUIImage(*m_pOriginalSeparator);
+    if (!pControl) return ;
+    pControl->SetWidth(width);
+  }
+  else if (setting.type == SettingInfo::CHECK || setting.type == SettingInfo::CHECK_UCHAR)
+  {
+    if (!m_pOriginalRadioButton) return;
+    pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
+    if (!pControl) return ;
+    ((CGUIRadioButtonControl *)pControl)->SetLabel(setting.name);
+    pControl->SetWidth(width);
+    if (setting.data) ((CGUIRadioButtonControl *)pControl)->SetSelected(*(bool *)setting.data == 1);
+  }
+  else if (setting.type == SettingInfo::SPIN && setting.entry.size() > 0 && m_pOriginalSpin)
+  {
+    pControl = new CGUISpinControlEx(*m_pOriginalSpin);
+    if (!pControl) return ;
+    pControl->SetWidth(width);
+    ((CGUISpinControlEx *)pControl)->SetText(setting.name);
+    pControl->SetWidth(width);
+    for (unsigned int i = 0; i < setting.entry.size(); i++)
+      ((CGUISpinControlEx *)pControl)->AddLabel(setting.entry[i].second, setting.entry[i].first);
+    if (setting.data) ((CGUISpinControlEx *)pControl)->SetValue(*(int *)setting.data);
+  }
+  else if (setting.type == SettingInfo::SLIDER)
+  {
+    if (!m_pOriginalSlider) return;
+    pControl = new CGUISettingsSliderControl(*m_pOriginalSlider);
+    if (!pControl) return ;
+    pControl->SetWidth(width);
+    ((CGUISettingsSliderControl *)pControl)->SetText(setting.name);
+    if (setting.formatFunction.standard)
+      ((CGUISettingsSliderControl *)pControl)->SetTextValue(setting.formatFunction.standard(*(float *)setting.data, setting.interval));
+    ((CGUISettingsSliderControl *)pControl)->SetType(SPIN_CONTROL_TYPE_FLOAT);
+    ((CGUISettingsSliderControl *)pControl)->SetFloatRange(setting.min, setting.max);
+    ((CGUISettingsSliderControl *)pControl)->SetFloatInterval(setting.interval);
+    if (setting.data) ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*(float *)setting.data);
+  }
+  else if (setting.type == SettingInfo::STRING && m_pOriginalSettingsButton)
+  {
+    pControl = new CGUIButtonControl(*m_pOriginalSettingsButton);
+    if (!pControl) return ;
+    ((CGUIButtonControl *)pControl)->SetLabel(setting.name);
+    string strValue = string(*(CStdString *)setting.data);
+    if (strValue.empty())
+      strValue = "-";
+    ((CGUIButtonControl *)pControl)->SetLabel2(strValue);
+    pControl->SetWidth(width);
+  }
+  else if (setting.type == SettingInfo::RANGE)
+  {
+    if (!m_pOriginalSlider) return;
+    pControl = new CGUISettingsSliderControl(*m_pOriginalSlider);
+    if (!pControl) return ;
+    pControl->SetWidth(width);
+    ((CGUISettingsSliderControl *)pControl)->SetText(setting.name);
+    if (setting.formatFunction.range)
+      ((CGUISettingsSliderControl *)pControl)->SetTextValue(setting.formatFunction.range(*((float **)setting.data)[0], *((float **)setting.data)[1], setting.interval));
+    ((CGUISettingsSliderControl *)pControl)->SetType(SPIN_CONTROL_TYPE_FLOAT);
+    ((CGUISettingsSliderControl *)pControl)->SetRangeSelection(true);
+    ((CGUISettingsSliderControl *)pControl)->SetFloatRange(setting.min, setting.max);
+    ((CGUISettingsSliderControl *)pControl)->SetFloatInterval(setting.interval);
+    if (setting.data)
+    {
+      ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*((float **)setting.data)[0], CGUISliderControl::RangeSelectorLower);
+      ((CGUISettingsSliderControl *)pControl)->SetFloatValue(*((float **)setting.data)[1], CGUISliderControl::RangeSelectorUpper);
+    }
+  }
+  if (!pControl) return;
+
+  pControl->SetID(iControlID);
+  pControl->SetVisible(true);
+  pControl->SetEnabled(setting.enabled);
+  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CONTROL_GROUP_LIST);
+  if (group)
+  {
+    pControl->AllocResources();
+    group->AddControl(pControl);
+  }
+  else
+    delete pControl;
+}
+
+void CGUIDialogSettings::AddEdit(unsigned int id, int label, CStdString *str, bool enabled)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::EDIT;
+  setting.enabled  = enabled;
+  setting.data = str;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddNumEdit(unsigned int id, int label, int *current, bool enabled)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::EDIT_NUM;
+  setting.enabled  = enabled;
+  setting.data = current;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddButton(unsigned int id, int label, float *current, float min, float interval, float max, FORMATFUNCTION function)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::BUTTON;
+  setting.data = current;
+  setting.min = min;
+  setting.max = max;
+  setting.interval = interval;
+  setting.formatFunction.standard = function;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddButton(unsigned int id, int label, CStdString *str, bool bOn)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::BUTTON_DIALOG;
+  setting.enabled  = bOn;
+  setting.data = str;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddString(unsigned int id, int label, CStdString *current)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::STRING;
+  setting.data = current;
+  setting.enabled = true;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddBool(unsigned int id, int label, bool *on, bool enabled)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::CHECK;
+  setting.data = on;
+  setting.enabled = enabled;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsigned int max, const SETTINGSTRINGS &entries)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::SPIN;
+  setting.data = current;
+  for (unsigned int i = 0; i < max; i++)
+    setting.entry.push_back(make_pair(i, entries[i]));
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsigned int max, const int *entries)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::SPIN;
+  setting.data = current;
+  for (unsigned int i = 0; i < max; i++)
+    setting.entry.push_back(make_pair(i, g_localizeStrings.Get(entries[i])));
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, unsigned int min, unsigned int max, const char* minLabel)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::SPIN;
+  setting.data = current;
+  for (unsigned int i = min; i <= max; i++)
+  {
+    CStdString format;
+    if (i == min && minLabel)
+      format = minLabel;
+    else
+      format.Format("%i", i);
+    setting.entry.push_back(make_pair(i, format));
+  }
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, vector<pair<int, CStdString> > &values)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::SPIN;
+  setting.data = current;
+  setting.entry = values;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddSpin(unsigned int id, int label, int *current, vector<pair<int, int> > &values)
+{
+  vector<pair<int, CStdString> > entries;
+  for(unsigned i = 0; i < values.size(); i++)
+    entries.push_back(make_pair(values[i].first, g_localizeStrings.Get(values[i].second)));
+  AddSpin(id, label, current, entries);
+}
+
+void CGUIDialogSettings::AddSlider(unsigned int id, int label, float *current, float min, float interval, float max, FORMATFUNCTION function, bool allowPopup /* = true*/)
+{
+  if (m_usePopupSliders && allowPopup)
+  {
+    AddButton(id, label, current, min, interval, max, function);
+    return;
+  }
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::SLIDER;
+  setting.min = min;
+  setting.interval = interval;
+  setting.max = max;
+  setting.data = current;
+  setting.formatFunction.standard = function;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddRangeSlider(unsigned int id, int label, float *currentLower, float* currentUpper, float min, float interval, float max, RANGEFORMATFUNCTION function)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.name = g_localizeStrings.Get(label);
+  setting.type = SettingInfo::RANGE;
+  setting.min = min;
+  setting.interval = interval;
+  setting.max = max;
+
+  float** data = new float*[2];
+  data[0] = currentLower;
+  data[1] = currentUpper;
+  setting.data = data;
+
+  setting.formatFunction.range = function;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::AddSeparator(unsigned int id)
+{
+  SettingInfo setting;
+  setting.id = id;
+  setting.type = SettingInfo::SEPARATOR;
+  setting.data = NULL;
+  m_settings.push_back(setting);
+}
+
+void CGUIDialogSettings::OnInitWindow()
+{
+  CreateSettings();
+  SetInitialVisibility();
+  SetupPage();
+  // set the default focus control
+  m_lastControlID = CONTROL_START;
+  CGUIDialog::OnInitWindow();
+}
+
+void CGUIDialogSettings::OnSliderChange(void *data, CGUISliderControl *slider)
+{
+  if (!data || !slider)
+    return;
+
+  SettingInfo *setting = (SettingInfo *)data;
+  if (setting->type == SettingInfo::SLIDER || (setting->type == SettingInfo::BUTTON && m_usePopupSliders && !slider->GetRangeSelection()))
+  {
+    *(float *)setting->data = slider->GetFloatValue();
+    OnSettingChanged(*setting);
+    if (setting->formatFunction.standard)
+      slider->SetTextValue(setting->formatFunction.standard(slider->GetFloatValue(), setting->interval));
+  }
+  else if (setting->type == SettingInfo::RANGE || (setting->type == SettingInfo::BUTTON && m_usePopupSliders && slider->GetRangeSelection()))
+  {
+    *((float **)setting->data)[0] = slider->GetFloatValue(CGUISliderControl::RangeSelectorLower);
+    *((float **)setting->data)[1] = slider->GetFloatValue(CGUISliderControl::RangeSelectorUpper);
+    OnSettingChanged(*setting);
+    if (setting->formatFunction.range)
+      slider->SetTextValue(setting->formatFunction.range(slider->GetFloatValue(CGUISliderControl::RangeSelectorLower), slider->GetFloatValue(CGUISliderControl::RangeSelectorUpper), setting->interval));
+  }
+}
diff --git a/xbmc/settings/dialogs/GUIDialogSettings.h b/xbmc/settings/dialogs/GUIDialogSettings.h
new file mode 100644 (file)
index 0000000..6202011
--- /dev/null
@@ -0,0 +1,119 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+#include "dialogs/GUIDialogSlider.h"
+
+class CGUISpinControlEx;
+class CGUIButtonControl;
+class CGUIRadioButtonControl;
+class CGUISettingsSliderControl;
+class CGUIEditControl;
+class CGUIImage;
+class CGUIEditControl;
+
+typedef std::vector<CStdString> SETTINGSTRINGS;
+typedef CStdString (*FORMATFUNCTION) (float value, float min);
+typedef CStdString (*RANGEFORMATFUNCTION) (float valueLower, float valueUpper, float min);
+
+class SettingInfo
+{
+public:
+  enum SETTING_TYPE { NONE=0, EDIT, EDIT_NUM, BUTTON, BUTTON_DIALOG, CHECK, CHECK_UCHAR, SPIN, SLIDER, SEPARATOR, STRING, RANGE };
+  SettingInfo()
+  {
+    id = 0;
+    data = NULL;
+    type = NONE;
+    enabled = true;
+    min = 0;
+    max = 0;
+    interval = 0;
+    formatFunction.standard = NULL;
+  };
+  SETTING_TYPE type;
+  CStdString name;
+  unsigned int id;
+  void *data;
+  float min;
+  float max;
+  float interval;
+  union
+  {
+    FORMATFUNCTION standard;
+    RANGEFORMATFUNCTION range;
+  } formatFunction;
+  std::vector<std::pair<int, CStdString> > entry;
+  bool enabled;
+};
+
+class CGUIDialogSettings :
+      public CGUIDialog, public ISliderCallback
+{
+public:
+  CGUIDialogSettings(int id, const char *xmlFile);
+  virtual ~CGUIDialogSettings(void);
+  virtual bool OnMessage(CGUIMessage &message);
+
+  virtual void OnSliderChange(void *data, CGUISliderControl *slider);
+protected:
+  virtual void OnOkay() {};
+  virtual void OnCancel() {};
+  virtual bool OnBack(int actionID);
+  virtual void OnInitWindow();
+  virtual void SetupPage();
+  virtual void CreateSettings() {};
+  void UpdateSetting(unsigned int setting);
+  void EnableSettings(unsigned int setting, bool enabled);
+  virtual void OnSettingChanged(SettingInfo &setting) {};
+  void FreeControls();
+  void OnClick(int iControlID);
+
+  void AddSetting(SettingInfo &setting, float width, int iControlID);
+
+  void AddEdit(unsigned int id, int label, CStdString *str, bool enabled = true);
+  void AddNumEdit(unsigned int id, int label, int *current, bool enabled = true);
+  void AddButton(unsigned int id, int label, float *current = NULL, float min = 0, float interval = 0, float max = 0, FORMATFUNCTION function = NULL);
+  void AddButton(unsigned int it, int label, CStdString *str, bool bOn=true);
+  void AddBool(unsigned int id, int label, bool *on, bool enabled = true);
+  void AddSpin(unsigned int id, int label, int *current, unsigned int max, const SETTINGSTRINGS &entries);
+  void AddString(unsigned int id, int label, CStdString *current);
+  void AddSpin(unsigned int id, int label, int *current, unsigned int max, const int *entries);
+  void AddSpin(unsigned int id, int label, int *current, unsigned int min, unsigned int max, const char* minLabel = NULL);
+  void AddSpin(unsigned int id, int label, int *current, std::vector<std::pair<int, CStdString> > &values);
+  void AddSpin(unsigned int id, int label, int *current, std::vector<std::pair<int, int> > &values);
+  void AddSlider(unsigned int id, int label, float *current, float min, float interval, float max, FORMATFUNCTION formatFunction, bool allowPopup = true);
+  void AddRangeSlider(unsigned int id, int label, float *currentLower, float* currentUpper, float min, float interval, float max, RANGEFORMATFUNCTION formatFunction);
+  void AddSeparator(unsigned int id);
+
+  CGUIEditControl *m_pOriginalEdit;
+  CGUIEditControl *m_pOriginalEditNum;
+  CGUISpinControlEx *m_pOriginalSpin;
+  CGUIRadioButtonControl *m_pOriginalRadioButton;
+  CGUIButtonControl *m_pOriginalSettingsButton;
+  CGUISettingsSliderControl *m_pOriginalSlider;
+  CGUIImage *m_pOriginalSeparator;
+
+  std::vector<SettingInfo> m_settings;
+
+  bool m_usePopupSliders;
+};
diff --git a/xbmc/settings/dialogs/Makefile b/xbmc/settings/dialogs/Makefile
new file mode 100644 (file)
index 0000000..e5876b1
--- /dev/null
@@ -0,0 +1,9 @@
+SRCS=GUIDialogContentSettings.cpp \
+     GUIDialogLockSettings.cpp \
+     GUIDialogProfileSettings.cpp \
+     GUIDialogSettings.cpp \
+
+LIB=settings_dialogs.a
+
+include ../../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
diff --git a/xbmc/settings/windows/GUISettingControls.cpp b/xbmc/settings/windows/GUISettingControls.cpp
new file mode 100644 (file)
index 0000000..40a6df2
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUISettingControls.h"
+#include "guilib/GUIRadioButtonControl.h"
+#include "guilib/GUISpinControlEx.h"
+#include "guilib/GUIEditControl.h"
+#include "Util.h"
+#include "dialogs/GUIDialogOK.h"
+#include "settings/GUISettings.h"
+#include "guilib/GUIImage.h"
+#include "guilib/LocalizeStrings.h"
+#include "addons/AddonManager.h"
+
+CGUIBaseSettingControl::CGUIBaseSettingControl(int id, CSetting *pSetting)
+{
+  m_id = id;
+  m_pSetting = pSetting;
+  m_delayed = false;
+}
+
+CGUIRadioButtonSettingControl::CGUIRadioButtonSettingControl(CGUIRadioButtonControl *pRadioButton, int id, CSetting *pSetting)
+    : CGUIBaseSettingControl(id, pSetting)
+{
+  m_pRadioButton = pRadioButton;
+  m_pRadioButton->SetID(id);
+  Update();
+}
+
+CGUIRadioButtonSettingControl::~CGUIRadioButtonSettingControl()
+{}
+
+bool CGUIRadioButtonSettingControl::OnClick()
+{
+  ((CSettingBool *)m_pSetting)->SetData(!((CSettingBool *)m_pSetting)->GetData());
+  return true;
+}
+
+void CGUIRadioButtonSettingControl::Update()
+{
+  if (m_pRadioButton)
+    m_pRadioButton->SetSelected(((CSettingBool *)m_pSetting)->GetData());
+}
+
+CGUISpinExSettingControl::CGUISpinExSettingControl(CGUISpinControlEx *pSpin, int id, CSetting *pSetting)
+    : CGUIBaseSettingControl(id, pSetting)
+{
+  m_pSpin = pSpin;
+  m_pSpin->SetID(id);
+  if (pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
+  {
+    CSettingFloat *pSettingFloat = (CSettingFloat *)pSetting;
+    m_pSpin->SetType(SPIN_CONTROL_TYPE_FLOAT);
+    m_pSpin->SetFloatRange(pSettingFloat->m_fMin, pSettingFloat->m_fMax);
+    m_pSpin->SetFloatInterval(pSettingFloat->m_fStep);
+  }
+  else if (pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || pSetting->GetControlType() == SPIN_CONTROL_INT)
+  {
+    CSettingInt *pSettingInt = (CSettingInt *)pSetting;
+    m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
+    m_pSpin->Clear();
+    CStdString strLabel;
+    int i = pSettingInt->m_iMin;
+    if (pSettingInt->m_iLabelMin>-1)
+    {
+      strLabel=g_localizeStrings.Get(pSettingInt->m_iLabelMin);
+      m_pSpin->AddLabel(strLabel, pSettingInt->m_iMin);
+      i += pSettingInt->m_iStep;
+    }
+    for (; i <= pSettingInt->m_iMax; i += pSettingInt->m_iStep)
+    {
+      if (pSettingInt->m_iFormat > -1)
+      {
+        CStdString strFormat = g_localizeStrings.Get(pSettingInt->m_iFormat);
+        strLabel.Format(strFormat, i);
+      }
+      else
+        strLabel.Format(pSettingInt->m_strFormat, i);
+      m_pSpin->AddLabel(strLabel, i);
+    }
+  }
+  else // if (pSetting->GetControlType() == SPIN_CONTROL_TEXT)
+  {
+    m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
+    m_pSpin->Clear();
+  }
+  Update();
+}
+
+CGUISpinExSettingControl::~CGUISpinExSettingControl()
+{}
+
+bool CGUISpinExSettingControl::OnClick()
+{
+  // TODO: Should really check for a change here (as end of spincontrols may
+  //       cause no change)
+  if (m_pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
+    ((CSettingFloat *)m_pSetting)->SetData(m_pSpin->GetFloatValue());
+  else
+  {
+    if (m_pSetting->GetType() == SETTINGS_TYPE_INT)
+    {
+      CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
+      pSettingInt->SetData(m_pSpin->GetValue());
+    }
+  }
+  return true;
+}
+
+void CGUISpinExSettingControl::Update()
+{
+  if (!m_pSpin)
+    return;
+  if (m_pSetting->GetControlType() == SPIN_CONTROL_FLOAT)
+  {
+    CSettingFloat *pSettingFloat = (CSettingFloat *)m_pSetting;
+    m_pSpin->SetFloatValue(pSettingFloat->GetData());
+  }
+  else if (m_pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || m_pSetting->GetControlType() == SPIN_CONTROL_INT)
+  {
+    CSettingInt *pSettingInt = (CSettingInt *)m_pSetting;
+    m_pSpin->SetValue(pSettingInt->GetData());
+  }
+}
+
+CGUIButtonSettingControl::CGUIButtonSettingControl(CGUIButtonControl *pButton, int id, CSetting *pSetting)
+    : CGUIBaseSettingControl(id, pSetting)
+{
+  m_pButton = pButton;
+  m_pButton->SetID(id);
+  Update();
+}
+
+CGUIButtonSettingControl::~CGUIButtonSettingControl()
+{}
+
+bool CGUIButtonSettingControl::OnClick()
+{
+  // this is pretty much a no-op as all click action is done in the calling class
+  Update();
+  return true;
+}
+
+void CGUIButtonSettingControl::Update()
+{
+  CStdString strText = ((CSettingString *)m_pSetting)->GetData();
+  if (m_pSetting->GetType() == SETTINGS_TYPE_ADDON)
+  {
+    ADDON::AddonPtr addon;
+    if (ADDON::CAddonMgr::Get().GetAddon(strText, addon))
+      strText = addon->Name();
+    if (strText.IsEmpty())
+      strText = g_localizeStrings.Get(231); // None
+  }
+  else if (m_pSetting->GetControlType() == BUTTON_CONTROL_PATH_INPUT)
+  {
+    CStdString shortPath;
+    if (CUtil::MakeShortenPath(strText, shortPath, 30 ))
+      strText = shortPath;
+  }
+  else if (m_pSetting->GetControlType() == BUTTON_CONTROL_STANDARD)
+    return;
+  if (m_pButton)
+    m_pButton->SetLabel2(strText);
+}
+
+CGUIEditSettingControl::CGUIEditSettingControl(CGUIEditControl *pEdit, int id, CSetting *pSetting)
+    : CGUIBaseSettingControl(id, pSetting)
+{
+  m_needsUpdate = false;
+  m_pEdit = pEdit;
+  m_pEdit->SetID(id);
+  int heading = ((CSettingString *)m_pSetting)->m_iHeadingString;
+  if (heading < 0) heading = 0;
+  if (pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_INPUT)
+    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD, heading);
+  else if (pSetting->GetControlType() == EDIT_CONTROL_MD5_INPUT)
+    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD_MD5, heading);    
+  else if (pSetting->GetControlType() == EDIT_CONTROL_IP_INPUT)
+    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_IPADDRESS, heading);
+  else if (pSetting->GetControlType() == EDIT_CONTROL_NUMBER_INPUT)
+    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_NUMBER, heading);
+  else if (pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_NUMBER_VERIFY_NEW)
+    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW, heading);
+  else
+    m_pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, heading);
+  Update();
+}
+
+CGUIEditSettingControl::~CGUIEditSettingControl()
+{
+}
+
+bool CGUIEditSettingControl::OnClick()
+{
+  // update our string
+  ((CSettingString *)m_pSetting)->SetData(m_pEdit->GetLabel2());
+  // we update on exit only
+  m_needsUpdate = true;
+  return false;
+}
+
+void CGUIEditSettingControl::Update()
+{
+  if (!m_needsUpdate && m_pEdit)
+    m_pEdit->SetLabel2(((CSettingString *)m_pSetting)->GetData());
+}
+
+bool CGUIEditSettingControl::IsValidIPAddress(const CStdString &strIP)
+{
+  const char* s = strIP.c_str();
+  bool legalFormat = true;
+  bool numSet = false;
+  int num = 0;
+  int dots = 0;
+
+  while (*s != '\0')
+  {
+    if (*s == '.')
+    {
+      ++dots;
+
+      // There must be a number before a .
+      if (!numSet)
+      {
+        legalFormat = false;
+        break;
+      }
+
+      if (num > 255)
+      {
+        legalFormat = false;
+        break;
+      }
+
+      num = 0;
+      numSet = false;
+    }
+    else if (*s >= '0' && *s <= '9')
+    {
+      num = (num * 10) + (*s - '0');
+      numSet = true;
+    }
+    else
+    {
+      legalFormat = false;
+      break;
+    }
+
+    ++s;
+  }
+
+  if (legalFormat)
+  {
+    if (!numSet)
+    {
+      legalFormat = false;
+    }
+
+    if (num > 255 || dots != 3)
+    {
+      legalFormat = false;
+    }
+  }
+
+  if (!legalFormat)
+    CGUIDialogOK::ShowAndGetInput(257, 724, 725, 0);
+
+  return legalFormat;
+}
+
+CGUISeparatorSettingControl::CGUISeparatorSettingControl(CGUIImage *pImage, int id, CSetting *pSetting)
+    : CGUIBaseSettingControl(id, pSetting)
+{
+  m_pImage = pImage;
+  m_pImage->SetID(id);
+}
+
+CGUISeparatorSettingControl::~CGUISeparatorSettingControl()
+{}
+
diff --git a/xbmc/settings/windows/GUISettingControls.h b/xbmc/settings/windows/GUISettingControls.h
new file mode 100644 (file)
index 0000000..576cc55
--- /dev/null
@@ -0,0 +1,130 @@
+#pragma once
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "utils/StdString.h"
+
+class CGUIImage;
+class CGUISpinControlEx;
+class CGUIEditControl;
+class CGUIButtonControl;
+class CGUIRadioButtonControl;
+
+class CSetting;
+
+class CGUIBaseSettingControl
+{
+public:
+  CGUIBaseSettingControl(int id, CSetting *pSetting);
+  virtual ~CGUIBaseSettingControl() {}
+  virtual bool OnClick() { return false; };
+  virtual void Update() {};
+  int GetID() { return m_id; };
+  CSetting* GetSetting() { return m_pSetting; };
+  virtual bool NeedsUpdate() { return false; };   ///< Returns true if the control needs an update
+  virtual void Reset() {}; ///< Resets the NeedsUpdate() state
+  virtual void Clear()=0;  ///< Clears the attached control
+
+  /*!
+   \brief Specifies that this setting should update after a delay
+   Useful for settings that have options to navigate through
+   and may take a while, or require additional input to update
+   once the final setting is chosen.  Settings default to updating
+   instantly.
+   \sa IsDelayed()
+   */
+  void SetDelayed() { m_delayed = true; };
+
+  /*!
+   \brief Returns whether this setting should have delayed update
+   \return true if the setting's update should be delayed
+   \sa SetDelayed()
+   */
+  bool IsDelayed() const { return m_delayed; };
+protected:
+  int m_id;
+  CSetting* m_pSetting;
+  bool m_delayed;
+};
+
+class CGUIRadioButtonSettingControl : public CGUIBaseSettingControl
+{
+public:
+  CGUIRadioButtonSettingControl(CGUIRadioButtonControl* pRadioButton, int id, CSetting *pSetting);
+  virtual ~CGUIRadioButtonSettingControl();
+  virtual bool OnClick();
+  virtual void Update();
+  virtual void Clear() { m_pRadioButton = NULL; }
+  void Select(bool bSelect);
+private:
+  CGUIRadioButtonControl *m_pRadioButton;
+};
+
+class CGUISpinExSettingControl : public CGUIBaseSettingControl
+{
+public:
+  CGUISpinExSettingControl(CGUISpinControlEx* pSpin, int id, CSetting *pSetting);
+  virtual ~CGUISpinExSettingControl();
+  virtual bool OnClick();
+  virtual void Update();
+  virtual void Clear() { m_pSpin = NULL; }
+private:
+  CGUISpinControlEx *m_pSpin;
+};
+
+class CGUIButtonSettingControl : public CGUIBaseSettingControl
+{
+public:
+  CGUIButtonSettingControl(CGUIButtonControl* pButton, int id, CSetting *pSetting);
+  virtual ~CGUIButtonSettingControl();
+  virtual bool OnClick();
+  virtual void Update();
+  virtual void Clear() { m_pButton = NULL; }
+private:
+  CGUIButtonControl *m_pButton;
+};
+
+class CGUIEditSettingControl : public CGUIBaseSettingControl
+{
+public:
+  CGUIEditSettingControl(CGUIEditControl* pButton, int id, CSetting *pSetting);
+  virtual ~CGUIEditSettingControl();
+  virtual bool OnClick();
+  virtual void Update();
+  virtual bool NeedsUpdate() { return m_needsUpdate; };
+  virtual void Reset() { m_needsUpdate = false; };
+  virtual void Clear() { m_pEdit = NULL; }
+private:
+  bool IsValidIPAddress(const CStdString &strIP);
+  CGUIEditControl *m_pEdit;
+  bool m_needsUpdate;
+};
+
+class CGUISeparatorSettingControl : public CGUIBaseSettingControl
+{
+public:
+  CGUISeparatorSettingControl(CGUIImage* pImage, int id, CSetting *pSetting);
+  virtual ~CGUISeparatorSettingControl();
+  virtual bool OnClick() { return false; };
+  virtual void Update() {};
+  virtual void Clear() { m_pImage = NULL; }
+private:
+  CGUIImage *m_pImage;
+};
diff --git a/xbmc/settings/windows/GUIWindowSettings.cpp b/xbmc/settings/windows/GUIWindowSettings.cpp
new file mode 100644 (file)
index 0000000..2aa675f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "system.h"
+#include "GUIWindowSettings.h"
+#include "guilib/Key.h"
+
+CGUIWindowSettings::CGUIWindowSettings(void)
+    : CGUIWindow(WINDOW_SETTINGS_MENU, "Settings.xml")
+{
+  m_loadType = KEEP_IN_MEMORY;
+}
+
+CGUIWindowSettings::~CGUIWindowSettings(void)
+{
+}
diff --git a/xbmc/settings/windows/GUIWindowSettings.h b/xbmc/settings/windows/GUIWindowSettings.h
new file mode 100644 (file)
index 0000000..6030222
--- /dev/null
@@ -0,0 +1,31 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIWindow.h"
+
+class CGUIWindowSettings :
+      public CGUIWindow
+{
+public:
+  CGUIWindowSettings(void);
+  virtual ~CGUIWindowSettings(void);
+};
diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.cpp b/xbmc/settings/windows/GUIWindowSettingsCategory.cpp
new file mode 100644 (file)
index 0000000..80b5d77
--- /dev/null
@@ -0,0 +1,2954 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "system.h"
+#include "GUIUserMessages.h"
+#include "GUIWindowSettingsCategory.h"
+#include "Application.h"
+#include "ApplicationMessenger.h"
+#include "interfaces/Builtins.h"
+#include "input/KeyboardLayoutConfiguration.h"
+#include "filesystem/Directory.h"
+#include "Util.h"
+#include "guilib/GUISpinControlEx.h"
+#include "guilib/GUIRadioButtonControl.h"
+#include "guilib/GUIEditControl.h"
+#include "guilib/GUIImage.h"
+#include "utils/Weather.h"
+#include "music/MusicDatabase.h"
+#include "video/VideoDatabase.h"
+#include "view/ViewDatabase.h"
+#include "PlayListPlayer.h"
+#include "addons/Skin.h"
+#include "guilib/GUIAudioManager.h"
+#include "GUIPassword.h"
+#include "GUIInfoManager.h"
+#include "dialogs/GUIDialogGamepad.h"
+#include "dialogs/GUIDialogNumeric.h"
+#include "dialogs/GUIDialogFileBrowser.h"
+#include "addons/GUIDialogAddonSettings.h"
+#include "addons/GUIWindowAddonBrowser.h"
+#include "dialogs/GUIDialogContextMenu.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogProgress.h"
+#include "dialogs/GUIDialogKaiToast.h"
+#include "addons/Visualisation.h"
+#include "addons/AddonManager.h"
+#include "addons/AddonInstaller.h"
+#include "storage/MediaManager.h"
+#include "network/Network.h"
+#include "guilib/GUIControlGroupList.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/GUIFontManager.h"
+#include "cores/AudioEngine/AEFactory.h"
+#ifdef _LINUX
+#include "LinuxTimezone.h"
+#include <dlfcn.h>
+#ifdef HAS_HAL
+#include "HALManager.h"
+#endif
+#endif
+#if defined(TARGET_DARWIN_OSX)
+#include "osx/XBMCHelper.h"
+#endif
+#include "network/GUIDialogAccessPoints.h"
+#include "filesystem/Directory.h"
+
+#include "FileItem.h"
+#include "guilib/GUIToggleButtonControl.h"
+#include "filesystem/SpecialProtocol.h"
+
+#include "network/Zeroconf.h"
+#include "peripherals/Peripherals.h"
+#include "peripherals/dialogs/GUIDialogPeripheralManager.h"
+#include "peripherals/devices/PeripheralImon.h"
+
+#ifdef _WIN32
+#include "WIN32Util.h"
+#endif
+#include <map>
+#include "settings/Settings.h"
+#include "settings/AdvancedSettings.h"
+#include "input/MouseStat.h"
+#if defined(TARGET_WINDOWS)
+#include "input/windows/WINJoystick.h"
+#elif defined(HAS_SDL_JOYSTICK)
+#include "input/SDLJoystick.h"
+#endif
+#include "guilib/LocalizeStrings.h"
+#include "LangInfo.h"
+#include "utils/StringUtils.h"
+#include "utils/URIUtils.h"
+#include "utils/SystemInfo.h"
+#include "windowing/WindowingFactory.h"
+#include "pvr/dialogs/GUIDialogPVRChannelManager.h"
+#include "pvr/PVRManager.h"
+#include "pvr/addons/PVRClients.h"
+
+#if defined(HAVE_LIBCRYSTALHD)
+#include "cores/dvdplayer/DVDCodecs/Video/CrystalHD.h"
+#endif
+
+#if defined(HAS_AIRPLAY)
+#include "network/AirPlayServer.h"
+#endif
+
+#if defined(HAS_WEB_SERVER)
+#include "network/WebServer.h"
+#endif
+
+using namespace std;
+using namespace XFILE;
+using namespace ADDON;
+using namespace PVR;
+using namespace PERIPHERALS;
+
+#define CONTROL_GROUP_BUTTONS           0
+#define CONTROL_GROUP_SETTINGS          1
+#define CONTROL_SETTINGS_LABEL          2
+#define CATEGORY_GROUP_ID               3
+#define SETTINGS_GROUP_ID               5
+#define CONTROL_DEFAULT_BUTTON          7
+#define CONTROL_DEFAULT_RADIOBUTTON     8
+#define CONTROL_DEFAULT_SPIN            9
+#define CONTROL_DEFAULT_CATEGORY_BUTTON 10
+#define CONTROL_DEFAULT_SEPARATOR       11
+#define CONTROL_DEFAULT_EDIT            12
+#define CONTROL_START_BUTTONS           -100
+#define CONTROL_START_CONTROL           -80
+
+CGUIWindowSettingsCategory::CGUIWindowSettingsCategory(void)
+    : CGUIWindow(WINDOW_SETTINGS_MYPICTURES, "SettingsCategory.xml")
+{
+  m_loadType = KEEP_IN_MEMORY;
+  m_pOriginalSpin = NULL;
+  m_pOriginalRadioButton = NULL;
+  m_pOriginalButton = NULL;
+  m_pOriginalCategoryButton = NULL;
+  m_pOriginalImage = NULL;
+  m_pOriginalEdit = NULL;
+  // set the correct ID range...
+  m_idRange.clear();
+  m_idRange.push_back(WINDOW_SETTINGS_MYPICTURES);
+  m_idRange.push_back(WINDOW_SETTINGS_MYPROGRAMS);
+  m_idRange.push_back(WINDOW_SETTINGS_MYWEATHER);
+  m_idRange.push_back(WINDOW_SETTINGS_MYMUSIC);
+  m_idRange.push_back(WINDOW_SETTINGS_SYSTEM);
+  m_idRange.push_back(WINDOW_SETTINGS_MYVIDEOS);
+  m_idRange.push_back(WINDOW_SETTINGS_SERVICE);
+  m_idRange.push_back(WINDOW_SETTINGS_APPEARANCE);
+  m_idRange.push_back(WINDOW_SETTINGS_MYPVR);
+
+  m_iScreen = 0;
+  m_strOldTrackFormat = "";
+  m_strOldTrackFormatRight = "";
+  m_returningFromSkinLoad = false;
+  m_delayedSetting.reset();
+}
+
+CGUIWindowSettingsCategory::~CGUIWindowSettingsCategory(void)
+{
+  FreeControls();
+  delete m_pOriginalEdit;
+}
+
+bool CGUIWindowSettingsCategory::OnBack(int actionID)
+{
+  g_settings.Save();
+  m_lastControlID = 0; // don't save the control as we go to a different window each time
+  return CGUIWindow::OnBack(actionID);
+}
+
+bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
+{
+  switch (message.GetMessage())
+  {
+  case GUI_MSG_CLICKED:
+    {
+      unsigned int iControl = message.GetSenderId();
+      for (unsigned int i = 0; i < m_vecSettings.size(); i++)
+      {
+        if (m_vecSettings[i]->GetID() == (int)iControl)
+          OnClick(m_vecSettings[i]);
+      }
+    }
+    break;
+  case GUI_MSG_FOCUSED:
+    {
+      CGUIWindow::OnMessage(message);
+      int focusedControl = GetFocusedControlID();
+      if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_vecSections.size()) &&
+          focusedControl - CONTROL_START_BUTTONS != m_iSection && !m_returningFromSkinLoad)
+      {
+        // changing section, check for updates and cancel any delayed changes
+        m_delayedSetting.reset();
+        CheckForUpdates();
+
+        if (m_vecSections[focusedControl-CONTROL_START_BUTTONS]->m_strCategory == "masterlock")
+        {
+          if (!g_passwordManager.IsMasterLockUnlocked(true))
+          { // unable to go to this category - focus the previous one
+            SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iSection, 0);
+            return false;
+          }
+        }
+        if (m_vecSections[focusedControl-CONTROL_START_BUTTONS]->m_strCategory == "pvrparental")
+        {
+          if (!g_PVRManager.CheckParentalPIN(g_localizeStrings.Get(19262).c_str()))
+          { // unable to go to this category - focus the previous one
+            SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iSection, 0);
+            return false;
+          }
+        }
+
+        m_iSection = focusedControl - CONTROL_START_BUTTONS;
+
+        CreateSettings();
+      }
+      return true;
+    }
+    break;
+  case GUI_MSG_LOAD_SKIN:
+    {
+      if (IsActive())
+        m_returningFromSkinLoad = true;
+    }
+    break;
+  case GUI_MSG_WINDOW_INIT:
+    {
+      m_delayedSetting.reset();
+      if (message.GetParam1() != WINDOW_INVALID && !m_returningFromSkinLoad)
+      { // coming to this window first time (ie not returning back from some other window)
+        // so we reset our section and control states
+        m_iSection = 0;
+        ResetControlStates();
+      }
+      m_iScreen = (int)message.GetParam2() - (int)CGUIWindow::GetID();
+      CGUIWindow::OnMessage(message);
+      m_returningFromSkinLoad = false;
+      return true;
+    }
+    break;
+  case GUI_MSG_UPDATE_ITEM:
+    if (m_delayedSetting)
+    {
+      OnSettingChanged(m_delayedSetting);
+      m_delayedSetting.reset();
+      return true;
+    }
+    break;
+  case GUI_MSG_UPDATE:
+    if (HasID(message.GetSenderId()))
+    {
+      int focusedControl = GetFocusedControlID();
+      CreateSettings();
+      SET_CONTROL_FOCUS(focusedControl, 0);
+    }
+    break;
+  case GUI_MSG_NOTIFY_ALL:
+    {
+      if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE)
+      {
+        // Cancel delayed setting - it's only used for res changing anyway
+        m_delayedSetting.reset();
+        if (IsActive() && g_guiSettings.GetResolution() != g_graphicsContext.GetVideoResolution())
+        {
+          g_guiSettings.SetResolution(g_graphicsContext.GetVideoResolution());
+          CreateSettings();
+        }
+      }
+    }
+    break;
+  case GUI_MSG_WINDOW_DEINIT:
+    {
+      m_delayedSetting.reset();
+
+      CheckForUpdates();
+      CGUIWindow::OnMessage(message);
+      FreeControls();
+      return true;
+    }
+    break;
+  }
+  return CGUIWindow::OnMessage(message);
+}
+
+void CGUIWindowSettingsCategory::SetupControls()
+{
+  // cleanup first, if necessary
+  FreeControls();
+  m_pOriginalSpin = (CGUISpinControlEx*)GetControl(CONTROL_DEFAULT_SPIN);
+  m_pOriginalRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_DEFAULT_RADIOBUTTON);
+  m_pOriginalCategoryButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_CATEGORY_BUTTON);
+  m_pOriginalButton = (CGUIButtonControl *)GetControl(CONTROL_DEFAULT_BUTTON);
+  m_pOriginalImage = (CGUIImage *)GetControl(CONTROL_DEFAULT_SEPARATOR);
+  if (!m_pOriginalCategoryButton || !m_pOriginalSpin || !m_pOriginalRadioButton || !m_pOriginalButton)
+    return ;
+  m_pOriginalEdit = (CGUIEditControl *)GetControl(CONTROL_DEFAULT_EDIT);
+  if (!m_pOriginalEdit || m_pOriginalEdit->GetControlType() != CGUIControl::GUICONTROL_EDIT)
+  {
+    delete m_pOriginalEdit;
+    m_pOriginalEdit = new CGUIEditControl(*m_pOriginalButton);
+  }
+  m_pOriginalSpin->SetVisible(false);
+  m_pOriginalRadioButton->SetVisible(false);
+  m_pOriginalButton->SetVisible(false);
+  m_pOriginalCategoryButton->SetVisible(false);
+  m_pOriginalEdit->SetVisible(false);
+  if (m_pOriginalImage) m_pOriginalImage->SetVisible(false);
+  // setup our control groups...
+  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(CATEGORY_GROUP_ID);
+  if (!group)
+    return;
+  // get a list of different sections
+  CSettingsGroup *pSettingsGroup = g_guiSettings.GetGroup(m_iScreen);
+  if (!pSettingsGroup) return ;
+  // update the screen string
+  SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, pSettingsGroup->GetLabelID());
+  // get the categories we need
+  pSettingsGroup->GetCategories(m_vecSections);
+  // run through and create our buttons...
+  int j=0;
+  for (unsigned int i = 0; i < m_vecSections.size(); i++)
+  {
+    if (m_vecSections[i]->m_labelID == 12360 && !g_settings.IsMasterUser())
+      continue;
+    CGUIButtonControl *pButton = NULL;
+    if (m_pOriginalCategoryButton->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)
+      pButton = new CGUIToggleButtonControl(*(CGUIToggleButtonControl *)m_pOriginalCategoryButton);
+    else
+      pButton = new CGUIButtonControl(*m_pOriginalCategoryButton);
+    pButton->SetLabel(g_localizeStrings.Get(m_vecSections[i]->m_labelID));
+    pButton->SetID(CONTROL_START_BUTTONS + j);
+    pButton->SetVisible(true);
+    pButton->AllocResources();
+    group->AddControl(pButton);
+    j++;
+  }
+  if (m_iSection < 0 || m_iSection >= (int)m_vecSections.size())
+    m_iSection = 0;
+  CreateSettings();
+  // set focus correctly
+  m_defaultControl = CONTROL_START_BUTTONS;
+}
+
+CGUIControl* CGUIWindowSettingsCategory::AddIntBasedSpinControl(CSetting *pSetting, float groupWidth, int &iControlID)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, groupWidth, iControlID);
+  if (!pSettingInt->m_entries.empty())
+  {
+    for (map<int,int>::iterator it=pSettingInt->m_entries.begin(); it != pSettingInt->m_entries.end();++it)
+      pControl->AddLabel(g_localizeStrings.Get(it->first), it->second);
+    pControl->SetValue(pSettingInt->GetData());
+  }
+  return pControl;
+}
+
+void CGUIWindowSettingsCategory::CreateSettings()
+{
+  FreeSettingsControls();
+
+  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
+  if (!group)
+    return;
+  vecSettings settings;
+  g_guiSettings.GetSettingsGroup(m_vecSections[m_iSection], settings);
+  int iControlID = CONTROL_START_CONTROL;
+  for (unsigned int i = 0; i < settings.size(); i++)
+  {
+    CSetting *pSetting = settings[i];
+    CStdString strSetting = pSetting->GetSetting();
+    if (pSetting->GetType() == SETTINGS_TYPE_INT)
+    {
+      CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddIntBasedSpinControl(pSetting, group->GetWidth(), iControlID);
+      CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+      if (strSetting.Equals("videoplayer.pauseafterrefreshchange"))
+      {
+        pControl->AddLabel(g_localizeStrings.Get(13551), 0);
+
+        for (int i = 1; i <= MAXREFRESHCHANGEDELAY; i++)
+        {
+          CStdString delayText;
+          delayText.Format(g_localizeStrings.Get(13553).c_str(), (double)i / 10.0);
+          pControl->AddLabel(delayText, i);
+        }
+        pControl->SetValue(pSettingInt->GetData());
+      }
+      else if (strSetting.Equals("subtitles.color"))
+      {
+        for (int i = SUBTITLE_COLOR_START; i <= SUBTITLE_COLOR_END; i++)
+          pControl->AddLabel(g_localizeStrings.Get(760 + i), i);
+        pControl->SetValue(pSettingInt->GetData());
+      }
+      else if (strSetting.Equals("lookandfeel.startupwindow"))
+        FillInStartupWindow(pSetting);
+      else if (strSetting.Equals("subtitles.height") || strSetting.Equals("karaoke.fontheight") )
+        FillInSubtitleHeights(pSetting, pControl);
+      else if (strSetting.Equals("videoscreen.screen"))
+        FillInScreens(strSetting, g_guiSettings.GetResolution());
+      else if (strSetting.Equals("videoscreen.resolution"))
+        FillInResolutions(strSetting, g_guiSettings.GetInt("videoscreen.screen"), g_guiSettings.GetResolution(), false);
+      else if (strSetting.Equals("epg.defaultguideview"))
+        FillInEpgGuideView(pSetting);
+      else if (strSetting.Equals("pvrplayback.startlast"))
+        FillInPvrStartLastChannel(pSetting);
+      continue;
+    }
+#ifdef HAS_WEB_SERVER
+    else if (strSetting.Equals("services.webserverport"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      BaseSettingControlPtr control = GetSetting(pSetting->GetSetting());
+      control->SetDelayed();
+      continue;
+    }
+#endif
+    else if (strSetting.Equals("services.esport"))
+    {
+#ifdef HAS_EVENT_SERVER
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      BaseSettingControlPtr control = GetSetting(pSetting->GetSetting());
+      control->SetDelayed();
+      continue;
+#endif
+    }
+    else if (strSetting.Equals("network.httpproxyport"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      BaseSettingControlPtr control = GetSetting(pSetting->GetSetting());
+      control->SetDelayed();
+      continue;
+    }
+    else if (strSetting.Equals("subtitles.font") || strSetting.Equals("karaoke.font") )
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInSubtitleFonts(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("subtitles.charset") || strSetting.Equals("locale.charset") || strSetting.Equals("karaoke.charset"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInCharSets(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("lookandfeel.font"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInSkinFonts(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("lookandfeel.soundskin"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInSoundSkins(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("locale.language"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      GetSetting(pSetting->GetSetting())->SetDelayed();
+      FillInLanguages(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("locale.audiolanguage") || strSetting.Equals("locale.subtitlelanguage"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      vector<CStdString> languages;
+      languages.push_back(g_localizeStrings.Get(308));
+      languages.push_back(g_localizeStrings.Get(309));
+      vector<CStdString> languageKeys;
+      languageKeys.push_back("original");
+      languageKeys.push_back("default");
+      FillInLanguages(pSetting, languages, languageKeys);
+      continue;
+    }
+#ifdef _LINUX
+    else if (strSetting.Equals("locale.timezonecountry"))
+    {
+      CStdString myTimezoneCountry = g_guiSettings.GetString("locale.timezonecountry");
+      int myTimezeoneCountryIndex = 0;
+
+      CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, group->GetWidth(), iControlID);
+      vector<CStdString> countries = g_timezone.GetCounties();
+      for (unsigned int i=0; i < countries.size(); i++)
+      {
+        if (countries[i] == myTimezoneCountry)
+           myTimezeoneCountryIndex = i;
+        pControl->AddLabel(countries[i], i);
+      }
+      pControl->SetValue(myTimezeoneCountryIndex);
+      continue;
+    }
+    else if (strSetting.Equals("locale.timezone"))
+    {
+      CStdString myTimezoneCountry = g_guiSettings.GetString("locale.timezonecountry");
+      CStdString myTimezone = g_guiSettings.GetString("locale.timezone");
+      int myTimezoneIndex = 0;
+
+      CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, group->GetWidth(), iControlID);
+      pControl->Clear();
+      vector<CStdString> timezones = g_timezone.GetTimezonesByCountry(myTimezoneCountry);
+      for (unsigned int i=0; i < timezones.size(); i++)
+      {
+        if (timezones[i] == myTimezone)
+           myTimezoneIndex = i;
+        pControl->AddLabel(timezones[i], i);
+      }
+      pControl->SetValue(myTimezoneIndex);
+      continue;
+    }
+#endif
+    else if (strSetting.Equals("videoscreen.screenmode"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInRefreshRates(strSetting, g_guiSettings.GetResolution(), false);
+      continue;
+    }
+    else if (strSetting.Equals("lookandfeel.skintheme"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInSkinThemes(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("lookandfeel.skincolors"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInSkinColors(pSetting);
+      continue;
+    }
+    /*
+    FIXME: setting is hidden in GUI because not supported properly.
+    else if (strSetting.Equals("videoplayer.displayresolution") || strSetting.Equals("pictures.displayresolution"))
+    {
+      FillInResolutions(pSetting);
+    }
+    */
+    else if (strSetting.Equals("locale.country"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInRegions(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("network.interface"))
+    {
+      FillInNetworkInterfaces(pSetting, group->GetWidth(), iControlID);
+      continue;
+    }
+    else if (strSetting.Equals("audiooutput.audiodevice"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInAudioDevices(pSetting);
+      continue;
+    }
+    else if (strSetting.Equals("audiooutput.passthroughdevice"))
+    {
+      AddSetting(pSetting, group->GetWidth(), iControlID);
+      FillInAudioDevices(pSetting,true);
+      continue;
+    }
+    AddSetting(pSetting, group->GetWidth(), iControlID);
+  }
+
+  if (m_vecSections[m_iSection]->m_strCategory == "network")
+     NetworkInterfaceChanged();
+
+  // update our settings (turns controls on/off as appropriate)
+  UpdateSettings();
+}
+
+void CGUIWindowSettingsCategory::UpdateSettings()
+{
+  for (unsigned int i = 0; i < m_vecSettings.size(); i++)
+  {
+    BaseSettingControlPtr pSettingControl = m_vecSettings[i];
+    pSettingControl->Update();
+    CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
+#ifdef HAVE_LIBVDPAU
+    if (strSetting.Equals("videoplayer.vdpauUpscalingLevel"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+      {
+        pControl->SetEnabled(true);
+      }
+    }
+    else
+#endif
+    if (strSetting.Equals("videoscreen.resolution"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+        pControl->SetEnabled(g_guiSettings.GetInt("videoscreen.screen") != DM_WINDOWED);
+    }
+    else if (strSetting.Equals("videoscreen.screenmode"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+        pControl->SetEnabled(g_guiSettings.GetInt("videoscreen.screen") != DM_WINDOWED);
+    }
+    else if (strSetting.Equals("videoscreen.fakefullscreen"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+        pControl->SetEnabled(g_guiSettings.GetInt("videoscreen.screen") != DM_WINDOWED);
+    }
+#if defined(TARGET_DARWIN_OSX) || defined(_WIN32)
+    else if (strSetting.Equals("videoscreen.blankdisplays"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+      {
+        if (g_Windowing.IsFullScreen())
+          pControl->SetEnabled(true);
+        else
+          pControl->SetEnabled(false);
+      }
+    }
+#endif
+#if defined(TARGET_DARWIN_OSX)
+    else if (strSetting.Equals("input.appleremotemode"))
+    {
+      int remoteMode = g_guiSettings.GetInt("input.appleremotemode");
+
+      // if it's not disabled, start the event server or else apple remote won't work
+      if ( remoteMode != APPLE_REMOTE_DISABLED )
+      {
+        g_guiSettings.SetBool("services.esenabled", true);
+        if (!g_application.StartEventServer())
+          CGUIDialogKaiToast::QueueNotification("DefaultIconWarning.png", g_localizeStrings.Get(33102), g_localizeStrings.Get(33100));
+      }
+
+      // if XBMC helper is running, prompt user before effecting change
+      if ( XBMCHelper::GetInstance().IsRunning() && XBMCHelper::GetInstance().GetMode()!=remoteMode )
+      {
+        bool cancelled;
+        if (!CGUIDialogYesNo::ShowAndGetInput(13144, 13145, 13146, 13147, -1, -1, cancelled, 10000))
+        {
+          // user declined, restore previous spinner state and appleremote mode
+          CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+          g_guiSettings.SetInt("input.appleremotemode", XBMCHelper::GetInstance().GetMode());
+          pControl->SetValue(XBMCHelper::GetInstance().GetMode());
+        }
+        else
+        {
+          // reload configuration
+          XBMCHelper::GetInstance().Configure();
+        }
+      }
+      else
+      {
+        // set new configuration.
+        XBMCHelper::GetInstance().Configure();
+      }
+
+      if (XBMCHelper::GetInstance().ErrorStarting() == true)
+      {
+        // inform user about error
+        CGUIDialogOK::ShowAndGetInput(13620, 13621, 20022, 20022);
+
+        // reset spinner to disabled state
+        CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+        pControl->SetValue(APPLE_REMOTE_DISABLED);
+      }
+    }
+    else if (strSetting.Equals("input.appleremotealwayson"))
+     {
+       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+       if (pControl)
+       {
+         int value = g_guiSettings.GetInt("input.appleremotemode");
+         if (value != APPLE_REMOTE_DISABLED)
+           pControl->SetEnabled(true);
+         else
+           pControl->SetEnabled(false);
+       }
+     }
+     else if (strSetting.Equals("input.appleremotesequencetime"))
+     {
+       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+       if (pControl)
+       {
+         int value = g_guiSettings.GetInt("input.appleremotemode");
+         if (value == APPLE_REMOTE_UNIVERSAL)
+           pControl->SetEnabled(true);
+         else
+           pControl->SetEnabled(false);
+       }
+     }
+#endif
+    else if (strSetting.Equals("filelists.allowfiledeletion"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(!g_settings.GetCurrentProfile().filesLocked() || g_passwordManager.bMasterUser);
+    }
+    else if (strSetting.Equals("filelists.showaddsourcebuttons"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_settings.GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser);
+    }
+    else if (strSetting.Equals("masterlock.startuplock"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_settings.GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE);
+    }
+    else if (strSetting.Equals("pvrmanager.channelscan"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("pvrmanager.enabled") && g_PVRClients && g_PVRClients->GetClientsSupportingChannelScan().size() > 0);
+    }
+    else if (strSetting.Equals("pvrmanager.channelmanager") || strSetting.Equals("pvrmenu.searchicons"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("pvrmanager.enabled"));
+    }
+    else if (!strSetting.Equals("pvrparental.enabled") &&
+        (strSetting.Equals("pvrparental.pin") || strSetting.Equals("pvrparental.duration")))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("pvrparental.enabled"));
+    }
+    else if (!strSetting.Equals("services.esenabled")
+             && strSetting.Left(11).Equals("services.es"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("services.esenabled"));
+    }
+    else if (strSetting.Equals("services.upnpannounce"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      pControl->SetEnabled(g_guiSettings.GetBool("services.upnpserver"));
+    }
+    else if (strSetting.Equals("audiocds.quality"))
+    { // only visible if we are doing non-WAV ripping
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_WAV &&
+                                         g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_FLAC);
+    }
+    else if (strSetting.Equals("audiocds.bitrate"))
+    { // only visible if we are ripping to CBR
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_WAV &&
+                                         g_guiSettings.GetInt("audiocds.encoder") != CDDARIP_ENCODER_FLAC &&
+                                         g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_CBR);
+    }
+    else if (strSetting.Equals("audiocds.compressionlevel"))
+    { // only visible if we are doing FLAC ripping
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("audiocds.encoder") == CDDARIP_ENCODER_FLAC);
+    }
+    else if (
+             strSetting.Equals("audiooutput.passthroughdevice") ||
+             strSetting.Equals("audiooutput.ac3passthrough") ||
+             strSetting.Equals("audiooutput.dtspassthrough") ||
+             strSetting.Equals("audiooutput.passthroughaac"))
+    { // only visible if we are in digital mode
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")));
+    }
+    else if (
+             strSetting.Equals("audiooutput.multichannellpcm" ) ||
+             strSetting.Equals("audiooutput.truehdpassthrough") ||
+             strSetting.Equals("audiooutput.dtshdpassthrough" ))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+      {
+        if (strSetting.Equals("audiooutput.dtshdpassthrough") && !g_guiSettings.GetBool("audiooutput.dtspassthrough"))
+          pControl->SetEnabled(false);
+        else
+          pControl->SetEnabled(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI);
+      }
+    }
+    else if (strSetting.Equals("musicplayer.crossfadealbumtracks"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("musicplayer.crossfade") > 0);
+    }
+#ifdef HAS_WEB_SERVER
+    else if (strSetting.Equals("services.webserverusername") ||
+             strSetting.Equals("services.webserverpassword"))
+    {
+      CGUIEditControl *pControl = (CGUIEditControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+        pControl->SetEnabled(g_guiSettings.GetBool("services.webserver"));
+    }
+#endif
+#ifdef HAS_AIRPLAY
+    else if ( strSetting.Equals("services.airplaypassword") ||
+              strSetting.Equals("services.useairplaypassword"))
+    {
+      if (strSetting.Equals("services.airplaypassword"))
+      {
+        CGUIEditControl *pControl = (CGUIEditControl *)GetControl(pSettingControl->GetID());
+        if (pControl)
+          pControl->SetEnabled(g_guiSettings.GetBool("services.useairplaypassword"));
+      }
+      else//useairplaypassword
+      {
+        CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(pSettingControl->GetID());
+        if (pControl)
+          pControl->SetEnabled(g_guiSettings.GetBool("services.airplay"));
+      }
+
+      //set credentials to airplay server
+      if (g_guiSettings.GetBool("services.airplay"))
+      {
+        CStdString password = g_guiSettings.GetString("services.airplaypassword");
+        CAirPlayServer::SetCredentials(g_guiSettings.GetBool("services.useairplaypassword"),
+                                       password);
+      }
+    }
+#endif//HAS_AIRPLAY
+    else if (strSetting.Equals("network.ipaddress") || strSetting.Equals("network.subnet") || strSetting.Equals("network.gateway") || strSetting.Equals("network.dns"))
+    {
+#ifdef _LINUX
+      bool enabled = (geteuid() == 0);
+#else
+      bool enabled = false;
+#endif
+      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
+      if (pControl1)
+         enabled = (pControl1->GetValue() == NETWORK_STATIC);
+
+       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+       if (pControl) pControl->SetEnabled(enabled);
+    }
+    else if (strSetting.Equals("network.assignment"))
+    {
+      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
+#ifdef HAS_LINUX_NETWORK
+      if (pControl1)
+         pControl1->SetEnabled(geteuid() == 0);
+#endif
+    }
+    else if (strSetting.Equals("network.essid") || strSetting.Equals("network.enc") || strSetting.Equals("network.key"))
+    {
+      // Get network information
+      CGUISpinControlEx *ifaceControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
+      CStdString ifaceName = ifaceControl->GetLabel();
+      CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
+      bool bIsWireless = iface->IsWireless();
+
+#ifdef HAS_LINUX_NETWORK
+      bool enabled = bIsWireless && (geteuid() == 0);
+#else
+      bool enabled = bIsWireless;
+#endif
+      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
+      if (pControl1)
+         enabled &= (pControl1->GetValue() != NETWORK_DISABLED);
+
+      if (strSetting.Equals("network.key"))
+      {
+         pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
+         if (pControl1) enabled &= (pControl1->GetValue() != ENC_NONE);
+      }
+
+       CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+       if (pControl) pControl->SetEnabled(enabled);
+    }
+    else if (strSetting.Equals("network.httpproxyserver")   || strSetting.Equals("network.httpproxyport") ||
+             strSetting.Equals("network.httpproxyusername") || strSetting.Equals("network.httpproxypassword") ||
+             strSetting.Equals("network.httpproxytype"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("network.usehttpproxy"));
+    }
+#ifdef HAS_LINUX_NETWORK
+    else if (strSetting.Equals("network.key"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
+      if (pControl && pControl1)
+         pControl->SetEnabled(!pControl1->IsDisabled() && pControl1->GetValue() > 0);
+    }
+    else if (strSetting.Equals("network.save"))
+    {
+      CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(pSettingControl->GetID());
+      pControl->SetEnabled(geteuid() == 0);
+    }
+#endif
+    else if (strSetting.Equals("subtitles.color") || strSetting.Equals("subtitles.style") || strSetting.Equals("subtitles.charset"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID());
+      pControl->SetEnabled(CUtil::IsUsingTTFSubtitles());
+    }
+    else if (strSetting.Equals("locale.charset"))
+    { // TODO: Determine whether we are using a TTF font or not.
+      //   CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      //   if (pControl) pControl->SetEnabled(g_guiSettings.GetString("lookandfeel.font").Right(4) == ".ttf");
+    }
+    else if (strSetting.Equals("screensaver.settings"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      AddonPtr addon;
+      if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
+        pControl->SetEnabled(addon->HasSettings());
+      else
+        pControl->SetEnabled(false);
+    }
+    else if (strSetting.Equals("screensaver.preview")           ||
+             strSetting.Equals("screensaver.time")              ||
+             strSetting.Equals("screensaver.usedimonpause")     ||
+             strSetting.Equals("screensaver.usemusicvisinstead"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(GetSetting(strSetting)->GetID());
+      pControl->SetEnabled(!g_guiSettings.GetString("screensaver.mode").IsEmpty());
+      if (strSetting.Equals("screensaver.usedimonpause") && g_guiSettings.GetString("screensaver.mode").Equals("screensaver.xbmc.builtin.dim"))
+        pControl->SetEnabled(false);
+    }
+    else if (strSetting.Equals("musicfiles.trackformat"))
+    {
+      if (m_strOldTrackFormat != g_guiSettings.GetString("musicfiles.trackformat"))
+      {
+        CUtil::DeleteMusicDatabaseDirectoryCache();
+        m_strOldTrackFormat = g_guiSettings.GetString("musicfiles.trackformat");
+      }
+    }
+    else if (strSetting.Equals("musicfiles.trackformatright"))
+    {
+      if (m_strOldTrackFormatRight != g_guiSettings.GetString("musicfiles.trackformatright"))
+      {
+        CUtil::DeleteMusicDatabaseDirectoryCache();
+        m_strOldTrackFormatRight = g_guiSettings.GetString("musicfiles.trackformatright");
+      }
+    }
+    else if (strSetting.Equals("audiocds.recordingpath") || strSetting.Equals("debug.screenshotpath"))
+    {
+      CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(pSettingControl->GetID());
+      if (pControl && g_guiSettings.GetString(strSetting, false).IsEmpty())
+        pControl->SetLabel2("");
+    }
+    else if (strSetting.Equals("lookandfeel.rssedit"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      pControl->SetEnabled(g_guiSettings.GetBool("lookandfeel.enablerssfeeds"));
+    }
+    else if (strSetting.Equals("lookandfeel.skinsettings"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      pControl->SetEnabled(g_SkinInfo->HasSkinFile("SkinSettings.xml"));
+    }
+    else if (strSetting.Equals("videoplayer.pauseafterrefreshchange"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF);
+    }
+    else if (strSetting.Equals("videoplayer.synctype"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl) pControl->SetEnabled(g_guiSettings.GetBool("videoplayer.usedisplayasclock"));
+    }
+    else if (strSetting.Equals("videoplayer.maxspeedadjust"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+      {
+        bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) &&
+            (g_guiSettings.GetInt("videoplayer.synctype") == SYNC_RESAMPLE);
+        pControl->SetEnabled(enabled);
+      }
+    }
+    else if (strSetting.Equals("videoplayer.resamplequality"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+      {
+        bool enabled = (g_guiSettings.GetBool("videoplayer.usedisplayasclock")) &&
+            (g_guiSettings.GetInt("videoplayer.synctype") == SYNC_RESAMPLE);
+        pControl->SetEnabled(enabled);
+      }
+    }
+    else if (strSetting.Equals("weather.addonsettings"))
+    {
+      AddonPtr addon;
+      if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("weather.addon"), addon, ADDON_SCRIPT_WEATHER))
+      {
+        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+        if (pControl)
+          pControl->SetEnabled(addon->HasSettings());
+      }
+    }
+    else if (strSetting.Equals("input.peripherals"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+        pControl->SetEnabled(g_peripherals.GetNumberOfPeripherals() > 0);
+    }
+    else if (strSetting.Equals("input.enablejoystick"))
+    {
+      CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+      if (pControl)
+        pControl->SetEnabled(CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0);
+    }
+  }
+
+  g_guiSettings.SetChanged();
+  g_guiSettings.NotifyObservers(ObservableMessageGuiSettings);
+}
+
+void CGUIWindowSettingsCategory::OnClick(BaseSettingControlPtr pSettingControl)
+{
+  CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
+  if (strSetting.Equals("weather.addonsettings"))
+  {
+    CStdString name = g_guiSettings.GetString("weather.addon");
+    AddonPtr addon;
+    if (CAddonMgr::Get().GetAddon(name, addon, ADDON_SCRIPT_WEATHER))
+    { // TODO: maybe have ShowAndGetInput return a bool if settings changed, then only reset weather if true.
+      CGUIDialogAddonSettings::ShowAndGetInput(addon);
+      g_weatherManager.Refresh();
+    }
+  }
+  else if (strSetting.Equals("lookandfeel.rssedit"))
+  {
+    AddonPtr addon;
+    CAddonMgr::Get().GetAddon("script.rss.editor",addon);
+    if (!addon)
+    {
+      if (!CGUIDialogYesNo::ShowAndGetInput(g_localizeStrings.Get(24076), g_localizeStrings.Get(24100),"RSS Editor",g_localizeStrings.Get(24101)))
+        return;
+      CAddonInstaller::Get().Install("script.rss.editor", true, "", false);
+    }
+    CBuiltins::Execute("RunScript(script.rss.editor)");
+  }
+  else if (pSettingControl->GetSetting()->GetType() == SETTINGS_TYPE_ADDON)
+  { // prompt for the addon
+    CSettingAddon *setting = (CSettingAddon *)pSettingControl->GetSetting();
+    CStdString addonID = setting->GetData();
+    if (CGUIWindowAddonBrowser::SelectAddonID(setting->m_type, addonID, setting->m_type == ADDON_SCREENSAVER || setting->m_type == ADDON_VIZ || setting->m_type == ADDON_SCRIPT_WEATHER) == 1)
+      setting->SetData(addonID);
+    else
+      return;
+  }
+  else if (strSetting.Equals("input.peripherals"))
+  {
+    CGUIDialogPeripheralManager *dialog = (CGUIDialogPeripheralManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_MANAGER);
+    if (dialog)
+      dialog->DoModal();
+    // refresh settings
+    UpdateSettings();
+    return;
+  }
+
+  // if OnClick() returns false, the setting hasn't changed or doesn't
+  // require immediate update
+  if (!pSettingControl->OnClick())
+  {
+    UpdateSettings();
+    if (!pSettingControl->IsDelayed())
+      return;
+  }
+
+  if (pSettingControl->IsDelayed())
+  { // delayed setting
+    m_delayedSetting = pSettingControl;
+    m_delayedTimer.StartZero();
+  }
+  else
+    OnSettingChanged(pSettingControl);
+}
+
+void CGUIWindowSettingsCategory::CheckForUpdates()
+{
+  for (unsigned int i = 0; i < m_vecSettings.size(); i++)
+  {
+    BaseSettingControlPtr pSettingControl = m_vecSettings[i];
+    if (pSettingControl->NeedsUpdate())
+    {
+      OnSettingChanged(pSettingControl);
+      pSettingControl->Reset();
+    }
+  }
+}
+
+void CGUIWindowSettingsCategory::OnSettingChanged(BaseSettingControlPtr pSettingControl)
+{
+  CStdString strSetting = pSettingControl->GetSetting()->GetSetting();
+
+  // ok, now check the various special things we need to do
+  if (pSettingControl->GetSetting()->GetType() == SETTINGS_TYPE_ADDON)
+  {
+    CSettingAddon *pSettingAddon = (CSettingAddon*)pSettingControl->GetSetting();
+    if (pSettingAddon->m_type == ADDON_SKIN)
+    {
+      g_application.ReloadSkin();
+    }
+    else if (pSettingAddon->m_type == ADDON_SCRIPT_WEATHER)
+    {
+      g_weatherManager.Refresh();
+    }
+  }
+  else if (strSetting.Equals("musicplayer.visualisation"))
+  { // new visualisation choosen...
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    if (pControl->GetValue() == 0)
+      pSettingString->SetData("None");
+    else
+      pSettingString->SetData(pControl->GetCurrentLabel());
+  }
+  else if (strSetting.Equals("debug.showloginfo"))
+  {
+    g_advancedSettings.SetDebugMode(g_guiSettings.GetBool("debug.showloginfo"));
+  }
+  /*else if (strSetting.Equals("musicfiles.repeat"))
+  {
+    g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC_TEMP, g_guiSettings.GetBool("musicfiles.repeat") ? PLAYLIST::REPEAT_ALL : PLAYLIST::REPEAT_NONE);
+  }*/
+  else if (strSetting.Equals("musiclibrary.cleanup"))
+  {
+    CMusicDatabase musicdatabase;
+    musicdatabase.Clean();
+    CUtil::DeleteMusicDatabaseDirectoryCache();
+  }
+  else if (strSetting.Equals("videolibrary.cleanup"))
+  {
+    if (CGUIDialogYesNo::ShowAndGetInput(313, 333, 0, 0))
+      g_application.StartVideoCleanup();
+  }
+  else if (strSetting.Equals("videolibrary.export"))
+    CBuiltins::Execute("exportlibrary(video)");
+  else if (strSetting.Equals("musiclibrary.export"))
+    CBuiltins::Execute("exportlibrary(music)");
+  else if (strSetting.Equals("karaoke.export") )
+  {
+    CContextButtons choices;
+    choices.Add(1, g_localizeStrings.Get(22034));
+    choices.Add(2, g_localizeStrings.Get(22035));
+
+    int retVal = CGUIDialogContextMenu::ShowAndGetChoice(choices);
+    if ( retVal > 0 )
+    {
+      CStdString path(g_settings.GetDatabaseFolder());
+      VECSOURCES shares;
+      g_mediaManager.GetLocalDrives(shares);
+      if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(661), path, true))
+      {
+        CMusicDatabase musicdatabase;
+        musicdatabase.Open();
+
+        if ( retVal == 1 )
+        {
+          URIUtils::AddFileToFolder(path, "karaoke.html", path);
+          musicdatabase.ExportKaraokeInfo( path, true );
+        }
+        else
+        {
+          URIUtils::AddFileToFolder(path, "karaoke.csv", path);
+          musicdatabase.ExportKaraokeInfo( path, false );
+        }
+        musicdatabase.Close();
+      }
+    }
+  }
+  else if (strSetting.Equals("videolibrary.import"))
+  {
+    CStdString path;
+    VECSOURCES shares;
+    g_mediaManager.GetLocalDrives(shares);
+    if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(651) , path))
+    {
+      CVideoDatabase videodatabase;
+      videodatabase.Open();
+      videodatabase.ImportFromXML(path);
+      videodatabase.Close();
+    }
+  }
+  else if (strSetting.Equals("musiclibrary.import"))
+  {
+    CStdString path;
+    VECSOURCES shares;
+    g_mediaManager.GetLocalDrives(shares);
+    if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "musicdb.xml", g_localizeStrings.Get(651) , path))
+    {
+      CMusicDatabase musicdatabase;
+      musicdatabase.Open();
+      musicdatabase.ImportFromXML(path);
+      musicdatabase.Close();
+    }
+  }
+  else if (strSetting.Equals("karaoke.importcsv"))
+  {
+    CStdString path(g_settings.GetDatabaseFolder());
+    VECSOURCES shares;
+    g_mediaManager.GetLocalDrives(shares);
+    if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "karaoke.csv", g_localizeStrings.Get(651) , path))
+    {
+      CMusicDatabase musicdatabase;
+      musicdatabase.Open();
+      musicdatabase.ImportKaraokeInfo(path);
+      musicdatabase.Close();
+    }
+  }
+  else if (strSetting.Left(22).Equals("MusicPlayer.ReplayGain"))
+  { // Update our replaygain settings
+    g_guiSettings.m_replayGain.iType = g_guiSettings.GetInt("musicplayer.replaygaintype");
+    g_guiSettings.m_replayGain.iPreAmp = g_guiSettings.GetInt("musicplayer.replaygainpreamp");
+    g_guiSettings.m_replayGain.iNoGainPreAmp = g_guiSettings.GetInt("musicplayer.replaygainnogainpreamp");
+    g_guiSettings.m_replayGain.bAvoidClipping = g_guiSettings.GetBool("musicplayer.replaygainavoidclipping");
+  }
+#ifdef HAS_WEB_SERVER
+  else if ( strSetting.Equals("services.webserver") || strSetting.Equals("services.webserverport"))
+  {
+    if (strSetting.Equals("services.webserverport"))
+      ValidatePortNumber(pSettingControl, "8080", "80");
+    g_application.StopWebServer();
+    if (g_guiSettings.GetBool("services.webserver"))
+      if (!g_application.StartWebServer())
+      {
+        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33101), "", g_localizeStrings.Get(33100), "");
+        g_guiSettings.SetBool("services.webserver", false);
+      }
+  }
+  else if (strSetting.Equals("services.webserverusername") || strSetting.Equals("services.webserverpassword"))
+  {
+    g_application.m_WebServer.SetCredentials(g_guiSettings.GetString("services.webserverusername"), g_guiSettings.GetString("services.webserverpassword"));
+  }
+#endif
+  else if (strSetting.Equals("services.zeroconf"))
+  {
+#ifdef HAS_ZEROCONF
+    //ifdef zeroconf here because it's only found in guisettings if defined
+    if(g_guiSettings.GetBool("services.zeroconf"))
+    {
+      CZeroconf::GetInstance()->Stop();
+      CZeroconf::GetInstance()->Start();
+    }
+#ifdef HAS_AIRPLAY
+    else
+    {
+      g_application.StopAirplayServer(true);
+      g_guiSettings.SetBool("services.airplay", false);
+      CZeroconf::GetInstance()->Stop();
+    }
+#endif
+#endif
+  }
+  else if (strSetting.Equals("services.airplay"))
+  {
+#ifdef HAS_AIRPLAY
+    if (g_guiSettings.GetBool("services.airplay"))
+    {
+#ifdef HAS_ZEROCONF
+      // AirPlay needs zeroconf
+      if(!g_guiSettings.GetBool("services.zeroconf"))
+      {
+        g_guiSettings.SetBool("services.zeroconf", true);
+        CZeroconf::GetInstance()->Stop();
+        CZeroconf::GetInstance()->Start();
+      }
+#endif //HAS_ZEROCONF
+      g_application.StartAirplayServer();//will stop the server before internal
+    }
+    else
+      g_application.StopAirplayServer(true);//will stop the server before internal
+#endif//HAS_AIRPLAY
+  }
+  else if (strSetting.Equals("network.ipaddress"))
+  {
+    if (g_guiSettings.GetInt("network.assignment") == NETWORK_STATIC)
+    {
+      CStdString strDefault = g_guiSettings.GetString("network.ipaddress").Left(g_guiSettings.GetString("network.ipaddress").ReverseFind('.'))+".1";
+      if (g_guiSettings.GetString("network.gateway").Equals("0.0.0.0"))
+        g_guiSettings.SetString("network.gateway",strDefault);
+      if (g_guiSettings.GetString("network.dns").Equals("0.0.0.0"))
+        g_guiSettings.SetString("network.dns",strDefault);
+
+    }
+  }
+
+  else if (strSetting.Equals("network.httpproxyport"))
+  {
+    ValidatePortNumber(pSettingControl, "8080", "8080", false);
+  }
+  else if (strSetting.Equals("videoplayer.calibrate") || strSetting.Equals("videoscreen.guicalibration"))
+  { // activate the video calibration screen
+    g_windowManager.ActivateWindow(WINDOW_SCREEN_CALIBRATION);
+  }
+  else if (strSetting.Equals("videoscreen.testpattern"))
+  { // activate the test pattern
+    g_windowManager.ActivateWindow(WINDOW_TEST_PATTERN);
+  }
+  else if (strSetting.Equals("subtitles.height"))
+  {
+    if (!CUtil::IsUsingTTFSubtitles())
+    {
+      CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+      ((CSettingInt *)pSettingControl->GetSetting())->FromString(pControl->GetCurrentLabel());
+    }
+  }
+  else if (strSetting.Equals("subtitles.font"))
+  {
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    pSettingString->SetData(pControl->GetCurrentLabel());
+    CSetting *pSetting = (CSetting *)g_guiSettings.GetSetting("subtitles.height");
+    FillInSubtitleHeights(pSetting, (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID()));
+  }
+  else if (strSetting.Equals("subtitles.charset"))
+  {
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    CStdString newCharset="DEFAULT";
+    if (pControl->GetValue()!=0)
+     newCharset = g_charsetConverter.getCharsetNameByLabel(pControl->GetCurrentLabel());
+    if (newCharset != "" && (newCharset != pSettingString->GetData() || newCharset=="DEFAULT"))
+    {
+      pSettingString->SetData(newCharset);
+      g_charsetConverter.reset();
+    }
+  }
+  else if (strSetting.Equals("karaoke.fontheight"))
+  {
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    ((CSettingInt *)pSettingControl->GetSetting())->FromString(pControl->GetCurrentLabel());
+  }
+  else if (strSetting.Equals("karaoke.font"))
+  {
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    pSettingString->SetData(pControl->GetCurrentLabel());
+    CSetting *pSetting = (CSetting *)g_guiSettings.GetSetting("karaoke.fontheight");
+    FillInSubtitleHeights(pSetting, (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID()));
+  }
+  else if (strSetting.Equals("karaoke.charset"))
+  {
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    CStdString newCharset="DEFAULT";
+    if (pControl->GetValue()!=0)
+      newCharset = g_charsetConverter.getCharsetNameByLabel(pControl->GetCurrentLabel());
+    if (newCharset != "" && (newCharset != pSettingString->GetData() || newCharset=="DEFAULT"))
+    {
+      pSettingString->SetData(newCharset);
+      g_charsetConverter.reset();
+    }
+  }
+  else if (strSetting.Equals("locale.charset"))
+  {
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    CStdString newCharset="DEFAULT";
+    if (pControl->GetValue()!=0)
+     newCharset = g_charsetConverter.getCharsetNameByLabel(pControl->GetCurrentLabel());
+    if (newCharset != "" && (newCharset != pSettingString->GetData() || newCharset=="DEFAULT"))
+    {
+      pSettingString->SetData(newCharset);
+      g_charsetConverter.reset();
+    }
+  }
+  else if (strSetting.Equals("lookandfeel.font"))
+  { // new font choosen...
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    CStdString strSkinFontSet = m_SkinFontSetIDs[pControl->GetCurrentLabel()];
+    if (strSkinFontSet != ".svn" && strSkinFontSet != g_guiSettings.GetString("lookandfeel.font"))
+    {
+      g_guiSettings.SetString("lookandfeel.font", strSkinFontSet);
+      g_application.ReloadSkin();
+    }
+  }
+  else if (strSetting.Equals("lookandfeel.soundskin"))
+  { // new sound skin choosen...
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    if (pControl->GetValue()==0)
+      g_guiSettings.SetString("lookandfeel.soundskin", "OFF");
+    else if (pControl->GetValue()==1)
+      g_guiSettings.SetString("lookandfeel.soundskin", "SKINDEFAULT");
+    else
+      g_guiSettings.SetString("lookandfeel.soundskin", pControl->GetCurrentLabel());
+
+    g_audioManager.Enable(true);
+    g_audioManager.Load();
+  }
+  else if (strSetting.Equals("lookandfeel.skinsettings"))
+  {
+    g_windowManager.ActivateWindow(WINDOW_SKIN_SETTINGS);
+  }
+  else if (strSetting.Equals("input.enablemouse"))
+  {
+    g_Mouse.SetEnabled(g_guiSettings.GetBool("input.enablemouse"));
+  }
+  else if (strSetting.Equals("input.enablejoystick"))
+  {
+#if defined(HAS_SDL_JOYSTICK)
+    g_Joystick.SetEnabled(g_guiSettings.GetBool("input.enablejoystick")  
+        && CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0);
+#endif
+  }
+  else if (strSetting.Equals("videoscreen.screen"))
+  {
+    DisplayMode mode = g_guiSettings.GetInt("videoscreen.screen");
+    // Cascade
+    FillInResolutions("videoscreen.resolution", mode, RES_DESKTOP, true);
+  }
+  else if (strSetting.Equals("videoscreen.resolution"))
+  {
+    RESOLUTION nextRes = (RESOLUTION) g_guiSettings.GetInt("videoscreen.resolution");
+    // Cascade
+    FillInRefreshRates("videoscreen.screenmode", nextRes, true);
+  }
+  else if (strSetting.Equals("videoscreen.screenmode"))
+  {
+    int iControlID = pSettingControl->GetID();
+    CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
+    g_windowManager.SendMessage(msg);
+    RESOLUTION nextRes = (RESOLUTION)msg.GetParam1();
+
+    OnRefreshRateChanged(nextRes);
+  }
+  else if (strSetting.Equals("videoscreen.vsync"))
+  {
+    int iControlID = pSettingControl->GetID();
+    CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
+    g_windowManager.SendMessage(msg);
+// DXMERGE: This may be useful
+//    g_videoConfig.SetVSyncMode((VSYNC)msg.GetParam1());
+  }
+  else if (strSetting.Equals("videoscreen.fakefullscreen"))
+  {
+    if (g_graphicsContext.IsFullScreenRoot())
+      g_graphicsContext.SetVideoResolution(g_graphicsContext.GetVideoResolution(), true);
+  }
+  else if (strSetting.Equals("locale.audiolanguage"))
+  { // new audio language chosen...
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    int iLanguage = pControl->GetValue();
+    if (iLanguage < 2)
+    {
+      if (iLanguage < 1)
+        g_guiSettings.SetString(strSetting, "original");
+      else
+        g_guiSettings.SetString(strSetting, "default");
+      g_langInfo.SetAudioLanguage("");
+    }
+    else
+    {
+      CStdString strLanguage = pControl->GetCurrentLabel();
+      if (strLanguage != pSettingString->GetData())
+      {
+        g_guiSettings.SetString(strSetting, strLanguage);
+        g_langInfo.SetAudioLanguage(strLanguage);
+      }
+    }
+  }
+  else if (strSetting.Equals("locale.subtitlelanguage"))
+  { // new subtitle language chosen...
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    int iLanguage = pControl->GetValue();
+    if (iLanguage < 2)
+    {
+      if (iLanguage < 1)
+        g_guiSettings.SetString(strSetting, "original");
+      else
+        g_guiSettings.SetString(strSetting, "default");
+      g_langInfo.SetSubtitleLanguage("");
+    }
+    else
+    {
+      CStdString strLanguage = pControl->GetCurrentLabel();
+      if (strLanguage != pSettingString->GetData())
+      {
+        g_guiSettings.SetString(strSetting, strLanguage);
+        g_langInfo.SetSubtitleLanguage(strLanguage);
+      }
+    }
+  }
+  else if (strSetting.Equals("locale.language"))
+  { // new language chosen...
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    CStdString strLanguage = pControl->GetCurrentLabel();
+    if (strLanguage != ".svn" && strLanguage != pSettingString->GetData())
+      g_guiSettings.SetLanguage(strLanguage);
+
+    // user set language, no longer use the TV's language
+    vector<CPeripheral *> cecDevices;
+    if (g_peripherals.GetPeripheralsWithFeature(cecDevices, FEATURE_CEC) > 0)
+    {
+      for (vector<CPeripheral *>::iterator it = cecDevices.begin(); it != cecDevices.end(); it++)
+        (*it)->SetSetting("use_tv_menu_language", false);
+    }
+  }
+  else if (strSetting.Equals("lookandfeel.skintheme"))
+  { //a new Theme was chosen
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+
+    CStdString strSkinTheme;
+
+    if (pControl->GetValue() == 0) // Use default theme
+      strSkinTheme = "SKINDEFAULT";
+    else
+      strSkinTheme = pControl->GetCurrentLabel();
+
+    if (strSkinTheme != pSettingString->GetData())
+    {
+      g_guiSettings.SetString("lookandfeel.skintheme", strSkinTheme);
+      // also set the default color theme
+      CStdString colorTheme(URIUtils::ReplaceExtension(strSkinTheme, ".xml"));
+      if (colorTheme.Equals("Textures.xml"))
+        colorTheme = "defaults.xml";
+      g_guiSettings.SetString("lookandfeel.skincolors", colorTheme);
+      g_application.ReloadSkin();
+    }
+  }
+  else if (strSetting.Equals("lookandfeel.skincolors"))
+  { //a new color was chosen
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+
+    CStdString strSkinColor;
+
+    if (pControl->GetValue() == 0) // Use default colors
+      strSkinColor = "SKINDEFAULT";
+    else
+      strSkinColor = pControl->GetCurrentLabel() + ".xml";
+
+    if (strSkinColor != pSettingString->GetData())
+    {
+      g_guiSettings.SetString("lookandfeel.skincolors", strSkinColor);
+      g_application.ReloadSkin();
+    }
+  }
+  else if (strSetting.Equals("videoplayer.displayresolution"))
+  {
+    CSettingInt *pSettingInt = (CSettingInt *)pSettingControl->GetSetting();
+    int iControlID = pSettingControl->GetID();
+    CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
+    g_windowManager.SendMessage(msg);
+    pSettingInt->SetData(msg.GetParam1());
+  }
+  else if (strSetting.Equals("videoscreen.flickerfilter") || strSetting.Equals("videoscreen.soften"))
+  { // reset display
+    g_graphicsContext.SetVideoResolution(g_guiSettings.m_LookAndFeelResolution);
+  }
+  else if (strSetting.Equals("screensaver.preview"))
+  {
+    g_application.ActivateScreenSaver(true);
+  }
+  else if (strSetting.Equals("screensaver.settings"))
+  {
+    AddonPtr addon;
+    if (CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
+      CGUIDialogAddonSettings::ShowAndGetInput(addon);
+  }
+  else if (strSetting.Equals("debug.screenshotpath") || strSetting.Equals("audiocds.recordingpath") || strSetting.Equals("subtitles.custompath") || strSetting.Equals("pvrmenu.iconpath"))
+  {
+    CSettingString *pSettingString = (CSettingString *)pSettingControl->GetSetting();
+    CStdString path = g_guiSettings.GetString(strSetting,false);
+    VECSOURCES shares;
+
+    bool bWriteOnly = true;
+
+    if (strSetting.Equals("pvrmenu.iconpath"))
+    {
+      bWriteOnly = false;
+    }
+    else if (strSetting.Equals("subtitles.custompath"))
+    {
+      bWriteOnly = false;
+      shares = g_settings.m_videoSources;
+    }
+
+    g_mediaManager.GetNetworkLocations(shares);
+    g_mediaManager.GetLocalDrives(shares);
+
+    UpdateSettings();
+
+    if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(pSettingString->m_iHeadingString), path, bWriteOnly))
+    {
+      pSettingString->SetData(path);
+    }
+  }
+  else if (strSetting.Left(22).Equals("MusicPlayer.ReplayGain"))
+  { // Update our replaygain settings
+    g_guiSettings.m_replayGain.iType = g_guiSettings.GetInt("musicplayer.replaygaintype");
+    g_guiSettings.m_replayGain.iPreAmp = g_guiSettings.GetInt("musicplayer.replaygainpreamp");
+    g_guiSettings.m_replayGain.iNoGainPreAmp = g_guiSettings.GetInt("musicplayer.replaygainnogainpreamp");
+    g_guiSettings.m_replayGain.bAvoidClipping = g_guiSettings.GetBool("musicplayer.replaygainavoidclipping");
+  }
+  else if (strSetting.Equals("locale.country"))
+  {
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+
+    const CStdString& strRegion=pControl->GetCurrentLabel();
+    g_langInfo.SetCurrentRegion(strRegion);
+    g_guiSettings.SetString("locale.country", strRegion);
+    g_weatherManager.Refresh(); // need to reset our weather, as temperatures need re-translating.
+  }
+  else if (strSetting.Equals("smb.winsserver") || strSetting.Equals("smb.workgroup") )
+  {
+    if (g_guiSettings.GetString("smb.winsserver") == "0.0.0.0")
+      g_guiSettings.SetString("smb.winsserver", "");
+
+    /* okey we really don't need to restarat, only deinit samba, but that could be damn hard if something is playing*/
+    //TODO - General way of handling setting changes that require restart
+
+    if (CGUIDialogYesNo::ShowAndGetInput(14038, 14039, 14040, -1, -1))
+    {
+      g_settings.Save();
+      CApplicationMessenger::Get().RestartApp();
+    }
+  }
+  else if (strSetting.Equals("services.upnpserver"))
+  {
+#ifdef HAS_UPNP
+    if (g_guiSettings.GetBool("services.upnpserver"))
+      g_application.StartUPnPServer();
+    else
+      g_application.StopUPnPServer();
+#endif
+  }
+  else if (strSetting.Equals("services.upnprenderer"))
+  {
+#ifdef HAS_UPNP
+    if (g_guiSettings.GetBool("services.upnprenderer"))
+      g_application.StartUPnPRenderer();
+    else
+      g_application.StopUPnPRenderer();
+#endif
+  }
+  else if (strSetting.Equals("services.upnpcontroller"))
+  {
+#ifdef HAS_UPNP
+    g_application.StopUPnPClient(); /* always stop and restart */
+    if (g_guiSettings.GetBool("services.upnpcontroller"))
+      g_application.StartUPnPClient();
+#endif
+  }
+  else if (strSetting.Equals("services.esenabled"))
+  {
+#ifdef HAS_EVENT_SERVER
+    if (g_guiSettings.GetBool("services.esenabled"))
+    {
+      if (!g_application.StartEventServer())
+      {
+        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
+        g_guiSettings.SetBool("services.esenabled", false);
+        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+        if (pControl) pControl->SetEnabled(false);
+      }
+    }
+    else
+    {
+      if (!g_application.StopEventServer(true, true))
+      {
+        g_guiSettings.SetBool("services.esenabled", true);
+        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+        if (pControl) pControl->SetEnabled(true);
+      }
+    }
+#endif
+#ifdef HAS_JSONRPC
+    if (g_guiSettings.GetBool("services.esenabled"))
+    {
+      if (!g_application.StartJSONRPCServer())
+        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33103), "", g_localizeStrings.Get(33100), "");
+    }
+    else
+      g_application.StopJSONRPCServer(false);
+#endif
+  }
+  else if (strSetting.Equals("services.esport"))
+  {
+#ifdef HAS_EVENT_SERVER
+    ValidatePortNumber(pSettingControl, "9777", "9777");
+    //restart eventserver without asking user
+    if (g_application.StopEventServer(true, false))
+    {
+      if (!g_application.StartEventServer())
+        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
+    }
+#if defined(TARGET_DARWIN_OSX)
+    //reconfigure XBMCHelper for port changes
+    XBMCHelper::GetInstance().Configure();
+#endif
+#endif
+  }
+  else if (strSetting.Equals("services.esallinterfaces"))
+  {
+#ifdef HAS_EVENT_SERVER
+    if (g_guiSettings.GetBool("services.esenabled"))
+    {
+      if (g_application.StopEventServer(true, true))
+      {
+        if (!g_application.StartEventServer())
+          CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
+      }
+      else
+      {
+        g_guiSettings.SetBool("services.esenabled", true);
+        CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+        if (pControl) pControl->SetEnabled(true);
+      }
+    }
+#endif
+#ifdef HAS_JSONRPC
+    if (g_guiSettings.GetBool("services.esenabled"))
+    {
+      if (!g_application.StartJSONRPCServer())
+        CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33103), "", g_localizeStrings.Get(33100), "");
+    }
+    else
+      g_application.StopJSONRPCServer(false);
+#endif
+  }
+  else if (strSetting.Equals("services.esinitialdelay") ||
+           strSetting.Equals("services.escontinuousdelay"))
+  {
+#ifdef HAS_EVENT_SERVER
+    if (g_guiSettings.GetBool("services.esenabled"))
+    {
+      g_application.RefreshEventServer();
+    }
+#endif
+  }
+  else if (strSetting.Equals("pvrmanager.enabled"))
+  {
+    if (g_guiSettings.GetBool("pvrmanager.enabled"))
+      CApplicationMessenger::Get().ExecBuiltIn("XBMC.StartPVRManager", false);
+    else
+      CApplicationMessenger::Get().ExecBuiltIn("XBMC.StopPVRManager", false);
+  }
+  else if (strSetting.Equals("masterlock.lockcode"))
+  {
+    // Now Prompt User to enter the old and then the new MasterCode!
+    if(g_passwordManager.SetMasterLockMode())
+    {
+      // We asked for the master password and saved the new one!
+      // Nothing todo here
+    }
+  }
+  else if (strSetting.Equals("network.interface"))
+  {
+     NetworkInterfaceChanged();
+  }
+#ifdef HAS_LINUX_NETWORK
+  else if (strSetting.Equals("network.save"))
+  {
+     NetworkAssignment iAssignment;
+     CStdString sIPAddress;
+     CStdString sNetworkMask;
+     CStdString sDefaultGateway;
+     CStdString sWirelessNetwork;
+     CStdString sWirelessKey;
+     CStdString sDns;
+     EncMode iWirelessEnc;
+     CStdString ifaceName;
+
+     CGUISpinControlEx *ifaceControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
+     ifaceName = ifaceControl->GetLabel();
+     CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
+
+     // Update controls with information
+     CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
+     if (pControl1) iAssignment = (NetworkAssignment) pControl1->GetValue();
+     CGUIButtonControl* pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.ipaddress")->GetID());
+     if (pControl2) sIPAddress = pControl2->GetLabel2();
+     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.subnet")->GetID());
+     if (pControl2) sNetworkMask = pControl2->GetLabel2();
+     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.gateway")->GetID());
+     if (pControl2) sDefaultGateway = pControl2->GetLabel2();
+     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.dns")->GetID());
+     if (pControl2) sDns = pControl2->GetLabel2();
+     pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
+     if (pControl1) iWirelessEnc = (EncMode) pControl1->GetValue();
+     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.essid")->GetID());
+     if (pControl2) sWirelessNetwork = pControl2->GetLabel2();
+     pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.key")->GetID());
+     if (pControl2) sWirelessKey = pControl2->GetLabel2();
+
+     CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
+     pDlgProgress->SetLine(0, "");
+     pDlgProgress->SetLine(1, g_localizeStrings.Get(784));
+     pDlgProgress->SetLine(2, "");
+     pDlgProgress->StartModal();
+     pDlgProgress->Progress();
+
+     std::vector<CStdString> nameServers;
+     nameServers.push_back(sDns);
+     g_application.getNetwork().SetNameServers(nameServers);
+     iface->SetSettings(iAssignment, sIPAddress, sNetworkMask, sDefaultGateway, sWirelessNetwork, sWirelessKey, iWirelessEnc);
+
+     pDlgProgress->Close();
+
+     if (iAssignment == NETWORK_DISABLED)
+        CGUIDialogOK::ShowAndGetInput(0, 788, 0, 0);
+     else if (iface->IsConnected())
+        CGUIDialogOK::ShowAndGetInput(0, 785, 0, 0);
+     else
+        CGUIDialogOK::ShowAndGetInput(0, 786, 0, 0);
+  }
+  else if (strSetting.Equals("network.essid"))
+  {
+    CGUIDialogAccessPoints *dialog = (CGUIDialogAccessPoints *)g_windowManager.GetWindow(WINDOW_DIALOG_ACCESS_POINTS);
+    if (dialog)
+    {
+       CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
+       dialog->SetInterfaceName(pControl->GetLabel());
+       dialog->DoModal();
+
+       if (dialog->WasItemSelected())
+       {
+          CGUIButtonControl* pControl2 = (CGUIButtonControl *)GetControl(GetSetting("network.essid")->GetID());
+          if (pControl2) pControl2->SetLabel2(dialog->GetSelectedAccessPointEssId());
+          pControl = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
+          if (pControl) pControl->SetValue(dialog->GetSelectedAccessPointEncMode());
+       }
+    }
+  }
+#endif
+#ifdef _LINUX
+  else if (strSetting.Equals("locale.timezonecountry"))
+  {
+    CGUISpinControlEx *pControlCountry = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+    CStdString country = pControlCountry->GetCurrentLabel();
+
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezone")->GetID());
+    pControl->Clear();
+    vector<CStdString> timezones = g_timezone.GetTimezonesByCountry(country);
+    for (unsigned int i=0; i < timezones.size(); i++)
+    {
+      pControl->AddLabel(timezones[i], i);
+    }
+
+    g_timezone.SetTimezone(pControl->GetLabel());
+    g_guiSettings.SetString("locale.timezonecountry",pControlCountry->GetLabel().c_str());
+
+    CGUISpinControlEx *tzControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezone")->GetID());
+    g_guiSettings.SetString("locale.timezone", tzControl->GetLabel().c_str());
+
+    CDateTime::ResetTimezoneBias();
+  }
+  else  if (strSetting.Equals("locale.timezone"))
+  {
+     CGUISpinControlEx *tzControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezone")->GetID());
+     g_timezone.SetTimezone(tzControl->GetLabel());
+     g_guiSettings.SetString("locale.timezone", tzControl->GetLabel().c_str());
+
+     tzControl = (CGUISpinControlEx *)GetControl(GetSetting("locale.timezonecountry")->GetID());
+     g_guiSettings.SetString("locale.timezonecountry", tzControl->GetLabel().c_str());
+
+     CDateTime::ResetTimezoneBias();
+  }
+#endif
+  else if (strSetting.Equals("lookandfeel.skinzoom"))
+  {
+    g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE);
+  }
+  else if (strSetting.Equals("videolibrary.flattentvshows") ||
+           strSetting.Equals("videolibrary.removeduplicates") ||
+           strSetting.Equals("videolibrary.groupmoviesets"))
+  {
+    CUtil::DeleteVideoDatabaseDirectoryCache();
+  }
+  else if (strSetting.Equals("pvrmenu.searchicons") && g_PVRManager.IsStarted())
+  {
+    g_PVRManager.SearchMissingChannelIcons();
+  }
+  else if (strSetting.Equals("pvrmanager.resetdb"))
+  {
+    if (g_PVRManager.CheckParentalPIN(g_localizeStrings.Get(19262).c_str()) &&
+        CGUIDialogYesNo::ShowAndGetInput(19098, 19186, 750, 0))
+    {
+      CDateTime::ResetTimezoneBias();
+      g_PVRManager.ResetDatabase(false);
+    }
+  }
+  else if (strSetting.Equals("epg.resetepg"))
+  {
+    if (CGUIDialogYesNo::ShowAndGetInput(19098, 19188, 750, 0))
+    {
+      CDateTime::ResetTimezoneBias();
+      g_PVRManager.ResetDatabase(true);
+    }
+  }
+  else if (strSetting.Equals("pvrmanager.channelscan") && g_PVRManager.IsStarted())
+  {
+    if (CGUIDialogYesNo::ShowAndGetInput(19098, 19118, 19194, 0))
+      g_PVRManager.StartChannelScan();
+  }
+  else if (strSetting.Equals("pvrmanager.channelmanager") && g_PVRManager.IsStarted())
+  {
+    CGUIDialogPVRChannelManager *dialog = (CGUIDialogPVRChannelManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_CHANNEL_MANAGER);
+    if (dialog)
+    {
+       dialog->DoModal();
+    }
+  }
+  else if (strSetting.Equals("pvrclient.menuhook") && g_PVRManager.IsStarted())
+  {
+    g_PVRManager.Get().Clients()->ProcessMenuHooks(-1, PVR_MENUHOOK_SETTING);
+  }
+  else if (strSetting.compare(0, 12, "audiooutput.") == 0)
+  {
+    if (strSetting.Equals("audiooutput.audiodevice"))
+    {
+      CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+#if defined(TARGET_DARWIN)
+      // save the sinkname - since we don't have sinks on osx
+      // we need to get the fitting sinkname for the device label from the
+      // factory
+      std::string label2sink = pControl->GetCurrentLabel();
+      CAEFactory::VerifyOutputDevice(label2sink, false);
+      g_guiSettings.SetString("audiooutput.audiodevice", label2sink.c_str());
+#else
+      g_guiSettings.SetString("audiooutput.audiodevice", m_AnalogAudioSinkMap[pControl->GetCurrentLabel()]);
+#endif
+    }
+#if !defined(TARGET_DARWIN)
+    else if (strSetting.Equals("audiooutput.passthroughdevice"))
+    {
+      CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
+      g_guiSettings.SetString("audiooutput.passthroughdevice", m_DigitalAudioSinkMap[pControl->GetCurrentLabel()]);
+    }
+#endif
+    else if (strSetting.Equals("audiooutput.guisoundmode"))
+    {
+      CAEFactory::SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
+    }
+
+    CAEFactory::OnSettingsChange(strSetting);
+  }
+  else if (strSetting.Equals("pvrparental.enabled"))
+  {
+    if (g_guiSettings.GetBool("pvrparental.enabled") && g_guiSettings.GetString("pvrparental.pin").GetLength() == 0)
+    {
+      CStdString newPassword = "";
+      bool bNewPassword = CGUIDialogNumeric::ShowAndVerifyNewPassword(newPassword);
+      if (bNewPassword)
+      {
+        // password set... save it
+        g_guiSettings.SetString("pvrparental.pin", newPassword);
+      }
+      else
+      {
+        // password not set... disable parental
+        g_guiSettings.SetBool("pvrparental.enabled", false);
+      }
+    }
+  }
+
+  UpdateSettings();
+}
+
+void CGUIWindowSettingsCategory::FreeControls()
+{
+  // clear the category group
+  CGUIControlGroupList *control = (CGUIControlGroupList *)GetControl(CATEGORY_GROUP_ID);
+  if (control)
+  {
+    control->FreeResources();
+    control->ClearAll();
+  }
+  m_vecSections.clear();
+  FreeSettingsControls();
+}
+
+void CGUIWindowSettingsCategory::FreeSettingsControls()
+{
+  // clear the settings group
+  CGUIControlGroupList *control = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
+  if (control)
+  {
+    control->FreeResources();
+    control->ClearAll();
+  }
+
+  for (int i = 0; (size_t)i < m_vecSettings.size(); i++)
+    m_vecSettings[i]->Clear();
+
+  m_vecSettings.clear();
+}
+
+CGUIControl* CGUIWindowSettingsCategory::AddSetting(CSetting *pSetting, float width, int &iControlID)
+{
+  if (!pSetting->IsVisible()) return NULL;  // not displayed in current session
+  BaseSettingControlPtr pSettingControl;
+  CGUIControl *pControl = NULL;
+  if (pSetting->GetControlType() == CHECKMARK_CONTROL)
+  {
+    pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
+    if (!pControl) return NULL;
+    ((CGUIRadioButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
+    pControl->SetWidth(width);
+    pSettingControl.reset(new CGUIRadioButtonSettingControl((CGUIRadioButtonControl *)pControl, iControlID, pSetting));
+  }
+  else if (pSetting->GetControlType() == SPIN_CONTROL_FLOAT || pSetting->GetControlType() == SPIN_CONTROL_INT_PLUS || pSetting->GetControlType() == SPIN_CONTROL_TEXT || pSetting->GetControlType() == SPIN_CONTROL_INT)
+  {
+    pControl = new CGUISpinControlEx(*m_pOriginalSpin);
+    if (!pControl) return NULL;
+    pControl->SetWidth(width);
+    ((CGUISpinControlEx *)pControl)->SetText(g_localizeStrings.Get(pSetting->GetLabel()));
+    pSettingControl.reset(new CGUISpinExSettingControl((CGUISpinControlEx *)pControl, iControlID, pSetting));
+  }
+  else if (pSetting->GetControlType() == SEPARATOR_CONTROL && m_pOriginalImage)
+  {
+    pControl = new CGUIImage(*m_pOriginalImage);
+    if (!pControl) return NULL;
+    pControl->SetWidth(width);
+    pSettingControl.reset(new CGUISeparatorSettingControl((CGUIImage *)pControl, iControlID, pSetting));
+  }
+  else if (pSetting->GetControlType() == EDIT_CONTROL_INPUT ||
+           pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_INPUT ||
+           pSetting->GetControlType() == EDIT_CONTROL_MD5_INPUT ||
+           pSetting->GetControlType() == EDIT_CONTROL_NUMBER_INPUT ||
+           pSetting->GetControlType() == EDIT_CONTROL_IP_INPUT ||
+           pSetting->GetControlType() == EDIT_CONTROL_HIDDEN_NUMBER_VERIFY_NEW )
+  {
+    pControl = new CGUIEditControl(*m_pOriginalEdit);
+    if (!pControl) return NULL;
+    ((CGUIEditControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
+    pControl->SetWidth(width);
+    pSettingControl.reset(new CGUIEditSettingControl((CGUIEditControl *)pControl, iControlID, pSetting));
+  }
+  else if (pSetting->GetControlType() != SEPARATOR_CONTROL) // button control
+  {
+    pControl = new CGUIButtonControl(*m_pOriginalButton);
+    if (!pControl) return NULL;
+    ((CGUIButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
+    pControl->SetWidth(width);
+    pSettingControl.reset(new CGUIButtonSettingControl((CGUIButtonControl *)pControl, iControlID, pSetting));
+  }
+  if (!pControl)
+  {
+    pSettingControl.reset();
+    return NULL;
+  }
+  pControl->SetID(iControlID++);
+  pControl->SetVisible(true);
+  CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
+  if (group)
+  {
+    pControl->AllocResources();
+    group->AddControl(pControl);
+  }
+  m_vecSettings.push_back(pSettingControl);
+  return pControl;
+}
+
+void CGUIWindowSettingsCategory::FrameMove()
+{
+  if (m_delayedSetting && m_delayedTimer.GetElapsedMilliseconds() > 3000)
+  { // we send a thread message so that it's processed the following frame (some settings won't
+    // like being changed during Render())
+    CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID());
+    g_windowManager.SendThreadMessage(message, GetID());
+    m_delayedTimer.Stop();
+  }
+  CGUIWindow::FrameMove();
+}
+
+void CGUIWindowSettingsCategory::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
+{
+  // update alpha status of current button
+  bool bAlphaFaded = false;
+  CGUIControl *control = GetFirstFocusableControl(CONTROL_START_BUTTONS + m_iSection);
+  if (control && !control->HasFocus())
+  {
+    if (control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
+    {
+      control->SetFocus(true);
+      ((CGUIButtonControl *)control)->SetAlpha(0x80);
+      bAlphaFaded = true;
+    }
+    else if (control->GetControlType() == CGUIControl::GUICONTROL_TOGGLEBUTTON)
+    {
+      control->SetFocus(true);
+      ((CGUIButtonControl *)control)->SetSelected(true);
+      bAlphaFaded = true;
+    }
+  }
+  CGUIWindow::DoProcess(currentTime, dirtyregions);
+  if (bAlphaFaded)
+  {
+    control->SetFocus(false);
+    if (control->GetControlType() == CGUIControl::GUICONTROL_BUTTON)
+      ((CGUIButtonControl *)control)->SetAlpha(0xFF);
+    else
+      ((CGUIButtonControl *)control)->SetSelected(false);
+  }
+}
+
+void CGUIWindowSettingsCategory::Render()
+{
+  CGUIWindow::Render();
+}
+
+void CGUIWindowSettingsCategory::FillInSubtitleHeights(CSetting *pSetting, CGUISpinControlEx *pControl)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
+  pControl->Clear();
+  if (CUtil::IsUsingTTFSubtitles())
+  { // easy - just fill as per usual
+    CStdString strLabel;
+    for (int i = pSettingInt->m_iMin; i <= pSettingInt->m_iMax; i += pSettingInt->m_iStep)
+    {
+      if (pSettingInt->m_iFormat > -1)
+      {
+        CStdString strFormat = g_localizeStrings.Get(pSettingInt->m_iFormat);
+        strLabel.Format(strFormat, i);
+      }
+      else
+        strLabel.Format(pSettingInt->m_strFormat, i);
+      pControl->AddLabel(strLabel, i);
+    }
+    pControl->SetValue(pSettingInt->GetData());
+  }
+}
+
+void CGUIWindowSettingsCategory::FillInSubtitleFonts(CSetting *pSetting)
+{
+  CSettingString *pSettingString = (CSettingString*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
+  pControl->Clear();
+  int iCurrentFont = 0;
+  int iFont = 0;
+
+  // find TTF fonts
+  {
+    CFileItemList items;
+    CFileItemList items2;
+    CDirectory::GetDirectory("special://home/media/Fonts/", items2);
+
+    if (CDirectory::GetDirectory("special://xbmc/media/Fonts/", items))
+    {
+      items.Append(items2);
+      for (int i = 0; i < items.Size(); ++i)
+      {
+        CFileItemPtr pItem = items[i];
+
+        if (!pItem->m_bIsFolder)
+        {
+
+          if ( !URIUtils::GetExtension(pItem->GetLabel()).Equals(".ttf") ) continue;
+          if (pItem->GetLabel().Equals(pSettingString->GetData(), false))
+            iCurrentFont = iFont;
+
+          pControl->AddLabel(pItem->GetLabel(), iFont++);
+        }
+
+      }
+    }
+  }
+  pControl->SetValue(iCurrentFont);
+}
+
+void CGUIWindowSettingsCategory::FillInSkinFonts(CSetting *pSetting)
+{
+  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
+  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
+  pControl->Clear();
+  setting->SetDelayed();
+
+  m_SkinFontSetIDs.clear();
+  int iSkinFontSet = 0;
+
+  CStdString strPath = g_SkinInfo->GetSkinPath("Font.xml");
+
+  CXBMCTinyXML xmlDoc;
+  if (!xmlDoc.LoadFile(strPath))
+  {
+    CLog::Log(LOGERROR, "Couldn't load %s", strPath.c_str());
+    return ;
+  }
+
+  TiXmlElement* pRootElement = xmlDoc.RootElement();
+
+  CStdString strValue = pRootElement->Value();
+  if (strValue != CStdString("fonts"))
+  {
+    CLog::Log(LOGERROR, "file %s doesnt start with <fonts>", strPath.c_str());
+    return ;
+  }
+
+  const TiXmlNode *pChild = pRootElement->FirstChild();
+  strValue = pChild->Value();
+  if (strValue == "fontset")
+  {
+    while (pChild)
+    {
+      strValue = pChild->Value();
+      if (strValue == "fontset")
+      {
+        const char* idAttr = ((TiXmlElement*) pChild)->Attribute("id");
+        const char* idLocAttr = ((TiXmlElement*) pChild)->Attribute("idloc");
+        const char* unicodeAttr = ((TiXmlElement*) pChild)->Attribute("unicode");
+
+        bool isUnicode=(unicodeAttr && stricmp(unicodeAttr, "true") == 0);
+
+        bool isAllowed=true;
+        if (g_langInfo.ForceUnicodeFont() && !isUnicode)
+          isAllowed=false;
+
+        if (idAttr != NULL && isAllowed)
+        {
+          if (idLocAttr)
+          {
+            pControl->AddLabel(g_localizeStrings.Get(atoi(idLocAttr)), iSkinFontSet);
+            m_SkinFontSetIDs[g_localizeStrings.Get(atoi(idLocAttr))] = idAttr;
+          }
+          else
+          {
+            pControl->AddLabel(idAttr, iSkinFontSet);
+            m_SkinFontSetIDs[idAttr] = idAttr;
+          }
+          if (strcmpi(idAttr, g_guiSettings.GetString("lookandfeel.font").c_str()) == 0)
+            pControl->SetValue(iSkinFontSet);
+          iSkinFontSet++;
+        }
+      }
+      pChild = pChild->NextSibling();
+    }
+
+  }
+  else
+  {
+    // Since no fontset is defined, there is no selection of a fontset, so disable the component
+    pControl->AddLabel(g_localizeStrings.Get(13278), 1);
+    pControl->SetValue(1);
+    pControl->SetEnabled(false);
+  }
+}
+
+void CGUIWindowSettingsCategory::FillInSoundSkins(CSetting *pSetting)
+{
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
+  pControl->Clear();
+  pControl->SetShowRange(true);
+
+  //find skins...
+  CFileItemList items;
+  CDirectory::GetDirectory("special://xbmc/sounds/", items);
+  CDirectory::GetDirectory("special://home/sounds/", items);
+
+  int iCurrentSoundSkin = 0;
+  int iSoundSkin = 0;
+  vector<CStdString> vecSoundSkins;
+  int i;
+  for (i = 0; i < items.Size(); ++i)
+  {
+    CFileItemPtr pItem = items[i];
+    if (pItem->m_bIsFolder)
+    {
+      if (strcmpi(pItem->GetLabel().c_str(), ".svn") == 0) continue;
+      if (strcmpi(pItem->GetLabel().c_str(), "fonts") == 0) continue;
+      if (strcmpi(pItem->GetLabel().c_str(), "media") == 0) continue;
+      vecSoundSkins.push_back(pItem->GetLabel());
+    }
+  }
+
+  pControl->AddLabel(g_localizeStrings.Get(474), iSoundSkin++); // Off
+  pControl->AddLabel(g_localizeStrings.Get(15109), iSoundSkin++); // Skin Default
+
+  if (g_guiSettings.GetString("lookandfeel.soundskin")=="SKINDEFAULT")
+    iCurrentSoundSkin=1;
+
+  sort(vecSoundSkins.begin(), vecSoundSkins.end(), sortstringbyname());
+  for (i = 0; i < (int) vecSoundSkins.size(); ++i)
+  {
+    CStdString strSkin = vecSoundSkins[i];
+    if (strcmpi(strSkin.c_str(), g_guiSettings.GetString("lookandfeel.soundskin").c_str()) == 0)
+    {
+      iCurrentSoundSkin = iSoundSkin;
+    }
+    pControl->AddLabel(strSkin, iSoundSkin++);
+  }
+  pControl->SetValue(iCurrentSoundSkin);
+  return ;
+}
+
+void CGUIWindowSettingsCategory::FillInCharSets(CSetting *pSetting)
+{
+  CSettingString *pSettingString = (CSettingString*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
+  pControl->Clear();
+  int iCurrentCharset = 0;
+  vector<CStdString> vecCharsets = g_charsetConverter.getCharsetLabels();
+
+  CStdString strCurrentCharsetLabel="DEFAULT";
+  if (pSettingString->GetData()!="DEFAULT")
+    strCurrentCharsetLabel = g_charsetConverter.getCharsetLabelByName(pSettingString->GetData());
+
+  sort(vecCharsets.begin(), vecCharsets.end(), sortstringbyname());
+
+  vecCharsets.insert(vecCharsets.begin(), g_localizeStrings.Get(13278)); // "Default"
+
+  bool bIsAuto=(pSettingString->GetData()=="DEFAULT");
+
+  for (int i = 0; i < (int) vecCharsets.size(); ++i)
+  {
+    CStdString strCharsetLabel = vecCharsets[i];
+
+    if (!bIsAuto && strCharsetLabel == strCurrentCharsetLabel)
+      iCurrentCharset = i;
+
+    pControl->AddLabel(strCharsetLabel, i);
+  }
+
+  pControl->SetValue(iCurrentCharset);
+}
+
+DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RESOLUTION res)
+{
+  DisplayMode mode;
+  if (res == RES_WINDOW)
+    mode = DM_WINDOWED;
+  else
+    mode = g_settings.m_ResInfo[res].iScreen;
+
+  // we expect "videoscreen.screen" but it might be hidden on some platforms,
+  // so check that we actually have a visable control.
+  BaseSettingControlPtr control = GetSetting(strSetting);
+  if (control)
+  {
+    control->SetDelayed();
+    CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+    pControl->Clear();
+
+    CStdString strScreen;
+    if (g_advancedSettings.m_canWindowed)
+      pControl->AddLabel(g_localizeStrings.Get(242), -1);
+
+    for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++)
+    {
+      strScreen.Format(g_localizeStrings.Get(241), g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen + 1);
+      pControl->AddLabel(strScreen, g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen);
+    }
+    pControl->SetValue(mode);
+    g_guiSettings.SetInt("videoscreen.screen", mode);
+  }
+
+  return mode;
+}
+
+void CGUIWindowSettingsCategory::FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange)
+{
+  BaseSettingControlPtr control = GetSetting(strSetting);
+  control->SetDelayed();
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+
+  pControl->Clear();
+
+  RESOLUTION spinres = RES_INVALID; // index of the resolution in the spinner that has same screen/width/height as res
+
+  if (mode == DM_WINDOWED)
+  {
+    pControl->AddLabel(g_localizeStrings.Get(242), RES_WINDOW);
+    spinres = RES_WINDOW;
+  }
+  else
+  {
+    vector<RESOLUTION_WHR> resolutions = g_Windowing.ScreenResolutions(mode);
+
+    for (unsigned int idx = 0; idx < resolutions.size(); idx++)
+    {
+      CStdString strRes;
+      strRes.Format("%dx%d%s", resolutions[idx].width, resolutions[idx].height,
+        (resolutions[idx].interlaced == D3DPRESENTFLAG_INTERLACED) ? "i" : "p");
+      pControl->AddLabel(strRes, resolutions[idx].ResInfo_Index);
+
+      RESOLUTION_INFO res1 = g_settings.m_ResInfo[res];
+      RESOLUTION_INFO res2 = g_settings.m_ResInfo[resolutions[idx].ResInfo_Index];
+      if (   res1.iScreen == res2.iScreen
+          && res1.iScreenWidth  == res2.iScreenWidth
+          && res1.iScreenHeight == res2.iScreenHeight
+          && (res1.dwFlags & D3DPRESENTFLAG_INTERLACED) == (res2.dwFlags & D3DPRESENTFLAG_INTERLACED))
+        spinres = (RESOLUTION) resolutions[idx].ResInfo_Index;
+    }
+  }
+
+  if (UserChange)
+  {
+    // Auto-select the windowed or desktop resolution of the screen
+    int autoresolution = RES_DESKTOP;
+    if (mode == DM_WINDOWED)
+    {
+      autoresolution = RES_WINDOW;
+    }
+    else
+    {
+      for (int idx=0; idx < g_Windowing.GetNumScreens(); idx++)
+        if (g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen == mode)
+        {
+          autoresolution = RES_DESKTOP + idx;
+          break;
+        }
+    }
+    pControl->SetValue(autoresolution);
+
+    // Cascade
+    FillInRefreshRates("videoscreen.screenmode", (RESOLUTION) autoresolution, true);
+  }
+  else
+  {
+    // select the entry equivalent to the resolution passed by the res parameter
+    pControl->SetValue(spinres);
+  }
+}
+
+void CGUIWindowSettingsCategory::FillInRefreshRates(CStdString strSetting, RESOLUTION res, bool UserChange)
+{
+  // The only meaningful parts of res here are iScreen, iScreenWidth, iScreenHeight
+
+  vector<REFRESHRATE> refreshrates;
+  if (res > RES_WINDOW)
+    refreshrates = g_Windowing.RefreshRates(g_settings.m_ResInfo[res].iScreen,
+      g_settings.m_ResInfo[res].iScreenWidth,
+      g_settings.m_ResInfo[res].iScreenHeight,
+      g_settings.m_ResInfo[res].dwFlags);
+
+  // The control setting doesn't exist when not in standalone mode, don't manipulate it
+  BaseSettingControlPtr control = GetSetting(strSetting);
+  CGUISpinControlEx *pControl= NULL;
+
+  // Populate
+  if (control)
+  {
+    control->SetDelayed();
+    pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+    pControl->Clear();
+
+    if (res == RES_WINDOW)
+    {
+      pControl->AddLabel(g_localizeStrings.Get(242), RES_WINDOW);
+    }
+    else
+    {
+      for (unsigned int idx = 0; idx < refreshrates.size(); idx++)
+      {
+        CStdString strRR;
+        strRR.Format("%.02f", refreshrates[idx].RefreshRate);
+        pControl->AddLabel(strRR, refreshrates[idx].ResInfo_Index);
+      }
+    }
+  }
+
+  // Select a rate
+  if (UserChange)
+  {
+    RESOLUTION newresolution;
+    if (res == RES_WINDOW)
+      newresolution = RES_WINDOW;
+    else
+      newresolution = (RESOLUTION) g_Windowing.DefaultRefreshRate(g_settings.m_ResInfo[res].iScreen, refreshrates).ResInfo_Index;
+
+    if (pControl)
+      pControl->SetValue(newresolution);
+
+    OnRefreshRateChanged(newresolution);
+  }
+  else
+  {
+    if (pControl)
+      pControl->SetValue(res);
+  }
+}
+
+void CGUIWindowSettingsCategory::OnRefreshRateChanged(RESOLUTION nextRes)
+{
+  RESOLUTION lastRes = g_graphicsContext.GetVideoResolution();
+  bool cancelled = false;
+
+  g_guiSettings.SetResolution(nextRes);
+  g_graphicsContext.SetVideoResolution(nextRes);
+
+  if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000))
+  {
+    g_guiSettings.SetResolution(lastRes);
+    g_graphicsContext.SetVideoResolution(lastRes);
+
+    DisplayMode mode = FillInScreens("videoscreen.screen", lastRes);
+    FillInResolutions("videoscreen.resolution", mode, lastRes, false);
+    FillInRefreshRates("videoscreen.screenmode", lastRes, false);
+  }
+}
+
+void CGUIWindowSettingsCategory::FillInLanguages(CSetting *pSetting, const std::vector<CStdString> &languages /* = std::vector<CStdString>() */, const std::vector<CStdString> &languageKeys /* = std::vector<CStdString>() */)
+{
+  CSettingString *pSettingString = (CSettingString *)pSetting;
+  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
+  pControl->Clear();
+
+  //find languages...
+  CFileItemList items;
+  CDirectory::GetDirectory("special://xbmc/language/", items);
+
+  int iCurrentLang = 0;
+  vector<CStdString> vecLanguage;
+  for (int i = 0; i < items.Size(); ++i)
+  {
+    CFileItemPtr pItem = items[i];
+    if (pItem->m_bIsFolder)
+    {
+      if (strcmpi(pItem->GetLabel().c_str(), ".svn") == 0) continue;
+      if (strcmpi(pItem->GetLabel().c_str(), "fonts") == 0) continue;
+      if (strcmpi(pItem->GetLabel().c_str(), "media") == 0) continue;
+      vecLanguage.push_back(pItem->GetLabel());
+    }
+  }
+
+  sort(vecLanguage.begin(), vecLanguage.end(), sortstringbyname());
+  // Add language options passed by parameter at the beginning
+  if (languages.size() > 0)
+    vecLanguage.insert(vecLanguage.begin(), languages.begin(), languages.begin() + languages.size());
+  for (unsigned int i = 0; i < vecLanguage.size(); ++i)
+  {
+    CStdString strLanguage = vecLanguage[i];
+    if ((i < languageKeys.size() && strcmpi(languageKeys[i].c_str(), pSettingString->GetData().c_str()) == 0) ||
+        strcmpi(strLanguage.c_str(), pSettingString->GetData().c_str()) == 0)
+      iCurrentLang = i;
+    pControl->AddLabel(strLanguage, i);
+  }
+
+  pControl->SetValue(iCurrentLang);
+}
+
+void CGUIWindowSettingsCategory::FillInRegions(CSetting *pSetting)
+{
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
+  pControl->Clear();
+
+  int iCurrentRegion=0;
+  CStdStringArray regions;
+  g_langInfo.GetRegionNames(regions);
+
+  CStdString strCurrentRegion=g_langInfo.GetCurrentRegion();
+
+  sort(regions.begin(), regions.end(), sortstringbyname());
+
+  for (int i = 0; i < (int) regions.size(); ++i)
+  {
+    const CStdString& strRegion = regions[i];
+
+    if (strRegion == strCurrentRegion)
+      iCurrentRegion = i;
+
+    pControl->AddLabel(strRegion, i);
+  }
+
+  pControl->SetValue(iCurrentRegion);
+}
+
+BaseSettingControlPtr CGUIWindowSettingsCategory::GetSetting(const CStdString &strSetting)
+{
+  for (unsigned int i = 0; i < m_vecSettings.size(); i++)
+  {
+    if (m_vecSettings[i]->GetSetting()->GetSetting() == strSetting)
+      return m_vecSettings[i];
+  }
+  return BaseSettingControlPtr();
+}
+
+void CGUIWindowSettingsCategory::FillInSkinThemes(CSetting *pSetting)
+{
+  // There is a default theme (just Textures.xpr/xbt)
+  // any other *.xpr|*.xbt files are additional themes on top of this one.
+  CSettingString *pSettingString = (CSettingString *)pSetting;
+  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
+  CStdString strSettingString = g_guiSettings.GetString("lookandfeel.skintheme");
+  setting->SetDelayed();
+
+  // Clear and add. the Default Label
+  pControl->Clear();
+  pControl->SetShowRange(true);
+  pControl->AddLabel(g_localizeStrings.Get(15109), 0); // "SKINDEFAULT" The standard Textures.xpr/xbt will be used
+
+  CStdString strDefaultTheme = pSettingString->GetData();
+
+  // Search for Themes in the Current skin!
+  vector<CStdString> vecTheme;
+  CUtil::GetSkinThemes(vecTheme);
+
+  // Remove the extension from the current Theme (backward compat)
+  URIUtils::RemoveExtension(strSettingString);
+
+  // Sort the Themes for GUI and list them
+  int iCurrentTheme = 0;
+  for (int i = 0; i < (int) vecTheme.size(); ++i)
+  {
+    CStdString strTheme = vecTheme[i];
+    // Is the Current Theme our Used Theme! If yes set the ID!
+    if (strTheme.CompareNoCase(strSettingString) == 0 )
+      iCurrentTheme = i + 1; // 1: #of Predefined Theme [Label]
+    pControl->AddLabel(strTheme, i + 1);
+  }
+  // Set the Choosen Theme
+  pControl->SetValue(iCurrentTheme);
+}
+
+void CGUIWindowSettingsCategory::FillInSkinColors(CSetting *pSetting)
+{
+  // There is a default theme (just defaults.xml)
+  // any other *.xml files are additional color themes on top of this one.
+  BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
+  CStdString strSettingString = g_guiSettings.GetString("lookandfeel.skincolors");
+  setting->SetDelayed();
+
+  // Clear and add. the Default Label
+  pControl->Clear();
+  pControl->SetShowRange(true);
+  pControl->AddLabel(g_localizeStrings.Get(15109), 0); // "SKINDEFAULT"! The standard defaults.xml will be used!
+
+  // Search for colors in the Current skin!
+  vector<CStdString> vecColors;
+
+  CStdString strPath;
+  URIUtils::AddFileToFolder(g_SkinInfo->Path(),"colors",strPath);
+
+  CFileItemList items;
+  CDirectory::GetDirectory(CSpecialProtocol::TranslatePathConvertCase(strPath), items, ".xml");
+  // Search for Themes in the Current skin!
+  for (int i = 0; i < items.Size(); ++i)
+  {
+    CFileItemPtr pItem = items[i];
+    if (!pItem->m_bIsFolder && pItem->GetLabel().CompareNoCase("defaults.xml") != 0)
+    { // not the default one
+      CStdString strLabel = pItem->GetLabel();
+      vecColors.push_back(strLabel.Mid(0, strLabel.size() - 4));
+    }
+  }
+  sort(vecColors.begin(), vecColors.end(), sortstringbyname());
+
+  // Remove the .xml extension from the Themes
+  if (URIUtils::GetExtension(strSettingString) == ".xml")
+    URIUtils::RemoveExtension(strSettingString);
+
+  int iCurrentColor = 0;
+  for (int i = 0; i < (int) vecColors.size(); ++i)
+  {
+    CStdString strColor = vecColors[i];
+    // Is the Current Theme our Used Theme! If yes set the ID!
+    if (strColor.CompareNoCase(strSettingString) == 0 )
+      iCurrentColor = i + 1; // 1: #of Predefined Theme [Label]
+    pControl->AddLabel(strColor, i + 1);
+  }
+  // Set the Choosen Theme
+  pControl->SetValue(iCurrentColor);
+}
+
+void CGUIWindowSettingsCategory::FillInStartupWindow(CSetting *pSetting)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->Clear();
+
+  const vector<CSkinInfo::CStartupWindow> &startupWindows = g_SkinInfo->GetStartupWindows();
+
+  // TODO: How should we localize this?
+  // In the long run there is no way to do it really without the skin having some
+  // translation information built in to it, which isn't really feasible.
+
+  // Alternatively we could lookup the strings in the english strings file to get
+  // their id and then get the string from that
+
+  // easier would be to have the skinner use the "name" as the label number.
+
+  // eg <window id="0">513</window>
+
+  bool currentSettingFound(false);
+  for (vector<CSkinInfo::CStartupWindow>::const_iterator it = startupWindows.begin(); it != startupWindows.end(); it++)
+  {
+    CStdString windowName((*it).m_name);
+    if (StringUtils::IsNaturalNumber(windowName))
+      windowName = g_localizeStrings.Get(atoi(windowName.c_str()));
+    int windowID((*it).m_id);
+    pControl->AddLabel(windowName, windowID);
+    if (pSettingInt->GetData() == windowID)
+      currentSettingFound = true;
+  }
+
+  // ok, now check whether our current option is one of these
+  // and set it's value
+  if (!currentSettingFound)
+  { // nope - set it to the "default" option - the first one
+    pSettingInt->SetData(startupWindows[0].m_id);
+  }
+  pControl->SetValue(pSettingInt->GetData());
+}
+
+void CGUIWindowSettingsCategory::OnInitWindow()
+{
+  m_strOldTrackFormat = g_guiSettings.GetString("musicfiles.trackformat");
+  m_strOldTrackFormatRight = g_guiSettings.GetString("musicfiles.trackformatright");
+  SetupControls();
+  CGUIWindow::OnInitWindow();
+}
+
+void CGUIWindowSettingsCategory::FillInViewModes(CSetting *pSetting, int windowID)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->AddLabel("Auto", DEFAULT_VIEW_AUTO);
+  bool found(false);
+  int foundType = 0;
+  CGUIWindow *window = g_windowManager.GetWindow(windowID);
+  if (window)
+  {
+    window->Initialize();
+    for (int i = 50; i < 60; i++)
+    {
+      IGUIContainer *control = (IGUIContainer *)window->GetControl(i);
+      if (control)
+      {
+        int type = (control->GetType() << 16) | i;
+        pControl->AddLabel(control->GetLabel(), type);
+        if (type == pSettingInt->GetData())
+          found = true;
+        else if ((type >> 16) == (pSettingInt->GetData() >> 16))
+          foundType = type;
+      }
+    }
+    window->ClearAll();
+  }
+  if (!found)
+    pSettingInt->SetData(foundType ? foundType : (DEFAULT_VIEW_AUTO));
+  pControl->SetValue(pSettingInt->GetData());
+}
+
+void CGUIWindowSettingsCategory::FillInSortMethods(CSetting *pSetting, int windowID)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  CFileItemList items("C:");
+  CGUIViewState *state = CGUIViewState::GetViewState(windowID, items);
+  if (state)
+  {
+    bool found(false);
+    vector< pair<int,int> > sortMethods;
+    state->GetSortMethods(sortMethods);
+    for (unsigned int i = 0; i < sortMethods.size(); i++)
+    {
+      pControl->AddLabel(g_localizeStrings.Get(sortMethods[i].second), sortMethods[i].first);
+      if (sortMethods[i].first == pSettingInt->GetData())
+        found = true;
+    }
+    if (!found && sortMethods.size())
+      pSettingInt->SetData(sortMethods[0].first);
+  }
+  pControl->SetValue(pSettingInt->GetData());
+  delete state;
+}
+
+void CGUIWindowSettingsCategory::FillInNetworkInterfaces(CSetting *pSetting, float groupWidth, int &iControlID)
+{
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, groupWidth, iControlID);
+  pControl->Clear();
+
+  // query list of interfaces
+  vector<CStdString> vecInterfaces;
+  std::vector<CNetworkInterface*>& ifaces = g_application.getNetwork().GetInterfaceList();
+  std::vector<CNetworkInterface*>::const_iterator iter = ifaces.begin();
+  while (iter != ifaces.end())
+  {
+    CNetworkInterface* iface = *iter;
+    vecInterfaces.push_back(iface->GetName());
+    ++iter;
+  }
+  sort(vecInterfaces.begin(), vecInterfaces.end(), sortstringbyname());
+
+  int iInterface = 0;
+  for (unsigned int i = 0; i < vecInterfaces.size(); ++i)
+    pControl->AddLabel(vecInterfaces[i], iInterface++);
+}
+
+void CGUIWindowSettingsCategory::FillInEpgGuideView(CSetting *pSetting)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->Clear();
+
+  pControl->AddLabel(g_localizeStrings.Get(19029), GUIDE_VIEW_CHANNEL);
+  pControl->AddLabel(g_localizeStrings.Get(19030), GUIDE_VIEW_NOW);
+  pControl->AddLabel(g_localizeStrings.Get(19031), GUIDE_VIEW_NEXT);
+  pControl->AddLabel(g_localizeStrings.Get(19032), GUIDE_VIEW_TIMELINE);
+
+  pControl->SetValue(pSettingInt->GetData());
+}
+
+void CGUIWindowSettingsCategory::FillInPvrStartLastChannel(CSetting *pSetting)
+{
+  CSettingInt *pSettingInt = (CSettingInt*)pSetting;
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->Clear();
+
+  pControl->AddLabel(g_localizeStrings.Get(106),   START_LAST_CHANNEL_OFF);
+  pControl->AddLabel(g_localizeStrings.Get(19190), START_LAST_CHANNEL_MIN);
+  pControl->AddLabel(g_localizeStrings.Get(107),   START_LAST_CHANNEL_ON);
+
+  pControl->SetValue(pSettingInt->GetData());
+}
+
+void CGUIWindowSettingsCategory::FillInAudioDevices(CSetting* pSetting, bool Passthrough)
+{
+  CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
+  pControl->Clear();
+
+  CStdString currentDevice = Passthrough ? g_guiSettings.GetString("audiooutput.passthroughdevice") : g_guiSettings.GetString("audiooutput.audiodevice");
+
+  if (Passthrough)
+  {
+    m_DigitalAudioSinkMap.clear();
+    m_DigitalAudioSinkMap["Error - no devices found"] = "null:";
+  }
+  else
+  {
+    m_AnalogAudioSinkMap.clear();
+    m_AnalogAudioSinkMap["Error - no devices found"] = "null:";
+  }
+
+  int selectedValue = -1;
+  AEDeviceList sinkList;
+  CAEFactory::EnumerateOutputDevices(sinkList, Passthrough);
+#if !defined(TARGET_DARWIN)
+  if (sinkList.size()==0)
+  {
+    pControl->AddLabel("Error - no devices found", 0);
+    selectedValue = 0;
+  }
+  else
+  {
+#endif
+    AEDeviceList::const_iterator iter = sinkList.begin();
+    for (int i=0; iter != sinkList.end(); iter++)
+    {
+      CStdString label = (*iter).first;
+      CStdString sink  = (*iter).second;
+      pControl->AddLabel(label.c_str(), i);
+
+      if (currentDevice.Equals(sink))
+        selectedValue = i;
+
+      if (Passthrough)
+        m_DigitalAudioSinkMap[label] = sink;
+      else
+        m_AnalogAudioSinkMap[label] = sink;
+
+      i++;
+    }
+
+#if !defined(TARGET_DARWIN)
+  }
+#endif
+
+  if (selectedValue < 0)
+  {
+    CLog::Log(LOGWARNING, "Failed to find previously selected audio sink");
+    pControl->SetValue(0);
+    if (!Passthrough)
+      ((CSettingString*)pSetting)->SetData(m_AnalogAudioSinkMap[pControl->GetCurrentLabel()]);
+    else
+      ((CSettingString*)pSetting)->SetData(m_DigitalAudioSinkMap[pControl->GetCurrentLabel()]);
+  }
+  else
+    pControl->SetValue(selectedValue);
+}
+
+void CGUIWindowSettingsCategory::NetworkInterfaceChanged(void)
+{
+#if 0
+   NetworkAssignment iAssignment;
+   CStdString sIPAddress;
+   CStdString sNetworkMask;
+   CStdString sDefaultGateway;
+   CStdString sWirelessNetwork;
+   CStdString sWirelessKey;
+   EncMode iWirelessEnc;
+   bool bIsWireless;
+   CStdString ifaceName;
+
+   // Get network information
+   CGUISpinControlEx *ifaceControl = (CGUISpinControlEx *)GetControl(GetSetting("network.interface")->GetID());
+   ifaceName = ifaceControl->GetLabel();
+   CNetworkInterface* iface = g_application.getNetwork().GetInterfaceByName(ifaceName);
+   iface->GetSettings(iAssignment, sIPAddress, sNetworkMask, sDefaultGateway, sWirelessNetwork, sWirelessKey, iWirelessEnc);
+   bIsWireless = iface->IsWireless();
+
+   CStdString dns;
+   std::vector<CStdString> dnss = g_application.getNetwork().GetNameServers();
+   if (dnss.size() >= 1)
+      dns = dnss[0];
+
+   // Update controls with information
+   CGUISpinControlEx* pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.assignment")->GetID());
+   if (pControl1) pControl1->SetValue(iAssignment);
+   GetSetting("network.dns")->GetSetting()->FromString(dns);
+   if (iAssignment == NETWORK_STATIC || iAssignment == NETWORK_DISABLED)
+   {
+     GetSetting("network.ipaddress")->GetSetting()->FromString(sIPAddress);
+     GetSetting("network.subnet")->GetSetting()->FromString(sNetworkMask);
+     GetSetting("network.gateway")->GetSetting()->FromString(sDefaultGateway);
+   }
+   else
+   {
+     GetSetting("network.ipaddress")->GetSetting()->FromString(iface->GetCurrentIPAddress());
+     GetSetting("network.subnet")->GetSetting()->FromString(iface->GetCurrentNetmask());
+     GetSetting("network.gateway")->GetSetting()->FromString(iface->GetCurrentDefaultGateway());
+   }
+
+   pControl1 = (CGUISpinControlEx *)GetControl(GetSetting("network.enc")->GetID());
+   if (pControl1) pControl1->SetValue(iWirelessEnc);
+
+   if (bIsWireless)
+   {
+      GetSetting("network.essid")->GetSetting()->FromString(sWirelessNetwork);
+      GetSetting("network.key")->GetSetting()->FromString(sWirelessKey);
+   }
+   else
+   {
+      GetSetting("network.essid")->GetSetting()->FromString("");
+      GetSetting("network.key")->GetSetting()->FromString("");
+   }
+#endif
+}
+
+void CGUIWindowSettingsCategory::ValidatePortNumber(BaseSettingControlPtr pSettingControl, const CStdString& userPort, const CStdString& privPort, bool listening/*=true*/)
+{
+  CSettingString *pSetting = (CSettingString *)pSettingControl->GetSetting();
+  // check that it's a valid port
+  int port = atoi(pSetting->GetData().c_str());
+#ifdef _LINUX
+  if (listening && !CUtil::CanBindPrivileged() && (port < 1024 || port > 65535))
+  {
+    CGUIDialogOK::ShowAndGetInput(257, 850, 852, -1);
+    pSetting->SetData(userPort.c_str());
+  }
+  else
+#endif
+  if (port <= 0 || port > 65535)
+  {
+    CGUIDialogOK::ShowAndGetInput(257, 850, 851, -1);
+    pSetting->SetData(privPort.c_str());
+  }
+}
diff --git a/xbmc/settings/windows/GUIWindowSettingsCategory.h b/xbmc/settings/windows/GUIWindowSettingsCategory.h
new file mode 100644 (file)
index 0000000..74b222c
--- /dev/null
@@ -0,0 +1,111 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIWindow.h"
+#include "settings/GUISettings.h"
+#include "settings/windows/GUISettingControls.h"
+#include "utils/Stopwatch.h"
+
+typedef boost::shared_ptr<CGUIBaseSettingControl> BaseSettingControlPtr;
+
+class CGUIWindowSettingsCategory :
+      public CGUIWindow
+{
+public:
+  CGUIWindowSettingsCategory(void);
+  virtual ~CGUIWindowSettingsCategory(void);
+  virtual bool OnMessage(CGUIMessage &message);
+  virtual bool OnBack(int actionID);
+  virtual void FrameMove();
+  virtual void Render();
+  virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions);
+  virtual int GetID() const { return CGUIWindow::GetID() + m_iScreen; };
+
+protected:
+  virtual void OnInitWindow();
+
+  void CheckNetworkSettings();
+  void FillInSubtitleHeights(CSetting *pSetting, CGUISpinControlEx *pControl);
+  void FillInSubtitleFonts(CSetting *pSetting);
+  void FillInCharSets(CSetting *pSetting);
+  void FillInSkinFonts(CSetting *pSetting);
+  void FillInSoundSkins(CSetting *pSetting);
+  void FillInLanguages(CSetting *pSetting, const std::vector<CStdString> &languages = std::vector<CStdString>(), const std::vector<CStdString> &languageKeys = std::vector<CStdString>());
+  DisplayMode FillInScreens(CStdString strSetting, RESOLUTION res);
+  void FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange);
+  void FillInRefreshRates(CStdString strSetting, RESOLUTION res, bool UserChange);
+  void OnRefreshRateChanged(RESOLUTION resolution);
+  void FillInRegions(CSetting *pSetting);
+  void FillInStartupWindow(CSetting *pSetting);
+  void FillInViewModes(CSetting *pSetting, int windowID);
+  void FillInSortMethods(CSetting *pSetting, int windowID);
+  void FillInEpgGuideView(CSetting *pSetting);
+  void FillInPvrStartLastChannel(CSetting *pSetting);
+
+  void FillInSkinThemes(CSetting *pSetting);
+  void FillInSkinColors(CSetting *pSetting);
+
+  void FillInNetworkInterfaces(CSetting *pSetting, float groupWidth, int &iControlID);
+  void NetworkInterfaceChanged(void);
+
+  void FillInAudioDevices(CSetting* pSetting, bool Passthrough = false);
+
+  virtual void SetupControls();
+  CGUIControl* AddIntBasedSpinControl(CSetting *pSetting, float groupWidth, int &iControlID);
+  void CreateSettings();
+  void UpdateSettings();
+  void CheckForUpdates();
+  void FreeSettingsControls();
+  virtual void FreeControls();
+  virtual void OnClick(BaseSettingControlPtr pSettingControl);
+  virtual void OnSettingChanged(BaseSettingControlPtr pSettingControl);
+  CGUIControl* AddSetting(CSetting *pSetting, float width, int &iControlID);
+  BaseSettingControlPtr GetSetting(const CStdString &strSetting);
+
+  void ValidatePortNumber(BaseSettingControlPtr pSettingControl, const CStdString& userPort, const CStdString& privPort, bool listening=true);
+
+  std::vector<BaseSettingControlPtr> m_vecSettings;
+  int m_iSection;
+  int m_iScreen;
+  vecSettingsCategory m_vecSections;
+  CGUISpinControlEx *m_pOriginalSpin;
+  CGUIRadioButtonControl *m_pOriginalRadioButton;
+  CGUIButtonControl *m_pOriginalCategoryButton;
+  CGUIButtonControl *m_pOriginalButton;
+  CGUIEditControl *m_pOriginalEdit;
+  CGUIImage *m_pOriginalImage;
+
+  CStdString m_strErrorMessage;
+
+  CStdString m_strOldTrackFormat;
+  CStdString m_strOldTrackFormatRight;
+
+  std::map<CStdString, CStdString> m_AnalogAudioSinkMap;
+  std::map<CStdString, CStdString> m_DigitalAudioSinkMap;
+  std::map<CStdString, CStdString> m_SkinFontSetIDs;
+
+  bool m_returningFromSkinLoad; // true if we are returning from loading the skin
+
+  boost::shared_ptr<CGUIBaseSettingControl> m_delayedSetting; ///< Current delayed setting \sa CGUIBaseSettingControl::SetDelayed()
+  CStopWatch           m_delayedTimer;   ///< Delayed setting timer
+};
+
diff --git a/xbmc/settings/windows/GUIWindowSettingsProfile.cpp b/xbmc/settings/windows/GUIWindowSettingsProfile.cpp
new file mode 100644 (file)
index 0000000..4858317
--- /dev/null
@@ -0,0 +1,220 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIWindowSettingsProfile.h"
+#include "windows/GUIWindowFileManager.h"
+#include "settings/Profile.h"
+#include "Application.h"
+#include "dialogs/GUIDialogContextMenu.h"
+#include "settings/dialogs/GUIDialogProfileSettings.h"
+#include "network/Network.h"
+#include "utils/URIUtils.h"
+#include "utils/Weather.h"
+#include "GUIPassword.h"
+#include "windows/GUIWindowLoginScreen.h"
+#include "guilib/GUIWindowManager.h"
+#include "filesystem/Directory.h"
+#include "FileItem.h"
+#include "settings/Settings.h"
+#include "guilib/LocalizeStrings.h"
+
+using namespace XFILE;
+
+#define CONTROL_PROFILES 2
+#define CONTROL_LASTLOADED_PROFILE 3
+#define CONTROL_LOGINSCREEN 4
+
+CGUIWindowSettingsProfile::CGUIWindowSettingsProfile(void)
+    : CGUIWindow(WINDOW_SETTINGS_PROFILES, "SettingsProfile.xml")
+{
+  m_listItems = new CFileItemList;
+  m_loadType = KEEP_IN_MEMORY;
+}
+
+CGUIWindowSettingsProfile::~CGUIWindowSettingsProfile(void)
+{
+  delete m_listItems;
+}
+
+int CGUIWindowSettingsProfile::GetSelectedItem()
+{
+  CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_PROFILES);
+  g_windowManager.SendMessage(msg);
+
+  return msg.GetParam1();
+}
+
+void CGUIWindowSettingsProfile::OnPopupMenu(int iItem)
+{
+  if (iItem == (int)g_settings.GetNumProfiles())
+    return;
+
+  // popup the context menu
+  CContextButtons choices;
+  choices.Add(1, 20092); // Load profile
+  if (iItem > 0)
+    choices.Add(2, 117); // Delete
+
+  int choice = CGUIDialogContextMenu::ShowAndGetChoice(choices);
+  if (choice == 1)
+  {
+    unsigned iCtrlID = GetFocusedControlID();
+    g_application.StopPlaying();
+    CGUIMessage msg2(GUI_MSG_ITEM_SELECTED, g_windowManager.GetActiveWindow(), iCtrlID);
+    g_windowManager.SendMessage(msg2);
+    g_application.getNetwork().NetworkMessage(CNetwork::SERVICES_DOWN,1);
+    g_settings.LoadMasterForLogin();
+    CGUIWindowLoginScreen::LoadProfile(iItem);
+    return;
+  }
+
+  if (choice == 2)
+  {
+    if (g_settings.DeleteProfile(iItem))
+      iItem--;
+  }
+
+  LoadList();
+  CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(),CONTROL_PROFILES,iItem);
+  OnMessage(msg);
+}
+
+bool CGUIWindowSettingsProfile::OnMessage(CGUIMessage& message)
+{
+  switch ( message.GetMessage() )
+  {
+  case GUI_MSG_WINDOW_DEINIT:
+    {
+      CGUIWindow::OnMessage(message);
+      ClearListItems();
+      return true;
+    }
+    break;
+
+  case GUI_MSG_CLICKED:
+    {
+      int iControl = message.GetSenderId();
+      if (iControl == CONTROL_PROFILES)
+      {
+        int iAction = message.GetParam1();
+        if (
+          iAction == ACTION_SELECT_ITEM ||
+          iAction == ACTION_MOUSE_LEFT_CLICK ||
+          iAction == ACTION_CONTEXT_MENU ||
+          iAction == ACTION_MOUSE_RIGHT_CLICK
+        )
+        {
+          CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_PROFILES);
+          g_windowManager.SendMessage(msg);
+          int iItem = msg.GetParam1();
+          if (iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_RIGHT_CLICK)
+          {
+            //contextmenu
+            if (iItem <= (int)g_settings.GetNumProfiles() - 1)
+            {
+              OnPopupMenu(iItem);
+            }
+            return true;
+          }
+          else if (iItem < (int)g_settings.GetNumProfiles())
+          {
+            if (CGUIDialogProfileSettings::ShowForProfile(iItem))
+            {
+              LoadList();
+              CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), 2,iItem);
+              g_windowManager.SendMessage(msg);
+
+              return true;
+            }
+
+            return false;
+          }
+          else if (iItem > (int)g_settings.GetNumProfiles() - 1)
+          {
+            CDirectory::Create(URIUtils::AddFileToFolder(g_settings.GetUserDataFolder(),"profiles"));
+            if (CGUIDialogProfileSettings::ShowForProfile(g_settings.GetNumProfiles()))
+            {
+              LoadList();
+              CGUIMessage msg(GUI_MSG_ITEM_SELECT, GetID(), 2,iItem);
+              g_windowManager.SendMessage(msg);
+              return true;
+            }
+
+            return false;
+          }
+        }
+      }
+      else if (iControl == CONTROL_LOGINSCREEN)
+      {
+        g_settings.ToggleLoginScreen();
+        g_settings.SaveProfiles(PROFILES_FILE);
+        return true;
+      }
+    }
+    break;
+  }
+
+  return CGUIWindow::OnMessage(message);
+}
+
+void CGUIWindowSettingsProfile::LoadList()
+{
+  ClearListItems();
+
+  for (unsigned int i = 0; i < g_settings.GetNumProfiles(); i++)
+  {
+    const CProfile *profile = g_settings.GetProfile(i);
+    CFileItemPtr item(new CFileItem(profile->getName()));
+    item->SetLabel2(profile->getDate());
+    item->SetArt("thumb", profile->getThumb());
+    item->SetOverlayImage(profile->getLockMode() == LOCK_MODE_EVERYONE ? CGUIListItem::ICON_OVERLAY_NONE : CGUIListItem::ICON_OVERLAY_LOCKED);
+    m_listItems->Add(item);
+  }
+  {
+    CFileItemPtr item(new CFileItem(g_localizeStrings.Get(20058)));
+    m_listItems->Add(item);
+  }
+  CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_PROFILES, 0, 0, m_listItems);
+  OnMessage(msg);
+
+  if (g_settings.UsingLoginScreen())
+  {
+    CONTROL_SELECT(CONTROL_LOGINSCREEN);
+  }
+  else
+  {
+    CONTROL_DESELECT(CONTROL_LOGINSCREEN);
+  }
+}
+
+void CGUIWindowSettingsProfile::ClearListItems()
+{
+  CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_PROFILES);
+  g_windowManager.SendMessage(msg);
+
+  m_listItems->Clear();
+}
+
+void CGUIWindowSettingsProfile::OnInitWindow()
+{
+  LoadList();
+  CGUIWindow::OnInitWindow();
+}
+
diff --git a/xbmc/settings/windows/GUIWindowSettingsProfile.h b/xbmc/settings/windows/GUIWindowSettingsProfile.h
new file mode 100644 (file)
index 0000000..2e41ce5
--- /dev/null
@@ -0,0 +1,44 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIWindow.h"
+
+class CGUIWindowSettingsProfile :
+      public CGUIWindow
+{
+public:
+  CGUIWindowSettingsProfile(void);
+  virtual ~CGUIWindowSettingsProfile(void);
+  virtual bool OnMessage(CGUIMessage& message);
+
+protected:
+  virtual void OnInitWindow();
+  CFileItemList *m_listItems;
+
+  void OnPopupMenu(int iItem);
+  void DoRename(int iItem);
+  void DoOverwrite(int iItem);
+  int GetSelectedItem();
+  void LoadList();
+  void SetLastLoaded();
+  void ClearListItems();
+};
diff --git a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
new file mode 100644 (file)
index 0000000..7917b27
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "system.h"
+#include "GUIWindowSettingsScreenCalibration.h"
+#include "guilib/GUIMoverControl.h"
+#include "guilib/GUIResizeControl.h"
+#ifdef HAS_VIDEO_PLAYBACK
+#include "cores/VideoRenderers/RenderManager.h"
+#endif
+#include "Application.h"
+#include "settings/Settings.h"
+#include "settings/GUISettings.h"
+#include "guilib/GUIWindowManager.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/LocalizeStrings.h"
+#include "utils/log.h"
+#include "windowing/WindowingFactory.h"
+
+using namespace std;
+
+#define CONTROL_LABEL_ROW1  2
+#define CONTROL_LABEL_ROW2  3
+#define CONTROL_TOP_LEFT  8
+#define CONTROL_BOTTOM_RIGHT 9
+#define CONTROL_SUBTITLES  10
+#define CONTROL_PIXEL_RATIO  11
+#define CONTROL_VIDEO   20
+#define CONTROL_NONE   0
+
+CGUIWindowSettingsScreenCalibration::CGUIWindowSettingsScreenCalibration(void)
+    : CGUIWindow(WINDOW_SCREEN_CALIBRATION, "SettingsScreenCalibration.xml")
+{
+  m_needsScaling = false;         // we handle all the scaling
+}
+
+CGUIWindowSettingsScreenCalibration::~CGUIWindowSettingsScreenCalibration(void)
+{}
+
+
+bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
+{
+  switch (action.GetID())
+  {
+  case ACTION_CALIBRATE_SWAP_ARROWS:
+    {
+      NextControl();
+      return true;
+    }
+    break;
+
+  case ACTION_CALIBRATE_RESET:
+    {
+      CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
+      pDialog->SetHeading(20325);
+      CStdString strText;
+      strText.Format(g_localizeStrings.Get(20326).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].strMode.c_str());
+      pDialog->SetLine(0, strText);
+      pDialog->SetLine(1, 20327);
+      pDialog->SetChoice(0, 222);
+      pDialog->SetChoice(1, 186);
+      pDialog->DoModal();
+      if (pDialog->IsConfirmed())
+      {
+        g_graphicsContext.ResetScreenParameters(m_Res[m_iCurRes]);
+        ResetControls();
+      }
+      return true;
+    }
+    break;
+
+  case ACTION_CHANGE_RESOLUTION:
+    // choose the next resolution in our list
+    {
+      m_iCurRes = (m_iCurRes+1) % m_Res.size();
+      g_graphicsContext.SetVideoResolution(m_Res[m_iCurRes]);
+      ResetControls();
+      return true;
+    }
+    break;
+  }
+  return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
+}
+
+void CGUIWindowSettingsScreenCalibration::AllocResources(bool forceLoad)
+{
+  CGUIWindow::AllocResources(forceLoad);
+}
+
+void CGUIWindowSettingsScreenCalibration::FreeResources(bool forceUnload)
+{
+  CGUIWindow::FreeResources(forceUnload);
+}
+
+
+bool CGUIWindowSettingsScreenCalibration::OnMessage(CGUIMessage& message)
+{
+  switch ( message.GetMessage() )
+  {
+  case GUI_MSG_WINDOW_DEINIT:
+    {
+      g_settings.UpdateCalibrations();
+      g_settings.Save();
+      g_graphicsContext.SetCalibrating(false);
+      g_windowManager.ShowOverlay(OVERLAY_STATE_SHOWN);
+      // reset our screen resolution to what it was initially
+      g_graphicsContext.SetVideoResolution(g_guiSettings.m_LookAndFeelResolution);
+      // Inform the player so we can update the resolution
+#ifdef HAS_VIDEO_PLAYBACK
+      g_renderManager.Update(false);
+#endif
+      g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE);
+    }
+    break;
+
+  case GUI_MSG_WINDOW_INIT:
+    {
+      CGUIWindow::OnMessage(message);
+      g_windowManager.ShowOverlay(OVERLAY_STATE_HIDDEN);
+      g_graphicsContext.SetCalibrating(true);
+
+      // Get the allowable resolutions that we can calibrate...
+      m_Res.clear();
+      if (g_application.IsPlayingVideo())
+      { // don't allow resolution switching if we are playing a video
+
+#ifdef HAS_VIDEO_PLAYBACK
+        RESOLUTION res = g_renderManager.GetResolution();
+        g_graphicsContext.SetVideoResolution(res);
+        // Inform the renderer so we can update the resolution
+        g_renderManager.Update(false);
+#endif
+
+        m_iCurRes = 0;
+        m_Res.push_back(g_graphicsContext.GetVideoResolution());
+        SET_CONTROL_VISIBLE(CONTROL_VIDEO);
+      }
+      else
+      {
+        SET_CONTROL_HIDDEN(CONTROL_VIDEO);
+        m_iCurRes = (unsigned int)-1;
+        g_graphicsContext.GetAllowedResolutions(m_Res);
+        // find our starting resolution
+        m_iCurRes = FindCurrentResolution();
+      }
+      if (m_iCurRes==(unsigned int)-1)
+      {
+        CLog::Log(LOGERROR, "CALIBRATION: Reported current resolution: %d", (int)g_graphicsContext.GetVideoResolution());
+        CLog::Log(LOGERROR, "CALIBRATION: Could not determine current resolution, falling back to default");
+        m_iCurRes = 0;
+      }
+
+      // Setup the first control
+      m_iControl = CONTROL_TOP_LEFT;
+      ResetControls();
+      return true;
+    }
+    break;
+  case GUI_MSG_CLICKED:
+    {
+      // clicked - change the control...
+      NextControl();
+    }
+    break;
+  case GUI_MSG_NOTIFY_ALL:
+    {
+      if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE)
+      {
+        m_iCurRes = FindCurrentResolution();
+      }
+    }
+    break;
+  }
+  return CGUIWindow::OnMessage(message);
+}
+
+unsigned int CGUIWindowSettingsScreenCalibration::FindCurrentResolution()
+{
+  RESOLUTION curRes = g_graphicsContext.GetVideoResolution();
+  for (unsigned int i = 0; i < m_Res.size(); i++)
+  {
+    // If it's a CUSTOM (monitor) resolution, then g_graphicsContext.GetAllowedResolutions()
+    // returns just one entry with CUSTOM in it. Update that entry to point to the current
+    // CUSTOM resolution.
+    if (curRes>=RES_CUSTOM)
+    {
+      if (m_Res[i]==RES_CUSTOM)
+      {
+        m_Res[i] = curRes;
+        return i;
+      }
+    }
+    else if (m_Res[i] == g_graphicsContext.GetVideoResolution())
+      return i;
+  }
+  return 0;
+}
+
+void CGUIWindowSettingsScreenCalibration::NextControl()
+{ // set the old control invisible and not focused, and choose the next control
+  CGUIControl *pControl = (CGUIControl *)GetControl(m_iControl);
+  if (pControl)
+  {
+    pControl->SetVisible(false);
+    pControl->SetFocus(false);
+  }
+  // switch to the next control
+  m_iControl++;
+  if (m_iControl > CONTROL_PIXEL_RATIO)
+    m_iControl = CONTROL_TOP_LEFT;
+  // enable the new control
+  EnableControl(m_iControl);
+}
+
+void CGUIWindowSettingsScreenCalibration::EnableControl(int iControl)
+{
+  SET_CONTROL_VISIBLE(CONTROL_TOP_LEFT);
+  SET_CONTROL_VISIBLE(CONTROL_BOTTOM_RIGHT);
+  SET_CONTROL_VISIBLE(CONTROL_SUBTITLES);
+  SET_CONTROL_VISIBLE(CONTROL_PIXEL_RATIO);
+  SET_CONTROL_FOCUS(iControl, 0);
+}
+
+void CGUIWindowSettingsScreenCalibration::ResetControls()
+{
+  // disable the video control, so that our other controls take mouse clicks etc.
+  CONTROL_DISABLE(CONTROL_VIDEO);
+  // disable the UI calibration for our controls
+  // and set their limits
+  // also, set them to invisible if they don't have focus
+  CGUIMoverControl *pControl = (CGUIMoverControl*)GetControl(CONTROL_TOP_LEFT);
+  if (pControl)
+  {
+    pControl->SetLimits( -g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth / 4,
+                         -g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight / 4,
+                         g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth / 4,
+                         g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight / 4);
+    pControl->SetPosition((float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.left,
+                          (float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.top);
+    pControl->SetLocation(g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.left,
+                          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.top, false);
+  }
+  pControl = (CGUIMoverControl*)GetControl(CONTROL_BOTTOM_RIGHT);
+  if (pControl)
+  {
+    pControl->SetLimits(g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*3 / 4,
+                        g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*3 / 4,
+                        g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*5 / 4,
+                        g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*5 / 4);
+    pControl->SetPosition((float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.right - (int)pControl->GetWidth(),
+                          (float)g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.bottom - (int)pControl->GetHeight());
+    pControl->SetLocation(g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.right,
+                          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.bottom, false);
+  }
+  // Subtitles and OSD controls can only move up and down
+  pControl = (CGUIMoverControl*)GetControl(CONTROL_SUBTITLES);
+  if (pControl)
+  {
+    pControl->SetLimits(0, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*3 / 4,
+                        0, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*5 / 4);
+    pControl->SetPosition((g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pControl->GetWidth()) * 0.5f,
+                          g_settings.m_ResInfo[m_Res[m_iCurRes]].iSubtitles - pControl->GetHeight());
+    pControl->SetLocation(0, g_settings.m_ResInfo[m_Res[m_iCurRes]].iSubtitles, false);
+  }
+  // lastly the pixel ratio control...
+  CGUIResizeControl *pResize = (CGUIResizeControl*)GetControl(CONTROL_PIXEL_RATIO);
+  if (pResize)
+  {
+    pResize->SetLimits(g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*0.25f, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*0.5f,
+                       g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth*0.75f, g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight*0.5f);
+    pResize->SetHeight(g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight * 0.5f);
+    pResize->SetWidth(pResize->GetHeight() / g_settings.m_ResInfo[m_Res[m_iCurRes]].fPixelRatio);
+    pResize->SetPosition((g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pResize->GetWidth()) / 2,
+                         (g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight - pResize->GetHeight()) / 2);
+  }
+  // Enable the default control
+  EnableControl(m_iControl);
+}
+
+void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
+{
+  CStdString strStatus;
+  if (iControl == CONTROL_PIXEL_RATIO)
+  {
+    CGUIResizeControl *pControl = (CGUIResizeControl*)GetControl(CONTROL_PIXEL_RATIO);
+    if (pControl)
+    {
+      float fWidth = (float)pControl->GetWidth();
+      float fHeight = (float)pControl->GetHeight();
+      g_settings.m_ResInfo[m_Res[m_iCurRes]].fPixelRatio = fHeight / fWidth;
+      // recenter our control...
+      pControl->SetPosition((g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pControl->GetWidth()) / 2,
+                            (g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight - pControl->GetHeight()) / 2);
+      strStatus.Format("%s (%5.3f)", g_localizeStrings.Get(275).c_str(), g_settings.m_ResInfo[m_Res[m_iCurRes]].fPixelRatio);
+      SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 278);
+    }
+  }
+  else
+  {
+    CGUIMoverControl *pControl = (CGUIMoverControl*)GetControl(iControl);
+    if (pControl)
+    {
+      switch (iControl)
+      {
+      case CONTROL_TOP_LEFT:
+        {
+          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.left = pControl->GetXLocation();
+          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.top = pControl->GetYLocation();
+          strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(272).c_str(), pControl->GetXLocation(), pControl->GetYLocation());
+          SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
+        }
+        break;
+
+      case CONTROL_BOTTOM_RIGHT:
+        {
+          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.right = pControl->GetXLocation();
+          g_settings.m_ResInfo[m_Res[m_iCurRes]].Overscan.bottom = pControl->GetYLocation();
+          int iXOff1 = g_settings.m_ResInfo[m_Res[m_iCurRes]].iWidth - pControl->GetXLocation();
+          int iYOff1 = g_settings.m_ResInfo[m_Res[m_iCurRes]].iHeight - pControl->GetYLocation();
+          strStatus.Format("%s (%i,%i)", g_localizeStrings.Get(273).c_str(), iXOff1, iYOff1);
+          SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
+        }
+        break;
+
+      case CONTROL_SUBTITLES:
+        {
+          g_settings.m_ResInfo[m_Res[m_iCurRes]].iSubtitles = pControl->GetYLocation();
+          strStatus.Format("%s (%i)", g_localizeStrings.Get(274).c_str(), pControl->GetYLocation());
+          SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 277);
+        }
+        break;
+      }
+    }
+  }
+  // set the label control correctly
+  CStdString strText;
+  if (g_Windowing.IsFullScreen())
+    strText.Format("%ix%i@%.2f - %s | %s", g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenWidth,
+      g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenHeight, g_settings.m_ResInfo[m_Res[m_iCurRes]].fRefreshRate,
+      g_localizeStrings.Get(244).c_str(), strStatus.c_str());
+  else
+    strText.Format("%ix%i - %s | %s", g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenWidth,
+      g_settings.m_ResInfo[m_Res[m_iCurRes]].iScreenHeight,
+      g_localizeStrings.Get(242).c_str(), strStatus.c_str());
+
+  SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, strText);
+}
+
+void CGUIWindowSettingsScreenCalibration::FrameMove()
+{
+  //  g_Windowing.Get3DDevice()->Clear(0, NULL, D3DCLEAR_TARGET, 0, 0, 0);
+  m_iControl = GetFocusedControlID();
+  if (m_iControl >= 0)
+  {
+    UpdateFromControl(m_iControl);
+  }
+  else
+  {
+    SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, "");
+    SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, "");
+  }
+  CGUIWindow::FrameMove();
+}
+
+void CGUIWindowSettingsScreenCalibration::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
+{
+  MarkDirtyRegion();
+
+  for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
+    SET_CONTROL_HIDDEN(i);
+
+  m_needsScaling = true;
+  CGUIWindow::DoProcess(currentTime, dirtyregions);
+  m_needsScaling = false;
+
+  g_graphicsContext.SetRenderingResolution(m_Res[m_iCurRes], false);
+  g_graphicsContext.AddGUITransform();
+
+  // process the movers etc.
+  for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
+  {
+    SET_CONTROL_VISIBLE(i);
+    CGUIControl *control = (CGUIControl *)GetControl(i);
+    if (control)
+      control->DoProcess(currentTime, dirtyregions);
+  }
+  g_graphicsContext.RemoveTransform();
+}
+
+void CGUIWindowSettingsScreenCalibration::DoRender()
+{
+  // we set that we need scaling here to render so that anything else on screen scales correctly
+  m_needsScaling = true;
+  CGUIWindow::DoRender();
+  m_needsScaling = false;
+}
diff --git a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h
new file mode 100644 (file)
index 0000000..2ac9d9d
--- /dev/null
@@ -0,0 +1,48 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIWindow.h"
+
+class CGUIWindowSettingsScreenCalibration : public CGUIWindow
+{
+public:
+  CGUIWindowSettingsScreenCalibration(void);
+  virtual ~CGUIWindowSettingsScreenCalibration(void);
+  virtual bool OnMessage(CGUIMessage& message);
+  virtual bool OnAction(const CAction &action);
+  virtual void DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions);
+  virtual void FrameMove();
+  virtual void DoRender();
+  virtual void AllocResources(bool forceLoad = false);
+  virtual void FreeResources(bool forceUnLoad = false);
+
+protected:
+  unsigned int FindCurrentResolution();
+  void NextControl();
+  void ResetControls();
+  void EnableControl(int iControl);
+  void UpdateFromControl(int iControl);
+  UINT m_iCurRes;
+  std::vector<RESOLUTION> m_Res;
+  int m_iControl;
+  float m_fPixelRatioBoxHeight;
+};
diff --git a/xbmc/settings/windows/GUIWindowTestPattern.cpp b/xbmc/settings/windows/GUIWindowTestPattern.cpp
new file mode 100644 (file)
index 0000000..c8b36da
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *      Test patterns designed by Ofer LaOr - hometheater.co.il
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIWindowTestPattern.h"
+#include "settings/Settings.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/Key.h"
+
+CGUIWindowTestPattern::CGUIWindowTestPattern(void)
+    : CGUIWindow(WINDOW_TEST_PATTERN, "")
+{
+  m_needsScaling = false;
+}
+
+CGUIWindowTestPattern::~CGUIWindowTestPattern(void)
+{}
+
+
+bool CGUIWindowTestPattern::OnAction(const CAction &action)
+{
+  switch (action.GetID())
+  {
+  case ACTION_MOVE_UP:
+  case ACTION_MOVE_LEFT:
+    m_pattern = m_pattern > 0 ? m_pattern - 1 : TEST_PATTERNS_COUNT - 1;
+    SetInvalid();
+    return true;
+
+  case ACTION_MOVE_DOWN:
+  case ACTION_MOVE_RIGHT:
+    m_pattern = (m_pattern + 1) % TEST_PATTERNS_COUNT;
+    SetInvalid();
+    return true;
+  }
+  return CGUIWindow::OnAction(action); // base class to handle basic movement etc.
+}
+
+bool CGUIWindowTestPattern::OnMessage(CGUIMessage& message)
+{
+  switch (message.GetMessage())
+  {
+  case GUI_MSG_WINDOW_INIT:
+    m_pattern = 0;
+    m_bounceDirectionX = 1;
+    m_bounceDirectionY = 1;
+    m_bounceX = 0;
+    m_bounceY = 0;
+    m_blinkFrame = 0;
+    break;
+
+  }
+  return CGUIWindow::OnMessage(message);
+}
+
+void CGUIWindowTestPattern::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions)
+{
+  if (m_pattern == 0 || m_pattern == 4)
+    MarkDirtyRegion();
+  CGUIWindow::Process(currentTime, dirtyregions);
+  m_renderRegion.SetRect(0, 0, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight());
+}
+
+void CGUIWindowTestPattern::Render()
+{
+  BeginRender();
+
+  int top = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.top;
+  int bottom = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.bottom;
+  int left = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.left;
+  int right = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].Overscan.right;
+
+  switch (m_pattern)
+  {
+    case 0:
+      DrawContrastBrightnessPattern(top, left, bottom, right);
+      break;
+
+    case 1:
+      DrawVerticalLines(top, left, bottom, right);
+      break;
+
+    case 2:
+      DrawHorizontalLines(top, left, bottom, right);
+      break;
+
+    case 3:
+      DrawCheckers(top, left, bottom, right);
+      break;
+
+    case 4:
+      DrawBouncingRectangle(top, left, bottom, right);
+      break;
+  }
+
+  EndRender();
+
+  CGUIWindow::Render();
+}
+
diff --git a/xbmc/settings/windows/GUIWindowTestPattern.h b/xbmc/settings/windows/GUIWindowTestPattern.h
new file mode 100644 (file)
index 0000000..d2069bd
--- /dev/null
@@ -0,0 +1,59 @@
+#pragma once
+
+/*
+ *      Copyright (C) 2005-2013 Team XBMC
+ *      http://www.xbmc.org
+ *
+ *      Test patterns designed by Ofer LaOr - hometheater.co.il
+ *
+ *  This Program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2, or (at your option)
+ *  any later version.
+ *
+ *  This Program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with XBMC; see the file COPYING.  If not, see
+ *  <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIWindow.h"
+
+#define TEST_PATTERNS_COUNT 5
+#define TEST_PATTERNS_BOUNCE_SQUARE_SIZE 100
+#define TEST_PATTERNS_BLINK_CYCLE 100
+
+class CGUIWindowTestPattern : public CGUIWindow
+{
+public:
+  CGUIWindowTestPattern(void);
+  virtual ~CGUIWindowTestPattern(void);
+  virtual bool OnMessage(CGUIMessage& message);
+  virtual bool OnAction(const CAction &action);
+  virtual void Render();
+  virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
+
+protected:
+  virtual void DrawVerticalLines(int top, int left, int bottom, int right) = 0;
+  virtual void DrawHorizontalLines(int top, int left, int bottom, int right) = 0;
+  virtual void DrawCheckers(int top, int left, int bottom, int right) = 0;
+  virtual void DrawBouncingRectangle(int top, int left, int bottom, int right) = 0;
+  virtual void DrawContrastBrightnessPattern(int top, int left, int bottom, int right) = 0;
+  virtual void DrawCircle(int originX, int originY, int radius) = 0;
+  virtual void BeginRender() = 0;
+  virtual void EndRender() = 0;
+
+  int m_pattern;
+  int m_bounceX;
+  int m_bounceY;
+  int m_bounceDirectionX;
+  int m_bounceDirectionY;
+  int m_blinkFrame;
+};
+
+
diff --git a/xbmc/settings/windows/Makefile b/xbmc/settings/windows/Makefile
new file mode 100644 (file)
index 0000000..8d5c3e4
--- /dev/null
@@ -0,0 +1,11 @@
+SRCS=GUISettingControls.cpp \
+     GUIWindowSettings.cpp \
+     GUIWindowSettingsCategory.cpp \
+     GUIWindowSettingsProfile.cpp \
+     GUIWindowSettingsScreenCalibration.cpp \
+     GUIWindowTestPattern.cpp \
+
+LIB=settings_windows.a
+
+include ../../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
index ff1096c..eee5583 100644 (file)
@@ -725,6 +725,8 @@ CCdInfo* CCdIoSupport::GetCdInfo(char* cDeviceFileName)
       ti.isofs_size = 0;
       ti.nJolietLevel = 0;
       ti.nFrames = 0;
+      ti.nMins = 0;
+      ti.nSecs = 0;
       info->SetTrackInformation( i, ti );
       CLog::Log(LOGDEBUG, "cdio_track_msf for track %i failed, I give up.", i);
       delete info;
index e51449f..85c1791 100644 (file)
@@ -18,6 +18,7 @@
  *
  */
 
+#include "config.h"
 #include <limits.h>
 #if defined(TARGET_ANDROID)
 #include <unistd.h>
@@ -71,10 +72,16 @@ void CThread::SetThreadInfo()
   m_ThreadOpaque.LwpId = syscall(SYS_gettid);
 #endif
 
+#if defined(HAVE_PTHREAD_SETNAME_NP)
 #ifdef TARGET_DARWIN
 #if(__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30200)
   pthread_setname_np(m_ThreadName.c_str());
 #endif
+#else
+  pthread_setname_np(m_ThreadId, m_ThreadName.c_str());
+#endif
+#elif defined(HAVE_PTHREAD_SET_NAME_NP)
+  pthread_set_name_np(m_ThreadId, m_ThreadName.c_str());
 #endif
     
 #ifdef RLIMIT_NICE
index fdbff2a..cecad10 100644 (file)
@@ -609,10 +609,9 @@ bool CBitstreamConverter::Convert(uint8_t *pData, int iSize)
           }
           else
           {
-            Close();
             m_inputBuffer = pData;
             m_inputSize   = iSize;
-            CLog::Log(LOGERROR, "CBitstreamConverter::Convert error converting. disable converter\n");
+            CLog::Log(LOGERROR, "CBitstreamConverter::Convert error converting.\n");
           }
         }
         else
index 194b9a9..4e37b7d 100644 (file)
@@ -296,7 +296,7 @@ static void logicalToVisualBiDi(const CStdStringA& strSource, CStdStringA& strDe
     FriBidiChar* visual = (FriBidiChar*) malloc((len + 1) * sizeof(FriBidiChar));
     FriBidiLevel* levels = (FriBidiLevel*) malloc((len + 1) * sizeof(FriBidiLevel));
 
-    if (fribidi_log2vis(logical, len, &base, visual, NULL, NULL, NULL))
+    if (fribidi_log2vis(logical, len, &base, visual, NULL, NULL, levels))
     {
       // Removes bidirectional marks
       len = fribidi_remove_bidi_marks(visual, len, NULL, NULL, NULL);
index 3ac6d37..d663b68 100644 (file)
@@ -23,6 +23,10 @@ class CJob;
 
 #include <stddef.h>
 
+#define kJobTypeMediaFlags  "mediaflags"
+#define kJobTypeCacheImage  "cacheimage"
+#define kJobTypeDDSCompress "ddscompress"
+
 /*!
  \ingroup jobs
  \brief Callback interface for asynchronous jobs.
index 3467646..13f8f55 100644 (file)
@@ -168,6 +168,9 @@ CJobManager::CJobManager()
 {
   m_jobCounter = 0;
   m_running = true;
+  
+  for (unsigned int priority = CJob::PRIORITY_LOW; priority <= CJob::PRIORITY_HIGH; ++priority)
+    m_jobPause[priority] = false; // Set this priority to unpaused
 }
 
 void CJobManager::CancelJobs()
@@ -212,7 +215,7 @@ unsigned int CJobManager::AddJob(CJob *job, IJobCallback *callback, CJob::PRIORI
     m_jobCounter++;
 
   // create a work item for this job
-  CWorkItem work(job, m_jobCounter, callback);
+  CWorkItem work(job, m_jobCounter, priority, callback);
   m_jobQueue[priority].push_back(work);
 
   StartWorkers(priority);
@@ -264,12 +267,11 @@ CJob *CJobManager::PopJob()
   CSingleLock lock(m_section);
   for (int priority = CJob::PRIORITY_HIGH; priority >= CJob::PRIORITY_LOW; --priority)
   {
+    if (m_jobPause[priority]) // In case this priority is paused, skip it
+      continue;
+
     if (m_jobQueue[priority].size() && m_processing.size() < GetMaxWorkers(CJob::PRIORITY(priority)))
     {
-      // skip adding any paused types
-      if (!SkipPausedJobs((CJob::PRIORITY)priority))
-        return NULL;
-
       // pop the job off the queue
       CWorkItem job = m_jobQueue[priority].front();
       m_jobQueue[priority].pop_front();
@@ -283,60 +285,41 @@ CJob *CJobManager::PopJob()
   return NULL;
 }
 
-void CJobManager::Pause(const std::string &pausedType)
+void CJobManager::Pause(const CJob::PRIORITY &priority)
 {
   CSingleLock lock(m_section);
-  // just push it in so we get ref counting,
-  // the queue will resume when all Pause requests
-  // for a given type have been UnPaused.
-  m_pausedTypes.push_back(pausedType);
+  m_jobPause[priority] = true;
 }
 
-void CJobManager::UnPause(const std::string &pausedType)
+void CJobManager::UnPause(const CJob::PRIORITY &priority)
 {
   CSingleLock lock(m_section);
-  std::vector<std::string>::iterator i = find(m_pausedTypes.begin(), m_pausedTypes.end(), pausedType);
-  if (i != m_pausedTypes.end())
-    m_pausedTypes.erase(i);
+  m_jobPause[priority] = false;
 }
 
-bool CJobManager::IsPaused(const std::string &pausedType)
+bool CJobManager::IsPaused(const CJob::PRIORITY &priority) const
 {
   CSingleLock lock(m_section);
-  std::vector<std::string>::iterator i = find(m_pausedTypes.begin(), m_pausedTypes.end(), pausedType);
-  return (i != m_pausedTypes.end());
+  return m_jobPause[priority];
 }
 
-bool CJobManager::SkipPausedJobs(CJob::PRIORITY priority)
+bool CJobManager::IsProcessing(const CJob::PRIORITY &priority) const
 {
-  if (priority > CJob::PRIORITY_LOW)
-    return true;
-
-  // find the first unpaused job
-  JobQueue::iterator first_job = m_jobQueue[priority].begin();
-  for (; first_job != m_jobQueue[priority].end(); ++first_job)
-  {
-    std::vector<std::string>::iterator i = find(m_pausedTypes.begin(), m_pausedTypes.end(), first_job->m_job->GetType());
-    if (i == m_pausedTypes.end())
-      break; // found a job that can be performed
-  }
-  if (first_job == m_jobQueue[priority].end())
-    return false; // no jobs ready to go
+  CSingleLock lock(m_section);
 
-  // shunt all the paused ones to the back of the queue
-  for (JobQueue::iterator i = m_jobQueue[priority].begin(); i != first_job; i++)
+  for(Processing::const_iterator it = m_processing.begin(); it < m_processing.end(); it++)
   {
-    m_jobQueue[priority].push_back(*i);
-    m_jobQueue[priority].pop_front();
+    if (priority == it->m_priority)
+      return true;
   }
-  return true;
+  return false;
 }
 
-int CJobManager::IsProcessing(const std::string &pausedType)
+int CJobManager::IsProcessing(const std::string &pausedType) const
 {
   int jobsMatched = 0;
   CSingleLock lock(m_section);
-  for(Processing::iterator it = m_processing.begin(); it < m_processing.end(); it++)
+  for(Processing::const_iterator it = m_processing.begin(); it < m_processing.end(); it++)
   {
     if (pausedType == std::string(it->m_job->GetType()))
       jobsMatched++;
index fee13d6..c53ea68 100644 (file)
@@ -165,11 +165,12 @@ class CJobManager
   class CWorkItem
   {
   public:
-    CWorkItem(CJob *job, unsigned int id, IJobCallback *callback)
+    CWorkItem(CJob *job, unsigned int id, CJob::PRIORITY priority, IJobCallback *callback)
     {
       m_job = job;
       m_id = id;
       m_callback = callback;
+      m_priority = priority;
     }
     bool operator==(unsigned int jobID) const
     {
@@ -191,6 +192,7 @@ class CJobManager
     CJob         *m_job;
     unsigned int  m_id;
     IJobCallback *m_callback;
+    CJob::PRIORITY m_priority;
   };
 
 public:
@@ -225,37 +227,43 @@ public:
   void CancelJobs();
 
   /*!
-   \brief Suspends queueing of the specified type until unpaused
-   Useful to (for ex) stop queuing thumb jobs during video playback. Only affects PRIORITY_LOW or lower.
+   \brief Checks to see if any jobs of a specific type are currently processing.
+   \param pausedType Job type to search for
+   \return Number of matching jobs
+   \sa Pause(), UnPause(), IsPaused()
+   */
+  int IsProcessing(const std::string &pausedType) const;
+
+  /*!
+   \brief Suspends queueing of the specified priority until unpaused
+   Useful to (for ex) stop queuing thumb jobs during video start/playback.
    Does not affect currently processing jobs, use IsProcessing to see if any need to be waited on
-   Types accumulate, so more than one can be set at a time.
-   Refcounted, so UnPause() must be called once for each Pause().
-   \param pausedType only jobs of this type will be affected
+   \param priority only jobs of this priority will be affected
    \sa UnPause(), IsPaused(), IsProcessing()
    */
-  void Pause(const std::string &pausedType);
+  void Pause(const CJob::PRIORITY &priority);
 
   /*!
-   \brief Resumes queueing of the specified type
-   \param pausedType only jobs of this type will be affected
+   \brief Resumes queueing of the specified priority
+   \param priority only jobs of this priority will be affected
    \sa Pause(), IsPaused(), IsProcessing()
    */
-  void UnPause(const std::string &pausedType);
+  void UnPause(const CJob::PRIORITY &priority);
 
   /*!
-   \brief Checks if jobs of specified type are paused.
-   \param pausedType only jobs of this type will be affected
+   \brief Checks if jobs of specified priority are paused.
+   \param priority only jobs of this priority will be affected
    \sa Pause(), UnPause(), IsProcessing()
    */
-  bool IsPaused(const std::string &pausedType);
+  bool IsPaused(const CJob::PRIORITY &priority) const;
 
   /*!
-   \brief Checks to see if any jobs of a specific type are currently processing.
-   \param pausedType Job type to search for
-   \return Number of matching jobs
+   \brief Checks to see if any jobs with specific priority are currently processing.
+   \param priority to search for
+   \return true if processing jobs, else returns false
    \sa Pause(), UnPause(), IsPaused()
    */
-  int IsProcessing(const std::string &pausedType);
+  bool IsProcessing(const CJob::PRIORITY &priority) const;
 
 protected:
   friend class CJobWorker;
@@ -304,14 +312,6 @@ private:
   void RemoveWorker(const CJobWorker *worker);
   unsigned int GetMaxWorkers(CJob::PRIORITY priority) const;
 
-  /*! \brief skips over any paused jobs of given priority.
-   Moves any paused jobs at the front of the queue to the back of the
-   queue, allowing unpaused jobs to continue processing.
-   \param priority the priority queue to consider.
-   \return true if an unpaused job is available, false if no unpaused jobs are available.
-   */
-  bool SkipPausedJobs(CJob::PRIORITY priority);
-
   unsigned int m_jobCounter;
 
   typedef std::deque<CWorkItem>    JobQueue;
@@ -319,11 +319,11 @@ private:
   typedef std::vector<CJobWorker*> Workers;
 
   JobQueue   m_jobQueue[CJob::PRIORITY_HIGH+1];
+  bool       m_jobPause[CJob::PRIORITY_HIGH+1];
   Processing m_processing;
   Workers    m_workers;
 
   CCriticalSection m_section;
   CEvent           m_jobEvent;
   bool             m_running;
-  std::vector<std::string>  m_pausedTypes;
 };
index 6b19187..6839005 100644 (file)
@@ -96,14 +96,19 @@ bool CSaveFileStateJob::DoWork()
           videodatabase.SetVideoSettings(progressTrackingFile, g_settings.m_currentVideoSettings);
         }
 
-        if ((m_item.IsDVDImage() ||
-             m_item.IsDVDFile()    ) &&
-             m_item.HasVideoInfoTag() &&
-             m_item.GetVideoInfoTag()->HasStreamDetails())
+        if (m_item.HasVideoInfoTag() && m_item.GetVideoInfoTag()->HasStreamDetails())
         {
-          videodatabase.SetStreamDetailsForFile(m_item.GetVideoInfoTag()->m_streamDetails,progressTrackingFile);
-          updateListing = true;
+          CFileItem dbItem(m_item);
+          videodatabase.GetStreamDetails(dbItem); // Fetch stream details from the db (if any)
+
+          // Check whether the item's db streamdetails need updating
+          if (!dbItem.GetVideoInfoTag()->HasStreamDetails() || dbItem.GetVideoInfoTag()->m_streamDetails != m_item.GetVideoInfoTag()->m_streamDetails)
+          {
+            videodatabase.SetStreamDetailsForFile(m_item.GetVideoInfoTag()->m_streamDetails, progressTrackingFile);
+            updateListing = true;
+          }
         }
+
         // in order to properly update the the list, we need to update the stack item which is held in g_application.m_stackFileItemToUpdate
         if (m_item.HasProperty("stackFileItemToUpdate"))
         {
index 4c741ad..8166c31 100644 (file)
@@ -23,6 +23,8 @@
 #include "StreamUtils.h"
 #include "Variant.h"
 
+const float VIDEOASPECT_EPSILON = 0.025f;
+
 void CStreamDetail::Archive(CArchive &ar)
 {
   // there's nothing to do here, the type is stored externally and parent isn't stored
@@ -186,6 +188,49 @@ CStreamDetails& CStreamDetails::operator=(const CStreamDetails &that)
   return *this;
 }
 
+bool CStreamDetails::operator ==(const CStreamDetails &right) const
+{
+  if (this == &right) return true;
+
+  if (GetVideoStreamCount()    != right.GetVideoStreamCount() ||
+      GetAudioStreamCount()    != right.GetAudioStreamCount() ||
+      GetSubtitleStreamCount() != right.GetSubtitleStreamCount())
+    return false;
+
+  for (int iStream=1; iStream<=GetVideoStreamCount(); iStream++)
+  {
+    if (GetVideoCodec(iStream)    != right.GetVideoCodec(iStream)    ||
+        GetVideoWidth(iStream)    != right.GetVideoWidth(iStream)    ||
+        GetVideoHeight(iStream)   != right.GetVideoHeight(iStream)   ||
+        GetVideoDuration(iStream) != right.GetVideoDuration(iStream) ||
+        fabs(GetVideoAspect(iStream) - right.GetVideoAspect(iStream)) > VIDEOASPECT_EPSILON)
+      return false;
+  }
+
+  for (int iStream=1; iStream<=GetAudioStreamCount(); iStream++)
+  {
+    if (GetAudioCodec(iStream)    != right.GetAudioCodec(iStream)    ||
+        GetAudioLanguage(iStream) != right.GetAudioLanguage(iStream) ||
+        GetAudioChannels(iStream) != right.GetAudioChannels(iStream) )
+      return false;
+  }
+
+  for (int iStream=1; iStream<=GetSubtitleStreamCount(); iStream++)
+  {
+    if (GetSubtitleLanguage(iStream) != right.GetSubtitleLanguage(iStream) )
+      return false;
+  }
+
+  return true;
+}
+
+bool CStreamDetails::operator !=(const CStreamDetails &right) const
+{
+  if (this == &right) return false;
+
+  return !(*this == right);
+}
+
 CStreamDetail *CStreamDetails::NewStream(CStreamDetail::StreamType type)
 {
   CStreamDetail *retVal = NULL;
@@ -466,8 +511,6 @@ void CStreamDetails::DetermineBestStreams(void)
   }  /* for each */
 }
 
-const float VIDEOASPECT_EPSILON = 0.025f;
-
 CStdString CStreamDetails::VideoDimsToResolutionDescription(int iWidth, int iHeight)
 {
   if (iWidth == 0 || iHeight == 0)
index 4d8d42a..5d5e205 100644 (file)
@@ -92,6 +92,8 @@ public:
   CStreamDetails(const CStreamDetails &that);
   ~CStreamDetails() { Reset(); };
   CStreamDetails& operator=(const CStreamDetails &that);
+  bool operator ==(const CStreamDetails &that) const;
+  bool operator !=(const CStreamDetails &that) const;
 
   static CStdString VideoDimsToResolutionDescription(int iWidth, int iHeight);
   static CStdString VideoAspectToAspectDescription(float fAspect);
index ee8fb57..ba45469 100644 (file)
@@ -679,3 +679,15 @@ size_t StringUtils::utf8_strlen(const char *s)
   }
   return length;
 }
+
+std::string StringUtils::Paramify(const std::string &param)
+{
+  std::string result = param;
+  // escape backspaces
+  StringUtils::Replace(result, "\\", "\\\\");
+  // escape double quotes
+  StringUtils::Replace(result, "\"", "\\\"");
+
+  // add double quotes around the whole string
+  return "\"" + result + "\"";
+}
index 019dbe5..e4c9e5b 100644 (file)
@@ -114,6 +114,16 @@ public:
   static bool ValidateUUID(const CStdString &uuid); // NB only validates syntax
   static double CompareFuzzy(const CStdString &left, const CStdString &right);
   static int FindBestMatch(const CStdString &str, const CStdStringArray &strings, double &matchscore);
+
+  /*! \brief Escapes the given string to be able to be used as a parameter.
+
+   Escapes backslashes and double-quotes with an additional backslash and
+   adds double-quotes around the whole string.
+
+   \param param String to escape/paramify
+   \return Escaped/Paramified string
+   */
+  static std::string Paramify(const std::string &param);
 private:
   static CStdString m_lastUUID;
 };
index 97a7c26..c7374d4 100644 (file)
@@ -376,7 +376,6 @@ bool CTuxBoxUtil::ParseChannelsEnigma2(TiXmlElement *root, CFileItemList &items,
     }
     while(pNode)
     {
-      pIt = pNode->FirstChildElement("e2servicereference");
       pIt = pNode->FirstChildElement("e2servicename");
       CStdString bqtName = pIt->FirstChild()->Value();
       pIt = pNode->FirstChildElement("e2servicelist");
index 4663b85..cfb9de8 100644 (file)
@@ -840,11 +840,6 @@ bool URIUtils::IsVideoDb(const CStdString& strFile)
   return strFile.Left(8).Equals("videodb:");
 }
 
-bool URIUtils::IsLastFM(const CStdString& strFile)
-{
-  return strFile.Left(7).Equals("lastfm:");
-}
-
 bool URIUtils::IsBluray(const CStdString& strFile)
 {
   return strFile.Left(7).Equals("bluray:");
index 3e6f251..826489d 100644 (file)
@@ -69,7 +69,6 @@ public:
   static bool IsInAPK(const CStdString& strFile);
   static bool IsInZIP(const CStdString& strFile);
   static bool IsISO9660(const CStdString& strFile);
-  static bool IsLastFM(const CStdString& strFile);
   static bool IsLiveTV(const CStdString& strFile);
   static bool IsPVRRecording(const CStdString& strFile);
   static bool IsMultiPath(const CStdString& strPath);
index 7dbbcf6..465c6b6 100644 (file)
@@ -126,18 +126,29 @@ bool XMLUtils::GetBoolean(const TiXmlNode* pRootNode, const char* strTag, bool&
 
 bool XMLUtils::GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue)
 {
+  std::string value;
+  if (GetString(pRootNode, strTag, value))
+  {
+    strStringValue = value;
+    return true;
+  }
+  return false;
+}
+
+bool XMLUtils::GetString(const TiXmlNode* pRootNode, const char* strTag, std::string& strStringValue)
+{
   const TiXmlElement* pElement = pRootNode->FirstChildElement(strTag );
   if (!pElement) return false;
   const char* encoded = pElement->Attribute("urlencoded");
   const TiXmlNode* pNode = pElement->FirstChild();
   if (pNode != NULL)
   {
-    strStringValue = pNode->Value();
+    strStringValue = pNode->ValueStr();
     if (encoded && strcasecmp(encoded,"yes") == 0)
-      CURL::Decode(strStringValue);
+      strStringValue = CURL::Decode(strStringValue);
     return true;
   }
-  strStringValue.Empty();
+  strStringValue.clear();
   return false;
 }
 
index d258d4d..1ec2c4f 100644 (file)
@@ -39,6 +39,7 @@ public:
   static bool GetInt(const TiXmlNode* pRootNode, const char* strTag, int& iIntValue);
   static bool GetBoolean(const TiXmlNode* pRootNode, const char* strTag, bool& bBoolValue);
   static bool GetString(const TiXmlNode* pRootNode, const char* strTag, CStdString& strStringValue);
+  static bool GetString(const TiXmlNode* pRootNode, const char* strTag, std::string& strStringValue);
   /*! \brief Get multiple tags, concatenating the values together.
    Transforms
      <tag>value1</tag>
index 4844ab4..046e77f 100644 (file)
@@ -462,3 +462,12 @@ TEST(TestStringUtils, FindBestMatch)
   EXPECT_EQ(refint, varint);
   EXPECT_EQ(refdouble, vardouble);
 }
+
+TEST(TestStringUtils, Paramify)
+{
+  const char *input = "some, very \\ odd \"string\"";
+  const char *ref   = "\"some, very \\\\ odd \\\"string\\\"\"";
+
+  std::string result = StringUtils::Paramify(input);
+  EXPECT_STREQ(ref, result.c_str());
+}
index 87988bc..548af27 100644 (file)
@@ -277,11 +277,6 @@ TEST_F(TestURIUtils, IsISO9660)
   EXPECT_TRUE(URIUtils::IsISO9660("iso9660://path/to/file"));
 }
 
-TEST_F(TestURIUtils, IsLastFM)
-{
-  EXPECT_TRUE(URIUtils::IsLastFM("lastfm://path/to/file"));
-}
-
 TEST_F(TestURIUtils, IsLiveTV)
 {
   EXPECT_TRUE(URIUtils::IsLiveTV("tuxbox://path/to/file"));
@@ -487,7 +482,6 @@ TEST_F(TestURIUtils, ProtocolHasEncodedFilename)
   EXPECT_TRUE(URIUtils::ProtocolHasEncodedFilename("daap"));
   EXPECT_TRUE(URIUtils::ProtocolHasEncodedFilename("dav"));
   EXPECT_TRUE(URIUtils::ProtocolHasEncodedFilename("tuxbox"));
-  EXPECT_TRUE(URIUtils::ProtocolHasEncodedFilename("lastfm"));
   EXPECT_TRUE(URIUtils::ProtocolHasEncodedFilename("rss"));
   EXPECT_TRUE(URIUtils::ProtocolHasEncodedFilename("davs"));
 }
index cf35037..4727fe5 100644 (file)
@@ -3098,6 +3098,19 @@ CVideoInfoTag CVideoDatabase::GetDetailsByTypeAndId(VIDEODB_CONTENT_TYPE type, i
   return details;
 }
 
+bool CVideoDatabase::GetStreamDetails(CFileItem& item)
+{
+  if (!item.HasVideoInfoTag())
+    return false;
+
+  CVideoInfoTag *tag = item.GetVideoInfoTag();
+  if (tag->m_iFileId < 0)
+    tag->m_iFileId = GetFileId(item);
+
+  return GetStreamDetails(*tag);
+}
+
+
 bool CVideoDatabase::GetStreamDetails(CVideoInfoTag& tag) const
 {
   if (tag.m_iFileId < 0)
@@ -3718,6 +3731,33 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, map<int, map<string, string>
   return false;
 }
 
+bool CVideoDatabase::GetArtTypes(const std::string &mediaType, std::vector<std::string> &artTypes)
+{
+  try
+  {
+    if (NULL == m_pDB.get()) return false;
+    if (NULL == m_pDS.get()) return false;
+
+    CStdString sql = PrepareSQL("SELECT DISTINCT type FROM art WHERE media_type='%s'", mediaType.c_str());
+    int numRows = RunQuery(sql);
+    if (numRows <= 0)
+      return numRows == 0;
+
+    while (!m_pDS->eof())
+    {
+      artTypes.push_back(m_pDS->fv(0).get_asString());
+      m_pDS->next();
+    }
+    m_pDS->close();
+    return true;
+  }
+  catch (...)
+  {
+    CLog::Log(LOGERROR, "%s(%s) failed", __FUNCTION__, mediaType.c_str());
+  }
+  return false;
+}
+
 /// \brief GetStackTimes() obtains any saved video times for the stacked file
 /// \retval Returns true if the stack times exist, false otherwise.
 bool CVideoDatabase::GetStackTimes(const CStdString &filePath, vector<int> &times)
index dbd7654..75dbd2d 100644 (file)
@@ -483,6 +483,7 @@ public:
   void AddBookMarkForEpisode(const CVideoInfoTag& tag, const CBookmark& bookmark);
   void DeleteBookMarkForEpisode(const CVideoInfoTag& tag);
   bool GetResumePoint(CVideoInfoTag& tag);
+  bool GetStreamDetails(CFileItem& item);
   bool GetStreamDetails(CVideoInfoTag& tag) const;
 
   // scraper settings
@@ -681,6 +682,7 @@ public:
   bool GetArtForItem(int mediaId, const std::string &mediaType, std::map<std::string, std::string> &art);
   std::string GetArtForItem(int mediaId, const std::string &mediaType, const std::string &artType);
   bool GetTvShowSeasonArt(int mediaId, std::map<int, std::map<std::string, std::string> > &seasonArt);
+  bool GetArtTypes(const std::string &mediaType, std::vector<std::string> &artTypes);
 
   int AddTag(const std::string &tag);
   void AddTagToItem(int idItem, int idTag, const std::string &type);
index 093ed9b..6075ac4 100644 (file)
@@ -200,10 +200,9 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
 
   m_database->Open();
 
-  if (pItem->HasVideoInfoTag() && !pItem->GetVideoInfoTag()->HasStreamDetails() &&
-     (pItem->GetVideoInfoTag()->m_type == "movie" || pItem->GetVideoInfoTag()->m_type == "episode" || pItem->GetVideoInfoTag()->m_type == "musicvideo"))
+  if (pItem->HasVideoInfoTag() && !pItem->GetVideoInfoTag()->HasStreamDetails() && pItem->IsVideo())
   {
-    if (m_database->GetStreamDetails(*pItem->GetVideoInfoTag()))
+    if (m_database->GetStreamDetails(*pItem))
       pItem->SetInvalid();
   }
 
@@ -212,11 +211,7 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
   {
     FillLibraryArt(*pItem);
 
-    if (!pItem->GetVideoInfoTag()->m_type.empty()         &&
-         pItem->GetVideoInfoTag()->m_type != "movie"      &&
-         pItem->GetVideoInfoTag()->m_type != "tvshow"     &&
-         pItem->GetVideoInfoTag()->m_type != "episode"    &&
-         pItem->GetVideoInfoTag()->m_type != "musicvideo")
+    if (!pItem->IsVideo() && !pItem->m_bIsFolder)
     {
       m_database->Close();
       return true; // nothing else to be done
index 2d57be7..4befd6c 100644 (file)
@@ -24,8 +24,6 @@
 #include "utils/JobManager.h"
 #include "FileItem.h"
 
-#define kJobTypeMediaFlags "mediaflags"
-
 class CStreamDetails;
 class IStreamDetailsObserver;
 class CVideoDatabase;
index ccd465d..ac4d6a6 100644 (file)
@@ -162,7 +162,11 @@ void CGUIDialogAudioSubtitleSettings::AddAudioStreams(unsigned int id)
   {
     CStdString strItem;
     CStdString strName;
-    g_application.m_pPlayer->GetAudioStreamName(i, strName);
+
+    SPlayerAudioStreamInfo info;
+    g_application.m_pPlayer->GetAudioStreamInfo(i, info);
+
+    strName = info.name;
     if (strName.length() == 0)
       strName = "Unnamed";
 
@@ -198,17 +202,17 @@ void CGUIDialogAudioSubtitleSettings::AddSubtitleStreams(unsigned int id)
   // cycle through each subtitle and add it to our entry list
   for (int i = 0; i <= setting.max; ++i)
   {
+    SPlayerSubtitleStreamInfo info;
+    g_application.m_pPlayer->GetSubtitleStreamInfo(i, info);
+
     CStdString strItem;
-    CStdString strName;
-    g_application.m_pPlayer->GetSubtitleName(i, strName);
+    CStdString strName = info.name;
+
     if (strName.length() == 0)
       strName = "Unnamed";
 
-    CStdString strLanguage;
-    g_application.m_pPlayer->GetSubtitleLanguage(i, strLanguage);
-
-    if (strName != strLanguage)
-      strName.Format("%s [%s]", strName.c_str(), strLanguage.c_str());
+    if (strName != info.language)
+      strName.Format("%s [%s]", strName.c_str(), info.language.c_str());
 
     strItem.Format("%s (%i/%i)", strName.c_str(), i + 1, (int)setting.max + 1);
 
index d7fb944..1149cc6 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-#include "settings/GUIDialogSettings.h"
+#include "settings/dialogs/GUIDialogSettings.h"
 typedef std::vector<int> Features;
 
 class CGUIDialogAudioSubtitleSettings :
index a309738..4ed7715 100644 (file)
@@ -244,7 +244,7 @@ void CGUIDialogVideoBookmarks::AddBookmark(CVideoInfoTag* tag)
   else
     bookmark.playerState.Empty();
 
-  bookmark.player = CPlayerCoreFactory::GetPlayerName(g_application.GetCurrentPlayer());
+  bookmark.player = CPlayerCoreFactory::Get().GetPlayerName(g_application.GetCurrentPlayer());
 
   // create the thumbnail image
 #ifdef HAS_VIDEO_PLAYBACK
index 26d300e..e5314df 100644 (file)
@@ -620,6 +620,15 @@ string CGUIDialogVideoInfo::ChooseArtType(const CFileItem &videoItem, map<string
       artTypes.push_back(i->first);
   }
 
+  // add any art types that exist for other media items of the same type
+  vector<string> dbArtTypes;
+  db.GetArtTypes(videoItem.GetVideoInfoTag()->m_type, dbArtTypes);
+  for (vector<string>::const_iterator it = dbArtTypes.begin(); it != dbArtTypes.end(); it++)
+  {
+    if (find(artTypes.begin(), artTypes.end(), *it) == artTypes.end())
+      artTypes.push_back(*it);
+  }
+
   for (vector<string>::const_iterator i = artTypes.begin(); i != artTypes.end(); ++i)
   {
     string type = *i;
index 2837d48..2be7784 100644 (file)
@@ -20,7 +20,7 @@
  *
  */
 
-#include "settings/GUIDialogSettings.h"
+#include "settings/dialogs/GUIDialogSettings.h"
 
 class CGUIDialogVideoSettings :
       public CGUIDialogSettings
index a314ad9..fb11628 100644 (file)
@@ -226,10 +226,11 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
       CStdString sub, lang;
       if (g_settings.m_currentVideoSettings.m_SubtitleOn)
       {
-        g_application.m_pPlayer->GetSubtitleName(g_application.m_pPlayer->GetSubtitle(),sub);
-        g_application.m_pPlayer->GetSubtitleLanguage(g_application.m_pPlayer->GetSubtitle(),lang);
-        if (sub != lang)
-          sub.Format("%s [%s]", sub.c_str(), lang.c_str());
+        SPlayerSubtitleStreamInfo info;
+        g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
+        sub = info.name;
+        if (sub != info.language)
+          sub.Format("%s [%s]", sub.c_str(), info.language.c_str());
       }
       else
         sub = g_localizeStrings.Get(1223);
@@ -279,10 +280,11 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
       CStdString sub, lang;
       if (g_settings.m_currentVideoSettings.m_SubtitleOn)
       {
-        g_application.m_pPlayer->GetSubtitleName(g_settings.m_currentVideoSettings.m_SubtitleStream,sub);
-        g_application.m_pPlayer->GetSubtitleLanguage(g_settings.m_currentVideoSettings.m_SubtitleStream,lang);
-        if (sub != lang)
-          sub.Format("%s [%s]", sub.c_str(), lang.c_str());
+        SPlayerSubtitleStreamInfo info;
+        g_application.m_pPlayer->GetSubtitleStreamInfo(g_application.m_pPlayer->GetSubtitle(), info);
+        sub = info.name;
+        if (sub != info.language)
+          sub.Format("%s [%s]", sub.c_str(), info.language.c_str());
       }
       else
         sub = g_localizeStrings.Get(1223);
@@ -364,7 +366,9 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action)
         g_settings.m_currentVideoSettings.m_AudioStream = 0;
       g_application.m_pPlayer->SetAudioStream(g_settings.m_currentVideoSettings.m_AudioStream);    // Set the audio stream to the one selected
       CStdString aud;
-      g_application.m_pPlayer->GetAudioStreamName(g_settings.m_currentVideoSettings.m_AudioStream,aud);
+      SPlayerAudioStreamInfo info;
+      g_application.m_pPlayer->GetAudioStreamInfo(g_settings.m_currentVideoSettings.m_AudioStream, info);
+      aud = info.name;
       CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(460), aud, DisplTime, false, MsgTime);
       return true;
     }
@@ -947,10 +951,8 @@ void CGUIWindowFullScreen::FrameMove()
       OnMessage(msg);
     }
     // show sizing information
-    CRect SrcRect, DestRect;
-    float fAR;
-    g_application.m_pPlayer->GetVideoRect(SrcRect, DestRect);
-    g_application.m_pPlayer->GetVideoAspectRatio(fAR);
+    SPlayerVideoStreamInfo info;
+    g_application.m_pPlayer->GetVideoStreamInfo(info);
     {
       // Splitres scaling factor
       RESOLUTION res = g_graphicsContext.GetVideoResolution();
@@ -959,9 +961,9 @@ void CGUIWindowFullScreen::FrameMove()
 
       CStdString strSizing;
       strSizing.Format(g_localizeStrings.Get(245),
-                       (int)SrcRect.Width(), (int)SrcRect.Height(),
-                       (int)(DestRect.Width() * xscale), (int)(DestRect.Height() * yscale),
-                       g_settings.m_fZoomAmount, fAR*g_settings.m_fPixelRatio, 
+                       (int)info.SrcRect.Width(), (int)info.SrcRect.Height(),
+                       (int)(info.DestRect.Width() * xscale), (int)(info.DestRect.Height() * yscale),
+                       g_settings.m_fZoomAmount, info.videoAspectRatio*g_settings.m_fPixelRatio, 
                        g_settings.m_fPixelRatio, g_settings.m_fVerticalShift);
       CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW2);
       msg.SetLabel(strSizing);
@@ -1118,13 +1120,13 @@ void CGUIWindowFullScreen::RenderTTFSubtitles()
         y = (float) g_settings.m_ResInfo[res].iSubtitles - textHeight;
       else
       {
-        CRect SrcRect, DestRect;
-        g_application.m_pPlayer->GetVideoRect(SrcRect, DestRect);
+        SPlayerVideoStreamInfo info;
+        g_application.m_pPlayer->GetVideoStreamInfo(info);
 
         if ((subalign == SUBTITLE_ALIGN_TOP_INSIDE) || (subalign == SUBTITLE_ALIGN_TOP_OUTSIDE))
-          y = DestRect.y1;
+          y = info.DestRect.y1;
         else
-          y = DestRect.y2;
+          y = info.DestRect.y2;
 
         // use the manual distance to the screenbottom as an offset to the automatic location
         if ((subalign == SUBTITLE_ALIGN_BOTTOM_INSIDE) || (subalign == SUBTITLE_ALIGN_TOP_OUTSIDE))
index fed607c..4a1feb2 100644 (file)
@@ -55,7 +55,7 @@
 #include "settings/Settings.h"
 #include "settings/AdvancedSettings.h"
 #include "settings/GUISettings.h"
-#include "settings/GUIDialogContentSettings.h"
+#include "settings/dialogs/GUIDialogContentSettings.h"
 #include "guilib/LocalizeStrings.h"
 #include "utils/StringUtils.h"
 #include "utils/log.h"
@@ -456,6 +456,14 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2)
     needsRefresh = pDlgInfo->NeedRefresh();
     if (!needsRefresh)
       return pDlgInfo->HasUpdatedThumb();
+    // check if the item in the video info dialog has changed and if so, get the new item
+    else if (pDlgInfo->GetCurrentListItem() != NULL)
+    {
+      item = pDlgInfo->GetCurrentListItem().get();
+
+      if (item->IsVideoDb() && item->HasVideoInfoTag())
+        item->SetPath(item->GetVideoInfoTag()->GetPath());
+    }
   }
 
   // quietly return if Internet lookups are disabled
@@ -1241,10 +1249,10 @@ void CGUIWindowVideoBase::GetContextButtons(int itemNumber, CContextButtons &but
         if (item->IsVideoDb())
         {
           CFileItem item2(item->GetVideoInfoTag()->m_strFileNameAndPath, false);
-          CPlayerCoreFactory::GetPlayers(item2, vecCores);
+          CPlayerCoreFactory::Get().GetPlayers(item2, vecCores);
         }
         else
-          CPlayerCoreFactory::GetPlayers(*item, vecCores);
+          CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
         if (vecCores.size() > 1)
           buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213);
       }
@@ -1379,11 +1387,11 @@ bool CGUIWindowVideoBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
       if (item->IsVideoDb())
       {
         CFileItem item2(*item->GetVideoInfoTag());
-        CPlayerCoreFactory::GetPlayers(item2, vecCores);
+        CPlayerCoreFactory::Get().GetPlayers(item2, vecCores);
       }
       else
-        CPlayerCoreFactory::GetPlayers(*item, vecCores);
-      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
+        CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
+      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
       if (g_application.m_eForcedNextPlayer != EPC_NONE)
         OnClick(itemNumber);
       return true;
index f23e76b..2f39e83 100644 (file)
@@ -1649,7 +1649,8 @@ bool CGUIWindowVideoNav::ApplyWatchedFilter(CFileItemList &items)
     filterWatched = true;
   if (!items.IsVideoDb())
     filterWatched = true;
-  if (items.IsSmartPlayList() && items.GetContent() == "tvshows")
+  if (items.GetContent() == "tvshows" &&
+     (items.IsSmartPlayList() || (items.HasProperty("library.filter") && items.GetProperty("library.filter").asBoolean())))
     node = NODE_TYPE_TITLE_TVSHOWS; // so that the check below works
 
   int watchMode = g_settings.GetWatchMode(m_vecItems->GetContent());
index 8360ee4..b1e8bdf 100644 (file)
@@ -330,6 +330,15 @@ bool CGUIWindowVideoPlaylist::OnPlayMedia(int iItem)
     CFileItemPtr pItem = m_vecItems->Get(iItem);
     CStdString strPath = pItem->GetPath();
     g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
+    // need to update Playlist FileItem's startOffset and resumePoint based on GUIWindowVideoPlaylist FileItem
+    if (pItem->m_lStartOffset == STARTOFFSET_RESUME)
+    {
+      CFileItemPtr pPlaylistItem = g_playlistPlayer.GetPlaylist(PLAYLIST_VIDEO)[iItem];
+      pPlaylistItem->m_lStartOffset = pItem->m_lStartOffset;
+      if (pPlaylistItem->HasVideoInfoTag() && pItem->HasVideoInfoTag())
+        pPlaylistItem->GetVideoInfoTag()->m_resumePoint = pItem->GetVideoInfoTag()->m_resumePoint;
+    }
+    // now play item
     g_playlistPlayer.Play( iItem );
   }
   return true;
@@ -399,10 +408,10 @@ void CGUIWindowVideoPlaylist::GetContextButtons(int itemNumber, CContextButtons
       if (item->IsVideoDb())
       {
         CFileItem item2(item->GetVideoInfoTag()->m_strFileNameAndPath, false);
-        CPlayerCoreFactory::GetPlayers(item2, vecCores);
+        CPlayerCoreFactory::Get().GetPlayers(item2, vecCores);
       }
       else
-        CPlayerCoreFactory::GetPlayers(*item, vecCores);
+        CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
       if (vecCores.size() > 1)
         buttons.Add(CONTEXT_BUTTON_PLAY_WITH, 15213); // Play With...
 
@@ -444,11 +453,11 @@ bool CGUIWindowVideoPlaylist::OnContextButton(int itemNumber, CONTEXT_BUTTON but
       if (item->IsVideoDb())
       {
         CFileItem item2(*item->GetVideoInfoTag());
-        CPlayerCoreFactory::GetPlayers(item2, vecCores);
+        CPlayerCoreFactory::Get().GetPlayers(item2, vecCores);
       }
       else
-        CPlayerCoreFactory::GetPlayers(*item, vecCores);
-      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
+        CPlayerCoreFactory::Get().GetPlayers(*item, vecCores);
+      g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
       if (g_application.m_eForcedNextPlayer != EPC_NONE)
         OnClick(itemNumber);
       return true;
index de0b5b3..6778263 100644 (file)
@@ -103,9 +103,6 @@ CGUIViewState* CGUIViewState::GetViewState(int windowId, const CFileItemList& it
   if (items.IsPlayList())
     return new CGUIViewStateMusicPlaylist(items);
 
-  if (url.GetProtocol() == "lastfm")
-    return new CGUIViewStateMusicLastFM(items);
-
   if (items.GetPath() == "special://musicplaylists/")
     return new CGUIViewStateWindowMusicSongs(items);
 
index 6ff14ba..605a5db 100644 (file)
@@ -463,3 +463,10 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* val
   return ADDON_STATUS_UNKNOWN;
 }
 
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+//-----------------------------------------------------------------------------
+
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 763932d..51adae7 100644 (file)
@@ -299,3 +299,11 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* val
 {
   return ADDON_STATUS_OK;
 }
+
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+// !!! Add-on master function !!!
+//-----------------------------------------------------------------------------
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 6c7dc82..019e59b 100644 (file)
@@ -342,6 +342,14 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char* id, const void* value)
   return ADDON_STATUS_OK;
 }
 
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+//-----------------------------------------------------------------------------
+
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
+
 //-- GetSubModules ------------------------------------------------------------
 // Return any sub modules supported by this vis
 //-----------------------------------------------------------------------------
index 031aa1a..0e561aa 100644 (file)
@@ -599,3 +599,10 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* val
   return ADDON_STATUS_UNKNOWN;
 }
 
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+// !!! Add-on master function !!!
+//-----------------------------------------------------------------------------
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 6eaa59c..0834774 100644 (file)
@@ -238,3 +238,10 @@ extern "C"   unsigned int GetSubModules(char ***presets)
 {
   return 0; // this vis supports 0 sub modules
 }
+
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+//-----------------------------------------------------------------------------
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 1a12ca2..e818dc4 100644 (file)
@@ -297,3 +297,10 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* val
   return ADDON_STATUS_OK;
 }
 
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+// !!! Add-on master function !!!
+//-----------------------------------------------------------------------------
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 75668cd..4185e4e 100644 (file)
@@ -327,3 +327,11 @@ extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* val
 //    return ADDON_STATUS_OK;
   return ADDON_STATUS_UNKNOWN;
 }
+
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+// !!! Add-on master function !!!
+//-----------------------------------------------------------------------------
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index f28af8a..523ddbf 100644 (file)
@@ -449,3 +449,10 @@ extern "C" unsigned int GetSubModules(char ***names)
 {
   return 0; // this vis supports 0 sub modules
 }
+
+//-- Announce -----------------------------------------------------------------
+// Receive announcements from XBMC
+//-----------------------------------------------------------------------------
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 5ddb3cc..f881c0c 100644 (file)
@@ -84,7 +84,7 @@ double fastatof (const char *p, bool &b_validformat)
     }
     b_validformat = true;
 
-    int frac;
+    int frac = 0;
     double sign, value, scale;
 
     // Skip leading white space, if any.
index cc080ef..8582578 100644 (file)
@@ -372,3 +372,7 @@ extern "C" ADDON_STATUS ADDON_SetSetting (const char *strSetting, const void* va
 
     return ADDON_STATUS_OK;
 }
+
+extern "C" void ADDON_Announce(const char *flag, const char *sender, const char *message, const void *data)
+{
+}
index 12ca945..aaa2ede 100644 (file)
@@ -40,6 +40,7 @@
 #include "DllPaths_win32.h"
 #include "FileSystem/File.h"
 #include "utils/URIUtils.h"
+#include "powermanagement\PowerManager.h"
 
 // default Broadcom registy bits (setup when installing a CrystalHD card)
 #define BC_REG_PATH       "Software\\Broadcom\\MediaPC"
@@ -264,6 +265,9 @@ bool CWIN32Util::PowerManagement(PowerState State)
     return false;
   }
 
+  // process OnSleep() events. This is called in main thread.
+  g_powerManager.ProcessEvents();
+
   switch (State)
   {
   case POWERSTATE_HIBERNATE:
index 01345b1..425e3f1 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 #include "settings/AdvancedSettings.h"
-#include "settings/AppParamParser.h"
+#include "AppParamParser.h"
 #include "utils/CharsetConverter.h"
 #include "utils/log.h"
 #include "threads/platform/win/Win32Exception.h"
index 40f4773..c02cd78 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "WinSystem.h"
 #include "settings/Settings.h"
+#include "settings/GUISettings.h"
 
 using namespace std;
 
@@ -200,3 +201,13 @@ REFRESHRATE CWinSystemBase::DefaultRefreshRate(int screen, vector<REFRESHRATE> r
   }
   return bestmatch;
 }
+
+bool CWinSystemBase::UseLimitedColor()
+{
+#if defined(HAS_GL) || defined(HAS_DX)
+  static CSettingBool* setting = (CSettingBool*)g_guiSettings.GetSetting("videoscreen.limitedrange");
+  return setting->GetData();
+#else
+  return false;
+#endif
+}
index f15e7e8..118a076 100644 (file)
@@ -74,6 +74,9 @@ public:
   //some plattforms have api for gesture inertial scrolling - default to false and use the InertialScrollingHandler
   virtual bool HasInertialGestures(){ return false; }
 
+  //does the output expect limited color range (ie 16-235)
+  virtual bool UseLimitedColor();
+
   virtual bool Minimize() { return false; }
   virtual bool Restore() { return false; }
   virtual bool Hide() { return false; }
index 96535ab..8554961 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "system.h"
+#include <list>
 #include "windowing/WinEvents.h"
 #include "WinEventsAndroid.h"
 #include "input/XBMC_vkeys.h"
@@ -32,7 +33,7 @@ static CCriticalSection g_inputCond;
 
 PHANDLE_EVENT_FUNC CWinEventsBase::m_pEventFunc = NULL;
 
-static std::vector<XBMC_Event> events;
+static std::list<XBMC_Event> events;
 
 void CWinEventsAndroid::DeInit()
 {
@@ -51,20 +52,34 @@ void CWinEventsAndroid::MessagePush(XBMC_Event *newEvent)
 bool CWinEventsAndroid::MessagePump()
 {
   bool ret = false;
-  std::vector<XBMC_Event> copy_events;
-  { // double-buffered events to avoid constant locking for OnEvent().
-    CSingleLock lock(g_inputCond);
-    copy_events = events;
-    events.clear();
-  }
 
-  for (std::vector<XBMC_Event>::iterator iter = copy_events.begin(); iter != copy_events.end(); iter++)
+  // Do not always loop, only pump the initial queued count events. else if ui keep pushing 
+  // events the loop won't finish then it will block xbmc main message loop. 
+  for (int pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount) 
   {
-    ret |= g_application.OnEvent(*iter);
+  
+    // Pop up only one event per time since in App::OnEvent it may init modal dialog which init 
+    // deeper message loop and call the deeper MessagePump from there. 
+    XBMC_Event pumpEvent; 
+    { 
+      CSingleLock lock(g_inputCond); 
+      if (events.size() == 0) 
+        return ret; 
+      pumpEvent = events.front(); 
+      events.pop_front(); 
+    }  
+
+    ret |= g_application.OnEvent(pumpEvent);
 
-    if (iter->type == XBMC_MOUSEBUTTONUP)
+    if (pumpEvent.type == XBMC_MOUSEBUTTONUP)
       g_windowManager.SendMessage(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0);
   }
 
   return ret;
 }
+
+int CWinEventsAndroid::GetQueueSize()
+{
+  CSingleLock lock(g_inputCond);
+  return events.size();
+}
index ff8e44b..727eae4 100644 (file)
@@ -35,7 +35,9 @@ public:
   static bool MessagePump();
 
 protected:
+  static int  GetQueueSize();
 
 };
 
 #endif // WINDOW_EVENTS_ANDROID_H
+
index 0c6fe18..9773fc4 100644 (file)
@@ -43,7 +43,7 @@ CWinSystemEGL::CWinSystemEGL() : CWinSystemBase()
   m_config            = NULL;
 
   m_egl               = NULL;
-  m_iVSyncMode        = false;
+  m_iVSyncMode        = 0;
 }
 
 CWinSystemEGL::~CWinSystemEGL()
@@ -384,9 +384,12 @@ bool CWinSystemEGL::PresentRenderImpl(const CDirtyRegionList &dirty)
 
 void CWinSystemEGL::SetVSyncImpl(bool enable)
 {
-  m_iVSyncMode = enable;
-  if (!m_egl->SetVSync(m_display, m_iVSyncMode))
+  m_iVSyncMode = enable ? 10:0;
+  if (!m_egl->SetVSync(m_display, enable))
+  {
+    m_iVSyncMode = 0;
     CLog::Log(LOGERROR, "%s,Could not set egl vsync", __FUNCTION__);
+  }
 }
 
 void CWinSystemEGL::ShowOSMouse(bool show)
index 4c10e4b..fd0dc18 100644 (file)
@@ -75,7 +75,6 @@ protected:
   EGLConfig             m_config;
 
   CEGLWrapper           *m_egl;
-  bool                  m_iVSyncMode;
   std::string           m_extensions;
 };
 
index 87e0181..0602ae8 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "system.h"
+#include <list>
 #include "WinEventsIOS.h"
 #include "input/XBMC_vkeys.h"
 #include "Application.h"
@@ -31,7 +32,7 @@ static CCriticalSection g_inputCond;
 
 PHANDLE_EVENT_FUNC CWinEventsBase::m_pEventFunc = NULL;
 
-static std::vector<XBMC_Event> events;
+static std::list<XBMC_Event> events;
 
 void CWinEventsIOS::DeInit()
 {
@@ -51,18 +52,23 @@ void CWinEventsIOS::MessagePush(XBMC_Event *newEvent)
 bool CWinEventsIOS::MessagePump()
 {
   bool ret = false;
-  std::vector<XBMC_Event> copy_events;
-
-  { // double-buffered events to avoid constant locking for OnEvent().
-    CSingleLock lock(g_inputCond);
-    copy_events = events;
-    events.clear();
-  }  
   
-  for (vector<XBMC_Event>::iterator it = copy_events.begin(); it!=copy_events.end(); ++it)
+  // Do not always loop, only pump the initial queued count events. else if ui keep pushing
+  // events the loop won't finish then it will block xbmc main message loop.
+  for (int pumpEventCount = GetQueueSize(); pumpEventCount > 0; --pumpEventCount)
   {
-    XBMC_Event *pumpEvent = (XBMC_Event *)&*it;
-    if (pumpEvent->type == XBMC_USEREVENT)
+    // Pop up only one event per time since in App::OnEvent it may init modal dialog which init
+    // deeper message loop and call the deeper MessagePump from there.
+    XBMC_Event pumpEvent;
+    {
+      CSingleLock lock(g_inputCond);
+      if (events.size() == 0)
+        return ret;
+      pumpEvent = events.front();
+      events.pop_front();
+    }  
+    
+    if (pumpEvent.type == XBMC_USEREVENT)
     {
       // On ATV2, we push in events as a XBMC_USEREVENT,
       // the jbutton.which will be the keyID to translate using joystick.AppleRemote.xml
@@ -70,18 +76,18 @@ bool CWinEventsIOS::MessagePump()
       std::string joystickName = "AppleRemote";
       bool isAxis = false;
       float fAmount = 1.0;
-      unsigned char wKeyID = pumpEvent->jbutton.which;
-      unsigned int holdTime = pumpEvent->jbutton.holdTime;
+      unsigned char wKeyID = pumpEvent.jbutton.which;
+      unsigned int holdTime = pumpEvent.jbutton.holdTime;
 
       CLog::Log(LOGDEBUG,"CWinEventsIOS: Button press keyID = %i", wKeyID);
       ret |= g_application.ProcessJoystickEvent(joystickName, wKeyID, isAxis, fAmount, holdTime);
     }
     else
-      ret |= g_application.OnEvent(*it);
+      ret |= g_application.OnEvent(pumpEvent);
 
 //on ios touch devices - unfocus controls on finger lift
 #if !defined(TARGET_DARWIN_IOS_ATV2)
-    if (pumpEvent->type == XBMC_MOUSEBUTTONUP)
+    if (pumpEvent.type == XBMC_MOUSEBUTTONUP)
     {
       g_windowManager.SendMessage(GUI_MSG_UNFOCUS_ALL, 0, 0, 0, 0);
     }
index 92e9927..35fbec1 100644 (file)
@@ -777,16 +777,13 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory, bool updateFilterPa
   if (!GetDirectory(directory, items))
   {
     CLog::Log(LOGERROR,"CGUIMediaWindow::GetDirectory(%s) failed", strDirectory.c_str());
-    // if the directory is the same as the old directory, then we'll return
-    // false.  Else, we assume we can get the previous directory
-    if (strDirectory.Equals(strCurrentDirectory))
-      return false;
+    // Try to return to the previous directory, if not the same
+    // else fallback to root
+    if (strDirectory.Equals(strCurrentDirectory) || !Update(m_history.RemoveParentPath()))
+      Update(""); // Fallback to root
 
-    // We assume, we can get the parent
-    // directory again, but we have to
-    // return false to be able to eg. show
+    // Return false to be able to eg. show
     // an error message.
-    Update(m_history.RemoveParentPath());
     return false;
   }
 
@@ -848,7 +845,7 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory, bool updateFilterPa
       showLabel = 997;
     else if (iWindow == WINDOW_MUSIC_FILES)
       showLabel = 998;
-    else // WINDOW_FILES
+    else if (iWindow == WINDOW_FILES || iWindow == WINDOW_PROGRAMS)
       showLabel = 1026;
   }
   if (strDirectory.Equals("sources://video/"))
@@ -1167,21 +1164,18 @@ bool CGUIMediaWindow::HaveDiscOrConnection(const CStdString& strPath, int iDrive
 // \brief Shows a standard errormessage for a given pItem.
 void CGUIMediaWindow::ShowShareErrorMessage(CFileItem* pItem)
 {
-  if (pItem->m_bIsShareOrDrive)
-  {
-    int idMessageText=0;
-    const CURL& url=pItem->GetAsUrl();
-    const CStdString& strHostName=url.GetHostName();
-
-    if (pItem->m_iDriveType != CMediaSource::SOURCE_TYPE_REMOTE) //  Local shares incl. dvd drive
-      idMessageText=15300;
-    else if (url.GetProtocol() == "smb" && strHostName.IsEmpty()) //  smb workgroup
-      idMessageText=15303;
-    else  //  All other remote shares
-      idMessageText=15301;
-
-    CGUIDialogOK::ShowAndGetInput(220, idMessageText, 0, 0);
-  }
+  int idMessageText = 0;
+  CURL url(pItem->GetPath());
+  const CStdString& strHostName = url.GetHostName();
+
+  if (url.GetProtocol() == "smb" && strHostName.IsEmpty()) //  smb workgroup
+    idMessageText = 15303; // Workgroup not found
+  else if (pItem->m_iDriveType == CMediaSource::SOURCE_TYPE_REMOTE || URIUtils::IsRemote(pItem->GetPath()))
+    idMessageText = 15301; // Could not connect to network server
+  else
+    idMessageText = 15300; // Path not found or invalid
+
+  CGUIDialogOK::ShowAndGetInput(220, idMessageText, 0, 0);
 }
 
 // \brief The functon goes up one level in the directory tree
@@ -1609,7 +1603,11 @@ bool CGUIMediaWindow::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
     }
   case CONTEXT_BUTTON_PLUGIN_SETTINGS:
     {
-      CURL plugin(m_vecItems->Get(itemNumber)->GetPath());
+      CFileItemPtr item = m_vecItems->Get(itemNumber);
+      // CONTEXT_BUTTON_PLUGIN_SETTINGS can be called for plugin item
+      // or script item; or for the plugin directory current listing.
+      bool isPluginOrScriptItem = (item && (item->IsPlugin() || item->IsScript()));
+      CURL plugin(isPluginOrScriptItem ? item->GetPath() : m_vecItems->GetPath());
       ADDON::AddonPtr addon;
       if (CAddonMgr::Get().GetAddon(plugin.GetHostName(), addon))
         if (CGUIDialogAddonSettings::ShowAndGetInput(addon))
@@ -1688,7 +1686,8 @@ void CGUIMediaWindow::OnFilterItems(const CStdString &filter)
   
   m_viewControl.Clear();
   
-  CFileItemList items(m_vecItems->GetPath()); // use the original path - it'll likely be relied on for other things later.
+  CFileItemList items;
+  items.Copy(*m_vecItems, false); // use the original path - it'll likely be relied on for other things later.
   items.Append(*m_unfilteredItems);
   bool filtered = GetFilteredItems(filter, items);
 
index fbbe083..21df65b 100644 (file)
@@ -1002,7 +1002,7 @@ void CGUIWindowFileManager::OnPopupMenu(int list, int item, bool bContextDriven
 
   // determine available players
   VECPLAYERCORES vecCores;
-  CPlayerCoreFactory::GetPlayers(*pItem, vecCores);
+  CPlayerCoreFactory::Get().GetPlayers(*pItem, vecCores);
 
   // add the needed buttons
   CContextButtons choices;
@@ -1046,8 +1046,8 @@ void CGUIWindowFileManager::OnPopupMenu(int list, int item, bool bContextDriven
   if (btnid == 3)
   {
     VECPLAYERCORES vecCores;
-    CPlayerCoreFactory::GetPlayers(*pItem, vecCores);
-    g_application.m_eForcedNextPlayer = CPlayerCoreFactory::SelectPlayerDialog(vecCores);
+    CPlayerCoreFactory::Get().GetPlayers(*pItem, vecCores);
+    g_application.m_eForcedNextPlayer = CPlayerCoreFactory::Get().SelectPlayerDialog(vecCores);
     if (g_application.m_eForcedNextPlayer != EPC_NONE)
       OnStart(pItem.get());
   }
index 346dca0..3327fec 100644 (file)
@@ -22,9 +22,9 @@
 #include "Application.h"
 #include "ApplicationMessenger.h"
 #include "GUIWindowLoginScreen.h"
-#include "settings/GUIWindowSettingsProfile.h"
+#include "settings/windows/GUIWindowSettingsProfile.h"
 #include "dialogs/GUIDialogContextMenu.h"
-#include "settings/GUIDialogProfileSettings.h"
+#include "settings/dialogs/GUIDialogProfileSettings.h"
 #include "GUIPassword.h"
 #ifdef HAS_PYTHON
 #include "interfaces/python/XBPython.h"