Merge pull request #26264 from the-black-eagle/mka_end_durations
[xbmc.git] / xbmc / addons / UISoundsResource.cpp
blob6ca53ddfd8b4bff4310eef20035065867a82cfca
1 /*
2 * Copyright (C) 2015-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8 #include "UISoundsResource.h"
10 #include "ServiceBroker.h"
11 #include "addons/addoninfo/AddonType.h"
12 #include "guilib/GUIAudioManager.h"
13 #include "settings/Settings.h"
14 #include "settings/SettingsComponent.h"
15 #include "utils/StringUtils.h"
16 #include "utils/URIUtils.h"
19 namespace ADDON
22 CUISoundsResource::CUISoundsResource(const AddonInfoPtr& addonInfo)
23 : CResource(addonInfo, AddonType::RESOURCE_UISOUNDS)
27 bool CUISoundsResource::IsAllowed(const std::string& file) const
29 return StringUtils::EqualsNoCase(file, "sounds.xml")
30 || URIUtils::HasExtension(file, ".wav");
33 bool CUISoundsResource::IsInUse() const
35 return CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_LOOKANDFEEL_SOUNDSKIN) == ID();
38 void CUISoundsResource::OnPostInstall(bool update, bool modal)
40 CGUIComponent* gui = CServiceBroker::GetGUI();
41 if (IsInUse() && gui)
42 gui->GetAudioManager().Load();