diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/addons/FontResource.cpp | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/addons/FontResource.cpp')
-rw-r--r-- | xbmc/addons/FontResource.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/xbmc/addons/FontResource.cpp b/xbmc/addons/FontResource.cpp new file mode 100644 index 0000000..0ed843b --- /dev/null +++ b/xbmc/addons/FontResource.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2005-2018 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ +#include "FontResource.h" + +#include "ServiceBroker.h" +#include "addons/AddonManager.h" +#include "addons/addoninfo/AddonInfo.h" +#include "addons/addoninfo/AddonType.h" +#include "filesystem/SpecialProtocol.h" +#include "messaging/ApplicationMessenger.h" +#include "settings/Settings.h" +#include "settings/SettingsComponent.h" +#include "utils/FileUtils.h" + +namespace ADDON +{ + +CFontResource::CFontResource(const AddonInfoPtr& addonInfo) + : CResource(addonInfo, AddonType::RESOURCE_FONT) +{ +} + +void CFontResource::OnPostInstall(bool update, bool modal) +{ + std::string skin = CServiceBroker::GetSettingsComponent()->GetSettings()->GetString(CSettings::SETTING_LOOKANDFEEL_SKIN); + const auto& deps = + CServiceBroker::GetAddonMgr().GetDepsRecursive(skin, OnlyEnabledRootAddon::CHOICE_YES); + for (const auto& it : deps) + if (it.id == ID()) + CServiceBroker::GetAppMessenger()->PostMsg(TMSG_EXECUTE_BUILT_IN, -1, -1, nullptr, + "ReloadSkin"); +} + +bool CFontResource::GetFont(const std::string& file, std::string& path) const +{ + std::string result = CSpecialProtocol::TranslatePathConvertCase(Path()+"/resources/"+file); + if (CFileUtils::Exists(result)) + { + path = result; + return true; + } + + return false; +} + +} |