aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Amland <thomas.amland@gmail.com>2015-07-07 18:16:49 +0200
committerThomas Amland <thomas.amland@gmail.com>2015-08-08 19:12:17 +0200
commit9f5d962b84bc5c93ffbc0733ff207d3fa1be2e6c (patch)
treeaa83c8d30ad67cce6f27d8216f44e1913f3505c4
parent7909aa4e50d56f17886d3b9e4f4019c9490285ed (diff)
change ui sound system to addons only
remove loading from load sounds from skin dir, system/sounds, user/sounds and support directory based themes to unify it with skins, langauges etc.
-rw-r--r--system/settings/settings.xml12
-rw-r--r--xbmc/Application.cpp23
-rw-r--r--xbmc/addons/Skin.cpp44
-rw-r--r--xbmc/addons/Skin.h1
-rw-r--r--xbmc/guilib/GUIAudioManager.cpp37
-rw-r--r--xbmc/settings/Settings.cpp2
6 files changed, 26 insertions, 93 deletions
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 3b1cb6bc35..316f19811b 100644
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -79,19 +79,19 @@
</dependencies>
<control type="list" format="string" />
</setting>
- <setting id="lookandfeel.soundskin" type="string" label="15108" help="36110">
+ <setting id="lookandfeel.soundskin" type="addon" label="15108" help="36110">
<level>0</level>
<default>resource.uisounds.confluence</default>
<constraints>
- <options>skinsounds</options>
+ <addontype>kodi.resource.uisounds</addontype>
+ <allowempty>true</allowempty>
</constraints>
- <dependencies>
- <dependency type="update" setting="lookandfeel.skin" />
- </dependencies>
<updates>
<update type="change" />
</updates>
- <control type="list" format="string" />
+ <control type="button" format="addon">
+ <show more="true" details="true">installed</show>
+ </control>
</setting>
</group>
<group id="2">
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp
index 95ae98c631..a0722f5fb6 100644
--- a/xbmc/Application.cpp
+++ b/xbmc/Application.cpp
@@ -1103,7 +1103,6 @@ void CApplication::CreateUserDirs()
CDirectory::Create("special://home/addons");
CDirectory::Create("special://home/addons/packages");
CDirectory::Create("special://home/media");
- CDirectory::Create("special://home/sounds");
CDirectory::Create("special://home/system");
CDirectory::Create("special://masterprofile/");
CDirectory::Create("special://temp/");
@@ -1124,7 +1123,6 @@ bool CApplication::Initialize()
#endif
{
CDirectory::Create("special://xbmc/addons");
- CDirectory::Create("special://xbmc/sounds");
}
// load the language and its translated strings
@@ -1373,22 +1371,11 @@ void CApplication::OnSettingChanged(const CSetting *setting)
return;
}
- // Reset sounds setting if new skin doen't provide sounds
- if (settingId == CSettings::SETTING_LOOKANDFEEL_SKIN && CSettings::Get().GetString(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN) == "SKINDEFAULT")
- {
- ADDON::AddonPtr addon;
- if (CAddonMgr::Get().GetAddon(((CSettingString*)setting)->GetValue(), addon, ADDON_SKIN))
- {
- if (!CDirectory::Exists(URIUtils::AddFileToFolder(addon->Path(), "sounds")))
- CSettings::Get().GetSetting(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN)->Reset();
- }
- }
-
- std::string builtin("ReloadSkin");
- if (settingId == CSettings::SETTING_LOOKANDFEEL_SKIN && !m_skinReverting)
- builtin += "(confirm)";
- CApplicationMessenger::Get().PostMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, builtin);
- }
+ std::string builtin("ReloadSkin");
+ if (settingId == CSettings::SETTING_LOOKANDFEEL_SKIN && !m_skinReverting)
+ builtin += "(confirm)";
+ CApplicationMessenger::Get().PostMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, builtin);
+ }
else if (settingId == CSettings::SETTING_LOOKANDFEEL_SKINTHEME)
{
// also set the default color theme
diff --git a/xbmc/addons/Skin.cpp b/xbmc/addons/Skin.cpp
index 8f9e793df6..525403bd87 100644
--- a/xbmc/addons/Skin.cpp
+++ b/xbmc/addons/Skin.cpp
@@ -478,50 +478,6 @@ void CSkinInfo::SettingOptionsSkinFontsFiller(const CSetting *setting, std::vect
current = list[0].second;
}
-void CSkinInfo::SettingOptionsSkinSoundFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data)
-{
- std::string settingValue = ((const CSettingString*)setting)->GetValue();
- current = "SKINDEFAULT";
-
- list.push_back(make_pair(g_localizeStrings.Get(474), "OFF"));
-
- if (CDirectory::Exists(URIUtils::AddFileToFolder(g_SkinInfo->Path(), "sounds")))
- list.push_back(make_pair(g_localizeStrings.Get(15106), "SKINDEFAULT"));
-
- ADDON::VECADDONS addons;
- if (ADDON::CAddonMgr::Get().GetAddons(ADDON::ADDON_RESOURCE_UISOUNDS, addons))
- {
- for (const auto& addon : addons)
- list.push_back(make_pair(addon->Name(), addon->ID()));
- }
-
- //Add sounds from special directories
- CFileItemList items;
- CDirectory::GetDirectory("special://xbmc/sounds/", items);
- CDirectory::GetDirectory("special://home/sounds/", items);
- 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;
- list.push_back(make_pair(pItem->GetLabel(), pItem->GetLabel()));
- }
- }
-
- sort(list.begin() + 2, list.end());
-
- // try to find the best matching value
- for (vector< pair<string, string> >::const_iterator it = list.begin(); it != list.end(); ++it)
- {
- if (StringUtils::EqualsNoCase(it->second, settingValue))
- current = settingValue;
- }
-}
-
void CSkinInfo::SettingOptionsSkinThemesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data)
{
// get the choosen theme and remove the extension from the current theme (backward compat)
diff --git a/xbmc/addons/Skin.h b/xbmc/addons/Skin.h
index 516592ec7f..51c1c0d967 100644
--- a/xbmc/addons/Skin.h
+++ b/xbmc/addons/Skin.h
@@ -174,7 +174,6 @@ public:
static void SettingOptionsSkinColorsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data);
static void SettingOptionsSkinFontsFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data);
- static void SettingOptionsSkinSoundFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data);
static void SettingOptionsSkinThemesFiller(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data);
static void SettingOptionsStartupWindowsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data);
diff --git a/xbmc/guilib/GUIAudioManager.cpp b/xbmc/guilib/GUIAudioManager.cpp
index 4b83943915..57a761633c 100644
--- a/xbmc/guilib/GUIAudioManager.cpp
+++ b/xbmc/guilib/GUIAudioManager.cpp
@@ -65,10 +65,11 @@ bool CGUIAudioManager::OnSettingUpdate(CSetting* &setting, const char *oldSettin
if (setting->GetId() == CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN)
{
- //We change to new resource.uisounds.confluence default only if current
- //skin is confluence. Otherwise keep it as SKINDEFAULT.
- return !(((CSettingString*)setting)->GetValue() == "SKINDEFAULT"
- && CSettings::Get().GetString(CSettings::SETTING_LOOKANDFEEL_SKIN) == "skin.confluence");
+ //Migrate the old settings
+ if (((CSettingString*)setting)->GetValue() == "SKINDEFAULT")
+ ((CSettingString*)setting)->Reset();
+ else if (((CSettingString*)setting)->GetValue() == "OFF")
+ ((CSettingString*)setting)->SetValue("");
}
return true;
}
@@ -222,30 +223,22 @@ void CGUIAudioManager::UnLoad()
std::string GetSoundSkinPath()
{
- const std::string id = CSettings::Get().GetString(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN);
- if (id == "OFF")
+ auto setting = static_cast<CSettingString*>(CSettings::Get().GetSetting(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN));
+ auto value = setting->GetValue();
+ if (value.empty())
return "";
- if (id == "SKINDEFAULT")
- return URIUtils::AddFileToFolder(g_SkinInfo->Path(), "sounds");
-
ADDON::AddonPtr addon;
- if (ADDON::CAddonMgr::Get().GetAddon(id, addon, ADDON::ADDON_RESOURCE_UISOUNDS))
- return URIUtils::AddFileToFolder("resource://", id);
-
- //Check special directories
- std::string path = URIUtils::AddFileToFolder("special://home/sounds", id);
- if (XFILE::CDirectory::Exists(path))
- return path;
-
- return URIUtils::AddFileToFolder("special://xbmc/sounds", id);
+ if (!ADDON::CAddonMgr::Get().GetAddon(value, addon, ADDON::ADDON_RESOURCE_UISOUNDS))
+ {
+ CLog::Log(LOGNOTICE, "Unknown sounds addon '%s'. Setting default sounds.", value.c_str());
+ setting->Reset();
+ }
+ return URIUtils::AddFileToFolder("resource://", setting->GetValue());
}
// \brief Load the config file (sounds.xml) for nav sounds
-// Can be located in a folder "sounds" in the skin or from a
-// subfolder of the folder "sounds" in the root directory of
-// xbmc
bool CGUIAudioManager::Load()
{
CSingleLock lock(m_cs);
@@ -406,7 +399,7 @@ IAESound* CGUIAudioManager::LoadWindowSound(TiXmlNode* pWindowNode, const std::s
void CGUIAudioManager::Enable(bool bEnable)
{
// always deinit audio when we don't want gui sounds
- if (CSettings::Get().GetString(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN)=="OFF")
+ if (CSettings::Get().GetString(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN).empty())
bEnable = false;
CSingleLock lock(m_cs);
diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp
index 8867b51638..4bf5916dc7 100644
--- a/xbmc/settings/Settings.cpp
+++ b/xbmc/settings/Settings.cpp
@@ -570,7 +570,6 @@ void CSettings::Uninitialize()
m_settingsManager->UnregisterSettingOptionsFiller("iso6391languages");
m_settingsManager->UnregisterSettingOptionsFiller("skincolors");
m_settingsManager->UnregisterSettingOptionsFiller("skinfonts");
- m_settingsManager->UnregisterSettingOptionsFiller("skinsounds");
m_settingsManager->UnregisterSettingOptionsFiller("skinthemes");
#if defined(TARGET_LINUX)
m_settingsManager->UnregisterSettingOptionsFiller("timezonecountries");
@@ -936,7 +935,6 @@ void CSettings::InitializeOptionFillers()
m_settingsManager->RegisterSettingOptionsFiller("iso6391languages", CLangInfo::SettingOptionsISO6391LanguagesFiller);
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);