DFDB004A1516408F005079A4 /* DirectoryCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00431516408F005079A4 /* DirectoryCache.cpp */; };
DFDB004B1516408F005079A4 /* FileCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00451516408F005079A4 /* FileCache.cpp */; };
DFDB004C1516408F005079A4 /* MemBufferCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00471516408F005079A4 /* MemBufferCache.cpp */; };
+ DFECFB69172D9E2B00A43CF7 /* GUIControlSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB67172D9E2B00A43CF7 /* GUIControlSettings.cpp */; };
+ DFECFB84172D9E4C00A43CF7 /* ISetting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB6A172D9E4C00A43CF7 /* ISetting.cpp */; };
+ DFECFB85172D9E4C00A43CF7 /* Setting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB6E172D9E4C00A43CF7 /* Setting.cpp */; };
+ DFECFB86172D9E4C00A43CF7 /* SettingAddon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB70172D9E4C00A43CF7 /* SettingAddon.cpp */; };
+ DFECFB87172D9E4C00A43CF7 /* SettingCategoryAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB72172D9E4C00A43CF7 /* SettingCategoryAccess.cpp */; };
+ DFECFB88172D9E4C00A43CF7 /* SettingConditions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB74172D9E4C00A43CF7 /* SettingConditions.cpp */; };
+ DFECFB89172D9E4C00A43CF7 /* SettingControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB76172D9E4C00A43CF7 /* SettingControl.cpp */; };
+ DFECFB8A172D9E4C00A43CF7 /* SettingDependency.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB78172D9E4C00A43CF7 /* SettingDependency.cpp */; };
+ DFECFB8B172D9E4C00A43CF7 /* SettingPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB7A172D9E4C00A43CF7 /* SettingPath.cpp */; };
+ DFECFB8C172D9E4C00A43CF7 /* SettingSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB7C172D9E4C00A43CF7 /* SettingSection.cpp */; };
+ DFECFB8D172D9E4C00A43CF7 /* SettingsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB7E172D9E4C00A43CF7 /* SettingsManager.cpp */; };
+ DFECFB8E172D9E4C00A43CF7 /* SettingUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB80172D9E4C00A43CF7 /* SettingUpdate.cpp */; };
+ DFECFB8F172D9E4C00A43CF7 /* SettingVisibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB82172D9E4C00A43CF7 /* SettingVisibility.cpp */; };
+ DFECFB92172D9E6D00A43CF7 /* BooleanLogic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB90172D9E6D00A43CF7 /* BooleanLogic.cpp */; };
+ DFECFBFD172DA58800A43CF7 /* NetworkServices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFBFB172DA58800A43CF7 /* NetworkServices.cpp */; };
DFFD594F1506B6300088DE4B /* IOSEAGLView.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFD594C1506B6300088DE4B /* IOSEAGLView.mm */; };
DFFEFBDB151606CB001294DC /* IOSScreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFEFBDA151606CB001294DC /* IOSScreenManager.mm */; };
DFFEFC2215160927001294DC /* IOSExternalTouchController.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFFEFC2115160927001294DC /* IOSExternalTouchController.mm */; };
F563530316E5442F00D21BAD /* UPnPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530116E5442F00D21BAD /* UPnPSettings.cpp */; };
F563530F16E5446300D21BAD /* GUIDialogContentSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563530716E5446300D21BAD /* GUIDialogContentSettings.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 */; };
F563532316E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F563531B16E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.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 */; };
- F56C7AF9131EC155000AD0F6 /* GUISettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D1131EC153000AD0F6 /* GUISettings.cpp */; };
F56C7AFA131EC155000AD0F6 /* AdvancedSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76D3131EC153000AD0F6 /* AdvancedSettings.cpp */; };
F56C7B00131EC155000AD0F6 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76DF131EC153000AD0F6 /* Settings.cpp */; };
F56C7B02131EC155000AD0F6 /* VideoSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C76E3131EC153000AD0F6 /* VideoSettings.cpp */; };
DFDB00461516408F005079A4 /* FileCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileCache.h; sourceTree = "<group>"; };
DFDB00471516408F005079A4 /* MemBufferCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemBufferCache.cpp; sourceTree = "<group>"; };
DFDB00481516408F005079A4 /* MemBufferCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemBufferCache.h; sourceTree = "<group>"; };
+ DFECFB67172D9E2B00A43CF7 /* GUIControlSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIControlSettings.cpp; path = windows/GUIControlSettings.cpp; sourceTree = "<group>"; };
+ DFECFB68172D9E2B00A43CF7 /* GUIControlSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIControlSettings.h; path = windows/GUIControlSettings.h; sourceTree = "<group>"; };
+ DFECFB6A172D9E4C00A43CF7 /* ISetting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISetting.cpp; sourceTree = "<group>"; };
+ DFECFB6B172D9E4C00A43CF7 /* ISetting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISetting.h; sourceTree = "<group>"; };
+ DFECFB6C172D9E4C00A43CF7 /* ISettingCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISettingCallback.h; sourceTree = "<group>"; };
+ DFECFB6D172D9E4C00A43CF7 /* ISettingCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISettingCreator.h; sourceTree = "<group>"; };
+ DFECFB6E172D9E4C00A43CF7 /* Setting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Setting.cpp; sourceTree = "<group>"; };
+ DFECFB6F172D9E4C00A43CF7 /* Setting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Setting.h; sourceTree = "<group>"; };
+ DFECFB70172D9E4C00A43CF7 /* SettingAddon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingAddon.cpp; sourceTree = "<group>"; };
+ DFECFB71172D9E4C00A43CF7 /* SettingAddon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingAddon.h; sourceTree = "<group>"; };
+ DFECFB72172D9E4C00A43CF7 /* SettingCategoryAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingCategoryAccess.cpp; sourceTree = "<group>"; };
+ DFECFB73172D9E4C00A43CF7 /* SettingCategoryAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingCategoryAccess.h; sourceTree = "<group>"; };
+ DFECFB74172D9E4C00A43CF7 /* SettingConditions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingConditions.cpp; sourceTree = "<group>"; };
+ DFECFB75172D9E4C00A43CF7 /* SettingConditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingConditions.h; sourceTree = "<group>"; };
+ DFECFB76172D9E4C00A43CF7 /* SettingControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingControl.cpp; sourceTree = "<group>"; };
+ DFECFB77172D9E4C00A43CF7 /* SettingControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingControl.h; sourceTree = "<group>"; };
+ DFECFB78172D9E4C00A43CF7 /* SettingDependency.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingDependency.cpp; sourceTree = "<group>"; };
+ DFECFB79172D9E4C00A43CF7 /* SettingDependency.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingDependency.h; sourceTree = "<group>"; };
+ DFECFB7A172D9E4C00A43CF7 /* SettingPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingPath.cpp; sourceTree = "<group>"; };
+ DFECFB7B172D9E4C00A43CF7 /* SettingPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingPath.h; sourceTree = "<group>"; };
+ DFECFB7C172D9E4C00A43CF7 /* SettingSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingSection.cpp; sourceTree = "<group>"; };
+ DFECFB7D172D9E4C00A43CF7 /* SettingSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingSection.h; sourceTree = "<group>"; };
+ DFECFB7E172D9E4C00A43CF7 /* SettingsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsManager.cpp; sourceTree = "<group>"; };
+ DFECFB7F172D9E4C00A43CF7 /* SettingsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsManager.h; sourceTree = "<group>"; };
+ DFECFB80172D9E4C00A43CF7 /* SettingUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingUpdate.cpp; sourceTree = "<group>"; };
+ DFECFB81172D9E4C00A43CF7 /* SettingUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingUpdate.h; sourceTree = "<group>"; };
+ DFECFB82172D9E4C00A43CF7 /* SettingVisibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingVisibility.cpp; sourceTree = "<group>"; };
+ DFECFB83172D9E4C00A43CF7 /* SettingVisibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingVisibility.h; sourceTree = "<group>"; };
+ DFECFB90172D9E6D00A43CF7 /* BooleanLogic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanLogic.cpp; sourceTree = "<group>"; };
+ DFECFB91172D9E6D00A43CF7 /* BooleanLogic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanLogic.h; sourceTree = "<group>"; };
+ DFECFBFB172DA58800A43CF7 /* NetworkServices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkServices.cpp; sourceTree = "<group>"; };
+ DFECFBFC172DA58800A43CF7 /* NetworkServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkServices.h; sourceTree = "<group>"; };
DFFD594B1506B6300088DE4B /* IOSEAGLView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSEAGLView.h; sourceTree = "<group>"; };
DFFD594C1506B6300088DE4B /* IOSEAGLView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSEAGLView.mm; sourceTree = "<group>"; };
DFFEFBD9151606CB001294DC /* IOSScreenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSScreenManager.h; sourceTree = "<group>"; };
F563530816E5446300D21BAD /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogContentSettings.h; path = dialogs/GUIDialogContentSettings.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>"; };
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>"; };
- 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>"; };
F56C76DF131EC153000AD0F6 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
F563530616E5444500D21BAD /* windows */ = {
isa = PBXGroup;
children = (
- F563531316E5446C00D21BAD /* GUISettingControls.cpp */,
- F563531416E5446C00D21BAD /* GUISettingControls.h */,
+ DFECFB67172D9E2B00A43CF7 /* GUIControlSettings.cpp */,
+ DFECFB68172D9E2B00A43CF7 /* GUIControlSettings.h */,
F563531516E5446C00D21BAD /* GUIWindowSettings.cpp */,
F563531616E5446C00D21BAD /* GUIWindowSettings.h */,
F563531716E5446C00D21BAD /* GUIWindowSettingsCategory.cpp */,
F56C7662131EC153000AD0F6 /* GUIDialogNetworkSetup.h */,
F56C7663131EC153000AD0F6 /* Network.cpp */,
F56C7664131EC153000AD0F6 /* Network.h */,
+ DFECFBFB172DA58800A43CF7 /* NetworkServices.cpp */,
+ DFECFBFC172DA58800A43CF7 /* NetworkServices.h */,
F56C7665131EC153000AD0F6 /* Socket.cpp */,
F56C7666131EC153000AD0F6 /* Socket.h */,
F56C7667131EC153000AD0F6 /* TCPServer.cpp */,
F56C76D4131EC153000AD0F6 /* AdvancedSettings.h */,
DF28EE14170E1E8D005FA9D2 /* DisplaySettings.cpp */,
DF28EE15170E1E8D005FA9D2 /* DisplaySettings.h */,
- F56C76D1131EC153000AD0F6 /* GUISettings.cpp */,
- F56C76D2131EC153000AD0F6 /* GUISettings.h */,
+ DFECFB6A172D9E4C00A43CF7 /* ISetting.cpp */,
+ DFECFB6B172D9E4C00A43CF7 /* ISetting.h */,
+ DFECFB6C172D9E4C00A43CF7 /* ISettingCallback.h */,
+ DFECFB6D172D9E4C00A43CF7 /* ISettingCreator.h */,
DF898FFC1709B95B00B35C21 /* ISettingsHandler.h */,
DF898FFD1709B95B00B35C21 /* ISubSettings.h */,
DF898FFE1709B95B00B35C21 /* MediaSettings.cpp */,
DF898FFF1709B95B00B35C21 /* MediaSettings.h */,
DF8990001709B95B00B35C21 /* MediaSourceSettings.cpp */,
DF8990011709B95B00B35C21 /* MediaSourceSettings.h */,
+ DFECFB6E172D9E4C00A43CF7 /* Setting.cpp */,
+ DFECFB6F172D9E4C00A43CF7 /* Setting.h */,
+ DFECFB70172D9E4C00A43CF7 /* SettingAddon.cpp */,
+ DFECFB71172D9E4C00A43CF7 /* SettingAddon.h */,
+ DFECFB72172D9E4C00A43CF7 /* SettingCategoryAccess.cpp */,
+ DFECFB73172D9E4C00A43CF7 /* SettingCategoryAccess.h */,
+ DFECFB74172D9E4C00A43CF7 /* SettingConditions.cpp */,
+ DFECFB75172D9E4C00A43CF7 /* SettingConditions.h */,
+ DFECFB76172D9E4C00A43CF7 /* SettingControl.cpp */,
+ DFECFB77172D9E4C00A43CF7 /* SettingControl.h */,
+ DFECFB78172D9E4C00A43CF7 /* SettingDependency.cpp */,
+ DFECFB79172D9E4C00A43CF7 /* SettingDependency.h */,
+ DFECFB7A172D9E4C00A43CF7 /* SettingPath.cpp */,
+ DFECFB7B172D9E4C00A43CF7 /* SettingPath.h */,
F56C76DF131EC153000AD0F6 /* Settings.cpp */,
F56C76E0131EC153000AD0F6 /* Settings.h */,
+ DFECFB7C172D9E4C00A43CF7 /* SettingSection.cpp */,
+ DFECFB7D172D9E4C00A43CF7 /* SettingSection.h */,
+ DFECFB7E172D9E4C00A43CF7 /* SettingsManager.cpp */,
+ DFECFB7F172D9E4C00A43CF7 /* SettingsManager.h */,
+ DFECFB80172D9E4C00A43CF7 /* SettingUpdate.cpp */,
+ DFECFB81172D9E4C00A43CF7 /* SettingUpdate.h */,
+ DFECFB82172D9E4C00A43CF7 /* SettingVisibility.cpp */,
+ DFECFB83172D9E4C00A43CF7 /* SettingVisibility.h */,
DF8990021709B95B00B35C21 /* SkinSettings.cpp */,
DF8990031709B95B00B35C21 /* SkinSettings.h */,
F56C76E3131EC153000AD0F6 /* VideoSettings.cpp */,
DF527785151BAFEE00B5B63B /* Base64.h */,
F56C7727131EC154000AD0F6 /* BitstreamStats.cpp */,
F56C7728131EC154000AD0F6 /* BitstreamStats.h */,
+ DFECFB90172D9E6D00A43CF7 /* BooleanLogic.cpp */,
+ DFECFB91172D9E6D00A43CF7 /* BooleanLogic.h */,
F56C7729131EC154000AD0F6 /* CharsetConverter.cpp */,
F56C772A131EC154000AD0F6 /* CharsetConverter.h */,
F56C772B131EC154000AD0F6 /* CPUInfo.cpp */,
F56C7AED131EC155000AD0F6 /* GUIViewStatePrograms.cpp in Sources */,
F56C7AEE131EC155000AD0F6 /* GUIWindowPrograms.cpp in Sources */,
F56C7AF3131EC155000AD0F6 /* RenderSystem.cpp in Sources */,
- F56C7AF9131EC155000AD0F6 /* GUISettings.cpp in Sources */,
F56C7AFA131EC155000AD0F6 /* AdvancedSettings.cpp in Sources */,
F56C7B00131EC155000AD0F6 /* Settings.cpp in Sources */,
F56C7B02131EC155000AD0F6 /* VideoSettings.cpp in Sources */,
F563530316E5442F00D21BAD /* UPnPSettings.cpp in Sources */,
F563530F16E5446300D21BAD /* GUIDialogContentSettings.cpp in Sources */,
F563531216E5446300D21BAD /* GUIDialogSettings.cpp in Sources */,
- F563531F16E5446C00D21BAD /* GUISettingControls.cpp in Sources */,
F563532016E5446C00D21BAD /* GUIWindowSettings.cpp in Sources */,
F563532116E5446C00D21BAD /* GUIWindowSettingsCategory.cpp in Sources */,
F563532316E5446C00D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
7C87B2EE162CE3F400EF897D /* PlayerController.cpp in Sources */,
F52CC6481713ADE900113454 /* DirectoryNodeGrouped.cpp in Sources */,
F52CC6D51713BE0D00113454 /* DirectoryNodeGrouped.cpp in Sources */,
+ DFECFB69172D9E2B00A43CF7 /* GUIControlSettings.cpp in Sources */,
+ DFECFB84172D9E4C00A43CF7 /* ISetting.cpp in Sources */,
+ DFECFB85172D9E4C00A43CF7 /* Setting.cpp in Sources */,
+ DFECFB86172D9E4C00A43CF7 /* SettingAddon.cpp in Sources */,
+ DFECFB87172D9E4C00A43CF7 /* SettingCategoryAccess.cpp in Sources */,
+ DFECFB88172D9E4C00A43CF7 /* SettingConditions.cpp in Sources */,
+ DFECFB89172D9E4C00A43CF7 /* SettingControl.cpp in Sources */,
+ DFECFB8A172D9E4C00A43CF7 /* SettingDependency.cpp in Sources */,
+ DFECFB8B172D9E4C00A43CF7 /* SettingPath.cpp in Sources */,
+ DFECFB8C172D9E4C00A43CF7 /* SettingSection.cpp in Sources */,
+ DFECFB8D172D9E4C00A43CF7 /* SettingsManager.cpp in Sources */,
+ DFECFB8E172D9E4C00A43CF7 /* SettingUpdate.cpp in Sources */,
+ DFECFB8F172D9E4C00A43CF7 /* SettingVisibility.cpp in Sources */,
+ DFECFB92172D9E6D00A43CF7 /* BooleanLogic.cpp in Sources */,
+ DFECFBFD172DA58800A43CF7 /* NetworkServices.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DFDB00271516403A005079A4 /* MemBufferCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDB00221516403A005079A4 /* MemBufferCache.cpp */; };
DFDD077316C0B58B000A1F73 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DFDD077216C0B58B000A1F73 /* Default-568h@2x.png */; };
DFE3505B1532535500F84CAA /* IOSKeyboardView.mm in Sources */ = {isa = PBXBuildFile; fileRef = DFE3505A1532535500F84CAA /* IOSKeyboardView.mm */; };
+ DFECFAEB172D9C7B00A43CF7 /* GUIControlSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAE9172D9C7B00A43CF7 /* GUIControlSettings.cpp */; };
+ DFECFB39172D9D2800A43CF7 /* ISetting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB1F172D9D2800A43CF7 /* ISetting.cpp */; };
+ DFECFB3A172D9D2800A43CF7 /* Setting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB23172D9D2800A43CF7 /* Setting.cpp */; };
+ DFECFB3B172D9D2800A43CF7 /* SettingAddon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB25172D9D2800A43CF7 /* SettingAddon.cpp */; };
+ DFECFB3C172D9D2800A43CF7 /* SettingCategoryAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB27172D9D2800A43CF7 /* SettingCategoryAccess.cpp */; };
+ DFECFB3D172D9D2800A43CF7 /* SettingConditions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB29172D9D2800A43CF7 /* SettingConditions.cpp */; };
+ DFECFB3E172D9D2800A43CF7 /* SettingControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB2B172D9D2800A43CF7 /* SettingControl.cpp */; };
+ DFECFB3F172D9D2800A43CF7 /* SettingDependency.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB2D172D9D2800A43CF7 /* SettingDependency.cpp */; };
+ DFECFB40172D9D2800A43CF7 /* SettingPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB2F172D9D2800A43CF7 /* SettingPath.cpp */; };
+ DFECFB41172D9D2800A43CF7 /* SettingSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB31172D9D2800A43CF7 /* SettingSection.cpp */; };
+ DFECFB42172D9D2800A43CF7 /* SettingsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB33172D9D2800A43CF7 /* SettingsManager.cpp */; };
+ DFECFB43172D9D2800A43CF7 /* SettingUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB35172D9D2800A43CF7 /* SettingUpdate.cpp */; };
+ DFECFB44172D9D2800A43CF7 /* SettingVisibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB37172D9D2800A43CF7 /* SettingVisibility.cpp */; };
+ DFECFB47172D9D4900A43CF7 /* BooleanLogic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB45172D9D4900A43CF7 /* BooleanLogic.cpp */; };
+ DFECFB4F172D9D8E00A43CF7 /* NetworkServices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB4D172D9D8E00A43CF7 /* NetworkServices.cpp */; };
DFF7A92315F7C62900D316E9 /* PltMimeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFF7A91F15F7C62900D316E9 /* PltMimeType.cpp */; };
DFF7A92415F7C62900D316E9 /* PltProtocolInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFF7A92115F7C62900D316E9 /* PltProtocolInfo.cpp */; };
DFF7A93215F7C73B00D316E9 /* NptPosixTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFF7A93015F7C73B00D316E9 /* NptPosixTime.cpp */; };
F52CC6361713AD5100113454 /* DirectoryNodeGrouped.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52CC6341713AD5100113454 /* DirectoryNodeGrouped.cpp */; };
F52CC6C71713BDEE00113454 /* DirectoryNodeGrouped.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52CC6C51713BDEE00113454 /* DirectoryNodeGrouped.cpp */; };
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 */; };
F56352ED16E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352E516E543F800D21BAD /* GUIWindowSettingsScreenCalibration.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 */; };
- F56C8AE6131F42ED000AD0F6 /* GUISettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86BC131F42EB000AD0F6 /* GUISettings.cpp */; };
F56C8AE7131F42ED000AD0F6 /* AdvancedSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86BE131F42EB000AD0F6 /* AdvancedSettings.cpp */; };
F56C8AED131F42ED000AD0F6 /* Settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86CA131F42EB000AD0F6 /* Settings.cpp */; };
F56C8AEF131F42ED000AD0F6 /* VideoSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56C86CE131F42EB000AD0F6 /* VideoSettings.cpp */; };
DFDD077216C0B58B000A1F73 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
DFE350591532535500F84CAA /* IOSKeyboardView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOSKeyboardView.h; sourceTree = "<group>"; };
DFE3505A1532535500F84CAA /* IOSKeyboardView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSKeyboardView.mm; sourceTree = "<group>"; };
+ DFECFAE9172D9C7B00A43CF7 /* GUIControlSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIControlSettings.cpp; path = windows/GUIControlSettings.cpp; sourceTree = "<group>"; };
+ DFECFAEA172D9C7B00A43CF7 /* GUIControlSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIControlSettings.h; path = windows/GUIControlSettings.h; sourceTree = "<group>"; };
+ DFECFB1F172D9D2800A43CF7 /* ISetting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISetting.cpp; sourceTree = "<group>"; };
+ DFECFB20172D9D2800A43CF7 /* ISetting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISetting.h; sourceTree = "<group>"; };
+ DFECFB21172D9D2800A43CF7 /* ISettingCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISettingCallback.h; sourceTree = "<group>"; };
+ DFECFB22172D9D2800A43CF7 /* ISettingCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISettingCreator.h; sourceTree = "<group>"; };
+ DFECFB23172D9D2800A43CF7 /* Setting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Setting.cpp; sourceTree = "<group>"; };
+ DFECFB24172D9D2800A43CF7 /* Setting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Setting.h; sourceTree = "<group>"; };
+ DFECFB25172D9D2800A43CF7 /* SettingAddon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingAddon.cpp; sourceTree = "<group>"; };
+ DFECFB26172D9D2800A43CF7 /* SettingAddon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingAddon.h; sourceTree = "<group>"; };
+ DFECFB27172D9D2800A43CF7 /* SettingCategoryAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingCategoryAccess.cpp; sourceTree = "<group>"; };
+ DFECFB28172D9D2800A43CF7 /* SettingCategoryAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingCategoryAccess.h; sourceTree = "<group>"; };
+ DFECFB29172D9D2800A43CF7 /* SettingConditions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingConditions.cpp; sourceTree = "<group>"; };
+ DFECFB2A172D9D2800A43CF7 /* SettingConditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingConditions.h; sourceTree = "<group>"; };
+ DFECFB2B172D9D2800A43CF7 /* SettingControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingControl.cpp; sourceTree = "<group>"; };
+ DFECFB2C172D9D2800A43CF7 /* SettingControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingControl.h; sourceTree = "<group>"; };
+ DFECFB2D172D9D2800A43CF7 /* SettingDependency.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingDependency.cpp; sourceTree = "<group>"; };
+ DFECFB2E172D9D2800A43CF7 /* SettingDependency.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingDependency.h; sourceTree = "<group>"; };
+ DFECFB2F172D9D2800A43CF7 /* SettingPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingPath.cpp; sourceTree = "<group>"; };
+ DFECFB30172D9D2800A43CF7 /* SettingPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingPath.h; sourceTree = "<group>"; };
+ DFECFB31172D9D2800A43CF7 /* SettingSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingSection.cpp; sourceTree = "<group>"; };
+ DFECFB32172D9D2800A43CF7 /* SettingSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingSection.h; sourceTree = "<group>"; };
+ DFECFB33172D9D2800A43CF7 /* SettingsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsManager.cpp; sourceTree = "<group>"; };
+ DFECFB34172D9D2800A43CF7 /* SettingsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsManager.h; sourceTree = "<group>"; };
+ DFECFB35172D9D2800A43CF7 /* SettingUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingUpdate.cpp; sourceTree = "<group>"; };
+ DFECFB36172D9D2800A43CF7 /* SettingUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingUpdate.h; sourceTree = "<group>"; };
+ DFECFB37172D9D2800A43CF7 /* SettingVisibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingVisibility.cpp; sourceTree = "<group>"; };
+ DFECFB38172D9D2800A43CF7 /* SettingVisibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingVisibility.h; sourceTree = "<group>"; };
+ DFECFB45172D9D4900A43CF7 /* BooleanLogic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanLogic.cpp; sourceTree = "<group>"; };
+ DFECFB46172D9D4900A43CF7 /* BooleanLogic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanLogic.h; sourceTree = "<group>"; };
+ DFECFB4D172D9D8E00A43CF7 /* NetworkServices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkServices.cpp; sourceTree = "<group>"; };
+ DFECFB4E172D9D8E00A43CF7 /* NetworkServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkServices.h; sourceTree = "<group>"; };
DFF7A91F15F7C62900D316E9 /* PltMimeType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PltMimeType.cpp; sourceTree = "<group>"; };
DFF7A92015F7C62900D316E9 /* PltMimeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PltMimeType.h; sourceTree = "<group>"; };
DFF7A92115F7C62900D316E9 /* PltProtocolInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PltProtocolInfo.cpp; 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>"; };
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>"; };
- 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>"; };
F56C86CA131F42EB000AD0F6 /* Settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Settings.cpp; sourceTree = "<group>"; };
F56352DB16E543DE00D21BAD /* windows */ = {
isa = PBXGroup;
children = (
- F56352DD16E543F800D21BAD /* GUISettingControls.cpp */,
- F56352DE16E543F800D21BAD /* GUISettingControls.h */,
+ DFECFAE9172D9C7B00A43CF7 /* GUIControlSettings.cpp */,
+ DFECFAEA172D9C7B00A43CF7 /* GUIControlSettings.h */,
F56352DF16E543F800D21BAD /* GUIWindowSettings.cpp */,
F56352E016E543F800D21BAD /* GUIWindowSettings.h */,
F56352E116E543F800D21BAD /* GUIWindowSettingsCategory.cpp */,
F56C8645131F42EB000AD0F6 /* GUIDialogNetworkSetup.h */,
F56C8646131F42EB000AD0F6 /* Network.cpp */,
F56C8647131F42EB000AD0F6 /* Network.h */,
+ DFECFB4D172D9D8E00A43CF7 /* NetworkServices.cpp */,
+ DFECFB4E172D9D8E00A43CF7 /* NetworkServices.h */,
F56C8648131F42EB000AD0F6 /* Socket.cpp */,
F56C8649131F42EB000AD0F6 /* Socket.h */,
F56C864A131F42EB000AD0F6 /* TCPServer.cpp */,
F56C86BF131F42EB000AD0F6 /* AdvancedSettings.h */,
DF28EE0A170E1E78005FA9D2 /* DisplaySettings.cpp */,
DF28EE0B170E1E78005FA9D2 /* DisplaySettings.h */,
- F56C86BC131F42EB000AD0F6 /* GUISettings.cpp */,
- F56C86BD131F42EB000AD0F6 /* GUISettings.h */,
+ DFECFB1F172D9D2800A43CF7 /* ISetting.cpp */,
+ DFECFB20172D9D2800A43CF7 /* ISetting.h */,
+ DFECFB21172D9D2800A43CF7 /* ISettingCallback.h */,
+ DFECFB22172D9D2800A43CF7 /* ISettingCreator.h */,
DF898FBA1709B8E600B35C21 /* ISettingsHandler.h */,
DF898FBB1709B8E600B35C21 /* ISubSettings.h */,
DF898FBC1709B8E600B35C21 /* MediaSettings.cpp */,
DF898FBD1709B8E600B35C21 /* MediaSettings.h */,
DF898FBE1709B8E600B35C21 /* MediaSourceSettings.cpp */,
DF898FBF1709B8E600B35C21 /* MediaSourceSettings.h */,
+ DFECFB23172D9D2800A43CF7 /* Setting.cpp */,
+ DFECFB24172D9D2800A43CF7 /* Setting.h */,
+ DFECFB25172D9D2800A43CF7 /* SettingAddon.cpp */,
+ DFECFB26172D9D2800A43CF7 /* SettingAddon.h */,
+ DFECFB27172D9D2800A43CF7 /* SettingCategoryAccess.cpp */,
+ DFECFB28172D9D2800A43CF7 /* SettingCategoryAccess.h */,
+ DFECFB29172D9D2800A43CF7 /* SettingConditions.cpp */,
+ DFECFB2A172D9D2800A43CF7 /* SettingConditions.h */,
+ DFECFB2B172D9D2800A43CF7 /* SettingControl.cpp */,
+ DFECFB2C172D9D2800A43CF7 /* SettingControl.h */,
+ DFECFB2D172D9D2800A43CF7 /* SettingDependency.cpp */,
+ DFECFB2E172D9D2800A43CF7 /* SettingDependency.h */,
+ DFECFB2F172D9D2800A43CF7 /* SettingPath.cpp */,
+ DFECFB30172D9D2800A43CF7 /* SettingPath.h */,
F56C86CA131F42EB000AD0F6 /* Settings.cpp */,
F56C86CB131F42EB000AD0F6 /* Settings.h */,
+ DFECFB31172D9D2800A43CF7 /* SettingSection.cpp */,
+ DFECFB32172D9D2800A43CF7 /* SettingSection.h */,
+ DFECFB33172D9D2800A43CF7 /* SettingsManager.cpp */,
+ DFECFB34172D9D2800A43CF7 /* SettingsManager.h */,
+ DFECFB35172D9D2800A43CF7 /* SettingUpdate.cpp */,
+ DFECFB36172D9D2800A43CF7 /* SettingUpdate.h */,
+ DFECFB37172D9D2800A43CF7 /* SettingVisibility.cpp */,
+ DFECFB38172D9D2800A43CF7 /* SettingVisibility.h */,
DF898FC01709B8E600B35C21 /* SkinSettings.cpp */,
DF898FC11709B8E600B35C21 /* SkinSettings.h */,
F56C86CE131F42EB000AD0F6 /* VideoSettings.cpp */,
DF52775D151BAFA000B5B63B /* Base64.h */,
F56C8716131F42EC000AD0F6 /* BitstreamStats.cpp */,
F56C8717131F42EC000AD0F6 /* BitstreamStats.h */,
+ DFECFB45172D9D4900A43CF7 /* BooleanLogic.cpp */,
+ DFECFB46172D9D4900A43CF7 /* BooleanLogic.h */,
F56C8718131F42EC000AD0F6 /* CharsetConverter.cpp */,
F56C8719131F42EC000AD0F6 /* CharsetConverter.h */,
F56C871A131F42EC000AD0F6 /* CPUInfo.cpp */,
F56C8ADC131F42ED000AD0F6 /* GUIWindowPrograms.cpp in Sources */,
F56C8ADF131F42ED000AD0F6 /* RenderSystemGLES.cpp in Sources */,
F56C8AE0131F42ED000AD0F6 /* RenderSystem.cpp in Sources */,
- F56C8AE6131F42ED000AD0F6 /* GUISettings.cpp in Sources */,
F56C8AE7131F42ED000AD0F6 /* AdvancedSettings.cpp in Sources */,
F56C8AED131F42ED000AD0F6 /* Settings.cpp in Sources */,
F56C8AEF131F42ED000AD0F6 /* VideoSettings.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 */,
F56352ED16E543F800D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
7C87B2DA162CE3C300EF897D /* PlayerController.cpp in Sources */,
F52CC6361713AD5100113454 /* DirectoryNodeGrouped.cpp in Sources */,
F52CC6C71713BDEE00113454 /* DirectoryNodeGrouped.cpp in Sources */,
+ DFECFAEB172D9C7B00A43CF7 /* GUIControlSettings.cpp in Sources */,
+ DFECFB39172D9D2800A43CF7 /* ISetting.cpp in Sources */,
+ DFECFB3A172D9D2800A43CF7 /* Setting.cpp in Sources */,
+ DFECFB3B172D9D2800A43CF7 /* SettingAddon.cpp in Sources */,
+ DFECFB3C172D9D2800A43CF7 /* SettingCategoryAccess.cpp in Sources */,
+ DFECFB3D172D9D2800A43CF7 /* SettingConditions.cpp in Sources */,
+ DFECFB3E172D9D2800A43CF7 /* SettingControl.cpp in Sources */,
+ DFECFB3F172D9D2800A43CF7 /* SettingDependency.cpp in Sources */,
+ DFECFB40172D9D2800A43CF7 /* SettingPath.cpp in Sources */,
+ DFECFB41172D9D2800A43CF7 /* SettingSection.cpp in Sources */,
+ DFECFB42172D9D2800A43CF7 /* SettingsManager.cpp in Sources */,
+ DFECFB43172D9D2800A43CF7 /* SettingUpdate.cpp in Sources */,
+ DFECFB44172D9D2800A43CF7 /* SettingVisibility.cpp in Sources */,
+ DFECFB47172D9D4900A43CF7 /* BooleanLogic.cpp in Sources */,
+ DFECFB4F172D9D8E00A43CF7 /* NetworkServices.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
18B7C8A0129423A7009E7A26 /* MusicInfoTagLoaderSPC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C87E129423A7009E7A26 /* MusicInfoTagLoaderSPC.cpp */; };
18B7C8A1129423A7009E7A26 /* MusicInfoTagLoaderWav.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C880129423A7009E7A26 /* MusicInfoTagLoaderWav.cpp */; };
18B7C8A4129423A7009E7A26 /* MusicInfoTagLoaderYM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C886129423A7009E7A26 /* MusicInfoTagLoaderYM.cpp */; };
- 18B7C8C412942451009E7A26 /* GUISettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8C212942451009E7A26 /* GUISettings.cpp */; };
18B7C8D712942546009E7A26 /* ButtonTranslator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8CB12942546009E7A26 /* ButtonTranslator.cpp */; };
18B7C8D812942546009E7A26 /* KeyboardLayoutConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8CD12942546009E7A26 /* KeyboardLayoutConfiguration.cpp */; };
18B7C8D912942546009E7A26 /* KeyboardStat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C8CF12942546009E7A26 /* KeyboardStat.cpp */; };
DFD5812616C828500008EEA0 /* DAVFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFD5812316C828500008EEA0 /* DAVFile.cpp */; };
DFD928F316384B6800709DAE /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFD928F116384B6800709DAE /* Timer.cpp */; };
DFDA3153160E34230047A626 /* DVDOverlayCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFDA3152160E34230047A626 /* DVDOverlayCodec.cpp */; };
+ DFECFADF172D9C5100A43CF7 /* GUIControlSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFADD172D9C5100A43CF7 /* GUIControlSettings.cpp */; };
+ DFECFB07172D9CAB00A43CF7 /* ISetting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAEE172D9CAB00A43CF7 /* ISetting.cpp */; };
+ DFECFB08172D9CAB00A43CF7 /* Setting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAF2172D9CAB00A43CF7 /* Setting.cpp */; };
+ DFECFB09172D9CAB00A43CF7 /* SettingAddon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAF4172D9CAB00A43CF7 /* SettingAddon.cpp */; };
+ DFECFB0A172D9CAB00A43CF7 /* SettingCategoryAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAF6172D9CAB00A43CF7 /* SettingCategoryAccess.cpp */; };
+ DFECFB0B172D9CAB00A43CF7 /* SettingConditions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAF8172D9CAB00A43CF7 /* SettingConditions.cpp */; };
+ DFECFB0C172D9CAB00A43CF7 /* SettingControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAFA172D9CAB00A43CF7 /* SettingControl.cpp */; };
+ DFECFB0D172D9CAB00A43CF7 /* SettingDependency.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAFC172D9CAB00A43CF7 /* SettingDependency.cpp */; };
+ DFECFB0E172D9CAB00A43CF7 /* SettingPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFAFE172D9CAB00A43CF7 /* SettingPath.cpp */; };
+ DFECFB0F172D9CAB00A43CF7 /* SettingSection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB00172D9CAB00A43CF7 /* SettingSection.cpp */; };
+ DFECFB10172D9CAB00A43CF7 /* SettingsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB02172D9CAB00A43CF7 /* SettingsManager.cpp */; };
+ DFECFB11172D9CAB00A43CF7 /* SettingUpdate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB03172D9CAB00A43CF7 /* SettingUpdate.cpp */; };
+ DFECFB12172D9CAB00A43CF7 /* SettingVisibility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB05172D9CAB00A43CF7 /* SettingVisibility.cpp */; };
+ DFECFB1C172D9D0100A43CF7 /* BooleanLogic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB1A172D9D0100A43CF7 /* BooleanLogic.cpp */; };
+ DFECFB4C172D9D6D00A43CF7 /* NetworkServices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DFECFB4A172D9D6D00A43CF7 /* NetworkServices.cpp */; };
E306D12E0DDF7B590052C2AD /* XBMCHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E306D12C0DDF7B590052C2AD /* XBMCHelper.cpp */; };
E33206380D5070AA00435CE3 /* DVDDemuxVobsub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E33206370D5070AA00435CE3 /* DVDDemuxVobsub.cpp */; };
E33466A60D2E5103005A65EC /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E33466A50D2E5103005A65EC /* IOKit.framework */; };
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 */; };
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 */; };
F56352BE16E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352B616E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp */; };
18B7C881129423A7009E7A26 /* MusicInfoTagLoaderWav.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicInfoTagLoaderWav.h; sourceTree = "<group>"; };
18B7C886129423A7009E7A26 /* MusicInfoTagLoaderYM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MusicInfoTagLoaderYM.cpp; sourceTree = "<group>"; };
18B7C887129423A7009E7A26 /* MusicInfoTagLoaderYM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MusicInfoTagLoaderYM.h; sourceTree = "<group>"; };
- 18B7C8C212942451009E7A26 /* GUISettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUISettings.cpp; sourceTree = "<group>"; };
- 18B7C8C312942451009E7A26 /* GUISettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUISettings.h; sourceTree = "<group>"; };
18B7C8CB12942546009E7A26 /* ButtonTranslator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonTranslator.cpp; sourceTree = "<group>"; };
18B7C8CC12942546009E7A26 /* ButtonTranslator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonTranslator.h; sourceTree = "<group>"; };
18B7C8CD12942546009E7A26 /* KeyboardLayoutConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardLayoutConfiguration.cpp; sourceTree = "<group>"; };
DFD928F116384B6800709DAE /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = "<group>"; };
DFD928F216384B6800709DAE /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
DFDA3152160E34230047A626 /* DVDOverlayCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDOverlayCodec.cpp; sourceTree = "<group>"; };
+ DFECFADD172D9C5100A43CF7 /* GUIControlSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GUIControlSettings.cpp; path = windows/GUIControlSettings.cpp; sourceTree = "<group>"; };
+ DFECFADE172D9C5100A43CF7 /* GUIControlSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIControlSettings.h; path = windows/GUIControlSettings.h; sourceTree = "<group>"; };
+ DFECFAEE172D9CAB00A43CF7 /* ISetting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ISetting.cpp; sourceTree = "<group>"; };
+ DFECFAEF172D9CAB00A43CF7 /* ISetting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISetting.h; sourceTree = "<group>"; };
+ DFECFAF0172D9CAB00A43CF7 /* ISettingCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISettingCallback.h; sourceTree = "<group>"; };
+ DFECFAF1172D9CAB00A43CF7 /* ISettingCreator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ISettingCreator.h; sourceTree = "<group>"; };
+ DFECFAF2172D9CAB00A43CF7 /* Setting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Setting.cpp; sourceTree = "<group>"; };
+ DFECFAF3172D9CAB00A43CF7 /* Setting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Setting.h; sourceTree = "<group>"; };
+ DFECFAF4172D9CAB00A43CF7 /* SettingAddon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingAddon.cpp; sourceTree = "<group>"; };
+ DFECFAF5172D9CAB00A43CF7 /* SettingAddon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingAddon.h; sourceTree = "<group>"; };
+ DFECFAF6172D9CAB00A43CF7 /* SettingCategoryAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingCategoryAccess.cpp; sourceTree = "<group>"; };
+ DFECFAF7172D9CAB00A43CF7 /* SettingCategoryAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingCategoryAccess.h; sourceTree = "<group>"; };
+ DFECFAF8172D9CAB00A43CF7 /* SettingConditions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingConditions.cpp; sourceTree = "<group>"; };
+ DFECFAF9172D9CAB00A43CF7 /* SettingConditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingConditions.h; sourceTree = "<group>"; };
+ DFECFAFA172D9CAB00A43CF7 /* SettingControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingControl.cpp; sourceTree = "<group>"; };
+ DFECFAFB172D9CAB00A43CF7 /* SettingControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingControl.h; sourceTree = "<group>"; };
+ DFECFAFC172D9CAB00A43CF7 /* SettingDependency.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingDependency.cpp; sourceTree = "<group>"; };
+ DFECFAFD172D9CAB00A43CF7 /* SettingDependency.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingDependency.h; sourceTree = "<group>"; };
+ DFECFAFE172D9CAB00A43CF7 /* SettingPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingPath.cpp; sourceTree = "<group>"; };
+ DFECFAFF172D9CAB00A43CF7 /* SettingPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingPath.h; sourceTree = "<group>"; };
+ DFECFB00172D9CAB00A43CF7 /* SettingSection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingSection.cpp; sourceTree = "<group>"; };
+ DFECFB01172D9CAB00A43CF7 /* SettingSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingSection.h; sourceTree = "<group>"; };
+ DFECFB02172D9CAB00A43CF7 /* SettingsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsManager.cpp; sourceTree = "<group>"; };
+ DFECFB03172D9CAB00A43CF7 /* SettingUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingUpdate.cpp; sourceTree = "<group>"; };
+ DFECFB04172D9CAB00A43CF7 /* SettingUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingUpdate.h; sourceTree = "<group>"; };
+ DFECFB05172D9CAB00A43CF7 /* SettingVisibility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingVisibility.cpp; sourceTree = "<group>"; };
+ DFECFB06172D9CAB00A43CF7 /* SettingVisibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingVisibility.h; sourceTree = "<group>"; };
+ DFECFB1A172D9D0100A43CF7 /* BooleanLogic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BooleanLogic.cpp; sourceTree = "<group>"; };
+ DFECFB1B172D9D0100A43CF7 /* BooleanLogic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BooleanLogic.h; sourceTree = "<group>"; };
+ DFECFB4A172D9D6D00A43CF7 /* NetworkServices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkServices.cpp; sourceTree = "<group>"; };
+ DFECFB4B172D9D6D00A43CF7 /* NetworkServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkServices.h; sourceTree = "<group>"; };
E306D12C0DDF7B590052C2AD /* XBMCHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XBMCHelper.cpp; sourceTree = "<group>"; };
E306D12D0DDF7B590052C2AD /* XBMCHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XBMCHelper.h; sourceTree = "<group>"; };
E33206370D5070AA00435CE3 /* DVDDemuxVobsub.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDDemuxVobsub.cpp; sourceTree = "<group>"; };
F56352A316E5402100D21BAD /* GUIDialogContentSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GUIDialogContentSettings.h; path = dialogs/GUIDialogContentSettings.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>"; };
E38E17C10D25F9FA00618676 /* GUIDialogNetworkSetup.h */,
E38E1E6B0D25F9FD00618676 /* Network.cpp */,
E38E1E6C0D25F9FD00618676 /* Network.h */,
+ DFECFB4A172D9D6D00A43CF7 /* NetworkServices.cpp */,
+ DFECFB4B172D9D6D00A43CF7 /* NetworkServices.h */,
E3E91FFC0D8C61DF002BF43D /* Socket.cpp */,
6E97BDC40DA2B620003A2A89 /* Socket.h */,
432D7CF612D870E800CE4C49 /* TCPServer.cpp */,
18B7C3A712942132009E7A26 /* AdvancedSettings.h */,
DF28EE01170E1E51005FA9D2 /* DisplaySettings.cpp */,
DF28EE02170E1E51005FA9D2 /* DisplaySettings.h */,
- 18B7C8C212942451009E7A26 /* GUISettings.cpp */,
- 18B7C8C312942451009E7A26 /* GUISettings.h */,
+ DFECFAEE172D9CAB00A43CF7 /* ISetting.cpp */,
+ DFECFAEF172D9CAB00A43CF7 /* ISetting.h */,
+ DFECFAF0172D9CAB00A43CF7 /* ISettingCallback.h */,
+ DFECFAF1172D9CAB00A43CF7 /* ISettingCreator.h */,
DF8990141709BB2D00B35C21 /* ISettingsHandler.h */,
DF8990151709BB2D00B35C21 /* ISubSettings.h */,
DF8990161709BB2D00B35C21 /* MediaSettings.cpp */,
DF8990171709BB2D00B35C21 /* MediaSettings.h */,
DF8990181709BB2D00B35C21 /* MediaSourceSettings.cpp */,
DF8990191709BB2D00B35C21 /* MediaSourceSettings.h */,
+ DFECFAF2172D9CAB00A43CF7 /* Setting.cpp */,
+ DFECFAF3172D9CAB00A43CF7 /* Setting.h */,
+ DFECFAF4172D9CAB00A43CF7 /* SettingAddon.cpp */,
+ DFECFAF5172D9CAB00A43CF7 /* SettingAddon.h */,
+ DFECFAF6172D9CAB00A43CF7 /* SettingCategoryAccess.cpp */,
+ DFECFAF7172D9CAB00A43CF7 /* SettingCategoryAccess.h */,
+ DFECFAF8172D9CAB00A43CF7 /* SettingConditions.cpp */,
+ DFECFAF9172D9CAB00A43CF7 /* SettingConditions.h */,
+ DFECFAFA172D9CAB00A43CF7 /* SettingControl.cpp */,
+ DFECFAFB172D9CAB00A43CF7 /* SettingControl.h */,
+ DFECFAFC172D9CAB00A43CF7 /* SettingDependency.cpp */,
+ DFECFAFD172D9CAB00A43CF7 /* SettingDependency.h */,
+ DFECFAFE172D9CAB00A43CF7 /* SettingPath.cpp */,
+ DFECFAFF172D9CAB00A43CF7 /* SettingPath.h */,
18B7C38E129420E5009E7A26 /* Settings.cpp */,
18B7C38F129420E5009E7A26 /* Settings.h */,
+ DFECFB00172D9CAB00A43CF7 /* SettingSection.cpp */,
+ DFECFB01172D9CAB00A43CF7 /* SettingSection.h */,
+ DFECFB02172D9CAB00A43CF7 /* SettingsManager.cpp */,
+ DFECFB03172D9CAB00A43CF7 /* SettingUpdate.cpp */,
+ DFECFB04172D9CAB00A43CF7 /* SettingUpdate.h */,
+ DFECFB05172D9CAB00A43CF7 /* SettingVisibility.cpp */,
+ DFECFB06172D9CAB00A43CF7 /* SettingVisibility.h */,
DF89901A1709BB2D00B35C21 /* SkinSettings.cpp */,
DF89901B1709BB2D00B35C21 /* SkinSettings.h */,
E38E1E010D25F9FD00618676 /* VideoSettings.cpp */,
F56353BE16E9BB3500D21BAD /* BitstreamConverter.h */,
E38E1E270D25F9FD00618676 /* BitstreamStats.cpp */,
E38E1E280D25F9FD00618676 /* BitstreamStats.h */,
+ DFECFB1A172D9D0100A43CF7 /* BooleanLogic.cpp */,
+ DFECFB1B172D9D0100A43CF7 /* BooleanLogic.h */,
E38E1E290D25F9FD00618676 /* CharsetConverter.cpp */,
E38E1E2A0D25F9FD00618676 /* CharsetConverter.h */,
E38E1E2B0D25F9FD00618676 /* CPUInfo.cpp */,
F563529F16E53FE900D21BAD /* dialogs */ = {
isa = PBXGroup;
children = (
+ DFECFADD172D9C5100A43CF7 /* GUIControlSettings.cpp */,
+ DFECFADE172D9C5100A43CF7 /* GUIControlSettings.h */,
F56352A216E5402100D21BAD /* GUIDialogContentSettings.cpp */,
F56352A316E5402100D21BAD /* GUIDialogContentSettings.h */,
F56352A816E5402100D21BAD /* GUIDialogSettings.cpp */,
F56352A016E53FF300D21BAD /* windows */ = {
isa = PBXGroup;
children = (
- F56352AE16E5403400D21BAD /* GUISettingControls.cpp */,
- F56352AF16E5403400D21BAD /* GUISettingControls.h */,
F56352B016E5403400D21BAD /* GUIWindowSettings.cpp */,
F56352B116E5403400D21BAD /* GUIWindowSettings.h */,
F56352B216E5403400D21BAD /* GUIWindowSettingsCategory.cpp */,
18B7C8A0129423A7009E7A26 /* MusicInfoTagLoaderSPC.cpp in Sources */,
18B7C8A1129423A7009E7A26 /* MusicInfoTagLoaderWav.cpp in Sources */,
18B7C8A4129423A7009E7A26 /* MusicInfoTagLoaderYM.cpp in Sources */,
- 18B7C8C412942451009E7A26 /* GUISettings.cpp in Sources */,
18B7C8D712942546009E7A26 /* ButtonTranslator.cpp in Sources */,
18B7C8D812942546009E7A26 /* KeyboardLayoutConfiguration.cpp in Sources */,
18B7C8D912942546009E7A26 /* KeyboardStat.cpp in Sources */,
F563529616E53FAB00D21BAD /* UPnPSettings.cpp in Sources */,
F56352AA16E5402100D21BAD /* GUIDialogContentSettings.cpp in Sources */,
F56352AD16E5402100D21BAD /* GUIDialogSettings.cpp in Sources */,
- F56352BA16E5403400D21BAD /* GUISettingControls.cpp in Sources */,
F56352BB16E5403400D21BAD /* GUIWindowSettings.cpp in Sources */,
F56352BC16E5403400D21BAD /* GUIWindowSettingsCategory.cpp in Sources */,
F56352BE16E5403400D21BAD /* GUIWindowSettingsScreenCalibration.cpp in Sources */,
7C87B2CE162CE39600EF897D /* PlayerController.cpp in Sources */,
F52CC5F01713AAA200113454 /* DirectoryNodeGrouped.cpp in Sources */,
F52CC6AA1713BD2B00113454 /* DirectoryNodeGrouped.cpp in Sources */,
+ DFECFADF172D9C5100A43CF7 /* GUIControlSettings.cpp in Sources */,
+ DFECFB07172D9CAB00A43CF7 /* ISetting.cpp in Sources */,
+ DFECFB08172D9CAB00A43CF7 /* Setting.cpp in Sources */,
+ DFECFB09172D9CAB00A43CF7 /* SettingAddon.cpp in Sources */,
+ DFECFB0A172D9CAB00A43CF7 /* SettingCategoryAccess.cpp in Sources */,
+ DFECFB0B172D9CAB00A43CF7 /* SettingConditions.cpp in Sources */,
+ DFECFB0C172D9CAB00A43CF7 /* SettingControl.cpp in Sources */,
+ DFECFB0D172D9CAB00A43CF7 /* SettingDependency.cpp in Sources */,
+ DFECFB0E172D9CAB00A43CF7 /* SettingPath.cpp in Sources */,
+ DFECFB0F172D9CAB00A43CF7 /* SettingSection.cpp in Sources */,
+ DFECFB10172D9CAB00A43CF7 /* SettingsManager.cpp in Sources */,
+ DFECFB11172D9CAB00A43CF7 /* SettingUpdate.cpp in Sources */,
+ DFECFB12172D9CAB00A43CF7 /* SettingVisibility.cpp in Sources */,
+ DFECFB1C172D9D0100A43CF7 /* BooleanLogic.cpp in Sources */,
+ DFECFB4C172D9D6D00A43CF7 /* NetworkServices.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
<width>260</width>
<height>481</height>
<itemgap>-1</itemgap>
- <onleft>60</onleft>
+ <onleft>9000</onleft>
<onright>5</onright>
<onup>3</onup>
<ondown>3</ondown>
<label>[COLOR=blue] - [/COLOR]$INFO[Control.GetLabel(2)]</label>
</control>
</control>
+ <control type="group">
+ <posx>-250</posx>
+ <include>SideBladeLeft</include>
+ <control type="grouplist" id="9000">
+ <posx>0</posx>
+ <posy>110</posy>
+ <width>250</width>
+ <height>600</height>
+ <onleft>9000</onleft>
+ <onright>3</onright>
+ <onup>9000</onup>
+ <ondown>9000</ondown>
+ <onback>3</onback>
+ <itemgap>0</itemgap>
+ <control type="label" id="200">
+ <width>250</width>
+ <height>35</height>
+ <font>font12</font>
+ <label>31007</label>
+ <textcolor>blue</textcolor>
+ <align>center</align>
+ <aligny>center</aligny>
+ </control>
+ <control type="button" id="20">
+ <description>Setting level button</description>
+ <textwidth>235</textwidth>
+ <include>ButtonCommonValues</include>
+ <label>10037</label>
+ <onclick>SettingsLevelChange</onclick>
+ </control>
+ <control type="button" id="21">
+ <description>Reset button</description>
+ <include>ButtonCommonValues</include>
+ <label>10035</label>
+ <onclick>SettingsReset</onclick>
+ </control>
+ </control>
+ </control>
<include>Clock</include>
</controls>
</window>
msgid "View Options"
msgstr ""
-#empty string with id 31007
+msgctxt "#31007"
+msgid "Settings Options"
+msgstr ""
msgctxt "#31008"
msgid "Fullscreen"
msgid "AirPlay"
msgstr ""
-#empty string with id 1274
+msgctxt "#1274"
+msgid "AirTunes"
+msgstr ""
#. Filter movies/tvshows/music/episodes/artists/musicvideos/albums/songs
#: xbmc/dialogs/GUIDialogMediaFilter.cpp
msgid "Settings - Profiles"
msgstr ""
-#empty strings from id 10035 to 10039
+msgctxt "#10035"
+msgid "Reset"
+msgstr ""
+
+msgctxt "#10036"
+msgid "Level: Basic"
+msgstr ""
+
+msgctxt "#10037"
+msgid "Level: Standard"
+msgstr ""
+
+msgctxt "#10038"
+msgid "Level: Advanced"
+msgstr ""
+
+msgctxt "#10039"
+msgid "Level: Expert"
+msgstr ""
#: xbmc/guilib/WindowIDs.h
msgctxt "#10040"
msgid "Addon browser"
msgstr ""
-#empty strings from id 10041 to 10099
+msgctxt "#10041"
+msgid "Reset settings"
+msgstr ""
+
+msgctxt "#10042"
+msgid "Are you sure you want to reset the settings in this category?"
+msgstr ""
+
+msgctxt "#10043"
+msgid "Help"
+msgstr ""
+
+msgctxt "#10044"
+msgid "No help available"
+msgstr ""
+
+#empty strings from id 10045 to 10099
#: xbmc/guilib/WindowIDs.h
msgctxt "#10100"
#: xbmc/settings/GUISettings.cpp
msgctxt "#13435"
-msgid "Enable HQ Scalers for scalings above %"
+msgid "Enable HQ Scalers for scalings above"
msgstr ""
#empty strings from id 13436 to 13499
xbmc\network\windows\ZeroconfWIN.cpp
msgctxt "#34300"
-msgid "Failed to start zeroconf"
+msgid "Failed to start Zeroconf"
msgstr ""
#: xbmc\network\windows\ZeroconfWIN.cpp
msgid "Is Apple's Bonjour Service installed? See log for more info."
msgstr ""
-#empty strings from id 34302 to 34399
+msgctxt "#34302"
+msgid "AirPlay requires Zeroconf to be enabled."
+msgstr ""
+
+msgctxt "#34303"
+msgid "Unable to stop Zeroconf"
+msgstr ""
+
+msgctxt "#34304"
+msgid "AirPlay and AirTunes depend on Zeroconf running."
+msgstr ""
+
+#empty strings from id 34305 to 34399
#: xbmc\cores\VideoRenderers\LinuxRendererGL.cpp
msgctxt "#34400"
<ClCompile Include="..\..\xbmc\network\httprequesthandler\HTTPWebinterfaceHandler.cpp" />
<ClCompile Include="..\..\xbmc\network\httprequesthandler\IHTTPRequestHandler.cpp" />
<ClCompile Include="..\..\xbmc\network\Network.cpp" />
+ <ClCompile Include="..\..\xbmc\network\NetworkServices.cpp" />
<ClCompile Include="..\..\xbmc\network\Socket.cpp" />
<ClCompile Include="..\..\xbmc\network\TCPServer.cpp" />
<ClCompile Include="..\..\xbmc\network\UdpClient.cpp" />
<ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogContentSettings.cpp" />
<ClCompile Include="..\..\xbmc\settings\dialogs\GUIDialogSettings.cpp" />
<ClCompile Include="..\..\xbmc\settings\DisplaySettings.cpp" />
- <ClCompile Include="..\..\xbmc\settings\GUISettings.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\ISetting.cpp" />
<ClCompile Include="..\..\xbmc\settings\MediaSettings.cpp" />
<ClCompile Include="..\..\xbmc\settings\MediaSourceSettings.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\Setting.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingAddon.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingCategoryAccess.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingConditions.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingControl.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingDependency.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingPath.cpp" />
<ClCompile Include="..\..\xbmc\settings\Settings.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingSection.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingsManager.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingUpdate.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\SettingVisibility.cpp" />
<ClCompile Include="..\..\xbmc\settings\SkinSettings.cpp" />
<ClCompile Include="..\..\xbmc\settings\VideoSettings.cpp" />
- <ClCompile Include="..\..\xbmc\settings\windows\GUISettingControls.cpp" />
+ <ClCompile Include="..\..\xbmc\settings\windows\GUIControlSettings.cpp" />
<ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettings.cpp" />
<ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsCategory.cpp" />
<ClCompile Include="..\..\xbmc\settings\windows\GUIWindowSettingsScreenCalibration.cpp" />
<ClInclude Include="..\..\xbmc\interfaces\python\PyContext.h" />
<ClInclude Include="..\..\xbmc\interfaces\python\pythreadstate.h" />
<ClInclude Include="..\..\xbmc\music\karaoke\karaokevideobackground.h" />
+ <ClInclude Include="..\..\xbmc\network\NetworkServices.h" />
<ClInclude Include="..\..\xbmc\peripherals\bus\virtual\PeripheralBusCEC.h" />
<ClInclude Include="..\..\xbmc\network\upnp\UPnPSettings.h" />
<ClInclude Include="..\..\xbmc\profiles\dialogs\GUIDialogLockSettings.h" />
<ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogContentSettings.h" />
<ClInclude Include="..\..\xbmc\settings\dialogs\GUIDialogSettings.h" />
<ClInclude Include="..\..\xbmc\settings\DisplaySettings.h" />
+ <ClInclude Include="..\..\xbmc\settings\ISetting.h" />
+ <ClInclude Include="..\..\xbmc\settings\ISettingCallback.h" />
+ <ClInclude Include="..\..\xbmc\settings\ISettingCreator.h" />
<ClInclude Include="..\..\xbmc\settings\ISettingsHandler.h" />
<ClInclude Include="..\..\xbmc\settings\ISubSettings.h" />
<ClInclude Include="..\..\xbmc\settings\MediaSettings.h" />
<ClInclude Include="..\..\xbmc\settings\MediaSourceSettings.h" />
+ <ClInclude Include="..\..\xbmc\settings\Setting.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingAddon.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingCategoryAccess.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingConditions.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingControl.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingDependency.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingPath.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingSection.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingsManager.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingUpdate.h" />
+ <ClInclude Include="..\..\xbmc\settings\SettingVisibility.h" />
<ClInclude Include="..\..\xbmc\settings\SkinSettings.h" />
- <ClInclude Include="..\..\xbmc\settings\windows\GUISettingControls.h" />
+ <ClInclude Include="..\..\xbmc\settings\windows\GUIControlSettings.h" />
<ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettings.h" />
<ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsCategory.h" />
<ClInclude Include="..\..\xbmc\settings\windows\GUIWindowSettingsScreenCalibration.h" />
<ClInclude Include="..\..\xbmc\settings\windows\GUIWindowTestPattern.h" />
+ <ClInclude Include="..\..\xbmc\utils\BooleanLogic.h" />
<ClInclude Include="..\..\xbmc\utils\IRssObserver.h" />
+ <ClInclude Include="..\..\xbmc\utils\IXmlDeserializable.h" />
<ClInclude Include="..\..\xbmc\utils\RssManager.h" />
<ClInclude Include="..\..\xbmc\utils\Vector.h" />
<ClInclude Include="..\..\xbmc\video\FFmpegVideoDecoder.h" />
</ClInclude>
<ClInclude Include="..\..\xbmc\interfaces\json-rpc\AddonsOperations.h" />
<ClCompile Include="..\..\xbmc\ThumbLoader.cpp" />
+ <ClCompile Include="..\..\xbmc\utils\BooleanLogic.cpp" />
<ClCompile Include="..\..\xbmc\utils\RssManager.cpp" />
<ClCompile Include="..\..\xbmc\utils\test\TestUrlOptions.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug (DirectX)|Win32'">true</ExcludedFromBuild>
<ClInclude Include="..\..\xbmc\rendering\RenderSystem.h" />
<ClInclude Include="..\..\xbmc\SectionLoader.h" />
<ClInclude Include="..\..\xbmc\settings\AdvancedSettings.h" />
- <ClInclude Include="..\..\xbmc\settings\GUISettings.h" />
<ClInclude Include="..\..\xbmc\settings\Settings.h" />
<ClInclude Include="..\..\xbmc\settings\VideoSettings.h" />
<ClInclude Include="..\..\xbmc\SortFileItem.h" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\$(ProjectFileName).targets.user" Condition="Exists('$(SolutionDir)\$(ProjectFileName).targets.user')" />
-</Project>
+</Project>
\ No newline at end of file
<ClCompile Include="..\..\xbmc\settings\AdvancedSettings.cpp">
<Filter>settings</Filter>
</ClCompile>
- <ClCompile Include="..\..\xbmc\settings\GUISettings.cpp">
- <Filter>settings</Filter>
- </ClCompile>
<ClCompile Include="..\..\xbmc\settings\Settings.cpp">
<Filter>settings</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\filesystem\MusicDatabaseDirectory\DirectoryNodeGrouped.cpp">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\windows\GUIControlSettings.cpp">
+ <Filter>settings\windows</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\ISetting.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\Setting.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingCategoryAccess.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingConditions.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingControl.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingDependency.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingVisibility.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\network\NetworkServices.cpp">
+ <Filter>network</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\utils\BooleanLogic.cpp">
+ <Filter>utils</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingUpdate.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingsManager.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingAddon.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingPath.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\xbmc\settings\SettingSection.cpp">
+ <Filter>settings</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
<ClInclude Include="..\..\xbmc\settings\AdvancedSettings.h">
<Filter>settings</Filter>
</ClInclude>
- <ClInclude Include="..\..\xbmc\settings\GUISettings.h">
- <Filter>settings</Filter>
- </ClInclude>
<ClInclude Include="..\..\xbmc\settings\Settings.h">
<Filter>settings</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\filesystem\MusicDatabaseDirectory\DirectoryNodeGrouped.h">
<Filter>filesystem\MusicDatabaseDirectory</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\windows\GUIControlSettings.h">
+ <Filter>settings\windows</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\ISetting.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\ISettingCallback.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\Setting.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingCategoryAccess.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingConditions.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingControl.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingDependency.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingVisibility.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\network\NetworkServices.h">
+ <Filter>network</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\utils\BooleanLogic.h">
+ <Filter>utils</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\utils\IXmlDeserializable.h">
+ <Filter>utils</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingUpdate.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingsManager.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\ISettingCreator.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingAddon.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingPath.h">
+ <Filter>settings</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\xbmc\settings\SettingSection.h">
+ <Filter>settings</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
<Filter>interfaces\swig</Filter>
</None>
</ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="appearance">
+ <category id="locale">
+ <group id="2">
+ <visible>false</visible>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="system">
+ <category id="videoscreen" label="21373" help="">
+ <group id="1">
+ <setting id="videoscreen.resolution" label="131" />
+ </group>
+ </category>
+ <category id="audiooutput">
+ <group id="1">
+ <setting id="audiooutput.passthroughaac">
+ <visible>false</visible>
+ </setting>
+ <setting id="audiooutput.truehdpassthrough">
+ <visible>false</visible>
+ </setting>
+ <setting id="audiooutput.dtshdpassthrough">
+ <visible>false</visible>
+ </setting>
+ </group>
+ </category>
+ <category id="input">
+ <group id="1">
+ <setting id="input.appleremotemode" type="integer" label="13600" help="">
+ <level>1</level>
+ <default>1</default> <!-- APPLE_REMOTE_STANDARD -->
+ <control type="spinner" format="string">
+ <options>
+ <option label="13610">0</option> <!-- APPLE_REMOTE_DISABLED -->
+ <option label="13611">1</option> <!-- APPLE_REMOTE_STANDARD -->
+ <option label="13612">2</option> <!-- APPLE_REMOTE_UNIVERSAL -->
+ <option label="13613">3</option> <!-- APPLE_REMOTE_MULTIREMOTE -->
+ </options>
+ </control>
+ </setting>
+ <setting id="input.appleremotealwayson" type="boolean" label="13602" help="">
+ <level>4</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" id="input.appleremotemode" operator="is not">0</dependency> <!-- APPLE_REMOTE_DISABLED -->
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="input.appleremotesequencetime" type="integer" label="13603" help="">
+ <level>1</level>
+ <default>500</default>
+ <control type="spinner" format="string">
+ <minimum label="351">50</minimum>
+ <step>50</step>
+ <maximum>1000</maximum>
+ <formatlabel>14046</formatlabel>
+ <dependencies>
+ <dependency type="enable" id="input.appleremotemode">2</dependency> <!-- APPLE_REMOTE_UNIVERSAL -->
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="videos">
+ <category id="videoplayer">
+ <group id="2">
+ <setting id="videoplayer.adjustrefreshrate">
+ <level>4</level>
+ </setting>
+ <setting id="videoplayer.pauseafterrefreshchange">
+ <level>4</level>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="system">
+ <category id="videoscreen">
+ <group id="1">
+ <setting id="videoscreen.blankdisplays">
+ <visible>false</visible>
+ </setting>
+ </group>
+ </category>
+ <category id="audiooutput">
+ <group id="1">
+ <setting id="audiooutput.ac3passthrough">
+ <visible>IsAppleTV2</visible>
+ </setting>
+ <setting id="audiooutput.dtspassthrough">
+ <visible>IsAppleTV2</visible>
+ </setting>
+ <setting id="audiooutput.multichannellpcm">
+ <visible>false</visible>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="audiooutput.audiodevice">
+ <default>Default</default>
+ </setting>
+ <setting id="audiooutput.passthroughdevice">
+ <level>4</level>
+ <default>Default</default>
+ </setting>
+ </group>
+ </category>
+ <category id="input">
+ <group id="2">
+ <setting id="input.enablemouse">
+ <level>4</level>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="system">
+ <category id="videoscreen">
+ <group id="1">
+ <setting id="videoscreen.screen">
+ <visible>false</visible>
+ </setting>
+ <setting id="videoscreen.resolution">
+ <visible>false</visible>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="system">
+ <category id="input">
+ <group id="1">
+ <setting id="input.appleremotealwayson">
+ <level>1</level>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="system">
+ <category id="videoscreen">
+ <group id="1">
+ <setting id="videoscreen.fakefullscreen">
+ <visible>false</visible>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings><section id="system">
+ <category id="videoscreen">
+ <group id="1">
+ <setting id="videoscreen.screen">
+ <visible>false</visible>
+ </setting>
+ </group>
+ </category>
+ <category id="audiooutput">
+ <group id="1">
+ <setting id="audiooutput.mode">
+ <default>2</default> <!-- AUDIO_HDMI -->
+ </setting>
+ <setting id="audiooutput.passthroughaac">
+ <visible>false</visible>
+ </setting>
+ <setting id="audiooutput.multichannellpcm">
+ <visible>false</visible>
+ </setting>
+ <setting id="audiooutput.truehdpassthrough">
+ <visible>false</visible>
+ </setting>
+ <setting id="audiooutput.dtshdpassthrough">
+ <visible>false</visible>
+ </setting>
+ </group>
+ <group id="2">
+ <visible>false</visible>
+ </group>
+ <group id="3">
+ <setting id="audiooutput.guisoundmode">
+ <visible>false</visible>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="appearance" label="480" help="">
+ <category id="lookandfeel" label="166" help="">
+ <group id="1">
+ <setting id="lookandfeel.skin" type="addon" label="166" help="">
+ <level>0</level>
+ <default>skin.confluence</default>
+ <addontype>xbmc.gui.skin</addontype>
+ </setting>
+ <setting id="lookandfeel.skinsettings" type="action" label="21417" help="">
+ <level>0</level>
+ <control type="button" format="action">
+ <dependencies>
+ <dependency type="enable" on="property" name="AddonHasSettings" setting="lookandfeel.skin" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="lookandfeel.skintheme" type="string" label="15111" help="">
+ <level>1</level>
+ <default>SKINDEFAULT</default>
+ <constraints>
+ <options>skinthemes</options>
+ </constraints>
+ <control type="spinner" format="string" delayed="true" />
+ </setting>
+ <setting id="lookandfeel.skincolors" type="string" label="14078" help="">
+ <level>1</level>
+ <default>SKINDEFAULT</default>
+ <constraints>
+ <options>skincolors</options>
+ </constraints>
+ <control type="spinner" format="string" delayed="true" />
+ </setting>
+ <setting id="lookandfeel.font" type="string" label="13303" help="">
+ <level>1</level>
+ <default>Default</default>
+ <constraints>
+ <options>skinfonts</options>
+ </constraints>
+ <control type="spinner" format="string" delayed="true" />
+ </setting>
+ <setting id="lookandfeel.skinzoom" type="integer" label="20109" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum>-20</minimum>
+ <step>2</step>
+ <maximum>20</maximum>
+ <formatlabel>14047</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="lookandfeel.startupwindow" type="integer" label="512" help="">
+ <level>0</level>
+ <default>10000</default> <!-- WINDOW_HOME -->
+ <constraints>
+ <options>startupwindows</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="lookandfeel.soundskin" type="string" label="15108" help="">
+ <level>0</level>
+ <default>SKINDEFAULT</default>
+ <constraints>
+ <options>skinsounds</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="lookandfeel.enablerssfeeds" type="boolean" label="13305" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="lookandfeel.rssedit" type="string" label="21450" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <control type="button" format="action">
+ <dependencies>
+ <dependency type="enable" setting="lookandfeel.enablerssfeeds">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="locale" label="14090" help="">
+ <group id="1">
+ <setting id="locale.language" type="string" label="248" help="">
+ <level>0</level>
+ <default>English</default>
+ <constraints>
+ <options>languages</options>
+ </constraints>
+ <control type="spinner" format="string" delayed="true" />
+ </setting>
+ <setting id="locale.country" type="string" label="20026" help="">
+ <level>0</level>
+ <default>USA (12h)</default>
+ <constraints>
+ <options>regions</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="update" setting="locale.language" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="locale.charset" type="string" label="14091" help="">
+ <level>1</level>
+ <default>DEFAULT</default>
+ <constraints>
+ <options>charsets</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="update" setting="locale.language" />
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="locale.timezonecountry" type="string" label="14079" help="">
+ <level>2</level>
+ <default>default</default> <!-- will be properly set on startup -->
+ <constraints>
+ <options>timezonecountries</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="locale.timezone" type="string" label="14080" help="">
+ <level>2</level>
+ <default>default</default> <!-- will be properly set on startup -->
+ <constraints>
+ <options>timezones</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="update" setting="locale.timezonecountry" />
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="4">
+ <setting id="locale.audiolanguage" type="string" label="285" help="">
+ <level>1</level>
+ <default>original</default>
+ <constraints>
+ <options>streamlanguages</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="locale.subtitlelanguage" type="string" label="286" help="">
+ <level>1</level>
+ <default>original</default>
+ <constraints>
+ <options>streamlanguages</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="filelists" label="14081" help="">
+ <group id="1">
+ <setting id="filelists.showparentdiritems" type="boolean" label="13306" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="filelists.showextensions" type="boolean" label="497" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="filelists.ignorethewhensorting" type="boolean" label="13399" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="filelists.allowfiledeletion" type="boolean" label="14071" help="">
+ <level>1</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <or>
+ <condition on="property" operator="!is" name="ProfileHasFilesLocked" />
+ <condition on="property" name="IsMasterUser" />
+ </or>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="filelists.showaddsourcebuttons" type="boolean" label="21382" help="">
+ <level>1</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <or>
+ <condition on="property" name="ProfileCanWriteSources" />
+ <condition on="property" name="IsMasterUser" />
+ </or>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="filelists.showhidden" type="boolean" label="21330" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ <category id="screensaver" label="360" help="355">
+ <group id="1">
+ <setting id="screensaver.mode" type="addon" label="356" help="">
+ <level>0</level>
+ <default>screensaver.xbmc.builtin.dim</default>
+ <addontype>xbmc.ui.screensaver</addontype>
+ <allowempty>true</allowempty>
+ <updates>
+ <update type="change" />
+ </updates>
+ </setting>
+ <setting id="screensaver.settings" type="action" label="21417" help="">
+ <level>0</level>
+ <control type="button" format="action">
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition on="setting" setting="screensaver.mode" operator="!is"></condition>
+ <condition on="property" name="AddonHasSettings" setting="screensaver.mode" />
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="screensaver.preview" type="action" label="1000" help="">
+ <level>0</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="screensaver.mode" operator="!is"></dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="screensaver.time" type="integer" label="355" help="">
+ <level>0</level>
+ <default>3</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>60</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="screensaver.mode" operator="!is"></dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="screensaver.usemusicvisinstead" type="boolean" label="13392" help="">
+ <level>1</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="screensaver.mode" operator="!is"></dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="screensaver.usedimonpause" type="boolean" label="22014" help="">
+ <level>1</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="screensaver.mode" operator="!is">screensaver.xbmc.builtin.dim</condition>
+ <condition setting="screensaver.mode" operator="!is"></condition>
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="window" label="0" help="">
+ <visible>false</visible>
+ <group id="1">
+ <setting id="window.width" type="integer" label="0" help="">
+ <level>4</level>
+ <default>720</default>
+ </setting>
+ <setting id="window.height" type="integer" label="0" help="">
+ <level>4</level>
+ <default>480</default>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="videos" label="3" help="">
+ <category id="videolibrary" label="14022" help="">
+ <group id="1">
+ <setting id="videolibrary.enabled" type="boolean" label="24022" help="">
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ <setting id="videolibrary.showunwatchedplots" type="boolean" label="20369" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ <setting id="videolibrary.seasonthumbs" type="boolean" label="20382" help="">
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ <setting id="videolibrary.actorthumbs" type="boolean" label="20402" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="videolibrary.flattentvshows" type="integer" label="20412" help="">
+ <level>1</level>
+ <default>1</default> <!-- if only one season -->
+ <constraints>
+ <options>
+ <option label="20420">0</option> <!-- never -->
+ <option label="20421">1</option> <!-- if only one season -->
+ <option label="20422">2</option> <!-- always -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videolibrary.groupmoviesets" type="boolean" label="20458" help="">
+ <level>0</level>
+ <default>false</default>
+ </setting>
+ <setting id="videolibrary.updateonstartup" type="boolean" label="22000" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="videolibrary.backgroundupdate" type="boolean" label="22001" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="videolibrary.cleanup" type="action" label="334" help="">
+ <level>2</level>
+ </setting>
+ <setting id="videolibrary.export" type="action" label="647" help="">
+ <level>2</level>
+ </setting>
+ <setting id="videolibrary.import" type="action" label="648" help="">
+ <level>2</level>
+ </setting>
+ </group>
+ </category>
+ <category id="videoplayer" label="14086" help="">
+ <group id="1">
+ <setting id="videoplayer.autoplaynextitem" type="boolean" label="13433" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="videoplayer.rendermethod" type="integer" label="13415" help="">
+ <level>2</level>
+ <default>0</default> <!-- RENDER_METHOD_AUTO -->
+ <constraints>
+ <options>rendermethods</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videoplayer.hqscalers" type="integer" label="13435" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>10</step>
+ <maximum>100</maximum>
+ <formatlabel>14047</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videoplayer.usevdpau" type="boolean" label="13425" help="">
+ <visible>HAVE_LIBVDPAU</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.usevaapi" type="boolean" label="13426" help="">
+ <visible>HAVE_LIBVA</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.usedxva2" type="boolean" label="13427" help="">
+ <visible>HasDXVA2</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.usechd" type="boolean" label="13428" help="">
+ <visible>HasCrystalHDDevice</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.usevda" type="boolean" label="13429" help="">
+ <visible>HasVDADecoder</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.useomx" type="boolean" label="13430" help="">
+ <visible>HAVE_LIBOPENMAX</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.usevideotoolbox" type="boolean" label="13432" help="">
+ <visible>HasVideoToolBoxDecoder</visible>
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.usepbo" type="boolean" label="13424" help="">
+ <visible>HAS_GL</visible>
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.adjustrefreshrate" type="integer" label="170" help="">
+ <level>2</level>
+ <default>0</default> <!-- ADJUST_REFRESHRATE_OFF -->
+ <constraints>
+ <options>
+ <option label="351">0</option> <!-- ADJUST_REFRESHRATE_OFF -->
+ <option label="36035">1</option> <!-- ADJUST_REFRESHRATE_ALWAYS -->
+ <option label="36036">2</option> <!-- ADJUST_REFRESHRATE_ON_STARTSTOP -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videoplayer.pauseafterrefreshchange" type="integer" label="13550" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <options>refreshchangedelays</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="videoplayer.adjustrefreshrate" operator="!is">0</dependency> <!-- ADJUST_REFRESHRATE_OFF -->
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoplayer.usedisplayasclock" type="boolean" label="13510" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ <setting id="videoplayer.synctype" type="integer" label="13500" help="">
+ <level>2</level>
+ <default>2</default> <!-- SYNC_RESAMPLE -->
+ <constraints>
+ <options>
+ <option label="13501">0</option> <!-- SYNC_DISCON -->
+ <option label="13502">1</option> <!-- SYNC_SKIPDUP -->
+ <option label="13503">2</option> <!-- SYNC_RESAMPLE -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="videoplayer.usedisplayasclock" operator="is">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoplayer.maxspeedadjust" type="number" label="13504" help="">
+ <level>4</level>
+ <default>5.0</default>
+ <constraints>
+ <minimum>0.0</minimum>
+ <step>0.1</step>
+ <maximum>10.0</maximum>
+ </constraints>
+ <control type="spinner" format="number">
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="videoplayer.usedisplayasclock" operator="is">true</condition>
+ <condition setting="videoplayer.synctype" operator="is">2</condition> <!-- SYNC_RESAMPLE -->
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoplayer.resamplequality" type="integer" label="13505" help="">
+ <level>4</level>
+ <default>1</default> <!-- RESAMPLE_MID -->
+ <constraints>
+ <options>
+ <option label="13506">0</option> <!-- RESAMPLE_LOW -->
+ <option label="13507">1</option> <!-- RESAMPLE_MID -->
+ <option label="13508">2</option> <!-- RESAMPLE_HIGH -->
+ <option label="13509">3</option> <!-- RESAMPLE_REALLYHIGH -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="videoplayer.usedisplayasclock" operator="is">true</condition>
+ <condition setting="videoplayer.synctype" operator="is">2</condition> <!-- SYNC_RESAMPLE -->
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoplayer.errorinaspect" type="integer" label="22021" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum label="231">0</minimum>
+ <step>1</step>
+ <maximum>20</maximum>
+ <formatlabel>14047</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videoplayer.stretch43" type="integer" label="173" help="">
+ <level>1</level>
+ <default>0</default> <!-- ViewModeNormal -->
+ <constraints>
+ <options>
+ <option label="630">0</option> <!-- ViewModeNormal -->
+ <option label="633">3</option> <!-- ViewModeWideZoom -->
+ <option label="634">4</option> <!-- ViewModeStretch16x9 -->
+ <option label="631">1</option> <!-- ViewModeZoom -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videoplayer.vdpau_allow_xrandr" type="boolean" label="13122" help="">
+ <visible>HAVE_LIBVDPAU</visible>
+ <level>4</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="3">
+ <visible>
+ <and>
+ <or>
+ <condition>HAS_GL</condition>
+ <condition>HAS_GLESv2</condition>
+ </or>
+ <condition>HAVE_LIBVDPAU</condition>
+ </and>
+ </visible>
+ <setting id="videoplayer.vdpauUpscalingLevel" type="boolean" label="13121" help="">
+ <level>4</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="4">
+ <setting id="videoplayer.teletextenabled" type="boolean" label="23050" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="videoplayer.teletextscale" type="boolean" label="23055" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="myvideos" label="14081" help="">
+ <group id="1">
+ <setting id="myvideos.selectaction" type="integer" label="22079" help="">
+ <level>1</level>
+ <default>1</default> <!-- SELECT_ACTION_PLAY_OR_RESUME -->
+ <constraints>
+ <options>
+ <option label="22080">0</option> <!-- SELECT_ACTION_CHOOSE -->
+ <option label="208">1</option> <!-- SELECT_ACTION_PLAY_OR_RESUME -->
+ <option label="13404">2</option> <!-- SELECT_ACTION_RESUME -->
+ <option label="22081">3</option> <!-- SELECT_ACTION_INFO -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="myvideos.extractflags" type="boolean" label="20433" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="myvideos.replacelabels" type="boolean" label="20419" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="myvideos.extractthumb" type="boolean" label="20433" help="">
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="myvideos.startwindow" type="integer" label="0" help="">
+ <level>4</level>
+ <default>100024</default> <!-- WINDOW_VIDEO_FILES -->
+ </setting>
+ <setting id="myvideos.stackvideos" type="boolean" label="0" help="">
+ <level>4</level>
+ <default>false</default>
+ </setting>
+ <setting id="myvideos.flatten" type="boolean" label="0" help="">
+ <level>4</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ <category id="subtitles" label="287" help="">
+ <group id="1">
+ <setting id="subtitles.font" type="string" label="14089" help="">
+ <level>1</level>
+ <default>arial.ttf</default>
+ <constraints>
+ <options>fonts</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="subtitles.height" type="integer" label="289" help="">
+ <level>1</level>
+ <default>28</default>
+ <constraints>
+ <minimum>16</minimum>
+ <step>2</step>
+ <maximum>74</maximum>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="update" setting="subtitles.font" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="subtitles.style" type="integer" label="736" help="">
+ <level>1</level>
+ <default>1</default> <!-- FONT_STYLE_BOLD -->
+ <constraints>
+ <options>
+ <option label="738">0</option> <!-- FONT_STYLE_NORMAL -->
+ <option label="739">1</option> <!-- FONT_STYLE_BOLD -->
+ <option label="740">2</option> <!-- FONT_STYLE_ITALICS -->
+ <option label="741">3</option> <!-- FONT_STYLE_BOLD | FONT_STYLE_ITALICS -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" on="property" name="IsUsingTTFSubtitles" setting="subtitles.font" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="subtitles.color" type="integer" label="737" help="">
+ <level>1</level>
+ <default>1</default> <!-- White -->
+ <constraints>
+ <options>
+ <option label="760">0</option> <!-- Yellow -->
+ <option label="761">1</option> <!-- White -->
+ <option label="762">2</option> <!-- Blue -->
+ <option label="763">3</option> <!-- Bright green -->
+ <option label="764">4</option> <!-- Yellow green -->
+ <option label="765">5</option> <!-- Cyan -->
+ <option label="766">6</option> <!-- Light grey -->
+ <option label="767">7</option> <!-- Grey -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" on="property" name="IsUsingTTFSubtitles" setting="subtitles.font" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="subtitles.charset" type="string" label="735" help="">
+ <level>1</level>
+ <default>DEFAULT</default>
+ <constraints>
+ <options>charsets</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" on="property" name="IsUsingTTFSubtitles" setting="subtitles.font" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="subtitles.overrideassfonts" type="boolean" label="21368" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="subtitles.custompath" type="path" label="21366" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>657</heading>
+ <constraints>
+ <writable>false</writable>
+ <sources>
+ <source>videos</source>
+ </sources>
+ </constraints>
+ <control type="button" format="path" />
+ </setting>
+ <setting id="subtitles.align" type="integer" label="21460" help="">
+ <level>1</level>
+ <default>0</default> <!-- SUBTITLE_ALIGN_MANUAL -->
+ <constraints>
+ <options>
+ <option label="21461">0</option> <!-- SUBTITLE_ALIGN_MANUAL -->
+ <option label="21462">1</option> <!-- SUBTITLE_ALIGN_BOTTOM_INSIDE -->
+ <option label="21463">2</option> <!-- SUBTITLE_ALIGN_BOTTOM_OUTSIDE -->
+ <option label="21464">3</option> <!-- SUBTITLE_ALIGN_TOP_INSIDE -->
+ <option label="21465">4</option> <!-- SUBTITLE_ALIGN_TOP_OUTSIDE -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="dvds" label="14087" help="">
+ <group id="1">
+ <setting id="dvds.autorun" type="boolean" label="14088" help="">
+ <level>0</level>
+ <default>false</default>
+ </setting>
+ <setting id="dvds.playerregion" type="integer" label="21372" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>1</step>
+ <maximum>8</maximum>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="dvds.automenu" type="boolean" label="21882" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ <category id="scrapers" label="0" help="">
+ <visible>false</visible>
+ <group id="1">
+ <setting id="scrapers.moviesdefault" type="addon" label="21413" help="">
+ <level>4</level>
+ <default>metadata.themoviedb.org</default>
+ <addontype>xbmc.metadata.scraper.movies</addontype>
+ </setting>
+ <setting id="scrapers.tvshowsdefault" type="addon" label="21414" help="">
+ <level>4</level>
+ <default>metadata.tvdb.com</default>
+ <addontype>xbmc.metadata.scraper.tvshows</addontype>
+ </setting>
+ <setting id="scrapers.musicvideosdefault" type="addon" label="21415" help="">
+ <level>4</level>
+ <default>metadata.musicvideos.theaudiodb.com</default>
+ <addontype>xbmc.metadata.scraper.musicvideos</addontype>
+ <updates>
+ <update type="change" />
+ </updates>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="pvr" label="19180" help="">
+ <category id="pvrmanager" label="128" help="">
+ <group id="1">
+ <setting id="pvrmanager.enabled" type="boolean" label="449" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="pvrmanager.syncchannelgroups" type="boolean" label="19221" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pvrmanager.backendchannelorder" type="boolean" label="19231" help="">
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="pvrmanager.usebackendchannelnumbers" type="boolean" label="19234" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="pvrmanager.channelmanager" type="action" label="19199" help="">
+ <level>1</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="pvrmanager.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="pvrmanager.channelscan" type="action" label="19117" help="">
+ <level>1</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="pvrmanager.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="pvrmanager.resetdb" type="action" label="19185" help="">
+ <level>2</level>
+ </setting>
+ </group>
+ <group id="4">
+ <setting id="pvrmanager.hideconnectionlostwarning" type="boolean" label="19269" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ <category id="pvrmenu" label="19181" help="">
+ <group id="1">
+ <setting id="pvrmenu.infoswitch" type="boolean" label="19178" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pvrmenu.infotimeout" type="boolean" label="19179" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pvrmenu.closechannelosdonswitch" type="boolean" label="19229" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="pvrmenu.infotime" type="integer" label="19184" help="">
+ <level>1</level>
+ <default>5</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>10</maximum>
+ <formatlabel>14045</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="pvrmenu.iconpath" type="path" label="19018" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>657</heading>
+ <constraints>
+ <writable>false</writable>
+ </constraints>
+ <control type="button" format="path" />
+ </setting>
+ <setting id="pvrmenu.searchicons" type="action" label="19167" help="">
+ <level>1</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="pvrmanager.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="epg" label="19069" help="">
+ <group id="1">
+ <setting id="epg.defaultguideview" type="integer" label="19065" help="">
+ <level>1</level>
+ <default>3</default> <!-- GUIDE_VIEW_TIMELINE -->
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>3</maximum>
+ <options>epgguideviews</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="epg.daystodisplay" type="integer" label="19182" help="">
+ <level>1</level>
+ <default>3</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>14</maximum>
+ <formatlabel>17999</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="epg.epgupdate" type="integer" label="19071" help="">
+ <level>1</level>
+ <default>120</default>
+ <constraints>
+ <minimum>15</minimum>
+ <step>15</step>
+ <maximum>2880</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="epg.preventupdateswhileplayingtv" type="boolean" label="19230" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="epg.ignoredbforclient" type="boolean" label="19072" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="epg.hidenoinfoavailable" type="boolean" label="19268" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="epg.resetepg" type="action" label="19187" help="">
+ <level>1</level>
+ </setting>
+ </group>
+ </category>
+ <category id="pvrplayback" label="19177" help="">
+ <group id="1">
+ <setting id="pvrplayback.playminimized" type="boolean" label="19171" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pvrplayback.startlast" type="integer" label="19189" help="">
+ <level>1</level>
+ <default>0</default> <!-- START_LAST_CHANNEL_OFF -->
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>2</maximum>
+ <options>pvrstartlastchannel</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="pvrplayback.signalquality" type="boolean" label="19037" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="pvrplayback.scantime" type="integer" label="19170" help="">
+ <level>1</level>
+ <default>10</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>60</maximum>
+ <formatlabel>14045</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="pvrplayback.confirmchannelswitch" type="boolean" label="19281" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="pvrplayback.channelentrytimeout" type="integer" label="19073" help="">
+ <level>1</level>
+ <default>0</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>250</step>
+ <maximum>10000</maximum>
+ <formatlabel>14046</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="pvrrecord" label="19043" help="">
+ <group id="1">
+ <setting id="pvrrecord.instantrecordtime" type="integer" label="19172" help="">
+ <level>1</level>
+ <default>120</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>720</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="pvrrecord.defaultpriority" type="integer" label="19173" help="">
+ <level>1</level>
+ <default>50</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>100</maximum>
+ </constraints>
+ <control type="spinner" format="integer" />
+ </setting>
+ <setting id="pvrrecord.defaultlifetime" type="integer" label="19174" help="">
+ <level>1</level>
+ <default>99</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>365</maximum>
+ <formatlabel>17999</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="pvrrecord.marginstart" type="integer" label="19175" help="">
+ <level>1</level>
+ <default>0</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>60</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="pvrrecord.marginend" type="integer" label="19176" help="">
+ <level>1</level>
+ <default>0</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>60</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="pvrrecord.timernotifications" type="boolean" label="19233" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="pvrpowermanagement" label="14095" help="">
+ <group id="1">
+ <setting id="pvrpowermanagement.enabled" type="boolean" label="305" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="pvrpowermanagement.backendidletime" type="integer" label="19244" help="">
+ <level>1</level>
+ <default>15</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>5</step>
+ <maximum>360</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="pvrpowermanagement.setwakeupcmd" type="string" label="19245" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="pvrpowermanagement.prewakeup" type="integer" label="19246" help="">
+ <level>1</level>
+ <default>15</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>1</step>
+ <maximum>60</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="pvrpowermanagement.dailywakeup" type="boolean" label="19247" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="pvrpowermanagement.dailywakeuptime" type="string" label="19248" help="">
+ <level>1</level>
+ <default>00:00:00</default>
+ <control type="edit" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="pvrparental" label="19259" help="">
+ <access>CheckPVRParentalPin</access>
+ <group id="1">
+ <setting id="pvrparental.enabled" type="boolean" label="449" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="pvrparental.pin" type="string" label="19261" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <control type="edit" format="integer" attributes="hidden,new" delayed="false">
+ <dependencies>
+ <dependency type="enable" setting="pvrparental.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="pvrparental.duration" type="integer" label="19260" help="">
+ <level>1</level>
+ <default>300</default>
+ <constraints>
+ <minimum>5</minimum>
+ <step>5</step>
+ <maximum>1200</maximum>
+ <formatlabel>14045</formatlabel>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="pvrparental.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="pvrclient" label="19279" help="">
+ <group id="1">
+ <setting id="pvrclient.menuhook" type="action" label="19280" help="">
+ <level>1</level>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="music" label="2" help="">
+ <category id="musiclibrary" label="14022" help="">
+ <group id="1">
+ <setting id="musiclibrary.enabled" type="boolean" label="24022" help="">
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ <setting id="musiclibrary.showcompilationartists" type="boolean" label="13414" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="musiclibrary.downloadinfo" type="boolean" label="20192" help="">
+ <level>0</level>
+ <default>false</default>
+ </setting>
+ <setting id="musiclibrary.albumsscraper" type="addon" label="20193" help="">
+ <level>1</level>
+ <default>metadata.album.universal</default>
+ <addontype>xbmc.metadata.scraper.albums</addontype>
+ </setting>
+ <setting id="musiclibrary.artistsscraper" type="addon" label="20194" help="">
+ <level>1</level>
+ <default>metadata.artists.universal</default>
+ <addontype>xbmc.metadata.scraper.artists</addontype>
+ </setting>
+ <setting id="musiclibrary.updateonstartup" type="boolean" label="22000" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="musiclibrary.backgroundupdate" type="boolean" label="22001" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="musiclibrary.cleanup" type="action" label="334" help="">
+ <level>2</level>
+ </setting>
+ <setting id="musiclibrary.export" type="action" label="20196" help="">
+ <level>2</level>
+ </setting>
+ <setting id="musiclibrary.import" type="action" label="20197" help="">
+ <level>2</level>
+ </setting>
+ </group>
+ </category>
+ <category id="musicplayer" label="14086" help="">
+ <group id="1">
+ <setting id="musicplayer.autoplaynextitem" type="boolean" label="489" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ <setting id="musicplayer.queuebydefault" type="boolean" label="14084" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="musicplayer.replaygaintype" type="integer" label="638" help="">
+ <level>2</level>
+ <default>1</default> <!-- REPLAY_GAIN_ALBUM -->
+ <constraints>
+ <options>
+ <option label="351">0</option> <!-- REPLAY_GAIN_NONE -->
+ <option label="639">2</option> <!-- REPLAY_GAIN_TRACK -->
+ <option label="640">1</option> <!-- REPLAY_GAIN_ALBUM -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="musicplayer.replaygainpreamp" type="integer" label="641" help="">
+ <level>2</level>
+ <default>89</default>
+ <constraints>
+ <minimum>77</minimum>
+ <step>1</step>
+ <maximum>101</maximum>
+ <formatlabel>14050</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="musicplayer.replaygainnogainpreamp" type="integer" label="642" help="">
+ <level>2</level>
+ <default>89</default>
+ <constraints>
+ <minimum>77</minimum>
+ <step>1</step>
+ <maximum>101</maximum>
+ <formatlabel>14050</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="musicplayer.replaygainavoidclipping" type="boolean" label="643" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="musicplayer.crossfade" type="integer" label="13314" help="">
+ <level>1</level>
+ <default>0</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>1</step>
+ <maximum>15</maximum>
+ <formatlabel>14045</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="musicplayer.crossfadealbumtracks" type="boolean" label="13400" help="">
+ <level>1</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="musicplayer.crossfade" operator="!is">0</condition>
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="4">
+ <setting id="musicplayer.visualisation" type="addon" label="250" help="">
+ <level>0</level>
+ <default>visualization.glspectrum</default>
+ <addontype>xbmc.player.musicviz</addontype>
+ <allowempty>true</allowempty>
+ </setting>
+ </group>
+ </category>
+ <category id="musicfiles" label="14081" help="">
+ <group id="1">
+ <setting id="musicfiles.usetags" type="boolean" label="258" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ <setting id="musicfiles.trackformat" type="string" label="13307" help="">
+ <level>2</level>
+ <default>[%N. ]%A - %T</default>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="musicfiles.trackformatright" type="string" label="13387" help="">
+ <level>2</level>
+ <default>%D</default>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="musicfiles.nowplayingtrackformat" type="string" label="13307" help="">
+ <level>4</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="musicfiles.nowplayingtrackformatright" type="string" label="13387" help="">
+ <level>4</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="musicfiles.librarytrackformat" type="string" label="13307" help="">
+ <level>4</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="musicfiles.librarytrackformatright" type="string" label="13387" help="">
+ <level>4</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="musicfiles.findremotethumbs" type="boolean" label="14059" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="audiocds" label="620" help="">
+ <group id="1">
+ <setting id="audiocds.autoaction" type="integer" label="14097" help="">
+ <level>1</level>
+ <default>0</default> <!-- AUTOCD_NONE -->
+ <constraints>
+ <options>audiocdactions</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="audiocds.usecddb" type="boolean" label="227" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="audiocds.recordingpath" type="path" label="20000" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>657</heading>
+ <control type="button" format="path" />
+ </setting>
+ <setting id="audiocds.trackpathformat" type="string" label="13307" help="">
+ <level>2</level>
+ <default>%A - %B/[%N. ][%A - ]%T</default>
+ <heading>16016</heading>
+ <control type="edit" format="string" />
+ </setting>
+ <setting id="audiocds.encoder" type="integer" label="621" help="">
+ <level>2</level>
+ <default>3</default> <!-- CDDARIP_ENCODER_FLAC -->
+ <constraints>
+ <options>audiocdencoders</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="audiocds.quality" type="integer" label="622" help="">
+ <level>2</level>
+ <default>0</default> <!-- CDDARIP_QUALITY_CBR -->
+ <constraints>
+ <options>
+ <option label="604">0</option> <!-- CDDARIP_QUALITY_CBR -->
+ <option label="601">1</option> <!-- CDDARIP_QUALITY_MEDIUM -->
+ <option label="602">2</option> <!-- CDDARIP_QUALITY_STANDARD -->
+ <option label="603">3</option> <!-- CDDARIP_QUALITY_EXTREME -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="audiocds.encoder" operator="!is">2</condition> <!-- CDDARIP_ENCODER_WAV -->
+ <condition setting="audiocds.encoder" operator="!is">3</condition> <!-- CDDARIP_ENCODER_FLAC -->
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiocds.bitrate" type="integer" label="623" help="">
+ <level>2</level>
+ <default>192</default>
+ <constraints>
+ <minimum>128</minimum>
+ <step>32</step>
+ <maximum>320</maximum>
+ <formatlabel>14048</formatlabel>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="audiocds.encoder" operator="!is">2</condition> <!-- CDDARIP_ENCODER_WAV -->
+ <condition setting="audiocds.encoder" operator="!is">3</condition> <!-- CDDARIP_ENCODER_FLAC -->
+ <condition setting="audiocds.quality" operator="is">0</condition> <!-- CDDARIP_QUALITY_CBR -->
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiocds.compressionlevel" type="integer" label="665" help="">
+ <level>2</level>
+ <default>5</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>8</maximum>
+ </constraints>
+ <control type="spinner" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="audiocds.encoder">3</dependency> <!-- CDDARIP_ENCODER_FLAC -->
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiocds.ejectonrip" type="boolean" label="14099" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="karaoke" label="13327" help="">
+ <visible>HAS_KARAOKE</visible>
+ <group id="1">
+ <setting id="karaoke.enabled" type="boolean" label="13323" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ <setting id="karaoke.autopopupselector" type="boolean" label="22037" help="">
+ <level>2</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="karaoke.font" type="string" label="22030" help="">
+ <level>2</level>
+ <default>arial.ttf</default>
+ <constraints>
+ <options>fonts</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="karaoke.fontheight" type="integer" label="22031" help="">
+ <level>2</level>
+ <default>36</default>
+ <constraints>
+ <minimum>16</minimum>
+ <step>2</step>
+ <maximum>74</maximum>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ <dependency type="update" setting="karaoke.font" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="karaoke.fontcolors" type="integer" label="22032" help="">
+ <level>2</level>
+ <default>0</default> <!-- white/green -->
+ <constraints>
+ <options>
+ <option label="22040">0</option> <!-- white/green -->
+ <option label="22041">1</option> <!-- white/red -->
+ <option label="22042">2</option> <!-- white/blue -->
+ <option label="22043">3</option> <!-- black/white -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="karaoke.charset" type="string" label="22033" help="">
+ <level>2</level>
+ <default>DEFAULT</default>
+ <constraints>
+ <options>charsets</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="karaoke.export" type="action" label="22038" help="">
+ <level>2</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="karaoke.importcsv" type="action" label="22036" help="">
+ <level>2</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="karaoke.enabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="mymusic" label="0" help="0">
+ <group id="1">
+ <setting id="mymusic.startwindow" type="integer" label="0" help="">
+ <level>4</level>
+ <default>10501</default> <!-- WINDOW_MUSIC_FILES -->
+ </setting>
+ <setting id="mymusic.songthumbinvis" type="boolean" label="0" help="">
+ <level>4</level>
+ <default>false</default>
+ </setting>
+ <setting id="mymusic.defaultlibview" type="string" label="0" help="">
+ <level>4</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="pictures" label="1" help="">
+ <category id="pictures" label="14081" help="">
+ <group id="1">
+ <setting id="pictures.usetags" type="boolean" label="14082" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ <setting id="pictures.generatethumbs" type="boolean" label="13360" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pictures.useexifrotation" type="boolean" label="20184" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pictures.showvideos" type="boolean" label="22022" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="pictures.displayresolution" type="integer" label="169" help="">
+ <visible>false</visible> <!-- not properly respected -->
+ <level>1</level>
+ <default>14</default> <!-- RES_AUTORES -->
+ <constraints>
+ <options>resolutions</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="slideshow" label="108" help="">
+ <group id="1">
+ <setting id="slideshow.staytime" type="integer" label="12378" help="">
+ <level>0</level>
+ <default>5</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>100</maximum>
+ <formatlabel>14045</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="slideshow.displayeffects" type="boolean" label="12379" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ <setting id="slideshow.shuffle" type="boolean" label="13319" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="weather" label="8" help="">
+ <category id="weather" label="16000" help="">
+ <group id="1">
+ <setting id="weather.currentlocation" type="integer" label="0" help="">
+ <level>4</level>
+ <default>0</default>
+ <constraints>
+ <minimum>0</minimum>
+ <step>1</step>
+ <maximum>2</maximum>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="weather.addon" type="addon" label="24029" help="">
+ <level>0</level>
+ <default>weather.wunderground</default>
+ <addontype>xbmc.python.weather</addontype>
+ </setting>
+ <setting id="weather.addonsettings" type="action" label="21417" help="">
+ <level>0</level>
+ <control type="button" format="action">
+ <dependencies>
+ <dependency type="enable" on="property" name="AddonHasSettings" setting="weather.addon" />
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="services" label="14036" help="">
+ <category id="general" label="16000" help="">
+ <group id="1">
+ <setting id="services.devicename" type="string" label="1271" help="">
+ <level>0</level>
+ <default>XBMC</default>
+ <control type="edit" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="upnp" label="20187" help="">
+ <group id="1">
+ <setting id="services.upnpserver" type="boolean" label="21360" help="">
+ <level>0</level>
+ <default>false</default>
+ </setting>
+ <setting id="services.upnpannounce" type="boolean" label="20188" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="services.upnpserver">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.upnprenderer" type="boolean" label="21881" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="services.upnpcontroller" type="boolean" label="21361" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ <category id="webserver" label="33101" help="">
+ <visible>HAS_WEB_SERVER</visible>
+ <group id="1">
+ <setting id="services.webserver" type="boolean" label="263" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="services.webserverport" type="integer" label="730" help="">
+ <level>2</level>
+ <default>8080</default>
+ <heading>730</heading>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>65535</maximum>
+ </constraints>
+ <control type="edit" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="services.webserver">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.webserverusername" type="string" label="1048" help="">
+ <level>2</level>
+ <default>xbmc</default>
+ <allowempty>true</allowempty>
+ <control type="edit" format="string">
+ <dependencies>
+ <dependency type="enable" setting="services.webserver">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.webserverpassword" type="string" label="733" help="">
+ <level>2</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>730</heading>
+ <control type="edit" format="string" attributes="hidden">
+ <dependencies>
+ <dependency type="enable" setting="services.webserver">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.webskin" type="addon" label="199" help="">
+ <level>1</level>
+ <default>webinterface.default</default>
+ <addontype>xbmc.gui.webinterface</addontype>
+ </setting>
+ </group>
+ </category>
+ <category id="remotecontrol" label="790" help="">
+ <visible>
+ <or>
+ <condition>HAS_EVENT_SERVER</condition>
+ <condition>HAS_JSONRPC</condition>
+ </or>
+ </visible>
+ <group id="1">
+ <setting id="services.esenabled" type="boolean" label="791" help="">
+ <level>1</level>
+ <default>true</default>
+ </setting>
+ <setting id="services.esport" type="integer" label="792" help="">
+ <visible>HAS_EVENT_SERVER</visible>
+ <level>4</level>
+ <default>9777</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>65535</maximum>
+ </constraints>
+ <control type="edit" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="services.esenabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.esportrange" type="integer" label="793" help="">
+ <visible>HAS_EVENT_SERVER</visible>
+ <level>4</level>
+ <default>10</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>100</maximum>
+ </constraints>
+ <control type="spinner" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="services.esenabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.esmaxclients" type="integer" label="797" help="">
+ <visible>HAS_EVENT_SERVER</visible>
+ <level>4</level>
+ <default>20</default>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>100</maximum>
+ </constraints>
+ <control type="spinner" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="services.esenabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.esallinterfaces" type="boolean" label="794" help="">
+ <level>1</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="services.esenabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.esinitialdelay" type="integer" label="795" help="">
+ <visible>HAS_EVENT_SERVER</visible>
+ <level>4</level>
+ <default>750</default>
+ <constraints>
+ <minimum>5</minimum>
+ <step>5</step>
+ <maximum>10000</maximum>
+ </constraints>
+ <control type="spinner" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="services.esenabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.escontinuousdelay" type="integer" label="796" help="">
+ <visible>HAS_EVENT_SERVER</visible>
+ <level>4</level>
+ <default>25</default>
+ <constraints>
+ <minimum>5</minimum>
+ <step>5</step>
+ <maximum>10000</maximum>
+ </constraints>
+ <control type="spinner" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="services.esenabled">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="zeroconf" label="1259" help="">
+ <visible>HAS_ZEROCONF</visible>
+ <group id="1">
+ <setting id="services.zeroconf" type="boolean" label="1260" help="">
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="airplay" label="1273" help="">
+ <visible>HAS_AIRPLAY</visible>
+ <group id="1">
+ <setting id="services.airplay" type="boolean" label="1270" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="services.useairplaypassword" type="boolean" label="1272" help="">
+ <level>1</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="services.airplay">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="services.airplaypassword" type="string" label="733" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>733</heading>
+ <control type="edit" format="string" attributes="hidden">
+ <dependencies>
+ <dependency type="enable" setting="services.airplay">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ </category>
+ <category id="smb" label="1200" help="">
+ <group id="1">
+ <setting id="smb.winsserver" type="string" label="1207" help="">
+ <level>2</level>
+ <default>0.0.0.0</default>
+ <control type="edit" format="ip" />
+ </setting>
+ <setting id="smb.workgroup" type="string" label="1202" help="">
+ <level>2</level>
+ <default>WORKGROUP</default>
+ <heading>1202</heading>
+ <control type="edit" format="string" />
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="system" label="13000" help="">
+ <category id="videoscreen" label="21373" help="">
+ <group id="1">
+ <setting id="videoscreen.screen" type="integer" label="240" help="">
+ <level>0</level>
+ <default>0</default>
+ <constraints>
+ <options>screens</options>
+ </constraints>
+ <control type="spinner" format="string" delayed="true" />
+ </setting>
+ <setting id="videoscreen.resolution" type="integer" label="169" help="">
+ <level>0</level>
+ <default>0</default>
+ <constraints>
+ <options>resolutions</options>
+ </constraints>
+ <control type="spinner" format="string" delayed="true">
+ <dependencies>
+ <dependency type="enable" setting="videoscreen.screen" operator="!is">-1</dependency> <!-- DM_WINDOWED -->
+ <dependency type="update" setting="videoscreen.screen" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoscreen.screenmode" type="string" label="243" help="">
+ <visible>IsStandAlone</visible>
+ <level>0</level>
+ <default>DESKTOP</default>
+ <constraints>
+ <options>refreshrates</options>
+ </constraints>
+ <updates>
+ <update type="change" />
+ </updates>
+ <control type="spinner" format="string" delayed="true">
+ <dependencies>
+ <dependency type="enable" setting="videoscreen.screen" operator="!is">-1</dependency> <!-- DM_WINDOWED -->
+ <dependency type="update" setting="videoscreen.screen" />
+ <dependency type="update" setting="videoscreen.resolution" />
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoscreen.fakefullscreen" type="boolean" label="14083" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="videoscreen.screen" operator="!is">-1</dependency> <!-- DM_WINDOWED -->
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="videoscreen.blankdisplays" type="boolean" label="13130" help="">
+ <level>1</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" on="property" name="IsFullscreen" />
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="videoscreen.vsync" type="integer" label="13105" help="">
+ <level>2</level>
+ <default>3</default> <!-- VSYNC_DRIVER -->
+ <constraints>
+ <options>verticalsyncs</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="videoscreen.guicalibration" type="action" label="214" help="">
+ <level>1</level>
+ </setting>
+ <setting id="videoscreen.testpattern" type="action" label="226" help="">
+ <visible>HAS_GL</visible>
+ <level>1</level>
+ </setting>
+ <setting id="videoscreen.limitedrange" type="boolean" label="36042" help="">
+ <visible>
+ <or>
+ <condition>HAS_GL</condition>
+ <condition>HAS_DX</condition>
+ </or>
+ </visible>
+ <level>3</level>
+ <default>false</default>
+ <updates>
+ <update type="rename">videoplayer.vdpaustudiolevel</update>
+ </updates>
+ </setting>
+ </group>
+ </category>
+ <category id="audiooutput" label="772" help="">
+ <group id="1">
+ <setting id="audiooutput.mode" type="integer" label="337" help="">
+ <level>1</level>
+ <default>0</default> <!-- AUDIO_ANALOG -->
+ <constraints>
+ <options>audiooutputmodes</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="audiooutput.channels" type="integer" label="34100" help="">
+ <level>0</level>
+ <default>1</default> <!-- AE_CH_LAYOUT_2_0 -->
+ <constraints>
+ <options>
+ <option label="34101">1</option> <!-- AE_CH_LAYOUT_2_0 -->
+ <option label="34102">2</option> <!-- AE_CH_LAYOUT_2_1 -->
+ <option label="34103">3</option> <!-- AE_CH_LAYOUT_3_0 -->
+ <option label="34104">4</option> <!-- AE_CH_LAYOUT_3_1 -->
+ <option label="34105">5</option> <!-- AE_CH_LAYOUT_4_0 -->
+ <option label="34106">6</option> <!-- AE_CH_LAYOUT_4_1 -->
+ <option label="34107">7</option> <!-- AE_CH_LAYOUT_5_0 -->
+ <option label="34108">8</option> <!-- AE_CH_LAYOUT_5_1 -->
+ <option label="34109">9</option> <!-- AE_CH_LAYOUT_7_0 -->
+ <option label="34110">10</option> <!-- AE_CH_LAYOUT_7_1 -->
+ </options>
+ </constraints>
+ <updates>
+ <update type="rename">audiooutput.channellayout</update>
+ </updates>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="audiooutput.normalizelevels" type="boolean" label="346" help="">
+ <level>2</level>
+ <default>true</default>
+ </setting>
+ <setting id="audiooutput.stereoupmix" type="boolean" label="252" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ <setting id="audiooutput.ac3passthrough" type="boolean" label="364" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <or>
+ <condition setting="audiooutput.mode">1</condition> <!-- AUDIO_IEC958 -->
+ <condition setting="audiooutput.mode">2</condition> <!-- AUDIO_HDMI -->
+ </or>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiooutput.dtspassthrough" type="boolean" label="254" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <or>
+ <condition setting="audiooutput.mode">1</condition> <!-- AUDIO_IEC958 -->
+ <condition setting="audiooutput.mode">2</condition> <!-- AUDIO_HDMI -->
+ </or>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiooutput.passthroughaac" type="boolean" label="299" help="">
+ <level>2</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <or>
+ <condition setting="audiooutput.mode">1</condition> <!-- AUDIO_IEC958 -->
+ <condition setting="audiooutput.mode">2</condition> <!-- AUDIO_HDMI -->
+ </or>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiooutput.multichannellpcm" type="boolean" label="348" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="audiooutput.mode">2</dependency> <!-- AUDIO_HDMI -->
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiooutput.truehdpassthrough" type="boolean" label="349" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" setting="audiooutput.mode">2</dependency> <!-- AUDIO_HDMI -->
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="audiooutput.dtshdpassthrough" type="boolean" label="347" help="">
+ <level>2</level>
+ <default>true</default>
+ <control>
+ <dependencies>
+ <dependency type="enable">
+ <and>
+ <condition setting="audiooutput.dtspassthrough">true</condition>
+ <condition setting="audiooutput.mode">2</condition> <!-- AUDIO_HDMI -->
+ </and>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="audiooutput.audiodevice" type="string" label="545" help="">
+ <level>2</level>
+ <default>Default</default> <!-- will be properly set on startup -->
+ <constraints>
+ <options>audiodevices</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="audiooutput.passthroughdevice" type="string" label="546" help="">
+ <level>2</level>
+ <default>Default</default> <!-- will be properly set on startup -->
+ <constraints>
+ <options>audiodevicespassthrough</options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable">
+ <or>
+ <condition setting="audiooutput.mode">1</condition> <!-- AUDIO_IEC958 -->
+ <condition setting="audiooutput.mode">2</condition> <!-- AUDIO_HDMI -->
+ </or>
+ </dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="audiooutput.guisoundmode" type="integer" label="34120" help="">
+ <level>0</level>
+ <default>1</default> <!-- AE_SOUND_IDLE -->
+ <constraints>
+ <options>
+ <option label="34121">1</option> <!-- AE_SOUND_IDLE -->
+ <option label="34122">2</option> <!-- AE_SOUND_ALWAYS -->
+ <option label="34123">0</option> <!-- AE_SOUND_OFF -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="input" label="14094" help="">
+ <group id="1">
+ <setting id="input.peripherals" type="action" label="35000" help="">
+ <level>2</level>
+ <control>
+ <dependencies>
+ <dependency type="enable" on="property" name="HasPeripherals" />
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="input.remoteaskeyboard" type="boolean" label="21449" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ <setting id="input.enablemouse" type="boolean" label="21369" help="">
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ <setting id="input.enablejoystick" type="boolean" label="35100" help="">
+ <visible>HAS_SDL_JOYSTICK</visible>
+ <level>0</level>
+ <default>true</default>
+ </setting>
+ </group>
+ </category>
+ <category id="network" label="798" help="">
+ <group id="1">
+ <setting id="network.usehttpproxy" type="boolean" label="708" help="">
+ <level>1</level>
+ <default>false</default>
+ </setting>
+ <setting id="network.httpproxytype" type="integer" label="1180" help="">
+ <level>1</level>
+ <default>0</default>
+ <constraints>
+ <options>
+ <option label="1181">0</option> <!-- PROXY_HTTP -->
+ <option label="1182">1</option> <!-- PROXY_SOCKS4 -->
+ <option label="1183">2</option> <!-- PROXY_SOCKS4A -->
+ <option label="1184">3</option> <!-- PROXY_SOCKS5 -->
+ <option label="1185">4</option> <!-- PROXY_SOCKS5_REMOTE -->
+ </options>
+ </constraints>
+ <control type="spinner" format="string">
+ <dependencies>
+ <dependency type="enable" setting="network.usehttpproxy">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="network.httpproxyserver" type="string" label="706" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <control type="edit" format="string">
+ <dependencies>
+ <dependency type="enable" setting="network.usehttpproxy">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="network.httpproxyport" type="integer" label="730" help="">
+ <level>1</level>
+ <default>8080</default>
+ <heading>707</heading>
+ <constraints>
+ <minimum>1</minimum>
+ <step>1</step>
+ <maximum>65535</maximum>
+ </constraints>
+ <control type="edit" format="integer">
+ <dependencies>
+ <dependency type="enable" setting="network.usehttpproxy">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="network.httpproxyusername" type="string" label="1048" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <control type="edit" format="string">
+ <dependencies>
+ <dependency type="enable" setting="network.usehttpproxy">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="network.httpproxypassword" type="string" label="733" help="">
+ <level>1</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <control type="edit" format="string" attributes="hidden">
+ <dependencies>
+ <dependency type="enable" setting="network.usehttpproxy">true</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="network.bandwidth" type="integer" label="14041" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>512</step>
+ <maximum>102400</maximum>
+ <formatlabel>14048</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="powermanagement" label="14095" help="">
+ <group id="1">
+ <setting id="powermanagement.displaysoff" type="integer" label="1450" help="">
+ <level>0</level>
+ <default>0</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>5</step>
+ <maximum>120</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="powermanagement.shutdowntime" type="integer" label="357" help="">
+ <level>2</level>
+ <default>0</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>5</step>
+ <maximum>120</maximum>
+ <formatlabel>14044</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="powermanagement.shutdownstate" type="integer" label="13008" help="">
+ <level>2</level>
+ <default>0</default> <!-- POWERSTATE_QUIT -->
+ <constraints>
+ <options>shutdownstates</options>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="debug" label="14092" help="">
+ <group id="1">
+ <setting id="debug.showloginfo" type="boolean" label="20191" help="">
+ <level>2</level>
+ <default>false</default>
+ </setting>
+ <setting id="debug.screenshotpath" type="path" label="20004" help="">
+ <level>2</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ <heading>657</heading>
+ <control type="button" format="path" />
+ </setting>
+ </group>
+ </category>
+ <category id="masterlock" label="12360" help="">
+ <access>CheckMasterLock</access>
+ <group id="1">
+ <setting id="masterlock.lockcode" type="string" label="20100" help="">
+ <level>2</level>
+ <default>-</default>
+ <control type="button" format="action" />
+ </setting>
+ <setting id="masterlock.startuplock" type="boolean" label="20076" help="">
+ <level>2</level>
+ <default>false</default>
+ <control>
+ <dependencies>
+ <dependency type="enable" on="property" name="ProfileLockMode" operator="!is">0</dependency>
+ </dependencies>
+ </control>
+ </setting>
+ <setting id="masterlock.maxretries" type="integer" label="12364" help="">
+ <level>4</level>
+ <default>3</default>
+ <constraints>
+ <minimum>3</minimum>
+ <step>1</step>
+ <maximum>100</maximum>
+ </constraints>
+ <control type="spinner" format="integer" />
+ </setting>
+ </group>
+ </category>
+ <category id="cache" label="439" help="">
+ <visible>false</visible>
+ <group id="1">
+ <setting id="cache.harddisk" type="integer" label="14025" help="">
+ <level>4</level>
+ <default>256</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>4096</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="2">
+ <setting id="cachevideo.dvdrom" type="integer" label="14026" help="">
+ <level>4</level>
+ <default>2048</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>16384</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="cachevideo.lan" type="integer" label="14027" help="">
+ <level>4</level>
+ <default>2048</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>16384</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="cachevideo.internet" type="integer" label="14028" help="">
+ <level>4</level>
+ <default>4096</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>16384</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="3">
+ <setting id="cacheaudio.dvdrom" type="integer" label="14030" help="">
+ <level>4</level>
+ <default>256</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>4096</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="cacheaudio.lan" type="integer" label="14031" help="">
+ <level>4</level>
+ <default>256</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>4096</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="cacheaudio.internet" type="integer" label="14032" help="">
+ <level>4</level>
+ <default>256</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>4096</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="4">
+ <setting id="cachedvd.dvdrom" type="integer" label="14034" help="">
+ <level>4</level>
+ <default>2048</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>16384</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ <setting id="cachedvd.lan" type="integer" label="14060" help="">
+ <level>4</level>
+ <default>2048</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>16384</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ <group id="5">
+ <setting id="cacheunknown.internet" type="integer" label="4096" help="">
+ <level>4</level>
+ <default>4096</default>
+ <constraints>
+ <minimum label="351">0</minimum>
+ <step>256</step>
+ <maximum>16384</maximum>
+ <formatlabel>14049</formatlabel>
+ </constraints>
+ <control type="spinner" format="string" />
+ </setting>
+ </group>
+ </category>
+ <category id="paths" label="" help="">
+ <group id="1">
+ <setting id="system.playlistspath" type="path" label="20006" help="">
+ <level>4</level>
+ <default></default>
+ <allowempty>true</allowempty>
+ </setting>
+ </group>
+ </category>
+ <category id="general" label="" help="">
+ <group id="1">
+ <setting id="general.addonautoupdate" type="boolean" label="0" help="">
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ <setting id="general.addonnotifications" type="boolean" label="0" help="">
+ <level>4</level>
+ <default>true</default>
+ </setting>
+ <setting id="general.addonforeignfilter" type="boolean" label="0" help="">
+ <level>4</level>
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<settings>
+ <section id="appearance">
+ <category id="locale">
+ <group id="2">
+ <visible>false</visible>
+ </group>
+ </category>
+ </section>
+ <section id="videos">
+ <category id="videoplayer">
+ <group id="2">
+ <setting id="videoplayer.usedisplayasclock">
+ <visible negated="true">HAS_GL</visible>
+ </setting>
+ <setting id="videoplayer.synctype">
+ <visible negated="true">HAS_GL</visible>
+ </setting>
+ </group>
+ </category>
+ </section>
+ <section id="services">
+ <category id="zeroconf">
+ <group id="1">
+ <setting id="services.zeroconf">
+ <default>false</default>
+ </setting>
+ </group>
+ </category>
+ <category id="smb" label="1200" help="">
+ <visible>false</visible>
+ </category>
+ </section>
+ <section id="system">
+ <category id="videoscreen">
+ <group id="1">
+ <setting id="videoscreen.fakefullscreen">
+ <visible negated="true">HAS_GL</visible>
+ </setting>
+ </group>
+ </category>
+ </section>
+</settings>
#include "PlayListPlayer.h"
#include "Autorun.h"
#include "video/Bookmark.h"
-#ifdef HAS_WEB_SERVER
-#include "network/WebServer.h"
-#include "network/httprequesthandler/HTTPImageHandler.h"
-#include "network/httprequesthandler/HTTPVfsHandler.h"
-#ifdef HAS_JSONRPC
-#include "network/httprequesthandler/HTTPJsonRpcHandler.h"
-#endif
-#ifdef HAS_WEB_INTERFACE
-#include "network/httprequesthandler/HTTPWebinterfaceHandler.h"
-#include "network/httprequesthandler/HTTPWebinterfaceAddonsHandler.h"
-#endif
-#endif
+#include "network/NetworkServices.h"
#include "guilib/GUIControlProfiler.h"
#include "utils/LangCodeExpander.h"
#include "GUIInfoManager.h"
#include "windowing/WindowingFactory.h"
#include "powermanagement/PowerManager.h"
#include "powermanagement/DPMSSupport.h"
+#include "settings/SettingAddon.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
#include "settings/MediaSettings.h"
#include "settings/MediaSourceSettings.h"
#include "settings/SkinSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/CPUInfo.h"
#include "utils/RssManager.h"
#include "utils/JobManager.h"
#include "utils/SaveFileStateJob.h"
#include "utils/AlarmClock.h"
+#include "utils/RssReader.h"
#include "utils/StringUtils.h"
#include "utils/Weather.h"
#include "DatabaseManager.h"
+#include "settings/DisplaySettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/SkinSettings.h"
+#include "view/ViewStateSettings.h"
+
#ifdef _LINUX
#include "XHandle.h"
#endif
#include "android/activity/XBMCApp.h"
#endif
+#ifdef TARGET_LINUX
+#include "linux/LinuxTimezone.h"
+#endif
+
using namespace std;
using namespace ADDON;
using namespace XFILE;
//extern IDirectSoundRenderer* m_pAudioDecoder;
CApplication::CApplication(void)
: m_pPlayer(NULL)
-#ifdef HAS_WEB_SERVER
- , m_WebServer(*new CWebServer)
- , m_httpImageHandler(*new CHTTPImageHandler)
- , m_httpVfsHandler(*new CHTTPVfsHandler)
-#ifdef HAS_JSONRPC
- , m_httpJsonRpcHandler(*new CHTTPJsonRpcHandler)
-#endif
-#ifdef HAS_WEB_INTERFACE
- , m_httpWebinterfaceHandler(*new CHTTPWebinterfaceHandler)
- , m_httpWebinterfaceAddonsHandler(*new CHTTPWebinterfaceAddonsHandler)
-#endif
-#endif
, m_itemCurrentFile(new CFileItem)
, m_stackFileItemToUpdate(new CFileItem)
, m_progressTrackingVideoResumeBookmark(*new CBookmark)
CApplication::~CApplication(void)
{
-#ifdef HAS_WEB_SERVER
- delete &m_WebServer;
- delete &m_httpImageHandler;
- delete &m_httpVfsHandler;
-#ifdef HAS_JSONRPC
- delete &m_httpJsonRpcHandler;
-#endif
-#ifdef HAS_WEB_INTERFACE
- delete &m_httpWebinterfaceHandler;
- delete &m_httpWebinterfaceAddonsHandler;
-#endif
-#endif
delete m_musicInfoScanner;
delete m_videoInfoScanner;
delete &m_progressTrackingVideoResumeBookmark;
{
g_Windowing.SetWindowResolution(newEvent.resize.w, newEvent.resize.h);
g_graphicsContext.SetVideoResolution(RES_WINDOW, true);
- g_guiSettings.SetInt("window.width", newEvent.resize.w);
- g_guiSettings.SetInt("window.height", newEvent.resize.h);
- g_settings.Save();
+ CSettings::Get().SetInt("window.width", newEvent.resize.w);
+ CSettings::Get().SetInt("window.height", newEvent.resize.h);
+ CSettings::Get().Save();
}
break;
case XBMC_VIDEOMOVE:
init_emu_environ();
CProfilesManager::Get().Load();
+ CSpecialProtocol::SetProfilePath(CProfilesManager::Get().GetProfileUserDataFolder());
CLog::Log(LOGNOTICE, "-----------------------------------------------------------------------");
#if defined(TARGET_DARWIN_OSX)
return false;
}
+ // Initialize default Settings - don't move
CLog::Log(LOGNOTICE, "load settings...");
- g_settings.RegisterSettingsHandler(this);
- g_settings.RegisterSettingsHandler(&CProfilesManager::Get());
- g_settings.RegisterSettingsHandler(&g_advancedSettings);
- g_settings.RegisterSettingsHandler(&CMediaSourceSettings::Get());
- g_settings.RegisterSettingsHandler(&CPlayerCoreFactory::Get());
- g_settings.RegisterSettingsHandler(&CRssManager::Get());
-#ifdef HAS_UPNP
- g_settings.RegisterSettingsHandler(&CUPnPSettings::Get());
-#endif
-
- g_settings.RegisterSubSettings(this);
- g_settings.RegisterSubSettings(&CDisplaySettings::Get());
- g_settings.RegisterSubSettings(&CMediaSettings::Get());
- g_settings.RegisterSubSettings(&CSkinSettings::Get());
- g_settings.RegisterSubSettings(&g_sysinfo);
- g_settings.RegisterSubSettings(&CViewStateSettings::Get());
-
- g_guiSettings.Initialize(); // Initialize default Settings - don't move
+ if (!CSettings::Get().Initialize())
+ return false;
+
g_powerManager.SetDefaults();
- if (!g_settings.Load())
+
+ // load the actual values
+ if (!CSettings::Get().Load())
{
- CLog::Log(LOGFATAL, "%s: Failed to reset settings", __FUNCTION__);
+ CLog::Log(LOGFATAL, "unable to load settings");
return false;
}
+ CSettings::Get().SetLoaded();
CLog::Log(LOGINFO, "creating subdirectories");
CLog::Log(LOGINFO, "userdata folder: %s", CProfilesManager::Get().GetProfileUserDataFolder().c_str());
- CLog::Log(LOGINFO, "recording folder: %s", g_guiSettings.GetString("audiocds.recordingpath",false).c_str());
- CLog::Log(LOGINFO, "screenshots folder: %s", g_guiSettings.GetString("debug.screenshotpath",false).c_str());
+ CLog::Log(LOGINFO, "recording folder: %s", CSettings::Get().GetString("audiocds.recordingpath").c_str());
+ CLog::Log(LOGINFO, "screenshots folder: %s", CSettings::Get().GetString("debug.screenshotpath").c_str());
CDirectory::Create(CProfilesManager::Get().GetUserDataFolder());
CDirectory::Create(CProfilesManager::Get().GetProfileUserDataFolder());
CProfilesManager::Get().CreateProfileFolders();
g_charsetConverter.reset();
// Load the langinfo to have user charset <-> utf-8 conversion
- CStdString strLanguage = g_guiSettings.GetString("locale.language");
+ CStdString strLanguage = CSettings::Get().GetString("locale.language");
strLanguage[0] = toupper(strLanguage[0]);
CStdString strLangInfoPath;
// restore AE's previous volume state
SetHardwareVolume(m_volumeLevel);
CAEFactory::SetMute (m_muted);
- CAEFactory::SetSoundMode(g_guiSettings.GetInt("audiooutput.guisoundmode"));
+ CAEFactory::SetSoundMode(CSettings::Get().GetInt("audiooutput.guisoundmode"));
// initialize the addon database (must be before the addon manager is init'd)
CDatabaseManager::Get().Initialize(true);
// Create the Mouse, Keyboard, Remote, and Joystick devices
// Initialize after loading settings to get joystick deadzone setting
g_Mouse.Initialize();
- g_Mouse.SetEnabled(g_guiSettings.GetBool("input.enablemouse"));
+ g_Mouse.SetEnabled(CSettings::Get().GetBool("input.enablemouse"));
g_Keyboard.Initialize();
#if defined(HAS_LIRC) || defined(HAS_IRSERVERSUITE)
}
// update the window resolution
- g_Windowing.SetWindowResolution(g_guiSettings.GetInt("window.width"), g_guiSettings.GetInt("window.height"));
+ g_Windowing.SetWindowResolution(CSettings::Get().GetInt("window.width"), CSettings::Get().GetInt("window.height"));
if (g_advancedSettings.m_startFullScreen && CDisplaySettings::Get().GetCurrentResolution() == RES_WINDOW)
CDisplaySettings::Get().SetCurrentResolution(RES_DESKTOP);
// initialize (and update as needed) our databases
CDatabaseManager::Get().Initialize();
-#ifdef HAS_WEB_SERVER
- CWebServer::RegisterRequestHandler(&m_httpImageHandler);
- CWebServer::RegisterRequestHandler(&m_httpVfsHandler);
-#ifdef HAS_JSONRPC
- CWebServer::RegisterRequestHandler(&m_httpJsonRpcHandler);
-#endif
-#ifdef HAS_WEB_INTERFACE
- CWebServer::RegisterRequestHandler(&m_httpWebinterfaceAddonsHandler);
- CWebServer::RegisterRequestHandler(&m_httpWebinterfaceHandler);
-#endif
-#endif
-
StartServices();
// Init DPMS, before creating the corresponding setting control.
m_dpms = new DPMSSupport();
if (g_windowManager.Initialized())
{
- g_guiSettings.GetSetting("powermanagement.displaysoff")->SetVisible(m_dpms->IsSupported());
+ CSettings::Get().GetSetting("powermanagement.displaysoff")->SetVisible(m_dpms->IsSupported());
g_windowManager.Add(new CGUIWindowHome);
g_windowManager.Add(new CGUIWindowPrograms);
/* window id's 3000 - 3100 are reserved for python */
// Make sure we have at least the default skin
- if (!LoadSkin(g_guiSettings.GetString("lookandfeel.skin")) && !LoadSkin(DEFAULT_SKIN))
+ string defaultSkin = ((const CSettingString*)CSettings::Get().GetSetting("lookandfeel.skin"))->GetDefault();
+ if (!LoadSkin(CSettings::Get().GetString("lookandfeel.skin")) && !LoadSkin(defaultSkin))
{
- CLog::Log(LOGERROR, "Default skin '%s' not found! Terminating..", DEFAULT_SKIN);
- return false;
+ CLog::Log(LOGERROR, "Default skin '%s' not found! Terminating..", defaultSkin.c_str());
+ return false;
}
if (g_advancedSettings.m_splashImage)
SAFE_DELETE(m_splash);
- if (g_guiSettings.GetBool("masterlock.startuplock") &&
+ if (CSettings::Get().GetBool("masterlock.startuplock") &&
CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
!CProfilesManager::Get().GetMasterProfile().getLockCode().IsEmpty())
{
ResetScreenSaver();
#ifdef HAS_SDL_JOYSTICK
- g_Joystick.SetEnabled(g_guiSettings.GetBool("input.enablejoystick") &&
+ g_Joystick.SetEnabled(CSettings::Get().GetBool("input.enablejoystick") &&
CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0 );
#endif
bool CApplication::StartServer(enum ESERVERS eServer, bool bStart, bool bWait/* = false*/)
{
- bool ret = true;
- bool oldSetting = false;
-
+ bool ret = false;
switch(eServer)
{
case ES_WEBSERVER:
- oldSetting = g_guiSettings.GetBool("services.webserver");
- g_guiSettings.SetBool("services.webserver", bStart);
-
- if (bStart)
- ret = StartWebServer();
- else
- StopWebServer();
-
- if (!ret)
- {
- g_guiSettings.SetBool("services.webserver", oldSetting);
- }
+ // the callback will take care of starting/stopping webserver
+ ret = CSettings::Get().SetBool("services.webserver", bStart);
break;
- case ES_AIRPLAYSERVER:
- oldSetting = g_guiSettings.GetBool("services.airplay");
- g_guiSettings.SetBool("services.airplay", bStart);
-
- if (bStart)
- ret = StartAirplayServer();
- else
- StopAirplayServer(bWait);
- if (!ret)
- {
- g_guiSettings.SetBool("services.airplay", oldSetting);
- }
+ case ES_AIRPLAYSERVER:
+ // the callback will take care of starting/stopping airplay
+ ret = CSettings::Get().SetBool("services.airplay", bStart);
break;
- case ES_JSONRPCSERVER:
- oldSetting = g_guiSettings.GetBool("services.esenabled");
- g_guiSettings.SetBool("services.esenabled", bStart);
- if (bStart)
- ret = StartJSONRPCServer();
- else
- StopJSONRPCServer(bWait);
-
- if (!ret)
- {
- g_guiSettings.SetBool("services.esenabled", oldSetting);
- }
+ case ES_JSONRPCSERVER:
+ // the callback will take care of starting/stopping jsonrpc server
+ ret = CSettings::Get().SetBool("services.esenabled", bStart);
break;
+
case ES_UPNPSERVER:
- g_guiSettings.SetBool("services.upnpserver", bStart);
- if (bStart)
- StartUPnPServer();
- else
- StopUPnPServer();
+ // the callback will take care of starting/stopping upnp server
+ ret = CSettings::Get().SetBool("services.upnpserver", bStart);
break;
+
case ES_UPNPRENDERER:
- g_guiSettings.SetBool("services.upnprenderer", bStart);
- if (bStart)
- StartUPnPRenderer();
- else
- StopUPnPRenderer();
+ // the callback will take care of starting/stopping upnp renderer
+ ret = CSettings::Get().SetBool("services.upnprenderer", bStart);
break;
- case ES_EVENTSERVER:
- oldSetting = g_guiSettings.GetBool("services.esenabled");
- g_guiSettings.SetBool("services.esenabled", bStart);
-
- if (bStart)
- ret = StartEventServer();
- else
- StopEventServer(bWait, false);
-
- if (!ret)
- {
- g_guiSettings.SetBool("services.esenabled", oldSetting);
- }
+ case ES_EVENTSERVER:
+ // the callback will take care of starting/stopping event server
+ ret = CSettings::Get().SetBool("services.esenabled", bStart);
break;
+
case ES_ZEROCONF:
- g_guiSettings.SetBool("services.zeroconf", bStart);
- if (bStart)
- StartZeroconf();
- else
- StopZeroconf();
+ // the callback will take care of starting/stopping zeroconf
+ ret = CSettings::Get().SetBool("services.zeroconf", bStart);
break;
+
default:
ret = false;
break;
}
- g_settings.Save();
+ CSettings::Get().Save();
return ret;
}
-bool CApplication::StartWebServer()
-{
-#ifdef HAS_WEB_SERVER
- if (g_guiSettings.GetBool("services.webserver") && m_network->IsAvailable())
- {
- int webPort = atoi(g_guiSettings.GetString("services.webserverport"));
- CLog::Log(LOGNOTICE, "Webserver: Starting...");
-#ifdef _LINUX
- if (webPort < 1024 && !CUtil::CanBindPrivileged())
- {
- CLog::Log(LOGERROR, "Cannot start Web Server on port %i, no permission to bind to ports below 1024", webPort);
- return false;
- }
-#endif
-
- bool started = false;
- if (m_WebServer.Start(webPort, g_guiSettings.GetString("services.webserverusername"), g_guiSettings.GetString("services.webserverpassword")))
- {
- std::vector<std::pair<std::string, std::string> > txt;
- started = true;
- // publish web frontend and API services
-#ifdef HAS_WEB_INTERFACE
- CZeroconf::GetInstance()->PublishService("servers.webserver", "_http._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), webPort, txt);
-#endif
-#ifdef HAS_JSONRPC
- CZeroconf::GetInstance()->PublishService("servers.jsonrpc-http", "_xbmc-jsonrpc-h._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), webPort, txt);
-#endif
- }
-
- return started;
- }
-#endif
-
- return true;
-}
-
-void CApplication::StopWebServer()
-{
-#ifdef HAS_WEB_SERVER
- if (m_WebServer.IsStarted())
- {
- CLog::Log(LOGNOTICE, "Webserver: Stopping...");
- m_WebServer.Stop();
- if(! m_WebServer.IsStarted() )
- {
- CLog::Log(LOGNOTICE, "Webserver: Stopped...");
- CZeroconf::GetInstance()->RemoveService("servers.webserver");
- CZeroconf::GetInstance()->RemoveService("servers.jsonrpc-http");
- } else
- CLog::Log(LOGWARNING, "Webserver: Failed to stop.");
- }
-#endif
-}
-
-bool CApplication::StartAirplayServer()
+void CApplication::StartPVRManager(bool bOpenPVRWindow /* = false */)
{
- bool ret = false;
-#ifdef HAS_AIRPLAY
- if (g_guiSettings.GetBool("services.airplay") && m_network->IsAvailable())
- {
- int listenPort = g_advancedSettings.m_airPlayPort;
- CStdString password = g_guiSettings.GetString("services.airplaypassword");
- bool usePassword = g_guiSettings.GetBool("services.useairplaypassword");
-
- if (CAirPlayServer::StartServer(listenPort, true))
- {
- CAirPlayServer::SetCredentials(usePassword, password);
- std::vector<std::pair<std::string, std::string> > txt;
- CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
- if (iface)
- {
- txt.push_back(std::make_pair("deviceid", iface->GetMacAddress()));
- }
- else
- {
- 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", "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;
- }
- }
- if (ret)
-#endif
- {
-#ifdef HAS_AIRTUNES
- if (g_guiSettings.GetBool("services.airplay") && m_network->IsAvailable())
- {
- int listenPort = g_advancedSettings.m_airTunesPort;
- CStdString password = g_guiSettings.GetString("services.airplaypassword");
- bool usePassword = g_guiSettings.GetBool("services.useairplaypassword");
-
- if (!CAirTunesServer::StartServer(listenPort, true, usePassword, password))
- {
- CLog::Log(LOGERROR, "Failed to start AirTunes Server");
- }
- ret = true;
- }
-#endif
- }
- return ret;
+ if (CSettings::Get().GetBool("pvrmanager.enabled"))
+ g_PVRManager.Start(true, bOpenPVRWindow);
}
-void CApplication::StopAirplayServer(bool bWait)
+void CApplication::StopPVRManager()
{
-#ifdef HAS_AIRPLAY
- CAirPlayServer::StopServer(bWait);
- CZeroconf::GetInstance()->RemoveService("servers.airplay");
-#endif
-#ifdef HAS_AIRTUNES
- CAirTunesServer::StopServer(bWait);
-#endif
+ CLog::Log(LOGINFO, "stopping PVRManager");
+ if (g_PVRManager.IsPlaying())
+ StopPlaying();
+ g_PVRManager.Stop();
+ g_EpgContainer.Stop();
}
-bool CApplication::StartJSONRPCServer()
+void CApplication::StartServices()
{
-#ifdef HAS_JSONRPC
- if (g_guiSettings.GetBool("services.esenabled"))
- {
- if (CTCPServer::StartServer(g_advancedSettings.m_jsonTcpPort, g_guiSettings.GetBool("services.esallinterfaces")))
- {
- std::vector<std::pair<std::string, std::string> > txt;
- CZeroconf::GetInstance()->PublishService("servers.jsonrpc-tcp", "_xbmc-jsonrpc._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), g_advancedSettings.m_jsonTcpPort, txt);
- return true;
- }
- else
- return false;
- }
+#if !defined(_WIN32) && defined(HAS_DVD_DRIVE)
+ // Start Thread for DVD Mediatype detection
+ CLog::Log(LOGNOTICE, "start dvd mediatype detection");
+ m_DetectDVDType.Create(false, THREAD_MINSTACKSIZE);
#endif
- return true;
-}
-
-void CApplication::StopJSONRPCServer(bool bWait)
-{
-#ifdef HAS_JSONRPC
- CTCPServer::StopServer(bWait);
- CZeroconf::GetInstance()->RemoveService("servers.jsonrpc-tcp");
-#endif
+ CLog::Log(LOGNOTICE, "initializing playlistplayer");
+ g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, CMediaSettings::Get().DoesMusicPlaylistRepeat() ? PLAYLIST::REPEAT_ALL : PLAYLIST::REPEAT_NONE);
+ g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, CMediaSettings::Get().IsMusicPlaylistShuffled());
+ g_playlistPlayer.SetRepeat(PLAYLIST_VIDEO, CMediaSettings::Get().DoesVideoPlaylistRepeat() ? PLAYLIST::REPEAT_ALL : PLAYLIST::REPEAT_NONE);
+ g_playlistPlayer.SetShuffle(PLAYLIST_VIDEO, CMediaSettings::Get().IsVideoPlaylistShuffled());
+ CLog::Log(LOGNOTICE, "DONE initializing playlistplayer");
}
-void CApplication::StartUPnP()
+void CApplication::StopServices()
{
-#ifdef HAS_UPNP
- StartUPnPClient();
- StartUPnPServer();
- StartUPnPRenderer();
-#endif
-}
+ m_network->NetworkMessage(CNetwork::SERVICES_DOWN, 0);
-void CApplication::StopUPnP(bool bWait)
-{
-#ifdef HAS_UPNP
- if (UPNP::CUPnP::IsInstantiated())
- {
- CLog::Log(LOGNOTICE, "stopping upnp");
- UPNP::CUPnP::ReleaseInstance(bWait);
- }
+#if !defined(_WIN32) && defined(HAS_DVD_DRIVE)
+ CLog::Log(LOGNOTICE, "stop dvd detect media");
+ m_DetectDVDType.StopThread();
#endif
-}
-bool CApplication::StartEventServer()
-{
-#ifdef HAS_EVENT_SERVER
- CEventServer* server = CEventServer::GetInstance();
- if (!server)
- {
- CLog::Log(LOGERROR, "ES: Out of memory");
- return false;
- }
- if (g_guiSettings.GetBool("services.esenabled"))
- {
- CLog::Log(LOGNOTICE, "ES: Starting event server");
- server->StartServer();
- return true;
- }
-#endif
- return true;
+ g_peripherals.Clear();
}
-bool CApplication::StopEventServer(bool bWait, bool promptuser)
+void CApplication::OnSettingChanged(const CSetting *setting)
{
-#ifdef HAS_EVENT_SERVER
- CEventServer* server = CEventServer::GetInstance();
- if (!server)
- {
- CLog::Log(LOGERROR, "ES: Out of memory");
- return false;
- }
- if (promptuser)
- {
- if (server->GetNumberOfClients() > 0)
- {
- bool cancelled = false;
- if (!CGUIDialogYesNo::ShowAndGetInput(13140, 13141, 13142, 20022,
- -1, -1, cancelled, 10000)
- || cancelled)
- {
- CLog::Log(LOGNOTICE, "ES: Not stopping event server");
- return false;
- }
- }
- CLog::Log(LOGNOTICE, "ES: Stopping event server with confirmation");
+ if (setting == NULL)
+ return;
- CEventServer::GetInstance()->StopServer(true);
+ const std::string &settingId = setting->GetId();
+ if (settingId == "lookandfeel.skin" ||
+ settingId == "lookandfeel.font" ||
+ settingId == "lookandfeel.skincolors")
+ ReloadSkin();
+ else if (settingId == "lookandfeel.skintheme")
+ {
+ // also set the default color theme
+ string colorTheme = URIUtils::ReplaceExtension(((CSettingString*)setting)->GetValue(), ".xml");
+ if (StringUtils::EqualsNoCase(colorTheme, "Textures.xml"))
+ colorTheme = "defaults.xml";
+
+ // check if we have to change the skin color
+ // if yes, it will trigger a call to ReloadSkin() in
+ // it's OnSettingChanged() callback
+ // if no we have to call ReloadSkin() ourselves
+ if (!StringUtils::EqualsNoCase(colorTheme, CSettings::Get().GetString("lookandfeel.skincolors")))
+ CSettings::Get().SetString("lookandfeel.skincolors", colorTheme);
+ else
+ ReloadSkin();
}
- else
+ else if (settingId == "lookandfeel.skinzoom")
+ g_windowManager.SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE);
+ else if (StringUtils::StartsWith(settingId, "audiooutput."))
{
- if (!bWait)
- CLog::Log(LOGNOTICE, "ES: Stopping event server");
+ if (settingId == "audiooutput.guisoundmode")
+ CAEFactory::SetSoundMode(((CSettingInt*)setting)->GetValue());
- CEventServer::GetInstance()->StopServer(bWait);
+ CAEFactory::OnSettingsChange(settingId);
}
-
- return true;
-#endif
+ else if (StringUtils::EqualsNoCase(settingId, "musicplayer.replaygaintype"))
+ m_replayGainSettings.iType = ((CSettingInt*)setting)->GetValue();
+ else if (StringUtils::EqualsNoCase(settingId, "musicplayer.replaygainpreamp"))
+ m_replayGainSettings.iPreAmp = ((CSettingInt*)setting)->GetValue();
+ else if (StringUtils::EqualsNoCase(settingId, "musicplayer.replaygainnogainpreamp"))
+ m_replayGainSettings.iNoGainPreAmp = ((CSettingInt*)setting)->GetValue();
+ else if (StringUtils::EqualsNoCase(settingId, "musicplayer.replaygainavoidclipping"))
+ m_replayGainSettings.bAvoidClipping = ((CSettingBool*)setting)->GetValue();
}
-void CApplication::RefreshEventServer()
+void CApplication::OnSettingAction(const CSetting *setting)
{
-#ifdef HAS_EVENT_SERVER
- if (g_guiSettings.GetBool("services.esenabled"))
- {
- CEventServer::GetInstance()->RefreshSettings();
- }
-#endif
-}
+ if (setting == NULL)
+ return;
-void CApplication::StartUPnPClient()
-{
-#ifdef HAS_UPNP
- if (g_guiSettings.GetBool("services.upnpcontroller"))
+ const std::string &settingId = setting->GetId();
+ if (settingId == "lookandfeel.skinsettings")
+ g_windowManager.ActivateWindow(WINDOW_SKIN_SETTINGS);
+ else if (settingId == "screensaver.preview")
+ ActivateScreenSaver(true);
+ else if (settingId == "screensaver.settings")
{
- CLog::Log(LOGNOTICE, "starting upnp client");
- UPNP::CUPnP::GetInstance()->StartClient();
+ AddonPtr addon;
+ if (CAddonMgr::Get().GetAddon(CSettings::Get().GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
+ CGUIDialogAddonSettings::ShowAndGetInput(addon);
}
-#endif
+ else if (settingId == "videoscreen.guicalibration")
+ g_windowManager.ActivateWindow(WINDOW_SCREEN_CALIBRATION);
+ else if (settingId == "videoscreen.testpattern")
+ g_windowManager.ActivateWindow(WINDOW_TEST_PATTERN);
}
-void CApplication::StopUPnPClient()
+bool CApplication::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
{
-#ifdef HAS_UPNP
- if (UPNP::CUPnP::IsInstantiated())
- {
- CLog::Log(LOGNOTICE, "stopping upnp client");
- UPNP::CUPnP::GetInstance()->StopClient();
- }
-#endif
-}
+ if (setting == NULL)
+ return false;
-void CApplication::StartUPnPRenderer()
-{
-#ifdef HAS_UPNP
- if (g_guiSettings.GetBool("services.upnprenderer"))
+ const std::string &settingId = setting->GetId();
+ if (settingId == "audiooutput.channels")
{
- CLog::Log(LOGNOTICE, "starting upnp renderer");
- UPNP::CUPnP::GetInstance()->StartRenderer();
- }
-#endif
-}
+ // check if this is an update from Eden
+ if (oldSettingId != NULL && oldSettingNode != NULL &&
+ StringUtils::EqualsNoCase(oldSettingId, "audiooutput.channellayout"))
+ {
+ bool ret = false;
+ CSettingInt* channels = (CSettingInt*)setting;
+ if (channels->FromString(oldSettingNode->FirstChild()->ValueStr()) && channels->GetValue() < AE_CH_LAYOUT_MAX - 1)
+ ret = channels->SetValue(channels->GetValue() + 1);
-void CApplication::StopUPnPRenderer()
-{
-#ifdef HAS_UPNP
- if (UPNP::CUPnP::IsInstantiated())
- {
- CLog::Log(LOGNOTICE, "stopping upnp renderer");
- UPNP::CUPnP::GetInstance()->StopRenderer();
- }
-#endif
-}
+ // let's just reset the audiodevice settings as well
+ std::string audiodevice = CSettings::Get().GetString("audiooutput.audiodevice");
+ CAEFactory::VerifyOutputDevice(audiodevice, false);
+ ret |= CSettings::Get().SetString("audiooutput.audiodevice", audiodevice.c_str());
-void CApplication::StartUPnPServer()
-{
-#ifdef HAS_UPNP
- if (g_guiSettings.GetBool("services.upnpserver"))
- {
- CLog::Log(LOGNOTICE, "starting upnp server");
- UPNP::CUPnP::GetInstance()->StartServer();
- }
-#endif
-}
-
-void CApplication::StopUPnPServer()
-{
-#ifdef HAS_UPNP
- if (UPNP::CUPnP::IsInstantiated())
- {
- CLog::Log(LOGNOTICE, "stopping upnp server");
- UPNP::CUPnP::GetInstance()->StopServer();
+ return ret;
+ }
}
-#endif
-}
-
-void CApplication::StartZeroconf()
-{
-#ifdef HAS_ZEROCONF
- //entry in guisetting only present if HAS_ZEROCONF is set
- if(g_guiSettings.GetBool("services.zeroconf"))
+ else if (settingId == "screensaver.mode")
{
- CLog::Log(LOGNOTICE, "starting zeroconf publishing");
- CZeroconf::GetInstance()->Start();
+ CSettingString *screensaverMode = (CSettingString*)setting;
+ // we no longer ship the built-in slideshow screensaver, replace it if it's still in use
+ if (StringUtils::EqualsNoCase(screensaverMode->GetValue(), "screensaver.xbmc.builtin.slideshow"))
+ return screensaverMode->SetValue("screensaver.xbmc.builtin.dim");
}
-#endif
-}
-
-void CApplication::StopZeroconf()
-{
-#ifdef HAS_ZEROCONF
- if(CZeroconf::IsInstantiated())
+ else if (settingId == "scrapers.musicvideosdefault")
{
- CLog::Log(LOGNOTICE, "stopping zeroconf publishing");
- CZeroconf::GetInstance()->Stop();
+ CSettingAddon *musicvideoScraper = (CSettingAddon*)setting;
+ if (StringUtils::EqualsNoCase(musicvideoScraper->GetValue(), "metadata.musicvideos.last.fm"))
+ {
+ musicvideoScraper->Reset();
+ return true;
+ }
}
-#endif
-}
-
-void CApplication::StartPVRManager(bool bOpenPVRWindow /* = false */)
-{
- if (g_guiSettings.GetBool("pvrmanager.enabled"))
- g_PVRManager.Start(true, bOpenPVRWindow);
-}
-
-void CApplication::StopPVRManager()
-{
- CLog::Log(LOGINFO, "stopping PVRManager");
- if (g_PVRManager.IsPlaying())
- StopPlaying();
- g_PVRManager.Stop();
- g_EpgContainer.Stop();
-}
-
-void CApplication::StartServices()
-{
-#if !defined(_WIN32) && defined(HAS_DVD_DRIVE)
- // Start Thread for DVD Mediatype detection
- CLog::Log(LOGNOTICE, "start dvd mediatype detection");
- m_DetectDVDType.Create(false, THREAD_MINSTACKSIZE);
-#endif
- CLog::Log(LOGNOTICE, "initializing playlistplayer");
- g_playlistPlayer.SetRepeat(PLAYLIST_MUSIC, CMediaSettings::Get().DoesMusicPlaylistRepeat() ? PLAYLIST::REPEAT_ALL : PLAYLIST::REPEAT_NONE);
- g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, CMediaSettings::Get().IsMusicPlaylistShuffled());
- g_playlistPlayer.SetRepeat(PLAYLIST_VIDEO, CMediaSettings::Get().DoesVideoPlaylistRepeat() ? PLAYLIST::REPEAT_ALL : PLAYLIST::REPEAT_NONE);
- g_playlistPlayer.SetShuffle(PLAYLIST_VIDEO, CMediaSettings::Get().IsVideoPlaylistShuffled());
- CLog::Log(LOGNOTICE, "DONE initializing playlistplayer");
+ return false;
}
-void CApplication::StopServices()
+bool CApplication::OnSettingsSaving() const
{
- m_network->NetworkMessage(CNetwork::SERVICES_DOWN, 0);
-
-#if !defined(_WIN32) && defined(HAS_DVD_DRIVE)
- CLog::Log(LOGNOTICE, "stop dvd detect media");
- m_DetectDVDType.StopThread();
-#endif
+ // don't save settings when we're busy stopping the application
+ // a lot of screens try to save settings on deinit and deinit is
+ // called for every screen when the application is stopping
+ if (m_bStop)
+ return false;
- g_peripherals.Clear();
+ return true;
}
void CApplication::ReloadSkin()
if (pWindow)
iCtrlID = pWindow->GetFocusedControlID();
- g_application.LoadSkin(g_guiSettings.GetString("lookandfeel.skin"));
+ g_application.LoadSkin(CSettings::Get().GetString("lookandfeel.skin"));
if (iCtrlID != -1)
{
}
}
-bool CApplication::OnSettingsSaving() const
-{
- // Don't save settings when we're busy stopping the application.
- // A lot of screens try to save settings on deinit and deinit is called
- // for every screen when the application is stopping.
- return !m_bStop;
-}
-
bool CApplication::Load(const TiXmlNode *settings)
{
if (settings == NULL)
void CApplication::LoadSkin(const SkinPtr& skin)
{
+ string defaultSkin = ((const CSettingString*)CSettings::Get().GetSetting("lookandfeel.skin"))->GetDefault();
if (!skin)
{
- CLog::Log(LOGERROR, "failed to load requested skin, fallback to \"%s\" skin", DEFAULT_SKIN);
- g_guiSettings.SetString("lookandfeel.skin", DEFAULT_SKIN);
- LoadSkin(DEFAULT_SKIN);
+ CLog::Log(LOGERROR, "failed to load requested skin, fallback to \"%s\" skin", defaultSkin.c_str());
+ CSettings::Get().SetString("lookandfeel.skin", defaultSkin);
return ;
}
{
// failed to find home.xml
// fallback to default skin
- if (strcmpi(skin->ID().c_str(), DEFAULT_SKIN) != 0)
+ if (strcmpi(skin->ID().c_str(), defaultSkin.c_str()) != 0)
{
- CLog::Log(LOGERROR, "home.xml doesn't exist in skin: %s, fallback to \"%s\" skin", skin->ID().c_str(), DEFAULT_SKIN);
- g_guiSettings.SetString("lookandfeel.skin", DEFAULT_SKIN);
- LoadSkin(DEFAULT_SKIN);
+ CLog::Log(LOGERROR, "home.xml doesn't exist in skin: %s, fallback to \"%s\" skin", skin->ID().c_str(), defaultSkin.c_str());
+ CSettings::Get().SetString("lookandfeel.skin", defaultSkin);
+ LoadSkin(defaultSkin);
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error, g_localizeStrings.Get(24102), g_localizeStrings.Get(24103));
return ;
}
CLog::Log(LOGINFO, " load fonts for skin...");
g_graphicsContext.SetMediaDir(skin->Path());
g_directoryCache.ClearSubPaths(skin->Path());
- if (g_langInfo.ForceUnicodeFont() && !g_fontManager.IsFontSetUnicode(g_guiSettings.GetString("lookandfeel.font")))
+ if (g_langInfo.ForceUnicodeFont() && !g_fontManager.IsFontSetUnicode(CSettings::Get().GetString("lookandfeel.font")))
{
CLog::Log(LOGINFO, " language needs a ttf font, loading first ttf font available");
CStdString strFontSet;
if (g_fontManager.GetFirstFontSetUnicode(strFontSet))
{
CLog::Log(LOGINFO, " new font is '%s'", strFontSet.c_str());
- g_guiSettings.SetString("lookandfeel.font", strFontSet);
- g_settings.Save();
+ CSettings::Get().SetString("lookandfeel.font", strFontSet);
+ CSettings::Get().Save();
}
else
- CLog::Log(LOGERROR, " no ttf font found, but needed for the language %s.", g_guiSettings.GetString("locale.language").c_str());
+ CLog::Log(LOGERROR, " no ttf font found, but needed for the language %s.", CSettings::Get().GetString("locale.language").c_str());
}
- g_colorManager.Load(g_guiSettings.GetString("lookandfeel.skincolors"));
+ g_colorManager.Load(CSettings::Get().GetString("lookandfeel.skincolors"));
- g_fontManager.LoadFonts(g_guiSettings.GetString("lookandfeel.font"));
+ g_fontManager.LoadFonts(CSettings::Get().GetString("lookandfeel.font"));
// load in the skin strings
CStdString langPath;
URIUtils::AddFileToFolder(skin->Path(), "language", langPath);
URIUtils::AddSlashAtEnd(langPath);
- g_localizeStrings.LoadSkinStrings(langPath, g_guiSettings.GetString("locale.language"));
+ g_localizeStrings.LoadSkinStrings(langPath, CSettings::Get().GetString("locale.language"));
g_SkinInfo->LoadIncludes();
MEASURE_FUNCTION;
- int vsync_mode = g_guiSettings.GetInt("videoscreen.vsync");
+ int vsync_mode = CSettings::Get().GetInt("videoscreen.vsync");
bool decrement = false;
bool hasRendered = false;
if (useKeyboard)
{
action = CAction(0); // reset our action
- if (g_guiSettings.GetBool("input.remoteaskeyboard"))
+ if (CSettings::Get().GetBool("input.remoteaskeyboard"))
{
// users remote is executing keyboard commands, so use the virtualkeyboard section of keymap.xml
// and send those rather than actual keyboard presses. Only for navigation-type commands though
if (action.GetID() == ACTION_TOGGLE_DIGITAL_ANALOG)
{
// we are only allowed to SetInt to a value supported in GUISettings, so we keep trying until it sticks
- int mode = g_guiSettings.GetInt("audiooutput.mode");
- for (int i = 0; i < AUDIO_COUNT; i++)
+ int mode = CSettings::Get().GetInt("audiooutput.mode");
+ for (int i = 0; i < 3; i++)
{
- if (++mode == AUDIO_COUNT)
+ if (++mode == 3)
mode = 0;
- g_guiSettings.SetInt("audiooutput.mode", mode);
- if (g_guiSettings.GetInt("audiooutput.mode") == mode)
+ CSettings::Get().SetInt("audiooutput.mode", mode);
+ if (CSettings::Get().GetInt("audiooutput.mode") == mode)
break;
}
#endif
DllLoaderContainer::Clear();
g_playlistPlayer.Clear();
- g_settings.Clear();
- g_guiSettings.Clear();
+ CSettings::Get().Uninitialize();
g_advancedSettings.Clear();
-
- g_settings.UnregisterSubSettings(this);
- g_settings.UnregisterSubSettings(&CDisplaySettings::Get());
- g_settings.UnregisterSubSettings(&CMediaSettings::Get());
- g_settings.UnregisterSubSettings(&CSkinSettings::Get());
- g_settings.UnregisterSubSettings(&g_sysinfo);
- g_settings.UnregisterSubSettings(&CViewStateSettings::Get());
-
- g_settings.UnregisterSettingsHandler(&g_advancedSettings);
- g_settings.UnregisterSettingsHandler(&CMediaSourceSettings::Get());
- g_settings.UnregisterSettingsHandler(&CPlayerCoreFactory::Get());
- g_settings.UnregisterSettingsHandler(&CRssManager::Get());
-#ifdef HAS_UPNP
- g_settings.UnregisterSettingsHandler(&CUPnPSettings::Get());
-#endif
- g_settings.UnregisterSettingsHandler(&CProfilesManager::Get());
- g_settings.UnregisterSettingsHandler(this);
#ifdef _LINUX
CXHandle::DumpObjectTracker();
if (CFile::Exists(CProfilesManager::Get().GetSettingsFile()))
{
CLog::Log(LOGNOTICE, "Saving settings");
- g_settings.Save();
+ CSettings::Get().Save();
}
else
CLog::Log(LOGNOTICE, "Not saving settings (settings.xml is not present)");
StopServices();
//Sleep(5000);
-#ifdef HAS_WEB_SERVER
- CWebServer::UnregisterRequestHandler(&m_httpImageHandler);
- CWebServer::UnregisterRequestHandler(&m_httpVfsHandler);
-#ifdef HAS_JSONRPC
- CWebServer::UnregisterRequestHandler(&m_httpJsonRpcHandler);
- CJSONRPC::Cleanup();
-#endif
-#ifdef HAS_WEB_INTERFACE
- CWebServer::UnregisterRequestHandler(&m_httpWebinterfaceAddonsHandler);
- CWebServer::UnregisterRequestHandler(&m_httpWebinterfaceHandler);
-#endif
-#endif
-
if (m_pPlayer)
{
CLog::Log(LOGNOTICE, "stop player");
{
if (m_iScreenSaveLock == 0)
if (CProfilesManager::Get().GetMasterProfile().getLockMode() != LOCK_MODE_EVERYONE &&
- (CProfilesManager::Get().UsingLoginScreen() || g_guiSettings.GetBool("masterlock.startuplock")) &&
+ (CProfilesManager::Get().UsingLoginScreen() || CSettings::Get().GetBool("masterlock.startuplock")) &&
CProfilesManager::Get().GetCurrentProfile().getLockMode() != LOCK_MODE_EVERYONE &&
m_screenSaver->ID() != "screensaver.xbmc.builtin.dim" && m_screenSaver->ID() != "screensaver.xbmc.builtin.black" && !m_screenSaver->ID().empty() && m_screenSaver->ID() != "visualization")
{
bool maybeScreensaver =
!m_dpmsIsActive && !m_bScreenSave
- && !g_guiSettings.GetString("screensaver.mode").IsEmpty();
+ && !CSettings::Get().GetString("screensaver.mode").empty();
bool maybeDPMS =
!m_dpmsIsActive && m_dpms->IsSupported()
- && g_guiSettings.GetInt("powermanagement.displaysoff") > 0;
+ && CSettings::Get().GetInt("powermanagement.displaysoff") > 0;
// Has the screen saver window become active?
if (maybeScreensaver && g_windowManager.IsWindowActive(WINDOW_SCREENSAVER))
if ((IsPlayingVideo() && !m_pPlayer->IsPaused())
// * Are we playing some music in fullscreen vis?
|| (IsPlayingAudio() && g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION
- && !g_guiSettings.GetString("musicplayer.visualisation").IsEmpty()))
+ && !CSettings::Get().GetString("musicplayer.visualisation").empty()))
{
ResetScreenSaverTimer();
return;
// DPMS has priority (it makes the screensaver not needed)
if (maybeDPMS
- && elapsed > g_guiSettings.GetInt("powermanagement.displaysoff") * 60)
+ && elapsed > CSettings::Get().GetInt("powermanagement.displaysoff") * 60)
{
ToggleDPMS(false);
WakeUpScreenSaver();
}
else if (maybeScreensaver
- && elapsed > g_guiSettings.GetInt("screensaver.time") * 60)
+ && elapsed > CSettings::Get().GetInt("screensaver.time") * 60)
{
ActivateScreenSaver();
}
// Get Screensaver Mode
m_screenSaver.reset();
- if (!CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), m_screenSaver))
+ if (!CAddonMgr::Get().GetAddon(CSettings::Get().GetString("screensaver.mode"), m_screenSaver))
m_screenSaver.reset(new CScreenSaver(""));
CAnnouncementManager::Announce(GUI, "xbmc", "OnScreensaverActivated");
if (!forceType)
{
// set to Dim in the case of a dialog on screen or playing video
- if (g_windowManager.HasModalDialog() || (IsPlayingVideo() && g_guiSettings.GetBool("screensaver.usedimonpause")) || g_PVRManager.IsRunningChannelScan())
+ if (g_windowManager.HasModalDialog() || (IsPlayingVideo() && CSettings::Get().GetBool("screensaver.usedimonpause")) || g_PVRManager.IsRunningChannelScan())
{
if (!CAddonMgr::Get().GetAddon("screensaver.xbmc.builtin.dim", m_screenSaver))
m_screenSaver.reset(new CScreenSaver(""));
}
// Check if we are Playing Audio and Vis instead Screensaver!
- else if (IsPlayingAudio() && g_guiSettings.GetBool("screensaver.usemusicvisinstead") && !g_guiSettings.GetString("musicplayer.visualisation").IsEmpty())
+ else if (IsPlayingAudio() && CSettings::Get().GetBool("screensaver.usemusicvisinstead") && !CSettings::Get().GetString("musicplayer.visualisation").empty())
{ // activate the visualisation
m_screenSaver.reset(new CScreenSaver("visualization"));
g_windowManager.ActivateWindow(WINDOW_VISUALISATION);
if (g_windowManager.IsWindowActive(WINDOW_DIALOG_PROGRESS)) // progress dialog is onscreen
resetTimer = true;
- if (g_guiSettings.GetBool("pvrmanager.enabled") && !g_PVRManager.IsIdle())
+ if (CSettings::Get().GetBool("pvrmanager.enabled") && !g_PVRManager.IsIdle())
resetTimer = true;
if (resetTimer)
return;
}
- if ( m_shutdownTimer.GetElapsedSeconds() > g_guiSettings.GetInt("powermanagement.shutdowntime") * 60 )
+ if ( m_shutdownTimer.GetElapsedSeconds() > CSettings::Get().GetInt("powermanagement.shutdowntime") * 60 )
{
// Since it is a sleep instead of a shutdown, let's set everything to reset when we wake up.
m_shutdownTimer.Stop();
{
// Start our cdg parser as appropriate
#ifdef HAS_KARAOKE
- if (m_pKaraokeMgr && g_guiSettings.GetBool("karaoke.enabled") && !m_itemCurrentFile->IsInternetStream())
+ if (m_pKaraokeMgr && CSettings::Get().GetBool("karaoke.enabled") && !m_itemCurrentFile->IsInternetStream())
{
m_pKaraokeMgr->Stop();
if (m_itemCurrentFile->IsMusicDb())
if (!IsPlayingAudio() && g_playlistPlayer.GetCurrentPlaylist() == PLAYLIST_NONE && g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
{
- g_settings.Save(); // save vis settings
+ CSettings::Get().Save(); // save vis settings
WakeUpScreenSaverAndDPMS();
g_windowManager.PreviousWindow();
}
if (!IsPlayingAudio() && (m_itemCurrentFile->IsCDDA() || m_itemCurrentFile->IsOnDVD()) && !g_mediaManager.IsDiscInDrive() && g_windowManager.GetActiveWindow() == WINDOW_VISUALISATION)
{
// yes, disable vis
- g_settings.Save(); // save vis settings
+ CSettings::Get().Save(); // save vis settings
WakeUpScreenSaverAndDPMS();
g_windowManager.PreviousWindow();
}
// Check if we need to shutdown (if enabled).
#if defined(TARGET_DARWIN)
- if (g_guiSettings.GetInt("powermanagement.shutdowntime") && g_advancedSettings.m_fullScreen)
+ if (CSettings::Get().GetInt("powermanagement.shutdowntime") && g_advancedSettings.m_fullScreen)
#else
- if (g_guiSettings.GetInt("powermanagement.shutdowntime"))
+ if (CSettings::Get().GetInt("powermanagement.shutdowntime"))
#endif
{
CheckShutdown();
void CApplication::UpdateLibraries()
{
- if (g_guiSettings.GetBool("videolibrary.updateonstartup"))
+ if (CSettings::Get().GetBool("videolibrary.updateonstartup"))
{
CLog::Log(LOGNOTICE, "%s - Starting video library startup scan", __FUNCTION__);
StartVideoScan("");
}
- if (g_guiSettings.GetBool("musiclibrary.updateonstartup"))
+ if (CSettings::Get().GetBool("musiclibrary.updateonstartup"))
{
CLog::Log(LOGNOTICE, "%s - Starting music library startup scan", __FUNCTION__);
StartMusicScan("");
if (!flags)
{ // setup default flags
- if (g_guiSettings.GetBool("musiclibrary.downloadinfo"))
+ if (CSettings::Get().GetBool("musiclibrary.downloadinfo"))
flags |= CMusicInfoScanner::SCAN_ONLINE;
- if (g_guiSettings.GetBool("musiclibrary.backgroundupdate"))
+ if (CSettings::Get().GetBool("musiclibrary.backgroundupdate"))
flags |= CMusicInfoScanner::SCAN_BACKGROUND;
}
bool CApplication::SetLanguage(const CStdString &strLanguage)
{
- CStdString strPreviousLanguage = g_guiSettings.GetString("locale.language");
+ CStdString strPreviousLanguage = CSettings::Get().GetString("locale.language");
CStdString strNewLanguage = strLanguage;
if (strNewLanguage != strPreviousLanguage)
{
else
CLog::Log(LOGERROR, "No ttf font found but needed: %s", strFontSet.c_str());
}
- g_guiSettings.SetString("locale.language", strNewLanguage);
+ CSettings::Get().SetString("locale.language", strNewLanguage);
g_charsetConverter.reset();
#include "cores/playercorefactory/PlayerCoreFactory.h"
#include "PlayListPlayer.h"
#include "settings/ISettingsHandler.h"
+#include "settings/ISettingCallback.h"
#include "settings/ISubSettings.h"
#if !defined(_WIN32) && defined(HAS_DVD_DRIVE)
#include "storage/DetectDVDType.h"
class DPMSSupport;
class CSplash;
class CBookmark;
-class CWebServer;
-class IPlayer;
-#ifdef HAS_WEB_SERVER
-class CWebServer;
-class CHTTPImageHandler;
-class CHTTPVfsHandler;
-#ifdef HAS_JSONRPC
-class CHTTPJsonRpcHandler;
-#endif
-#ifdef HAS_WEB_INTERFACE
-class CHTTPWebinterfaceHandler;
-class CHTTPWebinterfaceAddonsHandler;
-#endif
-#endif
-
class CNetwork;
namespace VIDEO
#define VOLUME_DYNAMIC_RANGE 90.0f // 60dB
#define VOLUME_CONTROL_STEPS 90 // 90 steps
+// replay gain settings struct for quick access by the player multiple
+// times per second (saves doing settings lookup)
+struct ReplayGainSettings
+{
+ int iPreAmp;
+ int iNoGainPreAmp;
+ int iType;
+ bool bAvoidClipping;
+};
+
class CBackgroundPlayer : public CThread
{
public:
};
class CApplication : public CXBApplicationEx, public IPlayerCallback, public IMsgTargetCallback,
- public ISettingsHandler, public ISubSettings
+ public ISettingCallback, public ISettingsHandler, public ISubSettings
{
public:
bool StartServer(enum ESERVERS eServer, bool bStart, bool bWait = false);
- bool StartWebServer();
- void StopWebServer();
- bool StartAirplayServer();
- void StopAirplayServer(bool bWait);
- bool StartJSONRPCServer();
- void StopJSONRPCServer(bool bWait);
- void StartUPnP();
- void StopUPnP(bool bWait);
- void StartUPnPClient();
- void StopUPnPClient();
- void StartUPnPRenderer();
- void StopUPnPRenderer();
- void StartUPnPServer();
- void StopUPnPServer();
void StartPVRManager(bool bOpenPVRWindow = false);
void StopPVRManager();
- bool StartEventServer();
- bool StopEventServer(bool bWait, bool promptuser);
- void RefreshEventServer();
- void StartZeroconf();
- void StopZeroconf();
bool IsCurrentThread() const;
void Stop(int exitCode);
void RestartApp();
IPlayer* m_pPlayer;
-#ifdef HAS_WEB_SERVER
- CWebServer& m_WebServer;
- CHTTPImageHandler& m_httpImageHandler;
- CHTTPVfsHandler& m_httpVfsHandler;
-#ifdef HAS_JSONRPC
- CHTTPJsonRpcHandler& m_httpJsonRpcHandler;
-#endif
-#ifdef HAS_WEB_INTERFACE
- CHTTPWebinterfaceHandler& m_httpWebinterfaceHandler;
- CHTTPWebinterfaceAddonsHandler& m_httpWebinterfaceAddonsHandler;
-#endif
-#endif
-
inline bool IsInScreenSaver() { return m_bScreenSave; };
int m_iScreenSaveLock; // spiff: are we checking for a lock? if so, ignore the screensaver state, if -1 we have failed to input locks
bool GetRenderGUI() const { return m_renderGUI; };
bool SetLanguage(const CStdString &strLanguage);
+
+ ReplayGainSettings& GetReplayGainSettings() { return m_replayGainSettings; }
protected:
virtual bool OnSettingsSaving() const;
virtual bool Load(const TiXmlNode *settings);
virtual bool Save(TiXmlNode *settings) const;
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
+ virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode);
+
bool LoadSkin(const CStdString& skinID);
void LoadSkin(const boost::shared_ptr<ADDON::CSkinInfo>& skin);
std::map<std::string, std::map<int, float> > m_lastAxisMap;
#endif
+ ReplayGainSettings m_replayGainSettings;
};
XBMC_GLOBAL_REF(CApplication,g_application);
#include "ApplicationMessenger.h"
#include "Application.h"
+#include "LangInfo.h"
#include "PlayListPlayer.h"
#include "Util.h"
#ifdef HAS_PYTHON
#include "utils/URIUtils.h"
#include "utils/Variant.h"
#include "guilib/GUIWindowManager.h"
-#include "guilib/Key.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/GUIDialog.h"
+#include "guilib/Key.h"
#include "GUIInfoManager.h"
#include "utils/Splash.h"
#include "cores/IPlayer.h"
{
case TMSG_SHUTDOWN:
{
- switch (g_guiSettings.GetInt("powermanagement.shutdownstate"))
+ switch (CSettings::Get().GetInt("powermanagement.shutdownstate"))
{
case POWERSTATE_SHUTDOWN:
Powerdown();
{
if(items.Size() == 0)
{
- g_guiSettings.SetString("screensaver.mode", "screensaver.xbmc.builtin.dim");
+ CSettings::Get().SetString("screensaver.mode", "screensaver.xbmc.builtin.dim");
g_application.ActivateScreenSaver();
}
else
*/
#include "AutoSwitch.h"
-#include "settings/GUISettings.h"
-#include "guilib/GUIWindowManager.h"
#include "FileItem.h"
+#include "guilib/GUIWindowManager.h"
#include "guilib/WindowIDs.h"
+#include "settings/Settings.h"
#include "view/ViewState.h"
#define METHOD_BYFOLDERS 0
int iSortMethod = -1;
int iPercent = 0;
int iCurrentWindow = g_windowManager.GetActiveWindow();
- bool bHideParentFolderItems = !g_guiSettings.GetBool("filelists.showparentdiritems");
+ bool bHideParentFolderItems = !CSettings::Get().GetBool("filelists.showparentdiritems");
switch (iCurrentWindow)
{
#include "filesystem/DirectoryFactory.h"
#include "filesystem/File.h"
#include "profiles/ProfilesManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "playlists/PlayList.h"
#include "guilib/GUIWindowManager.h"
+#include "guilib/LocalizeStrings.h"
#include "storage/MediaManager.h"
#include "video/VideoDatabase.h"
#include "dialogs/GUIDialogYesNo.h"
g_application.ResetScreenSaver();
g_application.WakeUpScreenSaverAndDPMS(); // turn off the screensaver if it's active
#ifdef HAS_CDDA_RIPPER
- if (g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_RIP &&
+ if (CSettings::Get().GetInt("audiocds.autoaction") == AUTOCD_RIP &&
pInfo->IsAudio(1) && !CProfilesManager::Get().GetCurrentProfile().musicLocked())
{
CCDDARipper::GetInstance().RipCD();
bool CAutorun::PlayDisc(const CStdString& path, bool bypassSettings, bool startFromBeginning)
{
- if ( !bypassSettings && !g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_PLAY && !g_guiSettings.GetBool("dvds.autorun"))
+ if ( !bypassSettings && !CSettings::Get().GetInt("audiocds.autoaction") == AUTOCD_PLAY && !CSettings::Get().GetBool("dvds.autorun"))
return false;
int nSize = g_playlistPlayer.GetPlaylist( PLAYLIST_MUSIC ).size();
// Check if the current foldername indicates a DVD structure (name is "VIDEO_TS")
if (name.Equals("VIDEO_TS") && bAllowVideo
- && (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
+ && (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
CStdString path = URIUtils::AddFileToFolder(pItem->GetPath(), "VIDEO_TS.IFO");
if(!CFile::Exists(path))
// A BR should also include an "AACS" folder for encryption, Sony-BRs can also include update folders for PS3 (PS3_UPDATE / PS3_VPRM).
// ToDo: for the time beeing, the DVD autorun settings are used to determine if the BR should be started automatically.
if (name.Equals("BDMV") && bAllowVideo
- && (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
+ && (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
CFileItem item(URIUtils::AddFileToFolder(pItem->GetPath(), "index.bdmv"), false);
item.SetLabel(g_mediaManager.GetDiskLabel(strDrive));
// Standard Content HD DVD (few discs?)
if (name.Equals("HVDVD_TS") && bAllowVideo
- && (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
+ && (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
if (hddvdname == "")
{
// If a file format was extracted we are sure this is a VCD. Autoplay if settings indicate we should.
if (!strExt.IsEmpty() && bAllowVideo
- && (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
+ && (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
CFileItemList items;
CDirectory::GetDirectory(pItem->GetPath(), items, strExt);
}
// check video first
- if (!nAddedToPlaylist && !bPlaying && (bypassSettings || g_guiSettings.GetBool("dvds.autorun")))
+ if (!nAddedToPlaylist && !bPlaying && (bypassSettings || CSettings::Get().GetBool("dvds.autorun")))
{
// stack video files
CFileItemList tempItems;
tempItems.Append(vecItems);
- if (g_guiSettings.GetBool("myvideos.stackvideos"))
+ if (CSettings::Get().GetBool("myvideos.stackvideos"))
tempItems.Stack();
CFileItemList itemlist;
}
}
// then music
- if (!bPlaying && (bypassSettings || g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_PLAY) && bAllowMusic)
+ if (!bPlaying && (bypassSettings || CSettings::Get().GetInt("audiocds.autoaction") == AUTOCD_PLAY) && bAllowMusic)
{
for (int i = 0; i < vecItems.Size(); i++)
{
return false;
}
+void CAutorun::SettingOptionAudioCdActionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ list.push_back(make_pair(g_localizeStrings.Get(16018), AUTOCD_NONE));
+ list.push_back(make_pair(g_localizeStrings.Get(14098), AUTOCD_PLAY));
+#ifdef HAS_CDDA_RIPPER
+ list.push_back(make_pair(g_localizeStrings.Get(14096), AUTOCD_RIP));
+#endif
+}
+
+void CAutorun::SettingOptionAudioCdEncodersFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+#ifdef HAVE_LIBMP3LAME
+ list.push_back(make_pair(g_localizeStrings.Get(34000), CDDARIP_ENCODER_LAME));
+#endif
+#ifdef HAVE_LIBVORBISENC
+ list.push_back(make_pair(g_localizeStrings.Get(34001), CDDARIP_ENCODER_VORBIS));
+#endif
+ list.push_back(make_pair(g_localizeStrings.Get(34002), CDDARIP_ENCODER_WAV));
+ list.push_back(make_pair(g_localizeStrings.Get(34005), CDDARIP_ENCODER_FLAC));
+}
+
#endif
class IDirectory;
}
+class CSetting;
+
+enum AutoCDAction
+{
+ AUTOCD_NONE = 0,
+ AUTOCD_PLAY,
+ AUTOCD_RIP
+};
+
namespace MEDIA_DETECT
{
class CAutorun
void Disable();
void HandleAutorun();
static void ExecuteAutorun(const CStdString& path = "", bool bypassSettings = false, bool ignoreplaying = false, bool startFromBeginning = false);
+
+ static void SettingOptionAudioCdActionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+ static void SettingOptionAudioCdEncodersFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
protected:
static bool RunDisc(XFILE::IDirectory* pDir, const CStdString& strDrive, int& nAddedToPlaylist, bool bRoot, bool bypassSettings, bool startFromBeginning);
bool m_bEnable;
#include "music/Album.h"
#include "music/Song.h"
#include "URL.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "utils/RegExp.h"
#include "utils/log.h"
#include "utils/Variant.h"
*GetPVRChannelInfoTag() = channel;
SetLabel(channel.ChannelName());
m_strLabel2 = bHasEpgNow ? epgNow.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
// item->m_bIsFolder = true; // don't treat stacked files as folders
// the label may be in a different char set from the filename (eg over smb
// the label is converted from utf8, but the filename is not)
- if (!g_guiSettings.GetBool("filelists.showextensions"))
+ if (!CSettings::Get().GetBool("filelists.showextensions"))
URIUtils::RemoveExtension(stackName);
item1->SetLabel(stackName);
}
// if a folder, check for folder.jpg
- if (m_bIsFolder && !IsFileFolder() && (!IsRemote() || alwaysCheckRemote || g_guiSettings.GetBool("musicfiles.findremotethumbs")))
+ if (m_bIsFolder && !IsFileFolder() && (!IsRemote() || alwaysCheckRemote || CSettings::Get().GetBool("musicfiles.findremotethumbs")))
{
CStdStringArray thumbs;
StringUtils::SplitString(g_advancedSettings.m_musicThumbs, "|", thumbs);
#include "video/VideoDatabase.h"
#include "cores/IPlayer.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
+#include "cores/VideoRenderers/BaseRenderer.h"
#define SYSHEATUPDATEINTERVAL 60000
URIUtils::RemoveExtension(strLabel);
break;
case WEATHER_PLUGIN:
- strLabel = g_guiSettings.GetString("weather.addon");
+ strLabel = CSettings::Get().GetString("weather.addon");
break;
case SYSTEM_DATE:
strLabel = GetDate();
CEpgInfoTag tag;
return m_currentFile->GetPVRChannelInfoTag()->GetEPGNow(tag) ?
tag.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
}
return g_localizeStrings.Get(g_windowManager.GetFocusedWindow());
break;
case SYSTEM_STARTUP_WINDOW:
- strLabel.Format("%i", g_guiSettings.GetInt("lookandfeel.startupwindow"));
+ strLabel.Format("%i", CSettings::Get().GetInt("lookandfeel.startupwindow"));
break;
case SYSTEM_CURRENT_CONTROL:
{
}
break;
case SYSTEM_LANGUAGE:
- strLabel = g_guiSettings.GetString("locale.language");
+ strLabel = CSettings::Get().GetString("locale.language");
break;
case SYSTEM_TEMPERATURE_UNITS:
strLabel = g_langInfo.GetTempUnitString();
break;
case SYSTEM_FRIENDLY_NAME:
{
- CStdString friendlyName = g_guiSettings.GetString("services.devicename");
+ CStdString friendlyName = CSettings::Get().GetString("services.devicename");
if (friendlyName.Equals("XBMC"))
strLabel.Format("%s (%s)", friendlyName.c_str(), g_application.getNetwork().GetHostName().c_str());
else
break;
case SKIN_THEME:
- strLabel = g_guiSettings.GetString("lookandfeel.skintheme");
+ strLabel = CSettings::Get().GetString("lookandfeel.skintheme");
break;
case SKIN_COLOUR_THEME:
- strLabel = g_guiSettings.GetString("lookandfeel.skincolors");
+ strLabel = CSettings::Get().GetString("lookandfeel.skincolors");
break;
case SKIN_ASPECT_RATIO:
if (g_SkinInfo)
case VISUALISATION_NAME:
{
AddonPtr addon;
- strLabel = g_guiSettings.GetString("musicplayer.visualisation");
+ strLabel = CSettings::Get().GetString("musicplayer.visualisation");
if (CAddonMgr::Get().GetAddon(strLabel,addon) && addon)
strLabel = addon->Name();
}
else if (condition == SYSTEM_ISINHIBIT)
bReturn = g_application.IsIdleShutdownInhibited();
else if (condition == SYSTEM_HAS_SHUTDOWN)
- bReturn = (g_guiSettings.GetInt("powermanagement.shutdowntime") > 0);
+ bReturn = (CSettings::Get().GetInt("powermanagement.shutdowntime") > 0);
else if (condition == SYSTEM_LOGGEDON)
bReturn = !(g_windowManager.GetActiveWindow() == WINDOW_LOGIN_SCREEN);
else if (condition == SYSTEM_SHOW_EXIT_BUTTON)
}
break;
case VIDEOPLAYER_USING_OVERLAYS:
- bReturn = (g_guiSettings.GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS);
+ bReturn = (CSettings::Get().GetInt("videoplayer.rendermethod") == RENDER_OVERLAYS);
break;
case VIDEOPLAYER_ISFULLSCREEN:
bReturn = g_windowManager.GetActiveWindow() == WINDOW_FULLSCREEN_VIDEO;
}
break;
case VISUALISATION_ENABLED:
- bReturn = !g_guiSettings.GetString("musicplayer.visualisation").IsEmpty();
+ bReturn = !CSettings::Get().GetString("musicplayer.visualisation").empty();
break;
case VIDEOPLAYER_HAS_EPG:
if (m_currentFile->HasPVRChannelInfoTag())
break;
case SKIN_HAS_THEME:
{
- CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme");
+ CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme");
theme.ToLower();
URIUtils::RemoveExtension(theme);
bReturn = theme.Equals(m_stringParameters[info.GetData1()]);
bReturn = g_alarmClock.HasAlarm(m_stringParameters[info.GetData1()]);
break;
case SYSTEM_GET_BOOL:
- bReturn = g_guiSettings.GetBool(m_stringParameters[info.GetData1()]);
+ bReturn = CSettings::Get().GetBool(m_stringParameters[info.GetData1()]);
break;
case SYSTEM_HAS_CORE_ID:
bReturn = g_cpuInfo.HasCoreId(info.GetData1());
case VIDEOPLAYER_ORIGINALTITLE:
return tag->GetEPGNow(epgTag) ?
epgTag.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
case VIDEOPLAYER_GENRE:
case VIDEOPLAYER_NEXT_TITLE:
return tag->GetEPGNext(epgTag) ?
epgTag.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
case VIDEOPLAYER_NEXT_GENRE:
CEpgInfoTag epgTag;
return item->GetPVRChannelInfoTag()->GetEPGNow(epgTag) ?
epgTag.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
}
if (item->HasVideoInfoTag())
{
if (!(!item->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && item->GetVideoInfoTag()->m_iSeason == -1)) // dont apply to tvshows
- if (item->GetVideoInfoTag()->m_playCount == 0 && !g_guiSettings.GetBool("videolibrary.showunwatchedplots"))
+ if (item->GetVideoInfoTag()->m_playCount == 0 && !CSettings::Get().GetBool("videolibrary.showunwatchedplots"))
return g_localizeStrings.Get(20370);
return item->GetVideoInfoTag()->m_strPlot;
#include "threads/SystemClock.h"
#include "GUILargeTextureManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "guilib/Texture.h"
#include "threads/SingleLock.h"
#include "utils/TimeUtils.h"
{
// direct route - load the image
unsigned int start = XbmcThreads::SystemClockMillis();
- m_texture = CBaseTexture::LoadFromFile(loadPath, g_graphicsContext.GetWidth(), g_graphicsContext.GetHeight(), g_guiSettings.GetBool("pictures.useexifrotation"));
+ m_texture = CBaseTexture::LoadFromFile(loadPath, g_graphicsContext.GetWidth(), g_graphicsContext.GetHeight(), CSettings::Get().GetBool("pictures.useexifrotation"));
if (!m_texture)
return false;
if (XbmcThreads::SystemClockMillis() - start > 100)
#include "profiles/dialogs/GUIDialogLockSettings.h"
#include "profiles/dialogs/GUIDialogProfileSettings.h"
#include "Util.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/GUIWindowManager.h"
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
}
else
{
- if (0 != g_guiSettings.GetInt("masterlock.maxretries") && pItem->m_iBadPwdCount >= g_guiSettings.GetInt("masterlock.maxretries"))
+ if (0 != CSettings::Get().GetInt("masterlock.maxretries") && pItem->m_iBadPwdCount >= CSettings::Get().GetInt("masterlock.maxretries"))
{ // user previously exhausted all retries, show access denied error
CGUIDialogOK::ShowAndGetInput(12345, 12346, 0, 0);
return false;
case 1:
{
// password entry failed
- if (0 != g_guiSettings.GetInt("masterlock.maxretries"))
+ if (0 != CSettings::Get().GetInt("masterlock.maxretries"))
pItem->m_iBadPwdCount++;
sprintf(buffer,"%i",pItem->m_iBadPwdCount);
CMediaSourceSettings::Get().UpdateSource(strType, strLabel, "badpwdcount", buffer);
int iVerifyPasswordResult = -1;
CStdString strHeader = g_localizeStrings.Get(20075);
if (iMasterLockRetriesLeft == -1)
- iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries");
+ iMasterLockRetriesLeft = CSettings::Get().GetInt("masterlock.maxretries");
if (g_passwordManager.iMasterLockRetriesLeft == 0) g_passwordManager.iMasterLockRetriesLeft = 1;
CStdString strPassword = CProfilesManager::Get().GetMasterProfile().getLockCode();
if (CProfilesManager::Get().GetMasterProfile().getLockMode() == 0)
if (iVerifyPasswordResult == 0)
{
- g_passwordManager.iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries");
+ g_passwordManager.iMasterLockRetriesLeft = CSettings::Get().GetInt("masterlock.maxretries");
return true; // OK The MasterCode Accepted! XBMC Can Run!
}
else
{
bCanceled = false;
if (iMasterLockRetriesLeft == -1)
- iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries");
+ iMasterLockRetriesLeft = CSettings::Get().GetInt("masterlock.maxretries");
if ((LOCK_MODE_EVERYONE < CProfilesManager::Get().GetMasterProfile().getLockMode() && !bMasterUser) && !bPromptUser)
// not unlocked, but calling code doesn't want to prompt user
return false;
if (!bResetCount)
{
// Bad mastercode entered
- if (0 < g_guiSettings.GetInt("masterlock.maxretries"))
+ if (0 < CSettings::Get().GetInt("masterlock.maxretries"))
{
// We're keeping track of how many bad passwords are entered
if (1 < g_passwordManager.iMasterLockRetriesLeft)
CGUIDialogOK::ShowAndGetInput(20075, 12345, dlgLine1, 0);
}
else
- g_passwordManager.iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries"); // user entered correct mastercode, reset retries to max allowed
+ g_passwordManager.iMasterLockRetriesLeft = CSettings::Get().GetInt("masterlock.maxretries"); // user entered correct mastercode, reset retries to max allowed
}
bool CGUIPassword::CheckLock(LockType btnType, const CStdString& strPassword, int iHeading)
return false;
}
+void CGUIPassword::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "masterlock.lockcode")
+ SetMasterLockMode();
+}
+
int CGUIPassword::VerifyPassword(LockType btnType, const CStdString& strPassword, const CStdString& strHeading)
{
int iVerifyPasswordResult;
*
*/
+#include <map>
+#include <vector>
+
+#include "settings/ISettingCallback.h"
#include "utils/StdString.h"
class CFileItem;
class CMediaSource;
-#include <vector>
-#include <map>
-
typedef std::vector<CMediaSource> VECSOURCES;
typedef enum
LOCK_MODE_EEPROM_PARENTAL = 5
} LockType;
-class CGUIPassword
+class CGUIPassword : public ISettingCallback
{
public:
CGUIPassword(void);
void RemoveSourceLocks();
bool IsDatabasePathUnlocked(const CStdString& strPath, VECSOURCES& vecSources);
+ virtual void OnSettingAction(const CSetting *setting);
+
bool bMasterUser;
int iMasterLockRetriesLeft;
*/
#include "LangInfo.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "Application.h"
+#include "FileItem.h"
+#include "Util.h"
+#include "filesystem/Directory.h"
+#include "guilib/GUIFontManager.h"
#include "guilib/LocalizeStrings.h"
+#include "pvr/PVRManager.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
+#include "utils/CharsetConverter.h"
#include "utils/log.h"
-#include "utils/XBMCTinyXML.h"
#include "utils/LangCodeExpander.h"
+#include "utils/StringUtils.h"
+#include "utils/Weather.h"
+#include "utils/XBMCTinyXML.h"
using namespace std;
+using namespace PVR;
#define TEMP_UNIT_STRINGS 20027
{
}
+void CLangInfo::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "locale.audiolanguage")
+ SetAudioLanguage(((CSettingString*)setting)->GetValue());
+ else if (settingId == "locale.subtitlelanguage")
+ SetSubtitleLanguage(((CSettingString*)setting)->GetValue());
+ else if (settingId == "locale.language")
+ {
+ if (!SetLanguage(((CSettingString*)setting)->GetValue()))
+ ((CSettingString*)CSettings::Get().GetSetting("locale.language"))->Reset();
+ }
+ else if (settingId == "locale.country")
+ {
+ g_langInfo.SetCurrentRegion(((CSettingString*)setting)->GetValue());
+ g_weatherManager.Refresh(); // need to reset our weather, as temperatures need re-translating.
+ }
+}
+
bool CLangInfo::Load(const CStdString& strFileName)
{
SetDefaults();
pRegion=pRegion->NextSiblingElement("region");
}
- const CStdString& strName=g_guiSettings.GetString("locale.country");
+ const CStdString& strName=CSettings::Get().GetString("locale.country");
SetCurrentRegion(strName);
}
CStdString CLangInfo::GetGuiCharSet() const
{
CStdString strCharSet;
- strCharSet=g_guiSettings.GetString("locale.charset");
+ strCharSet=CSettings::Get().GetString("locale.charset");
if (strCharSet=="DEFAULT")
strCharSet=m_currentRegion->m_strGuiCharSet;
CStdString CLangInfo::GetSubtitleCharSet() const
{
- CStdString strCharSet=g_guiSettings.GetString("subtitles.charset");
+ CStdString strCharSet=CSettings::Get().GetString("subtitles.charset");
if (strCharSet=="DEFAULT")
strCharSet=m_currentRegion->m_strSubtitleCharSet;
return strCharSet;
}
+bool CLangInfo::SetLanguage(const std::string &strLanguage)
+{
+ string strLangInfoPath = StringUtils::Format("special://xbmc/language/%s/langinfo.xml", strLanguage.c_str());
+ if (!g_langInfo.Load(strLangInfoPath))
+ return false;
+
+ if (ForceUnicodeFont() && !g_fontManager.IsFontSetUnicode())
+ {
+ CLog::Log(LOGINFO, "Language needs a ttf font, loading first ttf font available");
+ CStdString strFontSet;
+ if (!g_fontManager.GetFirstFontSetUnicode(strFontSet))
+ CLog::Log(LOGERROR, "No ttf font found but needed: %s", strFontSet.c_str());
+ }
+
+ g_charsetConverter.reset();
+
+ if (!g_localizeStrings.Load("special://xbmc/language/", strLanguage))
+ return false;
+
+ // also tell our weather and skin to reload as these are localized
+ g_weatherManager.Refresh();
+ g_PVRManager.LocalizationChanged();
+ g_application.ReloadSkin();
+
+ return true;
+}
+
// three char language code (not win32 specific)
const CStdString& CLangInfo::GetAudioLanguage() const
{
{
return g_localizeStrings.Get(SPEED_UNIT_STRINGS+m_currentRegion->m_speedUnit);
}
+
+void CLangInfo::SettingOptionsLanguagesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ SettingOptionsLanguagesFillerGeneral(setting, list, current);
+}
+
+void CLangInfo::SettingOptionsStreamLanguagesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ vector<string> languages;
+ languages.push_back(g_localizeStrings.Get(308));
+ languages.push_back(g_localizeStrings.Get(309));
+ vector<string> languageKeys;
+ languageKeys.push_back("original");
+ languageKeys.push_back("default");
+ SettingOptionsLanguagesFillerGeneral(setting, list, current, languages, languageKeys);
+}
+
+void CLangInfo::SettingOptionsRegionsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ CStdStringArray regions;
+ g_langInfo.GetRegionNames(regions);
+ sort(regions.begin(), regions.end(), sortstringbyname());
+
+ for (unsigned int i = 0; i < regions.size(); ++i)
+ list.push_back(make_pair(regions[i], regions[i]));
+}
+
+void CLangInfo::SettingOptionsLanguagesFillerGeneral(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t,
+ const std::vector<std::string> &languages /* = std::vector<std::string>() */,
+ const std::vector<std::string> &languageKeys /* = std::vector<std::string>() */)
+{
+ //find languages...
+ CFileItemList items;
+ XFILE::CDirectory::GetDirectory("special://xbmc/language/", items);
+
+ vector<string> vecLanguage;
+ for (int i = 0; i < items.Size(); ++i)
+ {
+ CFileItemPtr pItem = items[i];
+ if (pItem->m_bIsFolder)
+ {
+ if (StringUtils::EqualsNoCase(pItem->GetLabel(), ".svn") ||
+ StringUtils::EqualsNoCase(pItem->GetLabel(), "fonts") ||
+ StringUtils::EqualsNoCase(pItem->GetLabel(), "media"))
+ 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)
+ {
+ for (unsigned int i = 0; i < languages.size(); ++i)
+ list.push_back(make_pair(languages[i], languageKeys[i]));
+ }
+
+ for (unsigned int i = 0; i < vecLanguage.size(); ++i)
+ list.push_back(make_pair(vecLanguage[i], vecLanguage[i]));
+}
*
*/
+#include "settings/ISettingCallback.h"
#include "utils/StdString.h"
#include <map>
class TiXmlNode;
-class CLangInfo
+class CLangInfo : public ISettingCallback
{
public:
CLangInfo();
virtual ~CLangInfo();
+ virtual void OnSettingChanged(const CSetting *setting);
+
bool Load(const CStdString& strFileName);
CStdString GetGuiCharSet() const;
// three char language code (not win32 specific)
const CStdString& GetLanguageCode() const { return m_languageCodeGeneral; }
+ bool SetLanguage(const std::string &strLanguage);
+
const CStdString& GetAudioLanguage() const;
// language can either be a two char language code as defined in ISO639
// or a three char language code
const CStdString& GetCurrentRegion() const;
static void LoadTokens(const TiXmlNode* pTokens, std::vector<CStdString>& vecTokens);
+
+ static void SettingOptionsLanguagesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsStreamLanguagesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsRegionsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+
protected:
void SetDefaults();
protected:
+ static void SettingOptionsLanguagesFillerGeneral(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t,
+ const std::vector<std::string> &languages = std::vector<std::string>(),
+ const std::vector<std::string> &languageKeys = std::vector<std::string>());
+
class CRegion
{
public:
#include "video/VideoInfoDownloader.h"
#include "addons/AddonManager.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
#include "FileItem.h"
#include "music/Album.h"
#include "music/Artist.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include <vector>
#include "Application.h"
#include "GUILargeTextureManager.h"
#include "guilib/TextureManager.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
#include "utils/AlarmClock.h"
#include "utils/DownloadQueueManager.h"
#include "GUIInfoManager.h"
#include "linux/RBP.h"
#endif
- CSettings g_settings;
-
CXBMCRenderManager g_renderManager;
CLangInfo g_langInfo;
CLangCodeExpander g_LangCodeExpander;
#include "guilib/Texture.h"
#include "guilib/DDSImage.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "filesystem/File.h"
#include "pictures/Picture.h"
&& !file.GetMimeType().Left(6).Equals("image/") && !file.GetMimeType().Equals("application/octet-stream")) // ignore non-pictures
return NULL;
- CBaseTexture *texture = CBaseTexture::LoadFromFile(image, width, height, g_guiSettings.GetBool("pictures.useexifrotation"));
+ CBaseTexture *texture = CBaseTexture::LoadFromFile(image, width, height, CSettings::Get().GetBool("pictures.useexifrotation"));
if (!texture)
return NULL;
#endif
#include "profiles/ProfilesManager.h"
#include "utils/RegExp.h"
-#include "settings/GUISettings.h"
#include "guilib/GraphicContext.h"
#include "guilib/TextureManager.h"
#include "utils/fstrcmp.h"
#endif
#include "GUIUserMessages.h"
#include "filesystem/File.h"
+#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "utils/StringUtils.h"
#include "settings/AdvancedSettings.h"
strFilename = URIUtils::GetFileName(url.GetHostName());
// now remove the extension if needed
- if (!g_guiSettings.GetBool("filelists.showextensions") && !bIsFolder)
+ if (!CSettings::Get().GetBool("filelists.showextensions") && !bIsFolder)
{
URIUtils::RemoveExtension(strFilename);
return strFilename;
bool CUtil::IsUsingTTFSubtitles()
{
- return URIUtils::GetExtension(g_guiSettings.GetString("subtitles.font")).Equals(".ttf");
+ return URIUtils::GetExtension(CSettings::Get().GetString("subtitles.font")).Equals(".ttf");
}
#ifdef UNIT_TESTING
URIUtils::AddFileToFolder("special://cdrips/", strSpecial.Mid(7), strReturn);
// this one will be removed post 2.0
else if (strSpecial.Left(10).Equals("$PLAYLISTS"))
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath",false), strSpecial.Mid(10), strReturn);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), strSpecial.Mid(10), strReturn);
}
return strReturn;
}
{
vector<CStdString> vec;
CStdString strReturn;
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "music", strReturn);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music", strReturn);
vec.push_back(strReturn);
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "mixed", strReturn);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "mixed", strReturn);
vec.push_back(strReturn);
return XFILE::CMultiPathDirectory::ConstructMultiPath(vec);;
}
{
vector<CStdString> vec;
CStdString strReturn;
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "video", strReturn);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video", strReturn);
vec.push_back(strReturn);
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "mixed", strReturn);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "mixed", strReturn);
vec.push_back(strReturn);
return XFILE::CMultiPathDirectory::ConstructMultiPath(vec);;
}
CStdString strMovieFileNameNoExt(URIUtils::ReplaceExtension(strMovieFileName, ""));
strLookInPaths.push_back(strPath);
- if (!CMediaSettings::Get().GetAdditionalSubtitleDirectoryChecked() && !g_guiSettings.GetString("subtitles.custompath").IsEmpty()) // to avoid checking non-existent directories (network) every time..
+ if (!CMediaSettings::Get().GetAdditionalSubtitleDirectoryChecked() && !CSettings::Get().GetString("subtitles.custompath").empty()) // to avoid checking non-existent directories (network) every time..
{
- if (!g_application.getNetwork().IsAvailable() && !URIUtils::IsHD(g_guiSettings.GetString("subtitles.custompath")))
+ if (!g_application.getNetwork().IsAvailable() && !URIUtils::IsHD(CSettings::Get().GetString("subtitles.custompath")))
{
CLog::Log(LOGINFO,"CUtil::CacheSubtitles: disabling alternate subtitle directory for this session, it's nonaccessible");
CMediaSettings::Get().SetAdditionalSubtitleDirectoryChecked(-1); // disabled
}
- else if (!CDirectory::Exists(g_guiSettings.GetString("subtitles.custompath")))
+ else if (!CDirectory::Exists(CSettings::Get().GetString("subtitles.custompath")))
{
CLog::Log(LOGINFO,"CUtil::CacheSubtitles: disabling alternate subtitle directory for this session, it's nonexistant");
CMediaSettings::Get().SetAdditionalSubtitleDirectoryChecked(-1); // disabled
// this is last because we dont want to check any common subdirs or cd-dirs in the alternate <subtitles> dir.
if (CMediaSettings::Get().GetAdditionalSubtitleDirectoryChecked() == 1)
{
- strPath = g_guiSettings.GetString("subtitles.custompath");
+ strPath = CSettings::Get().GetString("subtitles.custompath");
URIUtils::AddSlashAtEnd(strPath);
strLookInPaths.push_back(strPath);
}
#endif //_LINUX
}
+bool CUtil::ValidatePort(int port)
+{
+ // check that it's a valid port
+#ifdef _LINUX
+ if (!CUtil::CanBindPrivileged() && (port < 1024 || port > 65535))
+ return false;
+ else
+#endif
+ if (port <= 0 || port > 65535)
+ return false;
+
+ return true;
+}
+
int CUtil::GetRandomNumber()
{
#ifdef TARGET_WINDOWS
static CStdString GetFrameworksPath(bool forPython = false);
static bool CanBindPrivileged();
+ static bool ValidatePort(int port);
/*!
* \brief Thread-safe random number generation
#include "Addon.h"
#include "AddonManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "interfaces/python/XBPython.h"
// Path where the language strings reside
CStdString chosenPath = URIUtils::AddFileToFolder(m_props.path, "resources/language/");
- m_hasStrings = m_strings.Load(chosenPath, g_guiSettings.GetString("locale.language"));
+ m_hasStrings = m_strings.Load(chosenPath, CSettings::Get().GetString("locale.language"));
return m_checkedStrings = true;
}
\return true if the addon has settings, false otherwise
\sa LoadSettings, LoadUserSettings, SaveSettings, HasUserSettings, GetSetting, UpdateSetting
*/
- bool HasSettings();
+ virtual bool HasSettings();
/*! \brief Check whether the user has configured this addon or not
\return true if previously saved settings are found, false otherwise
#include "guilib/GUIWindowManager.h"
#include "guilib/Key.h"
#include "guilib/TextureManager.h"
-#include "settings/GUISettings.h"
#include "guilib/GUISpinControlEx.h"
#include "guilib/GUIRadioButtonControl.h"
#include "guilib/GUISettingsSliderControl.h"
#include "guilib/LocalizeStrings.h"
#include "filesystem/Directory.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "ApplicationMessenger.h"
#include "Favourites.h"
#include "utils/JobManager.h"
bool CAddonInstallJob::OnPreInstall()
{
// check whether this is an active skin - we need to unload it if so
- if (g_guiSettings.GetString("lookandfeel.skin") == m_addon->ID())
+ if (CSettings::Get().GetString("lookandfeel.skin") == m_addon->ID())
{
CApplicationMessenger::Get().ExecBuiltIn("UnloadSkin", true);
return true;
void CAddonInstallJob::OnPostInstall(bool reloadAddon)
{
- if (m_addon->Type() < ADDON_VIZ_LIBRARY && g_guiSettings.GetBool("general.addonnotifications"))
+ if (m_addon->Type() < ADDON_VIZ_LIBRARY && CSettings::Get().GetBool("general.addonnotifications"))
{
CGUIDialogKaiToast::QueueNotification(m_addon->Icon(),
m_addon->Name(),
if (reloadAddon || (!m_update && CGUIDialogYesNo::ShowAndGetInput(m_addon->Name(),
g_localizeStrings.Get(24099),"","")))
{
- g_guiSettings.SetString("lookandfeel.skin",m_addon->ID().c_str());
+ CSettings::Get().SetString("lookandfeel.skin",m_addon->ID().c_str());
CGUIDialogKaiToast *toast = (CGUIDialogKaiToast *)g_windowManager.GetWindow(WINDOW_DIALOG_KAI_TOAST);
if (toast)
{
if (m_addon->Type() == ADDON_PVRDLL)
{
- if (g_guiSettings.GetBool("pvrmanager.enabled"))
+ if (CSettings::Get().GetBool("pvrmanager.enabled"))
PVR::CPVRManager::Get().Start(true);
}
}
#include "threads/SingleLock.h"
#include "FileItem.h"
#include "LangInfo.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/XBMCTinyXML.h"
#ifdef HAS_VISUALISATION
switch (type)
{
case ADDON_VIZ:
- setting = g_guiSettings.GetString("musicplayer.visualisation");
+ setting = CSettings::Get().GetString("musicplayer.visualisation");
break;
case ADDON_SCREENSAVER:
- setting = g_guiSettings.GetString("screensaver.mode");
+ setting = CSettings::Get().GetString("screensaver.mode");
break;
case ADDON_SCRAPER_ALBUMS:
- setting = g_guiSettings.GetString("musiclibrary.albumsscraper");
+ setting = CSettings::Get().GetString("musiclibrary.albumsscraper");
break;
case ADDON_SCRAPER_ARTISTS:
- setting = g_guiSettings.GetString("musiclibrary.artistsscraper");
+ setting = CSettings::Get().GetString("musiclibrary.artistsscraper");
break;
case ADDON_SCRAPER_MOVIES:
- setting = g_guiSettings.GetString("scrapers.moviesdefault");
+ setting = CSettings::Get().GetString("scrapers.moviesdefault");
break;
case ADDON_SCRAPER_MUSICVIDEOS:
- setting = g_guiSettings.GetString("scrapers.musicvideosdefault");
+ setting = CSettings::Get().GetString("scrapers.musicvideosdefault");
break;
case ADDON_SCRAPER_TVSHOWS:
- setting = g_guiSettings.GetString("scrapers.tvshowsdefault");
+ setting = CSettings::Get().GetString("scrapers.tvshowsdefault");
break;
case ADDON_WEB_INTERFACE:
- setting = g_guiSettings.GetString("services.webskin");
+ setting = CSettings::Get().GetString("services.webskin");
break;
default:
return false;
switch (type)
{
case ADDON_VIZ:
- g_guiSettings.SetString("musicplayer.visualisation",addonID);
+ CSettings::Get().SetString("musicplayer.visualisation",addonID);
break;
case ADDON_SCREENSAVER:
- g_guiSettings.SetString("screensaver.mode",addonID);
+ CSettings::Get().SetString("screensaver.mode",addonID);
break;
case ADDON_SCRAPER_ALBUMS:
- g_guiSettings.SetString("musiclibrary.albumsscraper",addonID);
+ CSettings::Get().SetString("musiclibrary.albumsscraper",addonID);
break;
case ADDON_SCRAPER_ARTISTS:
- g_guiSettings.SetString("musiclibrary.artistsscraper",addonID);
+ CSettings::Get().SetString("musiclibrary.artistsscraper",addonID);
break;
case ADDON_SCRAPER_MOVIES:
- g_guiSettings.SetString("scrapers.moviesdefault",addonID);
+ CSettings::Get().SetString("scrapers.moviesdefault",addonID);
break;
case ADDON_SCRAPER_MUSICVIDEOS:
- g_guiSettings.SetString("scrapers.musicvideosdefault",addonID);
+ CSettings::Get().SetString("scrapers.musicvideosdefault",addonID);
break;
case ADDON_SCRAPER_TVSHOWS:
- g_guiSettings.SetString("scrapers.tvshowsdefault",addonID);
+ CSettings::Get().SetString("scrapers.tvshowsdefault",addonID);
break;
default:
return false;
#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogKaiToast.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
namespace ADDON
{
if (m_addon->Type() == ADDON_PVRDLL)
{
- if (!g_guiSettings.GetBool("pvrmanager.hideconnectionlostwarning"))
+ if (!CSettings::Get().GetBool("pvrmanager.hideconnectionlostwarning"))
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, m_addon->Name().c_str(), g_localizeStrings.Get(36030)); // connection lost
// TODO handle disconnects after the add-on's been initialised
}
#include "utils/log.h"
#include "threads/SingleLock.h"
#include "settings/Settings.h"
+#include "settings/MediaSourceSettings.h"
#include "utils/StringUtils.h"
#include "AddonDatabase.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSourceSettings.h"
#include "storage/MediaManager.h"
-#include "settings/GUISettings.h"
#include "LangInfo.h"
#include "guilib/Key.h"
int iControl = message.GetSenderId();
if (iControl == CONTROL_AUTOUPDATE)
{
- g_guiSettings.ToggleBool("general.addonautoupdate");
- g_settings.Save();
+ CSettings::Get().ToggleBool("general.addonautoupdate");
return true;
}
else if (iControl == CONTROL_SHUTUP)
{
- g_guiSettings.ToggleBool("general.addonnotifications");
- g_settings.Save();
+ CSettings::Get().ToggleBool("general.addonnotifications");
+ CSettings::Get().Save();
return true;
}
else if (iControl == CONTROL_FOREIGNFILTER)
{
- g_guiSettings.ToggleBool("general.addonforeignfilter");
- g_settings.Save();
+ CSettings::Get().ToggleBool("general.addonforeignfilter");
+ CSettings::Get().Save();
Refresh();
return true;
}
void CGUIWindowAddonBrowser::UpdateButtons()
{
- SET_CONTROL_SELECTED(GetID(),CONTROL_AUTOUPDATE,g_guiSettings.GetBool("general.addonautoupdate"));
- SET_CONTROL_SELECTED(GetID(),CONTROL_SHUTUP,g_guiSettings.GetBool("general.addonnotifications"));
- SET_CONTROL_SELECTED(GetID(),CONTROL_FOREIGNFILTER,g_guiSettings.GetBool("general.addonforeignfilter"));
+ SET_CONTROL_SELECTED(GetID(),CONTROL_AUTOUPDATE, CSettings::Get().GetBool("general.addonautoupdate"));
+ SET_CONTROL_SELECTED(GetID(),CONTROL_SHUTUP, CSettings::Get().GetBool("general.addonnotifications"));
+ SET_CONTROL_SELECTED(GetID(),CONTROL_FOREIGNFILTER, CSettings::Get().GetBool("general.addonforeignfilter"));
CGUIMediaWindow::UpdateButtons();
}
else
{
result = CGUIMediaWindow::GetDirectory(strDirectory,items);
- if (g_guiSettings.GetBool("general.addonforeignfilter"))
+ if (CSettings::Get().GetBool("general.addonforeignfilter"))
{
int i=0;
while (i < items.Size())
{
- if (!FilterVar(g_guiSettings.GetBool("general.addonforeignfilter"),
+ if (!FilterVar(CSettings::Get().GetBool("general.addonforeignfilter"),
items[i]->GetProperty("Addon.Language"), "en") ||
- !FilterVar(g_guiSettings.GetBool("general.addonforeignfilter"),
+ !FilterVar(CSettings::Get().GetBool("general.addonforeignfilter"),
items[i]->GetProperty("Addon.Language"),
g_langInfo.GetLanguageLocale()))
{
#include "utils/XBMCTinyXML.h"
#include "filesystem/File.h"
#include "AddonDatabase.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "utils/JobManager.h"
#include "addons/AddonInstaller.h"
if (addon && addons[i]->Version() > addon->Version() &&
!database.IsAddonBlacklisted(addons[i]->ID(),addons[i]->Version().c_str()))
{
- if (g_guiSettings.GetBool("general.addonautoupdate") || addon->Type() >= ADDON_VIZ_LIBRARY)
+ if (CSettings::Get().GetBool("general.addonautoupdate") || addon->Type() >= ADDON_VIZ_LIBRARY)
{
CStdString referer;
if (URIUtils::IsInternetStream(addons[i]->Path()))
else
CAddonInstaller::Get().Install(addon->ID(), true, referer);
}
- else if (g_guiSettings.GetBool("general.addonnotifications"))
+ else if (CSettings::Get().GetBool("general.addonnotifications"))
{
CGUIDialogKaiToast::QueueNotification(addon->Icon(),
g_localizeStrings.Get(24061),
#include "Skin.h"
#include "AddonManager.h"
+#include "LangInfo.h"
+#include "Util.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
#include "guilib/WindowIDs.h"
+#include "settings/Settings.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
-#include "settings/GUISettings.h"
// fallback for new skin resolution code
#include "filesystem/Directory.h"
{
}
+bool CSkinInfo::HasSettings()
+{
+ return HasSkinFile("SkinSettings.xml");
+}
+
struct closestRes
{
closestRes(const RESOLUTION_INFO &target) : m_target(target) { };
int CSkinInfo::GetStartWindow() const
{
- int windowID = g_guiSettings.GetInt("lookandfeel.startupwindow");
+ int windowID = CSettings::Get().GetInt("lookandfeel.startupwindow");
assert(m_startupWindows.size());
for (vector<CStartupWindow>::const_iterator it = m_startupWindows.begin(); it != m_startupWindows.end(); it++)
{
bool CSkinInfo::IsInUse() const
{
// Could extend this to prompt for reverting to the standard skin perhaps
- return g_guiSettings.GetString("lookandfeel.skin") == ID();
+ return CSettings::Get().GetString("lookandfeel.skin") == ID();
}
const INFO::CSkinVariableString* CSkinInfo::CreateSkinVariable(const CStdString& name, int context)
return m_includes.CreateSkinVariable(name, context);
}
+void CSkinInfo::SettingOptionsSkinColorsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ // There is a default theme (just defaults.xml)
+ // any other *.xml files are additional color themes on top of this one.
+
+ // add the default label
+ list.push_back(make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT")); // the standard defaults.xml will be used!
+
+ // Search for colors in the Current skin!
+ vector<string> vecColors;
+ string strPath = URIUtils::AddFileToFolder(g_SkinInfo->Path(), "colors");
+
+ 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 && !StringUtils::EqualsNoCase(pItem->GetLabel(), "defaults.xml"))
+ { // not the default one
+ vecColors.push_back(pItem->GetLabel().Mid(0, pItem->GetLabel().size() - 4));
+ }
+ }
+ sort(vecColors.begin(), vecColors.end(), sortstringbyname());
+
+ for (int i = 0; i < (int) vecColors.size(); ++i)
+ list.push_back(make_pair(vecColors[i], vecColors[i]));
+
+ CStdString settingValue = ((const CSettingString*)setting)->GetValue();
+ // Remove the .xml extension from the Themes
+ if (URIUtils::GetExtension(settingValue) == ".xml")
+ URIUtils::RemoveExtension(settingValue);
+
+ // Set the choosen theme
+ current = settingValue;
+}
+
+void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ std::string strPath = g_SkinInfo->GetSkinPath("Font.xml");
+
+ CXBMCTinyXML xmlDoc;
+ if (!xmlDoc.LoadFile(strPath))
+ {
+ CLog::Log(LOGERROR, "FillInSkinFonts: Couldn't load %s", strPath.c_str());
+ return;
+ }
+
+ TiXmlElement* pRootElement = xmlDoc.RootElement();
+
+ std::string strValue = pRootElement->ValueStr();
+ if (strValue != "fonts")
+ {
+ CLog::Log(LOGERROR, "FillInSkinFonts: file %s doesn't start with <fonts>", strPath.c_str());
+ return;
+ }
+
+ const TiXmlNode *pChild = pRootElement->FirstChild();
+ strValue = pChild->ValueStr();
+ if (strValue == "fontset")
+ {
+ while (pChild)
+ {
+ strValue = pChild->ValueStr();
+ 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)
+ list.push_back(make_pair(g_localizeStrings.Get(atoi(idLocAttr)), idAttr));
+ else
+ list.push_back(make_pair(idAttr, idAttr));
+ }
+ }
+
+ pChild = pChild->NextSibling();
+ }
+ }
+ else
+ {
+ // Since no fontset is defined, there is no selection of a fontset, so disable the component
+ list.push_back(make_pair(g_localizeStrings.Get(13278), ""));
+ }
+}
+
+void CSkinInfo::SettingOptionsSkinSoundFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ //find skins...
+ CFileItemList items;
+ CDirectory::GetDirectory("special://xbmc/sounds/", items);
+ CDirectory::GetDirectory("special://home/sounds/", items);
+
+ vector<string> vecSoundSkins;
+ for (int i = 0; i < items.Size(); i++)
+ {
+ CFileItemPtr pItem = items[i];
+ if (pItem->m_bIsFolder)
+ {
+ if (StringUtils::EqualsNoCase(pItem->GetLabel(), ".svn") ||
+ StringUtils::EqualsNoCase(pItem->GetLabel(), "fonts") ||
+ StringUtils::EqualsNoCase(pItem->GetLabel(), "media"))
+ continue;
+
+ vecSoundSkins.push_back(pItem->GetLabel());
+ }
+ }
+
+ list.push_back(make_pair(g_localizeStrings.Get(474), "OFF"));
+ list.push_back(make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT"));
+
+ sort(vecSoundSkins.begin(), vecSoundSkins.end(), sortstringbyname());
+ for (unsigned int i = 0; i < vecSoundSkins.size(); i++)
+ list.push_back(make_pair(vecSoundSkins[i], vecSoundSkins[i]));
+}
+
+void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ // there is a default theme (just Textures.xpr/xbt)
+ // any other *.xpr|*.xbt files are additional themes on top of this one.
+ const CSettingString *pSettingString = (const CSettingString *)setting;
+
+ // add the default Label
+ list.push_back(make_pair(g_localizeStrings.Get(15109), "SKINDEFAULT")); // the standard Textures.xpr/xbt will be used
+
+ // search for themes in the current skin!
+ vector<CStdString> vecTheme;
+ CUtil::GetSkinThemes(vecTheme);
+
+ // sort the themes for GUI and list them
+ for (int i = 0; i < (int) vecTheme.size(); ++i)
+ list.push_back(make_pair(vecTheme[i], vecTheme[i]));
+
+ // set the choosen theme and remove the extension from the current theme (backward compat)
+ CStdString settingValue = pSettingString->GetValue();
+ URIUtils::RemoveExtension(settingValue);
+ current = settingValue;
+}
+
+void CSkinInfo::SettingOptionsStartupWindowsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ const vector<CStartupWindow> &startupWindows = g_SkinInfo->GetStartupWindows();
+
+ for (vector<CStartupWindow>::const_iterator it = startupWindows.begin(); it != startupWindows.end(); it++)
+ {
+ string windowName = it->m_name;
+ if (StringUtils::IsNaturalNumber(windowName))
+ windowName = g_localizeStrings.Get(atoi(windowName.c_str()));
+ int windowID = it->m_id;
+
+ list.push_back(make_pair(windowName, windowID));
+ }
+}
+
} /*namespace ADDON*/
*
*/
+#include <vector>
+
#include "Addon.h"
#include "guilib/GraphicContext.h" // needed for the RESOLUTION members
#include "guilib/GUIIncludes.h" // needed for the GUIInclude member
#define CREDIT_LINE_LENGTH 50
class TiXmlNode;
+class CSetting;
namespace ADDON
{
CSkinInfo(const cp_extension_t *ext);
virtual ~CSkinInfo();
+ virtual bool HasSettings();
+
/*! \brief Load resultion information from directories in Path().
*/
void Start();
static double GetMinVersion();
void LoadIncludes();
const INFO::CSkinVariableString* CreateSkinVariable(const CStdString& name, int context);
+
+ static void SettingOptionsSkinColorsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsSkinFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsSkinSoundFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsSkinThemesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsStartupWindowsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
protected:
/*! \brief Given a resolution, retrieve the corresponding directory name
\param res RESOLUTION to translate
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/DisplaySettings.h"
#include "windowing/WindowingFactory.h"
#include "utils/URIUtils.h"
#include "utils/StringUtils.h"
#include "guilib/LocalizeStrings.h"
#include "settings/AdvancedSettings.h"
#include "utils/StringUtils.h"
-#include "settings/GUISettings.h"
#include "storage/MediaManager.h"
using namespace MUSIC_INFO;
//! \param input The input file url
//! \param output The output file url
//! \param tag The music tag to attach to track
- //! \param encoder The encoder to use. See GUISettings.h
+ //! \param encoder The encoder to use. See Encoder.h
//! \param eject Should we eject tray on finish?
//! \param rate The sample rate of the input
//! \param channels Number of audio channels in input
#include "music/tags/MusicInfoTag.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogOK.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/SettingPath.h"
+#include "settings/Settings.h"
+#include "settings/windows/GUIControlSettings.h"
#include "FileItem.h"
#include "filesystem/SpecialProtocol.h"
#include "storage/MediaManager.h"
AddJob(new CCDDARipJob(pItem->GetPath(),strFile,
*pItem->GetMusicInfoTag(),
- g_guiSettings.GetInt("audiocds.encoder")));
+ CSettings::Get().GetInt("audiocds.encoder")));
return true;
}
if (item->GetPath().Find(".cdda") < 0)
continue;
- bool eject = g_guiSettings.GetBool("audiocds.ejectonrip") &&
+ bool eject = CSettings::Get().GetBool("audiocds.ejectonrip") &&
i == vecItems.Size()-1;
AddJob(new CCDDARipJob(item->GetPath(),strFile,
*item->GetMusicInfoTag(),
- g_guiSettings.GetInt("audiocds.encoder"), eject));
+ CSettings::Get().GetInt("audiocds.encoder"), eject));
}
return true;
bool CCDDARipper::CreateAlbumDir(const MUSIC_INFO::CMusicInfoTag& infoTag, CStdString& strDirectory, int& legalType)
{
- strDirectory = g_guiSettings.GetString("audiocds.recordingpath");
+ CSettingPath *recordingpathSetting = (CSettingPath*)CSettings::Get().GetSetting("audiocds.recordingpath");
+ if (recordingpathSetting != NULL)
+ {
+ strDirectory = recordingpathSetting->GetValue();
+ if (strDirectory.empty())
+ {
+ if (CGUIControlButtonSetting::GetPath(recordingpathSetting))
+ strDirectory = recordingpathSetting->GetValue();
+ }
+ }
URIUtils::AddSlashAtEnd(strDirectory);
if (strDirectory.size() < 3)
// use audiocds.trackpathformat setting to format
// directory name where CD tracks will be stored,
// use only format part ending at the last '/'
- strAlbumDir = g_guiSettings.GetString("audiocds.trackpathformat");
+ strAlbumDir = CSettings::Get().GetString("audiocds.trackpathformat");
int pos = max(strAlbumDir.ReverseFind('/'), strAlbumDir.ReverseFind('\\'));
if (pos < 0)
return ""; // no directory
// get track file name format from audiocds.trackpathformat setting,
// use only format part starting from the last '/'
- CStdString strFormat = g_guiSettings.GetString("audiocds.trackpathformat");
+ CStdString strFormat = CSettings::Get().GetString("audiocds.trackpathformat");
int pos = max(strFormat.ReverseFind('/'), strFormat.ReverseFind('\\'));
if (pos != -1)
{
CStdString track = destItem.GetLabel();
if (track.IsEmpty())
track.Format("%s%02i", "Track-", trackNumber);
- track += GetExtension(g_guiSettings.GetInt("audiocds.encoder"));
+ track += GetExtension(CSettings::Get().GetInt("audiocds.encoder"));
return track;
}
#define WRITEBUFFER_SIZE 131072 // 128k buffer
+enum CDDARipEncoder
+{
+ CDDARIP_ENCODER_LAME = 0,
+ CDDARIP_ENCODER_VORBIS,
+ CDDARIP_ENCODER_WAV,
+ CDDARIP_ENCODER_FLAC
+};
+
+enum CDDARipQuality
+{
+ CDDARIP_QUALITY_CBR = 0,
+ CDDARIP_QUALITY_MEDIUM,
+ CDDARIP_QUALITY_STANDARD,
+ CDDARIP_QUALITY_EXTREME
+};
+
namespace XFILE { class CFile; }
class CEncoder
#include "EncoderFFmpeg.h"
#include "filesystem/File.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/URIUtils.h"
/* AV_PKT_FLAG_KEY was named PKT_FLAG_KEY in older versions of libavcodec */
}
m_Format->oformat = fmt;
- m_Format->bit_rate = g_guiSettings.GetInt("audiocds.bitrate") * 1000;
+ m_Format->bit_rate = CSettings::Get().GetInt("audiocds.bitrate") * 1000;
/* add a stream to it */
m_Stream = m_dllAvFormat.avformat_new_stream(m_Format, codec);
#include "EncoderFlac.h"
#include "utils/log.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
CEncoderFlac::CEncoderFlac() : m_encoder(0), m_samplesBuf(new FLAC__int32[SAMPLES_BUF_SIZE])
{
ok &= m_dll.FLAC__stream_encoder_set_bits_per_sample(m_encoder, 16);
ok &= m_dll.FLAC__stream_encoder_set_sample_rate(m_encoder, 44100);
ok &= m_dll.FLAC__stream_encoder_set_total_samples_estimate(m_encoder, m_iTrackLength / 4);
- ok &= m_dll.FLAC__stream_encoder_set_compression_level(m_encoder, g_guiSettings.GetInt("audiocds.compressionlevel"));
+ ok &= m_dll.FLAC__stream_encoder_set_compression_level(m_encoder, CSettings::Get().GetInt("audiocds.compressionlevel"));
// now add some metadata
FLAC__StreamMetadata_VorbisComment_Entry entry;
*/
#include "EncoderLame.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#ifdef _WIN32
}
// setup parmaters, see lame.h for possibilities
- if (g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_CBR)
+ if (CSettings::Get().GetInt("audiocds.quality") == CDDARIP_QUALITY_CBR)
{
- int bitrate = g_guiSettings.GetInt("audiocds.bitrate");
+ int bitrate = CSettings::Get().GetInt("audiocds.bitrate");
// use cbr and specified bitrate from settings
CLog::Log(LOGDEBUG, "Lame setting CBR bitrate %d", bitrate);
m_dll.lame_set_brate(m_pGlobalFlags, bitrate);
{
// use presets (VBR)
int preset;
- switch (g_guiSettings.GetInt("audiocds.quality"))
+ switch (CSettings::Get().GetInt("audiocds.quality"))
{
case CDDARIP_QUALITY_MEDIUM:
preset = MEDIUM;
*/
#include "EncoderVorbis.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
CEncoderVorbis::CEncoderVorbis()
if (!CEncoder::Init(strFile, iInChannels, iInRate, iInBits)) return false;
float fQuality = 0.5f;
- if (g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_MEDIUM) fQuality = 0.4f;
- if (g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_STANDARD) fQuality = 0.5f;
- if (g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_EXTREME) fQuality = 0.7f;
+ if (CSettings::Get().GetInt("audiocds.quality") == CDDARIP_QUALITY_MEDIUM) fQuality = 0.4f;
+ if (CSettings::Get().GetInt("audiocds.quality") == CDDARIP_QUALITY_STANDARD) fQuality = 0.5f;
+ if (CSettings::Get().GetInt("audiocds.quality") == CDDARIP_QUALITY_EXTREME) fQuality = 0.7f;
if (!m_VorbisEncDll.Load() || !m_OggDll.Load() || !m_VorbisDll.Load())
{
}
m_VorbisDll.vorbis_info_init(&m_sVorbisInfo);
- if (g_guiSettings.GetInt("audiocds.quality") == CDDARIP_QUALITY_CBR)
+ if (CSettings::Get().GetInt("audiocds.quality") == CDDARIP_QUALITY_CBR)
{
// not realy cbr, but abr in this case
- int iBitRate = g_guiSettings.GetInt("audiocds.bitrate") * 1000;
+ int iBitRate = CSettings::Get().GetInt("audiocds.bitrate") * 1000;
m_VorbisEncDll.vorbis_encode_init(&m_sVorbisInfo, m_iInChannels, m_iInSampleRate, -1, iBitRate, -1);
}
else
#include "system.h"
#include "AEFactory.h"
+#include "Utils/AEUtil.h"
#if defined(TARGET_DARWIN)
#include "Engines/CoreAudio/CoreAudioAE.h"
+ #include "settings/SettingsManager.h"
#else
#include "Engines/SoftAE/SoftAE.h"
#endif
#include "Engines/PulseAE/PulseAE.h"
#endif
+#include "guilib/LocalizeStrings.h"
+#include "settings/Setting.h"
+#include "utils/StringUtils.h"
+
IAE* CAEFactory::AE = NULL;
static float g_fVolume = 1.0f;
static bool g_bMute = false;
if(AE)
AE->GarbageCollect();
}
+
+void CAEFactory::SettingOptionsAudioDevicesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ SettingOptionsAudioDevicesFillerGeneral(setting, list, current, false);
+}
+
+void CAEFactory::SettingOptionsAudioDevicesPassthroughFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ SettingOptionsAudioDevicesFillerGeneral(setting, list, current, true);
+}
+
+void CAEFactory::SettingOptionsAudioOutputModesFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ list.push_back(std::make_pair(g_localizeStrings.Get(338), AUDIO_ANALOG));
+#if !defined(TARGET_RASPBERRY_PI)
+ list.push_back(std::make_pair(g_localizeStrings.Get(339), AUDIO_IEC958));
+#endif
+ list.push_back(std::make_pair(g_localizeStrings.Get(420), AUDIO_HDMI));
+}
+
+void CAEFactory::SettingOptionsAudioDevicesFillerGeneral(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, bool passthrough)
+{
+ current = ((const CSettingString*)setting)->GetValue();
+ std::string firstDevice;
+
+ bool foundValue = false;
+ AEDeviceList sinkList;
+ EnumerateOutputDevices(sinkList, passthrough);
+#if !defined(TARGET_DARWIN)
+ if (sinkList.size() == 0)
+ list.push_back(std::make_pair("Error - no devices found", "error"));
+ else
+ {
+#endif
+ for (AEDeviceList::const_iterator sink = sinkList.begin(); sink != sinkList.end(); sink++)
+ {
+ if (sink == sinkList.begin())
+ firstDevice = sink->second;
+
+#if defined(TARGET_DARWIN)
+ list.push_back(StringSettingOption(sink->first, sink->first));
+#else
+ list.push_back(std::make_pair(sink->first, sink->second));
+#endif
+
+ if (StringUtils::EqualsNoCase(current, sink->second))
+ foundValue = true;
+ }
+#if !defined(TARGET_DARWIN)
+ }
+#endif
+
+ if (!foundValue)
+ current = firstDevice;
+}
*
*/
+#include <vector>
+
#include "Interfaces/AE.h"
#include "threads/Thread.h"
+class CSetting;
+
enum AEEngine
{
AE_ENGINE_NULL,
unsigned int encodedSampleRate, CAEChannelInfo channelLayout, unsigned int options = 0);
static IAEStream *FreeStream(IAEStream *stream);
static void GarbageCollect();
+
+ static void SettingOptionsAudioDevicesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsAudioDevicesPassthroughFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsAudioOutputModesFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
private:
static bool LoadEngine(enum AEEngine engine);
static IAE *AE;
+
+ static void SettingOptionsAudioDevicesFillerGeneral(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t, bool passthrough);
};
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "utils/log.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include <string.h>
CAEEncoderFFmpeg::CAEEncoderFFmpeg():
m_dllAvCodec.avcodec_register_all();
- bool ac3 = g_guiSettings.GetBool("audiooutput.ac3passthrough");
+ bool ac3 = CSettings::Get().GetBool("audiooutput.ac3passthrough");
AVCodec *codec = NULL;
#if 0
/* the DCA encoder is currently useless for transcode, it creates a 196 kHz DTS-HD like mongrel which is useless for SPDIF */
- bool dts = g_guiSettings.GetBool("audiooutput.dtspassthrough");
+ bool dts = CSettings::Get().GetBool("audiooutput.dtspassthrough");
if (dts && (!ac3 || g_advancedSettings.m_audioTranscodeTo.Equals("dts")))
{
m_CodecName = "DTS";
#include "CoreAudioAESound.h"
#include "Application.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/EndianSwap.h"
#include "utils/log.h"
if (m_rawPassthrough)
CLog::Log(LOGINFO, "CCoreAudioAE::OpenCoreAudio - RAW passthrough enabled");
- std::string m_outputDevice = g_guiSettings.GetString("audiooutput.audiodevice");
+ std::string m_outputDevice = CSettings::Get().GetString("audiooutput.audiodevice");
// on iOS devices we set fixed to two channels.
m_stdChLayout = AE_CH_LAYOUT_2_0;
#if defined(TARGET_DARWIN_OSX)
- switch (g_guiSettings.GetInt("audiooutput.channels"))
+ switch (CSettings::Get().GetInt("audiooutput.channels"))
{
default:
case 0: m_stdChLayout = AE_CH_LAYOUT_2_0; break; /* do not allow 1_0 output */
}
#endif
// force optical/coax to 2.0 output channels
- if (!m_rawPassthrough && g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958)
+ if (!m_rawPassthrough && CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958)
m_stdChLayout = AE_CH_LAYOUT_2_0;
// setup the desired format
#include "CoreAudioChannelLayout.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
-#include "settings/GUISettings.h"
#include "utils/log.h"
+#include "settings/Settings.h"
CCoreAudioAEHALOSX::CCoreAudioAEHALOSX() :
m_audioGraph (NULL ),
if (!m_audioGraph)
return false;
- AudioChannelLayoutTag layout = g_LayoutMap[ g_guiSettings.GetInt("audiooutput.channels") ];
+ AudioChannelLayoutTag layout = g_LayoutMap[ CSettings::Get().GetInt("audiooutput.channels") ];
// force optical/coax to 2.0 output channels
- if (!m_Passthrough && g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958)
+ if (!m_Passthrough && CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958)
layout = g_LayoutMap[1];
if (!m_audioGraph->Open(pSource, format, outputDevice, allowMixing, layout, m_initVolume ))
#include "xbmc/cores/AudioEngine/Interfaces/AE.h"
#include "xbmc/cores/AudioEngine/AEFactory.h"
#include "xbmc/cores/AudioEngine/Utils/AEUtil.h"
-#include "settings/GUISettings.h"
#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "settings/AdvancedSettings.h"
#include "Application.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "settings/Settings.h"
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
#include "guilib/LocalizeStrings.h"
#include "utils/MathUtils.h"
#include "utils/EndianSwap.h"
#include "threads/SingleLock.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "SoftAE.h"
#include "SoftAESound.h"
setting == "audiooutput.passthroughaac" ||
setting == "audiooutput.truehdpassthrough" ||
setting == "audiooutput.dtshdpassthrough" ||
- setting == "audiooutput.channels" ||
- setting == "audiooutput.useexclusivemode" ||
+ setting == "audiooutput.channels" ||
setting == "audiooutput.multichannellpcm" ||
setting == "audiooutput.stereoupmix")
{
if (m_audiophile)
CLog::Log(LOGINFO, "CSoftAE::LoadSettings - Audiophile switch enabled");
- m_stereoUpmix = g_guiSettings.GetBool("audiooutput.stereoupmix");
+ m_stereoUpmix = CSettings::Get().GetBool("audiooutput.stereoupmix");
if (m_stereoUpmix)
CLog::Log(LOGINFO, "CSoftAE::LoadSettings - Stereo upmix is enabled");
/* load the configuration */
m_stdChLayout = AE_CH_LAYOUT_2_0;
- switch (g_guiSettings.GetInt("audiooutput.channels"))
+ switch (CSettings::Get().GetInt("audiooutput.channels"))
{
default:
case 0: m_stdChLayout = AE_CH_LAYOUT_2_0; break; /* dont alow 1_0 output */
}
// force optical/coax to 2.0 output channels
- if (!m_rawPassthrough && g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958)
+ if (!m_rawPassthrough && CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958)
m_stdChLayout = AE_CH_LAYOUT_2_0;
/* get the output devices and ensure they exist */
- m_device = g_guiSettings.GetString("audiooutput.audiodevice");
- m_passthroughDevice = g_guiSettings.GetString("audiooutput.passthroughdevice");
+ m_device = CSettings::Get().GetString("audiooutput.audiodevice");
+ m_passthroughDevice = CSettings::Get().GetString("audiooutput.passthroughdevice");
VerifySoundDevice(m_device , false);
VerifySoundDevice(m_passthroughDevice, true );
m_transcode = (
- g_guiSettings.GetBool("audiooutput.ac3passthrough") /*||
- g_guiSettings.GetBool("audiooutput.dtspassthrough") */
+ CSettings::Get().GetBool("audiooutput.ac3passthrough") /*||
+ CSettings::Get().GetBool("audiooutput.dtspassthrough") */
) && (
- (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958) ||
- (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI && !g_guiSettings.GetBool("audiooutput.multichannellpcm"))
+ (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) ||
+ (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI && !CSettings::Get().GetBool("audiooutput.multichannellpcm"))
);
}
#include "utils/log.h"
#include "utils/MathUtils.h"
#include "threads/SingleLock.h"
-#include "settings/GUISettings.h"
#if defined(HAS_AMLPLAYER)
#include "cores/amlplayer/AMLUtils.h"
#endif
#include "utils/StdString.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
-#include "settings/GUISettings.h"
CAESinkProfiler::CAESinkProfiler()
{
#include <stdint.h>
#include "../Utils/AEUtil.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "utils/StdString.h"
#include "utils/log.h"
#include "cores/AudioEngine/AEFactory.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace std;
#undef RM
- if (g_guiSettings.GetBool("audiooutput.stereoupmix"))
+ if (CSettings::Get().GetBool("audiooutput.stereoupmix"))
BuildUpmixMatrix(input, output);
/* normalize the values */
else
{
//FIXME: guisetting is reversed, change the setting name after frodo
- normalize = !g_guiSettings.GetBool("audiooutput.normalizelevels");
+ normalize = !CSettings::Get().GetBool("audiooutput.normalizelevels");
CLog::Log(LOGDEBUG, "AERemap: Downmix normalization is %s", (normalize ? "enabled" : "disabled"));
}
#define MEMALIGN(b, x) __declspec(align(b)) x
#endif
+#define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI)
+
+enum AudioOutputs
+{
+ AUDIO_ANALOG = 0,
+ AUDIO_IEC958,
+ AUDIO_HDMI
+};
+
+// AV sync options
+enum AVSync
+{
+ SYNC_DISCON = 0,
+ SYNC_SKIPDUP,
+ SYNC_RESAMPLE
+};
+
class CAEUtil
{
private:
#include "filesystem/SpecialProtocol.h"
#include "URL.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "filesystem/Directory.h"
extern "C" void __stdcall update_emu_environ()
{
// Use a proxy, if the GUI was configured as such
- if (g_guiSettings.GetBool("network.usehttpproxy")
- && !g_guiSettings.GetString("network.httpproxyserver").empty()
- && !g_guiSettings.GetString("network.httpproxyport").empty()
- && g_guiSettings.GetInt("network.httpproxytype") == 0)
+ if (CSettings::Get().GetBool("network.usehttpproxy")
+ && !CSettings::Get().GetString("network.httpproxyserver").empty()
+ && !CSettings::Get().GetString("network.httpproxyport").empty()
+ && CSettings::Get().GetInt("network.httpproxytype") == 0)
{
CStdString strProxy;
- if (g_guiSettings.GetString("network.httpproxyusername") &&
- g_guiSettings.GetString("network.httpproxypassword"))
+ if (!CSettings::Get().GetString("network.httpproxyusername").empty() &&
+ !CSettings::Get().GetString("network.httpproxypassword").empty())
{
- strProxy.Format("%s:%s@", g_guiSettings.GetString("network.httpproxyusername").c_str(),
- g_guiSettings.GetString("network.httpproxypassword").c_str());
+ strProxy.Format("%s:%s@", CSettings::Get().GetString("network.httpproxyusername").c_str(),
+ CSettings::Get().GetString("network.httpproxypassword").c_str());
}
- strProxy += g_guiSettings.GetString("network.httpproxyserver");
- strProxy += ":" + g_guiSettings.GetString("network.httpproxyport");
+ strProxy += CSettings::Get().GetString("network.httpproxyserver");
+ strProxy += ":" + CSettings::Get().GetString("network.httpproxyport");
#ifdef _WIN32
pgwin32_putenv(("HTTP_PROXY=http://" +strProxy).c_str());
#include <algorithm>
#include "BaseRenderer.h"
#include "settings/DisplaySettings.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/GraphicContext.h"
#include "guilib/GUIWindowManager.h"
+#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
#include "utils/MathUtils.h"
+#include "utils/SystemInfo.h"
#include "settings/AdvancedSettings.h"
#include "cores/VideoRenderers/RenderFlags.h"
// Adjust refreshrate to match source fps
#if !defined(TARGET_DARWIN_IOS)
- if (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
+ if (CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
{
float weight;
if (!FindResolutionFromOverride(fps, weight, false)) //find a refreshrate from overrides
// allow a certain error to maximize screen size
float fCorrection = screenWidth / screenHeight / outputFrameRatio - 1.0f;
- float fAllowed = g_guiSettings.GetInt("videoplayer.errorinaspect") * 0.01f;
+ float fAllowed = CSettings::Get().GetInt("videoplayer.errorinaspect") * 0.01f;
if(fCorrection > fAllowed) fCorrection = fAllowed;
if(fCorrection < - fAllowed) fCorrection = - fAllowed;
CDisplaySettings::Get().SetNonLinearStretched(false);
if ( CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeZoom ||
- (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == ViewModeZoom))
+ (is43 && CSettings::Get().GetInt("videoplayer.stretch43") == ViewModeZoom))
{ // zoom image so no black bars
CDisplaySettings::Get().SetPixelRatio(1.0);
// calculate the desired output ratio
}
}
else if ( CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeWideZoom ||
- (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == ViewModeWideZoom))
+ (is43 && CSettings::Get().GetInt("videoplayer.stretch43") == ViewModeWideZoom))
{ // super zoom
float stretchAmount = (screenWidth / screenHeight) * CDisplaySettings::Get().GetResolutionInfo(res).fPixelRatio / sourceFrameRatio;
CDisplaySettings::Get().SetPixelRatio(pow(stretchAmount, float(2.0/3.0)));
CDisplaySettings::Get().SetNonLinearStretched(true);
}
else if ( CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode == ViewModeStretch16x9 ||
- (is43 && g_guiSettings.GetInt("videoplayer.stretch43") == ViewModeStretch16x9))
+ (is43 && CSettings::Get().GetInt("videoplayer.stretch43") == ViewModeStretch16x9))
{ // stretch image to 16:9 ratio
CDisplaySettings::Get().SetZoomAmount(1.0);
if (res == RES_PAL_4x3 || res == RES_PAL60_4x3 || res == RES_NTSC_4x3 || res == RES_HDTV_480p_4x3)
g_windowManager.MarkDirty(m_destRect);
}
+void CBaseRenderer::SettingOptionsRenderMethodsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ list.push_back(make_pair(g_localizeStrings.Get(13416), RENDER_METHOD_AUTO));
+
+#ifdef HAS_DX
+ if (g_sysinfo.IsVistaOrHigher())
+ list.push_back(make_pair(g_localizeStrings.Get(16319), RENDER_METHOD_DXVA));
+ list.push_back(make_pair(g_localizeStrings.Get(13431), RENDER_METHOD_D3D_PS));
+ list.push_back(make_pair(g_localizeStrings.Get(13419), RENDER_METHOD_SOFTWARE));
+#endif
+
+#ifdef HAS_GL
+ list.push_back(make_pair(g_localizeStrings.Get(13417), RENDER_METHOD_ARB));
+ list.push_back(make_pair(g_localizeStrings.Get(13418), RENDER_METHOD_GLSL));
+ list.push_back(make_pair(g_localizeStrings.Get(13419), RENDER_METHOD_SOFTWARE));
+#endif
+}
*
*/
+#include <vector>
+
#include "guilib/Resolution.h"
#include "guilib/Geometry.h"
#include "RenderFormats.h"
#define MAX_PLANES 3
#define MAX_FIELDS 3
+class CSetting;
+
typedef struct YV12Image
{
BYTE * plane[MAX_PLANES];
RENDERFEATURE_POSTPROCESS
};
+// Render Methods
+enum RenderMethods
+{
+ RENDER_METHOD_AUTO = 0,
+ RENDER_METHOD_ARB,
+ RENDER_METHOD_GLSL,
+ RENDER_METHOD_SOFTWARE,
+ RENDER_METHOD_D3D_PS,
+ RENDER_METHOD_DXVA,
+ RENDER_OVERLAYS = 99 // to retain compatibility
+};
+
typedef void (*RenderUpdateCallBackFn)(const void *ctx, const CRect &SrcRect, const CRect &DestRect);
struct DVDVideoPicture;
virtual void RegisterRenderUpdateCallBack(const void *ctx, RenderUpdateCallBackFn fn);
+ static void SettingOptionsRenderMethodsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
protected:
void ChooseBestResolution(float fps);
bool FindResolutionFromOverride(float fps, float& weight, bool fallback);
#include "LinuxRendererGL.h"
#include "Application.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "VideoShaders/YUV2RGBShader.h"
#include "VideoShaders/VideoFilterShader.h"
#include "windowing/WindowingFactory.h"
m_nonLinStretchGui = false;
m_pixelRatio = 1.0;
- m_pboSupported = glewIsSupported("GL_ARB_pixel_buffer_object") && g_guiSettings.GetBool("videoplayer.usepbo");
+ m_pboSupported = glewIsSupported("GL_ARB_pixel_buffer_object") && CSettings::Get().GetBool("videoplayer.usepbo");
return true;
}
}
else
{
- int requestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod");
+ int requestedMethod = CSettings::Get().GetInt("videoplayer.rendermethod");
CLog::Log(LOGDEBUG, "GL: Requested render method: %d", requestedMethod);
if (m_pYUVShader)
{
if(feature == RENDERFEATURE_BRIGHTNESS)
{
- if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoscreen.limitedrange"))
+ if ((m_renderMethod & RENDER_VDPAU) && !CSettings::Get().GetBool("videoscreen.limitedrange"))
return true;
if (m_renderMethod & RENDER_VAAPI)
if(feature == RENDERFEATURE_CONTRAST)
{
- if ((m_renderMethod & RENDER_VDPAU) && !g_guiSettings.GetBool("videoscreen.limitedrange"))
+ if ((m_renderMethod & RENDER_VDPAU) && !CSettings::Get().GetBool("videoscreen.limitedrange"))
return true;
if (m_renderMethod & RENDER_VAAPI)
// if scaling is below level, avoid hq scaling
float scaleX = fabs(((float)m_sourceWidth - m_destRect.Width())/m_sourceWidth)*100;
float scaleY = fabs(((float)m_sourceHeight - m_destRect.Height())/m_sourceHeight)*100;
- int minScale = g_guiSettings.GetInt("videoplayer.hqscalers");
+ int minScale = CSettings::Get().GetInt("videoplayer.hqscalers");
if (scaleX < minScale && scaleY < minScale)
return false;
#include "utils/fastmemcpy.h"
#include "utils/MathUtils.h"
#include "utils/GLUtils.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "settings/MediaSettings.h"
#include "settings/DisplaySettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/FrameBufferObject.h"
#include "VideoShaders/YUV2RGBShader.h"
#include "VideoShaders/VideoFilterShader.h"
#ifdef TARGET_DARWIN_IOS
float ios_version = GetIOSVersion();
#endif
- int requestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod");
+ int requestedMethod = CSettings::Get().GetInt("videoplayer.rendermethod");
CLog::Log(LOGDEBUG, "GL: Requested render method: %d", requestedMethod);
if (m_pYUVShader)
#include "cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySpu.h"
#include "cores/dvdplayer/DVDCodecs/Overlay/DVDOverlaySSA.h"
#include "cores/VideoRenderers/RenderManager.h"
+#include "guilib/GraphicContext.h"
#include "Application.h"
#include "guilib/GraphicContext.h"
#include "windowing/WindowingFactory.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
+#include "settings/DisplaySettings.h"
#include "threads/SingleLock.h"
#include "utils/MathUtils.h"
#if defined(HAS_GL) || defined(HAS_GLES)
#include "utils/log.h"
#include "windowing/WindowingFactory.h"
#include "utils/fastmemcpy.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
CRenderCaptureBase::CRenderCaptureBase()
{
if (!m_asyncChecked)
{
#ifndef HAS_GLES
- bool usePbo = g_guiSettings.GetBool("videoplayer.usepbo");
+ bool usePbo = CSettings::Get().GetBool("videoplayer.usepbo");
m_asyncSupported = g_Windowing.IsExtSupported("GL_ARB_pixel_buffer_object") && usePbo;
m_occlusionQuerySupported = g_Windowing.IsExtSupported("GL_ARB_occlusion_query");
#include "Application.h"
#include "ApplicationMessenger.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#if defined(HAS_GL)
#include "LinuxRendererGL.h"
{
float fps;
- if (g_guiSettings.GetInt("videoscreen.vsync") != VSYNC_DISABLED)
+ if (CSettings::Get().GetInt("videoscreen.vsync") != VSYNC_DISABLED)
{
fps = (float)g_VideoReferenceClock.GetRefreshRate();
if (fps <= 0) fps = g_graphicsContext.GetFPS();
#include "WinRenderer.h"
#include "Util.h"
#include "settings/DisplaySettings.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/Texture.h"
#include "windowing/WindowingFactory.h"
#include "settings/AdvancedSettings.h"
g_Windowing.Get3DDevice()->GetDeviceCaps(&m_deviceCaps);
- m_iRequestedMethod = g_guiSettings.GetInt("videoplayer.rendermethod");
+ m_iRequestedMethod = CSettings::Get().GetInt("videoplayer.rendermethod");
if ((g_advancedSettings.m_DXVAForceProcessorRenderer || m_iRequestedMethod == RENDER_METHOD_DXVA) && !m_processor.PreInit())
CLog::Log(LOGNOTICE, "CWinRenderer::Preinit - could not init DXVA2 processor - skipping");
// if scaling is below level, avoid hq scaling
float scaleX = fabs(((float)m_sourceWidth - m_destRect.Width())/m_sourceWidth)*100;
float scaleY = fabs(((float)m_sourceHeight - m_destRect.Height())/m_sourceHeight)*100;
- int minScale = g_guiSettings.GetInt("videoplayer.hqscalers");
+ int minScale = CSettings::Get().GetInt("videoplayer.hqscalers");
if (scaleX < minScale && scaleY < minScale)
return false;
return true;
#include "stdafx.h"
#include "ComboRenderer.h"
#include "Application.h"
-#include "Settings.h"
+#include "settings/Settings.h"
#include "settings/DisplaySettings.h"
CComboRenderer::CComboRenderer(LPDIRECT3DDEVICE8 pDevice)
if (g_application.IsInScreenSaver() && !m_bHasDimView)
{
D3DLOCKED_RECT lr;
- float fAmount = (float)g_guiSettings.GetInt("screensaver.dimlevel") / 100.0f;
+ float fAmount = (float)CSettings::Get().GetInt("screensaver.dimlevel") / 100.0f;
if ( D3D_OK == m_YUY2Texture[m_iYUY2RenderBuffer]->LockRect(0, &lr, NULL, 0 ))
{
// Drop brightness of current surface to 20%
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
#include "settings/VideoSettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
m_audio_info = "none";
m_audio_delay = 0;
- m_audio_passthrough_ac3 = g_guiSettings.GetBool("audiooutput.ac3passthrough");
- m_audio_passthrough_dts = g_guiSettings.GetBool("audiooutput.dtspassthrough");
+ m_audio_passthrough_ac3 = CSettings::Get().GetBool("audiooutput.ac3passthrough");
+ m_audio_passthrough_dts = CSettings::Get().GetBool("audiooutput.dtspassthrough");
m_video_info = "none";
m_video_width = 0;
#include "DVDPlayerAudio.h"
#include "cores/AudioEngine/AEFactory.h"
#include "cores/AudioEngine/Interfaces/AEStream.h"
-#include "settings/Settings.h"
#include "settings/MediaSettings.h"
using namespace std;
#endif
#include "../../DVDStreamInfo.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
+
+#if defined(TARGET_DARWIN)
+#include "settings/Settings.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
+#endif
CDVDAudioCodecFFmpeg::CDVDAudioCodecFFmpeg() : CDVDAudioCodec()
{
}
#if defined(TARGET_DARWIN)
- int audioMode = g_guiSettings.GetInt("audiooutput.mode");
+ int audioMode = CSettings::Get().GetInt("audiooutput.mode");
if (audioMode == AUDIO_HDMI)
- m_bLpcmMode = g_guiSettings.GetBool("audiooutput.multichannellpcm");
+ m_bLpcmMode = CSettings::Get().GetBool("audiooutput.multichannellpcm");
#endif
m_pCodecContext = m_dllAvCodec.avcodec_alloc_context3(pCodec);
#include "DVDAudioCodecPassthrough.h"
#include "DVDCodecs/DVDCodecs.h"
#include "DVDStreamInfo.h"
-#include "settings/GUISettings.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
#include "settings/Settings.h"
#include "utils/log.h"
bool bSupportsTrueHDOut = false;
bool bSupportsDTSHDOut = false;
- int audioMode = g_guiSettings.GetInt("audiooutput.mode");
+ int audioMode = CSettings::Get().GetInt("audiooutput.mode");
if (AUDIO_IS_BITSTREAM(audioMode))
{
- bSupportsAC3Out = g_guiSettings.GetBool("audiooutput.ac3passthrough");
- bSupportsDTSOut = g_guiSettings.GetBool("audiooutput.dtspassthrough");
+ bSupportsAC3Out = CSettings::Get().GetBool("audiooutput.ac3passthrough");
+ bSupportsDTSOut = CSettings::Get().GetBool("audiooutput.dtspassthrough");
}
if (audioMode == AUDIO_HDMI)
{
- bSupportsTrueHDOut = g_guiSettings.GetBool("audiooutput.truehdpassthrough");
- bSupportsDTSHDOut = g_guiSettings.GetBool("audiooutput.dtshdpassthrough" ) && bSupportsDTSOut;
+ bSupportsTrueHDOut = CSettings::Get().GetBool("audiooutput.truehdpassthrough");
+ bSupportsDTSHDOut = CSettings::Get().GetBool("audiooutput.dtshdpassthrough" ) && bSupportsDTSOut;
}
/* only get the dts core from the parser if we don't support dtsHD */
#include "DVDAudioCodecPassthroughFFmpeg.h"
#include "DVDCodecs/DVDCodecs.h"
#include "DVDStreamInfo.h"
-#include "settings/GUISettings.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
bool CDVDAudioCodecPassthroughFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
{
- int audioMode = g_guiSettings.GetInt("audiooutput.mode");
+ int audioMode = CSettings::Get().GetInt("audiooutput.mode");
// TODO - move this stuff somewhere else
if (AUDIO_IS_BITSTREAM(audioMode))
{
- m_bSupportsAC3Out = g_guiSettings.GetBool("audiooutput.ac3passthrough");
- m_bSupportsDTSOut = g_guiSettings.GetBool("audiooutput.dtspassthrough");
- m_bSupportsAACOut = g_guiSettings.GetBool("audiooutput.passthroughaac");
+ m_bSupportsAC3Out = CSettings::Get().GetBool("audiooutput.ac3passthrough");
+ m_bSupportsDTSOut = CSettings::Get().GetBool("audiooutput.dtspassthrough");
+ m_bSupportsAACOut = CSettings::Get().GetBool("audiooutput.passthroughaac");
}
else
return false;
#include "DVDStreamInfo.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/SystemInfo.h"
CDVDVideoCodec* CDVDFactoryCodec::OpenCodec(CDVDVideoCodec* pCodec, CDVDStreamInfo &hints, CDVDCodecOptions &options )
if( (pCodec = OpenCodec(new CDVDVideoCodecLibMpeg2(), hint, options)) ) return pCodec;
}
#if defined(HAVE_LIBVDADECODER)
- if (!hint.software && g_guiSettings.GetBool("videoplayer.usevda"))
+ if (!hint.software && CSettings::Get().GetBool("videoplayer.usevda"))
{
if (g_sysinfo.HasVDADecoder())
{
#endif
#if defined(HAVE_VIDEOTOOLBOXDECODER)
- if (!hint.software && g_guiSettings.GetBool("videoplayer.usevideotoolbox"))
+ if (!hint.software && CSettings::Get().GetBool("videoplayer.usevideotoolbox"))
{
if (g_sysinfo.HasVideoToolBoxDecoder())
{
#endif
#if defined(HAVE_LIBCRYSTALHD)
- if (!hint.software && g_guiSettings.GetBool("videoplayer.usechd"))
+ if (!hint.software && CSettings::Get().GetBool("videoplayer.usechd"))
{
if (CCrystalHD::GetInstance()->DevicePresent())
{
#endif
#if defined(HAVE_LIBOPENMAX)
- if (g_guiSettings.GetBool("videoplayer.useomx") && !hint.software )
+ if (CSettings::Get().GetBool("videoplayer.useomx") && !hint.software )
{
if (hint.codec == CODEC_ID_H264 || hint.codec == CODEC_ID_MPEG2VIDEO || hint.codec == CODEC_ID_VC1)
{
#include "DVDOverlayText.h"
#include "DVDStreamInfo.h"
#include "DVDCodecs/DVDCodecs.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
// 3GPP/TX3G (aka MPEG-4 Timed Text) Subtitle support
m_pOverlay = NULL;
// stupid, this comes from a static global in GUIWindowFullScreen.cpp
uint32_t colormap[8] = { 0xFFFFFF00, 0xFFFFFFFF, 0xFF0099FF, 0xFF00FF00, 0xFFCCFF00, 0xFF00FFFF, 0xFFE5E5E5, 0xFFC0C0C0 };
- m_textColor = colormap[g_guiSettings.GetInt("subtitles.color")];
+ m_textColor = colormap[CSettings::Get().GetInt("subtitles.color")];
}
CDVDOverlayCodecTX3G::~CDVDOverlayCodecTX3G()
#endif
#if defined(HAVE_LIBCRYSTALHD)
-#include "settings/GUISettings.h"
#include "DVDClock.h"
#include "DVDStreamInfo.h"
#include "DVDVideoCodecCrystalHD.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
bool CDVDVideoCodecCrystalHD::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
{
- if (g_guiSettings.GetBool("videoplayer.usechd") && !hints.software)
+ if (CSettings::Get().GetBool("videoplayer.usechd") && !hints.software)
{
switch (hints.codec)
{
#include "utils/CPUInfo.h"
#endif
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "boost/shared_ptr.hpp"
#include "threads/Atomics.h"
while(*cur != PIX_FMT_NONE)
{
#ifdef HAVE_LIBVDPAU
- if(CVDPAU::IsVDPAUFormat(*cur) && g_guiSettings.GetBool("videoplayer.usevdpau"))
+ if(CVDPAU::IsVDPAUFormat(*cur) && CSettings::Get().GetBool("videoplayer.usevdpau"))
{
if(ctx->GetHardware())
return *cur;
}
#endif
#ifdef HAS_DX
- if(DXVA::CDecoder::Supports(*cur) && g_guiSettings.GetBool("videoplayer.usedxva2"))
+ if(DXVA::CDecoder::Supports(*cur) && CSettings::Get().GetBool("videoplayer.usedxva2"))
{
DXVA::CDecoder* dec = new DXVA::CDecoder();
if(dec->Open(avctx, *cur, ctx->m_uSurfacesCount))
#endif
#ifdef HAVE_LIBVA
// mpeg4 vaapi decoding is disabled
- if(*cur == PIX_FMT_VAAPI_VLD && g_guiSettings.GetBool("videoplayer.usevaapi")
+ if(*cur == PIX_FMT_VAAPI_VLD && CSettings::Get().GetBool("videoplayer.usevaapi")
&& (avctx->codec_id != CODEC_ID_MPEG4 || g_advancedSettings.m_videoAllowMpeg4VAAPI))
{
if (ctx->GetHardware() != NULL)
}
#ifdef HAVE_LIBVDPAU
- if(g_guiSettings.GetBool("videoplayer.usevdpau") && !m_bSoftware)
+ if(CSettings::Get().GetBool("videoplayer.usevdpau") && !m_bSoftware)
{
while((pCodec = m_dllAvCodec.av_codec_next(pCodec)))
{
#if defined(HAVE_LIBOPENMAX)
#include "DVDClock.h"
-#include "settings/GUISettings.h"
#include "DVDStreamInfo.h"
#include "DVDVideoCodecOpenMax.h"
#include "OpenMaxVideo.h"
bool CDVDVideoCodecOpenMax::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
{
// we always qualify even if DVDFactoryCodec does this too.
- if (g_guiSettings.GetBool("videoplayer.useomx") && !hints.software)
+ if (CSettings::Get().GetBool("videoplayer.useomx") && !hints.software)
{
m_convert_bitstream = false;
#include "DVDStreamInfo.h"
#include "cores/dvdplayer/DVDCodecs/DVDCodecUtils.h"
#include "osx/CocoaInterface.h"
-#include "settings/GUISettings.h"
#include "windowing/WindowingFactory.h"
#include "utils/BitstreamConverter.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
+#include "settings/Settings.h"
#include <CoreFoundation/CoreFoundation.h>
else
m_dll = g_DllLibVDADecoder;
- if (g_guiSettings.GetBool("videoplayer.usevda") && !hints.software)
+ if (CSettings::Get().GetBool("videoplayer.usevda") && !hints.software)
{
CCocoaAutoPool pool;
#endif
#if defined(HAVE_VIDEOTOOLBOXDECODER)
-#include "GUISettings.h"
#include "DVDClock.h"
#include "DVDStreamInfo.h"
#include "DVDCodecUtils.h"
#include "DVDVideoCodecVideoToolBox.h"
#include "lib/DllSwScale.h"
#include "lib/DllAvFormat.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
#include "osx/DarwinUtils.h"
bool CDVDVideoCodecVideoToolBox::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
{
- if (g_guiSettings.GetBool("videoplayer.usevideotoolbox") && !hints.software)
+ if (CSettings::Get().GetBool("videoplayer.usevideotoolbox") && !hints.software)
{
m_dllAvUtil = new DllAvUtil;
m_dllAvFormat = new DllAvFormat;
#include "windowing/WindowingFactory.h"
#include "../../../VideoRenderers/WinRenderer.h"
#include "settings/Settings.h"
+#include "settings/MediaSettings.h"
#include "boost/shared_ptr.hpp"
#include "utils/AutoPtrHandle.h"
#include "settings/AdvancedSettings.h"
#include "DVDVideoCodecFFmpeg.h"
#include "DVDClock.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
#include "Application.h"
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("videoscreen.limitedrange"))
+ if (CSettings::Get().GetBool("videoscreen.limitedrange"))
{
void const * pm_CSCMatix[] = { &studioCSC };
vdp_st = vdp_video_mixer_set_attribute_values(videoMixer, ARSIZE(attributes), attributes, pm_CSCMatix);
#include "DVDClock.h" // for DVD_TIME_BASE
#include "commons/Exception.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "filesystem/File.h"
#include "filesystem/Directory.h"
#include "utils/log.h"
}
case AVMEDIA_TYPE_SUBTITLE:
{
- if (pStream->codec->codec_id == CODEC_ID_DVB_TELETEXT && g_guiSettings.GetBool("videoplayer.teletextenabled"))
+ if (pStream->codec->codec_id == CODEC_ID_DVB_TELETEXT && CSettings::Get().GetBool("videoplayer.teletextenabled"))
{
CDemuxStreamTeletext* st = new CDemuxStreamTeletext();
m_streams[iId] = st;
#include "IDVDPlayer.h"
#include "DVDCodecs/Overlay/DVDOverlay.h"
#include "DVDCodecs/Overlay/DVDOverlayImage.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "LangInfo.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
if(m_navmode)
{
- int region = g_guiSettings.GetInt("dvds.playerregion");
+ int region = CSettings::Get().GetInt("dvds.playerregion");
if(region == 0)
{
CLog::Log(LOGWARNING, "CDVDInputStreamBluray::Open - region dvd must be set in setting, assuming region 1");
#include "utils/LangCodeExpander.h"
#include "../DVDDemuxSPU.h"
#include "DVDStateSerializer.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "LangInfo.h"
#include "utils/log.h"
#include "guilib/Geometry.h"
return false;
}
- int region = g_guiSettings.GetInt("dvds.playerregion");
+ int region = CSettings::Get().GetInt("dvds.playerregion");
int mask = 0;
if(region > 0)
mask = 1 << (region-1);
}
// jump directly to title menu
- if(g_guiSettings.GetBool("dvds.automenu"))
+ if(CSettings::Get().GetBool("dvds.automenu"))
{
int len, event;
uint8_t buf[2048];
#include "utils/StringUtils.h"
#include "pvr/addons/PVRClients.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace XFILE;
using namespace PVR;
}
}
- ResetScanTimeout((unsigned int) g_guiSettings.GetInt("pvrplayback.scantime") * 1000);
+ ResetScanTimeout((unsigned int) CSettings::Get().GetInt("pvrplayback.scantime") * 1000);
m_content = content;
CLog::Log(LOGDEBUG, "CDVDInputStreamPVRManager::Open - stream opened: %s", transFile.c_str());
#endif
#include "settings/AdvancedSettings.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
-#include "settings/MediaSettings.h"
#include "GUIUserMessages.h"
#include "settings/Settings.h"
+#include "settings/MediaSettings.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
#include "utils/StreamDetails.h"
PREDICATE_RETURN(lh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream
, rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream);
- if(!g_guiSettings.GetString("locale.audiolanguage").Equals("original"))
+ if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.audiolanguage"), "original"))
{
CStdString audio_language = g_langInfo.GetAudioLanguage();
PREDICATE_RETURN(audio_language.Equals(lh.language.c_str())
, rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream);
CStdString subtitle_language = g_langInfo.GetSubtitleLanguage();
- if(!g_guiSettings.GetString("locale.subtitlelanguage").Equals("original"))
+ if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.subtitlelanguage"), "original"))
{
PREDICATE_RETURN((lh.source == STREAM_SOURCE_DEMUX_SUB || lh.source == STREAM_SOURCE_TEXT) && subtitle_language.Equals(lh.language.c_str())
, (rh.source == STREAM_SOURCE_DEMUX_SUB || rh.source == STREAM_SOURCE_TEXT) && subtitle_language.Equals(rh.language.c_str()));
PREDICATE_RETURN(lh.source == STREAM_SOURCE_TEXT
, rh.source == STREAM_SOURCE_TEXT);
- if(!g_guiSettings.GetString("locale.subtitlelanguage").Equals("original"))
+ if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.subtitlelanguage"), "original"))
{
PREDICATE_RETURN(subtitle_language.Equals(lh.language.c_str())
, subtitle_language.Equals(rh.language.c_str()));
if (filename.Left(7) == "http://" && CURL(filename).GetFileName().Right(5) == ".m3u8")
{
// get the available bandwidth (as per user settings)
- int maxrate = g_guiSettings.GetInt("network.bandwidth");
+ int maxrate = CSettings::Get().GetInt("network.bandwidth");
if(maxrate <= 0)
maxrate = INT_MAX;
if(input)
{
bool bSwitchSuccessful(false);
- bool bShowPreview(g_guiSettings.GetInt("pvrplayback.channelentrytimeout") > 0);
+ bool bShowPreview(CSettings::Get().GetInt("pvrplayback.channelentrytimeout") > 0);
if (!bShowPreview)
{
if (bShowPreview)
{
UpdateApplication(0);
- m_iChannelEntryTimeOut = XbmcThreads::SystemClockMillis() + g_guiSettings.GetInt("pvrplayback.channelentrytimeout");
+ m_iChannelEntryTimeOut = XbmcThreads::SystemClockMillis() + CSettings::Get().GetInt("pvrplayback.channelentrytimeout");
}
else
{
m_dvdPlayerVideo.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
if (state == CACHESTATE_PVR)
- m_pInputStream->ResetScanTimeout((unsigned int) g_guiSettings.GetInt("pvrplayback.scantime") * 1000);
+ m_pInputStream->ResetScanTimeout((unsigned int) CSettings::Get().GetInt("pvrplayback.scantime") * 1000);
}
if(state == CACHESTATE_PLAY
{
bool bReturn(false);
- if (g_guiSettings.GetBool("pvrmenu.infoswitch"))
+ if (CSettings::Get().GetBool("pvrmenu.infoswitch"))
{
- int iTimeout = g_guiSettings.GetBool("pvrmenu.infotimeout") ? g_guiSettings.GetInt("pvrmenu.infotime") : 0;
+ int iTimeout = CSettings::Get().GetBool("pvrmenu.infotimeout") ? CSettings::Get().GetInt("pvrmenu.infotime") : 0;
g_PVRManager.ShowPlayerInfo(iTimeout);
bReturn = true;
#include "DVDCodecs/DVDCodecs.h"
#include "DVDCodecs/DVDFactoryCodec.h"
#include "DVDPerformanceCounter.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "video/VideoReferenceClock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
bool CDVDPlayerAudio::OpenStream( CDVDStreamInfo &hints )
{
- bool passthrough = AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode"));
+ bool passthrough = AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode"));
CLog::Log(LOGNOTICE, "Finding audio codec for: %i", hints.codec);
CDVDAudioCodec* codec = CDVDFactoryCodec::CreateAudioCodec(hints, passthrough);
m_synctype = SYNC_DISCON;
m_setsynctype = SYNC_DISCON;
- if (g_guiSettings.GetBool("videoplayer.usedisplayasclock"))
- m_setsynctype = g_guiSettings.GetInt("videoplayer.synctype");
+ if (CSettings::Get().GetBool("videoplayer.usedisplayasclock"))
+ m_setsynctype = CSettings::Get().GetInt("videoplayer.synctype");
m_prevsynctype = -1;
m_error = 0;
m_errortime = CurrentHostCounter();
m_silence = false;
- m_maxspeedadjust = g_guiSettings.GetFloat("videoplayer.maxspeedadjust");
+ m_maxspeedadjust = CSettings::Get().GetNumber("videoplayer.maxspeedadjust");
}
void CDVDPlayerAudio::CloseStream(bool bWaitForBuffers)
bool CDVDPlayerAudio::SwitchCodecIfNeeded()
{
// check if passthrough is disabled
- if (!AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")))
+ if (!AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode")))
return false;
CLog::Log(LOGDEBUG, "CDVDPlayerAudio: Sample rate changed, checking for passthrough");
#include "cores/VideoRenderers/RenderFlags.h"
#include "windowing/WindowingFactory.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "video/VideoReferenceClock.h"
#include <iomanip>
#include <numeric>
#include <iterator>
+#include "guilib/GraphicContext.h"
#include "utils/log.h"
using namespace std;
return false;
}
- if(g_guiSettings.GetBool("videoplayer.usedisplayasclock") && !g_VideoReferenceClock.IsRunning())
+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && !g_VideoReferenceClock.IsRunning())
{
g_VideoReferenceClock.Create();
//we have to wait for the clock to start otherwise alsa can cause trouble
m_bFpsInvalid = (hint.fpsrate == 0 || hint.fpsscale == 0);
- m_bCalcFrameRate = g_guiSettings.GetBool("videoplayer.usedisplayasclock") ||
- g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF;
+ m_bCalcFrameRate = CSettings::Get().GetBool("videoplayer.usedisplayasclock") ||
+ CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF;
ResetFrameRateCalc();
m_iDroppedRequest = 0;
#include "DVDSubtitlesLibass.h"
#include "DVDClock.h"
#include "filesystem/SpecialProtocol.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
#include "threads/Atomics.h"
//Setting default font to the Arial in \media\fonts (used if FontConfig fails)
strPath = "special://xbmc/media/Fonts/";
- strPath += g_guiSettings.GetString("subtitles.font");
- int fc = !g_guiSettings.GetBool("subtitles.overrideassfonts");
+ strPath += CSettings::Get().GetString("subtitles.font");
+ int fc = !CSettings::Get().GetBool("subtitles.overrideassfonts");
m_dll.ass_set_margins(m_renderer, 0, 0, 0, 0);
m_dll.ass_set_use_margins(m_renderer, 0);
#include "linux/XMemUtils.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "cores/AudioEngine/Utils/AEConvert.h"
const float* coeff = downmixing_coefficients_8;
// normally we normalalise the levels, can be skipped (boosted) at risk of distortion
- if(!g_guiSettings.GetBool("audiooutput.normalizelevels"))
+ if(!CSettings::Get().GetBool("audiooutput.normalizelevels"))
{
double sum_L = 0;
double sum_R = 0;
#include <sys/time.h>
#include <inttypes.h>
#include "guilib/GraphicContext.h"
-#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/DisplaySettings.h"
+#include "settings/Settings.h"
#ifdef CLASSNAME
#undef CLASSNAME
#include "guilib/GUIWindowManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "windowing/WindowingFactory.h"
PREDICATE_RETURN(lh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream
, rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream);
- if(!g_guiSettings.GetString("locale.audiolanguage").Equals("original"))
+ if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.audiolanguage"), "original"))
{
CStdString audio_language = g_langInfo.GetAudioLanguage();
PREDICATE_RETURN(audio_language.Equals(lh.language.c_str())
, rh.type_index == CMediaSettings::Get().GetCurrentVideoSettings().m_SubtitleStream);
CStdString subtitle_language = g_langInfo.GetSubtitleLanguage();
- if(!g_guiSettings.GetString("locale.subtitlelanguage").Equals("original"))
+ if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.subtitlelanguage"), "original"))
{
PREDICATE_RETURN((lh.source == STREAM_SOURCE_DEMUX_SUB || lh.source == STREAM_SOURCE_TEXT) && subtitle_language.Equals(lh.language.c_str())
, (rh.source == STREAM_SOURCE_DEMUX_SUB || rh.source == STREAM_SOURCE_TEXT) && subtitle_language.Equals(rh.language.c_str()));
PREDICATE_RETURN(lh.source == STREAM_SOURCE_TEXT
, rh.source == STREAM_SOURCE_TEXT);
- if(!g_guiSettings.GetString("locale.subtitlelanguage").Equals("original"))
+ if(!StringUtils::EqualsNoCase(CSettings::Get().GetString("locale.subtitlelanguage"), "original"))
{
PREDICATE_RETURN(subtitle_language.Equals(lh.language.c_str())
, subtitle_language.Equals(rh.language.c_str()));
{
return false;
}
- if(g_guiSettings.GetBool("videoplayer.adjustrefreshrate"))
+ if(CSettings::Get().GetBool("videoplayer.adjustrefreshrate"))
m_av_clock.HDMIClockSync();
m_playSpeed = DVD_PLAYSPEED_NORMAL;
if (filename.Left(7) == "http://" && filename.Right(5) == ".m3u8")
{
// get the available bandwidth (as per user settings)
- int maxrate = g_guiSettings.GetInt("network.bandwidth");
+ int maxrate = CSettings::Get().GetInt("network.bandwidth");
if(maxrate <= 0)
maxrate = INT_MAX;
if(input)
{
bool bSwitchSuccessful(false);
- bool bShowPreview(g_guiSettings.GetInt("pvrplayback.channelentrytimeout") > 0);
+ bool bShowPreview(CSettings::Get().GetInt("pvrplayback.channelentrytimeout") > 0);
if (!bShowPreview)
{
if (bShowPreview)
{
UpdateApplication(0);
- m_iChannelEntryTimeOut = XbmcThreads::SystemClockMillis() + g_guiSettings.GetInt("pvrplayback.channelentrytimeout");
+ m_iChannelEntryTimeOut = XbmcThreads::SystemClockMillis() + CSettings::Get().GetInt("pvrplayback.channelentrytimeout");
}
else
{
m_player_video.SendMessage(new CDVDMsg(CDVDMsg::PLAYER_STARTED), 1);
if (state == CACHESTATE_PVR)
- m_pInputStream->ResetScanTimeout((unsigned int) g_guiSettings.GetInt("pvrplayback.scantime") * 1000);
+ m_pInputStream->ResetScanTimeout((unsigned int) CSettings::Get().GetInt("pvrplayback.scantime") * 1000);
}
if(state == CACHESTATE_PLAY
{
bool bReturn(false);
- if (g_guiSettings.GetBool("pvrmenu.infoswitch"))
+ if (CSettings::Get().GetBool("pvrmenu.infoswitch"))
{
- int iTimeout = g_guiSettings.GetBool("pvrmenu.infotimeout") ? g_guiSettings.GetInt("pvrmenu.infotime") : 0;
+ int iTimeout = CSettings::Get().GetBool("pvrmenu.infotimeout") ? CSettings::Get().GetInt("pvrmenu.infotime") : 0;
g_PVRManager.ShowPlayerInfo(iTimeout);
bReturn = true;
#include "linux/XMemUtils.h"
#include "utils/BitstreamStats.h"
-#include "settings/GUISettings.h"
-#include "settings/Settings.h"
#include "DVDDemuxers/DVDDemuxUtils.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
#include "utils/MathUtils.h"
#include "settings/AdvancedSettings.h"
#include "settings/Settings.h"
m_nChannels = 0;
m_synctype = SYNC_DISCON;
m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
- m_use_passthrough = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI) ? true : false ;
+ m_use_passthrough = (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI) ? true : false ;
m_use_hw_decode = g_advancedSettings.m_omxHWAudioDecode;
}
/* check our audio capabilties */
/* pathrought is overriding hw decode*/
- if(AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")) && m_use_passthrough)
+ if(AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode")) && m_use_passthrough)
{
- if(hints.codec == CODEC_ID_AC3 && g_guiSettings.GetBool("audiooutput.ac3passthrough") && hdmi_passthrough_ac3)
+ if(hints.codec == CODEC_ID_AC3 && CSettings::Get().GetBool("audiooutput.ac3passthrough") && hdmi_passthrough_ac3)
{
dataFormat = AE_FMT_AC3;
m_passthrough = true;
}
- if(hints.codec == CODEC_ID_DTS && g_guiSettings.GetBool("audiooutput.dtspassthrough") && hdmi_passthrough_dts)
+ if(hints.codec == CODEC_ID_DTS && CSettings::Get().GetBool("audiooutput.dtspassthrough") && hdmi_passthrough_dts)
{
dataFormat = AE_FMT_DTS;
m_passthrough = true;
std::string device = "";
- if(g_guiSettings.GetInt("audiooutput.mode") == AUDIO_HDMI)
+ if(CSettings::Get().GetInt("audiooutput.mode") == AUDIO_HDMI)
device = "hdmi";
else
device = "local";
#include "windowing/WindowingFactory.h"
#include "DVDOverlayRenderer.h"
#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
#include "settings/Settings.h"
#include "settings/MediaSettings.h"
#include "cores/VideoRenderers/RenderFormats.h"
m_hints = hints;
m_Deinterlace = ( CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode == VS_DEINTERLACEMODE_OFF ) ? false : true;
- m_hdmi_clock_sync = (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF);
+ m_hdmi_clock_sync = (CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF);
m_started = false;
m_flush = false;
m_stalled = m_messageQueue.GetPacketCount(CDVDMsg::DEMUXER_PACKET) == 0;
#include "settings/Settings.h"
#include "utils/BitstreamConverter.h"
-
#include <sys/time.h>
#include <inttypes.h>
#include "AudioDecoder.h"
#include "CodecFactory.h"
-#include "settings/GUISettings.h"
+#include "Application.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "music/tags/MusicInfoTag.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include <math.h>
-ReplayGainSettings CAudioDecoder::m_replayGainSettings;
-
CAudioDecoder::CAudioDecoder()
{
m_codec = NULL;
m_eof = false;
// get correct cache size
- unsigned int filecache = g_guiSettings.GetInt("cacheaudio.internet");
+ unsigned int filecache = CSettings::Get().GetInt("cacheaudio.internet");
if ( file.IsHD() )
- filecache = g_guiSettings.GetInt("cache.harddisk");
+ filecache = CSettings::Get().GetInt("cache.harddisk");
else if ( file.IsOnDVD() )
- filecache = g_guiSettings.GetInt("cacheaudio.dvdrom");
+ filecache = CSettings::Get().GetInt("cacheaudio.dvdrom");
else if ( file.IsOnLAN() )
- filecache = g_guiSettings.GetInt("cacheaudio.lan");
+ filecache = CSettings::Get().GetInt("cacheaudio.lan");
// create our codec
m_codec=CodecFactory::CreateCodecDemux(file.GetPath(), file.GetMimeType(), filecache * 1024);
float CAudioDecoder::GetReplayGain()
{
#define REPLAY_GAIN_DEFAULT_LEVEL 89.0f
- if (m_replayGainSettings.iType == REPLAY_GAIN_NONE)
+ const ReplayGainSettings &replayGainSettings = g_application.GetReplayGainSettings();
+ if (replayGainSettings.iType == REPLAY_GAIN_NONE)
return 1.0f;
// Compute amount of gain
- float replaydB = (float)m_replayGainSettings.iNoGainPreAmp;
+ float replaydB = (float)replayGainSettings.iNoGainPreAmp;
float peak = 0.0f;
- if (m_replayGainSettings.iType == REPLAY_GAIN_ALBUM)
+ if (replayGainSettings.iType == REPLAY_GAIN_ALBUM)
{
if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_ALBUM_INFO)
{
- replaydB = (float)m_replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainAlbumGain() * 0.01f;
+ replaydB = (float)replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainAlbumGain() * 0.01f;
peak = m_codec->m_tag.GetReplayGainAlbumPeak();
}
else if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_TRACK_INFO)
{
- replaydB = (float)m_replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainTrackGain() * 0.01f;
+ replaydB = (float)replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainTrackGain() * 0.01f;
peak = m_codec->m_tag.GetReplayGainTrackPeak();
}
}
- else if (m_replayGainSettings.iType == REPLAY_GAIN_TRACK)
+ else if (replayGainSettings.iType == REPLAY_GAIN_TRACK)
{
if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_TRACK_INFO)
{
- replaydB = (float)m_replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainTrackGain() * 0.01f;
+ replaydB = (float)replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainTrackGain() * 0.01f;
peak = m_codec->m_tag.GetReplayGainTrackPeak();
}
else if (m_codec->m_tag.HasReplayGainInfo() & REPLAY_GAIN_HAS_ALBUM_INFO)
{
- replaydB = (float)m_replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainAlbumGain() * 0.01f;
+ replaydB = (float)replayGainSettings.iPreAmp + (float)m_codec->m_tag.GetReplayGainAlbumGain() * 0.01f;
peak = m_codec->m_tag.GetReplayGainAlbumPeak();
}
}
// convert to a gain type
float replaygain = pow(10.0f, (replaydB - REPLAY_GAIN_DEFAULT_LEVEL)* 0.05f);
// check peaks
- if (m_replayGainSettings.bAvoidClipping)
+ if (replayGainSettings.bAvoidClipping)
{
if (fabs(peak * replaygain) > 1.0f)
replaygain = 1.0f / fabs(peak);
#define RET_SUCCESS 0
#define RET_SLEEP 1
-// replay gain settings struct for quick access by the player multiple
-// times per second (saves doing settings lookup)
-struct ReplayGainSettings
-{
- int iPreAmp;
- int iNoGainPreAmp;
- int iType;
- bool bAvoidClipping;
-};
-
class CAudioDecoder
{
public:
CAudioDecoder();
~CAudioDecoder();
- static ReplayGainSettings& GetReplayGainSettings() { return m_replayGainSettings; }
-
bool Create(const CFileItem &file, int64_t seekOffset);
void Destroy();
float GetReplayGain();
private:
- static ReplayGainSettings m_replayGainSettings;
-
// pcm buffer
CRingBuffer m_pcmBuffer;
#include "cores/dvdplayer/DVDStreamInfo.h"
#include "cores/dvdplayer/DVDCodecs/DVDFactoryCodec.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "URL.h"
#include "AudioDecoder.h"
CDVDStreamInfo hint(*pStream, true);
- bool passthrough = AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode"));
+ bool passthrough = AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode"));
m_pAudioCodec = CDVDFactoryCodec::CreateAudioCodec(hint, passthrough);
if (!m_pAudioCodec)
{
#include "CodecFactory.h"
#include "FileItem.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/Settings.h"
#include "music/tags/MusicInfoTag.h"
#include "utils/TimeUtils.h"
bool PAPlayer::OpenFile(const CFileItem& file, const CPlayerOptions &options)
{
- m_defaultCrossfadeMS = g_guiSettings.GetInt("musicplayer.crossfade") * 1000;
+ m_defaultCrossfadeMS = CSettings::Get().GetInt("musicplayer.crossfade") * 1000;
if (m_streams.size() > 1 || !m_defaultCrossfadeMS || m_isPaused)
{
void PAPlayer::UpdateCrossfadeTime(const CFileItem& file)
{
- m_upcomingCrossfadeMS = m_defaultCrossfadeMS = g_guiSettings.GetInt("musicplayer.crossfade") * 1000;
+ m_upcomingCrossfadeMS = m_defaultCrossfadeMS = CSettings::Get().GetInt("musicplayer.crossfade") * 1000;
if (m_upcomingCrossfadeMS)
{
if (m_streams.size() == 0 ||
(
- file.HasMusicInfoTag() && !g_guiSettings.GetBool("musicplayer.crossfadealbumtracks") &&
+ file.HasMusicInfoTag() && !CSettings::Get().GetBool("musicplayer.crossfadealbumtracks") &&
m_FileItem->HasMusicInfoTag() &&
(m_FileItem->GetMusicInfoTag()->GetAlbum() != "") &&
(m_FileItem->GetMusicInfoTag()->GetAlbum() == file.GetMusicInfoTag()->GetAlbum()) &&
#include "utils/BitstreamStats.h"
#include "PlayerCoreFactory.h"
#include "threads/SingleLock.h"
+#include "cores/AudioEngine/Utils/AEUtil.h"
#include "cores/dvdplayer/DVDPlayer.h"
#include "cores/paplayer/PAPlayer.h"
#include "cores/paplayer/DVDPlayerCodec.h"
#include "dialogs/GUIDialogContextMenu.h"
#include "utils/HttpHeader.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "URL.h"
#include "FileItem.h"
#include "profiles/ProfilesManager.h"
IPlayer* CPlayerCoreFactory::CreatePlayer(const CStdString& strCore, IPlayerCallback& callback) const
{
- return CreatePlayer( GetPlayerCore(strCore), callback );
+ return CreatePlayer(GetPlayerCore(strCore), callback );
}
IPlayer* CPlayerCoreFactory::CreatePlayer(const PLAYERCOREID eCore, IPlayerCallback& callback) const
if (bAdd)
{
- if( g_guiSettings.GetInt("audiooutput.mode") == AUDIO_ANALOG )
+ if( CSettings::Get().GetInt("audiooutput.mode") == AUDIO_ANALOG )
{
CLog::Log(LOGDEBUG, "CPlayerCoreFactory::GetPlayers: adding PAPlayer (%d)", EPC_PAPLAYER);
vecCores.push_back(EPC_PAPLAYER);
bool CPlayerCoreFactory::LoadConfiguration(const std::string &file, bool clear)
{
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
*
*/
-#include "system.h"
+#include <vector>
+#include "system.h"
#include "cores/IPlayerCallback.h"
#include "settings/ISettingsHandler.h"
#include "threads/CriticalSection.h"
#include "utils/StdString.h"
-#include <vector>
-
/*----------------------------------------------------------------------
| forward references
+---------------------------------------------------------------------*/
#include "PlayerSelectionRule.h"
#include "video/VideoInfoTag.h"
#include "utils/StreamDetails.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/RegExp.h"
#include "utils/XBMCTinyXML.h"
m_bStreamDetails = m_audioCodec.length() > 0 || m_audioChannels.length() > 0 ||
m_videoCodec.length() > 0 || m_videoResolution.length() > 0 || m_videoAspect.length() > 0;
- if (m_bStreamDetails && !g_guiSettings.GetBool("myvideos.extractflags"))
+ if (m_bStreamDetails && !CSettings::Get().GetBool("myvideos.extractflags"))
{
CLog::Log(LOGWARNING, "CPlayerSelectionRule::Initialize: rule: %s needs media flagging, which is disabled", m_name.c_str());
}
#include "GUIPassword.h"
#include "Util.h"
#include "utils/URIUtils.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "GUIDialogMediaSource.h"
#include "profiles/ProfilesManager.h"
#include "profiles/dialogs/GUIDialogLockSettings.h"
#include "addons/AddonManager.h"
#include "FileItem.h"
#include "filesystem/File.h"
-#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
#include "video/windows/GUIWindowVideoBase.h"
buttons.Add(CONTEXT_BUTTON_REMOVE_LOCK, 12335);
bool maxRetryExceeded = false;
- if (g_guiSettings.GetInt("masterlock.maxretries") != 0)
- maxRetryExceeded = (share->m_iBadPwdCount >= g_guiSettings.GetInt("masterlock.maxretries"));
+ if (CSettings::Get().GetInt("masterlock.maxretries") != 0)
+ maxRetryExceeded = (share->m_iBadPwdCount >= CSettings::Get().GetInt("masterlock.maxretries"));
if (maxRetryExceeded)
buttons.Add(CONTEXT_BUTTON_RESET_LOCK, 12334);
case CONTEXT_BUTTON_REACTIVATE_LOCK:
{
bool maxRetryExceeded = false;
- if (g_guiSettings.GetInt("masterlock.maxretries") != 0)
- maxRetryExceeded = (share->m_iBadPwdCount >= g_guiSettings.GetInt("masterlock.maxretries"));
+ if (CSettings::Get().GetInt("masterlock.maxretries") != 0)
+ maxRetryExceeded = (share->m_iBadPwdCount >= CSettings::Get().GetInt("masterlock.maxretries"));
if (!maxRetryExceeded)
{
// don't prompt user for mastercode when reactivating a lock
#include "filesystem/MultiPathDirectory.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
#include "filesystem/PVRDirectory.h"
#include "GUIDialogYesNo.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "PasswordManager.h"
#include "URL.h"
share1.strName = "SAP Streams";
extraShares.push_back(share1);
- if (g_guiSettings.GetString("audiocds.recordingpath",false) != "")
+ if (CSettings::Get().GetString("audiocds.recordingpath") != "")
{
share1.strPath = "special://recordings/";
share1.strName = g_localizeStrings.Get(21883);
extraShares.push_back(share1);
}
-
}
else if (m_type == "video")
{
#endif
share1.m_ignore = true;
- if (g_guiSettings.GetString("debug.screenshotpath",false)!= "")
+ if (CSettings::Get().GetString("debug.screenshotpath") != "")
{
share1.strPath = "special://screenshots/";
share1.strName = g_localizeStrings.Get(20008);
#include "GUIInfoManager.h"
#include "utils/TimeUtils.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
#include "utils/SeekHandler.h"
#define SEEK_BAR_DISPLAY_TIME 2000L
#include "GUIDialogSmartPlaylistEditor.h"
#include "guilib/GUIKeyboardFactory.h"
#include "Util.h"
+#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
#include "GUIDialogSmartPlaylistRule.h"
#include "guilib/GUIWindowManager.h"
#include "filesystem/File.h"
#include "profiles/ProfilesManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
CStdString path;
if (CGUIKeyboardFactory::ShowAndGetInput(filename, g_localizeStrings.Get(16013), false))
{
- path = URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"),m_playlist.GetSaveLocation());
+ path = URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"),m_playlist.GetSaveLocation());
path = URIUtils::AddFileToFolder(path, CUtil::MakeLegalFileName(filename));
}
else
{
// check if we need to actually change the save location for this playlist
// this occurs if the user switches from music video <> songs <> mixed
- if (m_path.Left(g_guiSettings.GetString("system.playlistspath").size()).Equals(g_guiSettings.GetString("system.playlistspath"))) // fugly, well aware
+ if (StringUtils::EqualsNoCase(m_path.Left(CSettings::Get().GetString("system.playlistspath").size()), CSettings::Get().GetString("system.playlistspath"))) // fugly, well aware
{
CStdString filename = URIUtils::GetFileName(m_path);
- CStdString strFolder = m_path.Mid(g_guiSettings.GetString("system.playlistspath").size(),m_path.size()-filename.size()-g_guiSettings.GetString("system.playlistspath").size()-1);
+ CStdString strFolder = m_path.Mid(CSettings::Get().GetString("system.playlistspath").size(),m_path.size()-filename.size()-CSettings::Get().GetString("system.playlistspath").size()-1);
if (strFolder != m_playlist.GetSaveLocation())
{ // move to the correct folder
XFILE::CFile::Delete(m_path);
- m_path = URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"),m_playlist.GetSaveLocation());
+ m_path = URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"),m_playlist.GetSaveLocation());
m_path = URIUtils::AddFileToFolder(m_path, filename);
}
}
#include "guilib/LocalizeStrings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
if (!m_lastScanTime.IsValid())
{
- if (!g_guiSettings.GetBool("epg.ignoredbforclient"))
+ if (!CSettings::Get().GetBool("epg.ignoredbforclient"))
{
CEpgDatabase *database = g_EpgContainer.GetDatabase();
CDateTime dtReturn; dtReturn.SetValid(false);
bool CEpg::Persist(void)
{
- if (g_guiSettings.GetBool("epg.ignoredbforclient") || !NeedsSave())
+ if (CSettings::Get().GetBool("epg.ignoredbforclient") || !NeedsSave())
return true;
#if EPG_DEBUGGING
{
CEpg tmpEpg(channel);
if (tmpEpg.UpdateFromScraper(start, end))
- bReturn = UpdateEntries(tmpEpg, !g_guiSettings.GetBool("epg.ignoredbforclient"));
+ bReturn = UpdateEntries(tmpEpg, !CSettings::Get().GetBool("epg.ignoredbforclient"));
}
else
{
CEpg tmpEpg(m_iEpgID, m_strName, m_strScraperName);
if (tmpEpg.UpdateFromScraper(start, end))
- bReturn = UpdateEntries(tmpEpg, !g_guiSettings.GetBool("epg.ignoredbforclient"));
+ bReturn = UpdateEntries(tmpEpg, !CSettings::Get().GetBool("epg.ignoredbforclient"));
}
return bReturn;
#include "Application.h"
#include "threads/SingleLock.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "dialogs/GUIDialogExtendedProgressBar.h"
#include "dialogs/GUIDialogProgress.h"
#include "guilib/GUIWindowManager.h"
m_bIsInitialising = true;
m_bStop = false;
- g_guiSettings.RegisterObserver(this);
LoadSettings();
m_iNextEpgUpdate = 0;
void CEpgContainer::Notify(const Observable &obs, const ObservableMessage msg)
{
- /* settings were updated */
- if (msg == ObservableMessageGuiSettings)
+ SetChanged();
+ NotifyObservers(msg);
+}
+
+void CEpgContainer::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "epg.ignoredbforclient" || settingId == "epg.epgupdate" ||
+ settingId == "epg.daystodisplay")
LoadSettings();
- else
- {
- SetChanged();
- NotifyObservers(msg);
- }
}
void CEpgContainer::LoadFromDB(void)
Sleep(1000);
}
-
- g_guiSettings.UnregisterObserver(this);
}
CEpg *CEpgContainer::GetById(int iEpgId) const
bool CEpgContainer::LoadSettings(void)
{
- m_bIgnoreDbForClient = g_guiSettings.GetBool("epg.ignoredbforclient");
- m_iUpdateTime = g_guiSettings.GetInt ("epg.epgupdate") * 60;
- m_iDisplayTime = g_guiSettings.GetInt ("epg.daystodisplay") * 24 * 60 * 60;
+ m_bIgnoreDbForClient = CSettings::Get().GetBool("epg.ignoredbforclient");
+ m_iUpdateTime = CSettings::Get().GetInt ("epg.epgupdate") * 60;
+ m_iDisplayTime = CSettings::Get().GetInt ("epg.daystodisplay") * 24 * 60 * 60;
return true;
}
lock.Leave();
return bReturn ||
- (g_guiSettings.GetBool("epg.preventupdateswhileplayingtv") &&
+ (CSettings::Get().GetBool("epg.preventupdateswhileplayingtv") &&
g_PVRManager.IsStarted() &&
g_PVRManager.IsPlaying());
}
*/
#include "XBDateTime.h"
+#include "settings/ISettingCallback.h"
#include "threads/CriticalSection.h"
#include "threads/Thread.h"
#include "utils/Observer.h"
#define g_EpgContainer CEpgContainer::Get()
class CEpgContainer : public Observer,
- public Observable,
- private CThread
+ public Observable,
+ public ISettingCallback,
+ private CThread
{
friend class CEpgDatabase;
*/
virtual void Notify(const Observable &obs, const ObservableMessage msg);
+ virtual void OnSettingChanged(const CSetting *setting);
+
CEpg *CreateChannelEpg(PVR::CPVRChannelPtr channel);
/*!
#include "pvr/timers/PVRTimers.h"
#include "pvr/PVRManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/Variant.h"
#include "addons/include/xbmc_pvr_types.h"
if (!bOverrideParental && bParentalLocked)
strTitle = g_localizeStrings.Get(19266); // parental locked
- else if (strTitle.empty() && !g_guiSettings.GetBool("epg.hidenoinfoavailable"))
+ else if (strTitle.empty() && !CSettings::Get().GetBool("epg.hidenoinfoavailable"))
strTitle = g_localizeStrings.Get(19055); // no information available
return strTitle;
#include "AFPDirectory.h"
#include "Util.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
#include "Util.h"
#include "URL.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "File.h"
#include <map>
else if( strProtocol.Equals("http")
|| strProtocol.Equals("https"))
{
- if (g_guiSettings.GetBool("network.usehttpproxy")
- && !g_guiSettings.GetString("network.httpproxyserver").empty()
- && !g_guiSettings.GetString("network.httpproxyport").empty()
+ if (CSettings::Get().GetBool("network.usehttpproxy")
+ && !CSettings::Get().GetString("network.httpproxyserver").empty()
+ && !CSettings::Get().GetString("network.httpproxyport").empty()
&& m_proxy.IsEmpty())
{
- m_proxy = g_guiSettings.GetString("network.httpproxyserver");
- m_proxy += ":" + g_guiSettings.GetString("network.httpproxyport");
- if (g_guiSettings.GetString("network.httpproxyusername").length() > 0 && m_proxyuserpass.IsEmpty())
+ m_proxy = CSettings::Get().GetString("network.httpproxyserver");
+ m_proxy += ":" + CSettings::Get().GetString("network.httpproxyport");
+ if (CSettings::Get().GetString("network.httpproxyusername").length() > 0 && m_proxyuserpass.IsEmpty())
{
- m_proxyuserpass = g_guiSettings.GetString("network.httpproxyusername");
- m_proxyuserpass += ":" + g_guiSettings.GetString("network.httpproxypassword");
+ m_proxyuserpass = CSettings::Get().GetString("network.httpproxyusername");
+ m_proxyuserpass += ":" + CSettings::Get().GetString("network.httpproxypassword");
}
- m_proxytype = (ProxyType)g_guiSettings.GetInt("network.httpproxytype");
+ m_proxytype = (ProxyType)CSettings::Get().GetInt("network.httpproxytype");
CLog::Log(LOGDEBUG, "Using proxy %s, type %d", m_proxy.c_str(), proxyType2CUrlProxyType[m_proxytype]);
}
#include "commons/Exception.h"
#include "FileItem.h"
#include "DirectoryCache.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/Job.h"
#include "utils/JobManager.h"
// TODO: we shouldn't be checking the gui setting here;
// callers should use getHidden instead
if ((!item->m_bIsFolder && !pDirectory->IsAllowed(item->GetPath())) ||
- (item->GetProperty("file:hidden").asBoolean() && !(hints.flags & DIR_FLAG_GET_HIDDEN) && !g_guiSettings.GetBool("filelists.showhidden")))
+ (item->GetProperty("file:hidden").asBoolean() && !(hints.flags & DIR_FLAG_GET_HIDDEN) && !CSettings::Get().GetBool("filelists.showhidden")))
{
items.Remove(i);
i--; // don't confuse loop
#include "HTSPDirectory.h"
#include "URL.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h"
#include "threads/SingleLock.h"
items.AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS("%K[ - %B]", "%Z", "%L", ""));
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B", "%Z", "%L", ""));
else
items.AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B", "%Z", "%L", ""));
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%Z", "%B", "%L", ""));
else
items.AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%Z", "%B", "%L", ""));
#include "DirectoryNodeArtist.h"
#include "QueryParams.h"
#include "music/MusicDatabase.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace XFILE::MUSICDATABASEDIRECTORY;
CQueryParams params;
CollectQueryParams(params);
- bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, !g_guiSettings.GetBool("musiclibrary.showcompilationartists"), params.GetGenreId());
+ bool bSuccess = musicdatabase.GetArtistsNav(BuildPath(), items, !CSettings::Get().GetBool("musiclibrary.showcompilationartists"), params.GetGenreId());
musicdatabase.Close();
#include "DllLibCMyth.h"
#include "video/VideoInfoTag.h"
#include "URL.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "utils/StringUtils.h"
#include "guilib/LocalizeStrings.h"
*/
if (type != TV_SHOWS)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%K", "%J"));
else
items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%K", "%J"));
}
m_dll->ref_release(list);
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"));
else
items.AddSortMethod(SORT_METHOD_LABEL, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"));
/*
* Video sort title is set to the channel number.
*/
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556 /* Title */, LABEL_MASKS("%K", "%B"));
else
items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556 /* Title */, LABEL_MASKS("%K", "%B"));
#include "threads/SingleLock.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogProgress.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "video/VideoInfoTag.h"
#include "guilib/LocalizeStrings.h"
case SORT_METHOD_LABEL:
case SORT_METHOD_LABEL_IGNORE_THE:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
dir->m_listItems->AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", label2Mask));
else
dir->m_listItems->AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", label2Mask));
case SORT_METHOD_TITLE:
case SORT_METHOD_TITLE_IGNORE_THE:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
dir->m_listItems->AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", label2Mask));
else
dir->m_listItems->AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T", label2Mask));
case SORT_METHOD_ARTIST:
case SORT_METHOD_ARTIST_IGNORE_THE:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
dir->m_listItems->AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%T", "%A"));
else
dir->m_listItems->AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%T", "%A"));
case SORT_METHOD_ALBUM:
case SORT_METHOD_ALBUM_IGNORE_THE:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
dir->m_listItems->AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%T", "%B"));
else
dir->m_listItems->AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%T", "%B"));
case SORT_METHOD_VIDEO_SORT_TITLE:
case SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", label2Mask));
else
dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", label2Mask));
case SORT_METHOD_STUDIO:
case SORT_METHOD_STUDIO_IGNORE_THE:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
dir->m_listItems->AddSortMethod(SORT_METHOD_STUDIO_IGNORE_THE, 572, LABEL_MASKS("%T", "%U"));
else
dir->m_listItems->AddSortMethod(SORT_METHOD_STUDIO, 572, LABEL_MASKS("%T", "%U"));
}
case SORT_METHOD_PLAYLIST_ORDER:
{
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
dir->m_listItems->AddSortMethod(SORT_METHOD_PLAYLIST_ORDER, 559, LABEL_MASKS(strTrackLeft, strTrackRight));
break;
#include "FileItem.h"
#include "CurlFile.h"
#include "settings/AdvancedSettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "utils/URIUtils.h"
#include "utils/XBMCTinyXML.h"
#include "utils/HTMLUtil.h"
#include "music/tags/MusicInfoTag.h"
#include "utils/log.h"
#include "URL.h"
-#include "settings/GUISettings.h"
#include "climits"
#include "threads/SingleLock.h"
else if(FindMime(resources, "image/"))
mime = "image/";
- int maxrate = g_guiSettings.GetInt("network.bandwidth");
+ int maxrate = CSettings::Get().GetInt("network.bandwidth");
if(maxrate == 0)
maxrate = INT_MAX;
#include "threads/SystemClock.h"
#include "system.h"
#include "ShoutcastFile.h"
-#include "settings/GUISettings.h"
#include "guilib/GUIWindowManager.h"
#include "URL.h"
#include "utils/RegExp.h"
#include "filesystem/File.h"
#include "music/MusicDatabase.h"
#include "playlists/SmartPlayList.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/URIUtils.h"
sorting.limitEnd = playlist.GetLimit();
sorting.sortBy = playlist.GetOrder();
sorting.sortOrder = playlist.GetOrderAscending() ? SortOrderAscending : SortOrderDescending;
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
sorting.sortAttributes = SortAttributeIgnoreArticle;
std::string option = !filter ? "xsp" : "filter";
#include "Util.h"
#include <libsmbclient.h>
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "utils/StringUtils.h"
#include "utils/TimeUtils.h"
#include "commons/Exception.h"
// set wins server if there's one. name resolve order defaults to 'lmhosts host wins bcast'.
// if no WINS server has been specified the wins method will be ignored.
- if ( g_guiSettings.GetString("smb.winsserver").length() > 0 && !g_guiSettings.GetString("smb.winsserver").Equals("0.0.0.0") )
+ if (CSettings::Get().GetString("smb.winsserver").length() > 0 && !StringUtils::EqualsNoCase(CSettings::Get().GetString("smb.winsserver"), "0.0.0.0") )
{
- fprintf(f, "\twins server = %s\n", g_guiSettings.GetString("smb.winsserver").c_str());
+ fprintf(f, "\twins server = %s\n", CSettings::Get().GetString("smb.winsserver").c_str());
fprintf(f, "\tname resolve order = bcast wins host\n");
}
else
fprintf(f, "\tdos charset = %s\n", g_advancedSettings.m_sambadoscodepage.c_str());
// if no workgroup string is specified, samba will use the default value 'WORKGROUP'
- if ( g_guiSettings.GetString("smb.workgroup").length() > 0 )
- fprintf(f, "\tworkgroup = %s\n", g_guiSettings.GetString("smb.workgroup").c_str());
+ if ( CSettings::Get().GetString("smb.workgroup").length() > 0 )
+ fprintf(f, "\tworkgroup = %s\n", CSettings::Get().GetString("smb.workgroup").c_str());
fclose(f);
}
}
#ifdef TARGET_WINDOWS
// if a wins-server is set, we have to change name resolve order to
- if ( g_guiSettings.GetString("smb.winsserver").length() > 0 && !g_guiSettings.GetString("smb.winsserver").Equals("0.0.0.0") )
+ if ( CSettings::Get().GetString("smb.winsserver").length() > 0 && !CSettings::Get().GetString("smb.winsserver").Equals("0.0.0.0") )
{
- lp_do_parameter( -1, "wins server", g_guiSettings.GetString("smb.winsserver").c_str());
+ lp_do_parameter( -1, "wins server", CSettings::Get().GetString("smb.winsserver").c_str());
lp_do_parameter( -1, "name resolve order", "bcast wins host");
}
else
#include "guilib/GraphicContext.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
RootDir = FullFileName;
if (RootDir.Equals("subtitles"))
- URIUtils::AddFileToFolder(g_guiSettings.GetString("subtitles.custompath"), FileName, translatedPath);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("subtitles.custompath"), FileName, translatedPath);
else if (RootDir.Equals("userdata"))
URIUtils::AddFileToFolder(CProfilesManager::Get().GetUserDataFolder(), FileName, translatedPath);
else if (RootDir.Equals("database"))
else if (RootDir.Equals("thumbnails"))
URIUtils::AddFileToFolder(CProfilesManager::Get().GetThumbnailsFolder(), FileName, translatedPath);
else if (RootDir.Equals("recordings") || RootDir.Equals("cdrips"))
- URIUtils::AddFileToFolder(g_guiSettings.GetString("audiocds.recordingpath", false), FileName, translatedPath);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("audiocds.recordingpath"), FileName, translatedPath);
else if (RootDir.Equals("screenshots"))
- URIUtils::AddFileToFolder(g_guiSettings.GetString("debug.screenshotpath", false), FileName, translatedPath);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("debug.screenshotpath"), FileName, translatedPath);
else if (RootDir.Equals("musicplaylists"))
URIUtils::AddFileToFolder(CUtil::MusicPlaylistsLocation(), FileName, translatedPath);
else if (RootDir.Equals("videoplaylists"))
#include "guilib/TextureManager.h"
#include "File.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/Crc32.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
case NODE_TYPE_TITLE_MOVIES:
if (strDirectory.Equals("videodb://movies/titles/"))
{
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
return "DefaultMovies.png";
return "DefaultMovieTitle.png";
}
case NODE_TYPE_TITLE_TVSHOWS:
if (strDirectory.Equals("videodb://tvshows/titles/"))
{
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
return "DefaultTVShows.png";
return "DefaultTVShowTitle.png";
}
case NODE_TYPE_TITLE_MUSICVIDEOS:
if (strDirectory.Equals("videodb://musicvideos/titles/"))
{
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
return "DefaultMusicVideos.png";
return "DefaultMusicVideoTitle.png";
}
#include "video/VideoDatabase.h"
#include "DirectoryNodeOverview.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "video/VideoDbUrl.h"
vector<pair<const char*, int> > vec;
if (hasMovies)
{
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
vec.push_back(make_pair("movies/titles", 342));
else
vec.push_back(make_pair("movies", 342)); // Movies
}
if (hasTvShows)
{
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
vec.push_back(make_pair("tvshows/titles", 20343));
else
vec.push_back(make_pair("tvshows", 20343)); // TV Shows
}
if (hasMusicVideos)
{
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
vec.push_back(make_pair("musicvideos/titles", 20389));
else
vec.push_back(make_pair("musicvideos", 20389)); // Music Videos
#include "QueryParams.h"
#include "video/VideoDatabase.h"
#include "video/VideoDbUrl.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "utils/Variant.h"
CQueryParams params;
CollectQueryParams(params);
- int iFlatten = g_guiSettings.GetInt("videolibrary.flattentvshows");
+ int iFlatten = CSettings::Get().GetInt("videolibrary.flattentvshows");
bool bSuccess=videodatabase.GetSeasonsNav(BuildPath(), items, params.GetActorId(), params.GetDirectorId(), params.GetGenreId(), params.GetYear(), params.GetTvShowId());
bool bFlatten = (items.GetObjectCount() == 1 && iFlatten == 1) || iFlatten == 2;
if (items.GetObjectCount() == 2 && iFlatten == 1)
if (items[0]->GetVideoInfoTag()->m_iSeason == 0 || items[1]->GetVideoInfoTag()->m_iSeason == 0)
bFlatten = true; // flatten if one season + specials
- if (iFlatten > 0 && !bFlatten && CMediaSettings::Get().GetWatchedMode("tvshows") == WatchedModeUnwatched)
+ if (iFlatten > 0 && !bFlatten && CMediaSettings::Get().GetWatchedMode("tvshows") == WatchedModeUnwatched)
{
int count = 0;
for(int i = 0; i < items.Size(); i++)
#include "filesystem/File.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "utils/XBMCTinyXML.h"
+#include "settings/Settings.h"
#include "test/TestUtils.h"
#include "gtest/gtest.h"
protected:
TestFileFactory()
{
- std::vector<CStdString> advancedsettings =
- CXBMCTestUtils::Instance().getAdvancedSettingsFiles();
- std::vector<CStdString> guisettings =
- CXBMCTestUtils::Instance().getGUISettingsFiles();
- std::vector<CStdString>::iterator it;
- for (it = advancedsettings.begin(); it < advancedsettings.end(); it++)
+ if (CSettings::Get().Initialize())
{
- g_advancedSettings.ParseSettingsFile(*it);
- }
- for (it = guisettings.begin(); it < guisettings.end(); it++)
- {
- CXBMCTinyXML xml(*it);
- g_guiSettings.LoadXML(xml.RootElement());
- }
+ std::vector<CStdString> advancedsettings =
+ CXBMCTestUtils::Instance().getAdvancedSettingsFiles();
+ std::vector<CStdString> guisettings =
+ CXBMCTestUtils::Instance().getGUISettingsFiles();
+
+ std::vector<CStdString>::iterator it;
+ for (it = guisettings.begin(); it < guisettings.end(); it++)
+ CSettings::Get().Load(*it);
+
+ for (it = advancedsettings.begin(); it < advancedsettings.end(); it++)
+ g_advancedSettings.ParseSettingsFile(*it);
+
+ CSettings::Get().SetLoaded();
+ }
}
~TestFileFactory()
{
g_advancedSettings.Clear();
- g_guiSettings.Clear();
+ CSettings::Get().Unload();
+ CSettings::Get().Uninitialize();
}
};
#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "filesystem/NFSFile.h"
-#include "settings/GUISettings.h"
#include "utils/URIUtils.h"
#include "FileItem.h"
#include "test/TestUtils.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
#include "utils/URIUtils.h"
#include "FileItem.h"
+#include "settings/Settings.h"
#include "test/TestUtils.h"
#include <errno.h>
/* Add default settings for locale.
* Settings here are taken from CGUISettings::Initialize()
*/
- CSettingsCategory *loc = g_guiSettings.AddCategory(7, "locale", 14090);
- g_guiSettings.AddString(loc, "locale.language",248,"english",
+ /* TODO
+ CSettingsCategory *loc = CSettings::Get().AddCategory(7, "locale", 14090);
+ CSettings::Get().AddString(loc, "locale.language",248,"english",
SPIN_CONTROL_TEXT);
- g_guiSettings.AddString(loc, "locale.country", 20026, "USA",
+ CSettings::Get().AddString(loc, "locale.country", 20026, "USA",
SPIN_CONTROL_TEXT);
- g_guiSettings.AddString(loc, "locale.charset", 14091, "DEFAULT",
+ CSettings::Get().AddString(loc, "locale.charset", 14091, "DEFAULT",
SPIN_CONTROL_TEXT); // charset is set by the
// language file
+ */
}
~TestZipFile()
{
- g_guiSettings.Clear();
+ CSettings::Get().Unload();
}
};
*/
#include "WINFileSMB.h"
#include "URL.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include <sys/stat.h>
#include <io.h>
int result = _chsize_s(fd, (long) size);
_close(fd);
return result;
-}
\ No newline at end of file
+}
#include "WINSMBDirectory.h"
#include "URL.h"
#include "utils/URIUtils.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "WIN32Util.h"
#include "utils/AutoPtrHandle.h"
#include "system.h"
#include "GUIAudioManager.h"
#include "Key.h"
-#include "settings/GUISettings.h"
#include "input/ButtonTranslator.h"
#include "threads/SingleLock.h"
#include "utils/URIUtils.h"
{
}
+void CGUIAudioManager::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "lookandfeel.soundskin")
+ {
+ Enable(true);
+ Load();
+ }
+}
+
void CGUIAudioManager::Initialize()
{
}
UnLoad();
- if (g_guiSettings.GetString("lookandfeel.soundskin")=="OFF")
+ if (CSettings::Get().GetString("lookandfeel.soundskin")=="OFF")
return true;
else
Enable(true);
- if (g_guiSettings.GetString("lookandfeel.soundskin")=="SKINDEFAULT")
+ if (CSettings::Get().GetString("lookandfeel.soundskin")=="SKINDEFAULT")
{
m_strMediaDir = URIUtils::AddFileToFolder(g_SkinInfo->Path(), "sounds");
}
else
- m_strMediaDir = URIUtils::AddFileToFolder("special://xbmc/sounds", g_guiSettings.GetString("lookandfeel.soundskin"));
+ m_strMediaDir = URIUtils::AddFileToFolder("special://xbmc/sounds", CSettings::Get().GetString("lookandfeel.soundskin"));
CStdString strSoundsXml = URIUtils::AddFileToFolder(m_strMediaDir, "sounds.xml");
void CGUIAudioManager::Enable(bool bEnable)
{
// always deinit audio when we don't want gui sounds
- if (g_guiSettings.GetString("lookandfeel.soundskin")=="OFF")
+ if (CSettings::Get().GetString("lookandfeel.soundskin")=="OFF")
bEnable = false;
CSingleLock lock(m_cs);
*
*/
+#include <map>
+
+#include "cores/AudioEngine/Interfaces/AESound.h"
+#include "settings/ISettingCallback.h"
#include "threads/CriticalSection.h"
#include "utils/log.h"
#include "utils/StdString.h"
-#include "cores/AudioEngine/Interfaces/AESound.h"
-
-#include <map>
// forward definitions
class CAction;
enum WINDOW_SOUND { SOUND_INIT = 0, SOUND_DEINIT };
-class CGUIAudioManager
+class CGUIAudioManager : public ISettingCallback
{
class CWindowSounds
{
CGUIAudioManager();
~CGUIAudioManager();
+ virtual void OnSettingChanged(const CSetting *setting);
+
void Initialize();
void DeInitialize();
*
*/
+#include "system.h"
#include "GUIControlFactory.h"
#include "LocalizeStrings.h"
#include "GUIButtonControl.h"
#include "utils/XMLUtils.h"
#include "GUIFontManager.h"
#include "GUIColorManager.h"
-#include "settings/Settings.h"
#include "utils/RssManager.h"
#include "utils/StringUtils.h"
#include "GUIAction.h"
+#include "utils/RssReader.h"
using namespace std;
using namespace EPG;
#include "GUIFont.h"
#include "utils/XMLUtils.h"
#include "GUIControlFactory.h"
+#include "filesystem/Directory.h"
#include "filesystem/File.h"
#include "filesystem/SpecialProtocol.h"
+#include "settings/Setting.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
#include "utils/StringUtils.h"
#include "windowing/WindowingFactory.h"
+#include "FileItem.h"
#include "URL.h"
+#include "Util.h"
using namespace std;
return false;
}
+
+void GUIFontManager::SettingOptionsFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ CFileItemList items;
+ CFileItemList items2;
+
+ // find TTF fonts
+ XFILE::CDirectory::GetDirectory("special://home/media/Fonts/", items2);
+
+ if (XFILE::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;
+
+ list.push_back(make_pair(pItem->GetLabel(), pItem->GetLabel()));
+ }
+ }
+ }
+}
class CGUIFontTTFBase;
class CXBMCTinyXML;
class TiXmlNode;
+class CSetting;
struct OrigFontInfo
{
void ReloadTTFFonts();
void UnloadTTFFonts();
+ static void SettingOptionsFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+
protected:
void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect) const;
void LoadFonts(const TiXmlNode* fontNode);
#include "utils/MathUtils.h"
#include "utils/log.h"
#include "windowing/WindowingFactory.h"
-#include "settings/GUISettings.h"
#include <math.h>
*/
#include "Application.h"
+#include "ApplicationMessenger.h"
#include "LocalizeStrings.h"
#include "GUIKeyboardFactory.h"
#include "dialogs/GUIDialogOK.h"
#include "GUIUserMessages.h"
#include "GUIWindowManager.h"
-#include "settings/GUISettings.h"
-#include "ApplicationMessenger.h"
+#include "settings/Settings.h"
#include "utils/md5.h"
if (1 > iRetries && strHeading.size())
strHeadingTemp = strHeading;
else
- strHeadingTemp.Format("%s - %i %s", g_localizeStrings.Get(12326).c_str(), g_guiSettings.GetInt("masterlock.maxretries") - iRetries, g_localizeStrings.Get(12343).c_str());
+ strHeadingTemp.Format("%s - %i %s", g_localizeStrings.Get(12326).c_str(), CSettings::Get().GetInt("masterlock.maxretries") - iRetries, g_localizeStrings.Get(12343).c_str());
CStdString strUserInput = "";
if (!ShowAndGetInput(strUserInput, strHeadingTemp, false, true, autoCloseMs)) //bool hiddenInput = false/true ? TODO: GUI Setting to enable disable this feature y/n?
*
*/
+#include "system.h"
#include "GUIListContainer.h"
#include "GUIListItem.h"
#include "Key.h"
*
*/
+#include "system.h"
#include "GUIListItemLayout.h"
#include "FileItem.h"
#include "GUIControlFactory.h"
#include "GUIRSSControl.h"
#include "GUIWindowManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "threads/CriticalSection.h"
#include "threads/SingleLock.h"
#include "utils/RssManager.h"
void CGUIRSSControl::Render()
{
// only render the control if they are enabled
- if (g_guiSettings.GetBool("lookandfeel.enablerssfeeds") && CRssManager::Get().IsActive())
+ if (CSettings::Get().GetBool("lookandfeel.enablerssfeeds") && CRssManager::Get().IsActive())
{
CSingleLock lock(m_criticalSection);
// Create RSS background/worker thread if needed
void CGUISpinControl::Clear()
{
- m_vecLabels.erase(m_vecLabels.begin(), m_vecLabels.end());
- m_vecValues.erase(m_vecValues.begin(), m_vecValues.end());
+ m_vecLabels.clear();
+ m_vecValues.clear();
+ m_vecStrValues.clear();
SetValue(0);
}
m_iEnd = iEnd;
}
-
void CGUISpinControl::SetFloatRange(float fStart, float fEnd)
{
m_fStart = fStart;
m_fValue = fValue;
}
+void CGUISpinControl::SetStringValue(const std::string& strValue)
+{
+ if (m_iType == SPIN_CONTROL_TYPE_TEXT)
+ {
+ m_iValue = 0;
+ for (unsigned int i = 0; i < m_vecStrValues.size(); i++)
+ if (strValue == m_vecStrValues[i])
+ m_iValue = i;
+ }
+
+ SetInvalid();
+}
+
int CGUISpinControl::GetValue() const
{
if (m_iType == SPIN_CONTROL_TYPE_TEXT)
return m_fValue;
}
+std::string CGUISpinControl::GetStringValue() const
+{
+ if (m_iType == SPIN_CONTROL_TYPE_TEXT && m_iValue >= 0 && m_iValue < (int)m_vecLabels.size())
+ {
+ if (m_iValue < (int)m_vecStrValues.size())
+ return m_vecStrValues[m_iValue];
+
+ return m_vecLabels[m_iValue];
+ }
+ return "";
+}
void CGUISpinControl::AddLabel(const string& strLabel, int iValue)
{
m_vecValues.push_back(iValue);
}
+void CGUISpinControl::AddLabel(const string& strLabel, const string& strValue)
+{
+ m_vecLabels.push_back(strLabel);
+ m_vecStrValues.push_back(strValue);
+}
+
const string CGUISpinControl::GetLabel() const
{
if (m_iValue >= 0 && m_iValue < (int)m_vecLabels.size())
{
- return m_vecLabels[ m_iValue];
+ return m_vecLabels[m_iValue];
}
return "";
}
void SetValue(int iValue);
void SetValueFromLabel(const CStdString &label);
void SetFloatValue(float fValue);
+ void SetStringValue(const std::string& strValue);
int GetValue() const;
float GetFloatValue() const;
+ std::string GetStringValue() const;
void AddLabel(const std::string& strLabel, int iValue);
+ void AddLabel(const std::string& strLabel, const std::string& strValue);
const std::string GetLabel() const;
void SetReverse(bool bOnOff);
int GetMaximum() const;
float m_fInterval;
std::vector<std::string> m_vecLabels;
std::vector<int> m_vecValues;
+ std::vector<std::string> m_vecStrValues;
CGUITexture m_imgspinUp;
CGUITexture m_imgspinDown;
CGUITexture m_imgspinUpFocus;
#include "GUIControlFactory.h"
#include "GUIControlGroup.h"
#include "GUIControlProfiler.h"
-#include "settings/Settings.h"
#ifdef PRE_SKIN_VERSION_9_10_COMPATIBILITY
#include "GUIEditControl.h"
#endif
#include "GUIInfoManager.h"
#include "threads/SingleLock.h"
#include "utils/URIUtils.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "addons/Skin.h"
#include "GUITexture.h"
#include "windowing/WindowingFactory.h"
// virtual music window which returns the last open music window (aka the music start window)
if (iWindowID == WINDOW_MUSIC)
{
- iWindowID = g_guiSettings.GetInt("mymusic.startwindow");
+ iWindowID = CSettings::Get().GetInt("mymusic.startwindow");
// ensure the music virtual window only returns music files and music library windows
if (iWindowID != WINDOW_MUSIC_NAV)
iWindowID = WINDOW_MUSIC_FILES;
#include "threads/SingleLock.h"
#include "Application.h"
#include "ApplicationMessenger.h"
-#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/DisplaySettings.h"
+#include "settings/Settings.h"
#include "cores/VideoRenderers/RenderManager.h"
#include "windowing/WindowingFactory.h"
#include "TextureManager.h"
{
}
+void CGraphicContext::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "videoscreen.fakefullscreen")
+ {
+ if (IsFullScreenRoot())
+ SetVideoResolution(GetVideoResolution(), true);
+ }
+}
+
void CGraphicContext::SetOrigin(float x, float y)
{
if (m_origins.size())
#if defined(HAS_VIDEO_PLAYBACK)
if(m_bFullScreenRoot)
{
- bool allowDesktopRes = g_guiSettings.GetInt("videoplayer.adjustrefreshrate") == ADJUST_REFRESHRATE_ALWAYS;
+ bool allowDesktopRes = CSettings::Get().GetInt("videoplayer.adjustrefreshrate") == ADJUST_REFRESHRATE_ALWAYS;
if(m_bFullScreenVideo || (!allowDesktopRes && g_application.IsPlayingVideo()))
SetVideoResolution(g_renderManager.GetResolution());
else if(CDisplaySettings::Get().GetCurrentResolution() > RES_DESKTOP)
if ((res != RES_DESKTOP && res != RES_WINDOW) || (lastRes != RES_DESKTOP && lastRes != RES_WINDOW))
{
//pause the player during the refreshrate change
- int delay = g_guiSettings.GetInt("videoplayer.pauseafterrefreshchange");
- if (delay > 0 && g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF && g_application.IsPlayingVideo() && !g_application.IsPaused())
+ int delay = CSettings::Get().GetInt("videoplayer.pauseafterrefreshchange");
+ if (delay > 0 && CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF && g_application.IsPlayingVideo() && !g_application.IsPaused())
{
g_application.m_pPlayer->Pause();
ThreadMessage msg = {TMSG_MEDIA_UNPAUSE};
if (g_advancedSettings.m_fullScreen)
{
#if defined (TARGET_DARWIN) || defined (_WIN32)
- bool blankOtherDisplays = g_guiSettings.GetBool("videoscreen.blankdisplays");
+ bool blankOtherDisplays = CSettings::Get().GetBool("videoscreen.blankdisplays");
g_Windowing.SetFullScreen(true, CDisplaySettings::Get().GetResolutionInfo(res), blankOtherDisplays);
#else
g_Windowing.SetFullScreen(true, CDisplaySettings::Get().GetResolutionInfo(res), false);
}
if(!g_guiSkinzoom) // lookup gui setting if we didn't have it already
- g_guiSkinzoom = (CSettingInt*)g_guiSettings.GetSetting("lookandfeel.skinzoom");
+ g_guiSkinzoom = (CSettingInt*)CSettings::Get().GetSetting("lookandfeel.skinzoom");
float fZoom = 1.0f;
if(g_guiSkinzoom)
- fZoom *= (100 + g_guiSkinzoom->GetData()) * 0.01f;
+ fZoom *= (100 + g_guiSkinzoom->GetValue()) * 0.01f;
fZoom -= 1.0f;
fToPosX -= fToWidth * fZoom * 0.5f;
#include "Resolution.h"
#include "utils/GlobalsHandling.h"
#include "DirtyRegion.h"
+#include "settings/ISettingCallback.h"
enum VIEW_TYPE { VIEW_TYPE_NONE = 0,
VIEW_TYPE_LIST,
VIEW_TYPE_AUTO,
VIEW_TYPE_MAX };
+enum AdjustRefreshRate
+{
+ ADJUST_REFRESHRATE_OFF = 0,
+ ADJUST_REFRESHRATE_ALWAYS,
+ ADJUST_REFRESHRATE_ON_STARTSTOP
+};
-class CGraphicContext : public CCriticalSection
+class CGraphicContext : public CCriticalSection,
+ public ISettingCallback
{
public:
CGraphicContext(void);
virtual ~CGraphicContext(void);
+ virtual void OnSettingChanged(const CSetting *setting);
+
// the following two functions should wrap any
// GL calls to maintain thread safety
void BeginPaint(bool lock=true);
#define ACTION_SWITCH_PLAYER 234
+#define ACTION_SETTINGS_RESET 240
+#define ACTION_SETTINGS_LEVEL_CHANGE 241
+
// touch actions
#define ACTION_TOUCH_TAP 401
#define ACTION_TOUCH_TAP_TEN 410
#include "GraphicContext.h"
#include "utils/log.h"
#include "addons/Skin.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "filesystem/SpecialProtocol.h"
#include "utils/EndianSwap.h"
#include "utils/URIUtils.h"
{
// if we are the theme bundle, we only load if the user has chosen
// a valid theme (or the skin has a default one)
- CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme");
+ CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme");
if (!theme.IsEmpty() && theme.CompareNoCase("SKINDEFAULT"))
{
CStdString themeXBT(URIUtils::ReplaceExtension(theme, ".xbt"));
#endif
#include <lzo/lzo1x.h>
#include "addons/Skin.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "filesystem/SpecialProtocol.h"
#include "utils/EndianSwap.h"
#include "utils/URIUtils.h"
{
// if we are the theme bundle, we only load if the user has chosen
// a valid theme (or the skin has a default one)
- CStdString theme = g_guiSettings.GetString("lookandfeel.skintheme");
+ CStdString theme = CSettings::Get().GetString("lookandfeel.skintheme");
if (!theme.IsEmpty() && theme.CompareNoCase("SKINDEFAULT"))
{
CStdString themeXPR(URIUtils::ReplaceExtension(theme, ".xpr"));
{"volampdown" , ACTION_VOLAMP_DOWN},
{"createbookmark" , ACTION_CREATE_BOOKMARK},
{"createepisodebookmark" , ACTION_CREATE_EPISODE_BOOKMARK},
+ {"settingsreset" , ACTION_SETTINGS_RESET},
+ {"settingslevelchange", ACTION_SETTINGS_LEVEL_CHANGE},
// PVR actions
{"channelup" , ACTION_CHANNEL_UP},
#ifdef HAS_EVENT_SERVER
#include "network/EventClient.h"
#endif
+#include "utils/StdString.h"
class CKey;
class CAction;
#include "MouseStat.h"
#include "guilib/Key.h"
-#include "windowing/WindowingFactory.h"
+#include "settings/Setting.h"
#include "utils/TimeUtils.h"
+#include "windowing/WindowingFactory.h"
CMouseStat::CMouseStat()
{
{
}
+void CMouseStat::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "input.enablemouse")
+ SetEnabled(((CSettingBool*)setting)->GetValue());
+}
+
void CMouseStat::Initialize()
{
// Set the default resolution (PAL)
*
*/
+#include "settings/ISettingCallback.h"
#include "windowing/XBMC_events.h"
#define XBMC_BUTTON(X) (1 << ((X)-1))
class CAction;
-class CMouseStat
+class CMouseStat : public ISettingCallback
{
public:
-
CMouseStat();
virtual ~CMouseStat();
+ virtual void OnSettingChanged(const CSetting *setting);
+
void Initialize();
void HandleEvent(XBMC_Event& newEvent);
void SetResolution(int maxX, int maxY, float speedX, float speedY);
#include "system.h"
#include "SDLJoystick.h"
#include "ButtonTranslator.h"
+#include "peripherals/devices/PeripheralImon.h"
#include "settings/AdvancedSettings.h"
#include "utils/log.h"
SetDeadzone(0);
}
+void CJoystick::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "input.enablejoystick")
+ SetEnabled(((CSettingBool*)setting)->GetValue() && PERIPHERALS::CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0);
+}
+
void CJoystick::Initialize()
{
if (!IsEnabled())
#define SDL_JOYSTICK_H
#include "system.h" // for HAS_SDL_JOYSTICK
+#include "settings/ISettingCallback.h"
#include <vector>
#include <string>
// Class to manage all connected joysticks
-class CJoystick
+class CJoystick : public ISettingCallback
{
public:
CJoystick();
+ virtual void OnSettingChanged(const CSetting *setting);
+
void Initialize();
void Reset(bool axis=false);
void ResetAxis(int axisId) { m_Amount[axisId] = 0; }
#include "WINJoystick.h"
#include "input/ButtonTranslator.h"
+#include "peripherals/devices/PeripheralImon.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Setting.h"
#include "utils/log.h"
#include <math.h>
ReleaseJoysticks();
}
+void CJoystick::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "input.enablejoystick")
+ SetEnabled(((CSettingBool*)setting)->GetValue() && PERIPHERALS::CPeripheralImon::GetCountOfImonsConflictWithDInput() == 0);
+}
+
void CJoystick::ReleaseJoysticks()
{
CSingleLock lock(m_critSection);
#include <vector>
#include <string>
+#include "settings/ISettingCallback.h"
#include "threads/CriticalSection.h"
#define JACTIVE_BUTTON 0x00000001
// Class to manage all connected joysticks
-class CJoystick
+class CJoystick : public ISettingCallback
{
public:
CJoystick();
~CJoystick();
+ virtual void OnSettingChanged(const CSetting *setting);
+
void Initialize();
void Reset(bool axis=false);
void ResetAxis(int axisId) { m_Amount[axisId] = 0; }
#include "addons/AddonInstaller.h"
#include "addons/AddonManager.h"
#include "addons/PluginSource.h"
+#include "network/NetworkServices.h"
#include "utils/log.h"
#include "storage/MediaManager.h"
#include "utils/RssManager.h"
#endif
#include <vector>
-#include "xbmc/settings/AdvancedSettings.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/DisplaySettings.h"
using namespace std;
using namespace XFILE;
{
case PLAYLIST_MUSIC:
CMediaSettings::Get().SetMusicPlaylistShuffled(g_playlistPlayer.IsShuffled(iPlaylist));
- g_settings.Save();
+ CSettings::Get().Save();
break;
case PLAYLIST_VIDEO:
CMediaSettings::Get().SetVideoPlaylistShuffled(g_playlistPlayer.IsShuffled(iPlaylist));
- g_settings.Save();
+ CSettings::Get().Save();
}
// send message
{
case PLAYLIST_MUSIC:
CMediaSettings::Get().SetMusicPlaylistRepeat(state == PLAYLIST::REPEAT_ALL);
- g_settings.Save();
+ CSettings::Get().Save();
break;
case PLAYLIST_VIDEO:
CMediaSettings::Get().SetVideoPlaylistRepeat(state == PLAYLIST::REPEAT_ALL);
- g_settings.Save();
+ CSettings::Get().Save();
}
// send messages so now playing window can get updated
{
int setting = CSkinSettings::Get().TranslateBool(parameter);
CSkinSettings::Get().SetBool(setting, !CSkinSettings::Get().GetBool(setting));
- g_settings.Save();
+ CSettings::Get().Save();
}
else if (execute.Equals("skin.setbool") && params.size())
{
{
int string = CSkinSettings::Get().TranslateBool(params[0]);
CSkinSettings::Get().SetBool(string, params[1].CompareNoCase("true") == 0);
- g_settings.Save();
+ CSettings::Get().Save();
return 0;
}
// default is to set it to true
int setting = CSkinSettings::Get().TranslateBool(params[0]);
CSkinSettings::Get().SetBool(setting, true);
- g_settings.Save();
+ CSettings::Get().Save();
}
else if (execute.Equals("skin.reset"))
{
CSkinSettings::Get().Reset(parameter);
- g_settings.Save();
+ CSettings::Get().Save();
}
else if (execute.Equals("skin.resetsettings"))
{
CSkinSettings::Get().Reset();
- g_settings.Save();
+ CSettings::Get().Save();
}
else if (execute.Equals("skin.theme"))
{
int iTheme = -1;
// find current theme
- if (!g_guiSettings.GetString("lookandfeel.skintheme").Equals("SKINDEFAULT"))
+ if (!StringUtils::EqualsNoCase(CSettings::Get().GetString("lookandfeel.skintheme"), "SKINDEFAULT"))
{
for (unsigned int i=0;i<vecTheme.size();++i)
{
- CStdString strTmpTheme(g_guiSettings.GetString("lookandfeel.skintheme"));
+ CStdString strTmpTheme(CSettings::Get().GetString("lookandfeel.skintheme"));
URIUtils::RemoveExtension(strTmpTheme);
if (vecTheme[i].Equals(strTmpTheme))
{
if (iTheme != -1 && iTheme < (int)vecTheme.size())
strSkinTheme = vecTheme[iTheme];
- g_guiSettings.SetString("lookandfeel.skintheme", strSkinTheme);
+ CSettings::Get().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);
+ CSettings::Get().SetString("lookandfeel.skincolors", colorTheme);
g_application.ReloadSkin();
}
else if (execute.Equals("skin.setstring") || execute.Equals("skin.setimage") || execute.Equals("skin.setfile") ||
if (execute.Equals("skin.setstring"))
{
CSkinSettings::Get().SetString(string, params[1]);
- g_settings.Save();
+ CSettings::Get().Save();
return 0;
}
}
if (CGUIDialogFileBrowser::ShowAndGetDirectory(localShares, g_localizeStrings.Get(1031), value))
CSkinSettings::Get().SetString(string, value);
}
- g_settings.Save();
+ CSettings::Get().Save();
}
else if (execute.Equals("skin.setaddon") && params.size() > 1)
{
if (types.size() > 0 && CGUIWindowAddonBrowser::SelectAddonID(types, result, true) == 1)
{
CSkinSettings::Get().SetString(string, result);
- g_settings.Save();
+ CSettings::Get().Save();
}
}
else if (execute.Equals("dialog.close") && params.size())
CProfilesManager::Get().LoadMasterProfileForLogin();
g_passwordManager.bMasterUser = false;
g_windowManager.ActivateWindow(WINDOW_LOGIN_SCREEN);
- if (!g_application.StartEventServer()) // event server could be needed in some situations
- CGUIDialogKaiToast::QueueNotification("DefaultIconWarning.png", g_localizeStrings.Get(33102), g_localizeStrings.Get(33100));
+ if (!CNetworkServices::Get().StartEventServer()) // event server could be needed in some situations
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(33102), g_localizeStrings.Get(33100));
}
else if (execute.Equals("pagedown"))
{
}
else if (execute.Equals("toggledebug"))
{
- bool debug = g_guiSettings.GetBool("debug.showloginfo");
- g_guiSettings.SetBool("debug.showloginfo", !debug);
+ bool debug = CSettings::Get().GetBool("debug.showloginfo");
+ CSettings::Get().SetBool("debug.showloginfo", !debug);
g_advancedSettings.SetDebugMode(!debug);
}
else if (execute.Equals("startpvrmanager"))
#include "ApplicationMessenger.h"
#include "filesystem/Directory.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace MUSIC_INFO;
using namespace JSONRPC;
musicUrl.AddOption("xsp", xsp);
}
- bool albumArtistsOnly = !g_guiSettings.GetBool("musiclibrary.showcompilationartists");
+ bool albumArtistsOnly = !CSettings::Get().GetBool("musiclibrary.showcompilationartists");
if (parameterObject["albumartistsonly"].isBoolean())
albumArtistsOnly = parameterObject["albumartistsonly"].asBoolean();
#include "interfaces/Builtins.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "addons/AddonManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/Variant.h"
using namespace std;
result["label"] = g_infoManager.GetLabel(g_infoManager.TranslateString("System.CurrentControl"));
else if (property.Equals("skin"))
{
- CStdString skinId = g_guiSettings.GetString("lookandfeel.skin");
+ CStdString skinId = CSettings::Get().GetString("lookandfeel.skin");
AddonPtr addon;
CAddonMgr::Get().GetAddon(skinId, addon, ADDON_SKIN);
std::string mask = maskparam;
VECSOURCES *shares = CMediaSourceSettings::Get().GetSources(s_shares);
if (!shares)
- throw WindowException("Error: GetSourcesFromType given %s is NULL.",s_shares.c_str());
+ throw WindowException("Error: GetSources given %s is NULL.",s_shares.c_str());
if (useFileDirectories && (!maskparam.empty() && !maskparam.size() == 0))
mask += "|.rar|.zip";
CStdStringArray tmpret;
String lmask = mask;
if (!shares)
- throw WindowException("Error: GetSourcesFromType given %s is NULL.",s_shares.c_str());
+ throw WindowException("Error: GetSources given %s is NULL.",s_shares.c_str());
if (useFileDirectories && (!lmask.empty() && !(lmask.size() == 0)))
lmask += "|.rar|.zip";
#include "XTimeUtils.h"
#endif
#include "guilib/LocalizeStrings.h"
-#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "GUIInfoManager.h"
#include "guilib/GUIAudioManager.h"
#include "guilib/GUIWindowManager.h"
#include "utils/Crc32.h"
#include "FileItem.h"
#include "LangInfo.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "guilib/TextureManager.h"
#include "Util.h"
#include "URL.h"
String getSkinDir()
{
TRACE;
- return g_guiSettings.GetString("lookandfeel.skin");
+ return CSettings::Get().GetString("lookandfeel.skin");
}
String getLanguage(int format /* = CLangCodeExpander::ENGLISH_NAME */, bool region /*= false*/)
{
TRACE;
- CStdString lang = g_guiSettings.GetString("locale.language");
+ CStdString lang = CSettings::Get().GetString("locale.language");
switch (format)
{
#include "WindowInterceptor.h"
#include "guilib/GUIWindowManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "addons/Skin.h"
#include "filesystem/File.h"
#include "utils/URIUtils.h"
URIUtils::AddSlashAtEnd(pathToLanguageFile);
// allocate a bunch of strings
- return g_localizeStrings.LoadBlock(m_scriptPath, pathToLanguageFile, g_guiSettings.GetString("locale.language"));
+ return g_localizeStrings.LoadBlock(m_scriptPath, pathToLanguageFile, CSettings::Get().GetString("locale.language"));
}
void WindowXML::ClearScriptStrings()
#include "pythreadstate.h"
#include "utils/TimeUtils.h"
#include "Util.h"
+#include "guilib/GraphicContext.h"
#include "threads/SystemClock.h"
#include "addons/Addon.h"
#include "threads/CriticalSection.h"
#include "utils/URIUtils.h"
#include "MediaSource.h"
-#include "settings/GUISettings.h"
class CHALDevice
{
#endif
#include "Util.h"
+#include "XBDateTime.h"
+#include "settings/Settings.h"
using namespace std;
free(line);
}
+void CLinuxTimezone::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "locale.timezone")
+ {
+ SetTimezone(((CSettingString*)setting)->GetValue());
+
+ CDateTime::ResetTimezoneBias();
+ }
+ else if (settingId == "locale.timezonecountry")
+ {
+ // nothing to do here. Changing locale.timezonecountry will trigger an
+ // update of locale.timezone and automatically adjust its value
+ // and execute OnSettingChanged() for it as well (see above)
+ }
+}
+
vector<CStdString> CLinuxTimezone::GetCounties()
{
return m_counties;
return timezoneName;
}
+void CLinuxTimezone::SettingOptionsTimezoneCountriesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ vector<CStdString> countries = g_timezone.GetCounties();
+ for (unsigned int i = 0; i < countries.size(); i++)
+ list.push_back(make_pair(countries[i], countries[i]));
+}
+
+void CLinuxTimezone::SettingOptionsTimezonesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ current = ((const CSettingString*)setting)->GetValue();
+ bool found = false;
+ vector<CStdString> timezones = g_timezone.GetTimezonesByCountry(CSettings::Get().GetString("locale.timezonecountry"));
+ for (unsigned int i = 0; i < timezones.size(); i++)
+ {
+ if (!found && timezones[i].Equals(current.c_str()))
+ found = true;
+
+ list.push_back(make_pair(timezones[i], timezones[i]));
+ }
+
+ if (!found && timezones.size() > 0)
+ current = timezones[0];
+}
+
CLinuxTimezone g_timezone;
*
*/
+#include "settings/ISettingCallback.h"
#include "utils/StdString.h"
#include <vector>
#include <map>
-class CLinuxTimezone
+class CSetting;
+
+class CLinuxTimezone : public ISettingCallback
{
public:
CLinuxTimezone();
+
+ virtual void OnSettingChanged(const CSetting *setting);
+
CStdString GetOSConfiguredTimezone();
std::vector<CStdString> GetCounties();
void SetTimezone(CStdString timezone);
int m_IsDST;
+
+ static void SettingOptionsTimezoneCountriesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsTimezonesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+
private:
std::vector<CStdString> m_counties;
std::map<CStdString, CStdString> m_countryByCode;
#if defined(HAVE_OMXLIB)
#include "video/VideoReferenceClock.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "OMXClock.h"
#include "utils/MathUtils.h"
OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE refClock;
OMX_INIT_STRUCTURE(refClock);
- if(g_guiSettings.GetBool("videoplayer.usedisplayasclock") && m_has_video)
+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && m_has_video)
refClock.eClock = OMX_TIME_RefClockVideo;
else if(m_has_audio)
refClock.eClock = OMX_TIME_RefClockAudio;
OMX_INIT_STRUCTURE(timeStamp);
timeStamp.nPortIndex = m_omx_clock.GetInputPort();
- if(g_guiSettings.GetBool("videoplayer.usedisplayasclock") && m_has_video)
+ if(CSettings::Get().GetBool("videoplayer.usedisplayasclock") && m_has_video)
index = OMX_IndexConfigTimeCurrentVideoReference;
else if(m_has_audio)
index = OMX_IndexConfigTimeCurrentAudioReference;
#include "GUIViewStateMusic.h"
#include "PlayListPlayer.h"
#include "video/VideoDatabase.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/WindowIDs.h"
#include "Util.h"
bool CGUIViewStateWindowMusic::AutoPlayNextItem()
{
- return g_guiSettings.GetBool("musicplayer.autoplaynextitem") &&
- !g_guiSettings.GetBool("musicplayer.queuebydefault");
+ return CSettings::Get().GetBool("musicplayer.autoplaynextitem") &&
+ !CSettings::Get().GetBool("musicplayer.queuebydefault");
}
CStdString CGUIViewStateWindowMusic::GetLockType()
CGUIViewStateMusicSearch::CGUIViewStateMusicSearch(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
{
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.librarytrackformat");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.librarytrackformat");
if (strTrackLeft.IsEmpty())
- strTrackLeft = g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.librarytrackformatright");
+ strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.librarytrackformatright");
if (strTrackRight.IsEmpty())
- strTrackRight = g_guiSettings.GetString("musicfiles.trackformatright");
+ strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright");
CStdString strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat;
if (strAlbumLeft.IsEmpty())
if (strAlbumRight.IsEmpty())
strAlbumRight = "%A"; // artist
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D", "%L", "%A")); // Title, Artist, Duration| empty, empty
SetSortMethod(SORT_METHOD_TITLE_IGNORE_THE);
SetSortMethod(SORT_METHOD_TITLE);
}
- CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
CMusicDatabaseDirectory dir;
NODE_TYPE NodeType=dir.GetDirectoryChildType(items.GetPath());
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.librarytrackformat");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.librarytrackformat");
if (strTrackLeft.IsEmpty())
- strTrackLeft = g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.librarytrackformatright");
+ strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.librarytrackformatright");
if (strTrackRight.IsEmpty())
- strTrackRight = g_guiSettings.GetString("musicfiles.trackformatright");
+ strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright");
CStdString strAlbumLeft = g_advancedSettings.m_strMusicLibraryAlbumFormat;
if (strAlbumLeft.IsEmpty())
break;
case NODE_TYPE_ARTIST:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%F", "", "%A", "")); // Filename, empty | Artist, empty
SetSortMethod(SORT_METHOD_ARTIST_IGNORE_THE);
AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%F", "", "%A", "")); // Filename, empty | Artist, empty
SetSortMethod(SORT_METHOD_ARTIST);
}
-
- CViewState *viewState = CViewStateSettings::Get().Get("musicnavartists");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicnavartists");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
case NODE_TYPE_YEAR_ALBUM:
{
// album
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
else
AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// artist
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
else
AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// year
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight));
- CViewState *viewState = CViewStateSettings::Get().Get("musicnavalbums");
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicnavalbums");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
SetSortMethod(SORT_METHOD_NONE);
SetViewAsControl(DEFAULT_VIEW_LIST);
-
SetSortOrder(SortOrderNone);
}
break;
case NODE_TYPE_SINGLES:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
}
AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating
-
- CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
case NODE_TYPE_SONG:
{
AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Title, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year
-
- CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
// the "All Albums" entries always default to SORT_METHOD_ALBUM as this is most logical - user can always
// change it and the change will be saved for this particular path
if (dir.IsAllItem(items.GetPath()))
- SetSortMethod(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_ALBUM_IGNORE_THE : SORT_METHOD_ALBUM);
+ SetSortMethod(CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_ALBUM_IGNORE_THE : SORT_METHOD_ALBUM);
else
SetSortMethod(viewState->m_sortMethod);
{
if (items.GetContent() == "songs" || items.GetContent() == "mixed")
{
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
strAlbumRight = "%A"; // artist
// album
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
else
AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// artist
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
else
AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
CGUIViewStateMusicPlaylist::CGUIViewStateMusicPlaylist(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
{
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
AddSortMethod(SORT_METHOD_PLAYLIST_ORDER, 559, LABEL_MASKS(strTrackLeft, strTrackRight));
AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty
SetSortMethod(SORT_METHOD_PLAYLIST_ORDER);
- CViewState *viewState = CViewStateSettings::Get().Get("musicfiles");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicfiles");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
else
{
- if (items.IsVideoDb() && items.Size() > (g_guiSettings.GetBool("filelists.showparentdiritems")?1:0))
+ if (items.IsVideoDb() && items.Size() > (CSettings::Get().GetBool("filelists.showparentdiritems")?1:0))
{
XFILE::VIDEODATABASEDIRECTORY::CQueryParams params;
- XFILE::CVideoDatabaseDirectory::GetQueryParams(items[g_guiSettings.GetBool("filelists.showparentdiritems")?1:0]->GetPath(),params);
+ XFILE::CVideoDatabaseDirectory::GetQueryParams(items[CSettings::Get().GetBool("filelists.showparentdiritems")?1:0]->GetPath(),params);
if (params.GetMVideoId() != -1)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", "%Y")); // Filename, Duration | Foldername, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%Y")); // Filename, Duration | Foldername, empty
AddSortMethod(SORT_METHOD_YEAR,562, LABEL_MASKS("%T", "%Y"));
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE,557, LABEL_MASKS("%A - %T", "%Y"));
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE,558, LABEL_MASKS("%B - %T", "%Y"));
AddSortMethod(SORT_METHOD_ARTIST,557, LABEL_MASKS("%A - %T", "%Y"));
AddSortMethod(SORT_METHOD_ALBUM,558, LABEL_MASKS("%B - %T", "%Y"));
}
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
}
else
}
else
{
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS(strTrackLeft, "%J", "%L", "%J")); // Userdefined, Date | FolderName, Date
AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
AddSortMethod(SORT_METHOD_LISTENERS,20455,LABEL_MASKS(strTrackLeft, "%W", "%L", "%W"));
-
- CViewState *viewState = CViewStateSettings::Get().Get("musicfiles");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("musicfiles");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
CGUIViewStateWindowMusicPlaylist::CGUIViewStateWindowMusicPlaylist(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
{
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.nowplayingtrackformat");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.nowplayingtrackformat");
if (strTrackLeft.IsEmpty())
- strTrackLeft = g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.nowplayingtrackformatright");
+ strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.nowplayingtrackformatright");
if (strTrackRight.IsEmpty())
- strTrackRight = g_guiSettings.GetString("musicfiles.trackformatright");
+ strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright");
AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
SetSortMethod(SORT_METHOD_NONE);
#include "dialogs/GUIDialogSelect.h"
#include "filesystem/File.h"
#include "profiles/ProfilesManager.h"
-#include "settings/MediaSettings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "FileItem.h"
#include "Application.h"
#include "karaoke/karaokelyricsfactory.h"
#endif
#include "storage/MediaManager.h"
+#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "utils/StringUtils.h"
#include "guilib/LocalizeStrings.h"
bool CMusicDatabase::LookupCDDBInfo(bool bRequery/*=false*/)
{
#ifdef HAS_DVD_DRIVE
- if (!g_guiSettings.GetBool("audiocds.usecddb"))
+ if (!CSettings::Get().GetBool("audiocds.usecddb"))
return false;
// check network connectivity
} // if ( !cddb.queryCDinfo( pCdInfo ) )
else
pDialogProgress->Close();
- } // if (pCdInfo->HasCDDBInfo() && g_settings.m_bUseCDDB)
+ }
// Filling the file items with cddb info happens in CMusicInfoTagLoaderCDDA
m_pDS->exec("DROP TABLE thumb");
CMediaSettings::Get().SetMusicNeedsUpdate(27);
- g_settings.Save();
+ CSettings::Get().Save();
}
if (version < 29)
else if (itemType.Equals("years"))
return GetYearsNav(strBaseDir, items, filter);
else if (itemType.Equals("artists"))
- return GetArtistsNav(strBaseDir, items, !g_guiSettings.GetBool("musiclibrary.showcompilationartists"), -1, -1, -1, filter, sortDescription);
+ return GetArtistsNav(strBaseDir, items, !CSettings::Get().GetBool("musiclibrary.showcompilationartists"), -1, -1, -1, filter, sortDescription);
else if (itemType.Equals("albums"))
return GetAlbumsByWhere(strBaseDir, filter, items, sortDescription);
else if (itemType.Equals("songs"))
if (xsp.GetOrder() != SortByNone)
sorting.sortBy = xsp.GetOrder();
sorting.sortOrder = xsp.GetOrderAscending() ? SortOrderAscending : SortOrderDescending;
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
sorting.sortAttributes = SortAttributeIgnoreArticle;
}
}
#include "utils/URIUtils.h"
#include "music/tags/MusicInfoTag.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "utils/log.h"
#include "Artist.h"
pItem->SetArt("thumb", song.strThumb);
}
}
- else if (g_guiSettings.GetBool("musicfiles.usetags") || pItem->IsCDDA())
+ else if (CSettings::Get().GetBool("musicfiles.usetags") || pItem->IsCDDA())
{ // Nothing found, load tag from file,
// always try to load cddb info
// get correct tag parser
#include "storage/MediaManager.h"
#include "utils/AsyncFileCopy.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
}
CStdString result;
- VECSOURCES sources(*CMediaSourceSettings::Get().GetSources("music"));
+ VECSOURCES sources = *CMediaSourceSettings::Get().GetSources("music");
g_mediaManager.GetLocalDrives(sources);
bool flip=false;
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, sources, g_localizeStrings.Get(20437), result, &flip, 20445))
#include "input/MouseStat.h"
#include "GUIUserMessages.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "addons/GUIWindowAddonBrowser.h"
#define CONTROL_VIS_BUTTON 500
CStdString addonID;
if (CGUIWindowAddonBrowser::SelectAddonID(ADDON::ADDON_VIZ, addonID, true) == 1)
{
- g_guiSettings.SetString("musicplayer.visualisation", addonID);
- g_settings.Save();
+ CSettings::Get().SetString("musicplayer.visualisation", addonID);
+ CSettings::Get().Save();
g_windowManager.SendMessage(GUI_MSG_VISUALISATION_RELOAD, 0, 0);
}
}
#include "filesystem/CurlFile.h"
#include "FileItem.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
#include "music/Album.h"
#include "filesystem/File.h"
#include "filesystem/Directory.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/LocalizeStrings.h"
#include "utils/StringUtils.h"
m_musicDatabase.Open();
- if (m_showDialog && !g_guiSettings.GetBool("musiclibrary.backgroundupdate"))
+ if (m_showDialog && !CSettings::Get().GetBool("musiclibrary.backgroundupdate"))
{
CGUIDialogExtendedProgressBar* dialog =
(CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
CLog::Log(LOGERROR,"Unable to find an url in nfo file: %s", strNfo.c_str());
}
- if (!scraper.CheckValidOrFallback(g_guiSettings.GetString("musiclibrary.albumsscraper")))
+ if (!scraper.CheckValidOrFallback(CSettings::Get().GetString("musiclibrary.albumsscraper")))
{ // the current scraper is invalid, as is the default - bail
CLog::Log(LOGERROR, "%s - current and default scrapers are invalid. Pick another one", __FUNCTION__);
return INFO_ERROR;
#include "threads/SystemClock.h"
#include "Application.h"
#include "guilib/GUIWindowManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "karaokelyrics.h"
#include "karaokelyricsfactory.h"
Stop(); // shouldn't happen, but...
// If disabled by configuration, do nothing
- if ( !g_guiSettings.GetBool("karaoke.enabled") )
+ if ( !CSettings::Get().GetBool("karaoke.enabled") )
return false;
m_Lyrics = CKaraokeLyricsFactory::CreateLyrics( strSongPath );
return;
}
- if ( !m_karaokeSongPlayed || !g_guiSettings.GetBool("karaoke.autopopupselector") )
+ if ( !m_karaokeSongPlayed || !CSettings::Get().GetBool("karaoke.autopopupselector") )
return;
// If less than 750ms passed return; we're still processing STOP events
#include "utils/CharsetConverter.h"
#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "guilib/GUITextLayout.h"
#include "guilib/GUIFont.h"
#include "karaokelyricstext.h"
m_preambleLayout = 0;
m_karaokeFont = 0;
- int coloridx = g_guiSettings.GetInt("karaoke.fontcolors");
+ int coloridx = CSettings::Get().GetInt("karaoke.fontcolors");
if ( coloridx < KARAOKE_COLOR_START || coloridx >= KARAOKE_COLOR_END )
coloridx = 0;
if ( m_lyrics.empty() )
return false;
- CStdString fontPath = "special://xbmc/media/Fonts/" + g_guiSettings.GetString("karaoke.font");
+ CStdString fontPath = "special://xbmc/media/Fonts/" + CSettings::Get().GetString("karaoke.font");
m_karaokeFont = g_fontManager.LoadTTF("__karaoke__", fontPath,
- m_colorLyrics, 0, g_guiSettings.GetInt("karaoke.fontheight"), FONT_STYLE_BOLD );
+ m_colorLyrics, 0, CSettings::Get().GetInt("karaoke.fontheight"), FONT_STYLE_BOLD );
CGUIFont *karaokeBorder = g_fontManager.LoadTTF("__karaokeborder__", fontPath,
- m_colorLyrics, 0, g_guiSettings.GetInt("karaoke.fontheight"), FONT_STYLE_BOLD, true );
+ m_colorLyrics, 0, CSettings::Get().GetInt("karaoke.fontheight"), FONT_STYLE_BOLD, true );
if ( !m_karaokeFont )
{
#include "karaokelyrics.h"
+// Karaoke colours
+// If you want to add more colors, it should be done the following way:
+// 1. Increase KARAOKE_COLOR_END
+// 2. Add a new color description in language/English/strings.xml in block
+// with id 22040 + KARAOKE_COLOR_END value
+// 3. Add a new color hex mask into gLyricColors structure in karaoke/karaokelyricstext.cpp
+#define KARAOKE_COLOR_START 0
+#define KARAOKE_COLOR_END 4
+
class CGUITextLayout;
class CGUIFont;
#include "utils/CharsetConverter.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include <math.h>
CStdString strUTF8;
// Use some heuristics; need to replace by real detection stuff later
- if ( g_charsetConverter.isValidUtf8(data) || g_guiSettings.GetString("karaoke.charset") == "DEFAULT" )
+ if ( g_charsetConverter.isValidUtf8(data) || CSettings::Get().GetString("karaoke.charset") == "DEFAULT" )
strUTF8 = data;
else
- g_charsetConverter.stringCharsetToUtf8( g_guiSettings.GetString("karaoke.charset"), data, strUTF8 );
+ g_charsetConverter.stringCharsetToUtf8( CSettings::Get().GetString("karaoke.charset"), data, strUTF8 );
if ( strUTF8.size() == 0 )
strUTF8 = " ";
#define REPLAY_GAIN_HAS_TRACK_PEAK 4
#define REPLAY_GAIN_HAS_ALBUM_PEAK 8
+enum ReplayGain
+{
+ REPLAY_GAIN_NONE = 0,
+ REPLAY_GAIN_ALBUM,
+ REPLAY_GAIN_TRACK
+};
+
namespace MUSIC_INFO
{
class EmbeddedArtInfo
#include "filesystem/File.h"
#include "profiles/ProfilesManager.h"
#include "storage/MediaManager.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/TimeUtils.h"
#include "utils/log.h"
// save current window, unless the current window is the music playlist window
if (GetID() != WINDOW_MUSIC_PLAYLIST &&
- g_guiSettings.GetInt("mymusic.startwindow") != GetID())
+ CSettings::Get().GetInt("mymusic.startwindow") != GetID())
{
- g_guiSettings.SetInt("mymusic.startwindow", GetID());
- g_settings.Save();
+ CSettings::Get().SetInt("mymusic.startwindow", GetID());
+ CSettings::Get().Save();
}
return true;
if (nWindow == GetID())
return true;
- g_guiSettings.SetInt("mymusic.startwindow", nWindow);
- g_settings.Save();
+ CSettings::Get().SetInt("mymusic.startwindow", nWindow);
+ CSettings::Get().Save();
g_windowManager.ChangeActiveWindow(nWindow);
- CGUIMessage msg2(GUI_MSG_SETFOCUS, g_guiSettings.GetInt("mymusic.startwindow"), CONTROL_BTNTYPE);
+ CGUIMessage msg2(GUI_MSG_SETFOCUS, CSettings::Get().GetInt("mymusic.startwindow"), CONTROL_BTNTYPE);
g_windowManager.SendMessage(msg2);
return true;
// or be at the files window and have file deletion enabled
else if (GetID() == WINDOW_MUSIC_FILES &&
- g_guiSettings.GetBool("filelists.allowfiledeletion"))
+ CSettings::Get().GetBool("filelists.allowfiledeletion"))
{
OnDeleteItem(iItem);
}
g_windowManager.SendMessage(msg2);
// Select the current window as default item
- CONTROL_SELECT_ITEM(CONTROL_BTNTYPE, g_guiSettings.GetInt("mymusic.startwindow") - WINDOW_MUSIC_FILES);
+ CONTROL_SELECT_ITEM(CONTROL_BTNTYPE, CSettings::Get().GetInt("mymusic.startwindow") - WINDOW_MUSIC_FILES);
CGUIMediaWindow::UpdateButtons();
}
// turned on, but we still want to use the playlist player in order to handle more queued items
// following etc.
// Karaoke items also can be added in runtime (while the song is played), so it should be queued too.
- if ( (g_guiSettings.GetBool("musicplayer.queuebydefault") && g_windowManager.GetActiveWindow() != WINDOW_MUSIC_PLAYLIST_EDITOR)
+ if ( (CSettings::Get().GetBool("musicplayer.queuebydefault") && g_windowManager.GetActiveWindow() != WINDOW_MUSIC_PLAYLIST_EDITOR)
|| pItem->IsKaraoke() )
{
// TODO: Should the playlist be cleared if nothing is already playing?
void CGUIWindowMusicBase::OnRetrieveMusicInfo(CFileItemList& items)
{
if (items.GetFolderCount()==items.Size() || items.IsMusicDb() ||
- (!g_guiSettings.GetBool("musicfiles.usetags") && !items.IsCDDA()))
+ (!CSettings::Get().GetBool("musicfiles.usetags") && !items.IsCDDA()))
{
return;
}
{
g_application.StartMusicScan("", CMusicInfoScanner::SCAN_RESCAN);
CMediaSettings::Get().SetMusicNeedsUpdate(0); // once is enough (user may interrupt, but that's up to them)
- g_settings.Save();
+ CSettings::Get().Save();
}
}
}
typedef std::vector <CFileItem*>::iterator ivecItems; ///< CFileItem* vector Iterator
CGUIDialogProgress* m_dlgProgress; ///< Progress dialog
- // member variables to save frequently used g_guiSettings (which is slow)
+ // member variables to save frequently used CSettings (which is slow)
bool m_hideExtensions;
CMusicDatabase m_musicdatabase;
MUSIC_INFO::CMusicInfoLoader m_musicInfoLoader;
#include "ApplicationMessenger.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
// is this the first time the window is opened?
if (m_vecItems->GetPath() == "?" && message.GetStringParam().IsEmpty())
- message.SetStringParam(g_guiSettings.GetString("mymusic.defaultlibview"));
+ message.SetStringParam(CSettings::Get().GetString("mymusic.defaultlibview"));
DisplayEmptyDatabaseMessage(false); // reset message state
nodetype == NODE_TYPE_OVERVIEW ||
nodetype == NODE_TYPE_TOP100))
{
- if (!item->GetPath().Equals(g_guiSettings.GetString("mymusic.defaultlibview")))
+ if (!item->GetPath().Equals(CSettings::Get().GetString("mymusic.defaultlibview").c_str()))
buttons.Add(CONTEXT_BUTTON_SET_DEFAULT, 13335); // set default
- if (strcmp(g_guiSettings.GetString("mymusic.defaultlibview"), ""))
+ if (strcmp(CSettings::Get().GetString("mymusic.defaultlibview").c_str(), ""))
buttons.Add(CONTEXT_BUTTON_CLEAR_DEFAULT, 13403); // clear default
}
NODE_TYPE childtype = dir.GetDirectoryChildType(item->GetPath());
}
case CONTEXT_BUTTON_SET_DEFAULT:
- g_guiSettings.SetString("mymusic.defaultlibview", GetQuickpathName(item->GetPath()));
- g_settings.Save();
+ CSettings::Get().SetString("mymusic.defaultlibview", GetQuickpathName(item->GetPath()));
+ CSettings::Get().Save();
return true;
case CONTEXT_BUTTON_CLEAR_DEFAULT:
- g_guiSettings.SetString("mymusic.defaultlibview", "");
- g_settings.Save();
+ CSettings::Get().SetString("mymusic.defaultlibview", "");
+ CSettings::Get().Save();
return true;
case CONTEXT_BUTTON_GO_TO_ARTIST:
#include "GUIUserMessages.h"
#include "Favourites.h"
#include "profiles/ProfilesManager.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "utils/StringUtils.h"
#include "utils/log.h"
{
g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, !(g_playlistPlayer.IsShuffled(PLAYLIST_MUSIC)));
CMediaSettings::Get().SetMusicPlaylistShuffled(g_playlistPlayer.IsShuffled(PLAYLIST_MUSIC));
- g_settings.Save();
+ CSettings::Get().Save();
UpdateButtons();
Refresh();
}
// save settings
CMediaSettings::Get().SetMusicPlaylistRepeat(g_playlistPlayer.GetRepeat(PLAYLIST_MUSIC) == PLAYLIST::REPEAT_ALL);
- g_settings.Save();
+ CSettings::Get().Save();
UpdateButtons();
}
{
// need 2 rename it
CStdString strFolder, strPath;
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "music", strFolder);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music", strFolder);
strNewFileName= CUtil::MakeLegalFileName( strNewFileName );
strNewFileName += ".m3u";
URIUtils::AddFileToFolder(strFolder, strNewFileName, strPath);
if (pItem->HasMusicInfoTag() && pItem->GetMusicInfoTag()->Loaded())
{ // set label 1+2 from tags
if (m_guiState.get()) m_hideExtensions = m_guiState->HideExtensions();
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.nowplayingtrackformat");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.nowplayingtrackformat");
if (strTrackLeft.IsEmpty())
- strTrackLeft = g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.nowplayingtrackformatright");
+ strTrackLeft = CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.nowplayingtrackformatright");
if (strTrackRight.IsEmpty())
- strTrackRight = g_guiSettings.GetString("musicfiles.trackformatright");
+ strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright");
CLabelFormatter formatter(strTrackLeft, strTrackRight);
formatter.FormatLabels(pItem);
} // if (pItem->m_musicInfoTag.Loaded())
#include "guilib/GUIWindowManager.h"
#include "guilib/GUIKeyboardFactory.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "GUIUserMessages.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
PLAYLIST::CPlayListM3U playlist;
playlist.Add(*m_playlist);
CStdString path, strBase;
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "music", strBase);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "music", strBase);
URIUtils::AddFileToFolder(strBase, name + ".m3u", path);
playlist.Save(path);
m_strLoadedPlaylist = name;
void CGUIWindowMusicPlaylistEditor::AppendToPlaylist(CFileItemList &newItems)
{
OnRetrieveMusicInfo(newItems);
- FormatItemLabels(newItems, LABEL_MASKS(g_guiSettings.GetString("musicfiles.trackformat"), g_guiSettings.GetString("musicfiles.trackformatright"), "%L", ""));
+ FormatItemLabels(newItems, LABEL_MASKS(CSettings::Get().GetString("musicfiles.trackformat"), CSettings::Get().GetString("musicfiles.trackformatright"), "%L", ""));
m_playlist->Append(newItems);
UpdatePlaylist();
}
#include "FileItem.h"
#include "profiles/ProfilesManager.h"
#include "storage/MediaManager.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
if (!item->IsParentFolder() && !item->IsReadOnly())
{
// either we're at the playlist location or its been explicitly allowed
- if (inPlaylists || g_guiSettings.GetBool("filelists.allowfiledeletion"))
+ if (inPlaylists || CSettings::Get().GetBool("filelists.allowfiledeletion"))
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
#include "music/dialogs/GUIDialogVisualisationPresetList.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/Key.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace MUSIC_INFO;
case ACTION_SHOW_INFO:
{
m_initTimer.Stop();
- g_guiSettings.SetBool("mymusic.songthumbinvis", g_infoManager.ToggleShowInfo());
+ CSettings::Get().SetBool("mymusic.songthumbinvis", g_infoManager.ToggleShowInfo());
return true;
}
break;
case ACTION_SHOW_GUI:
// save the settings
- g_settings.Save();
+ CSettings::Get().Save();
g_windowManager.PreviousWindow();
return true;
break;
case GUI_MSG_WINDOW_DEINIT:
{
if (IsActive()) // save any changed settings from the OSD
- g_settings.Save();
+ CSettings::Get().Save();
// check and close any OSD windows
CGUIDialogMusicOSD *pOSD = (CGUIDialogMusicOSD *)g_windowManager.GetWindow(WINDOW_DIALOG_MUSIC_OSD);
if (pOSD && pOSD->IsDialogRunning()) pOSD->Close(true);
if (g_infoManager.GetCurrentSongTag())
m_tag = *g_infoManager.GetCurrentSongTag();
- if (g_guiSettings.GetBool("mymusic.songthumbinvis"))
+ if (CSettings::Get().GetBool("mymusic.songthumbinvis"))
{ // always on
m_initTimer.Stop();
}
if (m_initTimer.IsRunning() && m_initTimer.GetElapsedSeconds() > (float)g_advancedSettings.m_songInfoDuration)
{
m_initTimer.Stop();
- if (!g_guiSettings.GetBool("mymusic.songthumbinvis"))
+ if (!CSettings::Get().GetBool("mymusic.songthumbinvis"))
{ // reached end of fade in, fade out again
g_infoManager.SetShowInfo(false);
}
}
}
+bool CAirPlayServer::IsRunning()
+{
+ if (ServerInstance == NULL)
+ return false;
+
+ return ((CThread*)ServerInstance)->IsRunning();
+}
+
void CAirPlayServer::AnnounceToClients(int state)
{
CSingleLock lock (m_connectionLock);
//AirPlayServer impl.
static bool StartServer(int port, bool nonlocal);
static void StopServer(bool bWait);
+ static bool IsRunning();
static bool SetCredentials(bool usePassword, const CStdString& password);
static bool IsPlaying(){ return m_isPlaying > 0;}
static void backupVolume();
}
}
+ bool CAirTunesServer::IsRunning()
+ {
+ if (ServerInstance == NULL)
+ return false;
+
+ return ((CThread*)ServerInstance)->IsRunning();
+ }
+
CAirTunesServer::CAirTunesServer(int port, bool nonlocal) : CThread("AirTunesServer")
{
m_port = port;
static bool StartServer(int port, bool nonlocal, bool usePassword, const CStdString &password="");
static void StopServer(bool bWait);
+ static bool IsRunning();
static void SetMetadataFromBuffer(const char *buffer, unsigned int size);
static void SetCoverArtFromBuffer(const char *buffer, unsigned int size);
#include "threads/CriticalSection.h"
#include "Socket.h"
#include "EventPacket.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include <list>
#include <map>
void RefreshSettings()
{
- m_iRepeatDelay = g_guiSettings.GetInt("services.esinitialdelay");
- m_iRepeatSpeed = g_guiSettings.GetInt("services.escontinuousdelay");
+ m_iRepeatDelay = CSettings::Get().GetInt("services.esinitialdelay");
+ m_iRepeatSpeed = CSettings::Get().GetInt("services.escontinuousdelay");
}
SOCKETS::CAddress& Address()
return;
// set default port
- string port = (const char*)g_guiSettings.GetString("services.esport");
- assert(port.length());
- m_iPort = atoi(port.c_str());
+ m_iPort = CSettings::Get().GetInt("services.esport");
assert(m_iPort <= 65535 && m_iPort >= 1);
// max clients
- m_iMaxClients = g_guiSettings.GetInt("services.esmaxclients");
+ m_iMaxClients = CSettings::Get().GetInt("services.esmaxclients");
if (m_iMaxClients < 0)
{
CLog::Log(LOGERROR, "ES: Invalid maximum number of clients specified %d", m_iMaxClients);
CAddress any_addr;
CSocketListener listener;
int packetSize = 0;
- std::vector<std::pair<std::string, std::string> > txt;
CLog::Log(LOGNOTICE, "ES: Starting UDP Event server on %s:%d", any_addr.Address(), m_iPort);
}
// bind to IP and start listening on port
- int port_range = g_guiSettings.GetInt("services.esportrange");
+ int port_range = CSettings::Get().GetInt("services.esportrange");
if (port_range < 1 || port_range > 100)
{
CLog::Log(LOGERROR, "ES: Invalid port range specified %d, defaulting to 10", port_range);
}
// publish service
+ std::vector<std::pair<std::string, std::string> > txt;
CZeroconf::GetInstance()->PublishService("servers.eventserver",
"_xbmc-events._udp",
g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME),
-SRCS = cddb.cpp
-SRCS += DNSNameCache.cpp
-SRCS += EventClient.cpp
-SRCS += EventPacket.cpp
-SRCS += EventServer.cpp
-SRCS += GUIDialogAccessPoints.cpp
-SRCS += GUIDialogNetworkSetup.cpp
-SRCS += Network.cpp
-SRCS += Socket.cpp
-SRCS += TCPServer.cpp
-SRCS += UdpClient.cpp
-SRCS += WebServer.cpp
-SRCS += ZeroconfBrowser.cpp
-SRCS += Zeroconf.cpp
+SRCS = cddb.cpp \
+ DNSNameCache.cpp \
+ EventClient.cpp \
+ EventPacket.cpp \
+ EventServer.cpp \
+ GUIDialogAccessPoints.cpp \
+ GUIDialogNetworkSetup.cpp \
+ Network.cpp \
+ NetworkServices.cpp \
+ Socket.cpp \
+ TCPServer.cpp \
+ UdpClient.cpp \
+ WebServer.cpp \
+ ZeroconfBrowser.cpp \
+ Zeroconf.cpp \
ifeq (@USE_AIRPLAY@, 1)
SRCS += AirPlayServer.cpp
*
*/
-#include "system.h"
-#include "Network.h"
-#include "Application.h"
-#include "ApplicationMessenger.h"
-#include "utils/RssManager.h"
-#include "utils/log.h"
-#include "guilib/LocalizeStrings.h"
-#include "dialogs/GUIDialogKaiToast.h"
-
#include <netinet/in.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#include "Network.h"
+#include "ApplicationMessenger.h"
+#include "network/NetworkServices.h"
+#include "utils/log.h"
+
using namespace std;
/* slightly modified in_ether taken from the etherboot project (http://sourceforge.net/projects/etherboot) */
return CStdString(hostName);
}
-
CNetworkInterface* CNetwork::GetFirstConnectedInterface()
{
vector<CNetworkInterface*>& ifaces = GetInterfaceList();
switch( message )
{
case SERVICES_UP:
- {
CLog::Log(LOGDEBUG, "%s - Starting network services",__FUNCTION__);
- StartServices();
- }
- break;
+ CNetworkServices::Get().Start();
+ break;
+
case SERVICES_DOWN:
- {
CLog::Log(LOGDEBUG, "%s - Signaling network services to stop",__FUNCTION__);
- StopServices(false); //tell network services to stop, but don't wait for them yet
+ CNetworkServices::Get().Stop(false); // tell network services to stop, but don't wait for them yet
CLog::Log(LOGDEBUG, "%s - Waiting for network services to stop",__FUNCTION__);
- StopServices(true); //wait for network services to stop
- }
- break;
+ CNetworkServices::Get().Stop(true); // wait for network services to stop
+ break;
}
}
CLog::Log(LOGINFO, "%s - Magic packet send to '%s'", __FUNCTION__, mac);
return true;
}
-
-void CNetwork::StartServices()
-{
-#ifdef HAS_WEB_SERVER
- if (!g_application.StartWebServer())
- CGUIDialogKaiToast::QueueNotification("DefaultIconWarning.png", g_localizeStrings.Get(33101), g_localizeStrings.Get(33100));
-#endif
-#ifdef HAS_UPNP
- g_application.StartUPnP();
-#endif
-#ifdef HAS_EVENT_SERVER
- if (!g_application.StartEventServer())
- CGUIDialogKaiToast::QueueNotification("DefaultIconWarning.png", g_localizeStrings.Get(33102), g_localizeStrings.Get(33100));
-#endif
-#ifdef HAS_JSONRPC
- if (!g_application.StartJSONRPCServer())
- CGUIDialogKaiToast::QueueNotification("DefaultIconWarning.png", g_localizeStrings.Get(33103), g_localizeStrings.Get(33100));
-#endif
-#ifdef HAS_ZEROCONF
- g_application.StartZeroconf();
-#endif
-#ifdef HAS_AIRPLAY
- g_application.StartAirplayServer();
-#endif
- CRssManager::Get().Start();
-}
-
-void CNetwork::StopServices(bool bWait)
-{
- if (bWait)
- {
-#ifdef HAS_UPNP
- g_application.StopUPnP(bWait);
-#endif
-#ifdef HAS_ZEROCONF
- g_application.StopZeroconf();
-#endif
-#ifdef HAS_WEB_SERVER
- g_application.StopWebServer();
-#endif
- // smb.Deinit(); if any file is open over samba this will break.
-
- CRssManager::Get().Stop();
- }
-
-#ifdef HAS_EVENT_SERVER
- g_application.StopEventServer(bWait, false);
-#endif
-#ifdef HAS_JSONRPC
- g_application.StopJSONRPCServer(bWait);
-#endif
-#if defined(HAS_AIRPLAY) || defined(HAS_AIRTUNES)
- g_application.StopAirplayServer(bWait);
-#endif
-}
-#ifndef NETWORK_H_
-#define NETWORK_H_
-
+#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://www.xbmc.org
*/
#include <vector>
-#include "utils/StdString.h"
+
#include "system.h"
+#include "settings/ISettingCallback.h"
+#include "utils/StdString.h"
+
enum EncMode { ENC_NONE = 0, ENC_WEP = 1, ENC_WPA = 2, ENC_WPA2 = 3 };
enum NetworkAssignment { NETWORK_DASH = 0, NETWORK_DHCP = 1, NETWORK_STATIC = 2, NETWORK_DISABLED = 3 };
virtual void SetSettings(NetworkAssignment& assignment, CStdString& ipAddress, CStdString& networkMask, CStdString& defaultGateway, CStdString& essId, CStdString& key, EncMode& encryptionMode) = 0;
};
-
-
class CNetwork
{
public:
static int ParseHex(char *str, unsigned char *addr);
};
+
#ifdef HAS_LINUX_NETWORK
#include "linux/NetworkLinux.h"
#else
#include "windows/NetworkWin32.h"
#endif
-#endif
--- /dev/null
+/*
+ * 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/>.
+ *
+ */
+
+#include "NetworkServices.h"
+#include "Application.h"
+#include "ApplicationMessenger.h"
+#include "GUIInfoManager.h"
+#ifdef TARGET_LINUX
+#include "Util.h"
+#endif
+#include "dialogs/GUIDialogKaiToast.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/LocalizeStrings.h"
+#include "network/Network.h"
+
+#ifdef HAS_AIRPLAY
+#include "network/AirPlayServer.h"
+#endif // HAS_AIRPLAY
+
+#ifdef HAS_AIRTUNES
+#include "network/AirTunesServer.h"
+#endif // HAS_AIRTUNES
+
+#ifdef HAS_EVENT_SERVER
+#include "network/EventServer.h"
+#endif // HAS_EVENT_SERVER
+
+#ifdef HAS_JSONRPC
+#include "interfaces/json-rpc/JSONRPC.h"
+#include "network/TCPServer.h"
+#endif
+
+#ifdef HAS_ZEROCONF
+#include "network/Zeroconf.h"
+#endif // HAS_ZEROCONF
+
+#ifdef HAS_UPNP
+#include "network/upnp/UPnP.h"
+#endif // HAS_UPNP
+
+#ifdef HAS_WEB_SERVER
+#include "network/WebServer.h"
+#include "network/httprequesthandler/HTTPImageHandler.h"
+#include "network/httprequesthandler/HTTPVfsHandler.h"
+#ifdef HAS_JSONRPC
+#include "network/httprequesthandler/HTTPJsonRpcHandler.h"
+#endif // HAS_JSONRPC
+#ifdef HAS_WEB_INTERFACE
+#include "network/httprequesthandler/HTTPWebinterfaceHandler.h"
+#include "network/httprequesthandler/HTTPWebinterfaceAddonsHandler.h"
+#endif // HAS_WEB_INTERFACE
+#endif // HAS_WEB_SERVER
+
+#if defined(TARGET_DARWIN_OSX)
+#include "osx/XBMCHelper.h"
+#endif
+
+#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
+#include "utils/log.h"
+#include "utils/RssManager.h"
+
+using namespace std;
+#ifdef HAS_JSONRPC
+using namespace JSONRPC;
+#endif // HAS_JSONRPC
+#ifdef HAS_EVENT_SERVER
+using namespace EVENTSERVER;
+#endif // HAS_EVENT_SERVER
+#ifdef HAS_UPNP
+using namespace UPNP;
+#endif // HAS_UPNP
+
+CNetworkServices::CNetworkServices()
+ :
+#ifdef HAS_WEB_SERVER
+ m_webserver(*new CWebServer),
+ m_httpImageHandler(*new CHTTPImageHandler),
+ m_httpVfsHandler(*new CHTTPVfsHandler)
+#ifdef HAS_JSONRPC
+ , m_httpJsonRpcHandler(*new CHTTPJsonRpcHandler)
+#endif // HAS_JSONRPC
+#ifdef HAS_WEB_INTERFACE
+ , m_httpWebinterfaceHandler(*new CHTTPWebinterfaceHandler)
+ , m_httpWebinterfaceAddonsHandler(*new CHTTPWebinterfaceAddonsHandler)
+#endif // HAS_WEB_INTERFACE
+#endif // HAS_WEB_SERVER
+{
+#ifdef HAS_WEB_SERVER
+ CWebServer::RegisterRequestHandler(&m_httpImageHandler);
+ CWebServer::RegisterRequestHandler(&m_httpVfsHandler);
+#ifdef HAS_JSONRPC
+ CWebServer::RegisterRequestHandler(&m_httpJsonRpcHandler);
+#endif // HAS_JSONRPC
+#ifdef HAS_WEB_INTERFACE
+ CWebServer::RegisterRequestHandler(&m_httpWebinterfaceAddonsHandler);
+ CWebServer::RegisterRequestHandler(&m_httpWebinterfaceHandler);
+#endif // HAS_WEB_INTERFACE
+#endif // HAS_WEB_SERVER
+}
+
+CNetworkServices::~CNetworkServices()
+{
+#ifdef HAS_WEB_SERVER
+ CWebServer::UnregisterRequestHandler(&m_httpImageHandler);
+ delete &m_httpImageHandler;
+ CWebServer::UnregisterRequestHandler(&m_httpVfsHandler);
+ delete &m_httpVfsHandler;
+#ifdef HAS_JSONRPC
+ CWebServer::UnregisterRequestHandler(&m_httpJsonRpcHandler);
+ delete &m_httpJsonRpcHandler;
+ CJSONRPC::Cleanup();
+#endif // HAS_JSONRPC
+#ifdef HAS_WEB_INTERFACE
+ CWebServer::UnregisterRequestHandler(&m_httpWebinterfaceAddonsHandler);
+ delete &m_httpWebinterfaceAddonsHandler;
+ CWebServer::UnregisterRequestHandler(&m_httpWebinterfaceHandler);
+ delete &m_httpWebinterfaceHandler;
+#endif // HAS_WEB_INTERFACE
+ delete &m_webserver;
+#endif // HAS_WEB_SERVER
+}
+
+CNetworkServices& CNetworkServices::Get()
+{
+ static CNetworkServices sNetworkServices;
+ return sNetworkServices;
+}
+
+bool CNetworkServices::OnSettingChanging(const CSetting *setting)
+{
+ if (setting == NULL)
+ return false;
+
+ const std::string &settingId = setting->GetId();
+#ifdef HAS_WEB_SERVER
+ if (settingId == "services.webserver" ||
+ settingId == "services.webserverport")
+ {
+ if (IsWebserverRunning() && !StopWebserver())
+ return false;
+
+ if (CSettings::Get().GetBool("services.webserver"))
+ {
+ if (!StartWebserver())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33101), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+ }
+ }
+ else if (settingId == "services.esport" ||
+ settingId == "services.webserverport")
+ return ValidatePort(((CSettingInt*)setting)->GetValue());
+ else
+#endif // HAS_WEB_SERVER
+
+#ifdef HAS_ZEROCONF
+ if (settingId == "services.zeroconf")
+ {
+ if (((CSettingBool*)setting)->GetValue())
+ return StartZeroconf();
+#ifdef HAS_AIRPLAY
+ else
+ {
+ // cannot disable
+ if (IsAirPlayServerRunning() || IsAirTunesServerRunning())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(1259), g_localizeStrings.Get(34303), g_localizeStrings.Get(34304), "");
+ return false;
+ }
+
+ return StopZeroconf();
+ }
+#endif // HAS_AIRPLAY
+ }
+ else
+#endif // HAS_ZEROCONF
+
+#ifdef HAS_AIRPLAY
+ if (settingId == "services.airplay")
+ {
+ if (((CSettingBool*)setting)->GetValue())
+ {
+#ifdef HAS_ZEROCONF
+ // AirPlay needs zeroconf
+ if (!CSettings::Get().GetBool("services.zeroconf"))
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(1273), g_localizeStrings.Get(33100), g_localizeStrings.Get(34302), "");
+ return false;
+ }
+#endif //HAS_ZEROCONF
+
+ if (!StartAirPlayServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(1273), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+
+ if (!CAirPlayServer::SetCredentials(CSettings::Get().GetBool("services.useairplaypassword"),
+ CSettings::Get().GetString("services.airplaypassword")))
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(1273), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+
+ if (!StartAirTunesServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(1274), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+ }
+ else
+ {
+ if (!StopAirPlayServer(true) || !StopAirTunesServer(true))
+ return false;
+ }
+ }
+ else if (settingId == "services.airplaypassword" ||
+ settingId == "services.useairplaypassword")
+ {
+ if (!CSettings::Get().GetBool("services.airplay"))
+ return false;
+
+ if (!CAirPlayServer::SetCredentials(CSettings::Get().GetBool("services.useairplaypassword"),
+ CSettings::Get().GetString("services.airplaypassword")))
+ return false;
+ }
+ else
+#endif //HAS_AIRPLAY
+
+#ifdef HAS_UPNP
+ if (settingId == "services.upnpserver")
+ {
+ if (((CSettingBool*)setting)->GetValue())
+ return StartUPnPServer();
+ else
+ return StopUPnPServer();
+ }
+ else if (settingId == "services.upnprenderer")
+ {
+ if (((CSettingBool*)setting)->GetValue())
+ return StartUPnPRenderer();
+ else
+ return StopUPnPRenderer();
+ }
+ else if (settingId == "services.upnpcontroller")
+ {
+ // always stop and restart
+ StopUPnPClient();
+ if (((CSettingBool*)setting)->GetValue())
+ return StartUPnPClient();
+ }
+ else
+#endif // HAS_UPNP
+
+ if (settingId == "services.esenabled")
+ {
+#ifdef HAS_EVENT_SERVER
+ if (((CSettingBool*)setting)->GetValue())
+ {
+ if (!StartEventServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+ }
+ else
+ return StopEventServer(true, true);
+#endif // HAS_EVENT_SERVER
+
+#ifdef HAS_JSONRPC
+ if (CSettings::Get().GetBool("services.esenabled"))
+ {
+ if (!StartJSONRPCServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33103), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+ }
+ else
+ return StopJSONRPCServer(false);
+#endif // HAS_JSONRPC
+ }
+ else if (settingId == "services.esport")
+ {
+#ifdef HAS_EVENT_SERVER
+ // restart eventserver without asking user
+ if (!StopEventServer(true, false))
+ return false;
+
+ if (!StartEventServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+
+#if defined(TARGET_DARWIN_OSX)
+ // reconfigure XBMCHelper for port changes
+ XBMCHelper::GetInstance().Configure();
+#endif // TARGET_DARWIN_OSX
+#endif // HAS_EVENT_SERVER
+ }
+ else if (settingId == "services.esallinterfaces")
+ {
+#ifdef HAS_EVENT_SERVER
+ if (CSettings::Get().GetBool("services.esenabled"))
+ {
+ if (!StopEventServer(true, true))
+ return false;
+
+ if (!StartEventServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33102), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+ }
+#endif // HAS_EVENT_SERVER
+
+#ifdef HAS_JSONRPC
+ if (CSettings::Get().GetBool("services.esenabled"))
+ {
+ if (!StartJSONRPCServer())
+ {
+ CGUIDialogOK::ShowAndGetInput(g_localizeStrings.Get(33103), "", g_localizeStrings.Get(33100), "");
+ return false;
+ }
+ }
+#endif // HAS_JSONRPC
+ }
+
+#ifdef HAS_EVENT_SERVER
+ else if (settingId == "services.esinitialdelay" ||
+ settingId == "services.escontinuousdelay")
+ {
+ if (CSettings::Get().GetBool("services.esenabled"))
+ return RefreshEventServer();
+ }
+#endif // HAS_EVENT_SERVER
+
+ return true;
+}
+
+void CNetworkServices::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+#ifdef HAS_WEB_SERVER
+ if (settingId == "services.webserverusername" ||
+ settingId == "services.webserverpassword")
+ {
+ m_webserver.SetCredentials(CSettings::Get().GetString("services.webserverusername"),
+ CSettings::Get().GetString("services.webserverpassword"));
+ }
+ else
+#endif // HAS_WEB_SERVER
+ if (settingId == "smb.winsserver" ||
+ settingId == "smb.workgroup")
+ {
+ // okey we really don't need to restart, 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))
+ {
+ CSettings::Get().Save();
+ CApplicationMessenger::Get().RestartApp();
+ }
+ }
+}
+
+void CNetworkServices::Start()
+{
+ StartZeroconf();
+ if (!StartWebserver())
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(33101), g_localizeStrings.Get(33100));
+ StartUPnP();
+ if (!StartEventServer())
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(33102), g_localizeStrings.Get(33100));
+ if (!StartJSONRPCServer())
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(33103), g_localizeStrings.Get(33100));
+ StartAirPlayServer();
+ StartAirTunesServer();
+ StartRss();
+}
+
+void CNetworkServices::Stop(bool bWait)
+{
+ if (bWait)
+ {
+ StopUPnP(bWait);
+ StopZeroconf();
+ StopWebserver();
+ StopRss();
+ }
+
+ StopEventServer(bWait, false);
+ StopJSONRPCServer(bWait);
+ StopAirPlayServer(bWait);
+ StopAirTunesServer(bWait);
+}
+
+bool CNetworkServices::StartWebserver()
+{
+#ifdef HAS_WEB_SERVER
+ if (!g_application.getNetwork().IsAvailable())
+ return false;
+
+ if (!CSettings::Get().GetBool("services.webserver"))
+ return false;
+
+ int webPort = CSettings::Get().GetInt("services.webserverport");
+ if (!ValidatePort(webPort))
+ {
+ CLog::Log(LOGERROR, "Cannot start Web Server on port %i", webPort);
+ return false;
+ }
+
+ if (IsWebserverRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "Webserver: Starting...");
+ if (!m_webserver.Start(webPort, CSettings::Get().GetString("services.webserverusername"), CSettings::Get().GetString("services.webserverpassword")))
+ return false;
+
+#ifdef HAS_ZEROCONF
+ std::vector<std::pair<std::string, std::string> > txt;
+ // publish web frontend and API services
+#ifdef HAS_WEB_INTERFACE
+ CZeroconf::GetInstance()->PublishService("servers.webserver", "_http._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), webPort, txt);
+#endif // HAS_WEB_INTERFACE
+#ifdef HAS_JSONRPC
+ CZeroconf::GetInstance()->PublishService("servers.jsonrpc-http", "_xbmc-jsonrpc-h._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), webPort, txt);
+#endif // HAS_JSONRPC
+#endif // HAS_ZEROCONF
+
+ return true;
+#endif // HAS_WEB_SERVER
+ return false;
+}
+
+bool CNetworkServices::IsWebserverRunning()
+{
+#ifdef HAS_WEB_SERVER
+ return m_webserver.IsStarted();
+#endif // HAS_WEB_SERVER
+ return false;
+}
+
+bool CNetworkServices::StopWebserver()
+{
+#ifdef HAS_WEB_SERVER
+ if (!IsWebserverRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "Webserver: Stopping...");
+ if (!m_webserver.Stop() || m_webserver.IsStarted())
+ {
+ CLog::Log(LOGWARNING, "Webserver: Failed to stop.");
+ return false;
+ }
+
+ CLog::Log(LOGNOTICE, "Webserver: Stopped...");
+#ifdef HAS_ZEROCONF
+#ifdef HAS_WEB_INTERFACE
+ CZeroconf::GetInstance()->RemoveService("servers.webserver");
+#endif // HAS_WEB_INTERFACE
+#ifdef HAS_JSONRPC
+ CZeroconf::GetInstance()->RemoveService("servers.jsonrpc-http");
+#endif // HAS_JSONRPC
+#endif // HAS_ZEROCONF
+
+ return true;
+#endif // HAS_WEB_SERVER
+ return false;
+}
+
+bool CNetworkServices::StartAirPlayServer()
+{
+#ifdef HAS_AIRPLAY
+ if (!g_application.getNetwork().IsAvailable() || !CSettings::Get().GetBool("services.airplay"))
+ return false;
+
+ if (IsAirPlayServerRunning())
+ return true;
+
+ if (!CAirPlayServer::StartServer(g_advancedSettings.m_airPlayPort, true))
+ return false;
+
+ if (!CAirPlayServer::SetCredentials(CSettings::Get().GetBool("services.useairplaypassword"),
+ CSettings::Get().GetString("services.airplaypassword")))
+ return false;
+
+#ifdef HAS_ZEROCONF
+ std::vector<std::pair<std::string, std::string> > txt;
+ CNetworkInterface* iface = g_application.getNetwork().GetFirstConnectedInterface();
+ txt.push_back(make_pair("deviceid", iface != NULL ? iface->GetMacAddress() : "FF:FF:FF:FF:FF:F2"));
+ txt.push_back(make_pair("features", "0x77"));
+ txt.push_back(make_pair("model", "Xbmc,1"));
+ txt.push_back(make_pair("srcvers", AIRPLAY_SERVER_VERSION_STR));
+ CZeroconf::GetInstance()->PublishService("servers.airplay", "_airplay._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), g_advancedSettings.m_airPlayPort, txt);
+#endif // HAS_ZEROCONF
+
+ return true;
+#endif // HAS_AIRPLAY
+ return false;
+}
+
+bool CNetworkServices::IsAirPlayServerRunning()
+{
+#ifdef HAS_AIRPLAY
+ return CAirPlayServer::IsRunning();
+#endif // HAS_AIRPLAY
+ return false;
+}
+
+bool CNetworkServices::StopAirPlayServer(bool bWait)
+{
+#ifdef HAS_AIRPLAY
+ if (!IsAirPlayServerRunning())
+ return true;
+
+ CAirPlayServer::StopServer(bWait);
+
+#ifdef HAS_ZEROCONF
+ CZeroconf::GetInstance()->RemoveService("servers.airplay");
+#endif // HAS_ZEROCONF
+
+ return true;
+#endif // HAS_AIRPLAY
+ return false;
+}
+
+bool CNetworkServices::StartAirTunesServer()
+{
+#ifdef HAS_AIRTUNES
+ if (!g_application.getNetwork().IsAvailable() || !CSettings::Get().GetBool("services.airplay"))
+ return false;
+
+ if (IsAirTunesServerRunning())
+ return true;
+
+ if (!CAirTunesServer::StartServer(g_advancedSettings.m_airTunesPort, true,
+ CSettings::Get().GetBool("services.useairplaypassword"),
+ CSettings::Get().GetString("services.airplaypassword")))
+ {
+ CLog::Log(LOGERROR, "Failed to start AirTunes Server");
+ return false;
+ }
+
+ return true;
+#endif // HAS_AIRTUNES
+ return false;
+}
+
+bool CNetworkServices::IsAirTunesServerRunning()
+{
+#ifdef HAS_AIRTUNES
+ return CAirTunesServer::IsRunning();
+#endif // HAS_AIRTUNES
+ return false;
+}
+
+bool CNetworkServices::StopAirTunesServer(bool bWait)
+{
+#ifdef HAS_AIRTUNES
+ if (!IsAirTunesServerRunning())
+ return true;
+
+ CAirTunesServer::StopServer(bWait);
+ return true;
+#endif // HAS_AIRTUNES
+ return false;
+}
+
+bool CNetworkServices::StartJSONRPCServer()
+{
+#ifdef HAS_JSONRPC
+ if (!CSettings::Get().GetBool("services.esenabled"))
+ return false;
+
+ if (IsJSONRPCServerRunning())
+ return true;
+
+ if (!CTCPServer::StartServer(g_advancedSettings.m_jsonTcpPort, CSettings::Get().GetBool("services.esallinterfaces")))
+ return false;
+
+#ifdef HAS_ZEROCONF
+ std::vector<std::pair<std::string, std::string> > txt;
+ CZeroconf::GetInstance()->PublishService("servers.jsonrpc-tpc", "_xbmc-jsonrpc._tcp", g_infoManager.GetLabel(SYSTEM_FRIENDLY_NAME), g_advancedSettings.m_jsonTcpPort, txt);
+#endif // HAS_ZEROCONF
+
+ return true;
+#endif // HAS_JSONRPC
+ return false;
+}
+
+bool CNetworkServices::IsJSONRPCServerRunning()
+{
+#ifdef HAS_JSONRPC
+ return CTCPServer::IsRunning();
+#endif // HAS_JSONRPC
+ return false;
+}
+
+bool CNetworkServices::StopJSONRPCServer(bool bWait)
+{
+#ifdef HAS_JSONRPC
+ if (!IsJSONRPCServerRunning())
+ return true;
+
+ CTCPServer::StopServer(bWait);
+
+#ifdef HAS_ZEROCONF
+ CZeroconf::GetInstance()->RemoveService("servers.jsonrpc-tcp");
+#endif // HAS_ZEROCONF
+
+ return true;
+#endif // HAS_JSONRPC
+ return false;
+}
+
+bool CNetworkServices::StartEventServer()
+{
+#ifdef HAS_EVENT_SERVER
+ if (!CSettings::Get().GetBool("services.esenabled"))
+ return false;
+
+ if (IsEventServerRunning())
+ return true;
+
+ CEventServer* server = CEventServer::GetInstance();
+ if (!server)
+ {
+ CLog::Log(LOGERROR, "ES: Out of memory");
+ return false;
+ }
+
+ CLog::Log(LOGNOTICE, "ES: Starting event server");
+ server->StartServer();
+
+ return true;
+#endif // HAS_EVENT_SERVER
+ return false;
+}
+
+bool CNetworkServices::IsEventServerRunning()
+{
+#ifdef HAS_EVENT_SERVER
+ return CEventServer::GetInstance()->Running();
+#endif // HAS_EVENT_SERVER
+ return false;
+}
+
+bool CNetworkServices::StopEventServer(bool bWait, bool promptuser)
+{
+#ifdef HAS_EVENT_SERVER
+ if (!IsEventServerRunning())
+ return true;
+
+ CEventServer* server = CEventServer::GetInstance();
+ if (!server)
+ {
+ CLog::Log(LOGERROR, "ES: Out of memory");
+ return false;
+ }
+
+ if (promptuser)
+ {
+ if (server->GetNumberOfClients() > 0)
+ {
+ bool cancelled = false;
+ if (!CGUIDialogYesNo::ShowAndGetInput(13140, 13141, 13142, 20022,
+ -1, -1, cancelled, 10000)
+ || cancelled)
+ {
+ CLog::Log(LOGNOTICE, "ES: Not stopping event server");
+ return false;
+ }
+ }
+ CLog::Log(LOGNOTICE, "ES: Stopping event server with confirmation");
+
+ CEventServer::GetInstance()->StopServer(true);
+ }
+ else
+ {
+ if (!bWait)
+ CLog::Log(LOGNOTICE, "ES: Stopping event server");
+
+ CEventServer::GetInstance()->StopServer(bWait);
+ }
+
+ return true;
+#endif // HAS_EVENT_SERVER
+ return false;
+}
+
+bool CNetworkServices::RefreshEventServer()
+{
+#ifdef HAS_EVENT_SERVER
+ if (!CSettings::Get().GetBool("services.esenabled"))
+ return false;
+
+ if (!IsEventServerRunning())
+ return false;
+
+ CEventServer::GetInstance()->RefreshSettings();
+ return true;
+#endif // HAS_EVENT_SERVER
+ return false;
+}
+
+bool CNetworkServices::StartUPnP()
+{
+ bool ret = false;
+#ifdef HAS_UPNP
+ ret |= StartUPnPClient();
+ ret |= StartUPnPServer();
+ ret |= StartUPnPRenderer();
+ return true;
+#endif // HAS_UPNP
+ return ret;
+}
+
+bool CNetworkServices::StopUPnP(bool bWait)
+{
+#ifdef HAS_UPNP
+ if (!CUPnP::IsInstantiated())
+ return true;
+
+ CLog::Log(LOGNOTICE, "stopping upnp");
+ CUPnP::ReleaseInstance(bWait);
+
+ return true;
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StartUPnPClient()
+{
+#ifdef HAS_UPNP
+ if (!CSettings::Get().GetBool("services.upnpcontroller"))
+ return false;
+
+ CLog::Log(LOGNOTICE, "starting upnp controller");
+ CUPnP::GetInstance()->StartClient();
+ return IsUPnPClientRunning();
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::IsUPnPClientRunning()
+{
+#ifdef HAS_UPNP
+ return CUPnP::GetInstance()->IsClientStarted();
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StopUPnPClient()
+{
+#ifdef HAS_UPNP
+ if (!IsUPnPRendererRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "stopping upnp client");
+ CUPnP::GetInstance()->StopClient();
+
+ return true;
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StartUPnPRenderer()
+{
+#ifdef HAS_UPNP
+ if (!CSettings::Get().GetBool("services.upnprenderer"))
+ return false;
+
+ CLog::Log(LOGNOTICE, "starting upnp renderer");
+ return CUPnP::GetInstance()->StartRenderer();
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::IsUPnPRendererRunning()
+{
+#ifdef HAS_UPNP
+ return CUPnP::GetInstance()->IsInstantiated();
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StopUPnPRenderer()
+{
+#ifdef HAS_UPNP
+ if (!IsUPnPRendererRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "stopping upnp renderer");
+ CUPnP::GetInstance()->StopRenderer();
+
+ return true;
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StartUPnPServer()
+{
+#ifdef HAS_UPNP
+ if (!CSettings::Get().GetBool("services.upnpserver"))
+ return false;
+
+ CLog::Log(LOGNOTICE, "starting upnp server");
+ return CUPnP::GetInstance()->StartServer();
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::IsUPnPServerRunning()
+{
+#ifdef HAS_UPNP
+ return CUPnP::GetInstance()->IsInstantiated();
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StopUPnPServer()
+{
+#ifdef HAS_UPNP
+ if (!IsUPnPRendererRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "stopping upnp server");
+ CUPnP::GetInstance()->StopServer();
+
+ return true;
+#endif // HAS_UPNP
+ return false;
+}
+
+bool CNetworkServices::StartRss()
+{
+ if (IsRssRunning())
+ return true;
+
+ CRssManager::Get().Start();
+ return true;
+}
+
+bool CNetworkServices::IsRssRunning()
+{
+ return CRssManager::Get().IsActive();
+}
+
+bool CNetworkServices::StopRss()
+{
+ if (!IsRssRunning())
+ return true;
+
+ CRssManager::Get().Stop();
+ return true;
+}
+
+bool CNetworkServices::StartZeroconf()
+{
+#ifdef HAS_ZEROCONF
+ if (!CSettings::Get().GetBool("services.zeroconf"))
+ return false;
+
+ if (IsZeroconfRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "starting zeroconf publishing");
+ return CZeroconf::GetInstance()->Start();
+#endif // HAS_ZEROCONF
+ return false;
+}
+
+bool CNetworkServices::IsZeroconfRunning()
+{
+#ifdef HAS_ZEROCONF
+ return CZeroconf::GetInstance()->IsInstantiated();
+#endif // HAS_ZEROCONF
+ return false;
+}
+
+bool CNetworkServices::StopZeroconf()
+{
+#ifdef HAS_ZEROCONF
+ if (!IsZeroconfRunning())
+ return true;
+
+ CLog::Log(LOGNOTICE, "stopping zeroconf publishing");
+ CZeroconf::GetInstance()->Stop();
+
+ return true;
+#endif // HAS_ZEROCONF
+ return false;
+}
+
+bool CNetworkServices::ValidatePort(int port)
+{
+ if (port <= 0 || port > 65535)
+ return false;
+
+#ifdef TARGET_LINUX
+ if (!CUtil::CanBindPrivileged() && (port < 1024 || port > 65535))
+ return false;
+#endif
+
+ return true;
+}
--- /dev/null
+#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 "system.h"
+#include "settings/ISettingCallback.h"
+
+#ifdef HAS_WEB_SERVER
+class CWebServer;
+class CHTTPImageHandler;
+class CHTTPVfsHandler;
+#ifdef HAS_JSONRPC
+class CHTTPJsonRpcHandler;
+#endif // HAS_JSONRPC
+#ifdef HAS_WEB_INTERFACE
+class CHTTPWebinterfaceHandler;
+class CHTTPWebinterfaceAddonsHandler;
+#endif // HAS_WEB_INTERFACE
+#endif // HAS_WEB_SERVER
+
+class CNetworkServices : public ISettingCallback
+{
+public:
+ static CNetworkServices& Get();
+
+ virtual bool OnSettingChanging(const CSetting *setting);
+ virtual void OnSettingChanged(const CSetting *setting);
+
+ void Start();
+ void Stop(bool bWait);
+
+ bool StartWebserver();
+ bool IsWebserverRunning();
+ bool StopWebserver();
+
+ bool StartAirPlayServer();
+ bool IsAirPlayServerRunning();
+ bool StopAirPlayServer(bool bWait);
+ bool StartAirTunesServer();
+ bool IsAirTunesServerRunning();
+ bool StopAirTunesServer(bool bWait);
+
+ bool StartJSONRPCServer();
+ bool IsJSONRPCServerRunning();
+ bool StopJSONRPCServer(bool bWait);
+
+ bool StartEventServer();
+ bool IsEventServerRunning();
+ bool StopEventServer(bool bWait, bool promptuser);
+ bool RefreshEventServer();
+
+ bool StartUPnP();
+ bool StopUPnP(bool bWait);
+ bool StartUPnPClient();
+ bool IsUPnPClientRunning();
+ bool StopUPnPClient();
+ bool StartUPnPRenderer();
+ bool IsUPnPRendererRunning();
+ bool StopUPnPRenderer();
+ bool StartUPnPServer();
+ bool IsUPnPServerRunning();
+ bool StopUPnPServer();
+
+ bool StartRss();
+ bool IsRssRunning();
+ bool StopRss();
+
+ bool StartZeroconf();
+ bool IsZeroconfRunning();
+ bool StopZeroconf();
+
+private:
+ CNetworkServices();
+ CNetworkServices(const CNetworkServices&);
+ CNetworkServices const& operator=(CNetworkServices const&);
+ virtual ~CNetworkServices();
+
+ bool ValidatePort(int port);
+
+#ifdef HAS_WEB_SERVER
+ CWebServer& m_webserver;
+ CHTTPImageHandler& m_httpImageHandler;
+ CHTTPVfsHandler& m_httpVfsHandler;
+#ifdef HAS_JSONRPC
+ CHTTPJsonRpcHandler& m_httpJsonRpcHandler;
+#endif
+#ifdef HAS_WEB_INTERFACE
+ CHTTPWebinterfaceHandler& m_httpWebinterfaceHandler;
+ CHTTPWebinterfaceAddonsHandler& m_httpWebinterfaceAddonsHandler;
+#endif
+#endif
+};
}
}
+bool CTCPServer::IsRunning()
+{
+ if (ServerInstance == NULL)
+ return false;
+
+ return ((CThread*)ServerInstance)->IsRunning();
+}
+
CTCPServer::CTCPServer(int port, bool nonlocal) : CThread("TCPServer")
{
m_port = port;
public:
static bool StartServer(int port, bool nonlocal);
static void StopServer(bool bWait);
+ static bool IsRunning();
virtual bool PrepareDownload(const char *path, CVariant &details, std::string &protocol);
virtual bool Download(const char *path, CVariant &result);
#include "WebServer.h"
#ifdef HAS_WEB_SERVER
+#include "URL.h"
+#include "XBDateTime.h"
#include "filesystem/File.h"
+#include "settings/Settings.h"
+#include "threads/SingleLock.h"
+#include "utils/Base64.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
#include "utils/Variant.h"
-#include "utils/Base64.h"
-#include "threads/SingleLock.h"
-#include "XBDateTime.h"
-#include "URL.h"
#ifdef _WIN32
#pragma comment(lib, "libmicrohttpd.dll.lib")
#include <stdio.h>
#include <stdint.h>
#include <vector>
+
#include "interfaces/json-rpc/ITransportLayer.h"
+#include "network/httprequesthandler/IHTTPRequestHandler.h"
#include "threads/CriticalSection.h"
-#include "httprequesthandler/IHTTPRequestHandler.h"
class CWebServer : public JSONRPC::ITransportLayer
{
static std::string GetRequestHeaderValue(struct MHD_Connection *connection, enum MHD_ValueKind kind, const std::string &key);
static int GetRequestHeaderValues(struct MHD_Connection *connection, enum MHD_ValueKind kind, std::map<std::string, std::string> &headerValues);
static int GetRequestHeaderValues(struct MHD_Connection *connection, enum MHD_ValueKind kind, std::multimap<std::string, std::string> &headerValues);
+
private:
struct MHD_Daemon* StartMHD(unsigned int flags, int port);
static int AskForAuthentication (struct MHD_Connection *connection);
*/
#include "system.h" //HAS_ZEROCONF define
#include "Zeroconf.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#ifdef _LINUX
#if !defined(TARGET_DARWIN)
const std::string& fcr_type,
const std::string& fcr_name,
unsigned int f_port,
- const std::vector<std::pair<std::string, std::string> >& txt)
+ std::vector<std::pair<std::string, std::string> > txt /* = std::vector<std::pair<std::string, std::string> >() */)
{
CSingleLock lock(*mp_crit_sec);
CZeroconf::PublishInfo info = {fcr_type, fcr_name, f_port, txt};
return (m_service_map.find(fcr_identifier) != m_service_map.end());
}
-void CZeroconf::Start()
+bool CZeroconf::Start()
{
CSingleLock lock(*mp_crit_sec);
if(!IsZCdaemonRunning())
{
- g_guiSettings.SetBool("services.zeroconf", false);
- if (g_guiSettings.GetBool("services.airplay"))
- g_guiSettings.SetBool("services.airplay", false);
- return;
+ CSettings::Get().SetBool("services.zeroconf", false);
+ if (CSettings::Get().GetBool("services.airplay"))
+ CSettings::Get().SetBool("services.airplay", false);
+ return false;
}
if(m_started)
- return;
+ return true;
m_started = true;
CJobManager::GetInstance().AddJob(new CPublish(m_service_map), NULL);
+ return true;
}
void CZeroconf::Stop()
const std::string& fcr_type,
const std::string& fcr_name,
unsigned int f_port,
- const std::vector<std::pair<std::string, std::string> >& txt);
+ std::vector<std::pair<std::string, std::string> > txt /*= std::vector<std::pair<std::string, std::string> >()*/);
///removes the specified service
///returns false if fcr_identifier does not exist
//starts publishing
//services that were added with PublishService(...) while Zeroconf wasn't
//started, get published now.
- void Start();
+ bool Start();
// unpublishs all services (but keeps them stored in this class)
// a call to Start() will republish them
#include "Platinum.h"
#include "URL.h"
#include "profiles/ProfilesManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "GUIUserMessages.h"
#include "FileItem.h"
#include "guilib/GUIWindowManager.h"
m_MediaBrowser = new CMediaBrowser(m_CtrlPointHolder->m_CtrlPoint);
// start controller
- if (g_guiSettings.GetBool("services.upnpcontroller")) {
+ if (CSettings::Get().GetBool("services.upnpcontroller")) {
m_MediaController = new CMediaController(m_CtrlPointHolder->m_CtrlPoint);
}
}
// but it doesn't work anyways as it requires multicast for XP to detect us
device->m_PresentationURL =
NPT_HttpUrl(m_IP,
- atoi(g_guiSettings.GetString("services.webserverport")),
+ CSettings::Get().GetInt("services.webserverport"),
"/").ToString();
device->m_ModelName = "XBMC Media Center";
/*----------------------------------------------------------------------
| CUPnP::StartServer
+---------------------------------------------------------------------*/
-void
+bool
CUPnP::StartServer()
{
- if (!m_ServerHolder->m_Device.IsNull()) return;
+ if (!m_ServerHolder->m_Device.IsNull()) return false;
- // load upnpserver.xml so that g_settings.m_vecUPnPMusiCMediaSources, etc.. are loaded
+ // load upnpserver.xml
CStdString filename;
URIUtils::AddFileToFolder(CProfilesManager::Get().GetUserDataFolder(), "upnpserver.xml", filename);
CUPnPSettings::Get().Load(filename);
// save UUID
CUPnPSettings::Get().SetServerUUID(m_ServerHolder->m_Device->GetUUID().GetChars());
- CUPnPSettings::Get().Save(filename);
+ return CUPnPSettings::Get().Save(filename);
}
/*----------------------------------------------------------------------
device->m_PresentationURL =
NPT_HttpUrl(m_IP,
- atoi(g_guiSettings.GetString("services.webserverport")),
+ CSettings::Get().GetInt("services.webserverport"),
"/").ToString();
device->m_ModelName = "XBMC Media Center";
device->m_ModelNumber = g_infoManager.GetVersion().c_str();
/*----------------------------------------------------------------------
| CUPnP::StartRenderer
+---------------------------------------------------------------------*/
-void CUPnP::StartRenderer()
+bool CUPnP::StartRenderer()
{
- if (!m_RendererHolder->m_Device.IsNull()) return;
+ if (!m_RendererHolder->m_Device.IsNull()) return false;
CStdString filename;
URIUtils::AddFileToFolder(CProfilesManager::Get().GetUserDataFolder(), "upnpserver.xml", filename);
// save UUID
CUPnPSettings::Get().SetRendererUUID(m_RendererHolder->m_Device->GetUUID().GetChars());
- CUPnPSettings::Get().Save(filename);
+ return CUPnPSettings::Get().Save(filename);
}
/*----------------------------------------------------------------------
~CUPnP();
// server
- void StartServer();
+ bool StartServer();
void StopServer();
// client
bool IsClientStarted() { return (m_MediaBrowser != NULL); }
// renderer
- void StartRenderer();
+ bool StartRenderer();
void StopRenderer();
void UpdateState();
#include "guilib/WindowIDs.h"
#include "music/tags/MusicInfoTag.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/md5.h"
#include "utils/StringUtils.h"
string buffer;
map<string,pair<bool, unsigned long> >::iterator itr;
- if (m_scanning || !g_guiSettings.GetBool("services.upnpannounce"))
+ if (m_scanning || !CSettings::Get().GetBool("services.upnpannounce"))
return;
NPT_CHECK_LABEL(FindServiceById("urn:upnp-org:serviceId:ContentDirectory", service), failed);
#include "threads/Event.h"
#include "Application.h"
#include "WindowingFactory.h"
-#include "Settings.h"
+#include "settings/DisplaySettings.h"
#undef BOOL
#import <Foundation/Foundation.h>
#include "PlatformDefs.h"
#include "Util.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogYesNo.h"
#include "utils/log.h"
#include "system.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/SystemInfo.h"
#include "threads/Atomics.h"
}
/////////////////////////////////////////////////////////////////////////////
+bool XBMCHelper::OnSettingChanging(const CSetting *setting)
+{
+ if (setting == NULL)
+ return false;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "input.appleremotemode")
+ {
+ int remoteMode = ((CSettingInt*)setting)->GetValue();
+
+ // if it's not disabled, start the event server or else apple remote won't work
+ if (remoteMode != APPLE_REMOTE_DISABLED)
+ {
+ // if starting the event server fails, we have to revert the change
+ if (!CSettings::Get().SetBool("services.esenabled", true))
+ return false;
+ }
+
+ // if XBMC helper is running, prompt user before effecting change
+ if (IsRunning() && GetMode() != remoteMode)
+ {
+ bool cancelled;
+ if (!CGUIDialogYesNo::ShowAndGetInput(13144, 13145, 13146, 13147, -1, -1, cancelled, 10000))
+ return false;
+ // reload configuration
+ else
+ Configure();
+ }
+ // set new configuration.
+ else
+ Configure();
+
+ if (ErrorStarting() == true)
+ {
+ // inform user about error
+ CGUIDialogOK::ShowAndGetInput(13620, 13621, 20022, 20022);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/////////////////////////////////////////////////////////////////////////////
void XBMCHelper::Start()
{
int pid = GetProcessPid(XBMC_HELPER_PROGRAM);
// Read the new configuration.
m_errorStarting = false;
- m_mode = g_guiSettings.GetInt("input.appleremotemode");
- m_sequenceDelay = g_guiSettings.GetInt("input.appleremotesequencetime");
- m_alwaysOn = g_guiSettings.GetBool("input.appleremotealwayson");
- CStdString port_string = g_guiSettings.GetString("services.esport");
+ m_mode = CSettings::Get().GetInt("input.appleremotemode");
+ m_sequenceDelay = CSettings::Get().GetInt("input.appleremotesequencetime");
+ m_alwaysOn = CSettings::Get().GetBool("input.appleremotealwayson");
+ CStdString port_string = CSettings::Get().GetString("services.esport");
m_port = atoi(port_string.c_str());
m_errorStarting = true;
m_mode = APPLE_REMOTE_DISABLED;
- g_guiSettings.SetInt("input.appleremotemode", APPLE_REMOTE_DISABLED);
+ CSettings::Get().SetInt("input.appleremotemode", APPLE_REMOTE_DISABLED);
}
// New configuration.
*/
#if !defined(__arm__)
-class XBMCHelper
+
+#include "settings/ISettingCallback.h"
+
+enum AppleRemoteOptions
{
- public:
+ APPLE_REMOTE_DISABLED = 0,
+ APPLE_REMOTE_STANDARD,
+ APPLE_REMOTE_UNIVERSAL,
+ APPLE_REMOTE_MULTIREMOTE
+};
+class XBMCHelper : public ISettingCallback
+{
+ public:
static XBMCHelper& GetInstance();
+ virtual bool OnSettingChanging(const CSetting *setting);
+
void Start();
void Stop();
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/XMLUtils.h"
-#include "settings/GUISettings.h"
#include "utils/XBMCTinyXML.h"
#include "filesystem/Directory.h"
#include "guilib/GUIWindowManager.h"
#include "utils/StringUtils.h"
#include "Util.h"
#include "guilib/Key.h"
+#include "settings/Setting.h"
using namespace PERIPHERALS;
using namespace XFILE;
CPeripherals::CPeripherals(void)
{
- CDirectory::Create("special://profile/peripheral_data");
-
Clear();
}
{
m_bIsStarted = true;
+ CDirectory::Create("special://profile/peripheral_data");
+
/* load mappings from peripherals.xml */
LoadMappings();
void CPeripherals::GetSettingsFromMappingsFile(TiXmlElement *xmlNode, map<CStdString, CSetting *> &m_settings)
{
TiXmlElement *currentNode = xmlNode->FirstChildElement("setting");
- int iMaxOrder(0);
-
while (currentNode)
{
CSetting *setting = NULL;
bool bValue = (strcmp(currentNode->Attribute("value"), "no") != 0 &&
strcmp(currentNode->Attribute("value"), "false") != 0 &&
strcmp(currentNode->Attribute("value"), "0") != 0);
- setting = new CSettingBool(0, strKey, iLabelId, bValue, CHECKMARK_CONTROL);
+ setting = new CSettingBool(strKey, iLabelId, bValue);
}
else if (strSettingsType.Equals("int"))
{
int iStep = currentNode->Attribute("step") ? atoi(currentNode->Attribute("step")) : 1;
int iMax = currentNode->Attribute("max") ? atoi(currentNode->Attribute("max")) : 255;
CStdString strFormat(currentNode->Attribute("format"));
- setting = new CSettingInt(0, strKey, iLabelId, iValue, iMin, iStep, iMax, SPIN_CONTROL_INT, strFormat);
+ setting = new CSettingInt(strKey, iLabelId, iValue, iMin, iStep, iMax, strFormat);
}
else if (strSettingsType.Equals("float"))
{
float fMin = currentNode->Attribute("min") ? (float) atof(currentNode->Attribute("min")) : 0;
float fStep = currentNode->Attribute("step") ? (float) atof(currentNode->Attribute("step")) : 0;
float fMax = currentNode->Attribute("max") ? (float) atof(currentNode->Attribute("max")) : 0;
- setting = new CSettingFloat(0, strKey, iLabelId, fValue, fMin, fStep, fMax, SPIN_CONTROL_FLOAT);
+ setting = new CSettingNumber(strKey, iLabelId, fValue, fMin, fStep, fMax);
}
else if (strSettingsType.Equals("enum"))
{
CStdString strEnums(currentNode->Attribute("lvalues"));
if (!strEnums.IsEmpty())
{
- map<int,int> enums;
+ vector< pair<int,int> > enums;
vector<CStdString> valuesVec;
CUtil::Tokenize(strEnums, valuesVec, "|");
for (unsigned int i = 0; i < valuesVec.size(); i++)
- enums.insert(make_pair(atoi(valuesVec[i]), atoi(valuesVec[i])));
+ enums.push_back(make_pair(atoi(valuesVec[i]), atoi(valuesVec[i])));
int iValue = currentNode->Attribute("value") ? atoi(currentNode->Attribute("value")) : 0;
- setting = new CSettingInt(0, strKey, iLabelId, iValue, enums, SPIN_CONTROL_TEXT);
+ setting = new CSettingInt(strKey, iLabelId, iValue, enums);
}
}
else
{
CStdString strValue(currentNode->Attribute("value"));
- setting = new CSettingString(0, strKey, iLabelId, strValue, EDIT_CONTROL_INPUT, !bConfigurable, -1);
+ setting = new CSettingString(strKey, iLabelId, strValue);
}
if (setting)
/* set the visibility */
setting->SetVisible(bConfigurable);
- /* set the order */
- int iOrder(0);
- currentNode->Attribute("order", &iOrder);
- /* if the order attribute is invalid or 0, then the setting will be added at the end */
- if (iOrder < 0)
- iOrder = 0;
- setting->SetOrder(iOrder);
- if (iOrder > iMaxOrder)
- iMaxOrder = iOrder;
-
/* and add this new setting */
m_settings[strKey] = setting;
}
currentNode = currentNode->NextSiblingElement("setting");
}
-
- /* add the settings without an order attribute or an invalid order attribute set at the end */
- for (map<CStdString, CSetting *>::iterator it = m_settings.begin(); it != m_settings.end(); it++)
- {
- if (it->second->GetOrder() == 0)
- it->second->SetOrder(++iMaxOrder);
- }
}
void CPeripherals::GetDirectory(const CStdString &strPath, CFileItemList &items) const
return false;
}
+
+void CPeripherals::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "locale.language")
+ {
+ // 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);
+ }
+ }
+}
+
+void CPeripherals::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "input.peripherals")
+ {
+ CGUIDialogPeripheralManager *dialog = (CGUIDialogPeripheralManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PERIPHERAL_MANAGER);
+ if (dialog != NULL)
+ dialog->DoModal();
+ }
+}
#include "system.h"
#include "bus/PeripheralBus.h"
#include "devices/Peripheral.h"
+#include "settings/ISettingCallback.h"
#include "threads/CriticalSection.h"
#include "threads/Thread.h"
{
#define g_peripherals CPeripherals::Get()
- class CPeripherals
+ class CPeripherals : public ISettingCallback
{
public:
static CPeripherals &Get(void);
return false;
#endif
}
+
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
private:
CPeripherals(void);
#include "peripherals/Peripherals.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
-#include "settings/GUISettings.h"
+#include "settings/Setting.h"
#include "utils/XBMCTinyXML.h"
#include "utils/URIUtils.h"
#include "guilib/LocalizeStrings.h"
using namespace PERIPHERALS;
using namespace std;
-struct SortBySettingsOrder
-{
- bool operator()(const CSetting *left, const CSetting *right)
- {
- return left->GetOrder() < right->GetOrder();
- }
-};
-
CPeripheral::CPeripheral(const PeripheralScanResult& scanResult) :
m_type(scanResult.m_mappedType),
m_busType(scanResult.m_busType),
vector<CSetting *> settings;
for (map<CStdString, CSetting *>::const_iterator it = m_settings.begin(); it != m_settings.end(); it++)
settings.push_back(it->second);
- sort(settings.begin(), settings.end(), SortBySettingsOrder());
return settings;
}
{
switch(setting->GetType())
{
- case SETTINGS_TYPE_BOOL:
+ case SettingTypeBool:
{
const CSettingBool *mappedSetting = (const CSettingBool *) setting;
- CSettingBool *boolSetting = new CSettingBool(mappedSetting->GetOrder(), strKey.c_str(), mappedSetting->GetLabel(), mappedSetting->GetData(), mappedSetting->GetControlType());
+ CSettingBool *boolSetting = new CSettingBool(strKey, *mappedSetting);
if (boolSetting)
{
boolSetting->SetVisible(mappedSetting->IsVisible());
}
}
break;
- case SETTINGS_TYPE_INT:
+ case SettingTypeInteger:
{
const CSettingInt *mappedSetting = (const CSettingInt *) setting;
- CSettingInt *intSetting(NULL);
- if (mappedSetting->GetControlType() == SPIN_CONTROL_INT)
- {
- intSetting = new CSettingInt(mappedSetting->GetOrder(), strKey.c_str(), mappedSetting->GetLabel(), mappedSetting->GetData(), mappedSetting->m_iMin, mappedSetting->m_iStep, mappedSetting->m_iMax, mappedSetting->GetControlType(), mappedSetting->m_strFormat);
- }
- else if (mappedSetting->GetControlType() == SPIN_CONTROL_TEXT)
- {
- intSetting = new CSettingInt(mappedSetting->GetOrder(), strKey.c_str(), mappedSetting->GetLabel(), mappedSetting->GetData(), mappedSetting->m_entries, mappedSetting->GetControlType());
- }
+ CSettingInt *intSetting = new CSettingInt(strKey, *mappedSetting);
if (intSetting)
{
intSetting->SetVisible(mappedSetting->IsVisible());
}
}
break;
- case SETTINGS_TYPE_FLOAT:
+ case SettingTypeNumber:
{
- const CSettingFloat *mappedSetting = (const CSettingFloat *) setting;
- CSettingFloat *floatSetting = new CSettingFloat(mappedSetting->GetOrder(), strKey.c_str(), mappedSetting->GetLabel(), mappedSetting->GetData(), mappedSetting->m_fMin, mappedSetting->m_fStep, mappedSetting->m_fMax, mappedSetting->GetControlType());
+ const CSettingNumber *mappedSetting = (const CSettingNumber *) setting;
+ CSettingNumber *floatSetting = new CSettingNumber(strKey, *mappedSetting);
if (floatSetting)
{
floatSetting->SetVisible(mappedSetting->IsVisible());
}
}
break;
- case SETTINGS_TYPE_STRING:
+ case SettingTypeString:
{
const CSettingString *mappedSetting = (const CSettingString *) setting;
- CSettingString *stringSetting = new CSettingString(mappedSetting->GetOrder(), strKey.c_str(), mappedSetting->GetLabel(), mappedSetting->GetData().c_str(), mappedSetting->GetControlType(), mappedSetting->m_bAllowEmpty, mappedSetting->m_iHeadingString);
+ CSettingString *stringSetting = new CSettingString(strKey, *mappedSetting);
if (stringSetting)
{
stringSetting->SetVisible(mappedSetting->IsVisible());
bool CPeripheral::GetSettingBool(const CStdString &strKey) const
{
map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_BOOL)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeBool)
{
- CSettingBool *boolSetting = (CSettingBool *) (*it).second;
+ CSettingBool *boolSetting = (CSettingBool *) (*it).second;
if (boolSetting)
- return boolSetting->GetData();
+ return boolSetting->GetValue();
}
return false;
int CPeripheral::GetSettingInt(const CStdString &strKey) const
{
map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_INT)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeInteger)
{
- CSettingInt *intSetting = (CSettingInt *) (*it).second;
+ CSettingInt *intSetting = (CSettingInt *) (*it).second;
if (intSetting)
- return intSetting->GetData();
+ return intSetting->GetValue();
}
return 0;
float CPeripheral::GetSettingFloat(const CStdString &strKey) const
{
map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_FLOAT)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeNumber)
{
- CSettingFloat *floatSetting = (CSettingFloat *) (*it).second;
+ CSettingNumber *floatSetting = (CSettingNumber *) (*it).second;
if (floatSetting)
- return floatSetting->GetData();
+ return (float)floatSetting->GetValue();
}
return 0;
const CStdString CPeripheral::GetSettingString(const CStdString &strKey) const
{
map<CStdString, CSetting *>::const_iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_STRING)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeString)
{
- CSettingString *stringSetting = (CSettingString *) (*it).second;
+ CSettingString *stringSetting = (CSettingString *) (*it).second;
if (stringSetting)
- return stringSetting->GetData();
+ return stringSetting->GetValue();
}
return StringUtils::EmptyString;
{
bool bChanged(false);
map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_BOOL)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeBool)
{
- CSettingBool *boolSetting = (CSettingBool *) (*it).second;
+ CSettingBool *boolSetting = (CSettingBool *) (*it).second;
if (boolSetting)
{
- bChanged = boolSetting->GetData() != bValue;
- boolSetting->SetData(bValue);
+ bChanged = boolSetting->GetValue() != bValue;
+ boolSetting->SetValue(bValue);
if (bChanged && m_bInitialised)
m_changedSettings.insert(strKey);
}
{
bool bChanged(false);
map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_INT)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeInteger)
{
- CSettingInt *intSetting = (CSettingInt *) (*it).second;
+ CSettingInt *intSetting = (CSettingInt *) (*it).second;
if (intSetting)
{
- bChanged = intSetting->GetData() != iValue;
- intSetting->SetData(iValue);
+ bChanged = intSetting->GetValue() != iValue;
+ intSetting->SetValue(iValue);
if (bChanged && m_bInitialised)
m_changedSettings.insert(strKey);
}
{
bool bChanged(false);
map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
- if (it != m_settings.end() && (*it).second->GetType() == SETTINGS_TYPE_FLOAT)
+ if (it != m_settings.end() && (*it).second->GetType() == SettingTypeNumber)
{
- CSettingFloat *floatSetting = (CSettingFloat *) (*it).second;
+ CSettingNumber *floatSetting = (CSettingNumber *) (*it).second;
if (floatSetting)
{
- bChanged = floatSetting->GetData() != fValue;
- floatSetting->SetData(fValue);
+ bChanged = floatSetting->GetValue() != fValue;
+ floatSetting->SetValue(fValue);
if (bChanged && m_bInitialised)
m_changedSettings.insert(strKey);
}
map<CStdString, CSetting *>::iterator it = m_settings.find(strKey);
if (it != m_settings.end())
{
- if ((*it).second->GetType() == SETTINGS_TYPE_STRING)
+ if ((*it).second->GetType() == SettingTypeString)
{
- CSettingString *stringSetting = (CSettingString *) (*it).second;
+ CSettingString *stringSetting = (CSettingString *) (*it).second;
if (stringSetting)
{
- bChanged = !stringSetting->GetData().Equals(strValue);
- stringSetting->SetData(strValue);
+ bChanged = !StringUtils::EqualsNoCase(stringSetting->GetValue(), strValue);
+ stringSetting->SetValue(strValue);
if (bChanged && m_bInitialised)
m_changedSettings.insert(strKey);
}
}
- else if ((*it).second->GetType() == SETTINGS_TYPE_INT)
+ else if ((*it).second->GetType() == SettingTypeInteger)
bChanged = SetSetting(strKey, (int) (strValue.IsEmpty() ? 0 : atoi(strValue.c_str())));
- else if ((*it).second->GetType() == SETTINGS_TYPE_FLOAT)
+ else if ((*it).second->GetType() == SettingTypeNumber)
bChanged = SetSetting(strKey, (float) (strValue.IsEmpty() ? 0 : atof(strValue.c_str())));
- else if ((*it).second->GetType() == SETTINGS_TYPE_BOOL)
+ else if ((*it).second->GetType() == SettingTypeBool)
bChanged = SetSetting(strKey, strValue.Equals("1"));
}
return bChanged;
CStdString strValue;
switch ((*itr).second->GetType())
{
- case SETTINGS_TYPE_STRING:
+ case SettingTypeString:
{
CSettingString *stringSetting = (CSettingString *) (*itr).second;
if (stringSetting)
- strValue = stringSetting->GetData();
+ strValue = stringSetting->GetValue();
}
break;
- case SETTINGS_TYPE_INT:
+ case SettingTypeInteger:
{
CSettingInt *intSetting = (CSettingInt *) (*itr).second;
if (intSetting)
- strValue.Format("%d", intSetting->GetData());
+ strValue.Format("%d", intSetting->GetValue());
}
break;
- case SETTINGS_TYPE_FLOAT:
+ case SettingTypeNumber:
{
- CSettingFloat *floatSetting = (CSettingFloat *) (*itr).second;
+ CSettingNumber *floatSetting = (CSettingNumber *) (*itr).second;
if (floatSetting)
- strValue.Format("%.2f", floatSetting->GetData());
+ strValue.Format("%.2f", floatSetting->GetValue());
}
break;
- case SETTINGS_TYPE_BOOL:
+ case SettingTypeBool:
{
CSettingBool *boolSetting = (CSettingBool *) (*itr).second;
if (boolSetting)
- strValue.Format("%d", boolSetting->GetData() ? 1:0);
+ strValue.Format("%d", boolSetting->GetValue() ? 1:0);
}
break;
default:
class TiXmlDocument;
+class CSetting;
+
namespace PERIPHERALS
{
class CGUIDialogPeripheralSettings;
#include "peripherals/Peripherals.h"
#include "peripherals/bus/PeripheralBus.h"
#include "pictures/GUIWindowSlideShow.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/Variant.h"
#include "PeripheralImon.h"
#include "utils/log.h"
#include "guilib/LocalizeStrings.h"
+#include "settings/Settings.h"
#include "threads/Atomics.h"
-#include "settings/GUISettings.h"
#if defined (TARGET_WINDOWS)
#include "system.h" // For HAS_SDL_JOYSTICK
#if defined (HAS_SDL_JOYSTICK)
{
if (deviceInserted || m_lCountOfImonsConflictWithDInput == 0)
{
-#if defined(TARGET_WINDOWS) && defined(HAS_SDL_JOYSTICK)
- bool enableJoystickNow = !deviceInserted && g_guiSettings.GetBool("input.enablejoystick");
+#if defined(TARGET_WINDOWS) && defined (HAS_SDL_JOYSTICK)
+ bool enableJoystickNow = !deviceInserted && CSettings::Get().GetBool("input.enablejoystick");
CLog::Log(LOGNOTICE, "Problematic iMON hardware %s. Joystick usage: %s", (deviceInserted ? "detected" : "was removed"),
(enableJoystickNow) ? "enabled." : "disabled." );
g_Joystick.SetEnabled(enableJoystickNow);
#include "PeripheralHID.h"
+class CSetting;
+
namespace PERIPHERALS
{
class CPeripheralImon : public CPeripheralHID
#include "GUIDialogPeripheralSettings.h"
#include "addons/Skin.h"
#include "peripherals/Peripherals.h"
-#include "settings/GUISettings.h"
+#include "settings/Setting.h"
#include "utils/log.h"
#include "video/dialogs/GUIDialogVideoSettings.h"
CGUIDialogPeripheralSettings::CGUIDialogPeripheralSettings(void) :
CGUIDialogSettings(WINDOW_DIALOG_PERIPHERAL_SETTINGS, "DialogPeripheralSettings.xml"),
m_item(NULL),
- m_bIsInitialising(true)
+ m_bIsInitialising(true),
+ m_settingId(0)
{
}
switch(setting->GetType())
{
- case SETTINGS_TYPE_BOOL:
+ case SettingTypeBool:
{
CSettingBool *boolSetting = (CSettingBool *) setting;
if (boolSetting)
{
- m_boolSettings.insert(make_pair(CStdString(boolSetting->GetSetting()), boolSetting->GetData()));
- AddBool(boolSetting->GetOrder(), boolSetting->GetLabel(), &m_boolSettings[boolSetting->GetSetting()], true);
+ m_boolSettings.insert(make_pair(CStdString(boolSetting->GetId()), boolSetting->GetValue()));
+ AddBool(m_settingId++, boolSetting->GetLabel(), &m_boolSettings[boolSetting->GetId()], true);
}
}
break;
- case SETTINGS_TYPE_INT:
+ case SettingTypeInteger:
{
CSettingInt *intSetting = (CSettingInt *) setting;
if (intSetting)
{
- if (intSetting->GetControlType() == SPIN_CONTROL_INT)
+ if (intSetting->GetControl().GetFormat() == SettingControlFormatInteger)
{
- m_intSettings.insert(make_pair(CStdString(intSetting->GetSetting()), (float) intSetting->GetData()));
- AddSlider(intSetting->GetOrder(), intSetting->GetLabel(), &m_intSettings[intSetting->GetSetting()], (float)intSetting->m_iMin, (float)intSetting->m_iStep, (float)intSetting->m_iMax, CGUIDialogVideoSettings::FormatInteger, false);
+ m_intSettings.insert(make_pair(CStdString(intSetting->GetId()), (float) intSetting->GetValue()));
+ AddSlider(m_settingId++, intSetting->GetLabel(), &m_intSettings[intSetting->GetId()], (float)intSetting->GetMinimum(), (float)intSetting->GetStep(), (float)intSetting->GetMaximum(), CGUIDialogVideoSettings::FormatInteger, false);
}
- else if (intSetting->GetControlType() == SPIN_CONTROL_TEXT)
+ else if (intSetting->GetControl().GetFormat() == SettingControlFormatString)
{
- m_intTextSettings.insert(make_pair(CStdString(intSetting->GetSetting()), intSetting->GetData()));
+ m_intTextSettings.insert(make_pair(CStdString(intSetting->GetId()), intSetting->GetValue()));
vector<pair<int, int> > entries;
- map<int, int>::iterator entriesItr = intSetting->m_entries.begin();
- while (entriesItr != intSetting->m_entries.end())
+ SettingOptions::const_iterator entriesItr = intSetting->GetOptions().begin();
+ while (entriesItr != intSetting->GetOptions().end())
{
entries.push_back(make_pair(entriesItr->first, entriesItr->second));
++entriesItr;
}
- AddSpin(intSetting->GetOrder(), intSetting->GetLabel(), &m_intTextSettings[intSetting->GetSetting()], entries);
+ AddSpin(m_settingId++, intSetting->GetLabel(), &m_intTextSettings[intSetting->GetId()], entries);
}
}
}
break;
- case SETTINGS_TYPE_FLOAT:
+ case SettingTypeNumber:
{
- CSettingFloat *floatSetting = (CSettingFloat *) setting;
+ CSettingNumber *floatSetting = (CSettingNumber *) setting;
if (floatSetting)
{
- m_floatSettings.insert(make_pair(CStdString(floatSetting->GetSetting()), floatSetting->GetData()));
- AddSlider(floatSetting->GetOrder(), floatSetting->GetLabel(), &m_floatSettings[floatSetting->GetSetting()], floatSetting->m_fMin, floatSetting->m_fStep, floatSetting->m_fMax, CGUIDialogVideoSettings::FormatFloat, false);
+ m_floatSettings.insert(make_pair(CStdString(floatSetting->GetId()), (float)floatSetting->GetValue()));
+ AddSlider(m_settingId++, floatSetting->GetLabel(), &m_floatSettings[floatSetting->GetId()], (float)floatSetting->GetMinimum(), (float)floatSetting->GetStep(), (float)floatSetting->GetMaximum(), CGUIDialogVideoSettings::FormatFloat, false);
}
}
break;
- case SETTINGS_TYPE_STRING:
+ case SettingTypeString:
{
CSettingString *stringSetting = (CSettingString *) setting;
if (stringSetting)
{
- m_stringSettings.insert(make_pair(CStdString(stringSetting->GetSetting()), stringSetting->GetData()));
- AddString(stringSetting->GetOrder(), stringSetting->GetLabel(), &m_stringSettings[stringSetting->GetSetting()]);
+ m_stringSettings.insert(make_pair(CStdString(stringSetting->GetId()), stringSetting->GetValue()));
+ AddString(m_settingId++, stringSetting->GetLabel(), &m_stringSettings[stringSetting->GetId()]);
}
}
break;
std::map<CStdString, int> m_intTextSettings;
std::map<CStdString, float> m_floatSettings;
std::map<CStdString, CStdString> m_stringSettings;
+ int m_settingId;
};
}
#include "GUIViewStatePictures.h"
#include "FileItem.h"
#include "view/ViewState.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "filesystem/Directory.h"
#include "filesystem/PluginDirectory.h"
#include "guilib/LocalizeStrings.h"
AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date
AddSortMethod(SORT_METHOD_DATE_TAKEN, 577, LABEL_MASKS("%L", "%t", "%L", "%J")); // Filename, DateTaken | Foldername, Date
AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | FolderName, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("pictures");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("pictures");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
CStdString CGUIViewStateWindowPictures::GetExtensions()
{
- if (g_guiSettings.GetBool("pictures.showvideos"))
+ if (CSettings::Get().GetBool("pictures.showvideos"))
return g_advancedSettings.m_pictureExtensions+"|"+g_advancedSettings.m_videoExtensions;
return g_advancedSettings.m_pictureExtensions;
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogYesNo.h"
#include "playlists/PlayList.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "utils/TimeUtils.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
}
else if (iControl == CONTROL_SHUFFLE)
{
- g_guiSettings.ToggleBool("slideshow.shuffle");
- g_settings.Save();
+ CSettings::Get().ToggleBool("slideshow.shuffle");
+ CSettings::Get().Save();
}
else if (m_viewControl.HasControl(iControl)) // list/thumb control
{
if (iAction == ACTION_DELETE_ITEM)
{
// is delete allowed?
- if (g_guiSettings.GetBool("filelists.allowfiledeletion"))
+ if (CSettings::Get().GetBool("filelists.allowfiledeletion"))
OnDeleteItem(iItem);
else
return false;
CGUIMediaWindow::UpdateButtons();
// Update the shuffle button
- if (g_guiSettings.GetBool("slideshow.shuffle"))
+ if (CSettings::Get().GetBool("slideshow.shuffle"))
{
CGUIMessage msg2(GUI_MSG_SELECTED, GetID(), CONTROL_SHUFFLE);
g_windowManager.SendMessage(msg2);
if (items[i]->GetLabel().Equals("folder.jpg"))
items.Remove(i);
- if (items.GetFolderCount()==items.Size() || !g_guiSettings.GetBool("pictures.usetags"))
+ if (items.GetFolderCount()==items.Size() || !CSettings::Get().GetBool("pictures.usetags"))
return;
// Start the music info loader thread
return false;
m_vecItems->SetArt("thumb", "");
- if (g_guiSettings.GetBool("pictures.generatethumbs"))
+ if (CSettings::Get().GetBool("pictures.generatethumbs"))
m_thumbLoader.Load(*m_vecItems);
m_vecItems->SetArt("thumb", CPictureThumbLoader::GetCachedImage(*m_vecItems, "thumb"));
CFileItemPtr pItem = m_vecItems->Get(i);
if (!pItem->m_bIsFolder && !(URIUtils::IsRAR(pItem->GetPath()) ||
URIUtils::IsZIP(pItem->GetPath())) && (pItem->IsPicture() || (
- g_guiSettings.GetBool("pictures.showvideos") &&
+ CSettings::Get().GetBool("pictures.showvideos") &&
pItem->IsVideo())))
{
pSlideShow->Add(pItem.get());
}
m_slideShowStarted = true;
pSlideShow->RunSlideShow(strPicture, true,
- g_guiSettings.GetBool("slideshow.shuffle"),false,
+ CSettings::Get().GetBool("slideshow.shuffle"),false,
m_guiState->GetSortMethod(),
m_guiState->GetSortOrder(),
strExtensions);
if (!m_thumbLoader.IsLoading())
buttons.Add(CONTEXT_BUTTON_REFRESH_THUMBS, 13315); // Create Thumbnails
- if (g_guiSettings.GetBool("filelists.allowfiledeletion") && !item->IsReadOnly())
+ if (CSettings::Get().GetBool("filelists.allowfiledeletion") && !item->IsReadOnly())
{
buttons.Add(CONTEXT_BUTTON_DELETE, 117);
buttons.Add(CONTEXT_BUTTON_RENAME, 118);
#include "guilib/GUIWindowManager.h"
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/Texture.h"
#include "windowing/WindowingFactory.h"
if (m_pCallback)
{
unsigned int start = XbmcThreads::SystemClockMillis();
- CBaseTexture* texture = CTexture::LoadFromFile(m_strFileName, m_maxWidth, m_maxHeight, g_guiSettings.GetBool("pictures.useexifrotation"));
+ CBaseTexture* texture = CTexture::LoadFromFile(m_strFileName, m_maxWidth, m_maxHeight, CSettings::Get().GetBool("pictures.useexifrotation"));
totalTime += XbmcThreads::SystemClockMillis() - start;
count++;
// tell our parent
{
case GUI_MSG_WINDOW_INIT:
{
- m_Resolution = (RESOLUTION) g_guiSettings.GetInt("pictures.displayresolution");
+ m_Resolution = (RESOLUTION) CSettings::Get().GetInt("pictures.displayresolution");
//FIXME: Use GUI resolution for now
if (0 /*m_Resolution != CDisplaySettings::Get().GetCurrentResolution() && m_Resolution != INVALID && m_Resolution!=AUTORES*/)
else
{
if (m_bSlideShow)
- m_Image[iPic].SetTexture(iSlideNumber, pTexture, g_guiSettings.GetBool("slideshow.displayeffects") ? CSlideShowPic::EFFECT_RANDOM : CSlideShowPic::EFFECT_NONE);
+ m_Image[iPic].SetTexture(iSlideNumber, pTexture, CSettings::Get().GetBool("slideshow.displayeffects") ? CSlideShowPic::EFFECT_RANDOM : CSlideShowPic::EFFECT_NONE);
else
m_Image[iPic].SetTexture(iSlideNumber, pTexture, CSlideShowPic::EFFECT_NO_TIMEOUT);
m_Image[iPic].SetOriginalSize(pTexture->GetOriginalWidth(), pTexture->GetOriginalHeight(), bFullSize);
bRandom = bNotRandom = false;
// NotRandom overrides the window setting
- if ((!bNotRandom && g_guiSettings.GetBool("slideshow.shuffle")) || bRandom)
+ if ((!bNotRandom && CSettings::Get().GetBool("slideshow.shuffle")) || bRandom)
Shuffle();
if (!beginSlidePath.IsEmpty())
#include "Picture.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "filesystem/File.h"
#include "utils/log.h"
int y = i / num_across;
// load in the image
unsigned int width = tile_width - 2*tile_gap, height = tile_height - 2*tile_gap;
- CBaseTexture *texture = CTexture::LoadFromFile(files[i], width, height, g_guiSettings.GetBool("pictures.useexifrotation"));
+ CBaseTexture *texture = CTexture::LoadFromFile(files[i], width, height, CSettings::Get().GetBool("pictures.useexifrotation"));
if (texture && texture->GetWidth() && texture->GetHeight())
{
GetScale(texture->GetWidth(), texture->GetHeight(), width, height);
#include "PictureInfoLoader.h"
#include "PictureInfoTag.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
CPictureInfoLoader::CPictureInfoLoader()
m_mapFileItems->SetFastLookup(true);
m_tagReads = 0;
- m_loadTags = g_guiSettings.GetBool("pictures.usetags");
+ m_loadTags = CSettings::Get().GetBool("pictures.usetags");
if (m_pProgressCallback)
m_pProgressCallback->SetProgressMax(m_pVecItems->GetFileCount());
#include "filesystem/MultiPathDirectory.h"
#include "guilib/GUIWindowManager.h"
#include "GUIUserMessages.h"
-#include "settings/GUISettings.h"
#include "utils/URIUtils.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "video/VideoThumbLoader.h"
using namespace XFILE;
{
thumb = thumbURL;
}
- else if (g_guiSettings.GetBool("myvideos.extractthumb") && g_guiSettings.GetBool("myvideos.extractflags"))
+ else if (CSettings::Get().GetBool("myvideos.extractthumb") && CSettings::Get().GetBool("myvideos.extractflags"))
{
CFileItem item(*pItem);
CThumbExtractor* extract = new CThumbExtractor(item, pItem->GetPath(), true, thumbURL);
#include "settings/AdvancedSettings.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "windowing/WindowingFactory.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
m_transistionStart.type = transEffect;
m_transistionStart.start = 0;
// the +1's make sure it actually occurs
- float fadeTime = std::min(0.2f*g_guiSettings.GetInt("slideshow.staytime"), 3.0f);
+ float fadeTime = std::min(0.2f*CSettings::Get().GetInt("slideshow.staytime"), 3.0f);
m_transistionStart.length = (int)(g_graphicsContext.GetFPS() * fadeTime); // transition time in frames
m_transistionEnd.type = transEffect;
m_transistionEnd.length = m_transistionStart.length;
m_fPosX = m_fPosY = 0.0f;
m_fPosZ = 1.0f;
m_fVelocityX = m_fVelocityY = m_fVelocityZ = 0.0f;
- int iFrames = max((int)(g_graphicsContext.GetFPS() * g_guiSettings.GetInt("slideshow.staytime")), 1);
+ int iFrames = max((int)(g_graphicsContext.GetFPS() * CSettings::Get().GetInt("slideshow.staytime")), 1);
if (m_displayEffect == EFFECT_PANORAMA)
{
RESOLUTION iRes = g_graphicsContext.GetVideoResolution();
else if (m_displayEffect == EFFECT_ZOOM)
{
m_fPosZ += m_fVelocityZ;
-/* if (m_fPosZ > 1.0f + 0.01f*g_guiSettings.GetInt("Slideshow.ZoomAmount"))
+/* if (m_fPosZ > 1.0f + 0.01f*CSettings::Get().GetInt("Slideshow.ZoomAmount"))
{
- m_fPosZ = 1.0f + 0.01f * g_guiSettings.GetInt("Slideshow.ZoomAmount");
+ m_fPosZ = 1.0f + 0.01f * CSettings::Get().GetInt("Slideshow.ZoomAmount");
m_fVelocityZ = -m_fVelocityZ;
}
if (m_fPosZ < 1.0f)
m_transistionTemp.length = IMMEDIATE_TRANSISTION_TIME;
m_fTransistionAngle = (float)fRotateAngle / (float)m_transistionTemp.length;
// reset the timer
- m_transistionEnd.start = m_iCounter + m_transistionStart.length + (int)(g_graphicsContext.GetFPS() * g_guiSettings.GetInt("slideshow.staytime"));
+ m_transistionEnd.start = m_iCounter + m_transistionStart.length + (int)(g_graphicsContext.GetFPS() * CSettings::Get().GetInt("slideshow.staytime"));
}
void CSlideShowPic::Zoom(float fZoom, bool immediate /* = false */)
m_transistionTemp.length = IMMEDIATE_TRANSISTION_TIME;
m_fTransistionZoom = (fZoom - m_fZoomAmount) / (float)m_transistionTemp.length;
// reset the timer
- m_transistionEnd.start = m_iCounter + m_transistionStart.length + (int)(g_graphicsContext.GetFPS() * g_guiSettings.GetInt("slideshow.staytime"));
+ m_transistionEnd.start = m_iCounter + m_transistionStart.length + (int)(g_graphicsContext.GetFPS() * CSettings::Get().GetInt("slideshow.staytime"));
// turn off the render effects until we're back down to normal zoom
m_bNoEffect = true;
}
m_fZoomLeft += fDeltaX;
m_fZoomTop += fDeltaY;
// reset the timer
- // m_transistionEnd.start = m_iCounter + m_transistionStart.length + (int)(g_graphicsContext.GetFPS() * g_guiSettings.GetInt("slideshow.staytime"));
+ // m_transistionEnd.start = m_iCounter + m_transistionStart.length + (int)(g_graphicsContext.GetFPS() * CSettings::Get().GetInt("slideshow.staytime"));
}
void CSlideShowPic::Render()
#include "Application.h"
#include "cores/AudioEngine/AEFactory.h"
#include "input/KeyboardStat.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "windowing/WindowingFactory.h"
#include "utils/log.h"
#include "utils/Weather.h"
void CPowerManager::SetDefaults()
{
- int defaultShutdown = g_guiSettings.GetInt("powermanagement.shutdownstate");
+ int defaultShutdown = CSettings::Get().GetInt("powermanagement.shutdownstate");
switch (defaultShutdown)
{
break;
}
- g_guiSettings.SetInt("powermanagement.shutdownstate", defaultShutdown);
+ ((CSettingInt*)CSettings::Get().GetSetting("powermanagement.shutdownstate"))->SetDefault(defaultShutdown);
}
bool CPowerManager::Powerdown()
CAnnouncementManager::Announce(System, "xbmc", "OnLowBattery");
}
+
+void CPowerManager::SettingOptionsShutdownStatesFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ if (g_powerManager.CanPowerdown())
+ list.push_back(make_pair(g_localizeStrings.Get(13005), POWERSTATE_SHUTDOWN));
+ if (g_powerManager.CanHibernate())
+ list.push_back(make_pair(g_localizeStrings.Get(13010), POWERSTATE_HIBERNATE));
+ if (g_powerManager.CanSuspend())
+ list.push_back(make_pair(g_localizeStrings.Get(13011), POWERSTATE_SUSPEND));
+ if (!g_application.IsStandAlone())
+ {
+ list.push_back(make_pair(g_localizeStrings.Get(13009), POWERSTATE_QUIT));
+#if !defined(TARGET_DARWIN_IOS)
+ list.push_back(make_pair(g_localizeStrings.Get(13014), POWERSTATE_MINIMIZE));
+#endif
+ }
+}
#ifndef _POWER_MANAGER_H_
#define _POWER_MANAGER_H_
+
+#include <string>
+#include <vector>
+
#include "IPowerSyscall.h"
+class CSetting;
+
+enum PowerState
+{
+ POWERSTATE_QUIT = 0,
+ POWERSTATE_SHUTDOWN,
+ POWERSTATE_HIBERNATE,
+ POWERSTATE_SUSPEND,
+ POWERSTATE_REBOOT,
+ POWERSTATE_MINIMIZE,
+ POWERSTATE_NONE,
+ POWERSTATE_ASK
+};
+
// For systems without PowerSyscalls we have a NullObject
class CNullPowerSyscall : public IPowerSyscall
{
int BatteryLevel();
void ProcessEvents();
+
+ static void SettingOptionsShutdownStatesFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
private:
void OnSleep();
void OnWake();
*/
#include "Win32PowerSyscall.h"
+#include "powermanagement/PowerManager.h"
#ifdef _WIN32
#include "WIN32Util.h"
#include "guilib/LocalizeStrings.h"
#include "input/ButtonTranslator.h"
#include "input/MouseStat.h"
-#include "settings/GUISettings.h"
#include "settings/Settings.h"
#if !defined(TARGET_WINDOWS) && defined(HAS_DVD_DRIVE)
#include "storage/DetectDVDType.h"
void CProfilesManager::OnSettingsLoaded()
{
// check them all
- string strDir = g_guiSettings.GetString("system.playlistspath");
+ string strDir = CSettings::Get().GetString("system.playlistspath");
if (strDir == "set default" || strDir.empty())
{
strDir = "special://profile/playlists/";
- g_guiSettings.SetString("system.playlistspath", strDir.c_str());
+ CSettings::Get().SetString("system.playlistspath", strDir.c_str());
}
CDirectory::Create(strDir);
m_currentProfile = index;
- // load the new settings
- if (!g_settings.Load())
+ // first unload any old settings
+ CSettings::Get().Unload();
+ // then load the new settings
+ if (!CSettings::Get().Load())
+ {
+ CLog::Log(LOGFATAL, "CProfilesManager: unable to load settings for profile \"%s\"", m_profiles.at(index).getName().c_str());
return false;
+ }
+ CSettings::Get().SetLoaded();
CreateProfileFolders();
g_charsetConverter.reset();
// Load the langinfo to have user charset <-> utf-8 conversion
- string strLanguage = g_guiSettings.GetString("locale.language");
+ string strLanguage = CSettings::Get().GetString("locale.language");
strLanguage[0] = toupper(strLanguage[0]);
string strLangInfoPath = StringUtils::Format("special://xbmc/language/%s/langinfo.xml", strLanguage.c_str());
CDatabaseManager::Get().Initialize();
- g_Mouse.SetEnabled(g_guiSettings.GetBool("input.enablemouse"));
+ g_Mouse.SetEnabled(CSettings::Get().GetBool("input.enablemouse"));
g_infoManager.ResetCache();
g_infoManager.ResetLibraryBools();
{
CXBMCTinyXML doc;
if (doc.LoadFile(URIUtils::AddFileToFolder(GetUserDataFolder(), "guisettings.xml")))
- g_guiSettings.LoadMasterLock(doc.RootElement());
+ {
+ CSettings::Get().LoadSetting(doc.RootElement(), "masterlock.maxretries");
+ CSettings::Get().LoadSetting(doc.RootElement(), "masterlock.startuplock");
+ }
}
CPasswordManager::GetInstance().Clear();
if (index == m_currentProfile)
{
LoadProfile(0);
- g_settings.Save();
+ CSettings::Get().Save();
}
CFileItemPtr item = CFileItemPtr(new CFileItem(URIUtils::AddFileToFolder(GetUserDataFolder(), strDirectory)));
#include "filesystem/File.h"
#include "FileItem.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
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.SaveSettings(path, &localSettings);
+ settings.Initialize();
+ settings.Save(path);
}
}
#include "GUIViewStatePrograms.h"
#include "FileItem.h"
#include "view/ViewState.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
#include "filesystem/Directory.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/WindowIDs.h"
+#include "settings/Settings.h"
#include "view/ViewStateSettings.h"
using namespace XFILE;
-using namespace ADDON;
CGUIViewStateWindowPrograms::CGUIViewStateWindowPrograms(const CFileItemList& items) : CGUIViewState(items)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%K", "%I", "%L", "")); // Titel, Size | Foldername, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%K", "%I", "%L", "")); // Titel, Size | Foldername, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("programs");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("programs");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
#include "pvr/channels/PVRChannel.h"
#include "epg/EpgInfoTag.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace PVR;
using namespace EPG;
ClearQualityInfo(qualityInfo);
PVR_CLIENT client;
- if (g_guiSettings.GetBool("pvrplayback.signalquality") &&
+ if (CSettings::Get().GetBool("pvrplayback.signalquality") &&
g_PVRClients->GetPlayingClient(client))
{
client->SignalQuality(qualityInfo);
#include "dialogs/GUIDialogProgress.h"
#include "dialogs/GUIDialogExtendedProgressBar.h"
#include "dialogs/GUIDialogKaiToast.h"
+#include "dialogs/GUIDialogYesNo.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
#include "music/tags/MusicInfoTag.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "interfaces/AnnouncementManager.h"
#include "addons/AddonInstaller.h"
#include "guilib/Key.h"
+#include "dialogs/GUIDialogPVRChannelManager.h"
using namespace std;
using namespace MUSIC_INFO;
return pvrManagerInstance;
}
+void CPVRManager::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "pvrmanager.enabled")
+ {
+ if (((CSettingBool*)setting)->GetValue())
+ CApplicationMessenger::Get().ExecBuiltIn("XBMC.StartPVRManager", false);
+ else
+ CApplicationMessenger::Get().ExecBuiltIn("XBMC.StopPVRManager", false);
+ }
+ else if (settingId == "pvrparental.enabled")
+ {
+ if (((CSettingBool*)setting)->GetValue() && CSettings::Get().GetString("pvrparental.pin").empty())
+ {
+ CStdString newPassword = "";
+ // password set... save it
+ if (CGUIDialogNumeric::ShowAndVerifyNewPassword(newPassword))
+ CSettings::Get().SetString("pvrparental.pin", newPassword);
+ // password not set... disable parental
+ else
+ ((CSettingBool*)setting)->SetValue(false);
+ }
+ }
+}
+
+void CPVRManager::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "pvrmenu.searchicons")
+ {
+ if (IsStarted())
+ SearchMissingChannelIcons();
+ }
+ else if (settingId == "pvrmanager.resetdb")
+ {
+ if (CheckParentalPIN(g_localizeStrings.Get(19262).c_str()) &&
+ CGUIDialogYesNo::ShowAndGetInput(19098, 19186, 750, 0))
+ {
+ CDateTime::ResetTimezoneBias();
+ ResetDatabase(false);
+ }
+ }
+ else if (settingId == "epg.resetepg")
+ {
+ if (CGUIDialogYesNo::ShowAndGetInput(19098, 19188, 750, 0))
+ {
+ CDateTime::ResetTimezoneBias();
+ ResetDatabase(true);
+ }
+ }
+ else if (settingId == "pvrmanager.channelscan")
+ {
+ if (IsStarted())
+ StartChannelScan();
+ }
+ else if (settingId == "pvrmanager.channelmanager")
+ {
+ if (IsStarted())
+ {
+ CGUIDialogPVRChannelManager *dialog = (CGUIDialogPVRChannelManager *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_CHANNEL_MANAGER);
+ if (dialog)
+ dialog->DoModal();
+ }
+ }
+ else if (settingId == "pvrclient.menuhook")
+ {
+ if (IsStarted())
+ Clients()->ProcessMenuHooks(-1, PVR_MENUHOOK_SETTING);
+ }
+}
+
bool CPVRManager::IsPVRWindowActive(void) const
{
return g_windowManager.IsWindowActive(WINDOW_PVR) ||
void CPVRManager::MarkAsOutdated(const std::string& strAddonId, const std::string& strReferer)
{
- if (IsStarted() && g_guiSettings.GetBool("general.addonautoupdate"))
+ if (IsStarted() && CSettings::Get().GetBool("general.addonautoupdate"))
{
CSingleLock lock(m_critSection);
m_outdatedAddons.insert(make_pair<string, string>(strAddonId, strReferer));
Stop();
/* don't start if Settings->Video->TV->Enable isn't checked */
- if (!g_guiSettings.GetBool("pvrmanager.enabled"))
+ if (!CSettings::Get().GetBool("pvrmanager.enabled"))
return;
ResetProperties();
while (GetState() == ManagerStateStarted && m_addons && m_addons->HasConnectedClients() && !bRestart)
{
/* continue last watched channel after first startup */
- if (m_bFirstStart && g_guiSettings.GetInt("pvrplayback.startlast") != START_LAST_CHANNEL_OFF)
+ if (m_bFirstStart && CSettings::Get().GetInt("pvrplayback.startlast") != START_LAST_CHANNEL_OFF)
ContinueLastChannel();
/* execute the next pending jobs if there are any */
bool CPVRManager::SetWakeupCommand(void)
{
- if (!g_guiSettings.GetBool("pvrpowermanagement.enabled"))
+ if (!CSettings::Get().GetBool("pvrpowermanagement.enabled"))
return false;
- const CStdString strWakeupCommand = g_guiSettings.GetString("pvrpowermanagement.setwakeupcmd", false);
+ const CStdString strWakeupCommand = CSettings::Get().GetString("pvrpowermanagement.setwakeupcmd");
if (!strWakeupCommand.IsEmpty() && m_timers)
{
time_t iWakeupTime;
if (channel && channel->HasPVRChannelInfoTag())
{
CLog::Log(LOGNOTICE, "PVRManager - %s - continue playback on channel '%s'", __FUNCTION__, channel->GetPVRChannelInfoTag()->ChannelName().c_str());
- bReturn = StartPlayback(channel->GetPVRChannelInfoTag(), (g_guiSettings.GetInt("pvrplayback.startlast") == START_LAST_CHANNEL_MIN));
+ bReturn = StartPlayback(channel->GetPVRChannelInfoTag(), (CSettings::Get().GetInt("pvrplayback.startlast") == START_LAST_CHANNEL_MIN));
}
return bReturn;
CLog::Log(LOGNOTICE,"PVRManager - %s - %s database cleared", __FUNCTION__, bResetEPGOnly ? "EPG" : "PVR and EPG");
- if (g_guiSettings.GetBool("pvrmanager.enabled"))
+ if (CSettings::Get().GetBool("pvrmanager.enabled"))
{
CLog::Log(LOGNOTICE,"PVRManager - %s - restarting the PVRManager", __FUNCTION__);
m_database->Open();
if (// different channel
(!GetCurrentChannel(currentChannel) || channel != *currentChannel) &&
// parental control enabled
- g_guiSettings.GetBool("pvrparental.enabled") &&
+ CSettings::Get().GetBool("pvrparental.enabled") &&
// channel is locked
channel.IsLocked())
{
- float parentalDurationMs = g_guiSettings.GetInt("pvrparental.duration") * 1000.0f;
+ float parentalDurationMs = CSettings::Get().GetInt("pvrparental.duration") * 1000.0f;
bReturn = m_parentalTimer &&
(!m_parentalTimer->IsRunning() ||
m_parentalTimer->GetElapsedMilliseconds() > parentalDurationMs);
bool CPVRManager::CheckParentalPIN(const char *strTitle /* = NULL */)
{
- CStdString pinCode = g_guiSettings.GetString("pvrparental.pin");
+ CStdString pinCode = CSettings::Get().GetString("pvrparental.pin");
- if (!g_guiSettings.GetBool("pvrparental.enabled") || pinCode.empty())
+ if (!CSettings::Get().GetBool("pvrparental.enabled") || pinCode.empty())
return true;
// Locked channel. Enter PIN:
{
musictag->SetTitle(bHasTagNow ?
epgTagNow.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055)); // no information available
if (bHasTagNow)
{
videotag->m_strTitle = bHasTagNow ?
epgTagNow.Title() :
- g_guiSettings.GetBool("epg.hidenoinfoavailable") ?
+ CSettings::Get().GetBool("epg.hidenoinfoavailable") ?
StringUtils::EmptyString :
g_localizeStrings.Get(19055); // no information available
if (bHasTagNow)
else if (m_timers) // has active timers, etc.?
{
const CDateTime now = CDateTime::GetUTCDateTime();
- const CDateTimeSpan idle(0, 0, g_guiSettings.GetInt("pvrpowermanagement.backendidletime"), 0);
+ const CDateTimeSpan idle(0, 0, CSettings::Get().GetInt("pvrpowermanagement.backendidletime"), 0);
const CDateTime next = m_timers->GetNextEventTime();
const CDateTimeSpan delta = next - now;
return false;
}
+void CPVRManager::SettingOptionsPvrStartLastChannelFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ list.push_back(make_pair(g_localizeStrings.Get(106), PVR::START_LAST_CHANNEL_OFF));
+ list.push_back(make_pair(g_localizeStrings.Get(19190), PVR::START_LAST_CHANNEL_MIN));
+ list.push_back(make_pair(g_localizeStrings.Get(107), PVR::START_LAST_CHANNEL_ON));
+}
+
bool CPVRChannelSwitchJob::DoWork(void)
{
// announce OnStop and delete m_previous when done
*
*/
+#include <map>
+
+#include "addons/include/xbmc_pvr_types.h"
+#include "settings/ISettingCallback.h"
+#include "threads/Event.h"
#include "threads/Thread.h"
#include "utils/JobManager.h"
-#include "threads/Event.h"
-#include "addons/include/xbmc_pvr_types.h"
-#include <map>
class CGUIDialogProgressBarHandle;
class CStopWatch;
class CAction;
+class CFileItemList;
namespace EPG
{
PlaybackTypeRadio
};
+ enum ChannelStartLast
+ {
+ START_LAST_CHANNEL_OFF = 0,
+ START_LAST_CHANNEL_MIN,
+ START_LAST_CHANNEL_ON
+ };
+
#define g_PVRManager CPVRManager::Get()
#define g_PVRChannelGroups g_PVRManager.ChannelGroups()
#define g_PVRTimers g_PVRManager.Timers()
typedef boost::shared_ptr<PVR::CPVRChannelGroup> CPVRChannelGroupPtr;
- class CPVRManager : private CThread
+ class CPVRManager : public ISettingCallback, private CThread
{
friend class CPVRClients;
*/
static CPVRManager &Get(void);
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
+
/*!
* @brief Get the channel groups container.
* @return The groups container.
*/
bool OnAction(const CAction &action);
+ static void SettingOptionsPvrStartLastChannelFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
protected:
/*!
* @brief PVR update and control thread.
*/
#include <vector>
+#include "Application.h"
#include "PVRClient.h"
#include "pvr/PVRManager.h"
#include "epg/Epg.h"
#include "pvr/timers/PVRTimerInfoTag.h"
#include "pvr/recordings/PVRRecordings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
using namespace std;
using namespace ADDON;
void CPVRClient::ResetQualityData(PVR_SIGNAL_STATUS &qualityInfo)
{
memset(&qualityInfo, 0, sizeof(qualityInfo));
- if (g_guiSettings.GetBool("pvrplayback.signalquality"))
+ if (CSettings::Get().GetBool("pvrplayback.signalquality"))
{
strncpy(qualityInfo.strAdapterName, g_localizeStrings.Get(13205).c_str(), PVR_ADDON_NAME_STRING_LENGTH - 1);
strncpy(qualityInfo.strAdapterStatus, g_localizeStrings.Get(13205).c_str(), PVR_ADDON_NAME_STRING_LENGTH - 1);
PVR_SIGNAL_STATUS qualityInfo;
ResetQualityData(qualityInfo);
- if (g_guiSettings.GetBool("pvrplayback.signalquality"))
+ if (CSettings::Get().GetBool("pvrplayback.signalquality"))
SignalQuality(qualityInfo);
CSingleLock lock(m_critSection);
#include "Application.h"
#include "ApplicationMessenger.h"
#include "GUIUserMessages.h"
-#include "settings/GUISettings.h"
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogSelect.h"
#include "pvr/PVRManager.h"
#include "pvr/PVRDatabase.h"
#include "guilib/GUIWindowManager.h"
#include "settings/DisplaySettings.h"
-#include "settings/Settings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "pvr/channels/PVRChannelGroups.h"
#include "pvr/channels/PVRChannelGroupInternal.h"
#include "pvr/recordings/PVRRecordings.h"
// You need a tuner, backend software, and an add-on for the backend to be able to use PVR.
// Please visit xbmc.org/pvr to learn more.
m_bNoAddonWarningDisplayed = true;
- g_guiSettings.SetBool("pvrmanager.enabled", false);
+ CSettings::Get().SetBool("pvrmanager.enabled", false);
CGUIDialogOK::ShowAndGetInput(19271, 19272, 19273, 19274);
CGUIMessage msg(GUI_MSG_UPDATE, WINDOW_SETTINGS_MYPVR, 0);
g_windowManager.SendThreadMessage(msg, WINDOW_SETTINGS_MYPVR);
#include "utils/log.h"
#include "Util.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
#include "utils/StringUtils.h"
#include "threads/SingleLock.h"
* - use Observable here, so we can use event driven operations later
*/
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogOK.h"
/* make sure this container is empty before loading */
Unload();
- m_bUsingBackendChannelOrder = g_guiSettings.GetBool("pvrmanager.backendchannelorder");
- m_bUsingBackendChannelNumbers = g_guiSettings.GetBool("pvrmanager.usebackendchannelnumbers");
+ m_bUsingBackendChannelOrder = CSettings::Get().GetBool("pvrmanager.backendchannelorder");
+ m_bUsingBackendChannelNumbers = CSettings::Get().GetBool("pvrmanager.usebackendchannelnumbers");
int iChannelCount = m_iGroupId > 0 ? LoadFromDb() : 0;
CLog::Log(LOGDEBUG, "PVRChannelGroup - %s - %d channels loaded from the database for group '%s'",
SortAndRenumber();
- g_guiSettings.RegisterObserver(this);
m_bLoaded = true;
return true;
void CPVRChannelGroup::Unload(void)
{
CSingleLock lock(m_critSection);
- g_guiSettings.UnregisterObserver(this);
m_members.clear();
}
bool CPVRChannelGroup::Update(void)
{
if (GroupType() == PVR_GROUP_TYPE_USER_DEFINED ||
- !g_guiSettings.GetBool("pvrmanager.syncchannelgroups"))
+ !CSettings::Get().GetBool("pvrmanager.syncchannelgroups"))
return true;
CPVRChannelGroup PVRChannels_tmp(m_bRadio, m_iGroupId, m_strGroupName);
void CPVRChannelGroup::SearchAndSetChannelIcons(bool bUpdateDb /* = false */)
{
- if (g_guiSettings.GetString("pvrmenu.iconpath").IsEmpty())
+ if (CSettings::Get().GetString("pvrmenu.iconpath").empty())
return;
CPVRDatabase *database = GetPVRDatabase();
if (!groupMember.channel->IconPath().IsEmpty())
continue;
- CStdString strBasePath = g_guiSettings.GetString("pvrmenu.iconpath");
+ CStdString strBasePath = CSettings::Get().GetString("pvrmenu.iconpath");
CStdString strSanitizedChannelName = CUtil::MakeLegalFileName(groupMember.channel->ClientChannelName());
CStdString strIconPath = strBasePath + strSanitizedChannelName;
{
bool bReturn(false);
unsigned int iChannelNumber(0);
- bool bUseBackendChannelNumbers(g_guiSettings.GetBool("pvrmanager.usebackendchannelnumbers") && g_PVRClients->EnabledClientAmount() == 1);
+ bool bUseBackendChannelNumbers(CSettings::Get().GetBool("pvrmanager.usebackendchannelnumbers") && g_PVRClients->EnabledClientAmount() == 1);
if (PreventSortAndRenumber())
return true;
m_members.at(iChannelPtr).channel->SetCachedChannelNumber(0);
}
-void CPVRChannelGroup::Notify(const Observable &obs, const ObservableMessage msg)
+void CPVRChannelGroup::OnSettingChanged(const CSetting *setting)
{
+ if (setting == NULL)
+ return;
+
/* TODO: while pvr manager is starting up do accept setting changes. */
if(!g_PVRManager.IsStarted())
{
CLog::Log(LOGWARNING, "CPVRChannelGroup setting change ignored while PVRManager is starting\n");
+ return;
}
- else if (msg == ObservableMessageGuiSettings)
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "pvrmanager.backendchannelorder" || settingId == "pvrmanager.usebackendchannelnumbers")
{
CSingleLock lock(m_critSection);
- bool bUsingBackendChannelOrder = g_guiSettings.GetBool("pvrmanager.backendchannelorder");
- bool bUsingBackendChannelNumbers = g_guiSettings.GetBool("pvrmanager.usebackendchannelnumbers");
+ bool bUsingBackendChannelOrder = CSettings::Get().GetBool("pvrmanager.backendchannelorder");
+ bool bUsingBackendChannelNumbers = CSettings::Get().GetBool("pvrmanager.usebackendchannelnumbers");
bool bChannelNumbersChanged = m_bUsingBackendChannelNumbers != bUsingBackendChannelNumbers;
bool bChannelOrderChanged = m_bUsingBackendChannelOrder != bUsingBackendChannelOrder;
#include "FileItem.h"
#include "PVRChannel.h"
+#include "settings/ISettingCallback.h"
#include "utils/JobManager.h"
#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr<PVR::CPVRChannelGroup> CPVRChannelGroupPtr;
/** A group of channels */
- class CPVRChannelGroup : private Observer,
- public Observable,
- public IJobCallback
+ class CPVRChannelGroup : public Observable,
+ public IJobCallback,
+ public ISettingCallback
{
friend class CPVRChannelGroups;
//@}
- void Notify(const Observable &obs, const ObservableMessage msg);
+ virtual void OnSettingChanged(const CSetting *setting);
/*!
* @brief Get a channel given it's EPG ID.
#include "PVRChannelGroupInternal.h"
-#include "settings/GUISettings.h"
-#include "settings/AdvancedSettings.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogYesNo.h"
#include "dialogs/GUIDialogOK.h"
+#include "settings/AdvancedSettings.h"
#include "utils/log.h"
#include "PVRChannelGroupsContainer.h"
#include "PVRChannelGroups.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "guilib/GUIWindowManager.h"
#include "utils/log.h"
#include "URL.h"
bool CPVRChannelGroups::GetGroupsFromClients(void)
{
- if (! g_guiSettings.GetBool("pvrmanager.syncchannelgroups"))
+ if (! CSettings::Get().GetBool("pvrmanager.syncchannelgroups"))
return true;
return g_PVRClients->GetChannelGroups(this) == PVR_ERROR_NO_ERROR;
bool CPVRChannelGroups::Update(bool bChannelsOnly /* = false */)
{
- bool bUpdateAllGroups = !bChannelsOnly && g_guiSettings.GetBool("pvrmanager.syncchannelgroups");
+ bool bUpdateAllGroups = !bChannelsOnly && CSettings::Get().GetBool("pvrmanager.syncchannelgroups");
bool bReturn(true);
// sync groups
if (!database)
return false;
- bool bSyncWithBackends = g_guiSettings.GetBool("pvrmanager.syncchannelgroups");
+ bool bSyncWithBackends = CSettings::Get().GetBool("pvrmanager.syncchannelgroups");
CSingleLock lock(m_critSection);
#include "pvr/PVRManager.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "pvr/addons/PVRClients.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "storage/MediaManager.h"
#define BUTTON_OK 4
CStdString strThumb;
VECSOURCES shares;
- if (g_guiSettings.GetString("pvrmenu.iconpath") != "")
+ if (CSettings::Get().GetString("pvrmenu.iconpath") != "")
{
CMediaSource share1;
- share1.strPath = g_guiSettings.GetString("pvrmenu.iconpath");
+ share1.strPath = CSettings::Get().GetString("pvrmenu.iconpath");
share1.strName = g_localizeStrings.Get(19018);
shares.push_back(share1);
}
#include "dialogs/GUIDialogOK.h"
#include "GUIDialogPVRGuideInfo.h"
#include "view/ViewState.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "GUIInfoManager.h"
#include "cores/IPlayer.h"
void CGUIDialogPVRChannelsOSD::CloseOrSelect(unsigned int iItem)
{
- if (g_guiSettings.GetBool("pvrmenu.closechannelosdonswitch"))
+ if (CSettings::Get().GetBool("pvrmenu.closechannelosdonswitch"))
Close();
else
m_viewControl.SetSelectedItem(iItem);
#include "GUIDialogPVRTimerSettings.h"
#include "guilib/GUIKeyboardFactory.h"
#include "dialogs/GUIDialogNumeric.h"
-#include "settings/GUISettings.h"
#include "guilib/LocalizeStrings.h"
#include "pvr/PVRManager.h"
*
*/
-#include "settings/GUISettings.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "dialogs/GUIDialogOK.h"
#include "dialogs/GUIDialogYesNo.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
m_iClientId = g_PVRClients->GetFirstConnectedClientID();
m_iClientIndex = -1;
m_iClientChannelUid = -1;
- m_iPriority = g_guiSettings.GetInt("pvrrecord.defaultpriority");
- m_iLifetime = g_guiSettings.GetInt("pvrrecord.defaultlifetime");
+ m_iPriority = CSettings::Get().GetInt("pvrrecord.defaultpriority");
+ m_iLifetime = CSettings::Get().GetInt("pvrrecord.defaultlifetime");
m_bIsRepeating = false;
m_iWeekdays = 0;
m_strFileNameAndPath = StringUtils::EmptyString;
m_bIsRadio = false;
CEpgInfoTagPtr emptyTag;
m_epgTag = emptyTag;
- m_iMarginStart = g_guiSettings.GetInt("pvrrecord.marginstart");
- m_iMarginEnd = g_guiSettings.GetInt("pvrrecord.marginend");
+ m_iMarginStart = CSettings::Get().GetInt("pvrrecord.marginstart");
+ m_iMarginEnd = CSettings::Get().GetInt("pvrrecord.marginend");
m_iGenreType = 0;
m_iGenreSubType = 0;
m_StartTime = CDateTime::GetUTCDateTime();
void CPVRTimerInfoTag::QueueNotification(void) const
{
- if (g_guiSettings.GetBool("pvrrecord.timernotifications"))
+ if (CSettings::Get().GetBool("pvrrecord.timernotifications"))
{
CStdString strMessage;
GetNotificationText(strMessage);
*/
#include "FileItem.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "dialogs/GUIDialogOK.h"
#include "threads/SingleLock.h"
NotifyObservers(bAddedOrDeleted ? ObservableMessageTimersReset : ObservableMessageTimers);
- if (g_guiSettings.GetBool("pvrrecord.timernotifications"))
+ if (CSettings::Get().GetBool("pvrrecord.timernotifications"))
{
/* queue notifications */
for (unsigned int iNotificationPtr = 0; iNotificationPtr < timerNotifications.size(); iNotificationPtr++)
newTimer->SetStartFromUTC(startTime);
newTimer->m_iMarginStart = 0; /* set the start margin to 0 for instant timers */
- int iDuration = g_guiSettings.GetInt("pvrrecord.instantrecordtime");
+ int iDuration = CSettings::Get().GetInt("pvrrecord.instantrecordtime");
CDateTime endTime = CDateTime::GetUTCDateTime() + CDateTimeSpan(0, 0, iDuration ? iDuration : 120, 0);
newTimer->SetEndFromUTC(endTime);
CDateTime CPVRTimers::GetNextEventTime(void) const
{
- const bool dailywakup = g_guiSettings.GetBool("pvrpowermanagement.dailywakeup");
+ const bool dailywakup = CSettings::Get().GetBool("pvrpowermanagement.dailywakeup");
const CDateTime now = CDateTime::GetUTCDateTime();
- const CDateTimeSpan prewakeup(0, 0, g_guiSettings.GetInt("pvrpowermanagement.prewakeup"), 0);
- const CDateTimeSpan idle(0, 0, g_guiSettings.GetInt("pvrpowermanagement.backendidletime"), 0);
+ const CDateTimeSpan prewakeup(0, 0, CSettings::Get().GetInt("pvrpowermanagement.prewakeup"), 0);
+ const CDateTimeSpan idle(0, 0, CSettings::Get().GetInt("pvrpowermanagement.backendidletime"), 0);
CDateTime wakeuptime;
if (dailywakup)
{
CDateTime dailywakeuptime;
- dailywakeuptime.SetFromDBTime(g_guiSettings.GetString("pvrpowermanagement.dailywakeuptime", false));
+ dailywakeuptime.SetFromDBTime(CSettings::Get().GetString("pvrpowermanagement.dailywakeuptime"));
dailywakeuptime = dailywakeuptime.GetAsUTCDateTime();
dailywakeuptime.SetDateTime(
#include "GUIWindowPVR.h"
#include "GUIWindowPVRCommon.h"
#include "guilib/GUIWindowManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
using namespace PVR;
PVRWindow ActiveView = GetActiveView();
if (ActiveView == PVR_WINDOW_RECORDINGS)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%L", "%I", "%L", "")); // FileName, Size | Foldername, e
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%L", "%I", "%L", "")); // FileName, Size | Foldername, empty
#include "pvr/addons/PVRClients.h"
#include "pvr/timers/PVRTimers.h"
#include "epg/EpgContainer.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "storage/MediaManager.h"
#include "utils/log.h"
#include "threads/SingleLock.h"
if (button == CONTEXT_BUTTON_PLAY_ITEM)
{
/* play channel */
- bReturn = PlayFile(item, g_guiSettings.GetBool("pvrplayback.playminimized"));
+ bReturn = PlayFile(item, CSettings::Get().GetBool("pvrplayback.playminimized"));
}
return bReturn;
CStdString strThumb;
VECSOURCES shares;
- if (g_guiSettings.GetString("pvrmenu.iconpath") != "")
+ if (CSettings::Get().GetString("pvrmenu.iconpath") != "")
{
CMediaSource share1;
- share1.strPath = g_guiSettings.GetString("pvrmenu.iconpath");
+ share1.strPath = CSettings::Get().GetString("pvrmenu.iconpath");
share1.strName = g_localizeStrings.Get(19018);
shares.push_back(share1);
}
#include "pvr/windows/GUIWindowPVR.h"
#include "pvr/windows/GUIWindowPVRSearch.h"
#include "pvr/recordings/PVRRecordings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/Settings.h"
#include "utils/log.h"
else
{
/* open channel */
- bReturn = PlayFile(item, g_guiSettings.GetBool("pvrplayback.playminimized"));
+ bReturn = PlayFile(item, CSettings::Get().GetBool("pvrplayback.playminimized"));
}
return bReturn;
#include "epg/EpgContainer.h"
#include "pvr/windows/GUIWindowPVR.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "pvr/addons/PVRClients.h"
CGUIWindowPVRGuide::CGUIWindowPVRGuide(CGUIWindowPVR *parent) :
CGUIWindowPVRCommon(parent, PVR_WINDOW_EPG, CONTROL_BTNGUIDE, CONTROL_LIST_GUIDE_NOW_NEXT),
Observer(),
- m_iGuideView(g_guiSettings.GetInt("epg.defaultguideview"))
+ m_iGuideView(CSettings::Get().GetInt("epg.defaultguideview"))
{
m_cachedTimeline = new CFileItemList;
m_cachedChannelGroup = CPVRChannelGroupPtr(new CPVRChannelGroup);
else if (m_iGuideView == GUIDE_VIEW_TIMELINE)
m_parent->SetLabel(m_iControlButton, g_localizeStrings.Get(19222) + ": " + g_localizeStrings.Get(19032));
}
+
+void CGUIWindowPVRGuide::SettingOptionsEpgGuideViewFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ list.push_back(make_pair(g_localizeStrings.Get(19029), PVR::GUIDE_VIEW_CHANNEL));
+ list.push_back(make_pair(g_localizeStrings.Get(19030), PVR::GUIDE_VIEW_NOW));
+ list.push_back(make_pair(g_localizeStrings.Get(19031), PVR::GUIDE_VIEW_NEXT));
+ list.push_back(make_pair(g_localizeStrings.Get(19032), PVR::GUIDE_VIEW_TIMELINE));
+}
#include "utils/Observer.h"
#include "../channels/PVRChannelGroup.h"
+class CSetting;
+
namespace PVR
{
+ enum EpgGuideView
+ {
+ GUIDE_VIEW_CHANNEL = 0,
+ GUIDE_VIEW_NOW,
+ GUIDE_VIEW_NEXT,
+ GUIDE_VIEW_TIMELINE
+ };
+
class CGUIWindowPVR;
class CGUIWindowPVRGuide : public CGUIWindowPVRCommon, public Observer
void SetInvalid(void) { UpdateData(); }
void UnregisterObservers(void);
void ResetObservers(void);
+
+ static void SettingOptionsEpgGuideViewFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
private:
bool SelectPlayingFile(void);
#ifdef HAS_DX
#include "threads/SystemClock.h"
-#include "settings/Settings.h"
#include "RenderSystemDX.h"
#include "utils/log.h"
#include "utils/TimeUtils.h"
#include "guilib/GUIWindowManager.h"
#include "threads/SingleLock.h"
#include "guilib/D3DResource.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "utils/SystemInfo.h"
#include "Application.h"
#include "Util.h"
#include "utils/LangCodeExpander.h"
#include "LangInfo.h"
#include "profiles/ProfilesManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/StringUtils.h"
#include "utils/SystemInfo.h"
#include "utils/URIUtils.h"
CAdvancedSettings::CAdvancedSettings()
{
m_initialized = false;
+ m_loaded = false;
}
void CAdvancedSettings::OnSettingsLoaded()
CLog::Log(LOGNOTICE, "Default Audio Player: %s", m_audioDefaultPlayer.c_str());
// setup any logging...
- if (g_guiSettings.GetBool("debug.showloginfo"))
+ if (CSettings::Get().GetBool("debug.showloginfo"))
{
m_logLevel = std::max(m_logLevelHint, LOG_LEVEL_DEBUG_FREEMEM);
CLog::Log(LOGNOTICE, "Enabled debug logging due to GUI setting (%d)", m_logLevel);
CLog::SetLogLevel(m_logLevel);
}
+void CAdvancedSettings::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "debug.showloginfo")
+ SetDebugMode(((CSettingBool*)setting)->GetValue());
+}
+
void CAdvancedSettings::Initialize()
{
m_audioHeadRoom = 0;
void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
{
+ if (m_loaded)
+ return;
+
CXBMCTinyXML advancedXML;
if (!CFile::Exists(file))
{
{ // read the loglevel setting, so set the setting advanced to hide it in GUI
// as altering it will do nothing - we don't write to advancedsettings.xml
XMLUtils::GetInt(pRootElement, "loglevel", m_logLevelHint, LOG_LEVEL_NONE, LOG_LEVEL_MAX);
- CSettingBool *setting = (CSettingBool *)g_guiSettings.GetSetting("debug.showloginfo");
- if (setting)
+ CSettingBool *setting = (CSettingBool *)CSettings::Get().GetSetting("debug.showloginfo");
+ if (setting != NULL)
{
const char* hide;
if (!((hide = pElement->Attribute("hide")) && strnicmp("false", hide, 4) == 0))
- setting->SetAdvanced();
+ setting->SetVisible(false);
}
g_advancedSettings.m_logLevel = std::max(g_advancedSettings.m_logLevel, g_advancedSettings.m_logLevelHint);
CLog::SetLogLevel(g_advancedSettings.m_logLevel);
XMLUtils::GetInt(pElement, "nofliptimeout", m_guiDirtyRegionNoFlipTimeout);
}
- // load in the GUISettings overrides:
- g_guiSettings.LoadXML(pRootElement, true); // true to hide the settings we read in
+ // must be done before calling CSettings::Load() to avoid an infinite loop
+ m_loaded = true;
+
+ // load in the settings overrides
+ CSettings::Get().Load(pRootElement, true); // true to hide the settings we read in
}
void CAdvancedSettings::Clear()
m_logFolder.clear();
m_userAgent.clear();
+
+ m_loaded = false;
}
void CAdvancedSettings::GetCustomTVRegexps(TiXmlElement *pRootElement, SETTINGS_TVSHOWLIST& settings)
#include <vector>
+#include "settings/ISettingCallback.h"
#include "settings/ISettingsHandler.h"
#include "utils/StdString.h"
#include "utils/GlobalsHandling.h"
typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
-class CAdvancedSettings : public ISettingsHandler
+class CAdvancedSettings : public ISettingCallback, public ISettingsHandler
{
public:
CAdvancedSettings();
virtual void OnSettingsLoaded();
+ virtual void OnSettingChanged(const CSetting *setting);
+
void Initialize();
bool Initialized() { return m_initialized; };
void AddSettingsFile(const CStdString &filename);
float GetDisplayLatency(float refreshrate);
bool m_initialized;
+ bool m_loaded;
void SetDebugMode(bool debug);
#include <stdlib.h>
#include "DisplaySettings.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/GraphicContext.h"
#include "guilib/gui3d.h"
-#include "settings/GUISettings.h"
+#include "guilib/LocalizeStrings.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/XMLUtils.h"
+#include "windowing/WindowingFactory.h"
+
+// 0.1 second increments
+#define MAX_REFRESH_CHANGE_DELAY 200
using namespace std;
m_nonLinearStretched = false;
}
-void CDisplaySettings::SetCurrentResolution(RESOLUTION resolution, bool save /* = false */)
+bool CDisplaySettings::OnSettingChanging(const CSetting *setting)
{
- if (save)
+ if (setting == NULL)
+ return false;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "videoscreen.resolution" ||
+ settingId == "videoscreen.screen" ||
+ settingId == "videoscreen.screenmode")
{
- string mode;
- if (resolution == RES_DESKTOP)
- mode = "DESKTOP";
- else if (resolution == RES_WINDOW)
- mode = "WINDOW";
- else if (resolution >= RES_CUSTOM && resolution < (RESOLUTION)m_resolutions.size())
+ // check if this is the revert call for a failed OnSettingChanging
+ // in which case we don't want to ask the user again
+ if (m_ignoreSettingChanging.find(make_pair(settingId, true)) == m_ignoreSettingChanging.end())
{
- const RESOLUTION_INFO &info = m_resolutions[resolution];
- mode = StringUtils::Format("%1i%05i%05i%09.5f%s", info.iScreen,
- info.iScreenWidth, info.iScreenHeight, info.fRefreshRate,
- (info.dwFlags & D3DPRESENTFLAG_INTERLACED) ? "i":"p");
+ RESOLUTION newRes = RES_DESKTOP;
+ if (settingId == "videoscreen.resolution")
+ newRes = (RESOLUTION)((CSettingInt*)setting)->GetValue();
+ else if (settingId == "videoscreen.screen")
+ newRes = GetResolutionForScreen();
+ else if (settingId == "videoscreen.screenmode")
+ newRes = GetResolutionFromString(((CSettingString*)setting)->GetValue());
+
+ // We need to change and save videoscreen.screenmode which will
+ // trigger another call to this OnSettingChanging() which should not
+ // trigger a user-input dialog which is already triggered by the callback
+ // of the changed setting
+ bool save = settingId != "videoscreen.screenmode";
+ if (save)
+ m_ignoreSettingChanging.insert(make_pair("videoscreen.screenmode", true));
+ SetCurrentResolution(newRes, save);
+ g_graphicsContext.SetVideoResolution(newRes);
+
+ // check if this setting is temporarily blocked from showing the dialog
+ if (m_ignoreSettingChanging.find(make_pair(settingId, false)) == m_ignoreSettingChanging.end())
+ {
+ bool cancelled = false;
+ if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000))
+ {
+ // we need to ignore the next OnSettingChanging() call for
+ // the same setting which is executed to broadcast that
+ // changing the setting has failed
+ m_ignoreSettingChanging.insert(make_pair(settingId, false));
+ return false;
+ }
+ }
+ else
+ m_ignoreSettingChanging.erase(make_pair(settingId, false));
+
+ if (settingId == "videoscreen.screen")
+ {
+ m_ignoreSettingChanging.insert(make_pair("videoscreen.resolution", true));
+ if (CSettings::Get().GetSetting("videoscreen.screenmode")->IsVisible())
+ m_ignoreSettingChanging.insert(make_pair("videoscreen.screenmode", true));
+ }
}
else
- {
- CLog::Log(LOGWARNING, "CDisplaySettings: setting invalid resolution %i", resolution);
- mode = "DESKTOP";
- }
+ m_ignoreSettingChanging.erase(make_pair(settingId, true));
+ }
+
+ return true;
+}
- g_guiSettings.SetString("videoscreen.screenmode", mode.c_str());
+bool CDisplaySettings::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
+{
+ if (setting == NULL)
+ return false;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "videoscreen.screenmode")
+ {
+ CSettingString *screenmodeSetting = (CSettingString*)setting;
+ std::string screenmode = screenmodeSetting->GetValue();
+ // in Eden there was no character ("i" or "p") indicating interlaced/progressive
+ // at the end so we just add a "p" and assume progressive
+ if (screenmode.size() == 20)
+ return screenmodeSetting->SetValue(screenmode + "p");
+ }
+
+ return false;
+}
+
+void CDisplaySettings::SetCurrentResolution(RESOLUTION resolution, bool save /* = false */)
+{
+ if (save)
+ {
+ string mode = GetStringFromResolution(resolution);
+ CSettings::Get().SetString("videoscreen.screenmode", mode.c_str());
}
m_currentResolution = resolution;
- g_guiSettings.SetChanged();
+ SetChanged();
}
RESOLUTION CDisplaySettings::GetDisplayResolution() const
{
- return GetResolutionFromString(g_guiSettings.GetString("videoscreen.screenmode"));
+ return GetResolutionFromString(CSettings::Get().GetString("videoscreen.screenmode"));
}
const RESOLUTION_INFO& CDisplaySettings::GetResolutionInfo(size_t index) const
}
}
-RESOLUTION CDisplaySettings::GetResolutionFromString(const std::string &strResolution) const
+RESOLUTION CDisplaySettings::GetResolutionFromString(const std::string &strResolution)
{
if (strResolution == "DESKTOP")
return RES_DESKTOP;
// find the closest match to these in our res vector. If we have the screen, we score the res
RESOLUTION bestRes = RES_DESKTOP;
float bestScore = FLT_MAX;
- for (ResolutionInfos::const_iterator resolution = m_resolutions.begin(); resolution != m_resolutions.end(); resolution++)
+
+ for (size_t resolution = 0; resolution < CDisplaySettings::Get().ResolutionInfoSize(); resolution++)
{
- const RESOLUTION_INFO &info = *resolution;
+ const RESOLUTION_INFO &info = CDisplaySettings::Get().GetResolutionInfo(resolution);
if (info.iScreen != screen)
continue;
float score = 10 * (square_error((float)info.iScreenWidth, (float)width) +
if (score < bestScore)
{
bestScore = score;
- bestRes = (RESOLUTION)(resolution - m_resolutions.begin());
+ bestRes = (RESOLUTION)resolution;
}
}
return bestRes;
return RES_DESKTOP;
}
+
+std::string CDisplaySettings::GetStringFromResolution(RESOLUTION resolution, float refreshrate /* = 0.0f */)
+{
+ if (resolution == RES_WINDOW)
+ return "WINDOW";
+
+ if (resolution >= RES_CUSTOM && resolution < (RESOLUTION)CDisplaySettings::Get().ResolutionInfoSize())
+ {
+ const RESOLUTION_INFO &info = CDisplaySettings::Get().GetResolutionInfo(resolution);
+ return StringUtils::Format("%1i%05i%05i%09.5f%s", info.iScreen,
+ info.iScreenWidth, info.iScreenHeight,
+ refreshrate > 0.0f ? refreshrate : info.fRefreshRate,
+ (info.dwFlags & D3DPRESENTFLAG_INTERLACED) ? "i":"p");
+ }
+
+ return "DESKTOP";
+}
+
+RESOLUTION CDisplaySettings::GetResolutionForScreen()
+{
+ DisplayMode mode = CSettings::Get().GetInt("videoscreen.screen");
+ if (mode == DM_WINDOWED)
+ return RES_WINDOW;
+
+ for (int idx=0; idx < g_Windowing.GetNumScreens(); idx++)
+ {
+ if (CDisplaySettings::Get().GetResolutionInfo(RES_DESKTOP + idx).iScreen == mode)
+ return (RESOLUTION)(RES_DESKTOP + idx);
+ }
+
+ return RES_DESKTOP;
+}
+
+void CDisplaySettings::SettingOptionsRefreshChangeDelaysFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ list.push_back(make_pair(g_localizeStrings.Get(13551), 0));
+
+ for (int i = 1; i <= MAX_REFRESH_CHANGE_DELAY; i++)
+ list.push_back(make_pair(StringUtils::Format(g_localizeStrings.Get(13553).c_str(), (double)i / 10.0), i));
+}
+
+void CDisplaySettings::SettingOptionsRefreshRatesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ // get the proper resolution
+ RESOLUTION res = GetResolutionForScreen();
+ if (res < RES_WINDOW)
+ return;
+
+ // only add "Windowed" if in windowed mode
+ if (res == RES_WINDOW)
+ {
+ current = "WINDOW";
+ list.push_back(make_pair(g_localizeStrings.Get(242), current));
+ return;
+ }
+
+ // The only meaningful parts of res here are iScreen, iScreenWidth, iScreenHeight
+ vector<REFRESHRATE> refreshrates = g_Windowing.RefreshRates(CDisplaySettings::Get().GetResolutionInfo(res).iScreen,
+ CDisplaySettings::Get().GetResolutionInfo(res).iScreenWidth,
+ CDisplaySettings::Get().GetResolutionInfo(res).iScreenHeight,
+ CDisplaySettings::Get().GetResolutionInfo(res).dwFlags);
+
+ bool match = false;
+ for (vector<REFRESHRATE>::const_iterator refreshrate = refreshrates.begin(); refreshrate != refreshrates.end(); refreshrate++)
+ {
+ std::string screenmode = GetStringFromResolution(res, refreshrate->RefreshRate);
+ if (!match && StringUtils::EqualsNoCase(((CSettingString*)setting)->GetValue(), screenmode))
+ match = true;
+ list.push_back(make_pair(StringUtils::Format("%.02f", refreshrate->RefreshRate), screenmode));
+ }
+
+ if (!match)
+ current = GetStringFromResolution(res, g_Windowing.DefaultRefreshRate(CDisplaySettings::Get().GetResolutionInfo(res).iScreen, refreshrates).RefreshRate);
+}
+
+void CDisplaySettings::SettingOptionsResolutionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ RESOLUTION res = RES_INVALID;
+ DisplayMode screen = CSettings::Get().GetInt("videoscreen.screen");
+ if (screen == DM_WINDOWED)
+ {
+ res = RES_WINDOW;
+ list.push_back(make_pair(g_localizeStrings.Get(242), RES_WINDOW));
+ }
+ else
+ {
+ vector<RESOLUTION_WHR> resolutions = g_Windowing.ScreenResolutions(screen);
+ for (vector<RESOLUTION_WHR>::const_iterator resolution = resolutions.begin(); resolution != resolutions.end(); resolution++)
+ {
+ list.push_back(make_pair(
+ StringUtils::Format("%dx%d%s", resolution->width, resolution->height, (resolution->interlaced == D3DPRESENTFLAG_INTERLACED) ? "i" : "p"),
+ resolution->ResInfo_Index));
+
+ RESOLUTION_INFO res1 = CDisplaySettings::Get().GetCurrentResolutionInfo();
+ RESOLUTION_INFO res2 = CDisplaySettings::Get().GetResolutionInfo(resolution->ResInfo_Index);
+ if (res1.iScreen == res2.iScreen &&
+ res1.iScreenWidth == res2.iScreenWidth &&
+ res1.iScreenHeight == res2.iScreenHeight &&
+ (res1.dwFlags & D3DPRESENTFLAG_INTERLACED) == (res2.dwFlags & D3DPRESENTFLAG_INTERLACED))
+ res = (RESOLUTION)resolution->ResInfo_Index;
+ }
+ }
+
+ if (res != RES_INVALID)
+ current = res;
+}
+
+void CDisplaySettings::SettingOptionsScreensFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+ if (g_advancedSettings.m_canWindowed)
+ list.push_back(make_pair(g_localizeStrings.Get(242), DM_WINDOWED));
+
+ for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++)
+ {
+ int screen = CDisplaySettings::Get().GetResolutionInfo(RES_DESKTOP + idx).iScreen;
+ list.push_back(make_pair(StringUtils::Format(g_localizeStrings.Get(241), screen + 1), screen));
+ }
+}
+
+void CDisplaySettings::SettingOptionsVerticalSyncsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t)
+{
+#if defined(_LINUX) && !defined(TARGET_DARWIN)
+ list.push_back(make_pair(g_localizeStrings.Get(13101), VSYNC_DRIVER));
+#endif
+ list.push_back(make_pair(g_localizeStrings.Get(13106), VSYNC_DISABLED));
+ list.push_back(make_pair(g_localizeStrings.Get(13107), VSYNC_VIDEO));
+ list.push_back(make_pair(g_localizeStrings.Get(13108), VSYNC_ALWAYS));
+}
*
*/
+#include <set>
#include <vector>
#include "guilib/Resolution.h"
+#include "settings/ISettingCallback.h"
#include "settings/ISubSettings.h"
#include "threads/CriticalSection.h"
+#include "utils/Observer.h"
class TiXmlNode;
-class CDisplaySettings : public ISubSettings
+class CDisplaySettings : public ISettingCallback, public ISubSettings,
+ public Observable
{
public:
static CDisplaySettings& Get();
virtual bool Save(TiXmlNode *settings) const;
virtual void Clear();
+ virtual bool OnSettingChanging(const CSetting *setting);
+ virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode);
+
/*!
\brief Returns the currently active resolution
bool IsNonLinearStretched() const { return m_nonLinearStretched; }
void SetNonLinearStretched(bool nonLinearStretch) { m_nonLinearStretched = nonLinearStretch; }
+ static void SettingOptionsRefreshChangeDelaysFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+ static void SettingOptionsRefreshRatesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
+ static void SettingOptionsResolutionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+ static void SettingOptionsScreensFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+ static void SettingOptionsVerticalSyncsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int ¤t);
+
protected:
CDisplaySettings();
CDisplaySettings(const CDisplaySettings&);
CDisplaySettings const& operator=(CDisplaySettings const&);
virtual ~CDisplaySettings();
- RESOLUTION GetResolutionFromString(const std::string &strResolution) const;
+ static RESOLUTION GetResolutionFromString(const std::string &strResolution);
+ static std::string GetStringFromResolution(RESOLUTION resolution, float refreshrate = 0.0f);
+ static RESOLUTION GetResolutionForScreen();
private:
// holds the real gui resolution
float m_pixelRatio; // current pixel ratio
float m_verticalShift; // current vertical shift
bool m_nonLinearStretched; // current non-linear stretch
+
+ /*!
+ \brief A set of pairs consisting of a setting identifier
+ and a boolean value which should be ignored in specific
+ situations. If the boolean value is "true" the whole
+ OnSettingChanging() logic must be skipped once. If it
+ is "false" only showing the GUI dialog must be skipped.
+ */
+ std::set< std::pair<std::string, bool> > m_ignoreSettingChanging;
CCriticalSection m_critical;
};
+++ /dev/null
-/*
- * 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 "network/Network.h"
-#include "GUISettings.h"
-#include <limits.h>
-#include <float.h>
-#include "Settings.h"
-#include "dialogs/GUIDialogFileBrowser.h"
-#include "storage/MediaManager.h"
-#ifdef _LINUX
-#include "LinuxTimezone.h"
-#endif
-#include "Application.h"
-#include "AdvancedSettings.h"
-#include "guilib/LocalizeStrings.h"
-#include "utils/CharsetConverter.h"
-#include "settings/DisplaySettings.h"
-#include "settings/VideoSettings.h"
-#include "utils/StringUtils.h"
-#include "utils/SystemInfo.h"
-#include "utils/log.h"
-#include "utils/XBMCTinyXML.h"
-#include "windowing/WindowingFactory.h"
-#include "powermanagement/PowerManager.h"
-#include "cores/dvdplayer/DVDCodecs/Video/CrystalHD.h"
-#include "cores/AudioEngine/AEFactory.h"
-#include "cores/AudioEngine/AEAudioFormat.h"
-#include "cores/paplayer/AudioDecoder.h"
-#include "filesystem/CurlFile.h"
-#include "guilib/GUIFont.h" // for FONT_STYLE_* definitions
-#if defined(TARGET_DARWIN_OSX)
- #include "cores/AudioEngine/Engines/CoreAudio/CoreAudioHardware.h"
-#endif
-#include "guilib/GUIFontManager.h"
-#include "LangInfo.h"
-#include "pvr/PVRManager.h"
-#include "utils/XMLUtils.h"
-#if defined(TARGET_DARWIN)
- #include "osx/DarwinUtils.h"
-#endif
-#include "Util.h"
-
-using namespace std;
-using namespace ADDON;
-using namespace PVR;
-
-// String id's of the masks
-#define MASK_DAYS 17999
-#define MASK_HOURS 17998
-#define MASK_MINS 14044
-#define MASK_SECS 14045
-#define MASK_MS 14046
-#define MASK_PERCENT 14047
-#define MASK_KBPS 14048
-#define MASK_MB 17997
-#define MASK_KB 14049
-#define MASK_DB 14050
-
-#define MAX_RESOLUTIONS 128
-
-#define TEXT_OFF 351
-#define TEXT_NONE 231
-
-#ifdef _LINUX
-#define DEFAULT_VISUALISATION "visualization.glspectrum"
-#elif defined(_WIN32)
-#ifdef HAS_DX
-#define DEFAULT_VISUALISATION "visualization.milkdrop"
-#else
-#define DEFAULT_VISUALISATION "visualization.glspectrum"
-#endif
-#endif
-
-#define DEFAULT_WEB_INTERFACE "webinterface.default"
-
-#ifdef MID
-#define DEFAULT_VSYNC VSYNC_DISABLED
-#else // MID
-#if defined(TARGET_DARWIN) || defined(_WIN32) || defined(TARGET_RASPBERRY_PI)
-#define DEFAULT_VSYNC VSYNC_ALWAYS
-#else
-#define DEFAULT_VSYNC VSYNC_DRIVER
-#endif
-#endif // MID
-
-struct sortsettings
-{
- bool operator()(const CSetting* pSetting1, const CSetting* pSetting2)
- {
- return pSetting1->GetOrder() < pSetting2->GetOrder();
- }
-};
-
-void CSettingBool::FromString(const CStdString &strValue)
-{
- m_bData = (strValue == "true");
-}
-
-CStdString CSettingBool::ToString() const
-{
- return m_bData ? "true" : "false";
-}
-
-CSettingSeparator::CSettingSeparator(int iOrder, const char *strSetting)
- : CSetting(iOrder, strSetting, 0, SEPARATOR_CONTROL)
-{
-}
-
-CSettingFloat::CSettingFloat(int iOrder, const char *strSetting, int iLabel, float fData, float fMin, float fStep, float fMax, int iControlType)
- : CSetting(iOrder, strSetting, iLabel, iControlType)
-{
- m_fData = fData;
- m_fMin = fMin;
- m_fStep = fStep;
- m_fMax = fMax;
-}
-
-void CSettingFloat::FromString(const CStdString &strValue)
-{
- SetData((float)atof(strValue.c_str()));
-}
-
-CStdString CSettingFloat::ToString() const
-{
- CStdString strValue;
- strValue.Format("%f", m_fData);
- return strValue;
-}
-
-CSettingInt::CSettingInt(int iOrder, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, const char *strFormat)
- : CSetting(iOrder, strSetting, iLabel, iControlType)
-{
- m_iData = iData;
- m_iMin = iMin;
- m_iMax = iMax;
- m_iStep = iStep;
- m_iFormat = -1;
- m_iLabelMin = -1;
- if (strFormat)
- m_strFormat = strFormat;
- else
- m_strFormat = "%i";
-}
-
-CSettingInt::CSettingInt(int iOrder, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, int iFormat, int iLabelMin)
- : CSetting(iOrder, strSetting, iLabel, iControlType)
-{
- m_iData = iData;
- m_iMin = iMin;
- m_iMax = iMax;
- m_iStep = iStep;
- m_iLabelMin = iLabelMin;
- m_iFormat = iFormat;
- if (m_iFormat < 0)
- m_strFormat = "%i";
-}
-
-CSettingInt::CSettingInt(int iOrder, const char *strSetting, int iLabel,
- int iData, const map<int,int>& entries, int iControlType)
- : CSetting(iOrder, strSetting, iLabel, iControlType),
- m_entries(entries)
-{
- m_iData = iData;
- m_iMin = -1;
- m_iMax = -1;
- m_iStep = 1;
- m_iLabelMin = -1;
-}
-
-void CSettingInt::FromString(const CStdString &strValue)
-{
- int id = atoi(strValue.c_str());
- SetData(id);
-}
-
-CStdString CSettingInt::ToString() const
-{
- CStdString strValue;
- strValue.Format("%i", m_iData);
- return strValue;
-}
-
-void CSettingHex::FromString(const CStdString &strValue)
-{
- int iHexValue;
- if (sscanf(strValue, "%x", (unsigned int *)&iHexValue))
- SetData(iHexValue);
-}
-
-CStdString CSettingHex::ToString() const
-{
- CStdString strValue;
- strValue.Format("%x", m_iData);
- return strValue;
-}
-
-CSettingString::CSettingString(int iOrder, const char *strSetting, int iLabel, const char *strData, int iControlType, bool bAllowEmpty, int iHeadingString)
- : CSetting(iOrder, strSetting, iLabel, iControlType)
-{
- m_strData = strData;
- m_bAllowEmpty = bAllowEmpty;
- m_iHeadingString = iHeadingString;
-}
-
-void CSettingString::FromString(const CStdString &strValue)
-{
- m_strData = strValue;
-}
-
-CStdString CSettingString::ToString() const
-{
- return m_strData;
-}
-
-CSettingPath::CSettingPath(int iOrder, const char *strSetting, int iLabel, const char *strData, int iControlType, bool bAllowEmpty, int iHeadingString)
- : CSettingString(iOrder, strSetting, iLabel, strData, iControlType, bAllowEmpty, iHeadingString)
-{
-}
-
-CSettingAddon::CSettingAddon(int iOrder, const char *strSetting, int iLabel, const char *strData, const TYPE type)
- : CSettingString(iOrder, strSetting, iLabel, strData, BUTTON_CONTROL_STANDARD, false, -1)
- , m_type(type)
-{
-}
-
-CSettingsCategory* CSettingsGroup::AddCategory(const char *strCategory, int labelID)
-{
- // Remove the category if it already exists
- for (vecSettingsCategory::iterator it = m_vecCategories.begin(); it != m_vecCategories.end(); it++)
- {
- if ((*it)->m_strCategory.Equals(strCategory))
- {
- delete (*it);
- m_vecCategories.erase(it);
- break;
- }
- }
- CSettingsCategory *pCategory = new CSettingsCategory(strCategory, labelID);
- if (pCategory)
- m_vecCategories.push_back(pCategory);
- return pCategory;
-}
-
-void CSettingsGroup::GetCategories(vecSettingsCategory &vecCategories)
-{
- vecCategories.clear();
- for (unsigned int i = 0; i < m_vecCategories.size(); i++)
- {
- vecSettings settings;
- // check whether we actually have these settings available.
- g_guiSettings.GetSettingsGroup(m_vecCategories[i], settings);
- if (settings.size())
- vecCategories.push_back(m_vecCategories[i]);
- }
-}
-
-#define SETTINGS_PICTURES WINDOW_SETTINGS_MYPICTURES - WINDOW_SETTINGS_START
-#define SETTINGS_PROGRAMS WINDOW_SETTINGS_MYPROGRAMS - WINDOW_SETTINGS_START
-#define SETTINGS_WEATHER WINDOW_SETTINGS_MYWEATHER - WINDOW_SETTINGS_START
-#define SETTINGS_MUSIC WINDOW_SETTINGS_MYMUSIC - WINDOW_SETTINGS_START
-#define SETTINGS_SYSTEM WINDOW_SETTINGS_SYSTEM - WINDOW_SETTINGS_START
-#define SETTINGS_VIDEOS WINDOW_SETTINGS_MYVIDEOS - WINDOW_SETTINGS_START
-#define SETTINGS_SERVICE WINDOW_SETTINGS_SERVICE - WINDOW_SETTINGS_START
-#define SETTINGS_APPEARANCE WINDOW_SETTINGS_APPEARANCE - WINDOW_SETTINGS_START
-#define SETTINGS_PVR WINDOW_SETTINGS_MYPVR - WINDOW_SETTINGS_START
-
-// Settings are case sensitive
-CGUISettings::CGUISettings(void)
-{
-}
-
-void CGUISettings::Initialize()
-{
- // Pictures settings
- AddGroup(SETTINGS_PICTURES, 1);
- CSettingsCategory* pic = AddCategory(SETTINGS_PICTURES, "pictures", 14081);
- AddBool(pic, "pictures.usetags", 14082, true);
- AddBool(pic,"pictures.generatethumbs",13360,true);
- AddBool(pic, "pictures.useexifrotation", 20184, true);
- AddBool(pic, "pictures.showvideos", 22022, true);
- // FIXME: hide this setting until it is properly respected. In the meanwhile, default to AUTO.
- AddInt(NULL, "pictures.displayresolution", 169, (int)RES_AUTORES, (int)RES_AUTORES, 1, (int)RES_AUTORES, SPIN_CONTROL_TEXT);
-
- CSettingsCategory* cat = AddCategory(SETTINGS_PICTURES, "slideshow", 108);
- AddInt(cat, "slideshow.staytime", 12378, 5, 1, 1, 100, SPIN_CONTROL_INT_PLUS, MASK_SECS);
- AddBool(cat, "slideshow.displayeffects", 12379, true);
- AddBool(NULL, "slideshow.shuffle", 13319, false);
-
- // Programs settings
-// AddGroup(1, 0);
-
- // My Weather settings
- AddGroup(SETTINGS_WEATHER, 8);
- CSettingsCategory* wea = AddCategory(SETTINGS_WEATHER, "weather", 16000);
- AddInt(NULL, "weather.currentlocation", 0, 1, 1, 1, 3, SPIN_CONTROL_INT_PLUS);
- AddDefaultAddon(wea, "weather.addon", 24029, "weather.wunderground", ADDON_SCRIPT_WEATHER);
- AddString(wea, "weather.addonsettings", 21417, "", BUTTON_CONTROL_STANDARD, true);
-
- // My Music Settings
- AddGroup(SETTINGS_MUSIC, 2);
- CSettingsCategory* ml = AddCategory(SETTINGS_MUSIC,"musiclibrary",14022);
- AddBool(NULL, "musiclibrary.enabled", 418, true);
- AddBool(ml, "musiclibrary.showcompilationartists", 13414, true);
- AddSeparator(ml,"musiclibrary.sep1");
- AddBool(ml,"musiclibrary.downloadinfo", 20192, false);
- AddDefaultAddon(ml, "musiclibrary.albumsscraper", 20193, "metadata.album.universal", ADDON_SCRAPER_ALBUMS);
- AddDefaultAddon(ml, "musiclibrary.artistsscraper", 20194, "metadata.artists.universal", ADDON_SCRAPER_ARTISTS);
- AddBool(ml, "musiclibrary.updateonstartup", 22000, false);
- AddBool(ml, "musiclibrary.backgroundupdate", 22001, false);
- AddSeparator(ml,"musiclibrary.sep2");
- AddString(ml, "musiclibrary.cleanup", 334, "", BUTTON_CONTROL_STANDARD);
- AddString(ml, "musiclibrary.export", 20196, "", BUTTON_CONTROL_STANDARD);
- AddString(ml, "musiclibrary.import", 20197, "", BUTTON_CONTROL_STANDARD);
-
- CSettingsCategory* mp = AddCategory(SETTINGS_MUSIC, "musicplayer", 14086);
- AddBool(mp, "musicplayer.autoplaynextitem", 489, true);
- AddBool(mp, "musicplayer.queuebydefault", 14084, false);
- AddSeparator(mp, "musicplayer.sep1");
- map<int,int> gain;
- gain.insert(make_pair(351,REPLAY_GAIN_NONE));
- gain.insert(make_pair(639,REPLAY_GAIN_TRACK));
- gain.insert(make_pair(640,REPLAY_GAIN_ALBUM));
-
- AddInt(mp, "musicplayer.replaygaintype", 638, REPLAY_GAIN_ALBUM, gain, SPIN_CONTROL_TEXT);
- AddInt(mp, "musicplayer.replaygainpreamp", 641, 89, 77, 1, 101, SPIN_CONTROL_INT_PLUS, MASK_DB);
- AddInt(mp, "musicplayer.replaygainnogainpreamp", 642, 89, 77, 1, 101, SPIN_CONTROL_INT_PLUS, MASK_DB);
- AddBool(mp, "musicplayer.replaygainavoidclipping", 643, false);
- AddSeparator(mp, "musicplayer.sep2");
- AddInt(mp, "musicplayer.crossfade", 13314, 0, 0, 1, 15, SPIN_CONTROL_INT_PLUS, MASK_SECS, TEXT_OFF);
- AddBool(mp, "musicplayer.crossfadealbumtracks", 13400, true);
- AddSeparator(mp, "musicplayer.sep3");
- AddDefaultAddon(mp, "musicplayer.visualisation", 250, DEFAULT_VISUALISATION, ADDON_VIZ);
-
- CSettingsCategory* mf = AddCategory(SETTINGS_MUSIC, "musicfiles", 14081);
- AddBool(mf, "musicfiles.usetags", 258, true);
- AddString(mf, "musicfiles.trackformat", 13307, "[%N. ]%A - %T", EDIT_CONTROL_INPUT, false, 16016);
- AddString(mf, "musicfiles.trackformatright", 13387, "%D", EDIT_CONTROL_INPUT, false, 16016);
- // advanced per-view trackformats.
- AddString(NULL, "musicfiles.nowplayingtrackformat", 13307, "", EDIT_CONTROL_INPUT, false, 16016);
- AddString(NULL, "musicfiles.nowplayingtrackformatright", 13387, "", EDIT_CONTROL_INPUT, false, 16016);
- AddString(NULL, "musicfiles.librarytrackformat", 13307, "", EDIT_CONTROL_INPUT, false, 16016);
- AddString(NULL, "musicfiles.librarytrackformatright", 13387, "", EDIT_CONTROL_INPUT, false, 16016);
- AddBool(mf, "musicfiles.findremotethumbs", 14059, true);
-
- CSettingsCategory* acd = AddCategory(SETTINGS_MUSIC, "audiocds", 620);
- map<int,int> autocd;
- autocd.insert(make_pair(16018, AUTOCD_NONE));
- autocd.insert(make_pair(14098, AUTOCD_PLAY));
-#ifdef HAS_CDDA_RIPPER
- autocd.insert(make_pair(14096, AUTOCD_RIP));
-#endif
- AddInt(acd,"audiocds.autoaction",14097,AUTOCD_NONE, autocd, SPIN_CONTROL_TEXT);
- AddBool(acd, "audiocds.usecddb", 227, true);
- AddSeparator(acd, "audiocds.sep1");
- AddPath(acd,"audiocds.recordingpath",20000,"select writable folder",BUTTON_CONTROL_PATH_INPUT,false,657);
- AddString(acd, "audiocds.trackpathformat", 13307, "%A - %B/[%N. ][%A - ]%T", EDIT_CONTROL_INPUT, false, 16016);
- map<int,int> encoders;
-#ifdef HAVE_LIBMP3LAME
- encoders.insert(make_pair(34000,CDDARIP_ENCODER_LAME));
-#endif
-#ifdef HAVE_LIBVORBISENC
- encoders.insert(make_pair(34001,CDDARIP_ENCODER_VORBIS));
-#endif
- encoders.insert(make_pair(34002,CDDARIP_ENCODER_WAV));
- encoders.insert(make_pair(34005,CDDARIP_ENCODER_FLAC));
- AddInt(acd, "audiocds.encoder", 621, CDDARIP_ENCODER_FLAC, encoders, SPIN_CONTROL_TEXT);
-
- map<int,int> qualities;
- qualities.insert(make_pair(604,CDDARIP_QUALITY_CBR));
- qualities.insert(make_pair(601,CDDARIP_QUALITY_MEDIUM));
- qualities.insert(make_pair(602,CDDARIP_QUALITY_STANDARD));
- qualities.insert(make_pair(603,CDDARIP_QUALITY_EXTREME));
- AddInt(acd, "audiocds.quality", 622, CDDARIP_QUALITY_CBR, qualities, SPIN_CONTROL_TEXT);
- AddInt(acd, "audiocds.bitrate", 623, 192, 128, 32, 320, SPIN_CONTROL_INT_PLUS, MASK_KBPS);
- AddInt(acd, "audiocds.compressionlevel", 665, 5, 0, 1, 8, SPIN_CONTROL_INT_PLUS);
- AddBool(acd, "audiocds.ejectonrip", 14099, true);
-
-#ifdef HAS_KARAOKE
- CSettingsCategory* kar = AddCategory(SETTINGS_MUSIC, "karaoke", 13327);
- AddBool(kar, "karaoke.enabled", 13323, false);
- // auto-popup the song selector dialog when the karaoke song was just finished and playlist is empty.
- AddBool(kar, "karaoke.autopopupselector", 22037, false);
- AddSeparator(kar, "karaoke.sep1");
- AddString(kar, "karaoke.font", 22030, "arial.ttf", SPIN_CONTROL_TEXT);
- AddInt(kar, "karaoke.fontheight", 22031, 36, 16, 2, 74, SPIN_CONTROL_TEXT); // use text as there is a disk based lookup needed
- map<int,int> colors;
- for (int i = KARAOKE_COLOR_START; i < KARAOKE_COLOR_END; i++)
- colors.insert(make_pair(22040 + i, i));
- AddInt(kar, "karaoke.fontcolors", 22032, KARAOKE_COLOR_START, colors, SPIN_CONTROL_TEXT);
- AddString(kar, "karaoke.charset", 22033, "DEFAULT", SPIN_CONTROL_TEXT);
- AddSeparator(kar,"karaoke.sep2");
- AddString(kar, "karaoke.export", 22038, "", BUTTON_CONTROL_STANDARD);
- AddString(kar, "karaoke.importcsv", 22036, "", BUTTON_CONTROL_STANDARD);
-#endif
-
- // System settings
- AddGroup(SETTINGS_SYSTEM, 13000);
- CSettingsCategory* vs = AddCategory(SETTINGS_SYSTEM, "videoscreen", 21373);
-
- // this setting would ideally not be saved, as its value is systematically derived from videoscreen.screenmode.
- // contains a DISPLAYMODE
-#if !defined(TARGET_DARWIN_IOS_ATV2) && !defined(TARGET_RASPBERRY_PI)
- AddInt(vs, "videoscreen.screen", 240, 0, -1, 1, 32, SPIN_CONTROL_TEXT);
-#endif
- // this setting would ideally not be saved, as its value is systematically derived from videoscreen.screenmode.
- // contains an index to the resolution info array in CDisplaySettings. the only meaningful fields are iScreen, iWidth, iHeight.
-#if defined(TARGET_DARWIN)
- #if !defined(TARGET_DARWIN_IOS_ATV2)
- AddInt(vs, "videoscreen.resolution", 131, -1, 0, 1, INT_MAX, SPIN_CONTROL_TEXT);
- #endif
-#else
- AddInt(vs, "videoscreen.resolution", 169, -1, 0, 1, INT_MAX, SPIN_CONTROL_TEXT);
-#endif
- AddString(g_application.IsStandAlone() ? vs : NULL, "videoscreen.screenmode", 243, "DESKTOP", SPIN_CONTROL_TEXT);
-
-#if defined(_WIN32) || defined(TARGET_DARWIN)
- // We prefer a fake fullscreen mode (window covering the screen rather than dedicated fullscreen)
- // as it works nicer with switching to other applications. However on some systems vsync is broken
- // when we do this (eg non-Aero on ATI in particular) and on others (AppleTV) we can't get XBMC to
- // the front
- bool fakeFullScreen = true;
- bool showSetting = true;
- if (g_sysinfo.IsAeroDisabled())
- fakeFullScreen = false;
-
-#if defined(_WIN32) && defined(HAS_GL)
- fakeFullScreen = true;
- showSetting = false;
-#endif
-
-#if defined(TARGET_DARWIN)
- showSetting = false;
-#endif
- AddBool(showSetting ? vs : NULL, "videoscreen.fakefullscreen", 14083, fakeFullScreen);
-#ifdef TARGET_DARWIN_IOS
- AddBool(NULL, "videoscreen.blankdisplays", 13130, false);
-#else
- AddBool(vs, "videoscreen.blankdisplays", 13130, false);
-#endif
-
- AddSeparator(vs, "videoscreen.sep1");
-#endif
-
- map<int,int> vsync;
-#if defined(_LINUX) && !defined(TARGET_DARWIN)
- vsync.insert(make_pair(13101,VSYNC_DRIVER));
-#endif
- vsync.insert(make_pair(13106,VSYNC_DISABLED));
- vsync.insert(make_pair(13107,VSYNC_VIDEO));
- vsync.insert(make_pair(13108,VSYNC_ALWAYS));
- AddInt(vs, "videoscreen.vsync", 13105, DEFAULT_VSYNC, vsync, SPIN_CONTROL_TEXT);
-
- AddString(vs, "videoscreen.guicalibration",214,"", BUTTON_CONTROL_STANDARD);
-#if defined(HAS_GL)
- // Todo: Implement test pattern for DX
- 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;
- audiomode.insert(make_pair(338,AUDIO_ANALOG));
-#if !defined(TARGET_RASPBERRY_PI)
- audiomode.insert(make_pair(339,AUDIO_IEC958));
-#endif
- audiomode.insert(make_pair(420,AUDIO_HDMI ));
-#if defined(TARGET_RASPBERRY_PI)
- AddInt(ao, "audiooutput.mode", 337, AUDIO_HDMI, audiomode, SPIN_CONTROL_TEXT);
-#else
- AddInt(ao, "audiooutput.mode", 337, AUDIO_ANALOG, audiomode, SPIN_CONTROL_TEXT);
-#endif
-
- map<int,int> channelLayout;
- for(int layout = AE_CH_LAYOUT_2_0; layout < AE_CH_LAYOUT_MAX; ++layout)
- channelLayout.insert(make_pair(34100+layout, layout));
- AddInt(ao, "audiooutput.channels", 34100, AE_CH_LAYOUT_2_0, channelLayout, SPIN_CONTROL_TEXT);
- AddBool(ao, "audiooutput.normalizelevels", 346, true);
- AddBool(ao, "audiooutput.stereoupmix", 252, false);
-
-#if defined(TARGET_DARWIN_IOS)
- CSettingsCategory* aocat = g_sysinfo.IsAppleTV2() ? ao : NULL;
-#else
- CSettingsCategory* aocat = ao;
-#endif
-
- AddBool(aocat, "audiooutput.ac3passthrough" , 364, true);
- AddBool(aocat, "audiooutput.dtspassthrough" , 254, true);
-
-
-#if !defined(TARGET_DARWIN) && !defined(TARGET_RASPBERRY_PI)
- AddBool(aocat, "audiooutput.passthroughaac" , 299, false);
-#endif
-#if !defined(TARGET_DARWIN_IOS) && !defined(TARGET_RASPBERRY_PI)
- AddBool(aocat, "audiooutput.multichannellpcm" , 348, true );
-#endif
-#if !defined(TARGET_DARWIN) && !defined(TARGET_RASPBERRY_PI)
- AddBool(aocat, "audiooutput.truehdpassthrough", 349, true );
- AddBool(aocat, "audiooutput.dtshdpassthrough" , 347, true );
-#endif
-
-#if !defined(TARGET_RASPBERRY_PI)
-#if defined(TARGET_DARWIN)
- #if defined(TARGET_DARWIN_IOS)
- CStdString defaultDeviceName = "Default";
- #else
- CStdString defaultDeviceName;
- CCoreAudioHardware::GetOutputDeviceName(defaultDeviceName);
- #endif
- AddString(ao, "audiooutput.audiodevice", 545, defaultDeviceName.c_str(), SPIN_CONTROL_TEXT);
- AddString(NULL, "audiooutput.passthroughdevice", 546, defaultDeviceName.c_str(), SPIN_CONTROL_TEXT);
-#else
- AddSeparator(ao, "audiooutput.sep1");
- AddString (ao, "audiooutput.audiodevice" , 545, CStdString(CAEFactory::GetDefaultDevice(false)), SPIN_CONTROL_TEXT);
- AddString (ao, "audiooutput.passthroughdevice", 546, CStdString(CAEFactory::GetDefaultDevice(true )), SPIN_CONTROL_TEXT);
- AddSeparator(ao, "audiooutput.sep2");
-#endif
-#endif
-
-#if !defined(TARGET_RASPBERRY_PI)
- map<int,int> guimode;
- guimode.insert(make_pair(34121, AE_SOUND_IDLE ));
- guimode.insert(make_pair(34122, AE_SOUND_ALWAYS));
- guimode.insert(make_pair(34123, AE_SOUND_OFF ));
- AddInt(ao, "audiooutput.guisoundmode", 34120, AE_SOUND_IDLE, guimode, SPIN_CONTROL_TEXT);
-#endif
-
- CSettingsCategory* in = AddCategory(SETTINGS_SYSTEM, "input", 14094);
- AddString(in, "input.peripherals", 35000, "", BUTTON_CONTROL_STANDARD);
-#if defined(TARGET_DARWIN)
- map<int,int> remotemode;
- remotemode.insert(make_pair(13610,APPLE_REMOTE_DISABLED));
- remotemode.insert(make_pair(13611,APPLE_REMOTE_STANDARD));
- remotemode.insert(make_pair(13612,APPLE_REMOTE_UNIVERSAL));
- remotemode.insert(make_pair(13613,APPLE_REMOTE_MULTIREMOTE));
- AddInt(in, "input.appleremotemode", 13600, APPLE_REMOTE_STANDARD, remotemode, SPIN_CONTROL_TEXT);
-#if defined(TARGET_DARWIN_OSX)
- AddBool(in, "input.appleremotealwayson", 13602, false);
-#else
- AddBool(NULL, "input.appleremotealwayson", 13602, false);
-#endif
- AddInt(NULL, "input.appleremotesequencetime", 13603, 500, 50, 50, 1000, SPIN_CONTROL_INT_PLUS, MASK_MS, TEXT_OFF);
- AddSeparator(in, "input.sep1");
-#endif
- AddBool(in, "input.remoteaskeyboard", 21449, false);
-#if defined(TARGET_DARWIN_IOS)
- AddBool(NULL, "input.enablemouse", 21369, true);
-#else
- AddBool(in, "input.enablemouse", 21369, true);
-#endif
-#if defined(HAS_SDL_JOYSTICK)
- AddBool(in, "input.enablejoystick", 35100, true);
-#endif
-
- CSettingsCategory* net = AddCategory(SETTINGS_SYSTEM, "network", 798);
- if (g_application.IsStandAlone())
- {
-#if !defined(TARGET_DARWIN)
- AddString(NULL, "network.interface",775,"", SPIN_CONTROL_TEXT);
-
- map<int, int> networkAssignments;
- networkAssignments.insert(make_pair(716, NETWORK_DHCP));
- networkAssignments.insert(make_pair(717, NETWORK_STATIC));
- networkAssignments.insert(make_pair(787, NETWORK_DISABLED));
- AddInt(NULL, "network.assignment", 715, NETWORK_DHCP, networkAssignments, SPIN_CONTROL_TEXT);
- AddString(NULL, "network.ipaddress", 719, "0.0.0.0", EDIT_CONTROL_IP_INPUT);
- AddString(NULL, "network.subnet", 720, "255.255.255.0", EDIT_CONTROL_IP_INPUT);
- AddString(NULL, "network.gateway", 721, "0.0.0.0", EDIT_CONTROL_IP_INPUT);
- AddString(NULL, "network.dns", 722, "0.0.0.0", EDIT_CONTROL_IP_INPUT);
- AddString(NULL, "network.dnssuffix", 22002, "", EDIT_CONTROL_INPUT, true);
- AddString(NULL, "network.essid", 776, "0.0.0.0", BUTTON_CONTROL_STANDARD);
-
- map<int, int> networkEncapsulations;
- networkEncapsulations.insert(make_pair(780, ENC_NONE));
- networkEncapsulations.insert(make_pair(781, ENC_WEP));
- networkEncapsulations.insert(make_pair(782, ENC_WPA));
- networkEncapsulations.insert(make_pair(783, ENC_WPA2));
- AddInt(NULL, "network.enc", 778, ENC_NONE, networkEncapsulations, SPIN_CONTROL_TEXT);
- AddString(NULL, "network.key", 777, "0.0.0.0", EDIT_CONTROL_INPUT);
-#ifndef _WIN32
- AddString(NULL, "network.save", 779, "", BUTTON_CONTROL_STANDARD);
-#endif
- AddSeparator(NULL, "network.sep1");
-#endif
- }
- AddBool(net, "network.usehttpproxy", 708, false);
- map<int,int> proxyTypes;
- proxyTypes.insert(make_pair(1181, XFILE::CCurlFile::PROXY_HTTP));
- proxyTypes.insert(make_pair(1182, XFILE::CCurlFile::PROXY_SOCKS4));
- proxyTypes.insert(make_pair(1183, XFILE::CCurlFile::PROXY_SOCKS4A));
- proxyTypes.insert(make_pair(1184, XFILE::CCurlFile::PROXY_SOCKS5));
- proxyTypes.insert(make_pair(1185, XFILE::CCurlFile::PROXY_SOCKS5_REMOTE));
- AddInt(net, "network.httpproxytype", 1180, XFILE::CCurlFile::PROXY_HTTP, proxyTypes, SPIN_CONTROL_TEXT);
- AddString(net, "network.httpproxyserver", 706, "", EDIT_CONTROL_INPUT);
- AddString(net, "network.httpproxyport", 730, "8080", EDIT_CONTROL_NUMBER_INPUT, false, 707);
- AddString(net, "network.httpproxyusername", 1048, "", EDIT_CONTROL_INPUT);
- AddString(net, "network.httpproxypassword", 733, "", EDIT_CONTROL_HIDDEN_INPUT,true,733);
- AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024, SPIN_CONTROL_INT_PLUS, MASK_KBPS, TEXT_OFF);
-
- CSettingsCategory* pwm = AddCategory(SETTINGS_SYSTEM, "powermanagement", 14095);
- // Note: Application.cpp might hide powersaving settings if not supported.
- AddInt(pwm, "powermanagement.displaysoff", 1450, 0, 0, 5, 120, SPIN_CONTROL_INT_PLUS, MASK_MINS, TEXT_OFF);
- AddInt(pwm, "powermanagement.shutdowntime", 357, 0, 0, 5, 120, SPIN_CONTROL_INT_PLUS, MASK_MINS, TEXT_OFF);
-
- map<int,int> shutdown;
- if (g_powerManager.CanPowerdown())
- shutdown.insert(make_pair(13005,POWERSTATE_SHUTDOWN));
-
- if (g_powerManager.CanHibernate())
- shutdown.insert(make_pair(13010,POWERSTATE_HIBERNATE));
-
- if (g_powerManager.CanSuspend())
- shutdown.insert(make_pair(13011,POWERSTATE_SUSPEND));
-
- // In standalone mode we default to another.
- if (g_application.IsStandAlone())
- AddInt(pwm, "powermanagement.shutdownstate", 13008, POWERSTATE_SHUTDOWN, shutdown, SPIN_CONTROL_TEXT);
- else
- {
- shutdown.insert(make_pair(13009,POWERSTATE_QUIT));
-#if !defined(TARGET_DARWIN_IOS)
- shutdown.insert(make_pair(13014,POWERSTATE_MINIMIZE));
-#endif
- AddInt(pwm, "powermanagement.shutdownstate", 13008, POWERSTATE_QUIT, shutdown, SPIN_CONTROL_TEXT);
- }
-
- CSettingsCategory* dbg = AddCategory(SETTINGS_SYSTEM, "debug", 14092);
- AddBool(dbg, "debug.showloginfo", 20191, false);
- AddPath(dbg, "debug.screenshotpath",20004,"select writable folder",BUTTON_CONTROL_PATH_INPUT,false,657);
-
- CSettingsCategory* mst = AddCategory(SETTINGS_SYSTEM, "masterlock", 12360);
- AddString(mst, "masterlock.lockcode" , 20100, "-", BUTTON_CONTROL_STANDARD);
- AddBool(mst, "masterlock.startuplock" , 20076,false);
- // hidden masterlock settings
- AddInt(NULL,"masterlock.maxretries", 12364, 3, 3, 1, 100, SPIN_CONTROL_TEXT);
-
- AddCategory(SETTINGS_SYSTEM, "cache", 439);
- AddInt(NULL, "cache.harddisk", 14025, 256, 0, 256, 4096, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddSeparator(NULL, "cache.sep1");
- AddInt(NULL, "cachevideo.dvdrom", 14026, 2048, 0, 256, 16384, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddInt(NULL, "cachevideo.lan", 14027, 2048, 0, 256, 16384, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddInt(NULL, "cachevideo.internet", 14028, 4096, 0, 256, 16384, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddSeparator(NULL, "cache.sep2");
- AddInt(NULL, "cacheaudio.dvdrom", 14030, 256, 0, 256, 4096, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddInt(NULL, "cacheaudio.lan", 14031, 256, 0, 256, 4096, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddInt(NULL, "cacheaudio.internet", 14032, 256, 0, 256, 4096, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddSeparator(NULL, "cache.sep3");
- AddInt(NULL, "cachedvd.dvdrom", 14034, 2048, 0, 256, 16384, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddInt(NULL, "cachedvd.lan", 14035, 2048, 0, 256, 16384, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
- AddSeparator(NULL, "cache.sep4");
- AddInt(NULL, "cacheunknown.internet", 14060, 4096, 0, 256, 16384, SPIN_CONTROL_INT_PLUS, MASK_KB, TEXT_OFF);
-
- // video settings
- AddGroup(SETTINGS_VIDEOS, 3);
- CSettingsCategory* vdl = AddCategory(SETTINGS_VIDEOS, "videolibrary", 14022);
- AddBool(NULL, "videolibrary.enabled", 418, true);
- AddBool(vdl, "videolibrary.showunwatchedplots", 20369, true);
- AddBool(NULL, "videolibrary.seasonthumbs", 20382, true);
- AddBool(vdl, "videolibrary.actorthumbs", 20402, true);
-
- map<int, int> flattenTVShowOptions;
- flattenTVShowOptions.insert(make_pair(20420, 0));
- flattenTVShowOptions.insert(make_pair(20421, 1));
- flattenTVShowOptions.insert(make_pair(20422, 2));
- AddInt(vdl, "videolibrary.flattentvshows", 20412, 1, flattenTVShowOptions, SPIN_CONTROL_TEXT);
-
- AddBool(vdl, "videolibrary.groupmoviesets", 20458, false);
- AddBool(vdl, "videolibrary.updateonstartup", 22000, false);
- AddBool(vdl, "videolibrary.backgroundupdate", 22001, false);
- AddSeparator(vdl, "videolibrary.sep3");
- AddString(vdl, "videolibrary.cleanup", 334, "", BUTTON_CONTROL_STANDARD);
- AddString(vdl, "videolibrary.export", 647, "", BUTTON_CONTROL_STANDARD);
- AddString(vdl, "videolibrary.import", 648, "", BUTTON_CONTROL_STANDARD);
-
- CSettingsCategory* vp = AddCategory(SETTINGS_VIDEOS, "videoplayer", 14086);
-
- AddBool(vp, "videoplayer.autoplaynextitem", 13433, false);
- AddSeparator(vp, "videoplayer.sep1");
-
- map<int, int> renderers;
- renderers.insert(make_pair(13416, RENDER_METHOD_AUTO));
-
-#ifdef HAS_DX
- if (g_sysinfo.IsVistaOrHigher())
- renderers.insert(make_pair(16319, RENDER_METHOD_DXVA));
- renderers.insert(make_pair(13431, RENDER_METHOD_D3D_PS));
- renderers.insert(make_pair(13419, RENDER_METHOD_SOFTWARE));
-#endif
-
-#ifdef HAS_GL
- renderers.insert(make_pair(13417, RENDER_METHOD_ARB));
- renderers.insert(make_pair(13418, RENDER_METHOD_GLSL));
- renderers.insert(make_pair(13419, RENDER_METHOD_SOFTWARE));
-#endif
- AddInt(vp, "videoplayer.rendermethod", 13415, RENDER_METHOD_AUTO, renderers, SPIN_CONTROL_TEXT);
-
- AddInt(vp, "videoplayer.hqscalers", 13435, 0, 0, 10, 100, SPIN_CONTROL_INT);
-
-#ifdef HAVE_LIBVDPAU
- AddBool(vp, "videoplayer.usevdpau", 13425, true);
-#endif
-#ifdef HAVE_LIBVA
- AddBool(vp, "videoplayer.usevaapi", 13426, true);
-#endif
-#ifdef HAS_DX
- AddBool(g_sysinfo.IsVistaOrHigher() ? vp: NULL, "videoplayer.usedxva2", 13427, g_sysinfo.IsVistaOrHigher() ? true : false);
-#endif
-#ifdef HAVE_LIBCRYSTALHD
- AddBool(CCrystalHD::GetInstance()->DevicePresent() ? vp: NULL, "videoplayer.usechd", 13428, true);
-#endif
-#ifdef HAVE_LIBVDADECODER
- AddBool(g_sysinfo.HasVDADecoder() ? vp: NULL, "videoplayer.usevda", 13429, true);
-#endif
-#ifdef HAVE_LIBOPENMAX
- AddBool(vp, "videoplayer.useomx", 13430, true);
-#endif
-#ifdef HAVE_VIDEOTOOLBOXDECODER
- AddBool(g_sysinfo.HasVideoToolBoxDecoder() ? vp: NULL, "videoplayer.usevideotoolbox", 13432, true);
-#endif
-
-#ifdef HAS_GL
- AddBool(NULL, "videoplayer.usepbo", 13424, true);
-#endif
-
- // FIXME: hide this setting until it is properly respected. In the meanwhile, default to AUTO.
- //AddInt(5, "videoplayer.displayresolution", 169, (int)RES_AUTORES, (int)RES_AUTORES, 1, (int)CUSTOM+MAX_RESOLUTIONS, SPIN_CONTROL_TEXT);
- AddInt(NULL, "videoplayer.displayresolution", 169, (int)RES_AUTORES, (int)RES_AUTORES, 1, (int)RES_AUTORES, SPIN_CONTROL_TEXT);
-
- map<int, int> adjustTypes;
- adjustTypes.insert(make_pair(351, ADJUST_REFRESHRATE_OFF));
- adjustTypes.insert(make_pair(36035, ADJUST_REFRESHRATE_ALWAYS));
- adjustTypes.insert(make_pair(36036, ADJUST_REFRESHRATE_ON_STARTSTOP));
-
-#if !defined(TARGET_DARWIN_IOS)
- AddInt(vp, "videoplayer.adjustrefreshrate", 170, ADJUST_REFRESHRATE_OFF, adjustTypes, SPIN_CONTROL_TEXT);
-// AddBool(vp, "videoplayer.adjustrefreshrate", 170, false);
- AddInt(vp, "videoplayer.pauseafterrefreshchange", 13550, 0, 0, 1, MAXREFRESHCHANGEDELAY, SPIN_CONTROL_TEXT);
-#else
- AddInt(NULL, "videoplayer.adjustrefreshrate", 170, ADJUST_REFRESHRATE_OFF, adjustTypes, SPIN_CONTROL_TEXT);
- //AddBool(NULL, "videoplayer.adjustrefreshrate", 170, false);
- AddInt(NULL, "videoplayer.pauseafterrefreshchange", 13550, 0, 0, 1, MAXREFRESHCHANGEDELAY, SPIN_CONTROL_TEXT);
-#endif
- //sync settings not available on windows gl build
-#if defined(_WIN32) && defined(HAS_GL)
- #define SYNCSETTINGS 0
-#else
- #define SYNCSETTINGS 1
-#endif
- AddBool(SYNCSETTINGS ? vp : NULL, "videoplayer.usedisplayasclock", 13510, false);
-
- map<int, int> syncTypes;
- syncTypes.insert(make_pair(13501, SYNC_DISCON));
- syncTypes.insert(make_pair(13502, SYNC_SKIPDUP));
- syncTypes.insert(make_pair(13503, SYNC_RESAMPLE));
- AddInt(SYNCSETTINGS ? vp : NULL, "videoplayer.synctype", 13500, SYNC_RESAMPLE, syncTypes, SPIN_CONTROL_TEXT);
- AddFloat(NULL, "videoplayer.maxspeedadjust", 13504, 5.0f, 0.0f, 0.1f, 10.0f);
-
- map<int, int> resampleQualities;
- resampleQualities.insert(make_pair(13506, RESAMPLE_LOW));
- resampleQualities.insert(make_pair(13507, RESAMPLE_MID));
- resampleQualities.insert(make_pair(13508, RESAMPLE_HIGH));
- resampleQualities.insert(make_pair(13509, RESAMPLE_REALLYHIGH));
- AddInt(NULL, "videoplayer.resamplequality", 13505, RESAMPLE_MID, resampleQualities, SPIN_CONTROL_TEXT);
- AddInt(vp, "videoplayer.errorinaspect", 22021, 0, 0, 1, 20, SPIN_CONTROL_INT_PLUS, MASK_PERCENT, TEXT_NONE);
-
- map<int,int> stretch;
- stretch.insert(make_pair(630,ViewModeNormal));
- stretch.insert(make_pair(633,ViewModeWideZoom));
- stretch.insert(make_pair(634,ViewModeStretch16x9));
- stretch.insert(make_pair(631,ViewModeZoom));
- AddInt(vp, "videoplayer.stretch43", 173, ViewModeNormal, stretch, SPIN_CONTROL_TEXT);
-#ifdef HAVE_LIBVDPAU
- AddBool(NULL, "videoplayer.vdpau_allow_xrandr", 13122, false);
-#endif
-#if defined(HAS_GL) || HAS_GLES == 2 // May need changing for GLES
- AddSeparator(vp, "videoplayer.sep1.5");
-#ifdef HAVE_LIBVDPAU
- AddBool(NULL, "videoplayer.vdpauUpscalingLevel", 13121, false);
- AddBool(NULL, "videoplayer.vdpaustudiolevel", 0, false); //depreciated
-#endif
-#endif
- AddSeparator(vp, "videoplayer.sep5");
- AddBool(vp, "videoplayer.teletextenabled", 23050, true);
- AddBool(vp, "Videoplayer.teletextscale", 23055, true);
-
- CSettingsCategory* vid = AddCategory(SETTINGS_VIDEOS, "myvideos", 14081);
-
- map<int, int> myVideosSelectActions;
- myVideosSelectActions.insert(make_pair(22080, SELECT_ACTION_CHOOSE));
- myVideosSelectActions.insert(make_pair(208, SELECT_ACTION_PLAY_OR_RESUME));
- myVideosSelectActions.insert(make_pair(13404, SELECT_ACTION_RESUME));
- myVideosSelectActions.insert(make_pair(22081, SELECT_ACTION_INFO));
-
- AddInt(vid, "myvideos.selectaction", 22079, SELECT_ACTION_PLAY_OR_RESUME, myVideosSelectActions, SPIN_CONTROL_TEXT);
- AddBool(vid, "myvideos.extractflags",20433, true);
- AddBool(vid, "myvideos.replacelabels", 20419, true);
- AddBool(NULL, "myvideos.extractthumb",20433, true);
-
- AddSeparator(NULL, "myvideos.sep1");
- AddInt(NULL, "myvideos.startwindow", 0, WINDOW_VIDEO_FILES, WINDOW_VIDEO_FILES, 1, WINDOW_VIDEO_NAV, SPIN_CONTROL_INT);
- AddBool(NULL, "myvideos.stackvideos", 0, false);
- AddBool(NULL, "myvideos.flatten", 0, false);
-
- CSettingsCategory* sub = AddCategory(SETTINGS_VIDEOS, "subtitles", 287);
- AddString(sub, "subtitles.font", 14089, "arial.ttf", SPIN_CONTROL_TEXT);
- AddInt(sub, "subtitles.height", 289, 28, 16, 2, 74, SPIN_CONTROL_TEXT); // use text as there is a disk based lookup needed
-
- map<int, int> fontStyles;
- fontStyles.insert(make_pair(738, FONT_STYLE_NORMAL));
- fontStyles.insert(make_pair(739, FONT_STYLE_BOLD));
- fontStyles.insert(make_pair(740, FONT_STYLE_ITALICS));
- fontStyles.insert(make_pair(741, FONT_STYLE_BOLD | FONT_STYLE_ITALICS));
-
- AddInt(sub, "subtitles.style", 736, FONT_STYLE_BOLD, fontStyles, SPIN_CONTROL_TEXT);
- AddInt(sub, "subtitles.color", 737, SUBTITLE_COLOR_START + 1, SUBTITLE_COLOR_START, 1, SUBTITLE_COLOR_END, SPIN_CONTROL_TEXT);
- AddString(sub, "subtitles.charset", 735, "DEFAULT", SPIN_CONTROL_TEXT);
- AddBool(sub,"subtitles.overrideassfonts", 21368, false);
- AddSeparator(sub, "subtitles.sep1");
- AddPath(sub, "subtitles.custompath", 21366, "", BUTTON_CONTROL_PATH_INPUT, false, 657);
-
- map<int, int> subtitleAlignments;
- subtitleAlignments.insert(make_pair(21461, SUBTITLE_ALIGN_MANUAL));
- subtitleAlignments.insert(make_pair(21462, SUBTITLE_ALIGN_BOTTOM_INSIDE));
- subtitleAlignments.insert(make_pair(21463, SUBTITLE_ALIGN_BOTTOM_OUTSIDE));
- subtitleAlignments.insert(make_pair(21464, SUBTITLE_ALIGN_TOP_INSIDE));
- subtitleAlignments.insert(make_pair(21465, SUBTITLE_ALIGN_TOP_OUTSIDE));
- AddInt(sub, "subtitles.align", 21460, SUBTITLE_ALIGN_MANUAL, subtitleAlignments, SPIN_CONTROL_TEXT);
-
- CSettingsCategory* dvd = AddCategory(SETTINGS_VIDEOS, "dvds", 14087);
- AddBool(dvd, "dvds.autorun", 14088, false);
- AddInt(dvd, "dvds.playerregion", 21372, 0, 0, 1, 8, SPIN_CONTROL_INT_PLUS, -1, TEXT_OFF);
- AddBool(dvd, "dvds.automenu", 21882, false);
-
- AddDefaultAddon(NULL, "scrapers.moviesdefault", 21413, "metadata.themoviedb.org", ADDON_SCRAPER_MOVIES);
- AddDefaultAddon(NULL, "scrapers.tvshowsdefault", 21414, "metadata.tvdb.com", ADDON_SCRAPER_TVSHOWS);
- AddDefaultAddon(NULL, "scrapers.musicvideosdefault", 21415, "metadata.musicvideos.theaudiodb.com", ADDON_SCRAPER_MUSICVIDEOS);
-
- // service settings
- AddGroup(SETTINGS_SERVICE, 14036);
-
- CSettingsCategory* srvGeneral = AddCategory(SETTINGS_SERVICE, "general", 16000);
- AddString(srvGeneral,"services.devicename", 1271, "XBMC", EDIT_CONTROL_INPUT);
-
- CSettingsCategory* srvUpnp = AddCategory(SETTINGS_SERVICE, "upnp", 20187);
- AddBool(srvUpnp, "services.upnpserver", 21360, false);
- AddBool(srvUpnp, "services.upnpannounce", 20188, true);
- AddBool(srvUpnp, "services.upnprenderer", 21881, false);
- AddBool(srvUpnp, "services.upnpcontroller", 21361, false);
-
-#ifdef HAS_WEB_SERVER
- CSettingsCategory* srvWeb = AddCategory(SETTINGS_SERVICE, "webserver", 33101);
- AddBool(srvWeb, "services.webserver", 263, false);
- AddString(srvWeb,"services.webserverport", 730, CUtil::CanBindPrivileged()?"80":"8080", EDIT_CONTROL_NUMBER_INPUT, false, 730);
- AddString(srvWeb,"services.webserverusername",1048, "xbmc", EDIT_CONTROL_INPUT);
- AddString(srvWeb,"services.webserverpassword",733, "", EDIT_CONTROL_HIDDEN_INPUT, true, 733);
- AddDefaultAddon(srvWeb, "services.webskin",199, DEFAULT_WEB_INTERFACE, ADDON_WEB_INTERFACE);
-#endif
-#ifdef HAS_EVENT_SERVER
- CSettingsCategory* srvEvent = AddCategory(SETTINGS_SERVICE, "remotecontrol", 790);
- AddBool(srvEvent, "services.esenabled", 791, true);
- AddString(NULL,"services.esport", 792, "9777", EDIT_CONTROL_NUMBER_INPUT, false, 792);
- AddInt(NULL, "services.esportrange", 793, 10, 1, 1, 100, SPIN_CONTROL_INT);
- AddInt(NULL, "services.esmaxclients", 797, 20, 1, 1, 100, SPIN_CONTROL_INT);
- AddBool(srvEvent, "services.esallinterfaces", 794, false);
- AddInt(NULL, "services.esinitialdelay", 795, 750, 5, 5, 10000, SPIN_CONTROL_INT);
- AddInt(NULL, "services.escontinuousdelay", 796, 25, 5, 5, 10000, SPIN_CONTROL_INT);
-#endif
-#ifdef HAS_ZEROCONF
- CSettingsCategory* srvZeroconf = AddCategory(SETTINGS_SERVICE, "zeroconf", 1259);
-#ifdef TARGET_WINDOWS
- AddBool(srvZeroconf, "services.zeroconf", 1260, false);
-#else
- AddBool(srvZeroconf, "services.zeroconf", 1260, true);
-#endif
-#endif
-
-#ifdef HAS_AIRPLAY
- CSettingsCategory* srvAirplay = AddCategory(SETTINGS_SERVICE, "airplay", 1273);
- AddBool(srvAirplay, "services.airplay", 1270, false);
- AddBool(srvAirplay, "services.useairplaypassword", 1272, false);
- AddString(srvAirplay, "services.airplaypassword", 733, "", EDIT_CONTROL_HIDDEN_INPUT, false, 733);
-#endif
-
-#ifndef _WIN32
- CSettingsCategory* srvSmb = AddCategory(SETTINGS_SERVICE, "smb", 1200);
- AddString(srvSmb, "smb.winsserver", 1207, "", EDIT_CONTROL_IP_INPUT);
- AddString(srvSmb, "smb.workgroup", 1202, "WORKGROUP", EDIT_CONTROL_INPUT, false, 1202);
-#endif
-
- // appearance settings
- AddGroup(SETTINGS_APPEARANCE, 480);
- CSettingsCategory* laf = AddCategory(SETTINGS_APPEARANCE,"lookandfeel", 166);
- AddDefaultAddon(laf, "lookandfeel.skin",166,DEFAULT_SKIN, ADDON_SKIN);
- AddString(laf, "lookandfeel.skinsettings", 21417, "", BUTTON_CONTROL_STANDARD);
- AddString(laf, "lookandfeel.skintheme",15111,"SKINDEFAULT", SPIN_CONTROL_TEXT);
- AddString(laf, "lookandfeel.skincolors",14078, "SKINDEFAULT", SPIN_CONTROL_TEXT);
- AddString(laf, "lookandfeel.font",13303,"Default", SPIN_CONTROL_TEXT);
- AddInt(laf, "lookandfeel.skinzoom",20109, 0, -20, 2, 20, SPIN_CONTROL_INT, MASK_PERCENT);
- AddInt(laf, "lookandfeel.startupwindow",512,1, WINDOW_HOME, 1, WINDOW_PYTHON_END, SPIN_CONTROL_TEXT);
- AddString(laf, "lookandfeel.soundskin",15108,"SKINDEFAULT", SPIN_CONTROL_TEXT);
- AddSeparator(laf, "lookandfeel.sep2");
- AddBool(laf, "lookandfeel.enablerssfeeds",13305, true);
- AddString(laf, "lookandfeel.rssedit", 21450, "", BUTTON_CONTROL_STANDARD);
-
- CSettingsCategory* loc = AddCategory(SETTINGS_APPEARANCE, "locale", 14090);
- AddString(loc, "locale.language",248,"English", SPIN_CONTROL_TEXT);
- AddString(loc, "locale.country", 20026, "USA (12h)", SPIN_CONTROL_TEXT);
- AddString(loc, "locale.charset", 14091, "DEFAULT", SPIN_CONTROL_TEXT); // charset is set by the language file
-
- bool use_timezone = false;
-
-#if defined(_LINUX)
-#if defined(TARGET_DARWIN)
- if (g_sysinfo.IsAppleTV2() && GetIOSVersion() < 4.3)
-#endif
-#if !defined(TARGET_ANDROID)
- use_timezone = true;
-#endif
-
- if (use_timezone)
- {
- AddSeparator(loc, "locale.sep1");
- AddString(loc, "locale.timezonecountry", 14079, g_timezone.GetCountryByTimezone(g_timezone.GetOSConfiguredTimezone()), SPIN_CONTROL_TEXT);
- AddString(loc, "locale.timezone", 14080, g_timezone.GetOSConfiguredTimezone(), SPIN_CONTROL_TEXT);
- }
-#endif
- AddSeparator(loc, "locale.sep3");
- AddString(loc, "locale.audiolanguage", 285, "original", SPIN_CONTROL_TEXT);
- AddString(loc, "locale.subtitlelanguage", 286, "original", SPIN_CONTROL_TEXT);
-
- CSettingsCategory* fl = AddCategory(SETTINGS_APPEARANCE, "filelists", 14081);
- AddBool(fl, "filelists.showparentdiritems", 13306, true);
- AddBool(fl, "filelists.showextensions", 497, true);
- AddBool(fl, "filelists.ignorethewhensorting", 13399, true);
- AddBool(fl, "filelists.allowfiledeletion", 14071, false);
- AddBool(fl, "filelists.showaddsourcebuttons", 21382, true);
- AddBool(fl, "filelists.showhidden", 21330, false);
-
- CSettingsCategory* ss = AddCategory(SETTINGS_APPEARANCE, "screensaver", 360);
- AddDefaultAddon(ss, "screensaver.mode", 356, "screensaver.xbmc.builtin.dim", ADDON_SCREENSAVER);
- AddString(ss, "screensaver.settings", 21417, "", BUTTON_CONTROL_STANDARD);
- AddString(ss, "screensaver.preview", 1000, "", BUTTON_CONTROL_STANDARD);
- AddInt(ss, "screensaver.time", 355, 3, 1, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_MINS);
- AddSeparator(ss, "screensaver.sep1");
- AddBool(ss, "screensaver.usemusicvisinstead", 13392, true);
- AddBool(ss, "screensaver.usedimonpause", 22014, true);
-
- AddCategory(SETTINGS_APPEARANCE, "window", 0);
- AddInt(NULL, "window.width", 0, 720, 10, 1, INT_MAX, SPIN_CONTROL_INT);
- AddInt(NULL, "window.height", 0, 480, 10, 1, INT_MAX, SPIN_CONTROL_INT);
-
- AddPath(NULL,"system.playlistspath",20006,"set default",BUTTON_CONTROL_PATH_INPUT,false);
-
- AddInt(NULL, "mymusic.startwindow", 0, WINDOW_MUSIC_FILES, WINDOW_MUSIC_FILES, 1, WINDOW_MUSIC_NAV, SPIN_CONTROL_INT);
- AddBool(NULL, "mymusic.songthumbinvis", 0, false);
- AddString(NULL, "mymusic.defaultlibview", 0, "", BUTTON_CONTROL_STANDARD);
-
- AddBool(NULL, "general.addonautoupdate", 0, true);
- AddBool(NULL, "general.addonnotifications", 0, true);
- AddBool(NULL, "general.addonforeignfilter", 0, false);
-
- // tv settings (access over TV menu from home window)
- AddGroup(SETTINGS_PVR, 19180);
- CSettingsCategory* pvr = AddCategory(SETTINGS_PVR, "pvrmanager", 128);
- AddBool(pvr, "pvrmanager.enabled", 449, false);
- AddSeparator(pvr, "pvrmanager.sep1");
- AddBool(pvr, "pvrmanager.syncchannelgroups", 19221, true);
- AddBool(pvr, "pvrmanager.backendchannelorder", 19231, true);
- AddBool(pvr, "pvrmanager.usebackendchannelnumbers", 19234, false);
- AddSeparator(pvr, "pvrmanager.sep2");
- AddString(pvr, "pvrmanager.channelmanager", 19199, "", BUTTON_CONTROL_STANDARD);
- AddString(pvr, "pvrmanager.channelscan", 19117, "", BUTTON_CONTROL_STANDARD);
- AddString(pvr, "pvrmanager.resetdb", 19185, "", BUTTON_CONTROL_STANDARD);
- AddSeparator(pvr, "pvrmanager.sep3");
- AddBool(pvr, "pvrmanager.hideconnectionlostwarning", 19269, false);
-
- CSettingsCategory* pvrm = AddCategory(SETTINGS_PVR, "pvrmenu", 19181);
- AddBool(pvrm, "pvrmenu.infoswitch", 19178, true);
- AddBool(pvrm, "pvrmenu.infotimeout", 19179, true);
- AddBool(pvrm, "pvrmenu.closechannelosdonswitch", 19229, false);
- AddInt(pvrm, "pvrmenu.infotime", 19184, 5, 1, 1, 10, SPIN_CONTROL_INT_PLUS, MASK_SECS);
- AddSeparator(pvrm, "pvrmenu.sep1");
- AddString(pvrm, "pvrmenu.iconpath", 19018, "", BUTTON_CONTROL_PATH_INPUT, false, 657);
- AddString(pvrm, "pvrmenu.searchicons", 19167, "", BUTTON_CONTROL_STANDARD);
-
- CSettingsCategory* pvre = AddCategory(SETTINGS_PVR, "epg", 19069);
- AddInt(pvre, "epg.defaultguideview", 19065, GUIDE_VIEW_TIMELINE, GUIDE_VIEW_CHANNEL, 1, GUIDE_VIEW_TIMELINE, SPIN_CONTROL_TEXT);
- AddInt(pvre, "epg.daystodisplay", 19182, 3, 1, 1, 14, SPIN_CONTROL_INT_PLUS, MASK_DAYS);
- AddSeparator(pvre, "epg.sep1");
- AddInt(pvre, "epg.epgupdate", 19071, 120, 15, 15, 2880, SPIN_CONTROL_INT_PLUS, MASK_MINS);
- AddBool(pvre, "epg.preventupdateswhileplayingtv", 19230, false);
- AddBool(pvre, "epg.ignoredbforclient", 19072, false);
- AddBool(pvre, "epg.hidenoinfoavailable", 19268, true);
- AddString(pvre, "epg.resetepg", 19187, "", BUTTON_CONTROL_STANDARD);
-
- CSettingsCategory* pvrp = AddCategory(SETTINGS_PVR, "pvrplayback", 19177);
- AddBool(pvrp, "pvrplayback.playminimized", 19171, true);
- AddInt(pvrp, "pvrplayback.startlast", 19189, START_LAST_CHANNEL_OFF, START_LAST_CHANNEL_OFF, 1, START_LAST_CHANNEL_ON, SPIN_CONTROL_TEXT);
- AddBool(pvrp, "pvrplayback.signalquality", 19037, true);
- AddSeparator(pvrp, "pvrplayback.sep1");
- AddInt(pvrp, "pvrplayback.scantime", 19170, 10, 1, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_SECS);
- AddBool(pvrp, "pvrplayback.confirmchannelswitch", 19281, false);
- AddInt(pvrp, "pvrplayback.channelentrytimeout", 19073, 0, 0, 250, 10000, SPIN_CONTROL_INT_PLUS, MASK_MS);
-
- CSettingsCategory* pvrr = AddCategory(SETTINGS_PVR, "pvrrecord", 19043);
- AddInt(pvrr, "pvrrecord.instantrecordtime", 19172, 120, 1, 1, 720, SPIN_CONTROL_INT_PLUS, MASK_MINS);
- AddInt(pvrr, "pvrrecord.defaultpriority", 19173, 50, 1, 1, 100, SPIN_CONTROL_INT_PLUS);
- AddInt(pvrr, "pvrrecord.defaultlifetime", 19174, 99, 1, 1, 365, SPIN_CONTROL_INT_PLUS, MASK_DAYS);
- AddInt(pvrr, "pvrrecord.marginstart", 19175, 2, 0, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_MINS);
- AddInt(pvrr, "pvrrecord.marginend", 19176, 10, 0, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_MINS);
- AddSeparator(pvrr, "pvrrecord.sep1");
- AddBool(pvrr, "pvrrecord.timernotifications", 19233, true);
-
- CSettingsCategory* pvrpwr = AddCategory(SETTINGS_PVR, "pvrpowermanagement", 14095);
- AddBool(pvrpwr, "pvrpowermanagement.enabled", 305, false);
- AddSeparator(pvrpwr, "pvrpowermanagement.sep1");
- AddInt(pvrpwr, "pvrpowermanagement.backendidletime", 19244, 15, 0, 5, 360, SPIN_CONTROL_INT_PLUS, MASK_MINS, TEXT_OFF);
- AddString(pvrpwr, "pvrpowermanagement.setwakeupcmd", 19245, "", EDIT_CONTROL_INPUT, true);
- AddInt(pvrpwr, "pvrpowermanagement.prewakeup", 19246, 15, 0, 1, 60, SPIN_CONTROL_INT_PLUS, MASK_MINS, TEXT_OFF);
- AddSeparator(pvrpwr, "pvrpowermanagement.sep2");
- AddBool(pvrpwr, "pvrpowermanagement.dailywakeup", 19247, false);
- AddString(pvrpwr, "pvrpowermanagement.dailywakeuptime", 19248, "00:00:00", EDIT_CONTROL_INPUT);
-
- CSettingsCategory* pvrpa = AddCategory(SETTINGS_PVR, "pvrparental", 19259);
- AddBool(pvrpa, "pvrparental.enabled", 449 , false);
- AddSeparator(pvrpa, "pvrparental.sep1");
- AddString(pvrpa, "pvrparental.pin", 19261, "", EDIT_CONTROL_HIDDEN_NUMBER_VERIFY_NEW, true);
- AddInt(pvrpa, "pvrparental.duration", 19260, 300, 5, 5, 1200, SPIN_CONTROL_INT_PLUS, MASK_SECS);
-
- CSettingsCategory* pvrc = AddCategory(SETTINGS_PVR, "pvrclient", 19279);
- AddString(pvrc, "pvrclient.menuhook", 19280, "", BUTTON_CONTROL_STANDARD);
-}
-
-CGUISettings::~CGUISettings(void)
-{
- Clear();
-}
-
-void CGUISettings::AddGroup(int groupID, int labelID)
-{
- CSettingsGroup *pGroup = new CSettingsGroup(groupID, labelID);
- if (pGroup)
- settingsGroups.push_back(pGroup);
-}
-
-CSettingsCategory* CGUISettings::AddCategory(int groupID, const char *strSetting, int labelID)
-{
- for (unsigned int i = 0; i < settingsGroups.size(); i++)
- {
- if (settingsGroups[i]->GetGroupID() == groupID)
- return settingsGroups[i]->AddCategory(CStdString(strSetting).ToLower(), labelID);
- }
- return NULL;
-}
-
-CSettingsGroup *CGUISettings::GetGroup(int groupID)
-{
- for (unsigned int i = 0; i < settingsGroups.size(); i++)
- {
- if (settingsGroups[i]->GetGroupID() == groupID)
- return settingsGroups[i];
- }
- CLog::Log(LOGDEBUG, "Error: Requested setting group (%i) was not found. "
- "It must be case-sensitive",
- groupID);
- return NULL;
-}
-
-void CGUISettings::AddSetting(CSettingsCategory* cat, CSetting* setting)
-{
- if (!setting)
- return;
-
- if (cat)
- cat->m_settings.push_back(setting);
- settingsMap.insert(pair<CStdString, CSetting*>(CStdString(setting->GetSetting()).ToLower(), setting));
-}
-
-void CGUISettings::AddSeparator(CSettingsCategory* cat, const char *strSetting)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingSeparator *pSetting = new CSettingSeparator(iOrder, CStdString(strSetting).ToLower());
- if (!pSetting) return;
- AddSetting(cat, pSetting);
-}
-
-void CGUISettings::AddBool(CSettingsCategory* cat, const char *strSetting, int iLabel, bool bData, int iControlType)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingBool* pSetting = new CSettingBool(iOrder, CStdString(strSetting).ToLower(), iLabel, bData, iControlType);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-bool CGUISettings::GetBool(const char *strSetting) const
-{
- ASSERT(settingsMap.size());
- constMapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- { // old category
- return ((CSettingBool*)(*it).second)->GetData();
- }
- // Backward compatibility (skins use this setting)
- if (strncmp(strSetting, "lookandfeel.enablemouse", 23) == 0)
- return GetBool("input.enablemouse");
- // Assert here and write debug output
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
- return false;
-}
-
-void CGUISettings::SetBool(const char *strSetting, bool bSetting)
-{
- ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- { // old category
- ((CSettingBool*)(*it).second)->SetData(bSetting);
-
- SetChanged();
-
- return ;
- }
- // Assert here and write debug output
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
-}
-
-void CGUISettings::ToggleBool(const char *strSetting)
-{
- ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(CStdString(strSetting).ToLower());
- if (it != settingsMap.end())
- { // old category
- ((CSettingBool*)(*it).second)->SetData(!((CSettingBool *)(*it).second)->GetData());
-
- SetChanged();
-
- return ;
- }
- // Assert here and write debug output
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
-}
-
-void CGUISettings::AddFloat(CSettingsCategory* cat, const char *strSetting, int iLabel, float fData, float fMin, float fStep, float fMax, int iControlType)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingFloat* pSetting = new CSettingFloat(iOrder, CStdString(strSetting).ToLower(), iLabel, fData, fMin, fStep, fMax, iControlType);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-float CGUISettings::GetFloat(const char *strSetting) const
-{
- ASSERT(settingsMap.size());
- constMapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- {
- return ((CSettingFloat *)(*it).second)->GetData();
- }
- // Assert here and write debug output
- //ASSERT(false);
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
- return 0.0f;
-}
-
-void CGUISettings::SetFloat(const char *strSetting, float fSetting)
-{
- ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- {
- ((CSettingFloat *)(*it).second)->SetData(fSetting);
-
- SetChanged();
-
- return ;
- }
- // Assert here and write debug output
- ASSERT(false);
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
-}
-
-void CGUISettings::LoadMasterLock(TiXmlElement *pRootElement)
-{
- mapIter it = settingsMap.find("masterlock.maxretries");
- if (it != settingsMap.end())
- LoadFromXML(pRootElement, it);
- it = settingsMap.find("masterlock.startuplock");
- if (it != settingsMap.end())
- LoadFromXML(pRootElement, it);
-}
-
-void CGUISettings::AddInt(CSettingsCategory* cat, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, const char *strFormat)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingInt* pSetting = new CSettingInt(iOrder, CStdString(strSetting).ToLower(), iLabel, iData, iMin, iStep, iMax, iControlType, strFormat);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-void CGUISettings::AddInt(CSettingsCategory* cat, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, int iFormat, int iLabelMin/*=-1*/)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingInt* pSetting = new CSettingInt(iOrder, CStdString(strSetting).ToLower(), iLabel, iData, iMin, iStep, iMax, iControlType, iFormat, iLabelMin);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-void CGUISettings::AddInt(CSettingsCategory* cat, const char *strSetting, int iLabel, int iData, const map<int,int>& entries, int iControlType)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingInt* pSetting = new CSettingInt(iOrder, CStdString(strSetting).ToLower(), iLabel, iData, entries, iControlType);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-void CGUISettings::AddHex(CSettingsCategory* cat, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, const char *strFormat)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingHex* pSetting = new CSettingHex(iOrder, CStdString(strSetting).ToLower(), iLabel, iData, iMin, iStep, iMax, iControlType, strFormat);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-int CGUISettings::GetInt(const char *strSetting) const
-{
- ASSERT(settingsMap.size());
-
- constMapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- {
- return ((CSettingInt *)(*it).second)->GetData();
- }
- // Assert here and write debug output
- CLog::Log(LOGERROR,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
- //ASSERT(false);
- return 0;
-}
-
-void CGUISettings::SetInt(const char *strSetting, int iSetting)
-{
- ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- {
- ((CSettingInt *)(*it).second)->SetData(iSetting);
-
- SetChanged();
-
- return ;
- }
- // Assert here and write debug output
- ASSERT(false);
-}
-
-void CGUISettings::AddString(CSettingsCategory* cat, const char *strSetting, int iLabel, const char *strData, int iControlType, bool bAllowEmpty, int iHeadingString)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingString* pSetting = new CSettingString(iOrder, CStdString(strSetting).ToLower(), iLabel, strData, iControlType, bAllowEmpty, iHeadingString);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-void CGUISettings::AddPath(CSettingsCategory* cat, const char *strSetting, int iLabel, const char *strData, int iControlType, bool bAllowEmpty, int iHeadingString)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingPath* pSetting = new CSettingPath(iOrder, CStdString(strSetting).ToLower(), iLabel, strData, iControlType, bAllowEmpty, iHeadingString);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-void CGUISettings::AddDefaultAddon(CSettingsCategory* cat, const char *strSetting, int iLabel, const char *strData, const TYPE type)
-{
- int iOrder = cat ? cat->m_settings.size() : 0;
- CSettingAddon* pSetting = new CSettingAddon(iOrder, CStdString(strSetting).ToLower(), iLabel, strData, type);
- if (!pSetting) return ;
- AddSetting(cat, pSetting);
-}
-
-const CStdString &CGUISettings::GetString(const char *strSetting, bool bPrompt /* = true */) const
-{
- ASSERT(settingsMap.size());
- constMapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- {
- CSettingString* result = ((CSettingString *)(*it).second);
- if (result->GetData() == "select folder" || result->GetData() == "select writable folder")
- {
- CStdString strData = "";
- if (bPrompt)
- {
- VECSOURCES shares;
- g_mediaManager.GetLocalDrives(shares);
- if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares,g_localizeStrings.Get(result->GetLabel()),strData,result->GetData() == "select writable folder"))
- {
- result->SetData(strData);
- g_settings.Save();
- }
- else
- return StringUtils::EmptyString;
- }
- else
- return StringUtils::EmptyString;
- }
- return result->GetData();
- }
- // Assert here and write debug output
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
- //ASSERT(false);
- // hardcoded return value so that compiler is happy
- return StringUtils::EmptyString;
-}
-
-void CGUISettings::SetString(const char *strSetting, const char *strData)
-{
- ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- {
- ((CSettingString *)(*it).second)->SetData(strData);
-
- SetChanged();
-
- return ;
- }
- // Assert here and write debug output
- ASSERT(false);
- CLog::Log(LOGDEBUG,"Error: Requested setting (%s) was not found. It must be case-sensitive", strSetting);
-}
-
-CSetting *CGUISettings::GetSetting(const char *strSetting)
-{
- ASSERT(settingsMap.size());
- mapIter it = settingsMap.find(strSetting);
- if (it != settingsMap.end())
- return (*it).second;
- else
- return NULL;
-}
-
-// get all the settings beginning with the term "strGroup"
-void CGUISettings::GetSettingsGroup(CSettingsCategory* cat, vecSettings &settings)
-{
- if (!cat || cat->m_settings.size() <= 0)
- return;
-
- vecSettings unorderedSettings;
- for (unsigned int index = 0; index < cat->m_settings.size(); index++)
- {
- if (!cat->m_settings.at(index)->IsAdvanced())
- unorderedSettings.push_back(cat->m_settings.at(index));
- }
-
- // now order them...
- sort(unorderedSettings.begin(), unorderedSettings.end(), sortsettings());
-
- // remove any instances of 2 separators in a row
- bool lastWasSeparator(false);
- for (vecSettings::iterator it = unorderedSettings.begin(); it != unorderedSettings.end(); it++)
- {
- CSetting *setting = *it;
- // only add separators if we don't have 2 in a row
- if (setting->GetType() == SETTINGS_TYPE_SEPARATOR)
- {
- if (!lastWasSeparator)
- settings.push_back(setting);
- lastWasSeparator = true;
- }
- else
- {
- lastWasSeparator = false;
- settings.push_back(setting);
- }
- }
-}
-
-void CGUISettings::LoadXML(TiXmlElement *pRootElement, bool hideSettings /* = false */)
-{ // load our stuff...
- bool updated = false;
-
- for (mapIter it = settingsMap.begin(); it != settingsMap.end(); it++)
- {
- LoadFromXML(pRootElement, it, hideSettings);
- }
-
- // check if we are updating to Frodo and need to update from
- // audiooutput.channellayout to audiooutput.channels
- TiXmlNode *channelNode = pRootElement->FirstChild("audiooutput");
- if (channelNode != NULL)
- {
- channelNode = channelNode->FirstChild("channellayout");
- CSettingInt* channels = (CSettingInt*)GetSetting("audiooutput.channels");
- if (channelNode != NULL && channelNode->FirstChild() != NULL && channels != NULL)
- {
- channels->FromString(channelNode->FirstChild()->ValueStr());
- if (channels->GetData() < AE_CH_LAYOUT_MAX - 1)
- channels->SetData(channels->GetData() + 1);
-
- // let's just reset the audiodevice settings as well
- std::string audiodevice = GetString("audiooutput.audiodevice");
- CAEFactory::VerifyOutputDevice(audiodevice, false);
- SetString("audiooutput.audiodevice", audiodevice.c_str());
-
- updated = true;
- }
- }
-
- // and fix the videoscreen.screenmode if necessary
- std::string screenmode = GetString("videoscreen.screenmode");
- // in Eden there was no character ("i" or "p") indicating interlaced/progressive
- // at the end so we just add a "p" and assume progressive
- if (screenmode.size() == 20)
- {
- screenmode += "p";
- SetString("videoscreen.screenmode", screenmode.c_str());
- updated = true;
- }
-
- // Get hardware based stuff...
- CLog::Log(LOGNOTICE, "Getting hardware information now...");
- // FIXME: Check if the hardware supports it (if possible ;)
- //SetBool("audiooutput.ac3passthrough", g_audioConfig.GetAC3Enabled());
- //SetBool("audiooutput.dtspassthrough", g_audioConfig.GetDTSEnabled());
- CLog::Log(LOGINFO, "Using %s output", GetInt("audiooutput.mode") == AUDIO_ANALOG ? "analog" : "digital");
- CLog::Log(LOGINFO, "AC3 pass through is %s", GetBool("audiooutput.ac3passthrough") ? "enabled" : "disabled");
- CLog::Log(LOGINFO, "DTS pass through is %s", GetBool("audiooutput.dtspassthrough") ? "enabled" : "disabled");
- CLog::Log(LOGINFO, "AAC pass through is %s", GetBool("audiooutput.passthroughaac") ? "enabled" : "disabled");
-
-#if defined(TARGET_DARWIN)
- // trap any previous vsync by driver setting, does not exist on OSX
- if (GetInt("videoscreen.vsync") == VSYNC_DRIVER)
- {
- 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"));
-
- // Move replaygain settings into our struct
- ReplayGainSettings &replayGainSettings = CAudioDecoder::GetReplayGainSettings();
- replayGainSettings.iPreAmp = GetInt("musicplayer.replaygainpreamp");
- replayGainSettings.iNoGainPreAmp = GetInt("musicplayer.replaygainnogainpreamp");
- replayGainSettings.iType = GetInt("musicplayer.replaygaintype");
- replayGainSettings.bAvoidClipping = GetBool("musicplayer.replaygainavoidclipping");
-
- bool use_timezone = false;
-
-#if defined(_LINUX)
-#if defined(TARGET_DARWIN)
- if (g_sysinfo.IsAppleTV2() && GetIOSVersion() < 4.3)
-#endif
-#if !defined(TARGET_ANDROID)
- use_timezone = true;
-#endif
-
- if (use_timezone)
- {
- CStdString timezone = GetString("locale.timezone");
- if(timezone == "0" || timezone.IsEmpty())
- {
- timezone = g_timezone.GetOSConfiguredTimezone();
- SetString("locale.timezone", timezone);
- updated = true;
- }
- g_timezone.SetTimezone(timezone);
- }
-#endif
-
- CStdString streamLanguage = GetString("locale.audiolanguage");
- if (!streamLanguage.Equals("original") && !streamLanguage.Equals("default"))
- g_langInfo.SetAudioLanguage(streamLanguage);
- else
- g_langInfo.SetAudioLanguage("");
-
- streamLanguage = GetString("locale.subtitlelanguage");
- if (!streamLanguage.Equals("original") && !streamLanguage.Equals("default"))
- g_langInfo.SetSubtitleLanguage(streamLanguage);
- else
- g_langInfo.SetSubtitleLanguage("");
-
- // we no longer ship the built-in slideshow screensaver, replace it if it's still in use
- if (GetString("screensaver.mode") == "screensaver.xbmc.builtin.slideshow")
- {
- SetString("screensaver.mode", "screensaver.xbmc.builtin.dim");
- updated = true;
- }
-
- // replace broken last.fm musicvideo scraper with theaudiodb.com if it's still in use
- if (GetString("scrapers.musicvideosdefault") == "metadata.musicvideos.last.fm")
- {
- SetString("scrapers.musicvideosdefault", "metadata.musicvideos.theaudiodb.com");
- updated = true;
- }
-
- if (updated)
- g_settings.Save();
-}
-
-void CGUISettings::LoadFromXML(TiXmlElement *pRootElement, mapIter &it, bool advanced /* = false */)
-{
- CStdStringArray strSplit;
- StringUtils::SplitString((*it).first, ".", strSplit);
- if (strSplit.size() > 1)
- {
- const TiXmlNode *pChild = pRootElement->FirstChild(strSplit[0].c_str());
- if (pChild)
- {
- const TiXmlElement *pGrandChild = pChild->FirstChildElement(strSplit[1].c_str());
- if (pGrandChild)
- {
- CStdString strValue = pGrandChild->FirstChild() ? pGrandChild->FirstChild()->Value() : "";
- if (strValue != "-")
- { // update our item
- (*it).second->FromString(strValue);
- if (advanced)
- (*it).second->SetAdvanced();
- }
- }
- }
- }
-
- SetChanged();
-}
-
-void CGUISettings::SaveXML(TiXmlNode *pRootNode)
-{
- for (mapIter it = settingsMap.begin(); it != settingsMap.end(); it++)
- {
- // don't save advanced settings
- CStdString first = (*it).first;
- if ((*it).second->IsAdvanced() || (*it).second->GetType() == SETTINGS_TYPE_SEPARATOR)
- continue;
-
- CStdStringArray strSplit;
- StringUtils::SplitString((*it).first, ".", strSplit);
- if (strSplit.size() > 1)
- {
- TiXmlNode *pChild = pRootNode->FirstChild(strSplit[0].c_str());
- if (!pChild)
- { // add our group tag
- TiXmlElement newElement(strSplit[0].c_str());
- pChild = pRootNode->InsertEndChild(newElement);
- }
-
- if (pChild)
- { // successfully added (or found) our group
- TiXmlElement newElement(strSplit[1]);
- if ((*it).second->GetType() == SETTINGS_TYPE_PATH)
- newElement.SetAttribute("pathversion", XMLUtils::path_version);
- TiXmlNode *pNewNode = pChild->InsertEndChild(newElement);
- if (pNewNode)
- {
- TiXmlText value((*it).second->ToString());
- pNewNode->InsertEndChild(value);
- }
- }
- }
- }
-
- SetChanged();
-}
-
-void CGUISettings::Clear()
-{
- for (mapIter it = settingsMap.begin(); it != settingsMap.end(); it++)
- delete (*it).second;
- settingsMap.clear();
- for (unsigned int i = 0; i < settingsGroups.size(); i++)
- delete settingsGroups[i];
- settingsGroups.clear();
-
- SetChanged();
-}
+++ /dev/null
-#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 <map>
-#include "guilib/Resolution.h"
-#include "addons/IAddon.h"
-#include "utils/Observer.h"
-#include "utils/GlobalsHandling.h"
-
-//FIXME - after eden - make that one nicer somehow...
-#if defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
-#include "system.h" //for HAS_SKIN_TOUCHED
-#endif
-
-#if defined(HAS_SKIN_TOUCHED) && defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
-#define DEFAULT_SKIN "skin.touched"
-#else
-#define DEFAULT_SKIN "skin.confluence"
-#endif
-
-class TiXmlNode;
-class TiXmlElement;
-
-// Render Methods
-#define RENDER_METHOD_AUTO 0
-#define RENDER_METHOD_ARB 1
-#define RENDER_METHOD_GLSL 2
-#define RENDER_METHOD_SOFTWARE 3
-#define RENDER_METHOD_D3D_PS 4
-#define RENDER_METHOD_DXVA 5
-#define RENDER_OVERLAYS 99 // to retain compatibility
-
-// Scaling options.
-#define SOFTWARE_UPSCALING_DISABLED 0
-#define SOFTWARE_UPSCALING_SD_CONTENT 1
-#define SOFTWARE_UPSCALING_ALWAYS 2
-
-// Apple Remote options.
-#define APPLE_REMOTE_DISABLED 0
-#define APPLE_REMOTE_STANDARD 1
-#define APPLE_REMOTE_UNIVERSAL 2
-#define APPLE_REMOTE_MULTIREMOTE 3
-
-// Subtitle colours
-
-#define SUBTITLE_COLOR_START 0
-#define SUBTITLE_COLOR_END 7
-
-// Karaoke colours
-
-// If you want to add more colors, it should be done the following way:
-// 1. Increase KARAOKE_COLOR_END
-// 2. Add a new color description in language/English/strings.xml in block
-// with id 22040 + KARAOKE_COLOR_END value
-// 3. Add a new color hex mask into gLyricColors structure in karaoke/karaokelyricstext.cpp
-#define KARAOKE_COLOR_START 0
-#define KARAOKE_COLOR_END 4
-
-// CDDA Autoaction defines
-#define AUTOCD_NONE 0
-#define AUTOCD_PLAY 1
-#define AUTOCD_RIP 2
-
-// CDDA ripper defines
-#define CDDARIP_ENCODER_LAME 0
-#define CDDARIP_ENCODER_VORBIS 1
-#define CDDARIP_ENCODER_WAV 2
-#define CDDARIP_ENCODER_FLAC 3
-
-#define CDDARIP_QUALITY_CBR 0
-#define CDDARIP_QUALITY_MEDIUM 1
-#define CDDARIP_QUALITY_STANDARD 2
-#define CDDARIP_QUALITY_EXTREME 3
-
-#define AUDIO_ANALOG 0
-#define AUDIO_IEC958 1
-#define AUDIO_HDMI 2
-#define AUDIO_COUNT 3
-#define AUDIO_IS_BITSTREAM(x) ((x) == AUDIO_IEC958 || (x) == AUDIO_HDMI)
-
-#define VIDEO_NORMAL 0
-#define VIDEO_LETTERBOX 1
-#define VIDEO_WIDESCREEN 2
-
-#define MODCHIP_SMARTXX 0
-#define MODCHIP_XENIUM 1
-#define MODCHIP_XECUTER3 2
-
-// LED settings
-#define LED_COLOUR_NO_CHANGE 0
-#define LED_COLOUR_GREEN 1
-#define LED_COLOUR_ORANGE 2
-#define LED_COLOUR_RED 3
-#define LED_COLOUR_CYCLE 4
-#define LED_COLOUR_OFF 5
-
-#define FRAME_RATE_LEAVE_AS_IS 0
-#define FRAME_RATE_CONVERT 1
-#define FRAME_RATE_USE_PAL60 2
-
-#define LED_PLAYBACK_OFF 0
-#define LED_PLAYBACK_VIDEO 1
-#define LED_PLAYBACK_MUSIC 2
-#define LED_PLAYBACK_VIDEO_MUSIC 3
-
-#define SPIN_DOWN_NONE 0
-#define SPIN_DOWN_MUSIC 1
-#define SPIN_DOWN_VIDEO 2
-#define SPIN_DOWN_BOTH 3
-
-#define AAM_QUIET 1
-#define AAM_FAST 0
-
-#define APM_HIPOWER 0
-#define APM_LOPOWER 1
-#define APM_HIPOWER_STANDBY 2
-#define APM_LOPOWER_STANDBY 3
-
-#define GUIDE_VIEW_CHANNEL 0
-#define GUIDE_VIEW_NOW 1
-#define GUIDE_VIEW_NEXT 2
-#define GUIDE_VIEW_TIMELINE 3
-
-#define START_LAST_CHANNEL_OFF 0
-#define START_LAST_CHANNEL_MIN 1
-#define START_LAST_CHANNEL_ON 2
-
-#define SETTINGS_TYPE_BOOL 1
-#define SETTINGS_TYPE_FLOAT 2
-#define SETTINGS_TYPE_INT 3
-#define SETTINGS_TYPE_STRING 4
-#define SETTINGS_TYPE_HEX 5
-#define SETTINGS_TYPE_SEPARATOR 6
-#define SETTINGS_TYPE_PATH 7
-#define SETTINGS_TYPE_ADDON 8
-
-#define CHECKMARK_CONTROL 1
-#define SPIN_CONTROL_FLOAT 2
-#define SPIN_CONTROL_INT 3
-#define SPIN_CONTROL_INT_PLUS 4
-#define SPIN_CONTROL_TEXT 5
-#define EDIT_CONTROL_INPUT 6
-#define EDIT_CONTROL_HIDDEN_INPUT 7
-#define EDIT_CONTROL_NUMBER_INPUT 8
-#define EDIT_CONTROL_IP_INPUT 9
-#define EDIT_CONTROL_MD5_INPUT 10
-#define BUTTON_CONTROL_STANDARD 11
-#define BUTTON_CONTROL_MISC_INPUT 12
-#define BUTTON_CONTROL_PATH_INPUT 13
-#define SEPARATOR_CONTROL 14
-#define EDIT_CONTROL_HIDDEN_NUMBER_VERIFY_NEW 15
-
-#define REPLAY_GAIN_NONE 0
-#define REPLAY_GAIN_ALBUM 1
-#define REPLAY_GAIN_TRACK 2
-
-//AV sync options
-#define SYNC_DISCON 0
-#define SYNC_SKIPDUP 1
-#define SYNC_RESAMPLE 2
-
-//adjust refreshrate options
-#define ADJUST_REFRESHRATE_OFF 0
-#define ADJUST_REFRESHRATE_ALWAYS 1
-#define ADJUST_REFRESHRATE_ON_STARTSTOP 2
-
-
-//resampler quality
-#define RESAMPLE_LOW 0
-#define RESAMPLE_MID 1
-#define RESAMPLE_HIGH 2
-#define RESAMPLE_REALLYHIGH 3
-
-//0.1 second increments
-#define MAXREFRESHCHANGEDELAY 200
-
-enum PowerState
-{
- POWERSTATE_QUIT = 0,
- POWERSTATE_SHUTDOWN,
- POWERSTATE_HIBERNATE,
- POWERSTATE_SUSPEND,
- POWERSTATE_REBOOT,
- POWERSTATE_MINIMIZE,
- POWERSTATE_NONE,
- POWERSTATE_ASK
-};
-
-enum VideoSelectAction
-{
- SELECT_ACTION_CHOOSE = 0,
- SELECT_ACTION_PLAY_OR_RESUME,
- SELECT_ACTION_RESUME,
- SELECT_ACTION_INFO,
- SELECT_ACTION_MORE,
- SELECT_ACTION_PLAY,
- SELECT_ACTION_PLAYPART
-};
-
-enum SubtitleAlign
-{
- SUBTITLE_ALIGN_MANUAL = 0,
- SUBTITLE_ALIGN_BOTTOM_INSIDE,
- SUBTITLE_ALIGN_BOTTOM_OUTSIDE,
- SUBTITLE_ALIGN_TOP_INSIDE,
- SUBTITLE_ALIGN_TOP_OUTSIDE
-};
-
-// base class for all settings types
-class CSetting
-{
-public:
- CSetting(int iOrder, const char *strSetting, int iLabel, int iControlType) {
- m_iOrder = iOrder;
- m_strSetting = strSetting;
- m_iLabel = iLabel;
- m_iControlType = iControlType;
- m_advanced = false;
- m_visible = true;
- };
- virtual ~CSetting() {};
- virtual int GetType() const { return 0; };
- int GetControlType() const { return m_iControlType; };
- virtual void FromString(const CStdString &strValue) {};
- virtual CStdString ToString() const { return ""; };
- const char *GetSetting() const { return m_strSetting.c_str(); };
- int GetLabel() const { return m_iLabel; };
- int GetOrder() const { return m_iOrder; };
- void SetOrder(int iOrder) { m_iOrder = iOrder; };
- void SetAdvanced() { m_advanced = true; };
- bool IsAdvanced() const { return m_advanced; };
- // A setting might be invisible in the current session, yet carried over
- // in the config file.
- void SetVisible(bool visible) { m_visible = visible; }
- bool IsVisible() const { return m_visible; }
-private:
- int m_iControlType;
- int m_iLabel;
- int m_iOrder;
- bool m_advanced;
- bool m_visible;
- CStdString m_strSetting;
-};
-
-class CSettingBool : public CSetting
-{
-public:
- CSettingBool(int iOrder, const char *strSetting, int iLabel, bool bData, int iControlType): CSetting(iOrder, strSetting, iLabel, iControlType) { m_bData = bData; };
- virtual ~CSettingBool() {};
-
- virtual int GetType() const { return SETTINGS_TYPE_BOOL; };
- virtual void FromString(const CStdString &strValue);
- virtual CStdString ToString() const;
-
- void SetData(bool bData) { m_bData = bData; };
- bool GetData() const { return m_bData; };
-
-private:
- bool m_bData;
-};
-
-class CSettingFloat : public CSetting
-{
-public:
- CSettingFloat(int iOrder, const char *strSetting, int iLabel, float fData, float fMin, float fStep, float fMax, int iControlType);
- virtual ~CSettingFloat() {};
-
- virtual int GetType() const { return SETTINGS_TYPE_FLOAT; };
- virtual void FromString(const CStdString &strValue);
- virtual CStdString ToString() const;
-
- void SetData(float fData) { m_fData = fData; if (m_fData < m_fMin) m_fData = m_fMin; if (m_fData > m_fMax) m_fData = m_fMax;};
- float GetData() const { return m_fData; };
-
- float m_fMin;
- float m_fStep;
- float m_fMax;
-
-private:
- float m_fData;
-};
-
-class CSettingInt : public CSetting
-{
-public:
- CSettingInt(int iOrder, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, const char *strFormat);
- CSettingInt(int iOrder, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, int iFormat, int iLabelMin);
- CSettingInt(int iOrder, const char *strSetting, int iLabel, int iData, const std::map<int,int>& entries, int iControlType);
- virtual ~CSettingInt() {};
-
- virtual int GetType() const { return SETTINGS_TYPE_INT; };
- virtual void FromString(const CStdString &strValue);
- virtual CStdString ToString() const;
-
- void SetData(int iData)
- {
- if (m_entries.empty())
- {
- m_iData = iData;
- if (m_iData < m_iMin) m_iData = m_iMin;
- if (m_iData > m_iMax) m_iData = m_iMax;
- }
- else
- {
- //if the setting is an std::map, check if iData is a valid value before assigning it
- for (std::map<int,int>::iterator it = m_entries.begin(); it != m_entries.end(); it++)
- {
- if (it->second == iData)
- {
- m_iData = iData;
- break;
- }
- }
- }
- }
- int GetData() const { return m_iData; };
-
- int m_iMin;
- int m_iStep;
- int m_iMax;
- int m_iFormat;
- int m_iLabelMin;
- CStdString m_strFormat;
- std::map<int,int> m_entries;
-
-protected:
- int m_iData;
-};
-
-class CSettingHex : public CSettingInt
-{
-public:
- CSettingHex(int iOrder, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, const char *strFormat)
- : CSettingInt(iOrder, strSetting, iLabel, iData, iMin, iStep, iMax, iControlType, strFormat) {};
- virtual ~CSettingHex() {};
- virtual void FromString(const CStdString &strValue);
- virtual CStdString ToString() const;
- virtual int GetType() const { return SETTINGS_TYPE_HEX; };
-};
-
-class CSettingString : public CSetting
-{
-public:
- CSettingString(int iOrder, const char *strSetting, int iLabel, const char *strData, int iControlType, bool bAllowEmpty, int iHeadingString);
- virtual ~CSettingString() {};
-
- virtual int GetType() const { return SETTINGS_TYPE_STRING; };
- virtual void FromString(const CStdString &strValue);
- virtual CStdString ToString() const;
-
- void SetData(const char *strData) { m_strData = strData; };
- const CStdString &GetData() const { return m_strData; };
-
- bool m_bAllowEmpty;
- int m_iHeadingString;
-private:
- CStdString m_strData;
-};
-
-class CSettingPath : public CSettingString
-{
-public:
- CSettingPath(int iOrder, const char *strSetting, int iLabel, const char *strData, int iControlType, bool bAllowEmpty, int iHeadingString);
- virtual ~CSettingPath() {};
-
- virtual int GetType() const { return SETTINGS_TYPE_PATH; };
-};
-
-class CSettingAddon : public CSettingString
-{
-public:
- CSettingAddon(int iOrder, const char *strSetting, int iLabel, const char *strData, const ADDON::TYPE type);
- virtual ~CSettingAddon() {};
- virtual int GetType() const { return SETTINGS_TYPE_ADDON; };
-
- const ADDON::TYPE m_type;
-};
-
-class CSettingSeparator : public CSetting
-{
-public:
- CSettingSeparator(int iOrder, const char *strSetting);
- virtual ~CSettingSeparator() {};
-
- virtual int GetType() const { return SETTINGS_TYPE_SEPARATOR; };
-};
-
-class CSettingsCategory
-{
-public:
- CSettingsCategory(const char *strCategory, int labelID)
- {
- m_strCategory = strCategory;
- m_labelID = labelID;
- }
- ~CSettingsCategory() {};
-
- CStdString m_strCategory;
- int m_labelID;
- std::vector<CSetting*> m_settings;
-};
-
-typedef std::vector<CSettingsCategory *> vecSettingsCategory;
-
-class CSettingsGroup
-{
-public:
- CSettingsGroup(int groupID, int labelID)
- {
- m_groupID = groupID;
- m_labelID = labelID;
- }
- ~CSettingsGroup()
- {
- for (unsigned int i = 0; i < m_vecCategories.size(); i++)
- delete m_vecCategories[i];
- m_vecCategories.clear();
- };
-
- CSettingsCategory* AddCategory(const char *strCategory, int labelID);
- void GetCategories(vecSettingsCategory &vecCategories);
- int GetLabelID() { return m_labelID; };
- int GetGroupID() { return m_groupID; };
-private:
- vecSettingsCategory m_vecCategories;
- int m_groupID;
- int m_labelID;
-};
-
-typedef std::vector<CSetting *> vecSettings;
-
-class CGUISettings : public Observable
-{
-public:
- CGUISettings();
- ~CGUISettings();
-
- void Initialize();
-
- void AddGroup(int groupID, int labelID);
- CSettingsCategory* AddCategory(int groupID, const char *strCategory, int labelID);
- CSettingsGroup *GetGroup(int windowID);
-
- void AddSetting(CSettingsCategory* cat, CSetting* setting);
- void AddBool(CSettingsCategory* cat, const char *strSetting, int iLabel, bool bSetting, int iControlType = CHECKMARK_CONTROL);
- bool GetBool(const char *strSetting) const;
- void SetBool(const char *strSetting, bool bSetting);
- void ToggleBool(const char *strSetting);
-
- void AddFloat(CSettingsCategory* cat, const char *strSetting, int iLabel, float fSetting, float fMin, float fStep, float fMax, int iControlType = SPIN_CONTROL_FLOAT);
- float GetFloat(const char *strSetting) const;
- void SetFloat(const char *strSetting, float fSetting);
-
- void AddInt(CSettingsCategory* cat, const char *strSetting, int iLabel, int fSetting, int iMin, int iStep, int iMax, int iControlType, const char *strFormat = NULL);
- void AddInt(CSettingsCategory* cat, const char *strSetting, int iLabel, int iData, int iMin, int iStep, int iMax, int iControlType, int iFormat, int iLabelMin=-1);
- void AddInt(CSettingsCategory* cat, const char *strSetting, int iLabel, int iData, const std::map<int,int>& entries, int iControlType);
- void AddSpin(unsigned int id, int label, int *current, std::vector<std::pair<int, int> > &values);
- int GetInt(const char *strSetting) const;
- void SetInt(const char *strSetting, int fSetting);
-
- void AddHex(CSettingsCategory* cat, const char *strSetting, int iLabel, int fSetting, int iMin, int iStep, int iMax, int iControlType, const char *strFormat = NULL);
-
- void AddString(CSettingsCategory* cat, const char *strSetting, int iLabel, const char *strData, int iControlType = EDIT_CONTROL_INPUT, bool bAllowEmpty = false, int iHeadingString = -1);
- void AddPath(CSettingsCategory* cat, const char *strSetting, int iLabel, const char *strData, int iControlType = EDIT_CONTROL_INPUT, bool bAllowEmpty = false, int iHeadingString = -1);
-
- void AddDefaultAddon(CSettingsCategory* cat, const char *strSetting, int iLabel, const char *strData, const ADDON::TYPE type);
-
- const CStdString &GetString(const char *strSetting, bool bPrompt=true) const;
- void SetString(const char *strSetting, const char *strData);
-
- void AddSeparator(CSettingsCategory* cat, const char *strSetting);
-
- CSetting *GetSetting(const char *strSetting);
-
- void GetSettingsGroup(CSettingsCategory* cat, vecSettings &settings);
- void LoadXML(TiXmlElement *pRootElement, bool hideSettings = false);
- void SaveXML(TiXmlNode *pRootNode);
- void LoadMasterLock(TiXmlElement *pRootElement);
-
- void Clear();
-
-private:
- typedef std::map<std::string, CSetting*>::iterator mapIter;
- typedef std::map<std::string, CSetting*>::const_iterator constMapIter;
- std::map<std::string, CSetting*> settingsMap;
- std::vector<CSettingsGroup *> settingsGroups;
- void LoadFromXML(TiXmlElement *pRootElement, mapIter &it, bool advanced = false);
-};
-
-XBMC_GLOBAL_REF(CGUISettings, g_guiSettings);
-#define g_guiSettings XBMC_GLOBAL_USE(CGUISettings)
--- /dev/null
+/*
+ * 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 "ISetting.h"
+#include "utils/log.h"
+#include "utils/XBMCTinyXML.h"
+
+#define XML_VISIBLE "visible"
+#define XML_CONDITION "condition"
+
+using namespace std;
+
+ISetting::ISetting(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : m_id(id),
+ m_settingsManager(settingsManager),
+ m_visible(true),
+ m_visibilityCondition(settingsManager)
+{ }
+
+bool ISetting::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ if (node == NULL)
+ return false;
+
+ const TiXmlNode *visibleNode = node->FirstChild(XML_VISIBLE);
+ if (visibleNode == NULL)
+ return true;
+
+ return m_visibilityCondition.Deserialize(visibleNode);
+}
+
+bool ISetting::DeserializeIdentification(const TiXmlNode *node, std::string &identification)
+{
+ if (node == NULL)
+ return false;
+
+ const TiXmlElement *element = node->ToElement();
+ if (element == NULL)
+ return false;
+
+ const char *idAttribute = element->Attribute(XML_ATTR_ID);
+ if (idAttribute == NULL || strlen(idAttribute) <= 0)
+ return false;
+
+ identification = idAttribute;
+ return true;
+}
+
+void ISetting::CheckVisible()
+{
+ m_visible = m_visibilityCondition.Check();
+}
--- /dev/null
+#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 <vector>
+
+#include "SettingVisibility.h"
+
+#define XML_SETTING "setting"
+
+#define XML_ATTR_ID "id"
+#define XML_ATTR_LABEL "label"
+#define XML_ATTR_HELP "help"
+#define XML_ATTR_TYPE "type"
+
+class CSettingsManager;
+class TiXmlNode;
+
+class ISetting
+{
+public:
+ ISetting(const std::string &id, CSettingsManager *settingsManager = NULL);
+ virtual ~ISetting() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ const std::string& GetId() const { return m_id; }
+ bool IsVisible() const { return m_visible; }
+ void CheckVisible();
+ void SetVisible(bool visible) { m_visible = visible; }
+
+ static bool DeserializeIdentification(const TiXmlNode *node, std::string &identification);
+
+protected:
+ std::string m_id;
+ CSettingsManager *m_settingsManager;
+
+private:
+ bool m_visible;
+ CSettingVisibility m_visibilityCondition;
+};
--- /dev/null
+#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/>.
+ *
+ */
+
+class CSetting;
+class TiXmlNode;
+
+class ISettingCallback
+{
+public:
+ virtual ~ISettingCallback() { }
+
+ /*!
+ \brief The value of the given setting is being changed.
+
+ This callback is triggered whenever the value of a setting is being
+ changed. The given CSetting already contains the new value and
+ the handler of the callback has the possibility to allow or revert
+ changing the value of the setting. In case of a revert OnSettingChanging()
+ is called again to inform all listeners that the value change has been
+ reverted.
+
+ \param setting The setting whose value is being changed (already containing the changed value)
+ \return True if the new value is acceptable otherwise false
+ */
+ virtual bool OnSettingChanging(const CSetting *setting) { return true; }
+
+ /*!
+ \brief The value of the given setting has changed.
+
+ This callback is triggered whenever the value of a setting has been
+ successfully changed (i.e. none of the OnSettingChanging() handlers)
+ has reverted the change.
+
+ \param setting The setting whose value has been changed
+ */
+ virtual void OnSettingChanged(const CSetting *setting) { }
+
+ /*!
+ \brief The given setting has been activated.
+
+ This callback is triggered whenever the given setting has been
+ activated. This callback is only fired for CSettingAction settings.
+
+ \param setting The setting which has been activated.
+ */
+ virtual void OnSettingAction(const CSetting *setting) { }
+
+ /*!
+ \brief The given setting needs to be updated.
+
+ This callback is triggered when a setting needs to be updated
+ because its value is outdated. This only happens when initially
+ loading the value of a setting and will not be triggered afterwards.
+
+ \param setting The setting which needs to be updated.
+ \return True if the setting has been successfully updated otherwise false
+ */
+ virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode) { return false; }
+};
--- /dev/null
+#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 CSetting;
+class CSettingsManager;
+
+class ISettingCreator
+{
+public:
+ virtual ~ISettingCreator() { }
+
+ virtual CSetting* CreateSetting(const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager = NULL) const = 0;
+};
\brief Clear any loaded setting values.
*/
virtual void Clear() { }
-};
\ No newline at end of file
+};
SRCS=AdvancedSettings.cpp \
DisplaySettings.cpp \
- GUISettings.cpp \
+ ISetting.cpp \
MediaSettings.cpp \
MediaSourceSettings.cpp \
+ Setting.cpp \
+ SettingAddon.cpp \
+ SettingCategoryAccess.cpp \
+ SettingConditions.cpp \
+ SettingControl.cpp \
+ SettingDependency.cpp \
+ SettingPath.cpp \
+ SettingSection.cpp \
Settings.cpp \
+ SettingsManager.cpp \
+ SettingUpdate.cpp \
+ SettingVisibility.cpp \
SkinSettings.cpp \
VideoSettings.cpp \
#include <limits.h>
#include "MediaSettings.h"
+#include "Application.h"
+#include "Util.h"
+#include "dialogs/GUIDialogContextMenu.h"
+#include "dialogs/GUIDialogFileBrowser.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/WindowIDs.h"
+#include "interfaces/Builtins.h"
+#include "music/MusicDatabase.h"
+#include "profiles/ProfilesManager.h"
+#include "settings/Setting.h"
+#include "storage/MediaManager.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
+#include "utils/URIUtils.h"
#include "utils/XBMCTinyXML.h"
#include "utils/XMLUtils.h"
+#include "video/VideoDatabase.h"
using namespace std;
return true;
}
+void CMediaSettings::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "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(CProfilesManager::Get().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 (settingId == "karaoke.importcsv")
+ {
+ CStdString path(CProfilesManager::Get().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 (settingId == "musiclibrary.cleanup")
+ {
+ CMusicDatabase musicdatabase;
+ musicdatabase.Clean();
+ CUtil::DeleteMusicDatabaseDirectoryCache();
+ }
+ else if (settingId == "musiclibrary.export")
+ CBuiltins::Execute("exportlibrary(music)");
+ else if (settingId == "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 (settingId == "videolibrary.cleanup")
+ {
+ if (CGUIDialogYesNo::ShowAndGetInput(313, 333, 0, 0))
+ g_application.StartVideoCleanup();
+ }
+ else if (settingId == "videolibrary.export")
+ CBuiltins::Execute("exportlibrary(video)");
+ else if (settingId == "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();
+ }
+ }
+}
+
int CMediaSettings::GetWatchedMode(const std::string &content) const
{
CSingleLock lock(m_critical);
#include <map>
#include <string>
+#include "settings/ISettingCallback.h"
#include "settings/ISubSettings.h"
#include "settings/VideoSettings.h"
#include "threads/CriticalSection.h"
WatchedModeWatched
} WatchedMode;
-class CMediaSettings : public ISubSettings
+class CMediaSettings : public ISettingCallback, public ISubSettings
{
public:
static CMediaSettings& Get();
virtual bool Load(const TiXmlNode *settings);
virtual bool Save(TiXmlNode *settings) const;
+ virtual void OnSettingAction(const CSetting *setting);
+
const CVideoSettings& GetDefaultVideoSettings() const { return m_defaultVideoSettings; }
CVideoSettings& GetDefaultVideoSettings() { return m_defaultVideoSettings; }
const CVideoSettings& GetCurrentVideoSettings() const { return m_currentVideoSettings; }
--- /dev/null
+/*
+ * 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 <sstream>
+
+#include "Setting.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+#include "utils/XMLUtils.h"
+
+#define XML_ELM_LEVEL "level"
+#define XML_ELM_DEFAULT "default"
+#define XML_ELM_VALUE "value"
+
+#define XML_ELM_CONSTRAINTS "constraints"
+#define XML_ELM_OPTIONS "options"
+#define XML_ELM_MINIMUM "minimum"
+#define XML_ELM_STEP "step"
+#define XML_ELM_MAXIMUM "maximum"
+
+CSetting::CSetting(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : ISetting(id, settingsManager),
+ m_callback(NULL),
+ m_label(-1), m_help(-1),
+ m_level(SettingLevelStandard),
+ m_changed(false)
+{ }
+
+CSetting::CSetting(const std::string &id, const CSetting &setting)
+ : ISetting(id, setting.m_settingsManager),
+ m_callback(NULL),
+ m_label(-1), m_help(-1),
+ m_level(SettingLevelStandard),
+ m_changed(false)
+{
+ m_id = id;
+ Copy(setting);
+}
+
+bool CSetting::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ // handle <visible> conditions
+ if (!ISetting::Deserialize(node, update))
+ return false;
+
+ const TiXmlElement *element = node->ToElement();
+ if (element == NULL)
+ return false;
+
+ // get the attributes label and help
+ int tmp = -1;
+ if (element->QueryIntAttribute(XML_ATTR_LABEL, &m_label) == TIXML_SUCCESS && tmp > 0)
+ m_label = tmp;
+ if (element->QueryIntAttribute(XML_ATTR_HELP, &m_help) == TIXML_SUCCESS && tmp > 0)
+ m_help = tmp;
+
+ // get the <level>
+ int level = -1;
+ if (XMLUtils::GetInt(node, XML_ELM_LEVEL, level))
+ m_level = (SettingLevel)level;
+
+ if (m_level < (int)SettingLevelBasic || m_level > (int)SettingLevelInternal)
+ m_level = SettingLevelStandard;
+
+ const TiXmlElement *control = node->FirstChildElement("control");
+ if (control != NULL)
+ {
+ if (!m_control.Deserialize(control, update) ||
+ m_control.GetType() == SettingControlTypeNone)
+ {
+ CLog::Log(LOGERROR, "CSetting: error reading <control> tag of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ const TiXmlNode *dependencies = control->FirstChild("dependencies");
+ if (dependencies != NULL)
+ {
+ const TiXmlNode *dependencyNode = dependencies->FirstChild("dependency");
+ while (dependencyNode != NULL)
+ {
+ CSettingDependency dependency(m_settingsManager);
+ if (dependency.Deserialize(dependencyNode))
+ m_dependencies.push_back(dependency);
+ else
+ CLog::Log(LOGWARNING, "CSetting: error reading <dependency> tag of \"%s\"", m_id.c_str());
+
+ dependencyNode = dependencyNode->NextSibling("dependency");
+ }
+ }
+ }
+
+ const TiXmlNode *updates = node->FirstChild("updates");
+ if (updates != NULL)
+ {
+ const TiXmlElement *updateElem = updates->FirstChildElement("update");
+ while (updateElem != NULL)
+ {
+ CSettingUpdate update;
+ if (update.Deserialize(updateElem))
+ {
+ if (!m_updates.insert(update).second)
+ CLog::Log(LOGWARNING, "CSetting: duplicate <update> definition for \"%s\"", m_id.c_str());
+ }
+ else
+ CLog::Log(LOGWARNING, "CSetting: error reading <update> tag of \"%s\"", m_id.c_str());
+
+ updateElem = updateElem->NextSiblingElement("update");
+ }
+ }
+
+ if ((m_control.GetType() == SettingControlTypeSpinner || m_control.GetType() == SettingControlTypeEdit) &&
+ m_control.GetFormat() == SettingControlFormatNone)
+ {
+ CLog::Log(LOGERROR, "CSetting: invalid <control> tag of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+bool CSetting::OnSettingChanging(const CSetting *setting)
+{
+ if (m_callback == NULL)
+ return true;
+
+ return m_callback->OnSettingChanging(setting);
+}
+
+void CSetting::OnSettingChanged(const CSetting *setting)
+{
+ if (m_callback == NULL)
+ return;
+
+ m_callback->OnSettingChanged(setting);
+}
+
+void CSetting::OnSettingAction(const CSetting *setting)
+{
+ if (m_callback == NULL)
+ return;
+
+ m_callback->OnSettingAction(setting);
+}
+
+bool CSetting::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
+{
+ if (m_callback == NULL)
+ return false;
+
+ return m_callback->OnSettingUpdate(setting, oldSettingId, oldSettingNode);
+}
+
+void CSetting::Copy(const CSetting &setting)
+{
+ SetVisible(setting.IsVisible());
+ m_callback = setting.m_callback;
+ m_label = setting.m_label;
+ m_help = setting.m_help;
+ m_level = setting.m_level;
+ m_control = setting.m_control;
+ m_dependencies = setting.m_dependencies;
+ m_updates = setting.m_updates;
+ m_changed = setting.m_changed;
+}
+
+CSettingBool::CSettingBool(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(false), m_default(false)
+{
+ m_control.SetType(SettingControlTypeCheckmark);
+ m_control.SetFormat(SettingControlFormatBoolean);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+CSettingBool::CSettingBool(const std::string &id, const CSettingBool &setting)
+ : CSetting(id, setting)
+{
+ copy(setting);
+}
+
+CSettingBool::CSettingBool(const std::string &id, int label, bool value, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(value), m_default(value)
+{
+ m_label = label;
+
+ m_control.SetType(SettingControlTypeCheckmark);
+ m_control.SetFormat(SettingControlFormatBoolean);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+bool CSettingBool::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSetting::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() != SettingControlTypeCheckmark ||
+ m_control.GetFormat() != SettingControlFormatBoolean ||
+ m_control.GetAttributes() != SettingControlAttributeNone)
+ {
+ CLog::Log(LOGERROR, "CSettingBool: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get the default value
+ bool value;
+ if (XMLUtils::GetBoolean(node, XML_ELM_DEFAULT, value))
+ m_value = m_default = value;
+ else if (!update)
+ {
+ CLog::Log(LOGERROR, "CSettingBool: error reading the default value of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+bool CSettingBool::FromString(const std::string &value)
+{
+ bool bValue;
+ if (!fromString(value, bValue))
+ return false;
+
+ return SetValue(bValue);
+}
+
+std::string CSettingBool::ToString() const
+{
+ return m_value ? "true" : "false";
+}
+
+bool CSettingBool::Equals(const std::string &value) const
+{
+ bool bValue;
+ return (fromString(value, bValue) && m_value == bValue);
+}
+
+bool CSettingBool::CheckValidity(const std::string &value) const
+{
+ bool bValue;
+ return fromString(value, bValue);
+}
+
+bool CSettingBool::SetValue(bool value)
+{
+ CSingleLock lock(m_critical);
+
+ if (value == m_value)
+ return true;
+
+ bool oldValue = m_value;
+ m_value = value;
+
+ if (!OnSettingChanging(this))
+ {
+ m_value = oldValue;
+
+ // the setting couldn't be changed because one of the
+ // callback handlers failed the OnSettingChanging()
+ // callback so we need to let all the callback handlers
+ // know that the setting hasn't changed
+ OnSettingChanging(this);
+ return false;
+ }
+
+ m_changed = m_value != m_default;
+ OnSettingChanged(this);
+ return true;
+}
+
+void CSettingBool::SetDefault(bool value)
+{
+ CSingleLock lock(m_critical);
+
+ m_default = value;
+ if (!m_changed)
+ m_value = m_default;
+}
+
+void CSettingBool::copy(const CSettingBool &setting)
+{
+ CSetting::Copy(setting);
+
+ m_value = setting.m_value;
+ m_default = setting.m_default;
+}
+
+bool CSettingBool::fromString(const std::string &strValue, bool &value) const
+{
+ CSingleLock lock(m_critical);
+
+ if (StringUtils::EqualsNoCase(strValue, "true"))
+ {
+ value = true;
+ return true;
+ }
+ if (StringUtils::EqualsNoCase(strValue, "false"))
+ {
+ value = false;
+ return true;
+ }
+
+ return false;
+}
+
+CSettingInt::CSettingInt(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(0), m_default(0),
+ m_min(0), m_step(1), m_max(0),
+ m_format(-1), m_labelMin(-1), m_strFormat("%i")
+{ }
+
+CSettingInt::CSettingInt(const std::string &id, const CSettingInt &setting)
+ : CSetting(id, setting)
+{
+ copy(setting);
+}
+
+CSettingInt::CSettingInt(const std::string &id, int label, int value, int minimum, int step, int maximum, int format, int minimumLabel, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(value), m_default(value),
+ m_min(minimum), m_step(step), m_max(maximum),
+ m_format(format), m_labelMin(minimumLabel), m_strFormat("%i")
+{
+ m_label = label;
+
+ m_control.SetType(SettingControlTypeSpinner);
+ if (format < 0)
+ m_control.SetFormat(SettingControlFormatInteger);
+ else
+ m_control.SetFormat(SettingControlFormatString);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+CSettingInt::CSettingInt(const std::string &id, int label, int value, int minimum, int step, int maximum, const std::string &format, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(value), m_default(value),
+ m_min(minimum), m_step(step), m_max(maximum),
+ m_format(-1), m_labelMin(-1), m_strFormat(format)
+{
+ m_label = label;
+
+ m_control.SetType(SettingControlTypeSpinner);
+ if (format.empty())
+ {
+ m_strFormat = "%i";
+ m_control.SetFormat(SettingControlFormatInteger);
+ }
+ else
+ m_control.SetFormat(SettingControlFormatString);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+CSettingInt::CSettingInt(const std::string &id, int label, int value, const SettingOptions &options, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(value), m_default(value),
+ m_min(0), m_step(1), m_max(0),
+ m_format(-1), m_labelMin(-1), m_strFormat("%i"),
+ m_options(options)
+{
+ m_label = label;
+
+ m_control.SetType(SettingControlTypeSpinner);
+ m_control.SetFormat(SettingControlFormatString);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+bool CSettingInt::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSetting::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() == SettingControlTypeCheckmark)
+ {
+ CLog::Log(LOGERROR, "CSettingInt: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get the default value
+ int value;
+ if (XMLUtils::GetInt(node, XML_ELM_DEFAULT, value))
+ m_value = m_default = value;
+ else if (!update)
+ {
+ CLog::Log(LOGERROR, "CSettingInt: error reading the default value of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ const TiXmlNode *constraints = node->FirstChild(XML_ELM_CONSTRAINTS);
+ if (constraints != NULL)
+ {
+ // get the entries
+ const TiXmlNode *options = constraints->FirstChild(XML_ELM_OPTIONS);
+ if (options != NULL && options->FirstChild() != NULL)
+ {
+ if (options->FirstChild()->Type() == TiXmlNode::TINYXML_TEXT)
+ m_optionsFiller = options->FirstChild()->ValueStr();
+ else
+ {
+ m_options.clear();
+ const TiXmlElement *optionElement = options->FirstChildElement("option");
+ while (optionElement != NULL)
+ {
+ std::pair<int, int> entry;
+ if (optionElement->QueryIntAttribute("label", &entry.first) == TIXML_SUCCESS && entry.first > 0)
+ {
+ entry.second = strtol(optionElement->FirstChild()->Value(), NULL, 10);
+ m_options.push_back(entry);
+ }
+
+ optionElement = optionElement->NextSiblingElement("option");
+ }
+ }
+ }
+
+ // get minimum
+ if (XMLUtils::GetInt(constraints, XML_ELM_MINIMUM, m_min) &&
+ m_control.GetFormat() == SettingControlFormatString)
+ {
+ const TiXmlElement *minimumElement = constraints->FirstChildElement(XML_ELM_MINIMUM);
+ if (minimumElement->QueryIntAttribute(XML_ATTR_LABEL, &m_labelMin) != TIXML_SUCCESS)
+ m_labelMin = -1;
+ }
+ // get step
+ XMLUtils::GetInt(constraints, XML_ELM_STEP, m_step);
+ // get maximum
+ XMLUtils::GetInt(constraints, XML_ELM_MAXIMUM, m_max);
+
+ if (m_control.GetFormat() == SettingControlFormatString)
+ {
+ XMLUtils::GetInt(constraints, "formatlabel", m_format);
+
+ if (m_labelMin < 0)
+ {
+ CStdString strFormat;
+ if (XMLUtils::GetString(constraints, "format", strFormat) && !strFormat.empty())
+ m_strFormat = strFormat;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CSettingInt::FromString(const std::string &value)
+{
+ int iValue;
+ if (!fromString(value, iValue))
+ return false;
+
+ return SetValue(iValue);
+}
+
+std::string CSettingInt::ToString() const
+{
+ std::ostringstream oss;
+ oss << m_value;
+
+ return oss.str();
+}
+
+bool CSettingInt::Equals(const std::string &value) const
+{
+ int iValue;
+ return (fromString(value, iValue) && m_value == iValue);
+}
+
+bool CSettingInt::CheckValidity(const std::string &value) const
+{
+ int iValue;
+ if (!fromString(value, iValue))
+ return false;
+
+ return CheckValidity(iValue);
+}
+
+bool CSettingInt::CheckValidity(int value) const
+{
+ if (!m_options.empty())
+ {
+ //if the setting is an std::map, check if we got a valid value before assigning it
+ bool ok = false;
+ for (SettingOptions::const_iterator it = m_options.begin(); it != m_options.end(); it++)
+ {
+ if (it->second == value)
+ {
+ ok = true;
+ break;
+ }
+ }
+
+ if (!ok)
+ return false;
+ }
+ else if (m_optionsFiller.empty() && m_min != m_max &&
+ (value < m_min || value > m_max))
+ return false;
+
+ return true;
+}
+
+bool CSettingInt::SetValue(int value)
+{
+ CSingleLock lock(m_critical);
+
+ if (value == m_value)
+ return true;
+
+ if (!CheckValidity(value))
+ return false;
+
+ int oldValue = m_value;
+ m_value = value;
+
+ if (!OnSettingChanging(this))
+ {
+ m_value = oldValue;
+
+ // the setting couldn't be changed because one of the
+ // callback handlers failed the OnSettingChanging()
+ // callback so we need to let all the callback handlers
+ // know that the setting hasn't changed
+ OnSettingChanging(this);
+ return false;
+ }
+
+ m_changed = m_value != m_default;
+ OnSettingChanged(this);
+ return true;
+}
+
+void CSettingInt::SetDefault(int value)
+{
+ CSingleLock lock(m_critical);
+
+ m_default = value;
+ if (!m_changed)
+ m_value = m_default;
+}
+
+void CSettingInt::copy(const CSettingInt &setting)
+{
+ CSetting::Copy(setting);
+
+ m_value = setting.m_value;
+ m_default = setting.m_default;
+ m_min = setting.m_min;
+ m_step = setting.m_step;
+ m_max = setting.m_max;
+ m_format = setting.m_format;
+ m_labelMin = setting.m_labelMin;
+ m_strFormat = setting.m_strFormat;
+ m_options = setting.m_options;
+ m_optionsFiller = setting.m_optionsFiller;
+}
+
+bool CSettingInt::fromString(const std::string &strValue, int &value) const
+{
+ if (strValue.empty())
+ return false;
+
+ char *end = NULL;
+ value = (int)strtol(strValue.c_str(), &end, 10);
+ if (end != NULL && *end != '\0')
+ return false;
+
+ return true;
+}
+
+CSettingNumber::CSettingNumber(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(0.0), m_default(0.0),
+ m_min(0.0), m_step(1.0), m_max(0.0)
+{ }
+
+CSettingNumber::CSettingNumber(const std::string &id, const CSettingNumber &setting)
+ : CSetting(id, setting)
+{
+ copy(setting);
+}
+
+CSettingNumber::CSettingNumber(const std::string &id, int label, float value, float minimum, float step, float maximum, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(value), m_default(value),
+ m_min(minimum), m_step(step), m_max(maximum)
+{
+ m_label = label;
+
+ m_control.SetType(SettingControlTypeSpinner);
+ m_control.SetFormat(SettingControlFormatNumber);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+bool CSettingNumber::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSetting::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() == SettingControlTypeCheckmark)
+ {
+ CLog::Log(LOGERROR, "CSettingInt: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get the default value
+ double value;
+ if (XMLUtils::GetDouble(node, XML_ELM_DEFAULT, value))
+ m_value = m_default = value;
+ else if (!update)
+ {
+ CLog::Log(LOGERROR, "CSettingNumber: error reading the default value of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ const TiXmlNode *constraints = node->FirstChild(XML_ELM_CONSTRAINTS);
+ if (constraints != NULL)
+ {
+ // get the minimum value
+ XMLUtils::GetDouble(constraints, XML_ELM_MINIMUM, m_min);
+ // get the step value
+ XMLUtils::GetDouble(constraints, XML_ELM_STEP, m_step);
+ // get the maximum value
+ XMLUtils::GetDouble(constraints, XML_ELM_MAXIMUM, m_max);
+ }
+
+ return true;
+}
+
+bool CSettingNumber::FromString(const std::string &value)
+{
+ double dValue;
+ if (!fromString(value, dValue))
+ return false;
+
+ return SetValue(dValue);
+}
+
+std::string CSettingNumber::ToString() const
+{
+ std::ostringstream oss;
+ oss << m_value;
+
+ return oss.str();
+}
+
+bool CSettingNumber::Equals(const std::string &value) const
+{
+ double dValue;
+ return (fromString(value, dValue) && m_value == dValue);
+}
+
+bool CSettingNumber::CheckValidity(const std::string &value) const
+{
+ double dValue;
+ if (!fromString(value, dValue))
+ return false;
+
+ return CheckValidity(dValue);
+}
+
+bool CSettingNumber::CheckValidity(double value) const
+{
+ if (m_min != m_max &&
+ (value < m_min || value > m_max))
+ return false;
+
+ return true;
+}
+
+bool CSettingNumber::SetValue(double value)
+{
+ CSingleLock lock(m_critical);
+
+ if (value == m_value)
+ return true;
+
+ if (!CheckValidity(value))
+ return false;
+
+ double oldValue = m_value;
+ m_value = value;
+
+ if (!OnSettingChanging(this))
+ {
+ m_value = oldValue;
+
+ // the setting couldn't be changed because one of the
+ // callback handlers failed the OnSettingChanging()
+ // callback so we need to let all the callback handlers
+ // know that the setting hasn't changed
+ OnSettingChanging(this);
+ return false;
+ }
+
+ m_changed = m_value != m_default;
+ OnSettingChanged(this);
+ return true;
+}
+
+void CSettingNumber::SetDefault(double value)
+{
+ CSingleLock lock(m_critical);
+
+ m_default = value;
+ if (!m_changed)
+ m_value = m_default;
+}
+
+void CSettingNumber::copy(const CSettingNumber &setting)
+{
+ CSetting::Copy(setting);
+
+ m_value = setting.m_value;
+ m_default = setting.m_default;
+ m_min = setting.m_min;
+ m_step = setting.m_step;
+ m_max = setting.m_max;
+}
+
+bool CSettingNumber::fromString(const std::string &strValue, double &value) const
+{
+ if (strValue.empty())
+ return false;
+
+ char *end = NULL;
+ value = (int)strtod(strValue.c_str(), &end);
+ if (end != NULL && *end != '\0')
+ return false;
+
+ return true;
+}
+
+CSettingString::CSettingString(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_allowEmpty(false), m_heading(-1)
+{ }
+
+CSettingString::CSettingString(const std::string &id, const CSettingString &setting)
+ : CSetting(id, setting)
+{
+ copy(setting);
+}
+
+CSettingString::CSettingString(const std::string &id, int label, const std::string &value, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager),
+ m_value(value), m_default(value),
+ m_allowEmpty(false), m_heading(-1)
+{
+ m_label = label;
+
+ m_control.SetType(SettingControlTypeEdit);
+ m_control.SetFormat(SettingControlFormatString);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+bool CSettingString::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSetting::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() == SettingControlTypeCheckmark ||
+ (m_control.GetType() == SettingControlTypeSpinner && (m_control.GetFormat() == SettingControlFormatInteger || m_control.GetFormat() == SettingControlFormatNumber)) ||
+ (m_control.GetType() == SettingControlTypeEdit && m_control.GetFormat() == SettingControlFormatNumber))
+ {
+ CLog::Log(LOGERROR, "CSettingString: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get allowempty (needs to be parsed before parsing the default value)
+ XMLUtils::GetBoolean(node, "allowempty", m_allowEmpty);
+ // get heading
+ XMLUtils::GetInt(node, "heading", m_heading);
+
+ // get the default value
+ CStdString value;
+ if (XMLUtils::GetString(node, XML_ELM_DEFAULT, value))
+ m_value = m_default = value;
+ else if (!update && !m_allowEmpty)
+ {
+ CLog::Log(LOGERROR, "CSettingString: error reading the default value of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ const TiXmlNode *constraints = node->FirstChild(XML_ELM_CONSTRAINTS);
+ if (constraints != NULL)
+ {
+ // get the entries
+ const TiXmlNode *options = constraints->FirstChild(XML_ELM_OPTIONS);
+ if (options != NULL && options->FirstChild() != NULL &&
+ options->FirstChild()->Type() == TiXmlNode::TINYXML_TEXT)
+ m_optionsFiller = options->FirstChild()->ValueStr();
+ }
+
+ return true;
+}
+
+bool CSettingString::CheckValidity(const std::string &value) const
+{
+ if (!m_allowEmpty && value.empty())
+ return false;
+
+ return true;
+}
+
+bool CSettingString::SetValue(const std::string &value)
+{
+ CSingleLock lock(m_critical);
+
+ if (value == m_value)
+ return true;
+
+ if (!CheckValidity(value))
+ return false;
+
+ std::string oldValue = m_value;
+ m_value = value;
+
+ if (!OnSettingChanging(this))
+ {
+ m_value = oldValue;
+
+ // the setting couldn't be changed because one of the
+ // callback handlers failed the OnSettingChanging()
+ // callback so we need to let all the callback handlers
+ // know that the setting hasn't changed
+ OnSettingChanging(this);
+ return false;
+ }
+
+ m_changed = m_value != m_default;
+ OnSettingChanged(this);
+ return true;
+}
+
+void CSettingString::SetDefault(const std::string &value)
+{
+ CSingleLock lock(m_critical);
+
+ m_default = value;
+ if (!m_changed)
+ m_value = m_default;
+}
+
+void CSettingString::copy(const CSettingString &setting)
+{
+ CSetting::Copy(setting);
+
+ m_value = setting.m_value;
+ m_default = setting.m_default;
+ m_allowEmpty = setting.m_allowEmpty;
+ m_heading = setting.m_heading;
+}
+
+CSettingAction::CSettingAction(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSetting(id, settingsManager)
+{
+ m_control.SetType(SettingControlTypeButton);
+ m_control.SetFormat(SettingControlFormatAction);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+CSettingAction::CSettingAction(const std::string &id, const CSettingAction &setting)
+ : CSetting(id, setting)
+{
+ m_control.SetType(SettingControlTypeButton);
+ m_control.SetFormat(SettingControlFormatAction);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+bool CSettingAction::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSetting::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() != SettingControlTypeButton ||
+ m_control.GetFormat() != SettingControlFormatAction ||
+ m_control.GetAttributes() != SettingControlAttributeNone)
+ {
+ CLog::Log(LOGERROR, "CSettingAction: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ return true;
+}
--- /dev/null
+#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 <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "ISetting.h"
+#include "ISettingCallback.h"
+#include "SettingControl.h"
+#include "SettingDependency.h"
+#include "SettingUpdate.h"
+#include "threads/CriticalSection.h"
+
+typedef enum {
+ SettingTypeNone = 0,
+ SettingTypeBool,
+ SettingTypeInteger,
+ SettingTypeNumber,
+ SettingTypeString,
+ SettingTypeAction
+} SettingType;
+
+typedef enum {
+ SettingLevelBasic = 0,
+ SettingLevelStandard,
+ SettingLevelAdvanced,
+ SettingLevelExpert,
+ SettingLevelInternal
+} SettingLevel;
+
+typedef std::pair<int, int> SettingOption;
+typedef std::vector<SettingOption> SettingOptions;
+
+class CSetting : public ISetting,
+ protected ISettingCallback
+{
+public:
+ CSetting(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSetting(const std::string &id, const CSetting &setting);
+ virtual ~CSetting() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ virtual int GetType() const = 0;
+ virtual bool FromString(const std::string &value) = 0;
+ virtual std::string ToString() const = 0;
+ virtual bool Equals(const std::string &value) const = 0;
+ virtual bool CheckValidity(const std::string &value) const = 0;
+ virtual void Reset() = 0;
+
+ int GetLabel() const { return m_label; }
+ int GetHelp() const { return m_help; }
+ SettingLevel GetLevel() const { return m_level; }
+ const CSettingControl& GetControl() const { return m_control; }
+ const SettingDependencies& GetDependencies() const { return m_dependencies; }
+ const std::set<CSettingUpdate>& GetUpdates() const { return m_updates; }
+
+protected:
+ friend class CSettingsManager;
+
+ virtual bool OnSettingChanging(const CSetting *setting);
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
+ virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode);
+
+ void Copy(const CSetting &setting);
+
+ ISettingCallback *m_callback;
+ int m_label;
+ int m_help;
+ SettingLevel m_level;
+ CSettingControl m_control;
+ SettingDependencies m_dependencies;
+ std::set<CSettingUpdate> m_updates;
+ bool m_changed;
+ CCriticalSection m_critical;
+};
+
+typedef std::vector<CSetting *> SettingList;
+
+class CSettingBool : public CSetting
+{
+public:
+ CSettingBool(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingBool(const std::string &id, const CSettingBool &setting);
+ CSettingBool(const std::string &id, int label, bool value, CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingBool() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ virtual int GetType() const { return SettingTypeBool; }
+ virtual bool FromString(const std::string &value);
+ virtual std::string ToString() const;
+ virtual bool Equals(const std::string &value) const;
+ virtual bool CheckValidity(const std::string &value) const;
+ virtual void Reset() { SetValue(m_default); }
+
+ bool GetValue() const { return m_value; }
+ bool SetValue(bool value);
+ bool GetDefault() const { return m_default; }
+ void SetDefault(bool value);
+
+private:
+ void copy(const CSettingBool &setting);
+ bool fromString(const std::string &strValue, bool &value) const;
+
+ bool m_value;
+ bool m_default;
+};
+
+class CSettingInt : public CSetting
+{
+public:
+ CSettingInt(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingInt(const std::string &id, const CSettingInt &setting);
+ CSettingInt(const std::string &id, int label, int value, int minimum, int step, int maximum, int format, int minimumLabel, CSettingsManager *settingsManager = NULL);
+ CSettingInt(const std::string &id, int label, int value, int minimum, int step, int maximum, const std::string &format, CSettingsManager *settingsManager = NULL);
+ CSettingInt(const std::string &id, int label, int value, const SettingOptions &options, CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingInt() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ virtual int GetType() const { return SettingTypeInteger; }
+ virtual bool FromString(const std::string &value);
+ virtual std::string ToString() const;
+ virtual bool Equals(const std::string &value) const;
+ virtual bool CheckValidity(const std::string &value) const;
+ virtual bool CheckValidity(int value) const;
+ virtual void Reset() { SetValue(m_default); }
+
+ int GetValue() const { return m_value; }
+ bool SetValue(int value);
+ int GetDefault() const { return m_default; }
+ void SetDefault(int value);
+
+ int GetMinimum() const { return m_min; }
+ int GetStep() const { return m_step; }
+ int GetMaximum() const { return m_max; }
+
+ int GetFormat() const { return m_format; }
+ int GetMinimumLabel() const { return m_labelMin; }
+ const std::string& GetFormatString() const { return m_strFormat; }
+ const SettingOptions& GetOptions() const { return m_options; }
+ const std::string& GetOptionsFiller() const { return m_optionsFiller; }
+
+private:
+ void copy(const CSettingInt &setting);
+ bool fromString(const std::string &strValue, int &value) const;
+
+ int m_value;
+ int m_default;
+ int m_min;
+ int m_step;
+ int m_max;
+ int m_format;
+ int m_labelMin;
+ std::string m_strFormat;
+ SettingOptions m_options;
+ std::string m_optionsFiller;
+};
+
+class CSettingNumber : public CSetting
+{
+public:
+ CSettingNumber(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingNumber(const std::string &id, const CSettingNumber &setting);
+ CSettingNumber(const std::string &id, int label, float value, float minimum, float step, float maximum, CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingNumber() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ virtual int GetType() const { return SettingTypeNumber; }
+ virtual bool FromString(const std::string &value);
+ virtual std::string ToString() const;
+ virtual bool Equals(const std::string &value) const;
+ virtual bool CheckValidity(const std::string &value) const;
+ virtual bool CheckValidity(double value) const;
+ virtual void Reset() { SetValue(m_default); }
+
+ double GetValue() const { return m_value; }
+ bool SetValue(double value);
+ double GetDefault() const { return m_default; }
+ void SetDefault(double value);
+
+ double GetMinimum() const { return m_min; }
+ double GetStep() const { return m_step; }
+ double GetMaximum() const { return m_max; }
+
+private:
+ virtual void copy(const CSettingNumber &setting);
+ bool fromString(const std::string &strValue, double &value) const;
+
+ double m_value;
+ double m_default;
+ double m_min;
+ double m_step;
+ double m_max;
+};
+
+class CSettingString : public CSetting
+{
+public:
+ CSettingString(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingString(const std::string &id, const CSettingString &setting);
+ CSettingString(const std::string &id, int label, const std::string &value, CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingString() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ virtual int GetType() const { return SettingTypeString; }
+ virtual bool FromString(const std::string &value) { return SetValue(value); }
+ virtual std::string ToString() const { return m_value; }
+ virtual bool Equals(const std::string &value) const { return m_value == value; }
+ virtual bool CheckValidity(const std::string &value) const;
+ virtual void Reset() { SetValue(m_default); }
+
+ virtual const std::string& GetValue() const { return m_value; }
+ virtual bool SetValue(const std::string &value);
+ virtual const std::string& GetDefault() const { return m_default; }
+ virtual void SetDefault(const std::string &value);
+
+ virtual bool AllowEmpty() const { return m_allowEmpty; }
+ virtual int GetHeading() const { return m_heading; }
+
+ const std::string& GetOptionsFiller() const { return m_optionsFiller; }
+
+protected:
+ virtual void copy(const CSettingString &setting);
+
+ std::string m_value;
+ std::string m_default;
+ bool m_allowEmpty;
+ int m_heading;
+ std::string m_optionsFiller;
+};
+
+class CSettingAction : public CSetting
+{
+public:
+ CSettingAction(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingAction(const std::string &id, const CSettingAction &setting);
+ virtual ~CSettingAction() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ virtual int GetType() const { return SettingTypeAction; }
+ virtual bool FromString(const std::string &value) { return false; }
+ virtual std::string ToString() const { return ""; }
+ virtual bool Equals(const std::string &value) const { return false; }
+ virtual bool CheckValidity(const std::string &value) const { return false; }
+ virtual void Reset() { }
+
+ // this needs to be public so it can be triggered when activated
+ // by the user in the GUI.
+ virtual void OnSettingAction(const CSetting *setting) { return CSetting::OnSettingAction(this); }
+};
--- /dev/null
+/*
+ * 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 "SettingAddon.h"
+#include "addons/Addon.h"
+#include "settings/SettingsManager.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/XBMCTinyXML.h"
+#include "utils/XMLUtils.h"
+
+#define XML_ELM_DEFAULT "default"
+
+CSettingAddon::CSettingAddon(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSettingString(id, settingsManager),
+ m_addonType(ADDON::ADDON_UNKNOWN)
+{
+ m_control.SetType(SettingControlTypeButton);
+ m_control.SetFormat(SettingControlFormatAddon);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+CSettingAddon::CSettingAddon(const std::string &id, const CSettingAddon &setting)
+ : CSettingString(id, setting)
+{
+ copy(setting);
+}
+
+bool CSettingAddon::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSettingString::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() != SettingControlTypeButton ||
+ m_control.GetFormat() != SettingControlFormatAddon ||
+ m_control.GetAttributes() != SettingControlAttributeNone)
+ {
+ CLog::Log(LOGERROR, "CSettingAddon: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get the default value by abusing the FromString
+ // implementation to parse the default value
+ CStdString value;
+ if (XMLUtils::GetString(node, XML_ELM_DEFAULT, value))
+ m_value = m_default = value;
+ else if (!update)
+ {
+ CLog::Log(LOGERROR, "CSettingAddon: error reading the default value of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get the addon type
+ CStdString strAddonType;
+ bool ok = XMLUtils::GetString(node, "addontype", strAddonType);
+ if (ok)
+ {
+ m_addonType = ADDON::TranslateType(strAddonType);
+ if (m_addonType == ADDON::ADDON_UNKNOWN)
+ ok = false;
+ }
+
+ if (!ok && !update)
+ {
+ CLog::Log(LOGERROR, "CSettingAddon: error reading the addontype value \"%s\" of \"%s\"", strAddonType.c_str(), m_id.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+void CSettingAddon::copy(const CSettingAddon &setting)
+{
+ CSettingString::Copy(setting);
+
+ m_addonType = setting.m_addonType;
+}
--- /dev/null
+#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 "Setting.h"
+#include "addons/IAddon.h"
+
+class CSettingAddon : public CSettingString
+{
+public:
+ CSettingAddon(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingAddon(const std::string &id, const CSettingAddon &setting);
+ virtual ~CSettingAddon() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ ADDON::TYPE GetAddonType() const { return m_addonType; }
+
+private:
+ void copy(const CSettingAddon &setting);
+
+ ADDON::TYPE m_addonType;
+};
--- /dev/null
+/*
+ * 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 "SettingCategoryAccess.h"
+#include "SettingConditions.h"
+#include "SettingsManager.h"
+#include "utils/log.h"
+
+bool CSettingCategoryAccessCondition::Check() const
+{
+ if (m_value.empty())
+ return true;
+
+ if (m_settingsManager == NULL)
+ return false;
+
+ bool found = m_settingsManager->GetConditions().Check(m_value, "true");
+ if (m_negated)
+ return !found;
+
+ return found;
+}
+
+bool CSettingCategoryAccessConditionCombination::Check() const
+{
+ if (m_operations.empty() && m_values.empty())
+ return true;
+
+ return CSettingConditionCombination::Check();
+}
+
+CSettingCategoryAccess::CSettingCategoryAccess(CSettingsManager *settingsManager /* = NULL */)
+ : CSettingCondition(settingsManager)
+{
+ m_operation = CBooleanLogicOperationPtr(new CSettingCategoryAccessConditionCombination(m_settingsManager));
+}
--- /dev/null
+#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 <set>
+#include <string>
+
+#include "SettingConditions.h"
+
+class CSettingCategoryAccessCondition : public CSettingConditionItem
+{
+public:
+ CSettingCategoryAccessCondition(CSettingsManager *settingsManager = NULL)
+ : CSettingConditionItem(settingsManager)
+ { }
+ virtual ~CSettingCategoryAccessCondition() { }
+
+ virtual bool Check() const;
+};
+
+class CSettingCategoryAccessConditionCombination : public CSettingConditionCombination
+{
+public:
+ CSettingCategoryAccessConditionCombination(CSettingsManager *settingsManager = NULL)
+ : CSettingConditionCombination(settingsManager)
+ { }
+ virtual ~CSettingCategoryAccessConditionCombination() { }
+
+ virtual bool Check() const;
+
+private:
+ virtual CBooleanLogicOperation* newOperation() { return new CSettingCategoryAccessConditionCombination(m_settingsManager); }
+ virtual CBooleanLogicValue* newValue() { return new CSettingCategoryAccessCondition(m_settingsManager); }
+};
+
+class CSettingCategoryAccess : public CSettingCondition
+{
+public:
+ CSettingCategoryAccess(CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingCategoryAccess() { }
+};
--- /dev/null
+/*
+ * 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 "SettingConditions.h"
+#include "SettingsManager.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+bool CSettingConditionItem::Deserialize(const TiXmlNode *node)
+{
+ if (!CBooleanLogicValue::Deserialize(node))
+ return false;
+
+ const TiXmlElement *elem = node->ToElement();
+ if (elem == NULL)
+ return false;
+
+ // get the "name" attribute
+ const char *strAttribute = elem->Attribute("name");
+ if (strAttribute != NULL)
+ m_name = strAttribute;
+
+ // get the "setting" attribute
+ strAttribute = elem->Attribute("setting");
+ if (strAttribute != NULL)
+ m_setting = strAttribute;
+
+ return true;
+}
+
+bool CSettingConditionItem::Check() const
+{
+ if (m_settingsManager == NULL)
+ return false;
+
+ return m_settingsManager->GetConditions().Check(m_name, m_value, m_setting) == !m_negated;
+}
+
+bool CSettingConditionCombination::Check() const
+{
+ bool ok = false;
+ for (CBooleanLogicOperations::const_iterator operation = m_operations.begin();
+ operation != m_operations.end(); operation++)
+ {
+ if (*operation == NULL)
+ continue;
+
+ CSettingConditionCombination *combination = static_cast<CSettingConditionCombination*>((*operation).get());
+ if (combination == NULL)
+ continue;
+
+ if (combination->Check())
+ ok = true;
+ else if (m_operation == BooleanLogicOperationAnd)
+ return false;
+ }
+
+ for (CBooleanLogicValues::const_iterator value = m_values.begin();
+ value != m_values.end(); value++)
+ {
+ if (*value == NULL)
+ continue;
+
+ CSettingConditionItem *condition = static_cast<CSettingConditionItem*>((*value).get());
+ if (condition == NULL)
+ continue;
+
+ if (condition->Check())
+ ok = true;
+ else if (m_operation == BooleanLogicOperationAnd)
+ return false;
+ }
+
+ return ok;
+}
+
+CSettingCondition::CSettingCondition(CSettingsManager *settingsManager /* = NULL */)
+ : ISettingCondition(settingsManager)
+{
+ m_operation = CBooleanLogicOperationPtr(new CSettingConditionCombination(settingsManager));
+}
+
+bool CSettingCondition::Check() const
+{
+ CSettingConditionCombination *combination = static_cast<CSettingConditionCombination*>(m_operation.get());
+ if (combination == NULL)
+ return false;
+
+ return combination->Check();
+}
+
+void CSettingConditionsManager::AddCondition(const std::string &condition)
+{
+ if (condition.empty())
+ return;
+
+ m_defines.insert(condition);
+}
+
+void CSettingConditionsManager::AddCondition(const std::string &identifier, SettingConditionCheck condition)
+{
+ if (identifier.empty() || condition == NULL)
+ return;
+
+ m_conditions.insert(SettingConditionPair(identifier, condition));
+}
+
+bool CSettingConditionsManager::Check(const std::string &condition, const std::string &value /* = "" */, const std::string settingId /* = "" */) const
+{
+ if (condition.empty())
+ return false;
+
+ std::string tmpCondition = condition;
+ StringUtils::ToLower(tmpCondition);
+
+ // special handling of "isdefined" conditions
+ if (tmpCondition == "isdefined")
+ {
+ std::string tmpValue = value;
+ StringUtils::ToLower(tmpValue);
+
+ return m_defines.find(tmpValue) != m_defines.end();
+ }
+
+ SettingConditionMap::const_iterator conditionIt = m_conditions.find(tmpCondition);
+ if (conditionIt == m_conditions.end())
+ return false;
+
+ return conditionIt->second(tmpCondition, value, settingId);
+}
+
+CSettingConditionsManager::CSettingConditionsManager()
+{ }
+
+CSettingConditionsManager::~CSettingConditionsManager()
+{
+ m_conditions.clear();
+ m_defines.clear();
+}
--- /dev/null
+#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 <map>
+#include <set>
+#include <string>
+
+#include "utils/BooleanLogic.h"
+
+class CSettingsManager;
+
+typedef bool (*SettingConditionCheck)(const std::string &condition, const std::string &value, const std::string &settingId);
+
+class ISettingCondition
+{
+public:
+ ISettingCondition(CSettingsManager *settingsManager)
+ : m_settingsManager(settingsManager)
+ { }
+ virtual ~ISettingCondition() { }
+
+ virtual bool Check() const = 0;
+
+protected:
+ CSettingsManager *m_settingsManager;
+};
+
+class CSettingConditionItem : public CBooleanLogicValue, public ISettingCondition
+{
+public:
+ CSettingConditionItem(CSettingsManager *settingsManager = NULL)
+ : ISettingCondition(settingsManager)
+ { }
+ virtual ~CSettingConditionItem() { }
+
+ virtual bool Deserialize(const TiXmlNode *node);
+ virtual const char* GetTag() const { return "condition"; }
+ virtual bool Check() const;
+
+protected:
+ std::string m_name;
+ std::string m_setting;
+};
+
+class CSettingConditionCombination : public CBooleanLogicOperation, public ISettingCondition
+{
+public:
+ CSettingConditionCombination(CSettingsManager *settingsManager = NULL)
+ : ISettingCondition(settingsManager)
+ { }
+ virtual ~CSettingConditionCombination() { }
+
+ virtual bool Check() const;
+
+private:
+ virtual CBooleanLogicOperation* newOperation() { return new CSettingConditionCombination(m_settingsManager); }
+ virtual CBooleanLogicValue* newValue() { return new CSettingConditionItem(m_settingsManager); }
+};
+
+class CSettingCondition : public CBooleanLogic, public ISettingCondition
+{
+public:
+ CSettingCondition(CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingCondition() { }
+
+ virtual bool Check() const;
+};
+
+class CSettingConditionsManager
+{
+public:
+ CSettingConditionsManager();
+ virtual ~CSettingConditionsManager();
+
+ void AddCondition(const std::string &condition);
+ void AddCondition(const std::string &identifier, SettingConditionCheck condition);
+
+ bool Check(const std::string &condition, const std::string &value = "", const std::string settingId = "") const;
+
+private:
+ CSettingConditionsManager(const CSettingConditionsManager&);
+ CSettingConditionsManager const& operator=(CSettingConditionsManager const&);
+
+ typedef std::pair<std::string, SettingConditionCheck> SettingConditionPair;
+ typedef std::map<std::string, SettingConditionCheck> SettingConditionMap;
+
+ SettingConditionMap m_conditions;
+ std::set<std::string> m_defines;
+};
--- /dev/null
+/*
+ * 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 <vector>
+
+#include "SettingControl.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+bool CSettingControl::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ if (node == NULL)
+ return false;
+
+ const TiXmlElement *elem = node->ToElement();
+ if (elem == NULL)
+ return false;
+
+ const char *strTmp = elem->Attribute("type");
+ if ((strTmp == NULL && !update && m_type == SettingControlTypeNone) || (strTmp != NULL && !setType(strTmp)))
+ {
+ CLog::Log(LOGERROR, "CSetting: error reading \"type\" attribute of <control>");
+ return false;
+ }
+
+ strTmp = elem->Attribute("format");
+ if ((strTmp == NULL && !update && m_format == SettingControlFormatNone) || (strTmp != NULL && !setFormat(strTmp)))
+ {
+ CLog::Log(LOGERROR, "CSetting: error reading \"format\" attribute of <control>");
+ return false;
+ }
+
+ if ((strTmp = elem->Attribute("attributes")) != NULL && !setAttributes(strTmp))
+ {
+ CLog::Log(LOGERROR, "CSetting: error reading \"attributes\" attribute of <control>");
+ return false;
+ }
+
+ if ((strTmp = elem->Attribute("delayed")) != NULL)
+ {
+ if (!StringUtils::EqualsNoCase(strTmp, "false") && !StringUtils::EqualsNoCase(strTmp, "true"))
+ {
+ CLog::Log(LOGERROR, "CSetting: error reading \"delayed\" attribute of <control>");
+ return false;
+ }
+ else
+ m_delayed = StringUtils::EqualsNoCase(strTmp, "true");
+ }
+
+ return true;
+}
+
+bool CSettingControl::setType(const std::string &strType)
+{
+ if (StringUtils::EqualsNoCase(strType, "toggle"))
+ m_type = SettingControlTypeCheckmark;
+ else if (StringUtils::EqualsNoCase(strType, "spinner"))
+ m_type = SettingControlTypeSpinner;
+ else if (StringUtils::EqualsNoCase(strType, "edit"))
+ {
+ m_type = SettingControlTypeEdit;
+ m_delayed = true;
+ }
+ else if (StringUtils::EqualsNoCase(strType, "button"))
+ m_type = SettingControlTypeButton;
+ else
+ return false;
+
+ return true;
+}
+
+bool CSettingControl::setFormat(const std::string &strFormat)
+{
+ if (StringUtils::EqualsNoCase(strFormat, "boolean"))
+ m_format = SettingControlFormatBoolean;
+ else if (StringUtils::EqualsNoCase(strFormat, "string"))
+ m_format = SettingControlFormatString;
+ else if (StringUtils::EqualsNoCase(strFormat, "integer"))
+ m_format = SettingControlFormatInteger;
+ else if (StringUtils::EqualsNoCase(strFormat, "number"))
+ m_format = SettingControlFormatNumber;
+ else if (StringUtils::EqualsNoCase(strFormat, "ip"))
+ m_format = SettingControlFormatIP;
+ else if (StringUtils::EqualsNoCase(strFormat, "md5"))
+ m_format = SettingControlFormatMD5;
+ else if (StringUtils::EqualsNoCase(strFormat, "path"))
+ m_format = SettingControlFormatPath;
+ else if (StringUtils::EqualsNoCase(strFormat, "addon"))
+ m_format = SettingControlFormatAddon;
+ else if (StringUtils::EqualsNoCase(strFormat, "action"))
+ m_format = SettingControlFormatAction;
+ else
+ return false;
+
+ return true;
+}
+
+bool CSettingControl::setAttributes(const std::string &strAttributes)
+{
+ std::vector<std::string> attributeList = StringUtils::Split(strAttributes, ",");
+
+ int controlAttributes = SettingControlAttributeNone;
+ for (std::vector<std::string>::const_iterator attribute = attributeList.begin(); attribute != attributeList.end(); attribute++)
+ {
+ if (StringUtils::EqualsNoCase(*attribute, "hidden"))
+ controlAttributes |= (int)SettingControlAttributeHidden;
+ else if (StringUtils::EqualsNoCase(*attribute, "new"))
+ controlAttributes |= (int)SettingControlAttributeVerifyNew;
+ else
+ return false;
+ }
+
+ m_attributes = (SettingControlAttribute)controlAttributes;
+ return true;
+}
\ No newline at end of file
--- /dev/null
+#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 TiXmlNode;
+
+typedef enum {
+ SettingControlTypeNone = 0,
+ SettingControlTypeCheckmark,
+ SettingControlTypeSpinner,
+ SettingControlTypeEdit,
+ SettingControlTypeButton
+} SettingControlType;
+
+typedef enum {
+ SettingControlFormatNone = 0,
+ SettingControlFormatBoolean,
+ SettingControlFormatString,
+ SettingControlFormatInteger,
+ SettingControlFormatNumber,
+ SettingControlFormatIP,
+ SettingControlFormatMD5,
+ SettingControlFormatPath,
+ SettingControlFormatAddon,
+ SettingControlFormatAction
+} SettingControlFormat;
+
+typedef enum {
+ SettingControlAttributeNone = 0x0,
+ SettingControlAttributeHidden = 0x1,
+ SettingControlAttributeVerifyNew = 0x2
+} SettingControlAttribute;
+
+class CSettingControl
+{
+public:
+ CSettingControl(SettingControlType type = SettingControlTypeNone,
+ SettingControlFormat format = SettingControlFormatNone,
+ SettingControlAttribute attribute = SettingControlAttributeNone)
+ : m_type(type), m_format(format), m_attributes(attribute),
+ m_delayed(false)
+ { }
+ virtual ~CSettingControl() { }
+
+ bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ SettingControlType GetType() const { return m_type; }
+ SettingControlFormat GetFormat() const { return m_format; }
+ SettingControlAttribute GetAttributes() const { return m_attributes; }
+ bool GetDelayed() const { return m_delayed; }
+
+ void SetType(SettingControlType type) { m_type = type; }
+ void SetFormat(SettingControlFormat format) { m_format = format; }
+ void SetAttributes(SettingControlAttribute attributes) { m_attributes = attributes; }
+
+protected:
+ bool setType(const std::string &strType);
+ bool setFormat(const std::string &strFormat);
+ bool setAttributes(const std::string &strAttributes);
+
+ SettingControlType m_type;
+ SettingControlFormat m_format;
+ SettingControlAttribute m_attributes;
+ bool m_delayed;
+};
--- /dev/null
+/*
+ * 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 <stdlib.h>
+
+#include "SettingDependency.h"
+#include "Setting.h"
+#include "SettingsManager.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+bool CSettingDependencyCondition::Deserialize(const TiXmlNode *node)
+{
+ if (!CSettingConditionItem::Deserialize(node))
+ return false;
+
+ const TiXmlElement *elem = node->ToElement();
+ if (elem == NULL)
+ return false;
+
+ m_target = SettingDependencyTargetSetting;
+ const char *strTarget = elem->Attribute("on");
+ if (strTarget != NULL && !setTarget(strTarget))
+ {
+ CLog::Log(LOGWARNING, "CSettingDependencyCondition: unknown target \"%s\"", strTarget);
+ return false;
+ }
+
+ if (m_target != SettingDependencyTargetSetting && m_name.empty())
+ {
+ CLog::Log(LOGWARNING, "CSettingDependencyCondition: missing name for dependency");
+ return false;
+ }
+
+ if (m_target == SettingDependencyTargetSetting)
+ {
+ if (m_setting.empty())
+ {
+ CLog::Log(LOGWARNING, "CSettingDependencyCondition: missing setting for dependency");
+ return false;
+ }
+
+ m_name = m_setting;
+ }
+
+ m_operator = SettingDependencyOperatorEquals;
+ const char *strOperator = elem->Attribute("operator");
+ if (strOperator != NULL && !setOperator(strOperator))
+ {
+ CLog::Log(LOGWARNING, "CSettingDependencyCondition: unknown operator \"%s\"", strOperator);
+ return false;
+ }
+
+ return true;
+}
+
+bool CSettingDependencyCondition::Check() const
+{
+ if (m_name.empty() ||
+ m_target == SettingDependencyTargetNone ||
+ m_operator == SettingDependencyOperatorNone ||
+ m_settingsManager == NULL)
+ return false;
+
+ bool result = false;
+ switch (m_target)
+ {
+ case SettingDependencyTargetSetting:
+ {
+ if (m_setting.empty())
+ return false;
+
+ const CSetting *setting = m_settingsManager->GetSetting(m_setting);
+ if (setting == NULL)
+ {
+ CLog::Log(LOGWARNING, "CSettingDependencyCondition: unable to check condition on unknown setting \"%s\"", m_setting.c_str());
+ return false;
+ }
+
+ if (m_operator == SettingDependencyOperatorEquals)
+ result = setting->Equals(m_value);
+ else if (m_operator == SettingDependencyOperatorContains)
+ result = (setting->ToString().find(m_value) != std::string::npos);
+
+ break;
+ }
+
+ case SettingDependencyTargetProperty:
+ {
+ result = m_settingsManager->GetConditions().Check(m_name, m_value, m_setting);
+ break;
+ }
+
+ default:
+ return false;
+ }
+
+ return result == !m_negated;
+}
+
+bool CSettingDependencyCondition::setTarget(const std::string &target)
+{
+ if (StringUtils::EqualsNoCase(target, "setting"))
+ m_target = SettingDependencyTargetSetting;
+ else if (StringUtils::EqualsNoCase(target, "property"))
+ m_target = SettingDependencyTargetProperty;
+ else
+ return false;
+
+ return true;
+}
+
+bool CSettingDependencyCondition::setOperator(const std::string &op)
+{
+ size_t length = 0;
+ if (StringUtils::EndsWith(op, "is"))
+ {
+ m_operator = SettingDependencyOperatorEquals;
+ length = 2;
+ }
+ else if (StringUtils::EndsWith(op, "contains"))
+ {
+ m_operator = SettingDependencyOperatorContains;
+ length = 8;
+ }
+
+ if (op.size() > length + 1)
+ return false;
+ if (op.size() == length + 1)
+ {
+ if (!StringUtils::StartsWith(op, "!"))
+ return false;
+ m_negated = true;
+ }
+
+ return true;
+}
+
+bool CSettingDependencyConditionCombination::Deserialize(const TiXmlNode *node)
+{
+ if (node == NULL)
+ return false;
+
+ size_t numOperations = m_operations.size();
+ size_t numValues = m_values.size();
+
+ if (!CSettingConditionCombination::Deserialize(node))
+ return false;
+
+ if (numOperations < m_operations.size())
+ {
+ for (size_t i = numOperations; i < m_operations.size(); i++)
+ {
+ if (m_operations[i] == NULL)
+ continue;
+
+ CSettingDependencyConditionCombination *combination = static_cast<CSettingDependencyConditionCombination*>(m_operations[i].get());
+ if (combination == NULL)
+ continue;
+
+ const std::set<std::string>& settings = combination->GetSettings();
+ m_settings.insert(settings.begin(), settings.end());
+ }
+ }
+
+ if (numValues < m_values.size())
+ {
+ for (size_t i = numValues; i < m_values.size(); i++)
+ {
+ if (m_values[i] == NULL)
+ continue;
+
+ CSettingDependencyCondition *condition = static_cast<CSettingDependencyCondition*>(m_values[i].get());
+ if (condition == NULL)
+ continue;
+
+ std::string settingId = condition->GetSetting();
+ if (!settingId.empty())
+ m_settings.insert(settingId);
+ }
+ }
+
+ return true;
+}
+
+CSettingDependency::CSettingDependency(CSettingsManager *settingsManager /* = NULL */)
+ : CSettingCondition(settingsManager),
+ m_type(SettingDependencyTypeNone)
+{
+ m_operation = CBooleanLogicOperationPtr(new CSettingDependencyConditionCombination(m_settingsManager));
+}
+
+bool CSettingDependency::Deserialize(const TiXmlNode *node)
+{
+ if (node == NULL)
+ return false;
+
+ const TiXmlElement *elem = node->ToElement();
+ if (elem == NULL)
+ return false;
+
+ const char *strType = elem->Attribute("type");
+ if (strType == NULL || strlen(strType) <= 0 || !setType(strType))
+ {
+ CLog::Log(LOGWARNING, "CSettingDependency: missing or unknown dependency type definition");
+ return false;
+ }
+
+ return CSettingCondition::Deserialize(node);
+}
+
+std::set<std::string> CSettingDependency::GetSettings() const
+{
+ if (m_operation == NULL)
+ return std::set<std::string>();
+
+ CSettingDependencyConditionCombination *combination = static_cast<CSettingDependencyConditionCombination*>(m_operation.get());
+ if (combination == NULL)
+ return std::set<std::string>();
+
+ return combination->GetSettings();
+}
+
+bool CSettingDependency::setType(const std::string &type)
+{
+ if (StringUtils::EqualsNoCase(type, "enable"))
+ m_type = SettingDependencyTypeEnable;
+ else if (StringUtils::EqualsNoCase(type, "update"))
+ m_type = SettingDependencyTypeUpdate;
+ else
+ return false;
+
+ return true;
+}
--- /dev/null
+#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 <list>
+#include <set>
+#include <string>
+
+#include "SettingConditions.h"
+#include "utils/BooleanLogic.h"
+
+typedef enum {
+ SettingDependencyTypeNone = 0,
+ SettingDependencyTypeEnable,
+ SettingDependencyTypeUpdate
+} SettingDependencyType;
+
+typedef enum {
+ SettingDependencyOperatorNone = 0,
+ SettingDependencyOperatorEquals,
+ SettingDependencyOperatorContains
+} SettingDependencyOperator;
+
+typedef enum {
+ SettingDependencyTargetNone = 0,
+ SettingDependencyTargetSetting,
+ SettingDependencyTargetProperty
+} SettingDependencyTarget;
+
+class CSettingDependencyCondition : public CSettingConditionItem
+{
+public:
+ CSettingDependencyCondition(CSettingsManager *settingsManager = NULL)
+ : CSettingConditionItem(settingsManager),
+ m_operator(SettingDependencyOperatorEquals)
+ { }
+ virtual ~CSettingDependencyCondition() { }
+
+ virtual bool Deserialize(const TiXmlNode *node);
+ virtual bool Check() const;
+
+ const std::string& GetName() const { return m_name; }
+ const std::string& GetSetting() const { return m_setting; }
+ const SettingDependencyTarget GetTarget() const { return m_target; }
+ const SettingDependencyOperator GetOperator() const { return m_operator; }
+
+private:
+ bool setTarget(const std::string &target);
+ bool setOperator(const std::string &op);
+
+ SettingDependencyTarget m_target;
+ SettingDependencyOperator m_operator;
+};
+
+class CSettingDependencyConditionCombination : public CSettingConditionCombination
+{
+public:
+ CSettingDependencyConditionCombination(CSettingsManager *settingsManager = NULL)
+ : CSettingConditionCombination(settingsManager)
+ { }
+ virtual ~CSettingDependencyConditionCombination() { }
+
+ virtual bool Deserialize(const TiXmlNode *node);
+
+ const std::set<std::string>& GetSettings() const { return m_settings; }
+
+private:
+ virtual CBooleanLogicOperation* newOperation() { return new CSettingDependencyConditionCombination(m_settingsManager); }
+ virtual CBooleanLogicValue* newValue() { return new CSettingDependencyCondition(m_settingsManager); }
+
+ std::set<std::string> m_settings;
+};
+
+class CSettingDependency : public CSettingCondition
+{
+public:
+ CSettingDependency(CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingDependency() { }
+
+ virtual bool Deserialize(const TiXmlNode *node);
+
+ SettingDependencyType GetType() const { return m_type; }
+ std::set<std::string> GetSettings() const;
+
+private:
+ bool setType(const std::string &type);
+
+ SettingDependencyType m_type;
+};
+
+typedef std::list<CSettingDependency> SettingDependencies;
+typedef std::map<std::string, SettingDependencies> SettingDependencyMap;
--- /dev/null
+/*
+ * 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 "SettingPath.h"
+#include "settings/SettingsManager.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+#include "utils/XMLUtils.h"
+
+#define XML_ELM_DEFAULT "default"
+#define XML_ELM_CONSTRAINTS "constraints"
+
+CSettingPath::CSettingPath(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : CSettingString(id, settingsManager),
+ m_writable(true)
+{
+ m_control.SetType(SettingControlTypeButton);
+ m_control.SetFormat(SettingControlFormatPath);
+ m_control.SetAttributes(SettingControlAttributeNone);
+}
+
+CSettingPath::CSettingPath(const std::string &id, const CSettingPath &setting)
+ : CSettingString(id, setting)
+{
+ copy(setting);
+}
+
+bool CSettingPath::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ CSingleLock lock(m_critical);
+
+ if (!CSettingString::Deserialize(node, update))
+ return false;
+
+ if (m_control.GetType() != SettingControlTypeButton ||
+ m_control.GetFormat() != SettingControlFormatPath ||
+ m_control.GetAttributes() != SettingControlAttributeNone)
+ {
+ CLog::Log(LOGERROR, "CSettingPath: invalid <control> of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ // get the default value by abusing the FromString
+ // implementation to parse the default value
+ CStdString value;
+ if (XMLUtils::GetString(node, XML_ELM_DEFAULT, value))
+ m_value = m_default = value;
+ else if (!update && !m_allowEmpty)
+ {
+ CLog::Log(LOGERROR, "CSettingPath: error reading the default value of \"%s\"", m_id.c_str());
+ return false;
+ }
+
+ const TiXmlNode *constraints = node->FirstChild(XML_ELM_CONSTRAINTS);
+ if (constraints != NULL)
+ {
+ // get writable
+ XMLUtils::GetBoolean(constraints, "writable", m_writable);
+
+ // get sources
+ const TiXmlNode *sources = constraints->FirstChild("sources");
+ if (sources != NULL)
+ {
+ m_sources.clear();
+ const TiXmlNode *source = sources->FirstChild("source");
+ while (source != NULL)
+ {
+ std::string strSource = source->FirstChild()->ValueStr();
+ if (!strSource.empty())
+ m_sources.push_back(strSource);
+
+ source = source->NextSibling("source");
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CSettingPath::SetValue(const std::string &value)
+{
+ // for backwards compatibility to Frodo
+ if (StringUtils::EqualsNoCase(value, "select folder") ||
+ StringUtils::EqualsNoCase(value, "select writable folder"))
+ return CSettingString::SetValue("");
+
+ return CSettingString::SetValue(value);
+}
+
+void CSettingPath::copy(const CSettingPath &setting)
+{
+ CSettingString::Copy(setting);
+
+ m_writable = setting.m_writable;
+ m_sources = setting.m_sources;
+}
--- /dev/null
+#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 <vector>
+
+#include "Setting.h"
+
+class CSettingPath : public CSettingString
+{
+public:
+ CSettingPath(const std::string &id, CSettingsManager *settingsManager = NULL);
+ CSettingPath(const std::string &id, const CSettingPath &setting);
+ virtual ~CSettingPath() { }
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+ virtual bool SetValue(const std::string &value);
+
+ bool Writable() const { return m_writable; }
+ const std::vector<std::string>& GetSources() const { return m_sources; }
+
+private:
+ void copy(const CSettingPath &setting);
+
+ bool m_writable;
+ std::vector<std::string> m_sources;
+};
--- /dev/null
+/*
+ * 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 "SettingSection.h"
+#include "SettingsManager.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+#define XML_CATEGORY "category"
+#define XML_GROUP "group"
+
+template<class T> void addISetting(const TiXmlNode *node, const T &item, std::vector<T> &items)
+{
+ if (node == NULL)
+ return;
+
+ const TiXmlElement *element = node->ToElement();
+ if (element == NULL)
+ return;
+
+ // check if there is a "before" or "after" attribute to place the setting at a specific position
+ int position = -1; // -1 => end, 0 => before, 1 => after
+ const char *positionId = element->Attribute("before");
+ if (positionId != NULL && strlen(positionId) > 0)
+ position = 0;
+ else if ((positionId = element->Attribute("after")) != NULL && strlen(positionId) > 0)
+ position = 1;
+
+ if (positionId != NULL && strlen(positionId) > 0 && position >= 0)
+ {
+ for (typename std::vector<T>::iterator it = items.begin(); it != items.end(); it++)
+ {
+ if (!StringUtils::EqualsNoCase((*it)->GetId(), positionId))
+ continue;
+
+ typename std::vector<T>::iterator positionIt = it;
+ if (position == 1)
+ positionIt++;
+
+ items.insert(positionIt, item);
+ return;
+ }
+ }
+
+ items.push_back(item);
+}
+
+CSettingGroup::CSettingGroup(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : ISetting(id, settingsManager)
+{ }
+
+CSettingGroup::~CSettingGroup()
+{
+ for (SettingList::const_iterator setting = m_settings.begin(); setting != m_settings.end(); setting++)
+ delete *setting;
+ m_settings.clear();
+}
+
+bool CSettingGroup::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ // handle <visible> conditions
+ if (!ISetting::Deserialize(node, update))
+ return false;
+
+ const TiXmlElement *settingElement = node->FirstChildElement(XML_SETTING);
+ while (settingElement != NULL)
+ {
+ std::string settingId;
+ if (CSettingCategory::DeserializeIdentification(settingElement, settingId))
+ {
+ CSetting *setting = NULL;
+ for (SettingList::iterator itSetting = m_settings.begin(); itSetting != m_settings.end(); itSetting++)
+ {
+ if ((*itSetting)->GetId() == settingId)
+ {
+ setting = *itSetting;
+ break;
+ }
+ }
+
+ update = (setting != NULL);
+ if (!update)
+ {
+ const char* settingType = settingElement->Attribute(XML_ATTR_TYPE);
+ if (settingType == NULL || strlen(settingType) <= 0)
+ {
+ CLog::Log(LOGERROR, "CSettingGroup: unable to read setting type of \"%s\"", settingId.c_str());
+ return false;
+ }
+
+ setting = m_settingsManager->CreateSetting(settingType, settingId, m_settingsManager);
+ if (setting == NULL)
+ CLog::Log(LOGERROR, "CSettingGroup: unknown setting type \"%s\" of \"%s\"", settingType, settingId.c_str());
+ }
+
+ if (setting == NULL)
+ CLog::Log(LOGERROR, "CSettingGroup: unable to create new setting \"%s\"", settingId.c_str());
+ else if (!setting->Deserialize(settingElement, update))
+ {
+ CLog::Log(LOGWARNING, "CSettingGroup: unable to read setting \"%s\"", settingId.c_str());
+ if (!update)
+ delete setting;
+ }
+ else if (!update)
+ addISetting(settingElement, setting, m_settings);
+ }
+
+ settingElement = settingElement->NextSiblingElement(XML_SETTING);
+ }
+
+ return true;
+}
+
+SettingList CSettingGroup::GetSettings(SettingLevel level) const
+{
+ SettingList settings;
+
+ for (SettingList::const_iterator it = m_settings.begin(); it != m_settings.end(); it++)
+ {
+ if ((*it)->GetLevel() <= level && (*it)->IsVisible())
+ settings.push_back(*it);
+ }
+
+ return settings;
+}
+
+CSettingCategory::CSettingCategory(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : ISetting(id, settingsManager),
+ m_label(-1), m_help(-1),
+ m_accessCondition(settingsManager)
+{ }
+
+CSettingCategory::~CSettingCategory()
+{
+ for (SettingGroupList::const_iterator it = m_groups.begin(); it != m_groups.end(); it++)
+ delete *it;
+
+ m_groups.clear();
+}
+
+bool CSettingCategory::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ // handle <visible> conditions
+ if (!ISetting::Deserialize(node, update))
+ return false;
+
+ const TiXmlElement *element = node->ToElement();
+ if (element == NULL)
+ return false;
+
+ int tmp = -1;
+ if (element->QueryIntAttribute(XML_ATTR_LABEL, &tmp) == TIXML_SUCCESS && tmp > 0)
+ m_label = tmp;
+ if (element->QueryIntAttribute(XML_ATTR_HELP, &m_help) == TIXML_SUCCESS && m_help > 0)
+ m_help = tmp;
+
+ const TiXmlNode *accessNode = node->FirstChild("access");
+ if (accessNode != NULL && !m_accessCondition.Deserialize(accessNode))
+ return false;
+
+ const TiXmlNode *groupNode = node->FirstChildElement(XML_GROUP);
+ while (groupNode != NULL)
+ {
+ std::string groupId;
+ if (CSettingGroup::DeserializeIdentification(groupNode, groupId))
+ {
+ CSettingGroup *group = NULL;
+ for (SettingGroupList::iterator itGroup = m_groups.begin(); itGroup != m_groups.end(); itGroup++)
+ {
+ if ((*itGroup)->GetId() == groupId)
+ {
+ group = *itGroup;
+ break;
+ }
+ }
+
+ update = (group != NULL);
+ if (!update)
+ group = new CSettingGroup(groupId, m_settingsManager);
+
+ if (group->Deserialize(groupNode, update))
+ {
+ if (!update)
+ addISetting(groupNode, group, m_groups);
+ }
+ else
+ {
+ CLog::Log(LOGWARNING, "CSettingCategory: unable to read group \"%s\"", groupId.c_str());
+ if (!update)
+ delete group;
+ }
+ }
+
+ groupNode = groupNode->NextSibling(XML_GROUP);
+ }
+
+ return true;
+}
+
+SettingGroupList CSettingCategory::GetGroups(SettingLevel level) const
+{
+ SettingGroupList groups;
+
+ for (SettingGroupList::const_iterator it = m_groups.begin(); it != m_groups.end(); it++)
+ {
+ if ((*it)->IsVisible() && (*it)->GetSettings(level).size() > 0)
+ groups.push_back(*it);
+ }
+
+ return groups;
+}
+
+bool CSettingCategory::CanAccess() const
+{
+ return m_accessCondition.Check();
+}
+
+CSettingSection::CSettingSection(const std::string &id, CSettingsManager *settingsManager /* = NULL */)
+ : ISetting(id, settingsManager),
+ m_label(-1), m_help(-1)
+{ }
+
+CSettingSection::~CSettingSection()
+{
+ for (SettingCategoryList::const_iterator it = m_categories.begin(); it != m_categories.end(); it++)
+ delete *it;
+
+ m_categories.clear();
+}
+
+bool CSettingSection::Deserialize(const TiXmlNode *node, bool update /* = false */)
+{
+ // handle <visible> conditions
+ if (!ISetting::Deserialize(node, update))
+ return false;
+
+ const TiXmlElement *element = node->ToElement();
+ if (element == NULL)
+ return false;
+
+ int tmp = -1;
+ if (element->QueryIntAttribute(XML_ATTR_LABEL, &tmp) == TIXML_SUCCESS && tmp > 0)
+ m_label = tmp;
+ if (element->QueryIntAttribute(XML_ATTR_HELP, &tmp) == TIXML_SUCCESS && tmp > 0)
+ m_help = tmp;
+
+ const TiXmlNode *categoryNode = node->FirstChild(XML_CATEGORY);
+ while (categoryNode != NULL)
+ {
+ std::string categoryId;
+ if (CSettingCategory::DeserializeIdentification(categoryNode, categoryId))
+ {
+ CSettingCategory *category = NULL;
+ for (SettingCategoryList::iterator itCategory = m_categories.begin(); itCategory != m_categories.end(); itCategory++)
+ {
+ if ((*itCategory)->GetId() == categoryId)
+ {
+ category = *itCategory;
+ break;
+ }
+ }
+
+ update = (category != NULL);
+ if (!update)
+ category = new CSettingCategory(categoryId, m_settingsManager);
+
+ if (category->Deserialize(categoryNode, update))
+ {
+ if (!update)
+ addISetting(categoryNode, category, m_categories);
+ }
+ else
+ {
+ CLog::Log(LOGWARNING, "CSettingSection: unable to read category \"%s\"", categoryId.c_str());
+ if (!update)
+ delete category;
+ }
+ }
+
+ categoryNode = categoryNode->NextSibling(XML_CATEGORY);
+ }
+
+ return true;
+}
+
+SettingCategoryList CSettingSection::GetCategories(SettingLevel level) const
+{
+ SettingCategoryList categories;
+
+ for (SettingCategoryList::const_iterator it = m_categories.begin(); it != m_categories.end(); it++)
+ {
+ if ((*it)->IsVisible() && (*it)->GetGroups(level).size() > 0)
+ categories.push_back(*it);
+ }
+
+ return categories;
+}
--- /dev/null
+#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 <vector>
+
+#include "ISetting.h"
+#include "Setting.h"
+#include "SettingCategoryAccess.h"
+
+class CSettingsManager;
+
+/*!
+ \ingroup settings
+ \brief Group of settings being part of a category
+ \sa CSettingCategory
+ \sa CSetting
+ */
+class CSettingGroup : public ISetting
+{
+public:
+ CSettingGroup(const std::string &id, CSettingsManager *settingsManager = NULL);
+ ~CSettingGroup();
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ const SettingList& GetSettings() const { return m_settings; }
+ SettingList GetSettings(SettingLevel level) const;
+
+private:
+ SettingList m_settings;
+};
+
+typedef std::vector<CSettingGroup *> SettingGroupList;
+
+/*!
+ \ingroup settings
+ \brief Category of groups of settings being part of a section
+ \sa CSettingSection
+ \sa CSettingGroup
+ */
+class CSettingCategory : public ISetting
+{
+public:
+ CSettingCategory(const std::string &id, CSettingsManager *settingsManager = NULL);
+ ~CSettingCategory();
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ const int GetLabel() const { return m_label; }
+ const int GetHelp() const { return m_help; }
+ const SettingGroupList& GetGroups() const { return m_groups; }
+ SettingGroupList GetGroups(SettingLevel level) const;
+
+ bool CanAccess() const;
+
+private:
+ int m_label;
+ int m_help;
+ SettingGroupList m_groups;
+ CSettingCategoryAccess m_accessCondition;
+};
+
+typedef std::vector<CSettingCategory *> SettingCategoryList;
+
+/*!
+ \ingroup settings
+ \brief Section of setting categories
+ \sa CSettings
+ \sa CSettingCategory
+ */
+class CSettingSection : public ISetting
+{
+public:
+ CSettingSection(const std::string &id, CSettingsManager *settingsManager = NULL);
+ ~CSettingSection();
+
+ virtual bool Deserialize(const TiXmlNode *node, bool update = false);
+
+ const int GetLabel() const { return m_label; }
+ const int GetHelp() const { return m_help; }
+ const SettingCategoryList& GetCategories() const { return m_categories; }
+ SettingCategoryList GetCategories(SettingLevel level) const;
+
+private:
+ int m_label;
+ int m_help;
+ SettingCategoryList m_categories;
+};
--- /dev/null
+/*
+ * 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 "SettingUpdate.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+CSettingUpdate::CSettingUpdate()
+ : m_type(SettingUpdateTypeNone)
+{ }
+
+bool CSettingUpdate::operator<(const CSettingUpdate& rhs) const
+{
+ return m_type < rhs.m_type && m_value < rhs.m_value;
+}
+
+bool CSettingUpdate::Deserialize(const TiXmlNode *node)
+{
+ if (node == NULL)
+ return false;
+
+ const TiXmlElement *elem = node->ToElement();
+ if (elem == NULL)
+ return false;
+
+ const char *strType = elem->Attribute("type");
+ if (strType == NULL || strlen(strType) <= 0 || !setType(strType))
+ {
+ CLog::Log(LOGWARNING, "CSettingUpdate: missing or unknown update type definition");
+ return false;
+ }
+
+ if (m_type == SettingUpdateTypeRename)
+ {
+ if (node->FirstChild() == NULL || node->FirstChild()->Type() != TiXmlNode::TINYXML_TEXT)
+ {
+ CLog::Log(LOGWARNING, "CSettingUpdate: missing or invalid setting id for rename update definition");
+ return false;
+ }
+
+ m_value = node->FirstChild()->ValueStr();
+ }
+
+ return true;
+}
+
+bool CSettingUpdate::setType(const std::string &type)
+{
+ if (StringUtils::EqualsNoCase(type, "change"))
+ m_type = SettingUpdateTypeChange;
+ else if (StringUtils::EqualsNoCase(type, "rename"))
+ m_type = SettingUpdateTypeRename;
+ else
+ return false;
+
+ return true;
+}
--- /dev/null
+#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 TiXmlNode;
+
+typedef enum {
+ SettingUpdateTypeNone = 0,
+ SettingUpdateTypeRename,
+ SettingUpdateTypeChange
+} SettingUpdateType;
+
+class CSettingUpdate
+{
+public:
+ CSettingUpdate();
+ virtual ~CSettingUpdate() { }
+
+ bool operator<(const CSettingUpdate& rhs) const;
+
+ virtual bool Deserialize(const TiXmlNode *node);
+
+ SettingUpdateType GetType() const { return m_type; }
+ const std::string& GetValue() const { return m_value; }
+
+private:
+ bool setType(const std::string &type);
+
+ SettingUpdateType m_type;
+ std::string m_value;
+};
--- /dev/null
+/*
+ * 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 "SettingVisibility.h"
+#include "SettingsManager.h"
+
+bool CSettingVisibilityCondition::Check() const
+{
+ if (m_settingsManager == NULL)
+ return false;
+
+ bool found = m_settingsManager->GetConditions().Check("IsDefined", m_value);
+ if (m_negated)
+ return !found;
+
+ return found;
+}
+
+bool CSettingVisibilityConditionCombination::Check() const
+{
+ if (m_operations.empty() && m_values.empty())
+ return true;
+
+ return CSettingConditionCombination::Check();
+}
+
+CSettingVisibility::CSettingVisibility(CSettingsManager *settingsManager /* = NULL */)
+ : CSettingCondition(settingsManager)
+{
+ m_operation = CBooleanLogicOperationPtr(new CSettingVisibilityConditionCombination(m_settingsManager));
+}
--- /dev/null
+#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 <set>
+#include <string>
+
+#include "SettingConditions.h"
+
+class CSettingVisibilityCondition : public CSettingConditionItem
+{
+public:
+ CSettingVisibilityCondition(CSettingsManager *settingsManager = NULL)
+ : CSettingConditionItem(settingsManager)
+ { }
+ virtual ~CSettingVisibilityCondition() { }
+
+ virtual bool Check() const;
+};
+
+class CSettingVisibilityConditionCombination : public CSettingConditionCombination
+{
+public:
+ CSettingVisibilityConditionCombination(CSettingsManager *settingsManager = NULL)
+ : CSettingConditionCombination(settingsManager)
+ { }
+ virtual ~CSettingVisibilityConditionCombination() { }
+
+ virtual bool Check() const;
+
+private:
+ virtual CBooleanLogicOperation* newOperation() { return new CSettingVisibilityConditionCombination(m_settingsManager); }
+ virtual CBooleanLogicValue* newValue() { return new CSettingVisibilityCondition(m_settingsManager); }
+};
+
+class CSettingVisibility : public CSettingCondition
+{
+public:
+ CSettingVisibility(CSettingsManager *settingsManager = NULL);
+ virtual ~CSettingVisibility() { }
+};
*
*/
+#include "system.h"
+
#include "Settings.h"
+#include "Application.h"
+#include "Autorun.h"
+#include "GUIPassword.h"
+#include "LangInfo.h"
+#include "Util.h"
+#include "addons/AddonManager.h"
+#include "addons/Skin.h"
+#include "cores/AudioEngine/AEFactory.h"
+#if defined(HAVE_LIBCRYSTALHD)
+#include "cores/dvdplayer/DVDCodecs/Video/CrystalHD.h"
+#endif // defined(HAVE_LIBCRYSTALHD)
+#include "cores/playercorefactory/PlayerCoreFactory.h"
+#include "cores/VideoRenderers/BaseRenderer.h"
#include "filesystem/File.h"
+#include "guilib/GraphicContext.h"
+#include "guilib/GUIAudioManager.h"
+#include "guilib/GUIFontManager.h"
+#include "guilib/LocalizeStrings.h"
+#include "input/MouseStat.h"
+#if defined(TARGET_WINDOWS)
+#include "input/windows/WINJoystick.h"
+#elif defined(HAS_SDL_JOYSTICK)
+#include "input/SDLJoystick.h"
+#endif // defined(HAS_SDL_JOYSTICK)
+#if defined(TARGET_LINUX)
+#include "linux/LinuxTimezone.h"
+#endif // defined(TARGET_LINUX)
+#include "network/NetworkServices.h"
+#include "network/upnp/UPnPSettings.h"
+#if defined(TARGET_DARWIN_OSX)
+#include "osx/XBMCHelper.h"
+#include "cores/AudioEngine/Engines/CoreAudio/CoreAudioHardware.h"
+#endif // defined(TARGET_DARWIN_OSX)
+#include "peripherals/Peripherals.h"
+#include "powermanagement/PowerManager.h"
#include "profiles/ProfilesManager.h"
-#include "settings/GUISettings.h"
+#include "pvr/PVRManager.h"
+#include "pvr/windows/GUIWindowPVRGuide.h"
+#include "settings/AdvancedSettings.h"
+#include "settings/DisplaySettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/MediaSourceSettings.h"
+#include "settings/SettingAddon.h"
+#include "settings/SettingsManager.h"
+#include "settings/SettingPath.h"
+#include "settings/SkinSettings.h"
#include "threads/SingleLock.h"
+#include "utils/CharsetConverter.h"
#include "utils/log.h"
+#include "utils/RssManager.h"
+#include "utils/StringUtils.h"
+#include "utils/SystemInfo.h"
+#include "utils/Weather.h"
#include "utils/XBMCTinyXML.h"
+#include "view/ViewStateSettings.h"
+#include "windowing/WindowingFactory.h"
+
+#define SETTINGS_XML_FOLDER "special://xbmc/system/settings/"
+#define SETTINGS_XML_ROOT "settings"
-using namespace std;
using namespace XFILE;
-CSettings::CSettings(void)
+bool AddonHasSettings(const std::string &condition, const std::string &value, const std::string &settingId)
{
+ if (settingId.empty())
+ return false;
+
+ CSettingAddon *setting = (CSettingAddon*)CSettings::Get().GetSetting(settingId);
+ if (setting == NULL)
+ return false;
+
+ ADDON::AddonPtr addon;
+ if (!ADDON::CAddonMgr::Get().GetAddon(setting->GetValue(), addon, setting->GetAddonType()) || addon == NULL)
+ return false;
+
+ return addon->HasSettings();
}
-void CSettings::RegisterSettingsHandler(ISettingsHandler *settingsHandler)
+bool CheckMasterLock(const std::string &condition, const std::string &value, const std::string &settingId)
{
- if (settingsHandler == NULL)
- return;
+ return g_passwordManager.IsMasterLockUnlocked(StringUtils::EqualsNoCase(value, "true"));
+}
- CSingleLock lock(m_critical);
- m_settingsHandlers.insert(settingsHandler);
+bool CheckPVRParentalPin(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return PVR::g_PVRManager.CheckParentalPIN(g_localizeStrings.Get(19262).c_str());
}
-void CSettings::UnregisterSettingsHandler(ISettingsHandler *settingsHandler)
+bool HasPeripherals(const std::string &condition, const std::string &value, const std::string &settingId)
{
- if (settingsHandler == NULL)
- return;
+ return PERIPHERALS::g_peripherals.GetNumberOfPeripherals() > 0;
+}
- CSingleLock lock(m_critical);
- m_settingsHandlers.erase(settingsHandler);
+bool IsFullscreen(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return g_Windowing.IsFullScreen();
}
-void CSettings::RegisterSubSettings(ISubSettings *subSettings)
+bool IsMasterUser(const std::string &condition, const std::string &value, const std::string &settingId)
{
- if (subSettings == NULL)
- return;
+ return g_passwordManager.bMasterUser;
+}
- CSingleLock lock(m_critical);
- m_subSettings.insert(subSettings);
+bool IsUsingTTFSubtitles(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CUtil::IsUsingTTFSubtitles();
}
-void CSettings::UnregisterSubSettings(ISubSettings *subSettings)
+bool ProfileCanWriteDatabase(const std::string &condition, const std::string &value, const std::string &settingId)
{
- if (subSettings == NULL)
- return;
+ return CProfilesManager::Get().GetCurrentProfile().canWriteDatabases();
+}
- CSingleLock lock(m_critical);
- m_subSettings.erase(subSettings);
+bool ProfileCanWriteSources(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().canWriteSources();
}
-CSettings::~CSettings(void)
+bool ProfileHasAddons(const std::string &condition, const std::string &value, const std::string &settingId)
{
- // first clear all registered settings handler and subsettings
- // implementations because we can't be sure that they are still valid
- m_settingsHandlers.clear();
- m_subSettings.clear();
+ return CProfilesManager::Get().GetCurrentProfile().hasAddons();
+}
- Clear();
+bool ProfileHasDatabase(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().hasDatabases();
}
-void CSettings::Save() const
+bool ProfileHasSources(const std::string &condition, const std::string &value, const std::string &settingId)
{
- if (!SaveSettings(CProfilesManager::Get().GetSettingsFile()))
- CLog::Log(LOGERROR, "Unable to save settings to %s", CProfilesManager::Get().GetSettingsFile().c_str());
+ return CProfilesManager::Get().GetCurrentProfile().hasSources();
}
-bool CSettings::Reset()
+bool ProfileHasAddonManagerLocked(const std::string &condition, const std::string &value, const std::string &settingId)
{
- CLog::Log(LOGINFO, "Resetting settings");
- CFile::Delete(CProfilesManager::Get().GetSettingsFile());
- Save();
- return LoadSettings(CProfilesManager::Get().GetSettingsFile());
+ return CProfilesManager::Get().GetCurrentProfile().addonmanagerLocked();
}
-bool CSettings::Load()
+bool ProfileHasFilesLocked(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().filesLocked();
+}
+
+bool ProfileHasMusicLocked(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().musicLocked();
+}
+
+bool ProfileHasPicturesLocked(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().picturesLocked();
+}
+
+bool ProfileHasProgramsLocked(const std::string &condition, const std::string &value, const std::string &settingId)
{
- if (!OnSettingsLoading())
+ return CProfilesManager::Get().GetCurrentProfile().programsLocked();
+}
+
+bool ProfileHasSettingsLocked(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().settingsLocked();
+}
+
+bool ProfileHasVideosLocked(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ return CProfilesManager::Get().GetCurrentProfile().videoLocked();
+}
+
+bool ProfileLockMode(const std::string &condition, const std::string &value, const std::string &settingId)
+{
+ char *tmp = NULL;
+ LockType lock = (LockType)strtol(value.c_str(), &tmp, 0);
+ if (tmp != NULL && *tmp != '\0')
return false;
- CLog::Log(LOGNOTICE, "loading %s", CProfilesManager::Get().GetSettingsFile().c_str());
- if (!LoadSettings(CProfilesManager::Get().GetSettingsFile()))
- {
- CLog::Log(LOGERROR, "Unable to load %s, creating new %s with default values", CProfilesManager::Get().GetSettingsFile().c_str(), CProfilesManager::Get().GetSettingsFile().c_str());
- if (!Reset())
- return false;
- }
+ return CProfilesManager::Get().GetCurrentProfile().getLockMode() == lock;
+}
+
+CSettings::CSettings()
+ : m_initialized(false)
+{
+ m_settingsManager = new CSettingsManager();
+}
+
+CSettings::~CSettings()
+{
+ Uninitialize();
+
+ delete m_settingsManager;
+}
+
+CSettings& CSettings::Get()
+{
+ static CSettings sSettings;
+ return sSettings;
+}
+
+CSetting* CSettings::CreateSetting(const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager /* = NULL */) const
+{
+ if (StringUtils::EqualsNoCase(settingType, "addon"))
+ return new CSettingAddon(settingId, settingsManager);
+ else if (StringUtils::EqualsNoCase(settingType, "path"))
+ return new CSettingPath(settingId, settingsManager);
+
+ return NULL;
+}
+
+bool CSettings::Initialize()
+{
+ CSingleLock lock(m_critical);
+ if (m_initialized)
+ return false;
+
+ // register custom setting types
+ InitializeSettingTypes();
+
+ // option fillers and conditions need to be
+ // initialized before the setting definitions
+ InitializeOptionFillers();
+ InitializeConditions();
+
+ // load the settings definitions
+ if (!InitializeDefinitions())
+ return false;
- OnSettingsLoaded();
+ InitializeVisibility();
+ InitializeDefaults();
+ m_settingsManager->SetInitialized();
+
+ InitializeISettingsHandlers();
+ InitializeISubSettings();
+ InitializeISettingCallbacks();
+
+ m_initialized = true;
return true;
}
-bool CSettings::LoadSettings(const CStdString& strSettingsFile)
+bool CSettings::Load()
+{
+ return Load(CProfilesManager::Get().GetSettingsFile());
+}
+
+bool CSettings::Load(const std::string &file)
{
- // load the xml file
CXBMCTinyXML xmlDoc;
- if (!xmlDoc.LoadFile(strSettingsFile))
+ if (!xmlDoc.LoadFile(file))
{
- CLog::Log(LOGERROR, "%s, Line %d\n%s", strSettingsFile.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
+ CLog::Log(LOGERROR, "CSettings: error loading settings from %s, Line %d\n%s", file.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
return false;
}
- TiXmlElement *pRootElement = xmlDoc.RootElement();
- if (strcmpi(pRootElement->Value(), "settings") != 0)
+ bool updated = false;
+ TiXmlElement *root = xmlDoc.RootElement();
+ if (!m_settingsManager->Load(root, updated))
{
- CLog::Log(LOGERROR, "%s\nDoesn't contain <settings>", strSettingsFile.c_str());
+ CLog::Log(LOGERROR, "CSettingsManager: unable to load settings from %s, creating new default settings", file.c_str());
+ if (!Reset())
+ return false;
+
+ if (!Load(file))
+ return false;
+ }
+ // if the settings had to be updated, we need to save the changes
+ else if (updated)
+ return Save(file);
+
+ return true;
+}
+
+bool CSettings::Load(const TiXmlElement *root, bool hide /* = false */)
+{
+ if (root == NULL)
return false;
+
+ std::map<std::string, CSetting*> *loadedSettings = NULL;
+ if (hide)
+ loadedSettings = new std::map<std::string, CSetting*>();
+
+ bool updated;
+ // only trigger settings events if hiding is disabled
+ bool success = m_settingsManager->Load(root, updated, !hide, loadedSettings);
+ // if necessary hide all the loaded settings
+ if (success && hide && loadedSettings != NULL)
+ {
+ for(std::map<std::string, CSetting*>::const_iterator setting = loadedSettings->begin(); setting != loadedSettings->end(); setting++)
+ setting->second->SetVisible(false);
+
+ delete loadedSettings;
}
- g_guiSettings.LoadXML(pRootElement);
-
- // load any ISubSettings implementations
- return Load(pRootElement);
+ return success;
+}
+
+void CSettings::SetLoaded()
+{
+ m_settingsManager->SetLoaded();
}
-bool CSettings::SaveSettings(const CStdString& strSettingsFile, CGUISettings *localSettings /* = NULL */) const
+bool CSettings::Save()
+{
+ return Save(CProfilesManager::Get().GetSettingsFile());
+}
+
+bool CSettings::Save(const std::string &file)
{
CXBMCTinyXML xmlDoc;
- TiXmlElement xmlRootElement("settings");
- TiXmlNode *pRoot = xmlDoc.InsertEndChild(xmlRootElement);
- if (!pRoot) return false;
- // write our tags one by one - just a big list for now (can be flashed up later)
+ TiXmlElement rootElement(SETTINGS_XML_ROOT);
+ TiXmlNode *root = xmlDoc.InsertEndChild(rootElement);
+ if (root == NULL)
+ return false;
- if (!OnSettingsSaving())
+ if (!m_settingsManager->Save(root))
return false;
- if (localSettings) // local settings to save
- localSettings->SaveXML(pRoot);
- else // save the global settings
- g_guiSettings.SaveXML(pRoot);
+ return xmlDoc.SaveFile(file);
+}
- OnSettingsSaved();
-
- if (!Save(pRoot))
- return false;
+void CSettings::Unload()
+{
+ CSingleLock lock(m_critical);
+ m_settingsManager->Unload();
+}
+
+void CSettings::Uninitialize()
+{
+ CSingleLock lock(m_critical);
+ if (!m_initialized)
+ return;
+
+ // unregister setting option fillers
+ m_settingsManager->UnregisterSettingOptionsFiller("audiocdactions");
+ m_settingsManager->UnregisterSettingOptionsFiller("audiocdencoders");
+ m_settingsManager->UnregisterSettingOptionsFiller("audiodevices");
+ m_settingsManager->UnregisterSettingOptionsFiller("audiodevicespassthrough");
+ m_settingsManager->UnregisterSettingOptionsFiller("audiooutputmodes");
+ m_settingsManager->UnregisterSettingOptionsFiller("charsets");
+ m_settingsManager->UnregisterSettingOptionsFiller("epgguideviews");
+ m_settingsManager->UnregisterSettingOptionsFiller("fontheights");
+ m_settingsManager->UnregisterSettingOptionsFiller("fonts");
+ m_settingsManager->UnregisterSettingOptionsFiller("languages");
+ m_settingsManager->UnregisterSettingOptionsFiller("pvrstartlastchannel");
+ m_settingsManager->UnregisterSettingOptionsFiller("refreshchangedelays");
+ m_settingsManager->UnregisterSettingOptionsFiller("refreshrates");
+ m_settingsManager->UnregisterSettingOptionsFiller("regions");
+ m_settingsManager->UnregisterSettingOptionsFiller("rendermethods");
+ m_settingsManager->UnregisterSettingOptionsFiller("resolutions");
+ m_settingsManager->UnregisterSettingOptionsFiller("screens");
+ m_settingsManager->UnregisterSettingOptionsFiller("shutdownstates");
+ m_settingsManager->UnregisterSettingOptionsFiller("startupwindows");
+ m_settingsManager->UnregisterSettingOptionsFiller("streamlanguages");
+ m_settingsManager->UnregisterSettingOptionsFiller("skincolors");
+ m_settingsManager->UnregisterSettingOptionsFiller("skinfonts");
+ m_settingsManager->UnregisterSettingOptionsFiller("skinsounds");
+ m_settingsManager->UnregisterSettingOptionsFiller("skinthemes");
+#if defined(TARGET_LINUX)
+ m_settingsManager->UnregisterSettingOptionsFiller("timezonecountries");
+ m_settingsManager->UnregisterSettingOptionsFiller("timezones");
+#endif // defined(TARGET_LINUX)
+ m_settingsManager->UnregisterSettingOptionsFiller("verticalsyncs");
+
+ // unregister ISettingCallback implementations
+ m_settingsManager->UnregisterCallback(&g_advancedSettings);
+ m_settingsManager->UnregisterCallback(&CMediaSettings::Get());
+ m_settingsManager->UnregisterCallback(&CDisplaySettings::Get());
+ m_settingsManager->UnregisterCallback(&g_application);
+ m_settingsManager->UnregisterCallback(&g_audioManager);
+ m_settingsManager->UnregisterCallback(&g_charsetConverter);
+ m_settingsManager->UnregisterCallback(&g_graphicsContext);
+ m_settingsManager->UnregisterCallback(&g_langInfo);
+#if defined(TARGET_WINDOWS) || defined(HAS_SDL_JOYSTICK)
+ m_settingsManager->UnregisterCallback(&g_Joystick);
+#endif
+ m_settingsManager->UnregisterCallback(&g_Mouse);
+ m_settingsManager->UnregisterCallback(&CNetworkServices::Get());
+ m_settingsManager->UnregisterCallback(&g_passwordManager);
+ m_settingsManager->UnregisterCallback(&PVR::g_PVRManager);
+ m_settingsManager->UnregisterCallback(&CRssManager::Get());
+#if defined(TARGET_LINUX)
+ m_settingsManager->UnregisterCallback(&g_timezone);
+#endif // defined(TARGET_LINUX)
+ m_settingsManager->UnregisterCallback(&g_weatherManager);
+ m_settingsManager->UnregisterCallback(&PERIPHERALS::CPeripherals::Get());
+
+ // unregister ISubSettings implementations
+ m_settingsManager->UnregisterSubSettings(&g_application);
+ m_settingsManager->UnregisterSubSettings(&CDisplaySettings::Get());
+ m_settingsManager->UnregisterSubSettings(&CMediaSettings::Get());
+ m_settingsManager->UnregisterSubSettings(&CSkinSettings::Get());
+ m_settingsManager->UnregisterSubSettings(&g_sysinfo);
+ m_settingsManager->UnregisterSubSettings(&CViewStateSettings::Get());
+
+ // unregister ISettingsHandler implementations
+ m_settingsManager->UnregisterSettingsHandler(&g_advancedSettings);
+ m_settingsManager->UnregisterSettingsHandler(&CMediaSourceSettings::Get());
+ m_settingsManager->UnregisterSettingsHandler(&CPlayerCoreFactory::Get());
+ m_settingsManager->UnregisterSettingsHandler(&CRssManager::Get());
+#ifdef HAS_UPNP
+ m_settingsManager->UnregisterSettingsHandler(&CUPnPSettings::Get());
+#endif
+ m_settingsManager->UnregisterSettingsHandler(&CProfilesManager::Get());
+ m_settingsManager->UnregisterSettingsHandler(&g_application);
+
+ // cleanup the settings manager
+ m_settingsManager->Clear();
+
+ m_initialized = false;
+}
+
+void CSettings::RegisterCallback(ISettingCallback *callback, const std::set<std::string> &settingList)
+{
+ m_settingsManager->RegisterCallback(callback, settingList);
+}
- // save the file
- return xmlDoc.SaveFile(strSettingsFile);
+void CSettings::UnregisterCallback(ISettingCallback *callback)
+{
+ m_settingsManager->UnregisterCallback(callback);
}
-void CSettings::Clear()
+CSetting* CSettings::GetSetting(const std::string &id) const
{
- OnSettingsCleared();
+ CSingleLock lock(m_critical);
+ if (id.empty())
+ return NULL;
- for (SubSettings::const_iterator it = m_subSettings.begin(); it != m_subSettings.end(); it++)
- (*it)->Clear();
+ return m_settingsManager->GetSetting(id);
}
-bool CSettings::OnSettingsLoading()
+CSettingSection* CSettings::GetSection(const std::string §ion) const
{
CSingleLock lock(m_critical);
- for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ if (section.empty())
+ return NULL;
+
+ return m_settingsManager->GetSection(section);
+}
+
+SettingDependencyMap CSettings::GetDependencies(const std::string &id) const
+{
+ return m_settingsManager->GetDependencies(id);
+}
+
+SettingDependencyMap CSettings::GetDependencies(const CSetting *setting) const
+{
+ return m_settingsManager->GetDependencies(setting);
+}
+
+void* CSettings::GetSettingOptionsFiller(const CSetting *setting)
+{
+ return m_settingsManager->GetSettingOptionsFiller(setting);
+}
+
+bool CSettings::GetBool(const std::string &id) const
+{
+ return m_settingsManager->GetBool(id);
+}
+
+bool CSettings::SetBool(const std::string &id, bool value)
+{
+ return m_settingsManager->SetBool(id, value);
+}
+
+bool CSettings::ToggleBool(const std::string &id)
+{
+ return m_settingsManager->ToggleBool(id);
+}
+
+int CSettings::GetInt(const std::string &id) const
+{
+ return m_settingsManager->GetInt(id);
+}
+
+bool CSettings::SetInt(const std::string &id, int value)
+{
+ return m_settingsManager->SetInt(id, value);
+}
+
+double CSettings::GetNumber(const std::string &id) const
+{
+ return m_settingsManager->GetNumber(id);
+}
+
+bool CSettings::SetNumber(const std::string &id, double value)
+{
+ return m_settingsManager->SetNumber(id, value);
+}
+
+std::string CSettings::GetString(const std::string &id) const
+{
+ return m_settingsManager->GetString(id);
+}
+
+bool CSettings::SetString(const std::string &id, const std::string &value)
+{
+ return m_settingsManager->SetString(id, value);
+}
+
+bool CSettings::LoadSetting(const TiXmlNode *node, const std::string &settingId)
+{
+ return m_settingsManager->LoadSetting(node, settingId);
+}
+
+bool CSettings::Initialize(const std::string &file)
+{
+ CXBMCTinyXML xmlDoc;
+ if (!xmlDoc.LoadFile(file.c_str()))
{
- if (!(*it)->OnSettingsLoading())
- return false;
+ CLog::Log(LOGERROR, "CSettings: error loading settings definition from %s, Line %d\n%s", file.c_str(), xmlDoc.ErrorRow(), xmlDoc.ErrorDesc());
+ return false;
+ }
+
+ TiXmlElement *root = xmlDoc.RootElement();
+ if (root == NULL)
+ return false;
+
+ return m_settingsManager->Initialize(root);
+}
+
+bool CSettings::InitializeDefinitions()
+{
+ if (!Initialize(SETTINGS_XML_FOLDER "settings.xml"))
+ {
+ CLog::Log(LOGFATAL, "Unable to load settings definitions");
+ return false;
}
+#if defined(TARGET_WINDOWS)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "win32.xml") && !Initialize(SETTINGS_XML_FOLDER "win32.xml"))
+ CLog::Log(LOGFATAL, "Unable to load win32-specific settings definitions");
+#elif defined(TARGET_LINUX)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "linux.xml") && !Initialize(SETTINGS_XML_FOLDER "linux.xml"))
+ CLog::Log(LOGFATAL, "Unable to load linux-specific settings definitions");
+#if defined(TARGET_DARWIN)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "darwin.xml") && !Initialize(SETTINGS_XML_FOLDER "darwin.xml"))
+ CLog::Log(LOGFATAL, "Unable to load darwin-specific settings definitions");
+#if defined(TARGET_DARWIN_OSX)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "darwin_osx.xml") && !Initialize(SETTINGS_XML_FOLDER "darwin_osx.xml"))
+ CLog::Log(LOGFATAL, "Unable to load osx-specific settings definitions");
+#elif defined(TARGET_DARWIN_IOS)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "darwin_ios.xml") && !Initialize(SETTINGS_XML_FOLDER "darwin_ios.xml"))
+ CLog::Log(LOGFATAL, "Unable to load ios-specific settings definitions");
+#if defined(TARGET_DARWIN_IOS_ATV2)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "darwin_ios_atv2.xml") && !Initialize(SETTINGS_XML_FOLDER "darwin_ios_atv2.xml"))
+ CLog::Log(LOGFATAL, "Unable to load atv2-specific settings definitions");
+#endif
+#endif
+#elif defined(TARGET_ANDROID)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "android.xml") && !Initialize(SETTINGS_XML_FOLDER "android.xml"))
+ CLog::Log(LOGFATAL, "Unable to load android-specific settings definitions");
+#elif defined(TARGET_RASPBERRY_PI)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "rbp.xml") && !Initialize(SETTINGS_XML_FOLDER "rbp.xml"))
+ CLog::Log(LOGFATAL, "Unable to load rbp-specific settings definitions");
+#elif defined(TARGET_FREEBSD)
+ if (CFile::Exists(SETTINGS_XML_FOLDER "freebsd.xml") && !Initialize(SETTINGS_XML_FOLDER "freebsd.xml"))
+ CLog::Log(LOGFATAL, "Unable to load freebsd-specific settings definitions");
+#endif
+#endif
+ if (CFile::Exists(SETTINGS_XML_FOLDER "appliance.xml") && !Initialize(SETTINGS_XML_FOLDER "appliance.xml"))
+ CLog::Log(LOGFATAL, "Unable to load appliance-specific settings definitions");
return true;
}
-void CSettings::OnSettingsLoaded()
+void CSettings::InitializeSettingTypes()
{
- CSingleLock lock(m_critical);
- for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
- (*it)->OnSettingsLoaded();
+ // register "addon" and "path" setting types implemented by CSettingAddon
+ m_settingsManager->RegisterSettingType("addon", this);
+ m_settingsManager->RegisterSettingType("path", this);
}
-bool CSettings::OnSettingsSaving() const
+void CSettings::InitializeVisibility()
{
- CSingleLock lock(m_critical);
- for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ // hide some settings if necessary
+#if defined(TARGET_LINUX)
+ CSettingString* timezonecountry = (CSettingString*)m_settingsManager->GetSetting("locale.timezonecountry");
+ CSettingString* timezone = (CSettingString*)m_settingsManager->GetSetting("locale.timezone");
+ #if defined(TARGET_DARWIN)
+ if (!g_sysinfo.IsAppleTV2() || GetIOSVersion() >= 4.3)
{
- if (!(*it)->OnSettingsSaving())
- return false;
+ timezonecountry->SetVisible(false);
+ timezone->SetVisible(false);
}
+ #endif
- return true;
+ if (timezonecountry->IsVisible())
+ timezonecountry->SetDefault(g_timezone.GetCountryByTimezone(g_timezone.GetOSConfiguredTimezone()));
+ if (timezone->IsVisible())
+ timezone->SetDefault(g_timezone.GetOSConfiguredTimezone());
+#endif
}
-void CSettings::OnSettingsSaved() const
+void CSettings::InitializeDefaults()
{
- CSingleLock lock(m_critical);
- for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
- (*it)->OnSettingsSaved();
+ // set some default values if necessary
+#if defined(HAS_SKIN_TOUCHED) && defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
+ ((CSettingAddon*)m_settingsManager->GetSetting("lookandfeel.skin"))->SetDefault("skin.touched");
+#endif
+
+#if defined(TARGET_WINDOWS)
+ #if defined(HAS_DX)
+ ((CSettingString*)m_settingsManager->GetSetting("musicplayer.visualisation"))->SetDefault("visualization.milkdrop");
+ #endif
+
+ #if !defined(HAS_GL)
+ // We prefer a fake fullscreen mode (window covering the screen rather than dedicated fullscreen)
+ // as it works nicer with switching to other applications. However on some systems vsync is broken
+ // when we do this (eg non-Aero on ATI in particular) and on others (AppleTV) we can't get XBMC to
+ // the front
+ if (g_sysinfo.IsAeroDisabled())
+ ((CSettingBool*)m_settingsManager->GetSetting("videoscreen.fakefullscreen"))->SetDefault(false);
+ #endif
+#endif
+
+#if defined(TARGET_DARWIN)
+ #if !defined(TARGET_DARWIN_IOS)
+ CStdString defaultAudioDeviceName;
+ CCoreAudioHardware::GetOutputDeviceName(defaultAudioDeviceName);
+ ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(defaultAudioDeviceName);
+ ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(defaultAudioDeviceName);
+ #endif
+#else
+ ((CSettingString*)m_settingsManager->GetSetting("audiooutput.audiodevice"))->SetDefault(CAEFactory::GetDefaultDevice(false));
+ ((CSettingString*)m_settingsManager->GetSetting("audiooutput.passthroughdevice"))->SetDefault(CAEFactory::GetDefaultDevice(true));
+#endif
+
+ if (g_application.IsStandAlone())
+ ((CSettingInt*)m_settingsManager->GetSetting("powermanagement.shutdownstate"))->SetDefault(POWERSTATE_SHUTDOWN);
+
+#if defined(HAS_WEB_SERVER)
+ if (CUtil::CanBindPrivileged())
+ ((CSettingInt*)m_settingsManager->GetSetting("services.webserverport"))->SetDefault(80);
+#endif
}
-void CSettings::OnSettingsCleared()
+void CSettings::InitializeOptionFillers()
{
- CSingleLock lock(m_critical);
- for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
- (*it)->OnSettingsCleared();
+ // register setting option fillers
+#ifdef HAS_DVD_DRIVE
+ m_settingsManager->RegisterSettingOptionsFiller("audiocdactions", MEDIA_DETECT::CAutorun::SettingOptionAudioCdActionsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("audiocdencoders", MEDIA_DETECT::CAutorun::SettingOptionAudioCdEncodersFiller);
+#endif
+ m_settingsManager->RegisterSettingOptionsFiller("audiodevices", CAEFactory::SettingOptionsAudioDevicesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("audiodevicespassthrough", CAEFactory::SettingOptionsAudioDevicesPassthroughFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("audiooutputmodes", CAEFactory::SettingOptionsAudioOutputModesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("charsets", CCharsetConverter::SettingOptionsCharsetsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("epgguideviews", PVR::CGUIWindowPVRGuide::SettingOptionsEpgGuideViewFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("fonts", GUIFontManager::SettingOptionsFontsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("languages", CLangInfo::SettingOptionsLanguagesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("pvrstartlastchannel", PVR::CPVRManager::SettingOptionsPvrStartLastChannelFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("refreshchangedelays", CDisplaySettings::SettingOptionsRefreshChangeDelaysFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("refreshrates", CDisplaySettings::SettingOptionsRefreshRatesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("regions", CLangInfo::SettingOptionsRegionsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("rendermethods", CBaseRenderer::SettingOptionsRenderMethodsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("resolutions", CDisplaySettings::SettingOptionsResolutionsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("screens", CDisplaySettings::SettingOptionsScreensFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("shutdownstates", CPowerManager::SettingOptionsShutdownStatesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("startupwindows", ADDON::CSkinInfo::SettingOptionsStartupWindowsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("streamlanguages", CLangInfo::SettingOptionsStreamLanguagesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("skincolors", ADDON::CSkinInfo::SettingOptionsSkinColorsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("skinfonts", ADDON::CSkinInfo::SettingOptionsSkinFontsFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("skinsounds", ADDON::CSkinInfo::SettingOptionsSkinSoundFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("skinthemes", ADDON::CSkinInfo::SettingOptionsSkinThemesFiller);
+#ifdef TARGET_LINUX
+ m_settingsManager->RegisterSettingOptionsFiller("timezonecountries", CLinuxTimezone::SettingOptionsTimezoneCountriesFiller);
+ m_settingsManager->RegisterSettingOptionsFiller("timezones", CLinuxTimezone::SettingOptionsTimezonesFiller);
+#endif
+ m_settingsManager->RegisterSettingOptionsFiller("verticalsyncs", CDisplaySettings::SettingOptionsVerticalSyncsFiller);
+}
+
+void CSettings::InitializeConditions()
+{
+ // add basic conditions
+ m_settingsManager->AddCondition("true");
+#ifdef HAS_AIRPLAY
+ m_settingsManager->AddCondition("has_airplay");
+#endif
+#ifdef HAS_EVENT_SERVER
+ m_settingsManager->AddCondition("has_event_server");
+#endif
+#ifdef HAS_GL
+ m_settingsManager->AddCondition("has_gl");
+#endif
+#ifdef HAS_GLES
+ m_settingsManager->AddCondition("has_gles");
+#endif
+#if HAS_GLES == 2
+ m_settingsManager->AddCondition("has_glesv2");
+#endif
+#ifdef HAS_KARAOKE
+ m_settingsManager->AddCondition("has_karaoke");
+#endif
+#ifdef HAS_SDL_JOYSTICK
+ m_settingsManager->AddCondition("has_sdl_joystick");
+#endif
+#ifdef HAS_SKIN_TOUCHED
+ m_settingsManager->AddCondition("has_skin_touched");
+#endif
+#ifdef HAS_TIME_SERVER
+ m_settingsManager->AddCondition("has_time_server");
+#endif
+#ifdef HAS_WEB_SERVER
+ m_settingsManager->AddCondition("has_web_server");
+#endif
+#ifdef HAS_ZEROCONF
+ m_settingsManager->AddCondition("has_zeroconf");
+#endif
+#ifdef HAVE_LIBCRYSTALHD
+ m_settingsManager->AddCondition("have_libcrystalhd");
+ if (CCrystalHD::GetInstance()->DevicePresent())
+ m_settingsManager->AddCondition("hascrystalhddevice");
+#endif
+#ifdef HAVE_LIBOPENMAX
+ m_settingsManager->AddCondition("have_libopenmax");
+#endif
+#ifdef HAVE_LIBVA
+ m_settingsManager->AddCondition("have_libva");
+#endif
+#ifdef HAVE_LIBVDADECODER
+ m_settingsManager->AddCondition("have_libvdadecoder");
+ if (g_sysinfo.HasVDADecoder())
+ m_settingsManager->AddCondition("hasvdadecoder");
+#endif
+#ifdef HAVE_LIBVDPAU
+ m_settingsManager->AddCondition("have_libvdpau");
+#endif
+#ifdef HAVE_VIDEOTOOLBOXDECODER
+ m_settingsManager->AddCondition("have_videotoolboxdecoder");
+ if (g_sysinfo.HasVideoToolBoxDecoder())
+ m_settingsManager->AddCondition("hasvideotoolboxdecoder");
+#endif
+#ifdef TARGET_DARWIN_IOS_ATV
+ if (g_sysinfo.IsAppleTV2())
+ m_settingsManager->AddCondition("isappletv2");
+#endif
+#if defined(TARGET_WINDOWS) && defined(HAS_DX)
+ m_settingsManager->AddCondition("has_dx");
+ if (g_sysinfo.IsVistaOrHigher())
+ m_settingsManager->AddCondition("hasdxva2");
+#endif
+
+ if (g_application.IsStandAlone())
+ m_settingsManager->AddCondition("isstandalone");
+
+ // add more complex conditions
+ m_settingsManager->AddCondition("addonhassettings", AddonHasSettings);
+ m_settingsManager->AddCondition("checkmasterlock", CheckMasterLock);
+ m_settingsManager->AddCondition("checkpvrparentalpin", CheckPVRParentalPin);
+ m_settingsManager->AddCondition("hasperipherals", HasPeripherals);
+ m_settingsManager->AddCondition("isfullscreen", IsFullscreen);
+ m_settingsManager->AddCondition("ismasteruser", IsMasterUser);
+ m_settingsManager->AddCondition("isusingttfsubtitles", IsUsingTTFSubtitles);
+ m_settingsManager->AddCondition("profilecanwritedatabase", ProfileCanWriteDatabase);
+ m_settingsManager->AddCondition("profilecanwritesources", ProfileCanWriteSources);
+ m_settingsManager->AddCondition("profilehasaddons", ProfileHasAddons);
+ m_settingsManager->AddCondition("profilehasdatabase", ProfileHasDatabase);
+ m_settingsManager->AddCondition("profilehassources", ProfileHasSources);
+ m_settingsManager->AddCondition("profilehasaddonmanagerlocked", ProfileHasAddonManagerLocked);
+ m_settingsManager->AddCondition("profilehasfileslocked", ProfileHasFilesLocked);
+ m_settingsManager->AddCondition("profilehasmusiclocked", ProfileHasMusicLocked);
+ m_settingsManager->AddCondition("profilehaspictureslocked", ProfileHasPicturesLocked);
+ m_settingsManager->AddCondition("profilehasprogramslocked", ProfileHasProgramsLocked);
+ m_settingsManager->AddCondition("profilehassettingslocked", ProfileHasSettingsLocked);
+ m_settingsManager->AddCondition("profilehasvideoslocked", ProfileHasVideosLocked);
+ m_settingsManager->AddCondition("profilelockmode", ProfileLockMode);
}
-bool CSettings::Load(const TiXmlNode *settings)
+void CSettings::InitializeISettingsHandlers()
{
- bool ok = true;
- for (SubSettings::const_iterator it = m_subSettings.begin(); it != m_subSettings.end(); it++)
- ok &= (*it)->Load(settings);
+ // register ISettingsHandler implementations
+ m_settingsManager->RegisterSettingsHandler(&g_application);
+ m_settingsManager->RegisterSettingsHandler(&CProfilesManager::Get());
+ m_settingsManager->RegisterSettingsHandler(&g_advancedSettings);
+ m_settingsManager->RegisterSettingsHandler(&CMediaSourceSettings::Get());
+ m_settingsManager->RegisterSettingsHandler(&CPlayerCoreFactory::Get());
+ m_settingsManager->RegisterSettingsHandler(&CRssManager::Get());
+#ifdef HAS_UPNP
+ m_settingsManager->RegisterSettingsHandler(&CUPnPSettings::Get());
+#endif
+}
- return ok;
+void CSettings::InitializeISubSettings()
+{
+ // register ISubSettings implementations
+ m_settingsManager->RegisterSubSettings(&g_application);
+ m_settingsManager->RegisterSubSettings(&CDisplaySettings::Get());
+ m_settingsManager->RegisterSubSettings(&CMediaSettings::Get());
+ m_settingsManager->RegisterSubSettings(&CSkinSettings::Get());
+ m_settingsManager->RegisterSubSettings(&g_sysinfo);
+ m_settingsManager->RegisterSubSettings(&CViewStateSettings::Get());
}
-bool CSettings::Save(TiXmlNode *settings) const
+void CSettings::InitializeISettingCallbacks()
{
- CSingleLock lock(m_critical);
- for (SubSettings::const_iterator it = m_subSettings.begin(); it != m_subSettings.end(); it++)
+ // register any ISettingCallback implementations
+ std::set<std::string> settingSet;
+ settingSet.insert("debug.showloginfo");
+ m_settingsManager->RegisterCallback(&g_advancedSettings, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("karaoke.export");
+ settingSet.insert("karaoke.importcsv");
+ settingSet.insert("musiclibrary.cleanup");
+ settingSet.insert("musiclibrary.export");
+ settingSet.insert("musiclibrary.import");
+ settingSet.insert("musicfiles.trackformat");
+ settingSet.insert("musicfiles.trackformatright");
+ settingSet.insert("videolibrary.flattentvshows");
+ settingSet.insert("videolibrary.removeduplicates");
+ settingSet.insert("videolibrary.groupmoviesets");
+ settingSet.insert("videolibrary.cleanup");
+ settingSet.insert("videolibrary.import");
+ settingSet.insert("videolibrary.export");
+ m_settingsManager->RegisterCallback(&CMediaSettings::Get(), settingSet);
+
+ settingSet.clear();
+ settingSet.insert("videoscreen.screen");
+ settingSet.insert("videoscreen.resolution");
+ settingSet.insert("videoscreen.screenmode");
+ m_settingsManager->RegisterCallback(&CDisplaySettings::Get(), settingSet);
+
+ settingSet.clear();
+ settingSet.insert("audiooutput.channels");
+ settingSet.insert("audiooutput.guisoundmode");
+ settingSet.insert("lookandfeel.skin");
+ settingSet.insert("lookandfeel.skinsettings");
+ settingSet.insert("lookandfeel.font");
+ settingSet.insert("lookandfeel.skintheme");
+ settingSet.insert("lookandfeel.skincolors");
+ settingSet.insert("lookandfeel.skinzoom");
+ settingSet.insert("musicplayer.replaygainpreamp");
+ settingSet.insert("musicplayer.replaygainnogainpreamp");
+ settingSet.insert("musicplayer.replaygaintype");
+ settingSet.insert("musicplayer.replaygainavoidclipping");
+ settingSet.insert("scrapers.musicvideosdefault");
+ settingSet.insert("screensaver.mode");
+ settingSet.insert("screensaver.preview");
+ settingSet.insert("screensaver.settings");
+ settingSet.insert("videoscreen.guicalibration");
+ settingSet.insert("videoscreen.testpattern");
+ m_settingsManager->RegisterCallback(&g_application, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("lookandfeel.soundskin");
+ m_settingsManager->RegisterCallback(&g_audioManager, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("subtitles.charset");
+ settingSet.insert("karaoke.charset");
+ settingSet.insert("locale.charset");
+ m_settingsManager->RegisterCallback(&g_charsetConverter, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("videoscreen.fakefullscreen");
+ m_settingsManager->RegisterCallback(&g_graphicsContext, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("locale.audiolanguage");
+ settingSet.insert("locale.subtitlelanguage");
+ settingSet.insert("locale.language");
+ settingSet.insert("locale.country");
+ m_settingsManager->RegisterCallback(&g_langInfo, settingSet);
+
+#if defined(HAS_SDL_JOYSTICK)
+ settingSet.clear();
+ settingSet.insert("input.enablejoystick");
+ m_settingsManager->RegisterCallback(&g_Joystick, settingSet);
+#endif
+
+ settingSet.clear();
+ settingSet.insert("input.enablemouse");
+ m_settingsManager->RegisterCallback(&g_Mouse, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("services.webserver");
+ settingSet.insert("services.webserverport");
+ settingSet.insert("services.webserverusername");
+ settingSet.insert("services.webserverpassword");
+ settingSet.insert("services.zeroconf");
+ settingSet.insert("services.airplay");
+ settingSet.insert("services.useairplaypassword");
+ settingSet.insert("services.airplaypassword");
+ settingSet.insert("services.upnpserver");
+ settingSet.insert("services.upnprenderer");
+ settingSet.insert("services.upnpcontroller");
+ settingSet.insert("services.esenabled");
+ settingSet.insert("services.esport");
+ settingSet.insert("services.esallinterfaces");
+ settingSet.insert("services.esinitialdelay");
+ settingSet.insert("services.escontinuousdelay");
+ settingSet.insert("smb.winsserver");
+ settingSet.insert("smb.workgroup");
+ m_settingsManager->RegisterCallback(&CNetworkServices::Get(), settingSet);
+
+ settingSet.clear();
+ settingSet.insert("masterlock.lockcode");
+ m_settingsManager->RegisterCallback(&g_passwordManager, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("pvrmanager.enabled");
+ settingSet.insert("pvrmanager.channelmanager");
+ settingSet.insert("pvrmanager.channelscan");
+ settingSet.insert("pvrmanager.resetdb");
+ settingSet.insert("pvrclient.menuhook");
+ settingSet.insert("pvrmenu.searchicons");
+ settingSet.insert("epg.resetepg");
+ settingSet.insert("pvrparental.enabled");
+ m_settingsManager->RegisterCallback(&PVR::g_PVRManager, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("lookandfeel.rssedit");
+ m_settingsManager->RegisterCallback(&CRssManager::Get(), settingSet);
+
+#if defined(TARGET_LINUX)
+ settingSet.clear();
+ settingSet.insert("locale.timezone");
+ settingSet.insert("locale.timezonecountry");
+ m_settingsManager->RegisterCallback(&g_timezone, settingSet);
+#endif
+
+ settingSet.clear();
+ settingSet.insert("weather.addon");
+ settingSet.insert("weather.addonsettings");
+ m_settingsManager->RegisterCallback(&g_weatherManager, settingSet);
+
+ settingSet.clear();
+ settingSet.insert("input.peripherals");
+ settingSet.insert("locale.language");
+ m_settingsManager->RegisterCallback(&PERIPHERALS::CPeripherals::Get(), settingSet);
+
+#if defined(TARGET_DARWIN_OSX)
+ settingSet.clear();
+ settingSet.insert("input.appleremotemode");
+ m_settingsManager->RegisterCallback(&XBMCHelper::GetInstance(), settingSet);
+#endif
+}
+
+bool CSettings::Reset()
+{
+ std::string settingsFile = CProfilesManager::Get().GetSettingsFile();
+ // try to delete the settings file
+ if (XFILE::CFile::Exists(settingsFile, false) && !XFILE::CFile::Delete(settingsFile))
+ CLog::Log(LOGWARNING, "Unable to delete old settings file at %s", settingsFile.c_str());
+
+ // unload any loaded settings
+ Unload();
+
+ // try to save the default settings
+ if (!Save())
{
- if (!(*it)->Save(settings))
- return false;
+ CLog::Log(LOGWARNING, "Failed to save the default settings to %s", settingsFile.c_str());
+ return false;
}
return true;
*/
#include <set>
+#include <string>
-#define PRE_SKIN_VERSION_9_10_COMPATIBILITY 1
-#define PRE_SKIN_VERSION_11_COMPATIBILITY 1
-
-#include "settings/ISettingsHandler.h"
-#include "settings/ISubSettings.h"
+#include "settings/ISettingCallback.h"
+#include "settings/ISettingCreator.h"
+#include "settings/Setting.h"
#include "threads/CriticalSection.h"
-#include "utils/StdString.h"
-class CGUISettings;
+class CSettingSection;
+class CSettingsManager;
class TiXmlElement;
class TiXmlNode;
-class CSettings : private ISettingsHandler, ISubSettings
+class CSettings : public ISettingCreator
{
public:
- CSettings(void);
- virtual ~CSettings(void);
+ CSettings();
+ virtual ~CSettings();
+
+ static CSettings& Get();
- void RegisterSettingsHandler(ISettingsHandler *settingsHandler);
- void UnregisterSettingsHandler(ISettingsHandler *settingsHandler);
- void RegisterSubSettings(ISubSettings *subSettings);
- void UnregisterSubSettings(ISubSettings *subSettings);
+ // implementation of ISettingCreator
+ virtual CSetting* CreateSetting(const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager = NULL) const;
+ bool Initialize();
bool Load();
- void Save() const;
- bool SaveSettings(const CStdString& strSettingsFile, CGUISettings *localSettings = NULL) const;
- bool Reset();
- void Clear();
+ bool Load(const std::string &file);
+ bool Load(const TiXmlElement *root, bool hide = false);
+ void SetLoaded();
+ bool Save();
+ bool Save(const std::string &file);
+ void Unload();
+ void Uninitialize();
-protected:
- bool LoadSettings(const CStdString& strSettingsFile);
+ void RegisterCallback(ISettingCallback *callback, const std::set<std::string> &settingList);
+ void UnregisterCallback(ISettingCallback *callback);
-private:
- // implementation of ISettingsHandler
- virtual bool OnSettingsLoading();
- virtual void OnSettingsLoaded();
- virtual bool OnSettingsSaving() const;
- virtual void OnSettingsSaved() const;
- virtual void OnSettingsCleared();
+ CSetting* GetSetting(const std::string &id) const;
+ CSettingSection* GetSection(const std::string §ion) const;
+ SettingDependencyMap GetDependencies(const std::string &id) const;
+ SettingDependencyMap GetDependencies(const CSetting *setting) const;
+ void* GetSettingOptionsFiller(const CSetting *setting);
+
+ bool GetBool(const std::string &id) const;
+ int GetInt(const std::string &id) const;
+ double GetNumber(const std::string &id) const;
+ std::string GetString(const std::string &id) const;
+
+ bool SetBool(const std::string &id, bool value);
+ bool ToggleBool(const std::string &id);
+ bool SetInt(const std::string &id, int value);
+ bool SetNumber(const std::string &id, double value);
+ bool SetString(const std::string &id, const std::string &value);
- // implementation of ISubSettings
- virtual bool Load(const TiXmlNode *settings);
- virtual bool Save(TiXmlNode *settings) const;
+ bool LoadSetting(const TiXmlNode *node, const std::string &settingId);
+private:
+ CSettings(const CSettings&);
+ CSettings const& operator=(CSettings const&);
+
+ bool Initialize(const std::string &file);
+ bool InitializeDefinitions();
+ void InitializeSettingTypes();
+ void InitializeVisibility();
+ void InitializeDefaults();
+ void InitializeOptionFillers();
+ void InitializeConditions();
+ void InitializeISettingsHandlers();
+ void InitializeISubSettings();
+ void InitializeISettingCallbacks();
+ bool Reset();
+
+ bool m_initialized;
+ CSettingsManager *m_settingsManager;
CCriticalSection m_critical;
- typedef std::set<ISettingsHandler*> SettingsHandlers;
- SettingsHandlers m_settingsHandlers;
- typedef std::set<ISubSettings*> SubSettings;
- SubSettings m_subSettings;
};
-
-extern class CSettings g_settings;
--- /dev/null
+/*
+ * 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 "SettingsManager.h"
+#include "SettingSection.h"
+#include "Setting.h"
+#include "threads/SingleLock.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+#define XML_ROOT "settings"
+#define XML_SECTION "section"
+
+
+CSettingsManager::CSettingsManager()
+ : m_initialized(false), m_loaded(false)
+{ }
+
+CSettingsManager::~CSettingsManager()
+{
+ // first clear all registered settings handler and subsettings
+ // implementations because we can't be sure that they are still valid
+ m_settingsHandlers.clear();
+ m_subSettings.clear();
+ m_settingCreators.clear();
+
+ Clear();
+}
+
+bool CSettingsManager::Initialize(const TiXmlElement *root)
+{
+ CSingleLock lock(m_critical);
+ if (m_initialized || root == NULL)
+ return false;
+
+ if (!StringUtils::EqualsNoCase(root->ValueStr(), XML_ROOT))
+ {
+ CLog::Log(LOGERROR, "CSettingsManager: error reading settings definition: doesn't contain <settings> tag");
+ return false;
+ }
+
+ const TiXmlNode *sectionNode = root->FirstChild(XML_SECTION);
+ while (sectionNode != NULL)
+ {
+ std::string sectionId;
+ if (CSettingSection::DeserializeIdentification(sectionNode, sectionId))
+ {
+ CSettingSection *section = NULL;
+ SettingSectionMap::iterator itSection = m_sections.find(sectionId);
+ bool update = (itSection != m_sections.end());
+ if (!update)
+ section = new CSettingSection(sectionId, this);
+ else
+ section = itSection->second;
+
+ if (section->Deserialize(sectionNode, update))
+ {
+ section->CheckVisible();
+ if (!update)
+ m_sections[section->GetId()] = section;
+
+ // get all settings and add them to the settings map
+ for (SettingCategoryList::const_iterator categoryIt = section->GetCategories().begin(); categoryIt != section->GetCategories().end(); categoryIt++)
+ {
+ (*categoryIt)->CheckVisible();
+ for (SettingGroupList::const_iterator groupIt = (*categoryIt)->GetGroups().begin(); groupIt != (*categoryIt)->GetGroups().end(); groupIt++)
+ {
+ (*groupIt)->CheckVisible();
+ for (SettingList::const_iterator settingIt = (*groupIt)->GetSettings().begin(); settingIt != (*groupIt)->GetSettings().end(); settingIt++)
+ {
+ (*settingIt)->CheckVisible();
+
+ const std::string &settingId = (*settingIt)->GetId();
+ SettingMap::iterator setting = m_settings.find(settingId);
+ if (setting == m_settings.end())
+ {
+ Setting tmpSetting = { NULL };
+ std::pair<SettingMap::iterator, bool> tmpIt = m_settings.insert(make_pair(settingId, tmpSetting));
+ setting = tmpIt.first;
+ }
+
+ if (setting->second.setting == NULL)
+ {
+ setting->second.setting = *settingIt;
+ (*settingIt)->m_callback = this;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ CLog::Log(LOGWARNING, "CSettingsManager: unable to read section \"%s\"", sectionId.c_str());
+ if (!update)
+ delete section;
+ }
+ }
+
+ sectionNode = sectionNode->NextSibling(XML_SECTION);
+ }
+
+ for (SettingMap::iterator itSettingDep = m_settings.begin(); itSettingDep != m_settings.end(); itSettingDep++)
+ {
+ if (itSettingDep->second.setting == NULL)
+ continue;
+
+ const SettingDependencies& deps = itSettingDep->second.setting->GetDependencies();
+ for (SettingDependencies::const_iterator depIt = deps.begin(); depIt != deps.end(); depIt++)
+ {
+ std::set<std::string> settingIds = depIt->GetSettings();
+ for (std::set<std::string>::const_iterator itSettingId = settingIds.begin(); itSettingId != settingIds.end(); itSettingId++)
+ {
+ SettingMap::iterator setting = m_settings.find(*itSettingId);
+ if (setting == m_settings.end())
+ continue;
+
+ setting->second.dependencies[itSettingDep->first].push_back(*depIt);
+ }
+ }
+ }
+
+ return true;
+}
+
+bool CSettingsManager::Load(const TiXmlElement *root, bool &updated, bool triggerEvents /* = true */, std::map<std::string, CSetting*> *loadedSettings /* = NULL */)
+{
+ CSingleLock lock(m_critical);
+ if (m_loaded || root == NULL)
+ return false;
+
+ if (triggerEvents && !OnSettingsLoading())
+ return false;
+
+ if (!Deserialize(root, loadedSettings))
+ return false;
+
+ bool ret = true;
+ // load any ISubSettings implementations
+ if (triggerEvents)
+ ret = Load(root);
+
+ updated = UpdateSettings(root);
+
+ if (triggerEvents)
+ OnSettingsLoaded();
+
+ return ret;
+}
+
+bool CSettingsManager::Save(TiXmlNode *root) const
+{
+ CSingleLock lock(m_critical);
+ if (!m_initialized || root == NULL)
+ return false;
+
+ if (!OnSettingsSaving())
+ return false;
+
+ if (!Serialize(root))
+ {
+ CLog::Log(LOGERROR, "CSettingsManager: failed to save settings");
+ return false;
+ }
+
+ // save any ISubSettings implementations
+ for (std::set<ISubSettings*>::const_iterator it = m_subSettings.begin(); it != m_subSettings.end(); it++)
+ {
+ if (!(*it)->Save(root))
+ return false;
+ }
+
+ OnSettingsSaved();
+
+ return true;
+}
+
+void CSettingsManager::Unload()
+{
+ CSingleLock lock(m_critical);
+ m_loaded = false;
+ for (SettingMap::iterator setting = m_settings.begin(); setting != m_settings.end(); setting++)
+ setting->second.setting->Reset();
+}
+
+void CSettingsManager::Clear()
+{
+ CSingleLock lock(m_critical);
+ m_settings.clear();
+ for (SettingSectionMap::iterator section = m_sections.begin(); section != m_sections.end(); section++)
+ delete section->second;
+ m_sections.clear();
+
+ OnSettingsCleared();
+
+ for (std::set<ISubSettings*>::const_iterator it = m_subSettings.begin(); it != m_subSettings.end(); it++)
+ (*it)->Clear();
+
+ m_loaded = false;
+ m_initialized = false;
+}
+
+bool CSettingsManager::LoadSetting(const TiXmlNode *node, const std::string &settingId)
+{
+ if (node == NULL)
+ return false;
+
+ CSetting *setting = GetSetting(settingId);
+ if (setting == NULL)
+ return false;
+
+ return LoadSetting(node, setting);
+}
+
+void CSettingsManager::SetInitialized()
+{
+ CSingleLock lock(m_critical);
+ if (m_initialized)
+ return;
+
+ m_initialized = true;
+
+ for (SettingMap::iterator setting = m_settings.begin(); setting != m_settings.end(); )
+ {
+ SettingMap::iterator tmpIterator = setting++;
+ if (tmpIterator->second.setting == NULL)
+ m_settings.erase(tmpIterator);
+ }
+}
+
+void CSettingsManager::RegisterCallback(ISettingCallback *callback, const std::set<std::string> &settingList)
+{
+ CSingleLock lock(m_critical);
+ if (callback == NULL)
+ return;
+
+ for (std::set<std::string>::const_iterator settingIt = settingList.begin(); settingIt != settingList.end(); settingIt++)
+ {
+ std::string id = *settingIt;
+ StringUtils::ToLower(id);
+
+ SettingMap::iterator setting = m_settings.find(id);
+ if (setting == m_settings.end())
+ {
+ if (m_initialized)
+ continue;
+
+ Setting tmpSetting = { NULL };
+ std::pair<SettingMap::iterator, bool> tmpIt = m_settings.insert(make_pair(id, tmpSetting));
+ setting = tmpIt.first;
+ }
+
+ setting->second.callbacks.insert(callback);
+ }
+}
+
+void CSettingsManager::UnregisterCallback(ISettingCallback *callback)
+{
+ CSingleLock lock(m_critical);
+ for (SettingMap::iterator settingIt = m_settings.begin(); settingIt != m_settings.end(); settingIt++)
+ settingIt->second.callbacks.erase(callback);
+}
+
+void CSettingsManager::RegisterSettingType(const std::string &settingType, ISettingCreator *settingCreator)
+{
+ CSingleLock lock(m_critical);
+ if (settingType.empty() || settingCreator == NULL)
+ return;
+
+ SettingCreatorMap::const_iterator creatorIt = m_settingCreators.find(settingType);
+ if (creatorIt == m_settingCreators.end())
+ m_settingCreators.insert(make_pair(settingType, settingCreator));
+}
+
+void CSettingsManager::RegisterSettingsHandler(ISettingsHandler *settingsHandler)
+{
+ if (settingsHandler == NULL)
+ return;
+
+ CSingleLock lock(m_critical);
+ m_settingsHandlers.insert(settingsHandler);
+}
+
+void CSettingsManager::UnregisterSettingsHandler(ISettingsHandler *settingsHandler)
+{
+ if (settingsHandler == NULL)
+ return;
+
+ CSingleLock lock(m_critical);
+ m_settingsHandlers.erase(settingsHandler);
+}
+
+void CSettingsManager::RegisterSubSettings(ISubSettings *subSettings)
+{
+ CSingleLock lock(m_critical);
+ if (subSettings == NULL)
+ return;
+
+ m_subSettings.insert(subSettings);
+}
+
+void CSettingsManager::UnregisterSubSettings(ISubSettings *subSettings)
+{
+ CSingleLock lock(m_critical);
+ if (subSettings == NULL)
+ return;
+
+ m_subSettings.erase(subSettings);
+}
+
+void CSettingsManager::RegisterSettingOptionsFiller(const std::string &identifier, IntegerSettingOptionsFiller optionsFiller)
+{
+ if (identifier.empty() || optionsFiller == NULL)
+ return;
+
+ RegisterSettingOptionsFiller(identifier, (void*)optionsFiller, SettingOptionsFillerTypeInteger);
+}
+
+void CSettingsManager::RegisterSettingOptionsFiller(const std::string &identifier, StringSettingOptionsFiller optionsFiller)
+{
+ if (identifier.empty() || optionsFiller == NULL)
+ return;
+
+ RegisterSettingOptionsFiller(identifier, (void*)optionsFiller, SettingOptionsFillerTypeString);
+}
+
+void CSettingsManager::UnregisterSettingOptionsFiller(const std::string &identifier)
+{
+ m_optionsFillers.erase(identifier);
+}
+
+void* CSettingsManager::GetSettingOptionsFiller(const CSetting *setting)
+{
+ if (setting == NULL)
+ return NULL;
+
+ // get the option filler's identifier
+ std::string filler;
+ if (setting->GetType() == SettingTypeInteger)
+ filler = ((const CSettingInt*)setting)->GetOptionsFiller();
+ else if (setting->GetType() == SettingTypeString)
+ filler = ((const CSettingString*)setting)->GetOptionsFiller();
+
+ if (filler.empty())
+ return NULL;
+
+ // check if such an option filler is known
+ SettingOptionsFillerMap::const_iterator fillerIt = m_optionsFillers.find(filler);
+ if (fillerIt == m_optionsFillers.end())
+ return NULL;
+
+ if (fillerIt->second.filler == NULL)
+ return NULL;
+
+ // make sure the option filler's type matches the setting's type
+ switch (fillerIt->second.type)
+ {
+ case SettingOptionsFillerTypeInteger:
+ {
+ if (setting->GetType() != SettingTypeInteger)
+ return NULL;
+
+ break;
+ }
+
+ case SettingOptionsFillerTypeString:
+ {
+ if (setting->GetType() != SettingTypeString)
+ return NULL;
+
+ break;
+ }
+
+ default:
+ return NULL;
+ }
+
+ return fillerIt->second.filler;
+}
+
+CSetting* CSettingsManager::GetSetting(const std::string &id) const
+{
+ CSingleLock lock(m_critical);
+ if (id.empty())
+ return NULL;
+
+ std::string settingId = id;
+ StringUtils::ToLower(settingId);
+
+ SettingMap::const_iterator setting = m_settings.find(settingId);
+ if (setting != m_settings.end())
+ return setting->second.setting;
+
+ CLog::Log(LOGDEBUG, "CSettingsManager: requested setting (%s) was not found.", id.c_str());
+ return NULL;
+}
+
+CSettingSection* CSettingsManager::GetSection(const std::string §ion) const
+{
+ CSingleLock lock(m_critical);
+ if (section.empty())
+ return NULL;
+
+ std::string sectionId = section;
+ StringUtils::ToLower(sectionId);
+
+ SettingSectionMap::const_iterator sectionIt = m_sections.find(sectionId);
+ if (sectionIt != m_sections.end())
+ return sectionIt->second;
+
+ CLog::Log(LOGDEBUG, "CSettingsManager: requested setting section (%s) was not found.", section.c_str());
+ return NULL;
+}
+
+SettingDependencyMap CSettingsManager::GetDependencies(const std::string &id) const
+{
+ CSingleLock lock(m_critical);
+ SettingMap::const_iterator setting = m_settings.find(id);
+ if (setting == m_settings.end())
+ return SettingDependencyMap();
+
+ return setting->second.dependencies;
+}
+
+SettingDependencyMap CSettingsManager::GetDependencies(const CSetting *setting) const
+{
+ CSingleLock lock(m_critical);
+ if (setting == NULL)
+ return SettingDependencyMap();
+
+ return GetDependencies(setting->GetId());
+}
+
+bool CSettingsManager::GetBool(const std::string &id) const
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeBool)
+ {
+ // Backward compatibility (skins use this setting)
+ if (setting == NULL && StringUtils::EqualsNoCase(id.c_str(), "lookandfeel.enablemouse"))
+ return GetBool("input.enablemouse");
+
+ return false;
+ }
+
+ return ((CSettingBool*)setting)->GetValue();
+}
+
+bool CSettingsManager::SetBool(const std::string &id, bool value)
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeBool)
+ return false;
+
+ return ((CSettingBool*)setting)->SetValue(value);
+}
+
+bool CSettingsManager::ToggleBool(const std::string &id)
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeBool)
+ return false;
+
+ return SetBool(id, !((CSettingBool*)setting)->GetValue());
+}
+
+int CSettingsManager::GetInt(const std::string &id) const
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeInteger)
+ return 0;
+
+ return ((CSettingInt*)setting)->GetValue();
+}
+
+bool CSettingsManager::SetInt(const std::string &id, int value)
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeInteger)
+ return false;
+
+ return ((CSettingInt*)setting)->SetValue(value);
+}
+
+double CSettingsManager::GetNumber(const std::string &id) const
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeNumber)
+ return 0.0;
+
+ return ((CSettingNumber*)setting)->GetValue();
+}
+
+bool CSettingsManager::SetNumber(const std::string &id, double value)
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeNumber)
+ return false;
+
+ return ((CSettingNumber*)setting)->SetValue(value);
+}
+
+std::string CSettingsManager::GetString(const std::string &id) const
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeString)
+ return "";
+
+ return ((CSettingString*)setting)->GetValue();
+}
+
+bool CSettingsManager::SetString(const std::string &id, const std::string &value)
+{
+ CSingleLock lock(m_critical);
+ CSetting *setting = GetSetting(id);
+ if (setting == NULL || setting->GetType() != SettingTypeString)
+ return false;
+
+ return ((CSettingString*)setting)->SetValue(value);
+}
+
+void CSettingsManager::AddCondition(const std::string &condition)
+{
+ if (condition.empty())
+ return;
+
+ m_conditions.AddCondition(condition);
+}
+
+void CSettingsManager::AddCondition(const std::string &identifier, SettingConditionCheck condition)
+{
+ if (identifier.empty() || condition == NULL)
+ return;
+
+ m_conditions.AddCondition(identifier, condition);
+}
+
+bool CSettingsManager::Serialize(TiXmlNode *parent) const
+{
+ if (parent == NULL)
+ return false;
+
+ for (SettingMap::const_iterator it = m_settings.begin(); it != m_settings.end(); it++)
+ {
+ if (it->second.setting->GetType() == SettingTypeAction)
+ continue;
+
+ std::vector<std::string> parts = StringUtils::Split(it->first, ".");
+ if (parts.size() != 2 || parts.at(0).empty() || parts.at(1).empty())
+ {
+ CLog::Log(LOGWARNING, "CSettingsManager: unable to save setting \"%s\"", it->first.c_str());
+ continue;
+ }
+
+ TiXmlNode *sectionNode = parent->FirstChild(parts.at(0));
+ if (sectionNode == NULL)
+ {
+ TiXmlElement sectionElement(parts.at(0));
+ sectionNode = parent->InsertEndChild(sectionElement);
+
+ if (sectionNode == NULL)
+ {
+ CLog::Log(LOGWARNING, "CSettingsManager: unable to write <%s> tag", parts.at(0).c_str());
+ continue;
+ }
+ }
+
+ TiXmlElement settingElement(parts.at(1));
+ TiXmlNode *settingNode = sectionNode->InsertEndChild(settingElement);
+ if (settingNode == NULL)
+ {
+ CLog::Log(LOGWARNING, "CSetting: unable to write <%s> tag in <%s>", parts.at(1).c_str(), parts.at(0).c_str());
+ continue;
+ }
+
+ TiXmlText value(it->second.setting->ToString());
+ settingNode->InsertEndChild(value);
+ }
+
+ return true;
+}
+
+bool CSettingsManager::Deserialize(const TiXmlNode *node, std::map<std::string, CSetting*> *loadedSettings /* = NULL */)
+{
+ if (node == NULL)
+ return false;
+
+ for (SettingMap::iterator it = m_settings.begin(); it != m_settings.end(); it++)
+ {
+ if (LoadSetting(node, it->second.setting) && loadedSettings != NULL)
+ loadedSettings->insert(make_pair(it->first, it->second.setting));
+ }
+
+ return true;
+}
+
+bool CSettingsManager::OnSettingChanging(const CSetting *setting)
+{
+ CSingleLock lock(m_critical);
+ if (setting == NULL)
+ return false;
+
+ if (!m_loaded)
+ return true;
+
+ SettingMap::const_iterator settingIt = m_settings.find(setting->GetId());
+ if (settingIt == m_settings.end())
+ return false;
+
+ Setting settingData = settingIt->second;
+ // now that we have a copy of the setting's data, we can leave the lock
+ lock.Leave();
+
+ for (CallbackSet::iterator callback = settingData.callbacks.begin();
+ callback != settingData.callbacks.end();
+ callback++)
+ {
+ if (!(*callback)->OnSettingChanging(setting))
+ return false;
+ }
+
+ return true;
+}
+
+void CSettingsManager::OnSettingChanged(const CSetting *setting)
+{
+ CSingleLock lock(m_critical);
+ if (!m_loaded || setting == NULL)
+ return;
+
+ SettingMap::const_iterator settingIt = m_settings.find(setting->GetId());
+ if (settingIt == m_settings.end())
+ return;
+
+ Setting settingData = settingIt->second;
+ // now that we have a copy of the setting's data, we can leave the lock
+ lock.Leave();
+
+ for (CallbackSet::iterator callback = settingData.callbacks.begin();
+ callback != settingData.callbacks.end();
+ callback++)
+ (*callback)->OnSettingChanged(setting);
+}
+
+void CSettingsManager::OnSettingAction(const CSetting *setting)
+{
+ CSingleLock lock(m_critical);
+ if (!m_loaded || setting == NULL)
+ return;
+
+ SettingMap::const_iterator settingIt = m_settings.find(setting->GetId());
+ if (settingIt == m_settings.end())
+ return;
+
+ Setting settingData = settingIt->second;
+ // now that we have a copy of the setting's data, we can leave the lock
+ lock.Leave();
+
+ for (CallbackSet::iterator callback = settingData.callbacks.begin();
+ callback != settingData.callbacks.end();
+ callback++)
+ (*callback)->OnSettingAction(setting);
+}
+
+bool CSettingsManager::OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode)
+{
+ CSingleLock lock(m_critical);
+ if (setting == NULL)
+ return false;
+
+ SettingMap::const_iterator settingIt = m_settings.find(setting->GetId());
+ if (settingIt == m_settings.end())
+ return false;
+
+ Setting settingData = settingIt->second;
+ // now that we have a copy of the setting's data, we can leave the lock
+ lock.Leave();
+
+ bool ret = false;
+ for (CallbackSet::iterator callback = settingData.callbacks.begin();
+ callback != settingData.callbacks.end();
+ callback++)
+ ret |= (*callback)->OnSettingUpdate(setting, oldSettingId, oldSettingNode);
+
+ return ret;
+}
+
+CSetting* CSettingsManager::CreateSetting(const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager /* = NULL */) const
+{
+ if (StringUtils::EqualsNoCase(settingType, "boolean"))
+ return new CSettingBool(settingId, (CSettingsManager*)this);
+ else if (StringUtils::EqualsNoCase(settingType, "integer"))
+ return new CSettingInt(settingId, (CSettingsManager*)this);
+ else if (StringUtils::EqualsNoCase(settingType, "number"))
+ return new CSettingNumber(settingId, (CSettingsManager*)this);
+ else if (StringUtils::EqualsNoCase(settingType, "string"))
+ return new CSettingString(settingId, (CSettingsManager*)this);
+ else if (StringUtils::EqualsNoCase(settingType, "action"))
+ return new CSettingAction(settingId, (CSettingsManager*)this);
+
+ SettingCreatorMap::const_iterator creator = m_settingCreators.find(settingType);
+ if (creator != m_settingCreators.end())
+ return creator->second->CreateSetting(settingType, settingId, (CSettingsManager*)this);
+
+ return NULL;
+}
+
+bool CSettingsManager::OnSettingsLoading()
+{
+ CSingleLock lock(m_critical);
+ for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ {
+ if (!(*it)->OnSettingsLoading())
+ return false;
+ }
+
+ return true;
+}
+
+void CSettingsManager::OnSettingsLoaded()
+{
+ CSingleLock lock(m_critical);
+ for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ (*it)->OnSettingsLoaded();
+}
+
+bool CSettingsManager::OnSettingsSaving() const
+{
+ CSingleLock lock(m_critical);
+ for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ {
+ if (!(*it)->OnSettingsSaving())
+ return false;
+ }
+
+ return true;
+}
+
+void CSettingsManager::OnSettingsSaved() const
+{
+ CSingleLock lock(m_critical);
+ for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ (*it)->OnSettingsSaved();
+}
+
+void CSettingsManager::OnSettingsCleared()
+{
+ CSingleLock lock(m_critical);
+ for (SettingsHandlers::const_iterator it = m_settingsHandlers.begin(); it != m_settingsHandlers.end(); it++)
+ (*it)->OnSettingsCleared();
+}
+
+bool CSettingsManager::Load(const TiXmlNode *settings)
+{
+ bool ok = true;
+ for (std::set<ISubSettings*>::const_iterator it = m_subSettings.begin(); it != m_subSettings.end(); it++)
+ ok &= (*it)->Load(settings);
+
+ return ok;
+}
+
+bool CSettingsManager::LoadSetting(const TiXmlNode *node, CSetting *setting)
+{
+ if (node == NULL || setting == NULL)
+ return false;
+
+ if (setting->GetType() == SettingTypeAction)
+ return false;
+
+ const std::string &settingId = setting->GetId();
+
+ std::vector<std::string> parts = StringUtils::Split(settingId, ".");
+ if (parts.size() != 2 || parts.at(0).empty() || parts.at(1).empty())
+ {
+ CLog::Log(LOGWARNING, "CSettingsManager: unable to load setting \"%s\"", settingId.c_str());
+ return false;
+ }
+
+ const TiXmlNode *sectionNode = node->FirstChild(parts.at(0));
+ if (sectionNode == NULL)
+ return false;
+
+ const TiXmlNode *settingNode = sectionNode->FirstChild(parts.at(1));
+ if (settingNode == NULL)
+ return false;
+
+ if (!setting->FromString(settingNode->FirstChild() != NULL ? settingNode->FirstChild()->ValueStr() : StringUtils::Empty))
+ {
+ CLog::Log(LOGWARNING, "CSettingsManager: unable to read value of setting \"%s\"", settingId.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+bool CSettingsManager::UpdateSettings(const TiXmlNode *root)
+{
+ bool updated = false;
+
+ for (SettingMap::iterator setting = m_settings.begin(); setting != m_settings.end(); setting++)
+ {
+ const std::set<CSettingUpdate>& updates = setting->second.setting->GetUpdates();
+ if (updates.empty())
+ continue;
+
+ for (std::set<CSettingUpdate>::const_iterator update = updates.begin(); update != updates.end(); update++)
+ updated |= UpdateSetting(root, setting->second.setting, *update);
+ }
+
+ return updated;
+}
+
+bool CSettingsManager::UpdateSetting(const TiXmlNode *node, CSetting *setting, const CSettingUpdate& update)
+{
+ if (node == NULL || setting == NULL || update.GetType() == SettingUpdateTypeNone)
+ return false;
+
+ bool updated = false;
+ const char *oldSetting = NULL;
+ const TiXmlNode *oldSettingNode = NULL;
+ if (update.GetType() == SettingUpdateTypeRename)
+ {
+ if (update.GetValue().empty())
+ return false;
+
+ oldSetting = update.GetValue().c_str();
+ std::vector<std::string> parts = StringUtils::Split(oldSetting, ".");
+ if (parts.size() != 2 || parts.at(0).empty() || parts.at(1).empty())
+ return false;
+
+ const TiXmlNode *sectionNode = node->FirstChild(parts.at(0));
+ if (sectionNode == NULL)
+ return false;
+
+ oldSettingNode = sectionNode->FirstChild(parts.at(1));
+ if (oldSettingNode == NULL)
+ return false;
+
+ if (setting->FromString(oldSettingNode->FirstChild() != NULL ? oldSettingNode->FirstChild()->ValueStr() : StringUtils::Empty))
+ updated = true;
+ else
+ CLog::Log(LOGWARNING, "CSetting: unable to update \"%s\" through automatically renaming from \"%s\"", setting->GetId().c_str(), oldSetting);
+ }
+
+ updated |= OnSettingUpdate(setting, oldSetting, oldSettingNode);
+ return updated;
+}
+
+void CSettingsManager::RegisterSettingOptionsFiller(const std::string &identifier, void *filler, SettingOptionsFillerType type)
+{
+ SettingOptionsFillerMap::const_iterator it = m_optionsFillers.find(identifier);
+ if (it != m_optionsFillers.end())
+ return;
+
+ SettingOptionsFiller optionsFiller = { filler, type };
+ m_optionsFillers.insert(make_pair(identifier, optionsFiller));
+}
--- /dev/null
+#pragma once
+/*
+ * Copyright (C) 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 <map>
+#include <set>
+#include <vector>
+
+#include "ISetting.h"
+#include "ISettingCallback.h"
+#include "ISettingCreator.h"
+#include "ISettingsHandler.h"
+#include "ISubSettings.h"
+#include "SettingConditions.h"
+#include "SettingDependency.h"
+#include "threads/CriticalSection.h"
+
+class CSettingSection;
+class CSettingUpdate;
+
+class TiXmlElement;
+class TiXmlNode;
+
+typedef std::pair<std::string, int> IntegerSettingOption;
+typedef std::pair<std::string, std::string> StringSettingOption;
+typedef std::vector<IntegerSettingOption> IntegerSettingOptions;
+typedef std::vector<StringSettingOption> StringSettingOptions;
+typedef void (*IntegerSettingOptionsFiller)(const CSetting *setting, IntegerSettingOptions &list, int ¤t);
+typedef void (*StringSettingOptionsFiller)(const CSetting *setting, StringSettingOptions &list, std::string ¤t);
+
+class CSettingsManager : public ISettingCreator, private ISettingCallback,
+ private ISettingsHandler, private ISubSettings
+{
+public:
+ CSettingsManager();
+ virtual ~CSettingsManager();
+
+ // implementation of ISettingCreator
+ virtual CSetting* CreateSetting(const std::string &settingType, const std::string &settingId, CSettingsManager *settingsManager = NULL) const;
+
+ bool Initialize(const TiXmlElement *root);
+ bool Load(const TiXmlElement *root, bool &updated, bool triggerEvents = true, std::map<std::string, CSetting*> *loadedSettings = NULL);
+ virtual bool Save(TiXmlNode *root) const;
+ void Unload();
+ void Clear();
+
+ bool LoadSetting(const TiXmlNode *node, const std::string &settingId);
+
+ void SetInitialized();
+ void SetLoaded() { m_loaded = true; }
+
+ void RegisterCallback(ISettingCallback *callback, const std::set<std::string> &settingList);
+ void UnregisterCallback(ISettingCallback *callback);
+
+ void RegisterSettingType(const std::string &settingType, ISettingCreator *settingCreator);
+
+ void RegisterSettingsHandler(ISettingsHandler *settingsHandler);
+ void UnregisterSettingsHandler(ISettingsHandler *settingsHandler);
+
+ void RegisterSubSettings(ISubSettings *subSettings);
+ void UnregisterSubSettings(ISubSettings *subSettings);
+
+ void RegisterSettingOptionsFiller(const std::string &identifier, IntegerSettingOptionsFiller optionsFiller);
+ void RegisterSettingOptionsFiller(const std::string &identifier, StringSettingOptionsFiller optionsFiller);
+ void UnregisterSettingOptionsFiller(const std::string &identifier);
+ void* GetSettingOptionsFiller(const CSetting *setting);
+
+ CSetting* GetSetting(const std::string &id) const;
+ CSettingSection* GetSection(const std::string §ion) const;
+ SettingDependencyMap GetDependencies(const std::string &id) const;
+ SettingDependencyMap GetDependencies(const CSetting *setting) const;
+
+ bool GetBool(const std::string &id) const;
+ int GetInt(const std::string &id) const;
+ double GetNumber(const std::string &id) const;
+ std::string GetString(const std::string &id) const;
+
+ bool SetBool(const std::string &id, bool value);
+ bool ToggleBool(const std::string &id);
+ bool SetInt(const std::string &id, int value);
+ bool SetNumber(const std::string &id, double value);
+ bool SetString(const std::string &id, const std::string &value);
+
+ const CSettingConditionsManager& GetConditions() const { return m_conditions; }
+ void AddCondition(const std::string &condition);
+ void AddCondition(const std::string &identifier, SettingConditionCheck condition);
+
+private:
+ // implementation of ISettingCallback
+ virtual bool OnSettingChanging(const CSetting *setting);
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
+ virtual bool OnSettingUpdate(CSetting* &setting, const char *oldSettingId, const TiXmlNode *oldSettingNode);
+
+ // implementation of ISettingsHandler
+ virtual bool OnSettingsLoading();
+ virtual void OnSettingsLoaded();
+ virtual bool OnSettingsSaving() const;
+ virtual void OnSettingsSaved() const;
+ virtual void OnSettingsCleared();
+
+ // implementation of ISubSettings
+ virtual bool Load(const TiXmlNode *settings);
+
+ bool Serialize(TiXmlNode *parent) const;
+ bool Deserialize(const TiXmlNode *node, std::map<std::string, CSetting*> *loadedSettings = NULL);
+
+ bool LoadSetting(const TiXmlNode *node, CSetting *setting);
+ bool UpdateSettings(const TiXmlNode *root);
+ bool UpdateSetting(const TiXmlNode *node, CSetting *setting, const CSettingUpdate& update);
+
+ typedef enum {
+ SettingOptionsFillerTypeNone = 0,
+ SettingOptionsFillerTypeInteger,
+ SettingOptionsFillerTypeString
+ } SettingOptionsFillerType;
+
+ void RegisterSettingOptionsFiller(const std::string &identifier, void *filler, SettingOptionsFillerType type);
+
+ typedef std::set<ISettingCallback *> CallbackSet;
+ typedef struct {
+ CSetting *setting;
+ SettingDependencyMap dependencies;
+ CallbackSet callbacks;
+ } Setting;
+
+ bool m_initialized;
+ bool m_loaded;
+
+ typedef std::map<std::string, Setting> SettingMap;
+ SettingMap m_settings;
+ typedef std::map<std::string, CSettingSection*> SettingSectionMap;
+ SettingSectionMap m_sections;
+
+ typedef std::map<std::string, ISettingCreator*> SettingCreatorMap;
+ SettingCreatorMap m_settingCreators;
+
+ std::set<ISubSettings*> m_subSettings;
+ typedef std::set<ISettingsHandler*> SettingsHandlers;
+ SettingsHandlers m_settingsHandlers;
+
+ CSettingConditionsManager m_conditions;
+
+ typedef struct {
+ void *filler;
+ SettingOptionsFillerType type;
+ } SettingOptionsFiller;
+ typedef std::map<std::string, SettingOptionsFiller> SettingOptionsFillerMap;
+ SettingOptionsFillerMap m_optionsFillers;
+
+ CCriticalSection m_critical;
+};
#include "SkinSettings.h"
#include "GUIInfoManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
std::string CSkinSettings::GetCurrentSkin() const
{
- return g_guiSettings.GetString("lookandfeel.skin");
+ return CSettings::Get().GetString("lookandfeel.skin");
}
\ No newline at end of file
#include "GUIDialogContentSettings.h"
#include "addons/GUIDialogAddonSettings.h"
-#include "settings/GUISettings.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/Key.h"
#include "addons/IAddon.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"
--- /dev/null
+/*
+ * 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/>.
+ *
+ */
+
+#include "GUIControlSettings.h"
+#include "Util.h"
+#include "addons/AddonManager.h"
+#include "addons/GUIWindowAddonBrowser.h"
+#include "dialogs/GUIDialogFileBrowser.h"
+#include "dialogs/GUIDialogOK.h"
+#include "guilib/GUIEditControl.h"
+#include "guilib/GUIImage.h"
+#include "guilib/GUIRadioButtonControl.h"
+#include "guilib/GUISpinControlEx.h"
+#include "guilib/LocalizeStrings.h"
+#include "settings/SettingAddon.h"
+#include "settings/SettingPath.h"
+#include "settings/Settings.h"
+#include "settings/MediaSourceSettings.h"
+#include "settings/Setting.h"
+#include "storage/MediaManager.h"
+#include "utils/StringUtils.h"
+
+using namespace ADDON;
+
+CGUIControlBaseSetting::CGUIControlBaseSetting(int id, CSetting *pSetting)
+{
+ m_id = id;
+ m_pSetting = pSetting;
+ m_delayed = false;
+ m_enabled = true;
+}
+
+void CGUIControlBaseSetting::Update()
+{
+ CGUIControl *control = GetControl();
+ if (control != NULL)
+ control->SetEnabled(IsEnabled());
+}
+
+CGUIControlRadioButtonSetting::CGUIControlRadioButtonSetting(CGUIRadioButtonControl *pRadioButton, int id, CSetting *pSetting)
+ : CGUIControlBaseSetting(id, pSetting)
+{
+ m_pRadioButton = pRadioButton;
+ m_pRadioButton->SetID(id);
+ Update();
+}
+
+CGUIControlRadioButtonSetting::~CGUIControlRadioButtonSetting()
+{ }
+
+bool CGUIControlRadioButtonSetting::OnClick()
+{
+ return ((CSettingBool *)m_pSetting)->SetValue(!((CSettingBool *)m_pSetting)->GetValue());
+}
+
+void CGUIControlRadioButtonSetting::Update()
+{
+ if (m_pRadioButton == NULL)
+ return;
+
+ CGUIControlBaseSetting::Update();
+
+ m_pRadioButton->SetSelected(((CSettingBool *)m_pSetting)->GetValue());
+}
+
+CGUIControlSpinExSetting::CGUIControlSpinExSetting(CGUISpinControlEx *pSpin, int id, CSetting *pSetting)
+ : CGUIControlBaseSetting(id, pSetting)
+{
+ m_pSpin = pSpin;
+ m_pSpin->SetID(id);
+
+ switch (pSetting->GetControl().GetFormat())
+ {
+ case SettingControlFormatNumber:
+ {
+ CSettingNumber *pSettingNumber = (CSettingNumber *)pSetting;
+ m_pSpin->SetType(SPIN_CONTROL_TYPE_FLOAT);
+ m_pSpin->SetFloatRange((float)pSettingNumber->GetMinimum(), (float)pSettingNumber->GetMaximum());
+ m_pSpin->SetFloatInterval((float)pSettingNumber->GetStep());
+ break;
+ }
+
+ case SettingControlFormatInteger:
+ case SettingControlFormatString:
+ {
+ m_pSpin->SetType(SPIN_CONTROL_TYPE_TEXT);
+ m_pSpin->Clear();
+
+ if (pSetting->GetType() == SettingTypeInteger)
+ {
+ CSettingInt *pSettingInt = (CSettingInt *)pSetting;
+
+ const SettingOptions& options = pSettingInt->GetOptions();
+ if (!options.empty())
+ {
+ for (SettingOptions::const_iterator it = options.begin(); it != options.end(); it++)
+ m_pSpin->AddLabel(g_localizeStrings.Get(it->first), it->second);
+ m_pSpin->SetValue(pSettingInt->GetValue());
+ }
+ else
+ {
+ std::string strLabel;
+ int i = pSettingInt->GetMinimum();
+ if (pSettingInt->GetMinimumLabel() > -1)
+ {
+ strLabel = g_localizeStrings.Get(pSettingInt->GetMinimumLabel());
+ m_pSpin->AddLabel(strLabel, pSettingInt->GetMinimum());
+ i += pSettingInt->GetStep();
+ }
+ for (; i <= pSettingInt->GetMaximum(); i += pSettingInt->GetStep())
+ {
+ if (pSettingInt->GetFormat() > -1)
+ strLabel = StringUtils::Format(g_localizeStrings.Get(pSettingInt->GetFormat()).c_str(), i);
+ else
+ strLabel = StringUtils::Format(pSettingInt->GetFormatString().c_str(), i);
+ m_pSpin->AddLabel(strLabel, i);
+ }
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
+CGUIControlSpinExSetting::~CGUIControlSpinExSetting()
+{ }
+
+bool CGUIControlSpinExSetting::OnClick()
+{
+ if (m_pSpin == NULL)
+ return false;
+
+ switch (m_pSetting->GetType())
+ {
+ case SettingTypeInteger:
+ return ((CSettingInt *)m_pSetting)->SetValue(m_pSpin->GetValue());
+ break;
+
+ case SettingTypeNumber:
+ return ((CSettingNumber *)m_pSetting)->SetValue(m_pSpin->GetFloatValue());
+
+ case SettingTypeString:
+ return ((CSettingString *)m_pSetting)->SetValue(m_pSpin->GetStringValue());
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+void CGUIControlSpinExSetting::Update()
+{
+ if (m_pSpin == NULL)
+ return;
+
+ CGUIControlBaseSetting::Update();
+
+ switch (m_pSetting->GetType())
+ {
+ case SettingTypeInteger:
+ m_pSpin->SetValue(((CSettingInt *)m_pSetting)->GetValue());
+ break;
+
+ case SettingTypeNumber:
+ m_pSpin->SetFloatValue((float)((CSettingNumber *)m_pSetting)->GetValue());
+ break;
+
+ case SettingTypeString:
+ m_pSpin->SetStringValue(((CSettingString *)m_pSetting)->GetValue());
+ break;
+
+ default:
+ break;
+ }
+
+ // disable the spinner if it has less than two items
+ if (!m_pSpin->IsDisabled() && (m_pSpin->GetMaximum() - m_pSpin->GetMinimum()) == 0)
+ m_pSpin->SetEnabled(false);
+}
+
+CGUIControlButtonSetting::CGUIControlButtonSetting(CGUIButtonControl *pButton, int id, CSetting *pSetting)
+ : CGUIControlBaseSetting(id, pSetting)
+{
+ m_pButton = pButton;
+ m_pButton->SetID(id);
+ Update();
+}
+
+CGUIControlButtonSetting::~CGUIControlButtonSetting()
+{ }
+
+bool CGUIControlButtonSetting::OnClick()
+{
+ if (m_pButton == NULL)
+ return false;
+
+ bool success = false;
+ switch (m_pSetting->GetControl().GetFormat())
+ {
+ case SettingControlFormatAddon:
+ {
+ // prompt for the addon
+ CSettingAddon *setting = (CSettingAddon *)m_pSetting;
+ CStdString addonID = setting->GetValue();
+ if (!CGUIWindowAddonBrowser::SelectAddonID(setting->GetAddonType(), addonID, setting->AllowEmpty()) == 1)
+ return false;
+
+ success = setting->SetValue(addonID);
+ break;
+ }
+
+ case SettingControlFormatPath:
+ {
+ success = GetPath((CSettingPath *)m_pSetting);
+ break;
+ }
+
+ case SettingControlFormatAction:
+ {
+ // simply call the OnSettingAction callback and whoever knows what to
+ // do can do so (based on the setting's identification
+ CSettingAction *pSettingAction = (CSettingAction *)m_pSetting;
+ pSettingAction->OnSettingAction(pSettingAction);
+ success = true;
+ break;
+ }
+
+ default:
+ return false;
+ }
+
+ return success;
+}
+
+void CGUIControlButtonSetting::Update()
+{
+ if (m_pButton == NULL)
+ return;
+
+ CGUIControlBaseSetting::Update();
+
+ if (m_pSetting->GetType() == SettingTypeString)
+ {
+ std::string strText = ((CSettingString *)m_pSetting)->GetValue();
+ switch (m_pSetting->GetControl().GetFormat())
+ {
+ case SettingControlFormatAddon:
+ {
+ ADDON::AddonPtr addon;
+ if (ADDON::CAddonMgr::Get().GetAddon(strText, addon))
+ strText = addon->Name();
+ if (strText.empty())
+ strText = g_localizeStrings.Get(231); // None
+ break;
+ }
+
+ case SettingControlFormatPath:
+ {
+ CStdString shortPath;
+ if (CUtil::MakeShortenPath(strText, shortPath, 30))
+ strText = shortPath;
+ break;
+ }
+
+ default:
+ return;
+ }
+
+ m_pButton->SetLabel2(strText);
+ }
+}
+
+bool CGUIControlButtonSetting::GetPath(CSettingPath *pathSetting)
+{
+ if (pathSetting == NULL)
+ return false;
+
+ CStdString path = pathSetting->GetValue();
+
+ VECSOURCES shares;
+ const std::vector<std::string>& sources = pathSetting->GetSources();
+ for (std::vector<std::string>::const_iterator source = sources.begin(); source != sources.end(); source++)
+ {
+ VECSOURCES *sources = CMediaSourceSettings::Get().GetSources(*source);
+ if (sources != NULL)
+ shares.insert(shares.end(), sources->begin(), sources->end());
+ }
+
+ g_mediaManager.GetNetworkLocations(shares);
+ g_mediaManager.GetLocalDrives(shares);
+
+ if (!CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(pathSetting->GetHeading()), path, pathSetting->Writable()))
+ return false;
+
+ return pathSetting->SetValue(path);
+}
+
+CGUIControlEditSetting::CGUIControlEditSetting(CGUIEditControl *pEdit, int id, CSetting *pSetting)
+ : CGUIControlBaseSetting(id, pSetting)
+{
+ m_pEdit = pEdit;
+ m_pEdit->SetID(id);
+ int heading = m_pSetting->GetLabel();
+ if (m_pSetting->GetType() == SettingTypeString)
+ {
+ CSettingString *pSettingString = (CSettingString *)m_pSetting;
+ if (pSettingString->GetHeading() > 0)
+ heading = pSettingString->GetHeading();
+ }
+ if (heading < 0)
+ heading = 0;
+
+ CGUIEditControl::INPUT_TYPE inputType = CGUIEditControl::INPUT_TYPE_TEXT;
+ const CSettingControl& control = pSetting->GetControl();
+ switch (control.GetFormat())
+ {
+ case SettingControlFormatString:
+ if (control.GetAttributes() & SettingControlAttributeHidden)
+ inputType = CGUIEditControl::INPUT_TYPE_PASSWORD;
+ break;
+
+ case SettingControlFormatInteger:
+ if (control.GetAttributes() & SettingControlAttributeVerifyNew)
+ inputType = CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW;
+ else
+ inputType = CGUIEditControl::INPUT_TYPE_NUMBER;
+ break;
+
+ case SettingControlFormatIP:
+ inputType = CGUIEditControl::INPUT_TYPE_IPADDRESS;
+ break;
+
+ case SettingControlFormatMD5:
+ inputType = CGUIEditControl::INPUT_TYPE_PASSWORD_MD5;
+ break;
+
+ default:
+ break;
+ }
+ m_pEdit->SetInputType(inputType, heading);
+
+ Update();
+}
+
+CGUIControlEditSetting::~CGUIControlEditSetting()
+{ }
+
+bool CGUIControlEditSetting::OnClick()
+{
+ if (m_pEdit == NULL)
+ return false;
+
+ // update our string
+ return m_pSetting->FromString(m_pEdit->GetLabel2());
+}
+
+void CGUIControlEditSetting::Update()
+{
+ if (m_pEdit == NULL)
+ return;
+
+ CGUIControlBaseSetting::Update();
+
+ m_pEdit->SetLabel2(m_pSetting->ToString());
+}
+
+CGUIControlSeparatorSetting::CGUIControlSeparatorSetting(CGUIImage *pImage, int id)
+ : CGUIControlBaseSetting(id, NULL)
+{
+ m_pImage = pImage;
+ m_pImage->SetID(id);
+}
+
+CGUIControlSeparatorSetting::~CGUIControlSeparatorSetting()
+{ }
--- /dev/null
+#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/>.
+ *
+ */
+
+#include "utils/StdString.h"
+
+class CGUIControl;
+class CGUIImage;
+class CGUISpinControlEx;
+class CGUIEditControl;
+class CGUIButtonControl;
+class CGUIRadioButtonControl;
+
+class CSetting;
+class CSettingPath;
+
+class CGUIControlBaseSetting
+{
+public:
+ CGUIControlBaseSetting(int id, CSetting *pSetting);
+ virtual ~CGUIControlBaseSetting() {}
+
+ int GetID() { return m_id; }
+ CSetting* GetSetting() { return m_pSetting; }
+
+ /*!
+ \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; }
+
+ /*!
+ \brief Specifies that this setting is enabled or disabled
+ This is used for settings which are enabled/disabled based
+ on conditions involving other settings and their values.
+ It must not be confused with a setting spin control being
+ disabled because it contains less than two items.
+ \param enabled Whether the setting is enabled or disabled
+ \sa IsEnabled()
+ */
+ void SetEnabled(bool enabled) { m_enabled = enabled; }
+
+ /*!
+ \brief Returns whether this setting is enabled or disabled
+ This state is independent of the real enabled state of a
+ setting control but represents the enabled state of the
+ setting itself based on specific conditions.
+ \return true if the setting is enabled otherwise false
+ \sa SetEnabled()
+ */
+ bool IsEnabled() const { return m_enabled; }
+
+ virtual CGUIControl* GetControl() { return NULL; }
+ virtual bool OnClick() { return false; }
+ virtual void Update();
+ virtual void Clear() = 0; ///< Clears the attached control
+protected:
+ int m_id;
+ CSetting* m_pSetting;
+ bool m_delayed;
+ bool m_enabled;
+};
+
+class CGUIControlRadioButtonSetting : public CGUIControlBaseSetting
+{
+public:
+ CGUIControlRadioButtonSetting(CGUIRadioButtonControl* pRadioButton, int id, CSetting *pSetting);
+ virtual ~CGUIControlRadioButtonSetting();
+
+ void Select(bool bSelect);
+
+ virtual CGUIControl* GetControl() { return (CGUIControl*)m_pRadioButton; }
+ virtual bool OnClick();
+ virtual void Update();
+ virtual void Clear() { m_pRadioButton = NULL; }
+private:
+ CGUIRadioButtonControl *m_pRadioButton;
+};
+
+class CGUIControlSpinExSetting : public CGUIControlBaseSetting
+{
+public:
+ CGUIControlSpinExSetting(CGUISpinControlEx* pSpin, int id, CSetting *pSetting);
+ virtual ~CGUIControlSpinExSetting();
+
+ virtual CGUIControl* GetControl() { return (CGUIControl*)m_pSpin; }
+ virtual bool OnClick();
+ virtual void Update();
+ virtual void Clear() { m_pSpin = NULL; }
+private:
+ CGUISpinControlEx *m_pSpin;
+};
+
+class CGUIControlButtonSetting : public CGUIControlBaseSetting
+{
+public:
+ CGUIControlButtonSetting(CGUIButtonControl* pButton, int id, CSetting *pSetting);
+ virtual ~CGUIControlButtonSetting();
+
+ virtual CGUIControl* GetControl() { return (CGUIControl*)m_pButton; }
+ virtual bool OnClick();
+ virtual void Update();
+ virtual void Clear() { m_pButton = NULL; }
+
+ static bool GetPath(CSettingPath *pathSetting);
+private:
+ CGUIButtonControl *m_pButton;
+};
+
+class CGUIControlEditSetting : public CGUIControlBaseSetting
+{
+public:
+ CGUIControlEditSetting(CGUIEditControl* pButton, int id, CSetting *pSetting);
+ virtual ~CGUIControlEditSetting();
+
+ virtual CGUIControl* GetControl() { return (CGUIControl*)m_pEdit; }
+ virtual bool OnClick();
+ virtual void Update();
+ virtual void Clear() { m_pEdit = NULL; }
+private:
+ CGUIEditControl *m_pEdit;
+};
+
+class CGUIControlSeparatorSetting : public CGUIControlBaseSetting
+{
+public:
+ CGUIControlSeparatorSetting(CGUIImage* pImage, int id);
+ virtual ~CGUIControlSeparatorSetting();
+
+ virtual CGUIControl* GetControl() { return (CGUIControl*)m_pImage; }
+ virtual bool OnClick() { return false; }
+ virtual void Update() {}
+ virtual void Clear() { m_pImage = NULL; }
+private:
+ CGUIImage *m_pImage;
+};
+++ /dev/null
-/*
- * 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()
-{}
-
+++ /dev/null
-#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;
-};
/*
- * Copyright (C) 2005-2013 Team XBMC
+ * Copyright (C) 2005-2012 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
*
*/
-#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 "profiles/ProfilesManager.h"
-#include "video/VideoDatabase.h"
-#include "view/ViewDatabase.h"
-#include "view/ViewState.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 "GUIUserMessages.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 "dialogs/GUIDialogTextViewer.h"
+#include "dialogs/GUIDialogYesNo.h"
#include "guilib/GUIControlGroupList.h"
-#include "guilib/GUIWindowManager.h"
-#include "guilib/GUIFontManager.h"
-#include "cores/AudioEngine/AEFactory.h"
-#include "cores/paplayer/AudioDecoder.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/GUIEditControl.h"
+#include "guilib/GUIImage.h"
+#include "guilib/GUIRadioButtonControl.h"
+#include "guilib/GUISpinControlEx.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 "settings/DisplaySettings.h"
-#include "settings/MediaSourceSettings.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/GUIWindowManager.h"
+#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
-#include "LangInfo.h"
-#include "utils/CharsetConverter.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
+#include "settings/DisplaySettings.h"
+#include "settings/Settings.h"
+#include "utils/log.h"
+#include "view/ViewStateSettings.h"
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 SETTINGS_PICTURES WINDOW_SETTINGS_MYPICTURES - WINDOW_SETTINGS_START
+#define SETTINGS_PROGRAMS WINDOW_SETTINGS_MYPROGRAMS - WINDOW_SETTINGS_START
+#define SETTINGS_WEATHER WINDOW_SETTINGS_MYWEATHER - WINDOW_SETTINGS_START
+#define SETTINGS_MUSIC WINDOW_SETTINGS_MYMUSIC - WINDOW_SETTINGS_START
+#define SETTINGS_SYSTEM WINDOW_SETTINGS_SYSTEM - WINDOW_SETTINGS_START
+#define SETTINGS_VIDEOS WINDOW_SETTINGS_MYVIDEOS - WINDOW_SETTINGS_START
+#define SETTINGS_SERVICE WINDOW_SETTINGS_SERVICE - WINDOW_SETTINGS_START
+#define SETTINGS_APPEARANCE WINDOW_SETTINGS_APPEARANCE - WINDOW_SETTINGS_START
+#define SETTINGS_PVR WINDOW_SETTINGS_MYPVR - WINDOW_SETTINGS_START
+
+#define SETTING_DELAY 1500
+
#define CONTROL_SETTINGS_LABEL 2
#define CATEGORY_GROUP_ID 3
#define SETTINGS_GROUP_ID 5
#define CONTROL_DEFAULT_EDIT 12
#define CONTROL_START_BUTTONS -100
#define CONTROL_START_CONTROL -80
+#define CONTRL_BTN_LEVELS 20
+
+typedef struct {
+ int id;
+ string name;
+} SettingGroup;
+
+static const SettingGroup s_settingGroupMap[] = { { SETTINGS_PICTURES, "pictures" },
+ { SETTINGS_PROGRAMS, "programs" },
+ { SETTINGS_WEATHER, "weather" },
+ { SETTINGS_MUSIC, "music" },
+ { SETTINGS_SYSTEM, "system" },
+ { SETTINGS_VIDEOS, "videos" },
+ { SETTINGS_SERVICE, "services" },
+ { SETTINGS_APPEARANCE, "appearance" },
+ { SETTINGS_PVR, "pvr" } };
+
+#define SettingGroupSize sizeof(s_settingGroupMap) / sizeof(SettingGroup)
CGUIWindowSettingsCategory::CGUIWindowSettingsCategory(void)
- : CGUIWindow(WINDOW_SETTINGS_MYPICTURES, "SettingsCategory.xml")
+ : CGUIWindow(WINDOW_SETTINGS_MYPICTURES, "SettingsCategory.xml"),
+ m_settings(CSettings::Get()),
+ m_iCategory(0), m_iSection(0),
+ m_delayedTimer(this),
+ m_returningFromSkinLoad(false)
{
m_loadType = KEEP_IN_MEMORY;
- m_pOriginalSpin = NULL;
- m_pOriginalRadioButton = NULL;
- m_pOriginalButton = NULL;
- m_pOriginalCategoryButton = NULL;
- m_pOriginalImage = NULL;
- m_pOriginalEdit = NULL;
+
+ newOriginalEdit = false;
+
// set the correct ID range...
m_idRange.clear();
m_idRange.push_back(WINDOW_SETTINGS_MYPICTURES);
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);
+ if (newOriginalEdit)
+ {
+ delete m_pOriginalEdit;
+ m_pOriginalEdit = NULL;
+ }
}
bool CGUIWindowSettingsCategory::OnMessage(CGUIMessage &message)
{
switch (message.GetMessage())
{
- case GUI_MSG_CLICKED:
+ case GUI_MSG_WINDOW_INIT:
+ {
+ m_delayedSetting.reset();
+ m_currentSetting.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_iCategory = 0;
+ ResetControlStates();
+ }
+
+ m_iSection = (int)message.GetParam2() - (int)CGUIWindow::GetID();
+ CGUIWindow::OnMessage(message);
+ m_returningFromSkinLoad = false;
+ return true;
+ }
+
+ case GUI_MSG_WINDOW_DEINIT:
{
- unsigned int iControl = message.GetSenderId();
- for (unsigned int i = 0; i < m_vecSettings.size(); i++)
+ // cancel any delayed changes
+ if (m_delayedSetting != NULL)
{
- if (m_vecSettings[i]->GetID() == (int)iControl)
- OnClick(m_vecSettings[i]);
+ m_delayedTimer.Stop();
+ CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID());
+ OnMessage(message);
}
+
+ CGUIWindow::OnMessage(message);
+ FreeControls();
+ return true;
}
- break;
- case GUI_MSG_FOCUSED:
+
+ 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)
+ if (!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")
+ // cancel any delayed changes
+ if (m_delayedSetting != NULL)
{
- 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;
- }
+ m_delayedTimer.Stop();
+ CGUIMessage message(GUI_MSG_UPDATE_ITEM, GetID(), GetID(), 1); // param1 = 1 for "reset the control if it's invalid"
+ OnMessage(message);
}
- if (m_vecSections[focusedControl-CONTROL_START_BUTTONS]->m_strCategory == "pvrparental")
+
+ int focusedControl = GetFocusedControlID();
+ // check if we have changed the category and need to create new setting controls
+ if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()) &&
+ focusedControl - CONTROL_START_BUTTONS != m_iCategory)
{
- 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);
+ if (!m_categories[focusedControl - CONTROL_START_BUTTONS]->CanAccess())
+ {
+ // unable to go to this category - focus the previous one
+ SET_CONTROL_FOCUS(CONTROL_START_BUTTONS + m_iCategory, 0);
return false;
}
- }
-
- m_iSection = focusedControl - CONTROL_START_BUTTONS;
- CreateSettings();
+ m_iCategory = focusedControl - CONTROL_START_BUTTONS;
+ CreateSettings();
+ }
+ else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
+ m_currentSetting = GetSettingControl(focusedControl);
}
return true;
}
- break;
- case GUI_MSG_LOAD_SKIN:
+
+ case GUI_MSG_CLICKED:
+ {
+ BaseSettingControlPtr control = GetSettingControl(message.GetSenderId());
+ if (control != NULL)
+ OnClick(control);
+
+ break;
+ }
+
+ case GUI_MSG_LOAD_SKIN:
{
if (IsActive())
m_returningFromSkinLoad = true;
+ break;
}
- break;
- case GUI_MSG_WINDOW_INIT:
+
+ case GUI_MSG_UPDATE_ITEM:
{
- 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();
+ if (m_delayedSetting != NULL)
+ {
+ // if updating the setting fails and param1 has been specifically set
+ // we need to call OnSettingChanged() to restore a valid value in the
+ // setting control
+ if (!m_delayedSetting->OnClick() && message.GetParam1() != 0)
+ OnSettingChanged(m_delayedSetting->GetSetting());
+ m_delayedSetting.reset();
+ return true;
}
- 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;
}
- break;
- case GUI_MSG_UPDATE:
- if (HasID(message.GetSenderId()))
+
+ case GUI_MSG_UPDATE:
{
- int focusedControl = GetFocusedControlID();
- CreateSettings();
- SET_CONTROL_FOCUS(focusedControl, 0);
+ if (IsActive() && HasID(message.GetSenderId()))
+ {
+ int focusedControl = GetFocusedControlID();
+ CreateSettings();
+ SET_CONTROL_FOCUS(focusedControl, 0);
+ }
+ break;
}
- break;
- case GUI_MSG_NOTIFY_ALL:
+
+ 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() && CDisplaySettings::Get().GetDisplayResolution() != g_graphicsContext.GetVideoResolution())
+ if (IsActive() && CDisplaySettings::Get().GetCurrentResolution() != g_graphicsContext.GetVideoResolution())
{
CDisplaySettings::Get().SetCurrentResolution(g_graphicsContext.GetVideoResolution(), true);
CreateSettings();
}
}
+ break;
}
- break;
- case GUI_MSG_WINDOW_DEINIT:
+ }
+
+ return CGUIWindow::OnMessage(message);
+}
+
+bool CGUIWindowSettingsCategory::OnAction(const CAction &action)
+{
+ switch (action.GetID())
+ {
+ case ACTION_SETTINGS_RESET:
{
- m_delayedSetting.reset();
+ if (CGUIDialogYesNo::ShowAndGetInput(10041, 0, 10042, 0))
+ {
+ for(vector<BaseSettingControlPtr>::iterator it = m_settingControls.begin(); it != m_settingControls.end(); it++)
+ {
+ CSetting *setting = (*it)->GetSetting();
+ if (setting != NULL)
+ setting->Reset();
+ }
+ }
+ return true;
+ }
- CheckForUpdates();
- CGUIWindow::OnMessage(message);
- FreeControls();
+ case ACTION_SETTINGS_LEVEL_CHANGE:
+ {
+ CViewStateSettings::Get().CycleSettingLevel();
+ CSettings::Get().Save();
+
+ // try to keep the current position
+ std::string oldCategory;
+ if (m_iCategory >= 0 && m_iCategory < (int)m_categories.size())
+ oldCategory = m_categories[m_iCategory]->GetId();
+
+ SET_CONTROL_LABEL(CONTRL_BTN_LEVELS, 10036 + (int)CViewStateSettings::Get().GetSettingLevel());
+ // only re-create the categories, the settings will be created later
+ SetupControls(false);
+
+ m_iCategory = 0;
+ // try to find the category that was previously selected
+ if (!oldCategory.empty())
+ {
+ for (int i = 0; i < (int)m_categories.size(); i++)
+ {
+ if (m_categories[i]->GetId() == oldCategory)
+ {
+ m_iCategory = i;
+ break;
+ }
+ }
+ }
+
+ CreateSettings();
+ return true;
+ }
+
+ case ACTION_SHOW_INFO:
+ {
+ int label = -1;
+ int help = -1;
+ int focusedControl = GetFocusedControlID();
+ // check if we are focusing a category
+ if (focusedControl >= CONTROL_START_BUTTONS && focusedControl < (int)(CONTROL_START_BUTTONS + m_categories.size()))
+ {
+ CSettingCategory *category = m_categories[focusedControl - CONTROL_START_BUTTONS];
+ label = category->GetLabel();
+ help = category->GetHelp();
+ }
+ else if (focusedControl >= CONTROL_START_CONTROL && focusedControl < (int)(CONTROL_START_CONTROL + m_settingControls.size()))
+ {
+ CSetting *setting = GetSettingControl(focusedControl)->GetSetting();
+ if (setting != NULL)
+ {
+ label = setting->GetLabel();
+ help = setting->GetHelp();
+ }
+ }
+ else
+ break;
+
+ if (help >= 0)
+ {
+ CGUIDialogTextViewer *dialog = (CGUIDialogTextViewer*)g_windowManager.GetWindow(WINDOW_DIALOG_TEXT_VIEWER);
+ if (dialog != NULL)
+ {
+ if (label < 0)
+ label = 10043; // "Help"
+ dialog->SetHeading(g_localizeStrings.Get(label));
+ dialog->SetText(g_localizeStrings.Get(help));
+ dialog->DoModal();
+ }
+ }
+ else
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(10043), g_localizeStrings.Get(10044), 2000U);
return true;
}
- break;
+
+ default:
+ break;
}
- return CGUIWindow::OnMessage(message);
+
+ return CGUIWindow::OnAction(action);
+}
+
+bool CGUIWindowSettingsCategory::OnBack(int actionID)
+{
+ m_settings.Save();
+ m_lastControlID = 0; // don't save the control as we go to a different window each time
+
+ return CGUIWindow::OnBack(actionID);
+}
+
+void CGUIWindowSettingsCategory::DoProcess(unsigned int currentTime, CDirtyRegionList &dirtyregions)
+{
+ // update alpha status of current button
+ bool bAlphaFaded = false;
+ CGUIControl *control = GetFirstFocusableControl(CONTROL_START_BUTTONS + m_iCategory);
+ 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::OnInitWindow()
+{
+ SetupControls();
+ CGUIWindow::OnInitWindow();
+}
+
+void CGUIWindowSettingsCategory::OnWindowLoaded()
+{
+ SET_CONTROL_LABEL(CONTRL_BTN_LEVELS, 10036 + (int)CViewStateSettings::Get().GetSettingLevel());
}
-void CGUIWindowSettingsCategory::SetupControls()
+void CGUIWindowSettingsCategory::SetupControls(bool createSettings /* = true */)
{
// 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);
{
delete m_pOriginalEdit;
m_pOriginalEdit = new CGUIEditControl(*m_pOriginalButton);
+ newOriginalEdit = true;
}
+
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 ;
+
+ CSettingSection *section = GetSection(m_iSection);
+ if (section == NULL)
+ return;
+
// update the screen string
- SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, pSettingsGroup->GetLabelID());
+ SET_CONTROL_LABEL(CONTROL_SETTINGS_LABEL, section->GetLabel());
+
// 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++)
+ m_categories = section->GetCategories(CViewStateSettings::Get().GetSettingLevel());
+
+ // go through the categories and create the necessary buttons
+ int buttonIdOffset = 0;
+ for (SettingCategoryList::const_iterator category = m_categories.begin(); category != m_categories.end(); category++)
{
- if (m_vecSections[i]->m_labelID == 12360 && !CProfilesManager::Get().IsMasterProfile())
- 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->SetLabel(g_localizeStrings.Get((*category)->GetLabel()));
+ pButton->SetID(CONTROL_START_BUTTONS + buttonIdOffset);
pButton->SetVisible(true);
pButton->AllocResources();
+
group->AddControl(pButton);
- j++;
+ buttonIdOffset++;
}
- if (m_iSection < 0 || m_iSection >= (int)m_vecSections.size())
- m_iSection = 0;
- CreateSettings();
+
+ if (createSettings)
+ CreateSettings();
+
// set focus correctly
m_defaultControl = CONTROL_START_BUTTONS;
}
-CGUIControl* CGUIWindowSettingsCategory::AddIntBasedSpinControl(CSetting *pSetting, float groupWidth, int &iControlID)
+void CGUIWindowSettingsCategory::FreeControls()
{
- CSettingInt *pSettingInt = (CSettingInt*)pSetting;
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddSetting(pSetting, groupWidth, iControlID);
- if (!pSettingInt->m_entries.empty())
+ // clear the category group
+ CGUIControlGroupList *control = (CGUIControlGroupList *)GetControl(CATEGORY_GROUP_ID);
+ if (control)
{
- 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());
+ control->FreeResources();
+ control->ClearAll();
}
- return pControl;
+ m_categories.clear();
+ FreeSettingsControls();
}
-void CGUIWindowSettingsCategory::CreateSettings()
+void CGUIWindowSettingsCategory::FreeSettingsControls()
{
- FreeSettingsControls();
+ m_currentSetting.reset();
- CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
- if (!group)
+ // clear the settings group
+ CGUIControlGroupList *control = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
+ if (control)
+ {
+ control->FreeResources();
+ control->ClearAll();
+ }
+
+ for (std::vector<BaseSettingControlPtr>::iterator control = m_settingControls.begin(); control != m_settingControls.end(); control++)
+ (*control)->Clear();
+
+ m_settingControls.clear();
+ m_settings.UnregisterCallback(this);
+}
+
+void CGUIWindowSettingsCategory::OnTimeout()
+{
+ if (m_delayedSetting == NULL)
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++)
+
+ // 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(), 1); // param1 = 1 for "reset the control if it's invalid"
+ g_windowManager.SendThreadMessage(message, GetID());
+}
+
+void CGUIWindowSettingsCategory::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL || setting->GetType() == SettingTypeNone ||
+ setting->GetType() == SettingTypeAction)
+ return;
+
+ BaseSettingControlPtr pControl = GetSettingControl(setting->GetId());
+ if (pControl == NULL)
+ return;
+
+ const SettingDependencyMap& deps = m_settings.GetDependencies(setting->GetId());
+ for (SettingDependencyMap::const_iterator depsIt = deps.begin(); depsIt != deps.end(); depsIt++)
+ {
+ for (SettingDependencies::const_iterator depIt = depsIt->second.begin(); depIt != depsIt->second.end(); depIt++)
+ UpdateControl(depsIt->first, *depIt);
+ }
+
+ // update GUI of the changed setting as the change could have been triggered by something else
+ pControl->Update();
+}
+
+void CGUIWindowSettingsCategory::UpdateControl(const std::string &dependingSetting, const CSettingDependency &dependency)
+{
+ if (dependingSetting.empty())
+ return;
+
+ BaseSettingControlPtr pControl = GetSettingControl(dependingSetting);
+ if (pControl == NULL)
+ return;
+
+ CSetting *pSetting = pControl->GetSetting();
+ if (pSetting == NULL)
+ return;
+
+ CheckDependency(pControl, dependency);
+
+ const SettingDependencyMap& deps = m_settings.GetDependencies(pSetting->GetId());
+ for (SettingDependencyMap::const_iterator depsIt = deps.begin(); depsIt != deps.end(); depsIt++)
+ {
+ for (SettingDependencies::const_iterator depIt = depsIt->second.begin(); depIt != depsIt->second.end(); depIt++)
+ UpdateControl(depsIt->first, *depIt);
+ }
+
+ // update GUI of the changed setting as the change could have been triggered by something else
+ pControl->Update();
+}
+
+void CGUIWindowSettingsCategory::CheckDependency(BaseSettingControlPtr pSettingControl, const CSettingDependency &dependency)
+{
+ if (pSettingControl == NULL || pSettingControl->GetControl() == NULL)
+ return;
+
+ CSetting *pSetting = pSettingControl->GetSetting();
+ if (pSetting == NULL)
+ return;
+
+ switch (dependency.GetType())
{
- CSetting *pSetting = settings[i];
- CStdString strSetting = pSetting->GetSetting();
- if (pSetting->GetType() == SETTINGS_TYPE_INT)
+ case SettingDependencyTypeEnable:
+ pSettingControl->SetEnabled(dependency.Check());
+ break;
+
+ case SettingDependencyTypeUpdate:
{
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)AddIntBasedSpinControl(pSetting, group->GetWidth(), iControlID);
- CSettingInt *pSettingInt = (CSettingInt*)pSetting;
- if (strSetting.Equals("videoplayer.pauseafterrefreshchange"))
- {
- pControl->AddLabel(g_localizeStrings.Get(13551), 0);
+ FillControl(pSetting, pSettingControl->GetControl());
+ break;
+ }
- 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, CDisplaySettings::Get().GetDisplayResolution());
- else if (strSetting.Equals("videoscreen.resolution"))
- FillInResolutions(strSetting, g_guiSettings.GetInt("videoscreen.screen"), CDisplaySettings::Get().GetDisplayResolution(), 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, CDisplaySettings::Get().GetDisplayResolution(), 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(!CProfilesManager::Get().GetCurrentProfile().filesLocked() || g_passwordManager.bMasterUser);
- }
- else if (strSetting.Equals("filelists.showaddsourcebuttons"))
- {
- CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
- if (pControl) pControl->SetEnabled(CProfilesManager::Get().GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser);
- }
- else if (strSetting.Equals("masterlock.startuplock"))
- {
- CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
- if (pControl) pControl->SetEnabled(CProfilesManager::Get().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(CProfilesManager::Get().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(CProfilesManager::Get().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
- ReplayGainSettings &replayGainSettings = CAudioDecoder::GetReplayGainSettings();
- replayGainSettings.iType = g_guiSettings.GetInt("musicplayer.replaygaintype");
- replayGainSettings.iPreAmp = g_guiSettings.GetInt("musicplayer.replaygainpreamp");
- replayGainSettings.iNoGainPreAmp = g_guiSettings.GetInt("musicplayer.replaygainnogainpreamp");
- replayGainSettings.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_application.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(CDisplaySettings::Get().GetCurrentResolution());
- }
- 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 = *CMediaSourceSettings::Get().GetSources("video");
- }
-
- 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
- ReplayGainSettings &replayGainSettings = CAudioDecoder::GetReplayGainSettings();
- replayGainSettings.iType = g_guiSettings.GetInt("musicplayer.replaygaintype");
- replayGainSettings.iPreAmp = g_guiSettings.GetInt("musicplayer.replaygainpreamp");
- replayGainSettings.iNoGainPreAmp = g_guiSettings.GetInt("musicplayer.replaygainnogainpreamp");
- replayGainSettings.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++);
- }
-
- }
- }
+ case SettingDependencyTypeNone:
+ default:
+ break;
}
- pControl->SetValue(iCurrentFont);
}
-void CGUIWindowSettingsCategory::FillInSkinFonts(CSetting *pSetting)
+void CGUIWindowSettingsCategory::CreateSettings()
{
- BaseSettingControlPtr setting = GetSetting(pSetting->GetSetting());
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(setting->GetID());
- pControl->SetType(SPIN_CONTROL_TYPE_TEXT);
- pControl->Clear();
- setting->SetDelayed();
+ FreeSettingsControls();
- m_SkinFontSetIDs.clear();
- int iSkinFontSet = 0;
+ if (m_categories.size() <= 0)
+ return;
- CStdString strPath = g_SkinInfo->GetSkinPath("Font.xml");
+ if (m_iCategory < 0 || m_iCategory >= (int)m_categories.size())
+ m_iCategory = 0;
- CXBMCTinyXML xmlDoc;
- if (!xmlDoc.LoadFile(strPath))
- {
- CLog::Log(LOGERROR, "Couldn't load %s", strPath.c_str());
- return ;
- }
+ CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
+ if (group == NULL)
+ return;
- TiXmlElement* pRootElement = xmlDoc.RootElement();
+ const CSettingCategory* category = m_categories.at(m_iCategory);
+ if (category == NULL)
+ return;
- CStdString strValue = pRootElement->Value();
- if (strValue != CStdString("fonts"))
- {
- CLog::Log(LOGERROR, "file %s doesnt start with <fonts>", strPath.c_str());
- return ;
- }
+ std::set<std::string> settingMap;
- const TiXmlNode *pChild = pRootElement->FirstChild();
- strValue = pChild->Value();
- if (strValue == "fontset")
+ const SettingGroupList& groups = category->GetGroups(CViewStateSettings::Get().GetSettingLevel());
+ int iControlID = CONTROL_START_CONTROL;
+ bool first = true;
+ for (SettingGroupList::const_iterator groupIt = groups.begin(); groupIt != groups.end(); groupIt++)
{
- 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 (*groupIt == NULL)
+ continue;
- 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();
- }
+ const SettingList& settings = (*groupIt)->GetSettings(CViewStateSettings::Get().GetSettingLevel());
+ if (settings.size() <= 0)
+ continue;
- }
- 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);
- }
-}
+ if (first)
+ first = false;
+ else
+ AddSeparator(group->GetWidth(), iControlID);
-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)
+ for (SettingList::const_iterator settingIt = settings.begin(); settingIt != settings.end(); settingIt++)
{
- 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());
- }
- }
+ CSetting *pSetting = *settingIt;
+ settingMap.insert(pSetting->GetId());
+ CGUIControl* pControl = AddSetting(pSetting, group->GetWidth(), iControlID);
- 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;
+ FillControl(pSetting, pControl);
}
- 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);
+ if (settingMap.size() > 0)
+ m_settings.RegisterCallback(this, settingMap);
+
+ // update our settings (turns controls on/off as appropriate)
+ UpdateSettings();
}
-DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RESOLUTION res)
+void CGUIWindowSettingsCategory::UpdateSettings()
{
- DisplayMode mode;
- if (res == RES_WINDOW)
- mode = DM_WINDOWED;
- else
- mode = CDisplaySettings::Get().GetResolutionInfo(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)
+ for (vector<BaseSettingControlPtr>::iterator it = m_settingControls.begin(); it != m_settingControls.end(); it++)
{
- control->SetDelayed();
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
- pControl->Clear();
-
- CStdString strScreen;
- if (g_advancedSettings.m_canWindowed)
- pControl->AddLabel(g_localizeStrings.Get(242), -1);
+ BaseSettingControlPtr pSettingControl = *it;
+ CSetting *pSetting = pSettingControl->GetSetting();
+ CGUIControl *pControl = pSettingControl->GetControl();
+ if (pSetting == NULL || pControl == NULL)
+ continue;
- for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++)
+ // update the setting's control's state (enabled/disabled etc)
+ const SettingDependencies &deps = pSetting->GetDependencies();
+ for (SettingDependencies::const_iterator dep = deps.begin(); dep != deps.end(); dep++)
{
- strScreen.Format(g_localizeStrings.Get(241), CDisplaySettings::Get().GetResolutionInfo(RES_DESKTOP + idx).iScreen + 1);
- pControl->AddLabel(strScreen, CDisplaySettings::Get().GetResolutionInfo(RES_DESKTOP + idx).iScreen);
+ // don't check "update" dependencies here as all the controls are already
+ // setup properly based on the existing values
+ if (dep->GetType() == SettingDependencyTypeUpdate)
+ continue;
+
+ CheckDependency(pSettingControl, *dep);
}
- pControl->SetValue(mode);
- g_guiSettings.SetInt("videoscreen.screen", mode);
- }
- return mode;
+ pSettingControl->Update();
+ }
}
-void CGUIWindowSettingsCategory::FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange)
+CGUIControl* CGUIWindowSettingsCategory::AddSetting(CSetting *pSetting, float width, int &iControlID)
{
- BaseSettingControlPtr control = GetSetting(strSetting);
- control->SetDelayed();
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
-
- pControl->Clear();
+ if (pSetting == NULL)
+ return NULL;
- RESOLUTION spinres = RES_INVALID; // index of the resolution in the spinner that has same screen/width/height as res
+ BaseSettingControlPtr pSettingControl;
+ CGUIControl *pControl = NULL;
- if (mode == DM_WINDOWED)
- {
- pControl->AddLabel(g_localizeStrings.Get(242), RES_WINDOW);
- spinres = RES_WINDOW;
- }
- else
+ switch (pSetting->GetControl().GetType())
{
- vector<RESOLUTION_WHR> resolutions = g_Windowing.ScreenResolutions(mode);
-
- for (unsigned int idx = 0; idx < resolutions.size(); idx++)
+ case SettingControlTypeCheckmark:
{
- 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 = CDisplaySettings::Get().GetResolutionInfo(res);
- RESOLUTION_INFO res2 = CDisplaySettings::Get().GetResolutionInfo(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;
- }
- }
+ pControl = new CGUIRadioButtonControl(*m_pOriginalRadioButton);
+ if (pControl == NULL)
+ return NULL;
- if (UserChange)
- {
- // Auto-select the windowed or desktop resolution of the screen
- int autoresolution = RES_DESKTOP;
- if (mode == DM_WINDOWED)
- {
- autoresolution = RES_WINDOW;
+ ((CGUIRadioButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
+ pSettingControl.reset(new CGUIControlRadioButtonSetting((CGUIRadioButtonControl *)pControl, iControlID, pSetting));
+ break;
}
- else
+
+ case SettingControlTypeSpinner:
{
- for (int idx=0; idx < g_Windowing.GetNumScreens(); idx++)
- if (CDisplaySettings::Get().GetResolutionInfo(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(CDisplaySettings::Get().GetResolutionInfo(res).iScreen,
- CDisplaySettings::Get().GetResolutionInfo(res).iScreenWidth,
- CDisplaySettings::Get().GetResolutionInfo(res).iScreenHeight,
- CDisplaySettings::Get().GetResolutionInfo(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();
+ pControl = new CGUISpinControlEx(*m_pOriginalSpin);
+ if (pControl == NULL)
+ return NULL;
- if (res == RES_WINDOW)
- {
- pControl->AddLabel(g_localizeStrings.Get(242), RES_WINDOW);
+ ((CGUISpinControlEx *)pControl)->SetText(g_localizeStrings.Get(pSetting->GetLabel()));
+ pSettingControl.reset(new CGUIControlSpinExSetting((CGUISpinControlEx *)pControl, iControlID, pSetting));
+ break;
}
- else
+
+ case SettingControlTypeEdit:
{
- for (unsigned int idx = 0; idx < refreshrates.size(); idx++)
- {
- CStdString strRR;
- strRR.Format("%.02f", refreshrates[idx].RefreshRate);
- pControl->AddLabel(strRR, refreshrates[idx].ResInfo_Index);
- }
+ pControl = new CGUIEditControl(*m_pOriginalEdit);
+ if (pControl == NULL)
+ return NULL;
+
+ ((CGUIEditControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
+ pSettingControl.reset(new CGUIControlEditSetting((CGUIEditControl *)pControl, iControlID, pSetting));
+ break;
}
- }
-
- // Select a rate
- if (UserChange)
- {
- RESOLUTION newresolution;
- if (res == RES_WINDOW)
- newresolution = RES_WINDOW;
- else
- newresolution = (RESOLUTION) g_Windowing.DefaultRefreshRate(CDisplaySettings::Get().GetResolutionInfo(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;
-
- CDisplaySettings::Get().SetCurrentResolution(nextRes, true);
- g_graphicsContext.SetVideoResolution(nextRes);
-
- if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000))
- {
- CDisplaySettings::Get().SetCurrentResolution(lastRes, true);
- 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)
+
+ case SettingControlTypeButton:
{
- 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());
+ pControl = new CGUIButtonControl(*m_pOriginalButton);
+ if (pControl == NULL)
+ return NULL;
+
+ ((CGUIButtonControl *)pControl)->SetLabel(g_localizeStrings.Get(pSetting->GetLabel()));
+ pSettingControl.reset(new CGUIControlButtonSetting((CGUIButtonControl *)pControl, iControlID, pSetting));
+ break;
}
+
+ case SettingControlTypeNone:
+ default:
+ return NULL;
}
- 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);
- }
+ if (pSetting->GetControl().GetDelayed())
+ pSettingControl->SetDelayed();
- pControl->SetValue(iCurrentLang);
+ return AddSettingControl(pControl, pSettingControl, width, iControlID);
}
-void CGUIWindowSettingsCategory::FillInRegions(CSetting *pSetting)
+CGUIControl* CGUIWindowSettingsCategory::AddSeparator(float width, int &iControlID)
{
- 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);
-}
+ if (m_pOriginalImage == NULL)
+ return NULL;
-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();
-}
+ CGUIControl *pControl = new CGUIImage(*m_pOriginalImage);
+ if (pControl == NULL)
+ return NULL;
-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);
+ return AddSettingControl(pControl, BaseSettingControlPtr(new CGUIControlSeparatorSetting((CGUIImage *)pControl, iControlID)), width, iControlID);
}
-void CGUIWindowSettingsCategory::FillInSkinColors(CSetting *pSetting)
+CGUIControl* CGUIWindowSettingsCategory::AddSettingControl(CGUIControl *pControl, BaseSettingControlPtr pSettingControl, float width, int &iControlID)
{
- // 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)
+ if (pControl == NULL)
{
- 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));
- }
+ pSettingControl.reset();
+ return NULL;
}
- 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)
+
+ pControl->SetID(iControlID++);
+ pControl->SetVisible(true);
+ pControl->SetWidth(width);
+
+ CGUIControlGroupList *group = (CGUIControlGroupList *)GetControl(SETTINGS_GROUP_ID);
+ if (group != NULL)
{
- 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);
+ pControl->AllocResources();
+ group->AddControl(pControl);
}
- // Set the Choosen Theme
- pControl->SetValue(iCurrentColor);
+ m_settingControls.push_back(pSettingControl);
+
+ return pControl;
}
-void CGUIWindowSettingsCategory::FillInStartupWindow(CSetting *pSetting)
+void CGUIWindowSettingsCategory::OnClick(BaseSettingControlPtr pSettingControl)
{
- 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
+ std::string strSetting = pSettingControl->GetSetting()->GetId();
- // 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++)
+ // we need to first set the delayed setting and then execute OnClick()
+ // because OnClick() triggers OnSettingChanged() and there we need to
+ // know if the changed setting is delayed or not
+ if (pSettingControl->IsDelayed())
{
- 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;
- }
+ m_delayedSetting = pSettingControl;
+ if (m_delayedTimer.IsRunning())
+ m_delayedTimer.Restart();
+ else
+ m_delayedTimer.Start(SETTING_DELAY);
- // 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);
+ return;
}
- 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());
+ // if changing the setting fails
+ // we need to restore the proper state
+ if (!pSettingControl->OnClick())
+ pSettingControl->Update();
}
-void CGUIWindowSettingsCategory::FillInSortMethods(CSetting *pSetting, int windowID)
+CSettingSection* CGUIWindowSettingsCategory::GetSection(int windowID) const
{
- CSettingInt *pSettingInt = (CSettingInt*)pSetting;
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
- CFileItemList items("C:");
- CGUIViewState *state = CGUIViewState::GetViewState(windowID, items);
- if (state)
+ for (size_t index = 0; index < SettingGroupSize; index++)
{
- 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);
+ if (s_settingGroupMap[index].id == windowID)
+ return m_settings.GetSection(s_settingGroupMap[index].name);
}
- pControl->SetValue(pSettingInt->GetData());
- delete state;
+
+ return NULL;
}
-void CGUIWindowSettingsCategory::FillInNetworkInterfaces(CSetting *pSetting, float groupWidth, int &iControlID)
+BaseSettingControlPtr CGUIWindowSettingsCategory::GetSettingControl(const std::string &strSetting)
{
- 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())
+ for (vector<BaseSettingControlPtr>::iterator control = m_settingControls.begin(); control != m_settingControls.end(); control++)
{
- CNetworkInterface* iface = *iter;
- vecInterfaces.push_back(iface->GetName());
- ++iter;
+ if ((*control)->GetSetting() != NULL && (*control)->GetSetting()->GetId() == strSetting)
+ return *control;
}
- sort(vecInterfaces.begin(), vecInterfaces.end(), sortstringbyname());
- int iInterface = 0;
- for (unsigned int i = 0; i < vecInterfaces.size(); ++i)
- pControl->AddLabel(vecInterfaces[i], iInterface++);
+ return BaseSettingControlPtr();
}
-void CGUIWindowSettingsCategory::FillInEpgGuideView(CSetting *pSetting)
+BaseSettingControlPtr CGUIWindowSettingsCategory::GetSettingControl(int controlId)
{
- CSettingInt *pSettingInt = (CSettingInt*)pSetting;
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
- pControl->Clear();
+ if (controlId < CONTROL_START_CONTROL || controlId >= (int)(CONTROL_START_CONTROL + m_settingControls.size()))
+ return BaseSettingControlPtr();
- 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());
+ return m_settingControls[controlId - CONTROL_START_CONTROL];
}
-void CGUIWindowSettingsCategory::FillInPvrStartLastChannel(CSetting *pSetting)
+void CGUIWindowSettingsCategory::FillControl(CSetting *pSetting, CGUIControl *pSettingControl)
{
- CSettingInt *pSettingInt = (CSettingInt*)pSetting;
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
- pControl->Clear();
+ void *filler = CSettings::Get().GetSettingOptionsFiller(pSetting);
+ if (filler == NULL)
+ return;
- 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);
+ if (pSetting->GetType() == SettingTypeInteger)
+ {
+ CSettingInt *pSettingInt = (CSettingInt*)pSetting;
- pControl->SetValue(pSettingInt->GetData());
-}
+ // get the list of options and the current option
+ IntegerSettingOptions options;
+ int currentOption = pSettingInt->GetValue();
+ ((IntegerSettingOptionsFiller)filler)(pSetting, options, currentOption);
-void CGUIWindowSettingsCategory::FillInAudioDevices(CSetting* pSetting, bool Passthrough)
-{
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(GetSetting(pSetting->GetSetting())->GetID());
- pControl->Clear();
+ // clear the spinner control
+ CGUISpinControlEx *pSpinControl = (CGUISpinControlEx *)pSettingControl;
+ pSpinControl->Clear();
- CStdString currentDevice = Passthrough ? g_guiSettings.GetString("audiooutput.passthroughdevice") : g_guiSettings.GetString("audiooutput.audiodevice");
+ // fill the spinner control
+ for (IntegerSettingOptions::const_iterator option = options.begin(); option != options.end(); option++)
+ pSpinControl->AddLabel(option->first, option->second);
- if (Passthrough)
- {
- m_DigitalAudioSinkMap.clear();
- m_DigitalAudioSinkMap["Error - no devices found"] = "null:";
- }
- else
- {
- m_AnalogAudioSinkMap.clear();
- m_AnalogAudioSinkMap["Error - no devices found"] = "null:";
- }
+ // set the current option
+ pSpinControl->SetValue(currentOption);
- 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;
+ // check if the current setting has changed
+ if (currentOption != pSettingInt->GetValue())
+ pSettingInt->SetValue(currentOption);
}
- else
+ else if (pSetting->GetType() == SettingTypeString)
{
-#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;
+ CSettingString *pSettingString = (CSettingString*)pSetting;
- i++;
- }
+ // get the list of options and the current option
+ StringSettingOptions options;
+ std::string currentOption = pSettingString->GetValue();
+ ((StringSettingOptionsFiller)filler)(pSetting, options, currentOption);
-#if !defined(TARGET_DARWIN)
- }
-#endif
+ // clear the spinner control
+ CGUISpinControlEx *pSpinControl = (CGUISpinControlEx *)pSettingControl;
+ pSpinControl->Clear();
- 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);
-}
+ // fill the spinner control
+ for (StringSettingOptions::const_iterator option = options.begin(); option != options.end(); option++)
+ pSpinControl->AddLabel(option->first, option->second);
-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
-}
+ // set the current option
+ pSpinControl->SetStringValue(currentOption);
-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());
+ // check if the current setting has changed
+ if (currentOption.compare(pSettingString->GetValue()) != 0)
+ pSettingString->SetValue(currentOption);
}
}
#pragma once
/*
- * Copyright (C) 2005-2013 Team XBMC
+ * Copyright (C) 2005-2012 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
*
*/
-#include "guilib/GUIWindow.h"
-#include "settings/GUISettings.h"
-#include "settings/windows/GUISettingControls.h"
-#include "utils/Stopwatch.h"
-
-typedef boost::shared_ptr<CGUIBaseSettingControl> BaseSettingControlPtr;
+#include <vector>
-class CGUIWindowSettingsCategory :
- public CGUIWindow
+#include "GUIControlSettings.h"
+#include "guilib/GUIWindow.h"
+#include "settings/SettingDependency.h"
+#include "settings/SettingSection.h"
+#include "settings/Settings.h"
+#include "settings/SettingsManager.h"
+#include "threads/Timer.h"
+
+typedef boost::shared_ptr<CGUIControlBaseSetting> BaseSettingControlPtr;
+
+class CGUIWindowSettingsCategory
+ : public CGUIWindow,
+ protected ITimerCallback,
+ protected ISettingCallback
{
public:
CGUIWindowSettingsCategory(void);
virtual ~CGUIWindowSettingsCategory(void);
virtual bool OnMessage(CGUIMessage &message);
+ virtual bool OnAction(const CAction &action);
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; };
+ virtual int GetID() const { return CGUIWindow::GetID() + m_iSection; };
protected:
virtual void OnInitWindow();
+ virtual void OnWindowLoaded();
+
+ virtual void SetupControls(bool createSettings = true);
+ virtual void FreeControls();
+ void FreeSettingsControls();
- 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);
+ virtual void OnTimeout();
+ virtual void OnSettingChanged(const CSetting *setting);
+
+ void UpdateControl(const std::string &dependingSetting, const CSettingDependency &dependency);
+ void CheckDependency(BaseSettingControlPtr pSettingControl, const CSettingDependency &dependency);
+
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);
+ CGUIControl* AddSeparator(float width, int &iControlID);
+ CGUIControl* AddSettingControl(CGUIControl *pControl, BaseSettingControlPtr pSettingControl, float width, int &iControlID);
+
+ /*!
+ \brief A setting control has been interacted with by the user
+
+ This method is called when the user manually interacts (clicks,
+ edits) with a setting control. It contains handling for both
+ delayed and undelayed settings and either starts the delay timer
+ or triggers the setting change which, on success, results in a
+ callback to OnSettingChanged().
+
+ \param pSettingControl Setting control that has been interacted with
+ */
+ virtual void OnClick(BaseSettingControlPtr pSettingControl);
+
+ /* TODO
+ void OnRefreshRateChanged(RESOLUTION resolution);
+
+ void FillInResolutions(CStdString strSetting, DisplayMode mode, RESOLUTION res, bool UserChange);
+ void FillInRefreshRates(CStdString strSetting, RESOLUTION res, bool UserChange);
+ */
- void ValidatePortNumber(BaseSettingControlPtr pSettingControl, const CStdString& userPort, const CStdString& privPort, bool listening=true);
+ CSettingSection* GetSection(int windowID) const;
+ BaseSettingControlPtr GetSettingControl(const std::string &setting);
+ BaseSettingControlPtr GetSettingControl(int controlId);
- std::vector<BaseSettingControlPtr> m_vecSettings;
+ void FillControl(CSetting *pSetting, CGUIControl *pSettingControl);
+
+ CSettings& m_settings;
+ SettingCategoryList m_categories;
+ std::vector<BaseSettingControlPtr> m_settingControls;
+
+ int m_iCategory;
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 newOriginalEdit;
+
+ BaseSettingControlPtr m_currentSetting; ///< Current setting control
+ BaseSettingControlPtr m_delayedSetting; ///< Current delayed setting \sa CBaseSettingControl::SetDelayed()
+ CTimer m_delayedTimer; ///< Delayed setting timer
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
};
-
#include "Application.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogYesNo.h"
#include "guilib/Key.h"
case GUI_MSG_WINDOW_DEINIT:
{
CDisplaySettings::Get().UpdateCalibrations();
- g_settings.Save();
+ CSettings::Get().Save();
g_graphicsContext.SetCalibrating(false);
g_windowManager.ShowOverlay(OVERLAY_STATE_SHOWN);
// reset our screen resolution to what it was initially
-SRCS=GUISettingControls.cpp \
+SRCS=GUIControlSettings.cpp \
GUIWindowSettings.cpp \
GUIWindowSettingsCategory.cpp \
GUIWindowSettingsScreenCalibration.cpp \
#include "Autorun.h"
#include "GUIUserMessages.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "utils/XBMCTinyXML.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "utils/JobManager.h"
#include "AutorunMediaJob.h"
-#include "settings/GUISettings.h"
#include "FileItem.h"
#include "filesystem/File.h"
void CMediaManager::OnStorageAdded(const CStdString &label, const CStdString &path)
{
- if (g_guiSettings.GetInt("audiocds.autoaction") != AUTOCD_NONE || g_guiSettings.GetBool("dvds.autorun"))
- if (g_guiSettings.GetInt("audiocds.autoaction") == AUTOCD_RIP)
+#ifdef HAS_DVD_DRIVE
+ if (CSettings::Get().GetInt("audiocds.autoaction") != AUTOCD_NONE || CSettings::Get().GetBool("dvds.autorun"))
+ if (CSettings::Get().GetInt("audiocds.autoaction") == AUTOCD_RIP)
CJobManager::GetInstance().AddJob(new CAutorunMediaJob(label, path), this, CJob::PRIORITY_LOW);
else
CJobManager::GetInstance().AddJob(new CAutorunMediaJob(label, path), this, CJob::PRIORITY_HIGH);
else
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(13021), label, TOAST_DISPLAY_TIME, false);
+#endif
}
void CMediaManager::OnStorageSafelyRemoved(const CStdString &label)
#define DECLARE_UNUSED(a,b) a __attribute__((unused)) b;
#endif
+#define PRE_SKIN_VERSION_9_10_COMPATIBILITY 1
+#define PRE_SKIN_VERSION_11_COMPATIBILITY 1
+
/*****************
* All platforms
*****************/
#define GET_G(color) ((color >> 8) & 0xFF)
#define GET_B(color) ((color >> 0) & 0xFF)
+/****************
+ * default skin
+ ****************/
+#if defined(HAS_SKIN_TOUCHED) && defined(TARGET_DARWIN_IOS) && !defined(TARGET_DARWIN_IOS_ATV2)
+#define DEFAULT_SKIN "skin.touched"
+#else
+#define DEFAULT_SKIN "skin.confluence"
+#endif
#include "filesystem/SpecialProtocol.h"
#include "powermanagement/PowerManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "Util.h"
#include <cstdio>
* that the initialization of these components won't be needed.
*/
g_powerManager.Initialize();
- g_guiSettings.Initialize();
+ CSettings::Get().Initialize();
/* Create a temporary directory and set it to be used throughout the
* test suite run.
--- /dev/null
+/*
+ * Copyright (C) 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/>.
+ *
+ */
+
+#include "BooleanLogic.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+#include "utils/XBMCTinyXML.h"
+
+bool CBooleanLogicValue::Deserialize(const TiXmlNode *node)
+{
+ if (node == NULL)
+ return false;
+
+ const TiXmlElement *elem = node->ToElement();
+ if (elem == NULL)
+ return false;
+
+ if (node->FirstChild() != NULL && node->FirstChild()->Type() == TiXmlNode::TINYXML_TEXT)
+ m_value = node->FirstChild()->ValueStr();
+
+ m_negated = false;
+ const char *strNegated = elem->Attribute("negated");
+ if (strNegated != NULL)
+ {
+ if (StringUtils::EqualsNoCase(strNegated, "true"))
+ m_negated = true;
+ else if (!StringUtils::EqualsNoCase(strNegated, "false"))
+ {
+ CLog::Log(LOGDEBUG, "CBooleanLogicValue: invalid negated value \"%s\"", strNegated);
+ return false;
+ }
+ }
+
+ return true;
+}
+
+CBooleanLogicOperation::~CBooleanLogicOperation()
+{
+ m_operations.clear();
+ m_values.clear();
+}
+
+bool CBooleanLogicOperation::Deserialize(const TiXmlNode *node)
+{
+ if (node == NULL)
+ return false;
+
+ // check if this is a simple operation with a single value directly expressed
+ // in the parent tag
+ if (node->FirstChild() == NULL || node->FirstChild()->Type() == TiXmlNode::TINYXML_TEXT)
+ {
+ CBooleanLogicValuePtr value = CBooleanLogicValuePtr(newValue());
+ if (value == NULL || !value->Deserialize(node))
+ {
+ CLog::Log(LOGDEBUG, "CBooleanLogicOperation: failed to deserialize implicit boolean value definition");
+ return false;
+ }
+
+ m_values.push_back(value);
+ return true;
+ }
+
+ const TiXmlNode *operationNode = node->FirstChild();
+ while (operationNode != NULL)
+ {
+ std::string tag = operationNode->ValueStr();
+ if (StringUtils::EqualsNoCase(tag, "and") || StringUtils::EqualsNoCase(tag, "or"))
+ {
+ CBooleanLogicOperationPtr operation = CBooleanLogicOperationPtr(newOperation());
+ if (operation == NULL)
+ return false;
+
+ operation->SetOperation(StringUtils::EqualsNoCase(tag, "and") ? BooleanLogicOperationAnd : BooleanLogicOperationOr);
+ if (!operation->Deserialize(operationNode))
+ {
+ CLog::Log(LOGDEBUG, "CBooleanLogicOperation: failed to deserialize <%s> definition", tag.c_str());
+ return false;
+ }
+
+ m_operations.push_back(operation);
+ }
+ else
+ {
+ CBooleanLogicValuePtr value = CBooleanLogicValuePtr(newValue());
+ if (value == NULL)
+ return false;
+
+ if (StringUtils::EqualsNoCase(tag, value->GetTag()))
+ {
+ if (!value->Deserialize(operationNode))
+ {
+ CLog::Log(LOGDEBUG, "CBooleanLogicOperation: failed to deserialize <%s> definition", tag.c_str());
+ return false;
+ }
+
+ m_values.push_back(value);
+ }
+ else if (operationNode->Type() == TiXmlNode::TINYXML_ELEMENT)
+ CLog::Log(LOGDEBUG, "CBooleanLogicOperation: unknown <%s> definition encountered", tag.c_str());
+ }
+
+ operationNode = operationNode->NextSibling();
+ }
+
+ return true;
+}
+
+bool CBooleanLogic::Deserialize(const TiXmlNode *node)
+{
+ if (node == NULL)
+ return false;
+
+ if (m_operation == NULL)
+ {
+ m_operation = CBooleanLogicOperationPtr(new CBooleanLogicOperation());
+
+ if (m_operation == NULL)
+ return false;
+ }
+
+ return m_operation->Deserialize(node);
+}
--- /dev/null
+#pragma once
+/*
+ * Copyright (C) 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/>.
+ *
+ */
+
+#include <string>
+#include <vector>
+
+#include <boost/shared_ptr.hpp>
+
+#include "utils/IXmlDeserializable.h"
+
+typedef enum {
+ BooleanLogicOperationOr = 0,
+ BooleanLogicOperationAnd
+} BooleanLogicOperation;
+
+class CBooleanLogicValue : public IXmlDeserializable
+{
+public:
+ CBooleanLogicValue(const std::string &value = "", bool negated = false)
+ : m_value(value), m_negated(negated)
+ { }
+ virtual ~CBooleanLogicValue() { }
+
+ virtual bool Deserialize(const TiXmlNode *node);
+
+ virtual const std::string& GetValue() const { return m_value; }
+ virtual bool IsNegated() const { return m_negated; }
+ virtual const char* GetTag() const { return "value"; }
+
+ virtual void SetValue(const std::string &value) { m_value = value; }
+ virtual void SetNegated(bool negated) { m_negated = negated; }
+
+protected:
+ std::string m_value;
+ bool m_negated;
+};
+
+typedef boost::shared_ptr<CBooleanLogicValue> CBooleanLogicValuePtr;
+typedef std::vector<CBooleanLogicValuePtr> CBooleanLogicValues;
+
+class CBooleanLogicOperation;
+typedef boost::shared_ptr<CBooleanLogicOperation> CBooleanLogicOperationPtr;
+typedef std::vector<CBooleanLogicOperationPtr> CBooleanLogicOperations;
+
+class CBooleanLogicOperation : public IXmlDeserializable
+{
+public:
+ CBooleanLogicOperation(BooleanLogicOperation op = BooleanLogicOperationAnd)
+ : m_operation(op)
+ { }
+ virtual ~CBooleanLogicOperation();
+
+ virtual bool Deserialize(const TiXmlNode *node);
+
+ virtual BooleanLogicOperation GetOperation() const { return m_operation; }
+ virtual const CBooleanLogicOperations& GetOperations() const { return m_operations; }
+ virtual const CBooleanLogicValues& GetValues() const { return m_values; }
+
+ virtual void SetOperation(BooleanLogicOperation op) { m_operation = op; }
+
+protected:
+ virtual CBooleanLogicOperation* newOperation() { return new CBooleanLogicOperation(); }
+ virtual CBooleanLogicValue* newValue() { return new CBooleanLogicValue(); }
+
+ BooleanLogicOperation m_operation;
+ CBooleanLogicOperations m_operations;
+ CBooleanLogicValues m_values;
+};
+
+class CBooleanLogic : public IXmlDeserializable
+{
+public:
+ CBooleanLogic() { }
+ virtual ~CBooleanLogic() { }
+
+ virtual bool Deserialize(const TiXmlNode *node);
+
+ virtual const CBooleanLogicOperationPtr& Get() const { return m_operation; }
+ virtual CBooleanLogicOperationPtr Get() { return m_operation; }
+
+protected:
+ CBooleanLogicOperationPtr m_operation;
+};
#include "Util.h"
#include <fribidi/fribidi.h>
#include "LangInfo.h"
+#include "guilib/LocalizeStrings.h"
+#include "settings/Setting.h"
#include "threads/SingleLock.h"
#include "log.h"
{
}
+void CCharsetConverter::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ // TODO: does this make any sense at all for subtitles and karaoke?
+ if (settingId == "subtitles.charset" ||
+ settingId == "karaoke.charset" ||
+ settingId == "locale.charset")
+ reset();
+}
+
void CCharsetConverter::clear()
{
}
{
logicalToVisualBiDi(strSource, strDest, FRIBIDI_UTF8, FRIBIDI_TYPE_RTL);
}
+
+void CCharsetConverter::SettingOptionsCharsetsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t)
+{
+ vector<CStdString> vecCharsets = g_charsetConverter.getCharsetLabels();
+ sort(vecCharsets.begin(), vecCharsets.end(), sortstringbyname());
+
+ list.push_back(make_pair(g_localizeStrings.Get(13278), "DEFAULT")); // "Default"
+ for (int i = 0; i < (int) vecCharsets.size(); ++i)
+ list.push_back(make_pair(vecCharsets[i], g_charsetConverter.getCharsetNameByLabel(vecCharsets[i])));
+}
*
*/
+#include "settings/ISettingCallback.h"
#include "threads/CriticalSection.h"
-#include "StdString.h"
#include "utils/GlobalsHandling.h"
+#include "utils/StdString.h"
#include <vector>
-class CCharsetConverter
+class CSetting;
+
+class CCharsetConverter : public ISettingCallback
{
public:
CCharsetConverter();
+ virtual void OnSettingChanged(const CSetting *setting);
+
void reset();
void clear();
void toW(const CStdStringA& source, CStdStringW& dest, const CStdStringA& enc);
void fromW(const CStdStringW& source, CStdStringA& dest, const CStdStringA& enc);
+
+ static void SettingOptionsCharsetsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string ¤t);
};
XBMC_GLOBAL(CCharsetConverter,g_charsetConverter);
#include "TextureCacheJob.h"
#include "pictures/Picture.h"
#include "profiles/ProfilesManager.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "guilib/Texture.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/LocalizeStrings.h"
items.Clear();
// now actors
- if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
+ if (CSettings::Get().GetBool("videolibrary.actorthumbs"))
{
db.GetActorsNav("videodb://movies/titles/", items, VIDEODB_CONTENT_MOVIES);
db.GetActorsNav("videodb://tvshows/titles/", items, VIDEODB_CONTENT_TVSHOWS);
--- /dev/null
+#pragma once
+/*
+ * Copyright (C) 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 TiXmlNode;
+
+class IXmlDeserializable
+{
+public:
+ virtual ~IXmlDeserializable() { }
+
+ virtual bool Deserialize(const TiXmlNode *node) = 0;
+};
*/
#include "LabelFormatter.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "RegExp.h"
#include "Util.h"
#include "video/VideoInfoTag.h"
AssembleMask(0, mask);
AssembleMask(1, mask2);
// save a bool for faster lookups
- m_hideFileExtensions = !g_guiSettings.GetBool("filelists.showextensions");
+ m_hideFileExtensions = !CSettings::Get().GetBool("filelists.showextensions");
}
CStdString CLabelFormatter::GetContent(unsigned int label, const CFileItem *item) const
Base64.cpp \
BitstreamConverter.cpp \
BitstreamStats.cpp \
+ BooleanLogic.cpp \
CharsetConverter.cpp \
CPUInfo.cpp \
Crc32.cpp \
{
ObservableMessageNone,
ObservableMessageCurrentItem,
- ObservableMessageGuiSettings,
ObservableMessageAddons,
ObservableMessageEpg,
ObservableMessageEpgContainer,
*/
#include "RssManager.h"
+#include "addons/AddonInstaller.h"
+#include "addons/AddonManager.h"
+#include "dialogs/GUIDialogYesNo.h"
#include "filesystem/File.h"
+#include "interfaces/Builtins.h"
#include "profiles/ProfilesManager.h"
+#include "settings/Setting.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
#include "utils/RssReader.h"
Clear();
}
+void CRssManager::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == "lookandfeel.rssedit")
+ {
+ ADDON::AddonPtr addon;
+ 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)");
+ }
+}
+
void CRssManager::Start()
{
m_bActive = true;
#include "threads/CriticalSection.h"
+#include "settings/ISettingCallback.h"
#include "settings/ISettingsHandler.h"
class CRssReader;
} RssSet;
typedef std::map<int, RssSet> RssUrls;
-class CRssManager : public ISettingsHandler
+class CRssManager : public ISettingCallback, public ISettingsHandler
{
public:
static CRssManager& Get();
virtual void OnSettingsLoaded();
virtual void OnSettingsCleared();
+ virtual void OnSettingAction(const CSetting *setting);
+
void Start();
void Stop();
bool Load();
#include "utils/JobManager.h"
#include "utils/URIUtils.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
+#include "settings/SettingPath.h"
+#include "settings/Settings.h"
+#include "settings/windows/GUIControlSettings.h"
using namespace std;
using namespace XFILE;
{
static bool savingScreenshots = false;
static vector<CStdString> screenShots;
-
bool promptUser = false;
+ CStdString strDir;
+
// check to see if we have a screenshot folder yet
- CStdString strDir = g_guiSettings.GetString("debug.screenshotpath", false);
+ CSettingPath *screenshotSetting = (CSettingPath*)CSettings::Get().GetSetting("debug.screenshotpath");
+ if (screenshotSetting != NULL)
+ {
+ strDir = screenshotSetting->GetValue();
+ if (strDir.empty())
+ {
+ if (CGUIControlButtonSetting::GetPath(screenshotSetting))
+ strDir = screenshotSetting->GetValue();
+ }
+ }
+
if (strDir.IsEmpty())
{
strDir = "special://temp/";
screenShots.push_back(file);
if (promptUser)
{ // grab the real directory
- CStdString newDir = g_guiSettings.GetString("debug.screenshotpath");
+ CStdString newDir;
+ if (screenshotSetting != NULL)
+ {
+ newDir = screenshotSetting->GetValue();
+ if (newDir.empty())
+ {
+ if (CGUIControlButtonSetting::GetPath(screenshotSetting))
+ newDir = screenshotSetting->GetValue();
+ }
+ }
+
if (!newDir.IsEmpty())
{
for (unsigned int i = 0; i < screenShots.size(); i++)
#include "filesystem/StackDirectory.h"
#include "network/DNSNameCache.h"
#include "settings/AdvancedSettings.h"
+#include "settings/MediaSettings.h"
#include "URL.h"
#include "StringUtils.h"
#include "Temperature.h"
#include "network/Network.h"
#include "Application.h"
-#include "settings/GUISettings.h"
#include "settings/Settings.h"
#include "guilib/GUIWindowManager.h"
#include "GUIUserMessages.h"
#include "addons/AddonManager.h"
#include "interfaces/python/XBPython.h"
#include "CharsetConverter.h"
+#include "addons/GUIDialogAddonSettings.h"
using namespace std;
using namespace ADDON;
return false;
AddonPtr addon;
- if (!ADDON::CAddonMgr::Get().GetAddon(g_guiSettings.GetString("weather.addon"), addon, ADDON_SCRIPT_WEATHER))
+ if (!ADDON::CAddonMgr::Get().GetAddon(CSettings::Get().GetString("weather.addon"), addon, ADDON_SCRIPT_WEATHER))
return false;
// initialize our sys.argv variables
*/
void CWeather::SetArea(int iLocation)
{
- g_guiSettings.SetInt("weather.currentlocation", iLocation);
- g_settings.Save();
+ CSettings::Get().SetInt("weather.currentlocation", iLocation);
+ CSettings::Get().Save();
}
/*!
*/
int CWeather::GetArea() const
{
- return g_guiSettings.GetInt("weather.currentlocation");
+ return CSettings::Get().GetInt("weather.currentlocation");
}
CJob *CWeather::GetJob() const
m_info = ((CWeatherJob *)job)->GetInfo();
CInfoLoader::OnJobComplete(jobID, success, job);
}
+
+void CWeather::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string settingId = setting->GetId();
+ if (settingId == "weather.addon")
+ Refresh();
+}
+
+void CWeather::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ const std::string settingId = setting->GetId();
+ if (settingId == "weather.addonsettings")
+ {
+ AddonPtr addon;
+ if (CAddonMgr::Get().GetAddon(CSettings::Get().GetString("weather.addon"), addon, ADDON_SCRIPT_WEATHER) && addon != NULL)
+ { // TODO: maybe have ShowAndGetInput return a bool if settings changed, then only reset weather if true.
+ CGUIDialogAddonSettings::ShowAndGetInput(addon);
+ Refresh();
+ }
+ }
+}
+
#include "InfoLoader.h"
#include "StdString.h"
+#include "settings/ISettingCallback.h"
#include "utils/GlobalsHandling.h"
#include <map>
static bool m_imagesOkay;
};
-class CWeather : public CInfoLoader
+class CWeather : public CInfoLoader,
+ public ISettingCallback
{
public:
CWeather(void);
virtual CStdString BusyInfo(int info) const;
virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job);
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
+
private:
CWeatherInfo m_info;
#undef ELEMENT
#undef COMMENT
#undef UNKNOWN
-#undef TEXT
+//#undef TEXT
#undef DECLARATION
#undef TYPECOUNT
CSingleLock waitLock(critSec);
if (!m_file)
{
- // g_advancedSettings.m_logFolder is initialized in the CSettings constructor
- // and changed in CApplication::Create()
+ // the log folder location is initialized in the CAdvancedSettings
+ // constructor and changed in CApplication::Create()
CStdString strLogFile, strLogFileOld;
strLogFile.Format("%sxbmc.log", path);
*
*/
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/CharsetConverter.h"
#include "gtest/gtest.h"
/* Add default settings for locale.
* Settings here are taken from CGUISettings::Initialize()
*/
- CSettingsCategory *loc = g_guiSettings.AddCategory(7, "locale", 14090);
- g_guiSettings.AddString(loc, "locale.language",248,"english",
+ /* TODO
+ CSettingsCategory *loc = CSettings::Get().AddCategory(7, "locale", 14090);
+ CSettings::Get().AddString(loc, "locale.language",248,"english",
SPIN_CONTROL_TEXT);
- g_guiSettings.AddString(loc, "locale.country", 20026, "USA",
+ CSettings::Get().AddString(loc, "locale.country", 20026, "USA",
SPIN_CONTROL_TEXT);
- g_guiSettings.AddString(loc, "locale.charset", 14091, "DEFAULT",
+ CSettings::Get().AddString(loc, "locale.charset", 14091, "DEFAULT",
SPIN_CONTROL_TEXT); // charset is set by the
// language file
- /* Add default settings for subtitles */
- CSettingsCategory *sub = g_guiSettings.AddCategory(5, "subtitles", 287);
- g_guiSettings.AddString(sub, "subtitles.charset", 735, "DEFAULT",
+ // Add default settings for subtitles
+ CSettingsCategory *sub = CSettings::Get().AddCategory(5, "subtitles", 287);
+ CSettings::Get().AddString(sub, "subtitles.charset", 735, "DEFAULT",
SPIN_CONTROL_TEXT);
+ */
g_charsetConverter.reset();
g_charsetConverter.clear();
~TestCharsetConverter()
{
- g_guiSettings.Clear();
+ CSettings::Get().Unload();
}
CStdStringA refstra1, refstra2, varstra1;
#include "utils/DownloadQueue.h"
#include "threads/Thread.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "test/TestUtils.h"
#include "gtest/gtest.h"
protected:
TestDownloadQueue()
{
- CSettingsCategory* net = g_guiSettings.AddCategory(4, "network", 798);
- g_guiSettings.AddBool(net, "network.usehttpproxy", 708, false);
- g_guiSettings.AddString(net, "network.httpproxyserver", 706, "",
+ CSettingsCategory* net = CSettings::Get().AddCategory(4, "network", 798);
+ CSettings::Get().AddBool(net, "network.usehttpproxy", 708, false);
+ CSettings::Get().AddString(net, "network.httpproxyserver", 706, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxyport", 730, "8080",
+ CSettings::Get().AddString(net, "network.httpproxyport", 730, "8080",
EDIT_CONTROL_NUMBER_INPUT, false, 707);
- g_guiSettings.AddString(net, "network.httpproxyusername", 1048, "",
+ CSettings::Get().AddString(net, "network.httpproxyusername", 1048, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxypassword", 733, "",
+ CSettings::Get().AddString(net, "network.httpproxypassword", 733, "",
EDIT_CONTROL_HIDDEN_INPUT,true,733);
- g_guiSettings.AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
+ CSettings::Get().AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
SPIN_CONTROL_INT_PLUS, 14048, 351);
}
~TestDownloadQueue()
{
- g_guiSettings.Clear();
+ CSettings::Get().Clear();
}
};
#include "utils/DownloadQueueManager.h"
#include "threads/Thread.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "test/TestUtils.h"
#include "gtest/gtest.h"
protected:
TestDownloadQueueManager()
{
- CSettingsCategory* net = g_guiSettings.AddCategory(4, "network", 798);
- g_guiSettings.AddBool(net, "network.usehttpproxy", 708, false);
- g_guiSettings.AddString(net, "network.httpproxyserver", 706, "",
+ /* TODO
+ CSettingsCategory* net = CSettings::Get().AddCategory(4, "network", 798);
+ CSettings::Get().AddBool(net, "network.usehttpproxy", 708, false);
+ CSettings::Get().AddString(net, "network.httpproxyserver", 706, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxyport", 730, "8080",
+ CSettings::Get().AddString(net, "network.httpproxyport", 730, "8080",
EDIT_CONTROL_NUMBER_INPUT, false, 707);
- g_guiSettings.AddString(net, "network.httpproxyusername", 1048, "",
+ CSettings::Get().AddString(net, "network.httpproxyusername", 1048, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxypassword", 733, "",
+ CSettings::Get().AddString(net, "network.httpproxypassword", 733, "",
EDIT_CONTROL_HIDDEN_INPUT,true,733);
- g_guiSettings.AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
+ CSettings::Get().AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
SPIN_CONTROL_INT_PLUS, 14048, 351);
+ */
}
~TestDownloadQueueManager()
{
- g_guiSettings.Clear();
+ CSettings::Get().Unload();
}
};
*/
#include "utils/JobManager.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/SystemInfo.h"
#include "gtest/gtest.h"
protected:
TestJobManager()
{
- CSettingsCategory* net = g_guiSettings.AddCategory(4, "network", 798);
- g_guiSettings.AddBool(net, "network.usehttpproxy", 708, false);
- g_guiSettings.AddString(net, "network.httpproxyserver", 706, "",
+ /* TODO
+ CSettingsCategory* net = CSettings::Get().AddCategory(4, "network", 798);
+ CSettings::Get().AddBool(net, "network.usehttpproxy", 708, false);
+ CSettings::Get().AddString(net, "network.httpproxyserver", 706, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxyport", 730, "8080",
+ CSettings::Get().AddString(net, "network.httpproxyport", 730, "8080",
EDIT_CONTROL_NUMBER_INPUT, false, 707);
- g_guiSettings.AddString(net, "network.httpproxyusername", 1048, "",
+ CSettings::Get().AddString(net, "network.httpproxyusername", 1048, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxypassword", 733, "",
+ CSettings::Get().AddString(net, "network.httpproxypassword", 733, "",
EDIT_CONTROL_HIDDEN_INPUT,true,733);
- g_guiSettings.AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
+ CSettings::Get().AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
SPIN_CONTROL_INT_PLUS, 14048, 351);
+ */
}
~TestJobManager()
{
- g_guiSettings.Clear();
+ CSettings::Get().Unload();
}
};
#include "utils/LabelFormatter.h"
#include "filesystem/File.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "test/TestUtils.h"
protected:
TestLabelFormatter()
{
- CSettingsCategory* fl = g_guiSettings.AddCategory(7, "filelists", 14081);
- g_guiSettings.AddBool(fl, "filelists.showparentdiritems", 13306, true);
- g_guiSettings.AddBool(fl, "filelists.showextensions", 497, true);
- g_guiSettings.AddBool(fl, "filelists.ignorethewhensorting", 13399, true);
- g_guiSettings.AddBool(fl, "filelists.allowfiledeletion", 14071, false);
- g_guiSettings.AddBool(fl, "filelists.showaddsourcebuttons", 21382, true);
- g_guiSettings.AddBool(fl, "filelists.showhidden", 21330, false);
+ /* TODO
+ CSettingsCategory* fl = CSettings::Get().AddCategory(7, "filelists", 14081);
+ CSettings::Get().AddBool(fl, "filelists.showparentdiritems", 13306, true);
+ CSettings::Get().AddBool(fl, "filelists.showextensions", 497, true);
+ CSettings::Get().AddBool(fl, "filelists.ignorethewhensorting", 13399, true);
+ CSettings::Get().AddBool(fl, "filelists.allowfiledeletion", 14071, false);
+ CSettings::Get().AddBool(fl, "filelists.showaddsourcebuttons", 21382, true);
+ CSettings::Get().AddBool(fl, "filelists.showhidden", 21330, false);
+ */
}
~TestLabelFormatter()
{
- g_guiSettings.Clear();
+ CSettings::Get().Unload();
}
};
*/
#include "utils/SystemInfo.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "GUIInfoManager.h"
#include "gtest/gtest.h"
protected:
TestSystemInfo()
{
- CSettingsCategory* net = g_guiSettings.AddCategory(4, "network", 798);
- g_guiSettings.AddBool(net, "network.usehttpproxy", 708, false);
- g_guiSettings.AddString(net, "network.httpproxyserver", 706, "",
+ CSettingsCategory* net = CSettings::Get().AddCategory(4, "network", 798);
+ CSettings::Get().AddBool(net, "network.usehttpproxy", 708, false);
+ CSettings::Get().AddString(net, "network.httpproxyserver", 706, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxyport", 730, "8080",
+ CSettings::Get().AddString(net, "network.httpproxyport", 730, "8080",
EDIT_CONTROL_NUMBER_INPUT, false, 707);
- g_guiSettings.AddString(net, "network.httpproxyusername", 1048, "",
+ CSettings::Get().AddString(net, "network.httpproxyusername", 1048, "",
EDIT_CONTROL_INPUT);
- g_guiSettings.AddString(net, "network.httpproxypassword", 733, "",
+ CSettings::Get().AddString(net, "network.httpproxypassword", 733, "",
EDIT_CONTROL_HIDDEN_INPUT,true,733);
- g_guiSettings.AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
+ CSettings::Get().AddInt(net, "network.bandwidth", 14041, 0, 0, 512, 100*1024,
SPIN_CONTROL_INT_PLUS, 14048, 351);
}
~TestSystemInfo()
{
- g_guiSettings.Clear();
+ CSettings::Get().Clear();
}
};
{
CStdString ref, var;
- /* NOTE: g_settings need to be set to find other extensions. */
+ /* NOTE: CSettings need to be set to find other extensions. */
ref = "/path/to/file";
var = "/path/to/file.xml";
URIUtils::RemoveExtension(var);
#include "filesystem/VideoDatabaseDirectory.h"
#include "filesystem/Directory.h"
#include "VideoDatabase.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/WindowIDs.h"
#include "guilib/LocalizeStrings.h"
}
else
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("videofiles");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videofiles");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
{
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
SetSortMethod(SORT_METHOD_LABEL);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavactors");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavactors");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
{
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
SetSortMethod(SORT_METHOD_LABEL);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavyears");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavyears");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
{
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%L", "","%L","")); // Label, empty | Label, empty
SetSortMethod(SORT_METHOD_VIDEO_SORT_TITLE);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavseasons");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavseasons");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
break;
case NODE_TYPE_TITLE_TVSHOWS:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
else
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
AddSortMethod(SORT_METHOD_LASTPLAYED, 568, LABEL_MASKS("%T", "%p", "%T", "%p")); // Title, #Last played | Title, #Last played
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%L","%Y","%L","%Y")); // Label, Year | Label, Year
SetSortMethod(SORT_METHOD_LABEL);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
{
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%R", "%L", "")); // Title, Rating | Label, empty
SetSortMethod(SORT_METHOD_LABEL);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
break;
case NODE_TYPE_SETS:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T","%R", "%T","%R")); // Title, Rating | Title, Rating
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%R", "%T","%R")); // Title, Rating | Title, Rating
AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
SetSortMethod(SORT_METHOD_LABEL_IGNORE_THE);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
case NODE_TYPE_TAGS:
{
SORT_METHOD method = SORT_METHOD_LABEL_IGNORE_THE;
- if (!g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (!CSettings::Get().GetBool("filelists.ignorethewhensorting"))
method = SORT_METHOD_LABEL;
AddSortMethod(method, 551, LABEL_MASKS("%T","", "%T","")); // Title, empty | Title, empty
SetSortMethod(method);
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavgenres");
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%H. %T", "%V")); // Order. Title, Playcount | empty, empty
}
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T","%R")); // Title, Rating | empty, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
{
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
else
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
}
else
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
else
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
if (params.GetSetId() > -1)
SetSortMethod(SORT_METHOD_YEAR);
else
break;
case NODE_TYPE_TITLE_MUSICVIDEOS:
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
AddSortMethod(SORT_METHOD_MPAA_RATING, 20074, LABEL_MASKS("%T", "%O"));
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T", "%Y")); // Album - Title, Year | empty, empty
if (CMediaSettings::Get().GetWatchedMode(items.GetContent()) == WatchedModeAll)
AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
}
else
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // Label, Size | Label, Size
AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Label, Date | Label, Date
AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%L", "%I", "%L", "")); // Label, Size | Label, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("videofiles");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videofiles");
SetSortMethod(viewState->m_sortMethod);
SetViewAsControl(viewState->m_viewMode);
SetSortOrder(viewState->m_sortOrder);
SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavseasons"));
break;
case NODE_TYPE_TITLE_MUSICVIDEOS:
- SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV,CViewStateSettings::Get().Get("videonavmusicvideos"));
+ SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV, CViewStateSettings::Get().Get("videonavmusicvideos"));
break;
default:
SaveViewToDb(m_items.GetPath(), WINDOW_VIDEO_NAV);
// Setup shares we want to have
m_sources.clear();
CFileItemList items;
- if (g_guiSettings.GetBool("myvideos.flatten"))
+ if (CSettings::Get().GetBool("myvideos.flatten"))
CDirectory::GetDirectory("library://video_flat/", items, "");
else
CDirectory::GetDirectory("library://video/", items, "");
CQueryParams params;
CVideoDatabaseDirectory::GetQueryParams(m_items.GetPath(),params);
if (params.GetContentType() == VIDEODB_CONTENT_MUSICVIDEOS || params.GetContentType() == 6) // recently added musicvideos
- return g_guiSettings.GetBool("musicplayer.autoplaynextitem");
+ return CSettings::Get().GetBool("musicplayer.autoplaynextitem");
- return g_guiSettings.GetBool("videoplayer.autoplaynextitem");
+ return CSettings::Get().GetBool("videoplayer.autoplaynextitem");
}
CGUIViewStateWindowVideoPlaylist::CGUIViewStateWindowVideoPlaylist(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
CGUIViewStateVideoMovies::CGUIViewStateVideoMovies(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
else
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
AddSortMethod(SORT_METHOD_MPAA_RATING, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
- CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavtitles");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
AddPlaylistOrder(items, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
else
CGUIViewStateVideoMusicVideos::CGUIViewStateVideoMusicVideos(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
AddSortMethod(SORT_METHOD_MPAA_RATING, 20074, LABEL_MASKS("%T", "%O"));
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
{
AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T", "%Y")); // Album - Title, Year | empty, empty
AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V")); // Title, Playcount | empty, empty
- CStdString strTrackLeft=g_guiSettings.GetString("musicfiles.trackformat");
- CStdString strTrackRight=g_guiSettings.GetString("musicfiles.trackformatright");
+ CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
+ CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavmusicvideos");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
AddPlaylistOrder(items, LABEL_MASKS("%A - %T", "%Y")); // Artist - Title, Year | empty, empty
else
CGUIViewStateVideoTVShows::CGUIViewStateVideoTVShows(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
else
AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavtvshows");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
AddPlaylistOrder(items, LABEL_MASKS("%T", "%M", "%T", "%M")); // Title, #Episodes | Title, #Episodes
else
CGUIViewStateVideoEpisodes::CGUIViewStateVideoEpisodes(const CFileItemList& items) : CGUIViewStateWindowVideo(items)
{
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%Z - %H. %T","%R")); // TvShow - Order. Title, Rating | empty, empty
else
AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
AddSortMethod(SORT_METHOD_PRODUCTIONCODE, 20368, LABEL_MASKS("%Z - %H. %T","%P")); // TvShow - Order. Title, Production Code | empty, empty
AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%Z - %H. %T","%J")); // TvShow - Order. Title, Date | empty, empty
}
-
- CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
+
+ const CViewState *viewState = CViewStateSettings::Get().Get("videonavepisodes");
if (items.IsSmartPlayList() || items.GetProperty("library.filter").asBoolean())
AddPlaylistOrder(items, LABEL_MASKS("%Z - %H. %T", "%R")); // TvShow - Order. Title, Rating | empty, empty
else
#include "PlayerController.h"
#include "utils/StdString.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
-#include "settings/MediaSettings.h"
#include "settings/DisplaySettings.h"
+#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "cores/IPlayer.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/GUISliderControl.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "video/dialogs/GUIDialogAudioSubtitleSettings.h"
+#include "video/windows/GUIWindowFullScreen.h"
#ifdef HAS_VIDEO_PLAYBACK
#include "cores/VideoRenderers/RenderManager.h"
#endif
case ACTION_SUBTITLE_VSHIFT_UP:
{
RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution());
- int subalign = g_guiSettings.GetInt("subtitles.align");
+ int subalign = CSettings::Get().GetInt("subtitles.align");
if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE))
{
res_info.iSubtitles ++;
case ACTION_SUBTITLE_VSHIFT_DOWN:
{
RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution());
- int subalign = g_guiSettings.GetInt("subtitles.align");
+ int subalign = CSettings::Get().GetInt("subtitles.align");
if ((subalign == SUBTITLE_ALIGN_BOTTOM_OUTSIDE) || (subalign == SUBTITLE_ALIGN_TOP_INSIDE))
{
res_info.iSubtitles--;
case ACTION_SUBTITLE_ALIGN:
{
RESOLUTION_INFO& res_info = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution());
- int subalign = g_guiSettings.GetInt("subtitles.align");
+ int subalign = CSettings::Get().GetInt("subtitles.align");
subalign++;
if (subalign > SUBTITLE_ALIGN_TOP_OUTSIDE)
res_info.iSubtitles = res_info.iHeight - 1;
- g_guiSettings.SetInt("subtitles.align", subalign);
+ CSettings::Get().SetInt("subtitles.align", subalign);
CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info,
g_localizeStrings.Get(21460),
g_localizeStrings.Get(21461 + subalign),
#include "FileItem.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/MediaSourceSettings.h"
#include "settings/Settings.h"
m_pDS->exec("CREATE TRIGGER delete_person AFTER DELETE ON actors FOR EACH ROW BEGIN DELETE FROM art WHERE media_id=old.idActor AND media_type IN ('actor','artist','writer','director'); END");
CMediaSettings::Get().SetVideoNeedsUpdate(63);
- g_settings.Save();
+ CSettings::Get().Save();
}
if (iVersion < 64)
{ // add idShow to episode table
sorting.sortBy = xsp.GetOrder();
if (xsp.GetOrderDirection() != SortOrderNone)
sorting.sortOrder = xsp.GetOrderDirection();
- if (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
sorting.sortAttributes = SortAttributeIgnoreArticle;
}
}
#include "dialogs/GUIDialogOK.h"
#include "interfaces/AnnouncementManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "utils/StringUtils.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/GUIWindowManager.h"
m_database.Open();
- if (m_showDialog && !g_guiSettings.GetBool("videolibrary.backgroundupdate"))
+ if (m_showDialog && !CSettings::Get().GetBool("videolibrary.backgroundupdate"))
{
CGUIDialogExtendedProgressBar* dialog =
(CGUIDialogExtendedProgressBar*)g_windowManager.GetWindow(WINDOW_DIALOG_EXT_PROGRESS);
// parent folder to apply the thumb to and to search for local actor thumbs
CStdString parentDir = GetParentDir(*pItem);
- if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
+ if (CSettings::Get().GetBool("videolibrary.actorthumbs"))
FetchActorThumbs(movieDetails.m_cast, actorArtPath.empty() ? parentDir : actorArtPath);
if (bApplyToDir)
ApplyThumbToFolder(parentDir, art["thumb"]);
#include "VideoInfoTag.h"
#include "utils/XMLUtils.h"
#include "guilib/LocalizeStrings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "filesystem/File.h"
#include "filesystem/DirectoryCache.h"
#include "FileItem.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "GUIUserMessages.h"
#include "guilib/GUIWindowManager.h"
#include "TextureCache.h"
m_database->SetArtForItem(info->m_iDbId, info->m_type, "thumb", thumbURL);
}
}
- else if (g_guiSettings.GetBool("myvideos.extractthumb") &&
- g_guiSettings.GetBool("myvideos.extractflags"))
+ else if (CSettings::Get().GetBool("myvideos.extractthumb") &&
+ CSettings::Get().GetBool("myvideos.extractflags"))
{
CFileItem item(*pItem);
CStdString path(item.GetPath());
}
// flag extraction
- if (g_guiSettings.GetBool("myvideos.extractflags") &&
+ if (CSettings::Get().GetBool("myvideos.extractflags") &&
(!pItem->HasVideoInfoTag() ||
!pItem->GetVideoInfoTag()->HasStreamDetails() ||
pItem->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() <= 0))
#include "addons/Skin.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/LocalizeStrings.h"
#include "pvr/PVRManager.h"
#include "cores/AudioEngine/Utils/AEUtil.h"
// only show stuff available in digital mode if we have digital output
if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO))
- AddBool(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, 252, &CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers, AUDIO_IS_BITSTREAM(g_guiSettings.GetInt("audiooutput.mode")));
+ AddBool(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, 252, &CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers, AUDIO_IS_BITSTREAM(CSettings::Get().GetInt("audiooutput.mode")));
int settings[3] = { 338, 339, 420 }; //ANALOG, IEC958, HDMI
- m_outputmode = g_guiSettings.GetInt("audiooutput.mode");
+ m_outputmode = CSettings::Get().GetInt("audiooutput.mode");
if (SupportsAudioFeature(IPC_AUD_SELECT_OUTPUT))
AddSpin(AUDIO_SETTINGS_DIGITAL_ANALOG, 337, &m_outputmode, 3, settings);
// update the screen setting...
CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = -1 - m_audioStream;
// call monkeyh1's code here...
- //bool bAudioOnAllSpeakers = (g_guiSettings.GetInt("audiooutput.mode") == AUDIO_IEC958) && CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers;
+ //bool bAudioOnAllSpeakers = (CSettings::Get().GetInt("audiooutput.mode") == AUDIO_IEC958) && CMediaSettings::Get().GetCurrentVideoSettings().m_OutputToAllSpeakers;
return;
}
}
switch(m_outputmode)
{
- case 0: g_guiSettings.SetInt("audiooutput.mode", AUDIO_ANALOG ); break;
- case 1: g_guiSettings.SetInt("audiooutput.mode", AUDIO_IEC958 ); bitstream = true; break;
- case 2: g_guiSettings.SetInt("audiooutput.mode", AUDIO_HDMI ); bitstream = true; break;
+ case 0: CSettings::Get().SetInt("audiooutput.mode", AUDIO_ANALOG ); break;
+ case 1: CSettings::Get().SetInt("audiooutput.mode", AUDIO_IEC958 ); bitstream = true; break;
+ case 2: CSettings::Get().SetInt("audiooutput.mode", AUDIO_HDMI ); bitstream = true; break;
}
EnableSettings(AUDIO_SETTINGS_OUTPUT_TO_ALL_SPEAKERS, bitstream);
if (g_application.GetCurrentPlayer() == EPC_DVDPLAYER)
strMask = ".srt|.rar|.zip|.ifo|.smi|.sub|.idx|.ass|.ssa|.txt";
VECSOURCES shares(*CMediaSourceSettings::Get().GetSources("video"));
- if (CMediaSettings::Get().GetAdditionalSubtitleDirectoryChecked() != -1 && !g_guiSettings.GetString("subtitles.custompath").IsEmpty())
+ if (CMediaSettings::Get().GetAdditionalSubtitleDirectoryChecked() != -1 && !CSettings::Get().GetString("subtitles.custompath").empty())
{
CMediaSource share;
std::vector<CStdString> paths;
CStdString strPath1;
URIUtils::GetDirectory(strPath,strPath1);
paths.push_back(strPath1);
- strPath1 = g_guiSettings.GetString("subtitles.custompath");
- paths.push_back(g_guiSettings.GetString("subtitles.custompath"));
+ strPath1 = CSettings::Get().GetString("subtitles.custompath");
+ paths.push_back(CSettings::Get().GetString("subtitles.custompath"));
share.FromNameAndPaths("video",g_localizeStrings.Get(21367),paths);
shares.push_back(share);
strPath = share.strPath;
CMediaSettings::Get().GetDefaultVideoSettings() = CMediaSettings::Get().GetCurrentVideoSettings();
CMediaSettings::Get().GetDefaultVideoSettings().m_SubtitleStream = -1;
CMediaSettings::Get().GetDefaultVideoSettings().m_AudioStream = -1;
- g_settings.Save();
+ CSettings::Get().Save();
}
}
#include "GUIDialogTeletext.h"
#include "utils/log.h"
-#include "settings/GUISettings.h"
#include "Application.h"
#include "guilib/GUITexture.h"
#include "guilib/Texture.h"
#include "guilib/LocalizeStrings.h"
#include "dialogs/GUIDialogKaiToast.h"
#include "cores/IPlayer.h"
+#include "settings/Settings.h"
using namespace std;
m_windowLoaded = true;
g_graphicsContext.SetScalingResolution(m_coordsRes, m_needsScaling);
- if (g_guiSettings.GetBool("videoplayer.teletextscale"))
+ if (CSettings::Get().GetBool("videoplayer.teletextscale"))
{
/* Fixed aspect ratio to 4:3 for teletext */
left = g_graphicsContext.ScaleFinalXCoord((float)(m_coordsRes.iWidth-m_coordsRes.iHeight*4/3)/2, 0);
#include "utils/AsyncFileCopy.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "GUIUserMessages.h"
CFileItemPtr item(new CFileItem(it->strName));
if (!it->thumb.IsEmpty())
item->SetArt("thumb", it->thumb);
- else if (g_guiSettings.GetBool("videolibrary.actorthumbs"))
+ else if (CSettings::Get().GetBool("videolibrary.actorthumbs"))
{ // backward compatibility
CStdString thumb = CScraperUrl::GetThumbURL(it->thumbUrl.GetFirstThumb());
if (!thumb.IsEmpty())
// setup plot text area
CStdString strTmp = m_movieItem->GetVideoInfoTag()->m_strPlot;
if (!(!m_movieItem->GetVideoInfoTag()->m_strShowTitle.IsEmpty() && m_movieItem->GetVideoInfoTag()->m_iSeason == 0)) // dont apply to tvshows
- if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && !g_guiSettings.GetBool("videolibrary.showunwatchedplots"))
+ if (m_movieItem->GetVideoInfoTag()->m_playCount == 0 && !CSettings::Get().GetBool("videolibrary.showunwatchedplots"))
strTmp = g_localizeStrings.Get(20370);
strTmp.Trim();
#include "guilib/GUIWindowManager.h"
#include "GUIPassword.h"
#include "utils/MathUtils.h"
-#include "settings/GUISettings.h"
#ifdef HAS_VIDEO_PLAYBACK
#include "cores/VideoRenderers/RenderManager.h"
#endif
CMediaSettings::Get().GetDefaultVideoSettings() = CMediaSettings::Get().GetCurrentVideoSettings();
CMediaSettings::Get().GetDefaultVideoSettings().m_SubtitleStream = -1;
CMediaSettings::Get().GetDefaultVideoSettings().m_AudioStream = -1;
- g_settings.Save();
+ CSettings::Get().Save();
}
}
else if (setting.id == VIDEO_SETTINGS_DEINTERLACEMODE)
#include "video/dialogs/GUIDialogFullScreenInfo.h"
#include "dialogs/GUIDialogNumeric.h"
#include "settings/DisplaySettings.h"
-#include "settings/Settings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/GUISelectButtonControl.h"
#include "FileItem.h"
#include "video/VideoReferenceClock.h"
#include "settings/AdvancedSettings.h"
#include "utils/CPUInfo.h"
-#include "settings/GUISettings.h"
#include "guilib/LocalizeStrings.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
}
else
{
- int autoCloseTime = g_guiSettings.GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
+ int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout;
CStdString strChannel;
strChannel.Format("%i", action.GetID() - REMOTE_0);
if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime)
CSingleLock lock (m_fontLock);
CStdString fontPath = "special://xbmc/media/Fonts/";
- fontPath += g_guiSettings.GetString("subtitles.font");
+ fontPath += CSettings::Get().GetString("subtitles.font");
// We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions.
RESOLUTION_INFO pal(720, 576, 0);
- CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, &pal, true);
- CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, &pal, true);
+ CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[CSettings::Get().GetInt("subtitles.color")], 0, CSettings::Get().GetInt("subtitles.height"), CSettings::Get().GetInt("subtitles.style"), false, 1.0f, 1.0f, &pal, true);
+ CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, CSettings::Get().GetInt("subtitles.height"), CSettings::Get().GetInt("subtitles.style"), true, 1.0f, 1.0f, &pal, true);
if (!subFont || !borderFont)
CLog::Log(LOGERROR, "CGUIWindowFullScreen::OnMessage(WINDOW_INIT) - Unable to load subtitle font");
else
CGUIWindow::OnMessage(message);
- g_settings.Save();
+ CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
strSizing.Format(g_localizeStrings.Get(245),
(int)info.SrcRect.Width(), (int)info.SrcRect.Height(),
(int)(info.DestRect.Width() * xscale), (int)(info.DestRect.Height() * yscale),
- CDisplaySettings::Get().GetZoomAmount(), info.videoAspectRatio*CDisplaySettings::Get().GetPixelRatio(),
+ CDisplaySettings::Get().GetZoomAmount(), info.videoAspectRatio*CDisplaySettings::Get().GetPixelRatio(),
CDisplaySettings::Get().GetPixelRatio(), CDisplaySettings::Get().GetVerticalShift());
CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW2);
msg.SetLabel(strSizing);
float maxWidth = (float) CDisplaySettings::Get().GetResolutionInfo(res).Overscan.right - CDisplaySettings::Get().GetResolutionInfo(res).Overscan.left;
m_subsLayout->Update(subtitleText, maxWidth * 0.9f, false, true); // true to force LTR reading order (most Hebrew subs are this format)
- int subalign = g_guiSettings.GetInt("subtitles.align");
+ int subalign = CSettings::Get().GetInt("subtitles.align");
float textWidth, textHeight;
m_subsLayout->GetTextExtent(textWidth, textHeight);
float x = maxWidth * 0.5f + CDisplaySettings::Get().GetResolutionInfo(res).Overscan.left;
#include "guilib/GUIWindow.h"
#include "threads/CriticalSection.h"
+enum SubtitleAlign
+{
+ SUBTITLE_ALIGN_MANUAL = 0,
+ SUBTITLE_ALIGN_BOTTOM_INSIDE,
+ SUBTITLE_ALIGN_BOTTOM_OUTSIDE,
+ SUBTITLE_ALIGN_TOP_INSIDE,
+ SUBTITLE_ALIGN_TOP_OUTSIDE
+};
+
class CGUITextLayout; // forward
class CGUIWindowFullScreen : public CGUIWindow
#include "profiles/ProfilesManager.h"
#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/dialogs/GUIDialogContentSettings.h"
#include "guilib/Key.h"
m_dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
// save current window, unless the current window is the video playlist window
- if (GetID() != WINDOW_VIDEO_PLAYLIST && g_guiSettings.GetInt("myvideos.startwindow") != GetID())
+ if (GetID() != WINDOW_VIDEO_PLAYLIST && CSettings::Get().GetInt("myvideos.startwindow") != GetID())
{
- g_guiSettings.SetInt("myvideos.startwindow", GetID());
- g_settings.Save();
+ CSettings::Get().SetInt("myvideos.startwindow", GetID());
+ CSettings::Get().Save();
}
return CGUIMediaWindow::OnMessage(message);
int iControl = message.GetSenderId();
if (iControl == CONTROL_STACK)
{
- g_guiSettings.ToggleBool("myvideos.stackvideos");
- g_settings.Save();
+ CSettings::Get().ToggleBool("myvideos.stackvideos");
+ CSettings::Get().Save();
UpdateButtons();
Update( m_vecItems->GetPath() );
}
if (nNewWindow != GetID())
{
- g_guiSettings.SetInt("myvideos.startwindow", nNewWindow);
- g_settings.Save();
+ CSettings::Get().SetInt("myvideos.startwindow", nNewWindow);
+ CSettings::Get().Save();
g_windowManager.ChangeActiveWindow(nNewWindow);
CGUIMessage msg2(GUI_MSG_SETFOCUS, nNewWindow, CONTROL_BTNTYPE);
g_windowManager.SendMessage(msg2);
OnDeleteItem(iItem);
// or be at the files window and have file deletion enabled
- else if (GetID() == WINDOW_VIDEO_FILES && g_guiSettings.GetBool("filelists.allowfiledeletion"))
+ else if (GetID() == WINDOW_VIDEO_FILES && CSettings::Get().GetBool("filelists.allowfiledeletion"))
OnDeleteItem(iItem);
// or be at the video playlists location
g_windowManager.SendMessage(msg2);
// Select the current window as default item
- int nWindow = g_guiSettings.GetInt("myvideos.startwindow")-WINDOW_VIDEO_FILES;
+ int nWindow = CSettings::Get().GetInt("myvideos.startwindow")-WINDOW_VIDEO_FILES;
CONTROL_SELECT_ITEM(CONTROL_BTNTYPE, nWindow);
CONTROL_ENABLE(CONTROL_BTNSCAN);
SET_CONTROL_LABEL(CONTROL_STACK, 14000); // Stack
- SET_CONTROL_SELECTED(GetID(), CONTROL_STACK, g_guiSettings.GetBool("myvideos.stackvideos"));
+ SET_CONTROL_SELECTED(GetID(), CONTROL_STACK, CSettings::Get().GetBool("myvideos.stackvideos"));
CONTROL_ENABLE_ON_CONDITION(CONTROL_STACK, m_stackingAvailable);
CGUIMediaWindow::UpdateButtons();
CStdString path = item->GetPath();
if (!item->m_bIsFolder && path != "add" && path != "addons://more/video" &&
path.Left(19) != "newsmartplaylist://" && path.Left(14) != "newplaylist://" && path.Left(9) != "newtag://")
- return OnFileAction(iItem, g_guiSettings.GetInt("myvideos.selectaction"));
+ return OnFileAction(iItem, CSettings::Get().GetInt("myvideos.selectaction"));
return CGUIMediaWindow::OnSelect(iItem);
}
//then add add either 'play from here' or 'play only this' depending on default behaviour
if (!(item->m_bIsFolder || item->IsScript()) && m_vecItems->Size() > 1 && itemNumber < m_vecItems->Size()-1)
{
- if (!g_guiSettings.GetBool("videoplayer.autoplaynextitem"))
+ if (!CSettings::Get().GetBool("videoplayer.autoplaynextitem"))
buttons.Add(CONTEXT_BUTTON_PLAY_AND_QUEUE, 13412);
else
buttons.Add(CONTEXT_BUTTON_PLAY_ONLY_THIS, 13434);
return;
}
- if ((g_guiSettings.GetBool("filelists.allowfiledeletion") ||
+ if ((CSettings::Get().GetBool("filelists.allowfiledeletion") ||
m_vecItems->GetPath().Equals("special://videoplaylists/")) &&
CUtil::SupportsWriteFileOperations(item->GetPath()))
CFileUtils::DeleteItem(item);
if (info && info->Content() == CONTENT_TVSHOWS)
m_stackingAvailable = false;
- if (m_stackingAvailable && !items.IsStack() && g_guiSettings.GetBool("myvideos.stackvideos"))
+ if (m_stackingAvailable && !items.IsStack() && CSettings::Get().GetBool("myvideos.stackvideos"))
items.Stack();
return bResult;
VIDEODATABASEDIRECTORY::NODE_TYPE nodeType = CVideoDatabaseDirectory::GetDirectoryChildType(m_strFilterPath);
if (items.GetContent().Equals("movies") && params.GetSetId() <= 0 &&
nodeType == NODE_TYPE_TITLE_MOVIES &&
- (g_guiSettings.GetBool("videolibrary.groupmoviesets") || (StringUtils::EqualsNoCase(group, "sets") && mixed)))
+ (CSettings::Get().GetBool("videolibrary.groupmoviesets") || (StringUtils::EqualsNoCase(group, "sets") && mixed)))
{
CFileItemList groupedItems;
if (GroupUtils::Group(GroupBySet, m_strFilterPath, items, groupedItems, GroupAttributeIgnoreSingleItems))
Update(strParentPath);
- if (pSelItem->IsVideoDb() && g_guiSettings.GetBool("myvideos.flatten"))
+ if (pSelItem->IsVideoDb() && CSettings::Get().GetBool("myvideos.flatten"))
SetHistoryForPath("");
else
SetHistoryForPath(strParentPath);
Update(strPath);
- if (pSelItem->IsVideoDb() && g_guiSettings.GetBool("myvideos.flatten"))
+ if (pSelItem->IsVideoDb() && CSettings::Get().GetBool("myvideos.flatten"))
SetHistoryForPath("");
else
SetHistoryForPath(strPath);
if (!searchItems.Size())
return;
- searchItems.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SortOrderAscending);
+ searchItems.Sort(CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SortOrderAscending);
for (int i = 0; i < searchItems.Size(); i++)
searchItems[i]->SetLabel(prependLabel + searchItems[i]->GetLabel());
results.Append(searchItems);
{
CEdenVideoArtUpdater::Start();
CMediaSettings::Get().SetVideoNeedsUpdate(0); // once is enough
- g_settings.Save();
+ CSettings::Get().Save();
}
}
}
#include "PlayListPlayer.h"
#include "video/VideoThumbLoader.h"
+enum VideoSelectAction
+{
+ SELECT_ACTION_CHOOSE = 0,
+ SELECT_ACTION_PLAY_OR_RESUME,
+ SELECT_ACTION_RESUME,
+ SELECT_ACTION_INFO,
+ SELECT_ACTION_MORE,
+ SELECT_ACTION_PLAY,
+ SELECT_ACTION_PLAYPART
+};
+
class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObserver, public IStreamDetailsObserver
{
public:
#include "Application.h"
#include "ApplicationMessenger.h"
#include "profiles/ProfilesManager.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "storage/MediaManager.h"
/* We don't want to show Autosourced items (ie removable pendrives, memorycards) in Library mode */
m_rootDir.AllowNonLocalSources(false);
- SetProperty("flattened", g_guiSettings.GetBool("myvideos.flatten"));
+ SetProperty("flattened", CSettings::Get().GetBool("myvideos.flatten"));
if (message.GetNumStringParams() && message.GetStringParam(0).Equals("Files") &&
CMediaSourceSettings::Get().GetSources("video")->empty())
{
else if (iControl == CONTROL_BTNSHOWMODE)
{
CMediaSettings::Get().CycleWatchedMode(m_vecItems->GetContent());
- g_settings.Save();
+ CSettings::Get().Save();
OnFilterItems(GetProperty("filter").asString());
return true;
}
else if (iControl == CONTROL_BTNFLATTEN)
{
- g_guiSettings.ToggleBool("myvideos.flatten");
- g_settings.Save();
- SetProperty("flattened", g_guiSettings.GetBool("myvideos.flatten"));
+ CSettings::Get().ToggleBool("myvideos.flatten");
+ CSettings::Get().Save();
+ SetProperty("flattened", CSettings::Get().GetBool("myvideos.flatten"));
CUtil::DeleteVideoDatabaseDirectoryCache();
SetupShares();
Update("");
CMediaSettings::Get().SetWatchedMode(m_vecItems->GetContent(), WatchedModeUnwatched);
else
CMediaSettings::Get().SetWatchedMode(m_vecItems->GetContent(), WatchedModeAll);
- g_settings.Save();
+ CSettings::Get().Save();
OnFilterItems(GetProperty("filter").asString());
return true;
}
Similarly, we assign the "clean" library labels to the item only if the "Replace filenames with library titles"
setting is enabled.
*/
- const bool stackItems = items.GetProperty("isstacked").asBoolean() || (StackingAvailable(items) && g_guiSettings.GetBool("myvideos.stackvideos"));
- const bool replaceLabels = allowReplaceLabels && g_guiSettings.GetBool("myvideos.replacelabels");
+ const bool stackItems = items.GetProperty("isstacked").asBoolean() || (StackingAvailable(items) && CSettings::Get().GetBool("myvideos.stackvideos"));
+ const bool replaceLabels = allowReplaceLabels && CSettings::Get().GetBool("myvideos.replacelabels");
CFileItemList dbItems;
/* NOTE: In the future when GetItemsForPath returns all items regardless of whether they're "in the library"
SET_CONTROL_SELECTED(GetID(),CONTROL_BTNPARTYMODE, g_partyModeManager.IsEnabled());
- SET_CONTROL_SELECTED(GetID(),CONTROL_BTNFLATTEN, g_guiSettings.GetBool("myvideos.flatten"));
+ SET_CONTROL_SELECTED(GetID(),CONTROL_BTNFLATTEN, CSettings::Get().GetBool("myvideos.flatten"));
}
bool CGUIWindowVideoNav::GetFilteredItems(const CStdString &filter, CFileItemList &items)
if (URIUtils::HasSlashAtEnd(strDeletePath))
pItem->m_bIsFolder=true;
- if (g_guiSettings.GetBool("filelists.allowfiledeletion") &&
+ if (CSettings::Get().GetBool("filelists.allowfiledeletion") &&
CUtil::SupportsWriteFileOperations(strDeletePath))
{
pItem->SetPath(strDeletePath);
if (!m_vecItems->IsVideoDb() && !m_vecItems->IsVirtualDirectoryRoot())
{ // non-video db items, file operations are allowed
- if ((g_guiSettings.GetBool("filelists.allowfiledeletion") &&
+ if ((CSettings::Get().GetBool("filelists.allowfiledeletion") &&
CUtil::SupportsWriteFileOperations(item->GetPath())) ||
(inPlaylists && !URIUtils::GetFileName(item->GetPath()).Equals("PartyMode-Video.xsp")
&& (item->IsPlayList() || item->IsSmartPlayList())))
int iSelectedLabel = 0;
if (list.Size() > 1)
{
- list.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SortOrderAscending);
+ list.Sort(CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SortOrderAscending);
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
pDialog->SetItems(&list);
#include "guilib/GUIKeyboardFactory.h"
#include "GUIUserMessages.h"
#include "Favourites.h"
-#include "settings/Settings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSettings.h"
+#include "settings/Settings.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
#include "utils/log.h"
{
g_playlistPlayer.SetShuffle(PLAYLIST_VIDEO, !(g_playlistPlayer.IsShuffled(PLAYLIST_VIDEO)));
CMediaSettings::Get().SetVideoPlaylistShuffled(g_playlistPlayer.IsShuffled(PLAYLIST_VIDEO));
- g_settings.Save();
+ CSettings::Get().Save();
UpdateButtons();
Refresh();
}
// save settings
CMediaSettings::Get().SetVideoPlaylistRepeat(g_playlistPlayer.GetRepeat(PLAYLIST_VIDEO) == PLAYLIST::REPEAT_ALL);
- g_settings.Save();
+ CSettings::Get().Save();
UpdateButtons();
}
{
// need 2 rename it
CStdString strPath, strFolder;
- URIUtils::AddFileToFolder(g_guiSettings.GetString("system.playlistspath"), "video", strFolder);
+ URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video", strFolder);
strNewFileName = CUtil::MakeLegalFileName(strNewFileName);
strNewFileName += ".m3u";
URIUtils::AddFileToFolder(strFolder, strNewFileName, strPath);
#include "addons/AddonManager.h"
#include "addons/PluginSource.h"
#include "view/ViewState.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
#include "settings/MediaSourceSettings.h"
#include "settings/Settings.h"
void CGUIViewState::SetCurrentSortMethod(int method)
{
- bool ignoreThe = g_guiSettings.GetBool("filelists.ignorethewhensorting");
+ bool ignoreThe = CSettings::Get().GetBool("filelists.ignorethewhensorting");
if (method < SORT_METHOD_NONE || method >= SORT_METHOD_MAX)
return; // invalid
bool CGUIViewState::HideExtensions()
{
- return !g_guiSettings.GetBool("filelists.showextensions");
+ return !CSettings::Get().GetBool("filelists.showextensions");
}
bool CGUIViewState::HideParentDirItems()
{
- return !g_guiSettings.GetBool("filelists.showparentdiritems");
+ return !CSettings::Get().GetBool("filelists.showparentdiritems");
}
bool CGUIViewState::DisableAddSourceButtons()
{
if (CProfilesManager::Get().GetCurrentProfile().canWriteSources() || g_passwordManager.bMasterUser)
- return !g_guiSettings.GetBool("filelists.showaddsourcebuttons");
+ return !CSettings::Get().GetBool("filelists.showaddsourcebuttons");
return true;
}
if (db.Open())
{
CViewState state;
- if (db.GetViewState(path, windowID, state, g_guiSettings.GetString("lookandfeel.skin")) ||
+ if (db.GetViewState(path, windowID, state, CSettings::Get().GetString("lookandfeel.skin")) ||
db.GetViewState(path, windowID, state, ""))
{
SetViewAsControl(state.m_viewMode);
CViewState state(m_currentViewAsControl, GetSortMethod(), m_sortOrder);
if (viewState)
*viewState = state;
- db.SetViewState(path, windowID, state, g_guiSettings.GetString("lookandfeel.skin"));
+ db.SetViewState(path, windowID, state, CSettings::Get().GetString("lookandfeel.skin"));
db.Close();
if (viewState)
- g_settings.Save();
+ CSettings::Get().Save();
}
}
SortBy sortBy = (SortBy)items.GetProperty(PROPERTY_SORT_ORDER).asInteger();
if (sortBy != SortByNone)
{
- sortMethod = SortUtils::TranslateOldSortMethod(sortBy, g_guiSettings.GetBool("filelists.ignorethewhensorting"));
+ sortMethod = SortUtils::TranslateOldSortMethod(sortBy, CSettings::Get().GetBool("filelists.ignorethewhensorting"));
if (sortMethod == SORT_METHOD_NONE)
sortMethod = SORT_METHOD_PLAYLIST_ORDER;
else
#define XML_VIEWMODE "viewmode"
#define XML_SORTMETHOD "sortmethod"
#define XML_SORTORDER "sortorder"
+#define XML_GENERAL "general"
+#define XML_SETTINGLEVEL "settinglevel"
using namespace std;
AddViewState("pictures", DEFAULT_VIEW_AUTO);
AddViewState("videofiles", DEFAULT_VIEW_AUTO);
AddViewState("musicfiles", DEFAULT_VIEW_AUTO);
+
+ Clear();
}
CViewStateSettings::~CViewStateSettings()
viewState->second->m_sortOrder = (SortOrder)sortOrder;
}
+ pElement = settings->FirstChild(XML_GENERAL);
+ if (pElement != NULL)
+ {
+ int settingLevel;
+ if (XMLUtils::GetInt(pElement, XML_SETTINGLEVEL, settingLevel, (const int)SettingLevelBasic, (const int)SettingLevelExpert))
+ m_settingLevel = (SettingLevel)settingLevel;
+ else
+ m_settingLevel = SettingLevelStandard;
+ }
+
return true;
}
XMLUtils::SetInt(pNewNode, XML_VIEWMODE, viewState->second->m_viewMode);
XMLUtils::SetInt(pNewNode, XML_SORTMETHOD, (int)viewState->second->m_sortMethod);
XMLUtils::SetInt(pNewNode, XML_SORTORDER, (int)viewState->second->m_sortOrder);
+ }
+ TiXmlNode *generalNode = settings->FirstChild(XML_GENERAL);
+ if (generalNode == NULL)
+ {
+ TiXmlElement generalElement(XML_GENERAL);
+ generalNode = settings->InsertEndChild(generalElement);
+ if (generalNode == NULL)
+ return false;
}
+ XMLUtils::SetInt(generalNode, XML_SETTINGLEVEL, (int)m_settingLevel);
+
return true;
}
+void CViewStateSettings::Clear()
+{
+ m_settingLevel = SettingLevelStandard;
+}
+
const CViewState* CViewStateSettings::Get(const std::string &viewState) const
{
CSingleLock lock(m_critical);
return NULL;
}
+void CViewStateSettings::SetSettingLevel(SettingLevel settingLevel)
+{
+ if (settingLevel < SettingLevelBasic)
+ m_settingLevel = SettingLevelBasic;
+ if (settingLevel > SettingLevelExpert)
+ m_settingLevel = SettingLevelExpert;
+ else
+ m_settingLevel = settingLevel;
+}
+
+void CViewStateSettings::CycleSettingLevel()
+{
+ m_settingLevel = (SettingLevel)((int)m_settingLevel + 1);
+ if (m_settingLevel > SettingLevelExpert)
+ m_settingLevel = SettingLevelBasic;
+}
+
void CViewStateSettings::AddViewState(const std::string& strTagName, int defaultView /* = DEFAULT_VIEW_LIST */, SORT_METHOD defaultSort /* = SORT_METHOD_LABEL */)
{
if (strTagName.empty() || m_viewStates.find(strTagName) != m_viewStates.end())
#include "ViewState.h"
#include "guilib/GraphicContext.h"
#include "settings/ISubSettings.h"
+#include "settings/Setting.h"
#include "threads/CriticalSection.h"
class TiXmlNode;
virtual bool Load(const TiXmlNode *settings);
virtual bool Save(TiXmlNode *settings) const;
+ virtual void Clear();
const CViewState* Get(const std::string &viewState) const;
CViewState* Get(const std::string &viewState);
+ SettingLevel GetSettingLevel() const { return m_settingLevel; }
+ void SetSettingLevel(SettingLevel settingLevel);
+ void CycleSettingLevel();
+
protected:
CViewStateSettings();
CViewStateSettings(const CViewStateSettings&);
private:
std::map<std::string, CViewState*> m_viewStates;
+ SettingLevel m_settingLevel;
CCriticalSection m_critical;
void AddViewState(const std::string& strTagName, int defaultView = DEFAULT_VIEW_LIST, SORT_METHOD defaultSort = SORT_METHOD_LABEL);
g_AnnouncePreset.Init(m_pScriptEngine, "ANNOUNCE");
g_AnnouncePreset.m_presetId = 3;
- if ( g_Settings.PresetLocked )
+ if ( CSettings::Get().PresetLocked )
{
// Check that the preset locked in the settings file is still valid
if ( g_currPresetId >= g_PresetFiles.NumFiles() || g_currPresetId < 0 )
g_currPresetId = GetRandomPreset();
}
}
- else if ( g_Settings.RandomPresetsEnabled )
+ else if ( CSettings::Get().RandomPresetsEnabled )
{
g_currPresetId = GetRandomPreset();
}
char filename[ 256 ];
sprintf( filename, "%s%s", g_PresetPath, g_PresetFiles.GetFilename( g_currPresetId ) );
g_presets[ 0 ]->Begin( filename );
- g_mainCounter = g_Settings.TimeBetweenPresets + ((rand() % 100) / 100.0f) * g_Settings.TimeBetweenPresetsRand;
+ g_mainCounter = CSettings::Get().TimeBetweenPresets + ((rand() % 100) / 100.0f) * CSettings::Get().TimeBetweenPresetsRand;
g_currentState = STATE_RENDER_PRESET;
}
case STATE_RENDER_PRESET:
{
// OutputDebugString("STATE = STATE_RENDER_PRESET\n");
- if ( !g_Settings.PresetLocked )
+ if ( !CSettings::Get().PresetLocked )
{
g_mainCounter -= g_timePass;
}
if ( g_mainCounter <= 0 )
{
// Not in a transition, preset not locked and time for a new preset
- if ( g_Settings.RandomPresetsEnabled )
+ if ( CSettings::Get().RandomPresetsEnabled )
{
int nextPreset = GetRandomPreset();
if ( nextPreset == g_currPresetId )
}
g_finished = true;
- g_mainCounter = g_Settings.TimeBetweenPresets + ((rand() % 100) / 100.0f) * g_Settings.TimeBetweenPresetsRand;
+ g_mainCounter = CSettings::Get().TimeBetweenPresets + ((rand() % 100) / 100.0f) * CSettings::Get().TimeBetweenPresetsRand;
// Load preset
sprintf(filename, "%s%s", g_PresetPath, g_PresetFiles.GetFilename( g_currPresetId ) );
if ( g_presets[ 1 ]->Begin( filename ) == true )
{
// Load and begin transition
- if ( g_Settings.TransitionsEnabled && g_TransitionFiles.NumFiles() != 0 )
+ if ( CSettings::Get().TransitionsEnabled && g_TransitionFiles.NumFiles() != 0 )
{
g_transitionId = ( g_transitionId + 1 ) % g_TransitionFiles.NumFiles();
sprintf( filename, "%s%s", g_TransitionPath, g_TransitionFiles.GetFilename( g_transitionId ) );
// OutputDebugString("STATE = STATE_TRANSITION\n");
if (g_finished)
{
- g_mainCounter = g_Settings.TimeBetweenPresets + ((rand() % 100) / 100.0f) * g_Settings.TimeBetweenPresetsRand;
+ g_mainCounter = CSettings::Get().TimeBetweenPresets + ((rand() % 100) / 100.0f) * CSettings::Get().TimeBetweenPresetsRand;
SwapPresets();
g_finished = false;
// Renderer::Rect( -1.0, -1.0, 1.0, 1.0, 0xff000000 );
/*
- if ( g_Settings.ShowAudioAnalysis )
+ if ( CSettings::Get().ShowAudioAnalysis )
{
FLOAT BAR_WIDTH = 1.0f / 128;
/ *
}
*/
- if( g_Settings.ShowDebugConsole )
+ if( CSettings::Get().ShowDebugConsole )
{
DebugConsole::Render();
}
- if( g_Settings.ShowFPS )
+ if( CSettings::Get().ShowFPS )
{
char FrameRate[256];
sprintf_s(FrameRate, 256, "FPS = %0.02f\n", fFPS );
*/
#include "WIN32Util.h"
-#include "settings/GUISettings.h"
#include "Util.h"
#include "utils/URIUtils.h"
#include "storage/cdioSupport.h"
CloseHandle(deviceHandle);
return BusTypeUsb == busType;
- }
\ No newline at end of file
+ }
*/
#include "URL.h"
-#include "settings/GUISettings.h"
#if _MSC_VER > 1400
#include "Cfgmgr32.h"
#endif
#include "MediaSource.h"
-#include "utils/Stopwatch.h"
#include "guilib/Geometry.h"
+#include "powermanagement/PowerManager.h"
+#include "utils/Stopwatch.h"
enum Drive_Types
{
*
*/
-#include "settings/AdvancedSettings.h"
#include "AppParamParser.h"
+#include "settings/AdvancedSettings.h"
#include "utils/CharsetConverter.h"
#include "utils/log.h"
#include "threads/platform/win/Win32Exception.h"
#include "guilib/GraphicContext.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
using namespace std;
bool CWinSystemBase::UseLimitedColor()
{
#if defined(HAS_GL) || defined(HAS_DX)
- static CSettingBool* setting = (CSettingBool*)g_guiSettings.GetSetting("videoscreen.limitedrange");
- return setting->GetData();
+ static CSettingBool* setting = (CSettingBool*)CSettings::Get().GetSetting("videoscreen.limitedrange");
+ return setting->GetValue();
#else
return false;
#endif
#include "filesystem/SpecialProtocol.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
+#include "settings/DisplaySettings.h"
#include "guilib/Texture.h"
#include "windowing/X11/XRandR.h"
#include <vector>
#include "guilib/GraphicContext.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
+#include "settings/DisplaySettings.h"
#include "utils/log.h"
#include "EGLWrapper.h"
#include "EGLQuirks.h"
RESOLUTION_INFO &curr = CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution());
// if we are using automatic hdmi mode switching
- if (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
+ if (CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
{
int searchWidth = curr.iScreenWidth;
int searchHeight = curr.iScreenHeight;
#include "utils/log.h"
#include "filesystem/SpecialProtocol.h"
#include "settings/DisplaySettings.h"
-#include "settings/Settings.h"
#include "guilib/GraphicContext.h"
#include "guilib/Texture.h"
#include <vector>
#include "guilib/GUIWindowManager.h"
#include "settings/DisplaySettings.h"
#include "settings/Settings.h"
-#include "settings/GUISettings.h"
+#include "settings/DisplaySettings.h"
#include "input/KeyboardStat.h"
#include "threads/SingleLock.h"
#include "utils/log.h"
// send pre-configuration change now and do not
// wait for switch videomode callback. This gives just
// a little more advanced notice of the display pre-change.
- if (g_guiSettings.GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
+ if (CSettings::Get().GetInt("videoplayer.adjustrefreshrate") != ADJUST_REFRESHRATE_OFF)
CheckDisplayChanging(kCGDisplayBeginConfigurationFlag);
// switch videomode
last_window_screen = [[last_view window] screen];
last_window_origin = [[last_view window] frame].origin;
- if (g_guiSettings.GetBool("videoscreen.fakefullscreen"))
+ if (CSettings::Get().GetBool("videoscreen.fakefullscreen"))
{
// This is Cocca Windowed FullScreen Mode
// Get the screen rect of our current display
if (GetDisplayID(res.iScreen) == kCGDirectMainDisplay)
SetMenuBarVisible(true);
- if (g_guiSettings.GetBool("videoscreen.fakefullscreen"))
+ if (CSettings::Get().GetBool("videoscreen.fakefullscreen"))
{
// restore the windowed window level
[[last_view window] setLevel:NSNormalWindowLevel];
#include "guilib/GUIControl.h" // for EVENT_RESULT
#include "powermanagement/windows/Win32PowerSyscall.h"
#include "Shlobj.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/Settings.h"
#include "peripherals/Peripherals.h"
#include "utils/JobManager.h"
#include "network/Zeroconf.h"
case SC_MONITORPOWER:
if (g_application.IsPlaying() || g_application.IsPaused())
return 0;
- else if(g_guiSettings.GetInt("powermanagement.displaysoff") == 0)
+ else if(CSettings::Get().GetInt("powermanagement.displaysoff") == 0)
return 0;
break;
case SC_SCREENSAVE:
#include "WinEventsWin32.h"
#include "resource.h"
#include "guilib/gui3d.h"
-#include "settings/DisplaySettings.h"
-#include "settings/GUISettings.h"
#include "settings/AdvancedSettings.h"
+#include "settings/DisplaySettings.h"
+#include "settings/Settings.h"
#include "utils/log.h"
#ifdef _WIN32
{
m_IsAlteringWindow = true;
- CLog::Log(LOGDEBUG, "%s (%s) on screen %d with size %dx%d, refresh %f%s", __FUNCTION__, !fullScreen ? "windowed" : (g_guiSettings.GetBool("videoscreen.fakefullscreen") ? "windowed fullscreen" : "true fullscreen"), res.iScreen, res.iWidth, res.iHeight, res.fRefreshRate, (res.dwFlags & D3DPRESENTFLAG_INTERLACED) ? "i" : "");
+ CLog::Log(LOGDEBUG, "%s (%s) on screen %d with size %dx%d, refresh %f%s", __FUNCTION__, !fullScreen ? "windowed" : (CSettings::Get().GetBool("videoscreen.fakefullscreen") ? "windowed fullscreen" : "true fullscreen"), res.iScreen, res.iWidth, res.iHeight, res.fRefreshRate, (res.dwFlags & D3DPRESENTFLAG_INTERLACED) ? "i" : "");
bool forceResize = false;
m_nHeight = res.iHeight;
m_bBlankOtherDisplay = blankOtherDisplays;
- if (fullScreen && g_guiSettings.GetBool("videoscreen.fakefullscreen"))
+ if (fullScreen && CSettings::Get().GetBool("videoscreen.fakefullscreen"))
ChangeResolution(res);
ResizeInternal(forceResize);
#include "WinSystemWin32DX.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "guilib/gui3d.h"
#ifdef HAS_DX
bool CWinSystemWin32DX::UseWindowedDX(bool fullScreen)
{
- return (g_guiSettings.GetBool("videoscreen.fakefullscreen") || !fullScreen);
+ return (CSettings::Get().GetBool("videoscreen.fakefullscreen") || !fullScreen);
}
bool CWinSystemWin32DX::CreateNewWindow(CStdString name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction)
*/
#include "WinSystemWin32GL.h"
#include "WIN32Util.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "guilib/gui3d.h"
#ifdef HAS_GL
CWIN32Util::CheckGLVersion();
- g_guiSettings.SetBool("videoscreen.fakefullscreen", true);
+ CSettings::Get().SetBool("videoscreen.fakefullscreen", true);
return true;
}
#include "dialogs/GUIDialogProgress.h"
#include "profiles/ProfilesManager.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "URL.h"
#include "dialogs/GUIDialogSmartPlaylistEditor.h"
SortDescription sorting;
sorting.sortBy = sortBy;
sorting.sortOrder = items.GetProperty(PROPERTY_SORT_ASCENDING).asBoolean() ? SortOrderAscending : SortOrderDescending;
- sorting.sortAttributes = g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone;
+ sorting.sortAttributes = CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone;
// if the sort order is descending, we need to switch the original sort order, as we assume
// in CGUIViewState::AddPlaylistOrder that SORT_METHOD_PLAYLIST_ORDER is ascending.
}
// If karaoke song is being played AND popup autoselector is enabled, the playlist should not be added
- bool do_not_add_karaoke = g_guiSettings.GetBool("karaoke.enabled") &&
- g_guiSettings.GetBool("karaoke.autopopupselector") && pItem->IsKaraoke();
+ bool do_not_add_karaoke = CSettings::Get().GetBool("karaoke.enabled") &&
+ CSettings::Get().GetBool("karaoke.autopopupselector") && pItem->IsKaraoke();
bool autoplay = m_guiState.get() && m_guiState->AutoPlayNextItem();
if (m_vecItems->IsPlugin())
#include "playlists/PlayList.h"
#include "utils/AsyncFileCopy.h"
#include "storage/MediaManager.h"
-#include "settings/Settings.h"
#include "settings/AdvancedSettings.h"
-#include "settings/GUISettings.h"
#include "settings/MediaSourceSettings.h"
+#include "settings/Settings.h"
#include "input/MouseStat.h"
#include "guilib/LocalizeStrings.h"
#include "utils/StringUtils.h"
void CGUIWindowFileManager::UpdateButtons()
{
-
- /*
- // Update sorting control
- bool bSortOrder=false;
- if ( m_bViewSource )
- {
- if (m_strSourceDirectory.IsEmpty())
- bSortOrder=g_settings.m_bMyFilesSourceRootSortOrder;
- else
- bSortOrder=g_settings.m_bMyFilesSourceSortOrder;
- }
- else
- {
- if (m_strDestDirectory.IsEmpty())
- bSortOrder=g_settings.m_bMyFilesDestRootSortOrder;
- else
- bSortOrder=g_settings.m_bMyFilesDestSortOrder;
- }
-
- if (bSortOrder)
- {
- CGUIMessage msg(GUI_MSG_DESELECTED,GetID(), CONTROL_BTNSORTASC);
- g_windowManager.SendMessage(msg);
- }
- else
- {
- CGUIMessage msg(GUI_MSG_SELECTED,GetID(), CONTROL_BTNSORTASC);
- g_windowManager.SendMessage(msg);
- }
-
- */
// update our current directory labels
CStdString strDir = CURL(m_Directory[0]->GetPath()).GetWithoutUserDetails();
if (strDir.IsEmpty())
CStdString strParentPath;
URIUtils::GetParentPath(strDirectory, strParentPath);
- if (strDirectory.IsEmpty() && (m_vecItems[iList]->Size() == 0 || g_guiSettings.GetBool("filelists.showaddsourcebuttons")))
+ if (strDirectory.IsEmpty() && (m_vecItems[iList]->Size() == 0 || CSettings::Get().GetBool("filelists.showaddsourcebuttons")))
{ // add 'add source button'
CStdString strLabel = g_localizeStrings.Get(1026);
CFileItemPtr pItem(new CFileItem(strLabel));
pItem->SetSpecialSort(SortSpecialOnBottom);
m_vecItems[iList]->Add(pItem);
}
- else if (items.IsEmpty() || g_guiSettings.GetBool("filelists.showparentdiritems"))
+ else if (items.IsEmpty() || CSettings::Get().GetBool("filelists.showparentdiritems"))
{
CFileItemPtr pItem(new CFileItem(".."));
pItem->SetPath(m_rootDir.IsSource(strDirectory) ? "" : strParentPath);
#include "GUIUserMessages.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogOK.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "FileItem.h"
#include "guilib/Key.h"
#include "guilib/LocalizeStrings.h"
if (choice == 3)
{
if (g_passwordManager.CheckLock(CProfilesManager::Get().GetMasterProfile().getLockMode(),CProfilesManager::Get().GetMasterProfile().getLockCode(),20075))
- g_passwordManager.iMasterLockRetriesLeft = g_guiSettings.GetInt("masterlock.maxretries");
+ g_passwordManager.iMasterLockRetriesLeft = CSettings::Get().GetInt("masterlock.maxretries");
else // be inconvenient
CApplicationMessenger::Get().Shutdown();
#include "addons/AddonManager.h"
#include "Application.h"
#include "GUIPassword.h"
-#include "settings/GUISettings.h"
+#include "settings/Settings.h"
#include "GUIUserMessages.h"
#include "guilib/GUIWindowManager.h"
#include "threads/SingleLock.h"
m_addon.reset();
// Setup new screensaver instance
AddonPtr addon;
- if (!CAddonMgr::Get().GetAddon(g_guiSettings.GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
+ if (!CAddonMgr::Get().GetAddon(CSettings::Get().GetString("screensaver.mode"), addon, ADDON_SCREENSAVER))
return false;
m_addon = boost::dynamic_pointer_cast<CScreenSaver>(addon);
#include "GUIWindowWeather.h"
#include "guilib/GUIImage.h"
#include "utils/Weather.h"
-#include "settings/GUISettings.h"
#include "guilib/GUIWindowManager.h"
#include "utils/URIUtils.h"
#ifdef HAS_PYTHON