aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Kerling <pkerling@casix.org>2018-01-02 12:22:39 +0100
committerPhilipp Kerling <pkerling@casix.org>2018-01-04 15:25:15 +0100
commitcd81ef4f4fb3ef020e3f67843ea6bcf1a5bc31cc (patch)
tree0333d2825bb7d5513de99fdb06922031cb1df619
parentdaed233cb9104828aa37cfe47c3cbaa149ce4f82 (diff)
Add support for JPG splash screen
-rw-r--r--tools/android/packaging/.gitignore2
-rw-r--r--tools/android/packaging/Makefile.in7
-rw-r--r--xbmc/Util.cpp10
-rw-r--r--xbmc/Util.h2
-rw-r--r--xbmc/platform/darwin/ios/IOSExternalTouchController.mm3
-rw-r--r--xbmc/rendering/RenderSystem.cpp8
-rw-r--r--xbmc/windows/GUIWindowSplash.cpp9
7 files changed, 23 insertions, 18 deletions
diff --git a/tools/android/packaging/.gitignore b/tools/android/packaging/.gitignore
index 467d2ac3e6..d916dfda47 100644
--- a/tools/android/packaging/.gitignore
+++ b/tools/android/packaging/.gitignore
@@ -3,7 +3,7 @@ xbmc/assets/*
xbmc/lib/*
xbmc/libs/*
xbmc/obj/*
-xbmc/res/drawable/splash.png
+xbmc/res/drawable*/splash.*
xbmc/src/R.java
xbmc/src/org/xbmc/kodi/*.class
xbmc/classes.dex
diff --git a/tools/android/packaging/Makefile.in b/tools/android/packaging/Makefile.in
index cf21dca28d..f74425ccfb 100644
--- a/tools/android/packaging/Makefile.in
+++ b/tools/android/packaging/Makefile.in
@@ -119,13 +119,13 @@ python: | xbmc/assets
res:
mkdir -p xbmc/res xbmc/res/raw xbmc/res/values images
@echo "native_arch=$(CPU)" > xbmc/res/raw/xbmc.properties
- cp -fp $(CMAKE_SOURCE_DIR)/media/Splash.png xbmc/res/drawable/splash.png
+ cp -fp $(CMAKE_SOURCE_DIR)/media/splash.* xbmc/res/drawable/
cp -fp media/drawable-hdpi/ic_launcher.png xbmc/res/drawable-hdpi/ic_launcher.png
cp -fp media/drawable-ldpi/ic_launcher.png xbmc/res/drawable-ldpi/ic_launcher.png
cp -fp media/drawable-mdpi/ic_launcher.png xbmc/res/drawable-mdpi/ic_launcher.png
cp -fp media/drawable-xhdpi/ic_launcher.png xbmc/res/drawable-xhdpi/ic_launcher.png
cp -fp media/drawable-xxhdpi/ic_launcher.png xbmc/res/drawable-xxhdpi/ic_launcher.png
- cp -fp $(CMAKE_SOURCE_DIR)/media/Splash.png xbmc/res/drawable-xxxhdpi/splash.png
+ cp -fp $(CMAKE_SOURCE_DIR)/media/splash.* xbmc/res/drawable-xxxhdpi/
cp -fp media/drawable-xxxhdpi/ic_launcher.png xbmc/res/drawable-xxxhdpi/ic_launcher.png
cp -fp media/drawable-xhdpi/banner.png xbmc/res/drawable-xhdpi/banner.png
cp -fp $(CMAKE_SOURCE_DIR)/media/icon80x80.png xbmc/res/drawable/ic_recommendation_80dp.png
@@ -182,7 +182,8 @@ apk-clean:
rm -rf xbmc/obj
rm -rf xbmc/res/raw
rm -rf xbmc/res/values
- rm -f xbmc/res/drawable/splash.png
+ rm -f xbmc/res/drawable/splash.*
+ rm -f xbmc/res/drawable-xxxhdpi/splash.*
rm -rf assets
.PHONY: force libs assets python sharedapk sharedobb res package
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index f5bf9ad392..514bdf7bb2 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -45,6 +45,7 @@
#endif
#include <stdlib.h>
#include <algorithm>
+#include <array>
#include "addons/VFSEntry.h"
#include "ServiceBroker.h"
@@ -547,6 +548,15 @@ bool CUtil::IsPicture(const std::string& strFile)
CServiceBroker::GetFileExtensionProvider().GetPictureExtensions()+ "|.tbn|.dds");
}
+std::string CUtil::GetSplashPath()
+{
+ std::array<std::string, 4> candidates {{ "special://home/media/splash.jpg", "special://home/media/splash.png", "special://xbmc/media/splash.jpg", "special://xbmc/media/splash.png" }};
+ auto it = std::find_if(candidates.begin(), candidates.end(), [](std::string const& file) { return XFILE::CFile::Exists(file); });
+ if (it == candidates.end())
+ throw std::runtime_error("No splash image found");
+ return CSpecialProtocol::TranslatePathConvertCase(*it);
+}
+
bool CUtil::ExcludeFileOrFolder(const std::string& strFileOrFolder, const std::vector<std::string>& regexps)
{
if (strFileOrFolder.empty())
diff --git a/xbmc/Util.h b/xbmc/Util.h
index 16836bca8f..23f2daf6d8 100644
--- a/xbmc/Util.h
+++ b/xbmc/Util.h
@@ -70,6 +70,8 @@ public:
static int GetDVDIfoTitle(const std::string& strPathFile);
static bool IsPicture(const std::string& strFile);
+ /// Get resolved filesystem location of splash image
+ static std::string GetSplashPath();
/*! \brief retrieve MD5sum of a file
\param strPath - path to the file to MD5sum
diff --git a/xbmc/platform/darwin/ios/IOSExternalTouchController.mm b/xbmc/platform/darwin/ios/IOSExternalTouchController.mm
index 2e252e7a09..459b6d26b8 100644
--- a/xbmc/platform/darwin/ios/IOSExternalTouchController.mm
+++ b/xbmc/platform/darwin/ios/IOSExternalTouchController.mm
@@ -21,6 +21,7 @@
#include "input/MouseStat.h"
#include "filesystem/SpecialProtocol.h"
#include "guilib/LocalizeStrings.h"
+#include "Util.h"
#import "IOSExternalTouchController.h"
#import "XBMCController.h"
@@ -84,7 +85,7 @@ const CGFloat timeFadeSecs = 2.0;
[descriptionLabel release];
//load the splash image
- std::string strUserSplash = CSpecialProtocol::TranslatePath("special://xbmc/media/Splash.png");
+ std::string strUserSplash = CUtil::GetSplashPath();
xbmcLogo = [UIImage imageWithContentsOfFile:[NSString stringWithUTF8String:strUserSplash.c_str()]];
//make a view with the image
diff --git a/xbmc/rendering/RenderSystem.cpp b/xbmc/rendering/RenderSystem.cpp
index 0cd966a5e3..4b98eb943c 100644
--- a/xbmc/rendering/RenderSystem.cpp
+++ b/xbmc/rendering/RenderSystem.cpp
@@ -22,8 +22,8 @@
#include "guilib/GUIImage.h"
#include "guilib/GUILabelControl.h"
#include "guilib/GUIFontManager.h"
-#include "filesystem/File.h"
#include "settings/AdvancedSettings.h"
+#include "Util.h"
CRenderSystemBase::CRenderSystemBase()
: m_stereoView(RENDER_STEREO_VIEW_OFF)
@@ -90,12 +90,8 @@ void CRenderSystemBase::ShowSplash(const std::string& message)
if (!m_splashImage)
{
- std::string splashImage = "special://home/media/Splash.png";
- if (!XFILE::CFile::Exists(splashImage))
- splashImage = "special://xbmc/media/Splash.png";
-
m_splashImage = std::unique_ptr<CGUIImage>(new CGUIImage(0, 0, 0, 0, g_graphicsContext.GetWidth(),
- g_graphicsContext.GetHeight(), CTextureInfo(splashImage)));
+ g_graphicsContext.GetHeight(), CTextureInfo(CUtil::GetSplashPath())));
m_splashImage->SetAspectRatio(CAspectRatio::AR_SCALE);
}
diff --git a/xbmc/windows/GUIWindowSplash.cpp b/xbmc/windows/GUIWindowSplash.cpp
index 93d494bec0..1fbbe9eff0 100644
--- a/xbmc/windows/GUIWindowSplash.cpp
+++ b/xbmc/windows/GUIWindowSplash.cpp
@@ -23,6 +23,7 @@
#include "filesystem/SpecialProtocol.h"
#include "guilib/GUIImage.h"
#include "guilib/GUIWindowManager.h"
+#include "Util.h"
#include "utils/log.h"
CGUIWindowSplash::CGUIWindowSplash(void) : CGUIWindow(WINDOW_SPLASH, "")
@@ -35,13 +36,7 @@ CGUIWindowSplash::~CGUIWindowSplash(void) = default;
void CGUIWindowSplash::OnInitWindow()
{
- std::string splashImage = "special://home/media/Splash.png";
- if (!XFILE::CFile::Exists(splashImage))
- splashImage = "special://xbmc/media/Splash.png";
-
- CLog::Log(LOGINFO, "load splash image: %s", CSpecialProtocol::TranslatePath(splashImage).c_str());
-
- m_image = std::unique_ptr<CGUIImage>(new CGUIImage(0, 0, 0, 0, g_graphicsContext.GetWidth(), g_graphicsContext.GetHeight(), CTextureInfo(splashImage)));
+ m_image = std::unique_ptr<CGUIImage>(new CGUIImage(0, 0, 0, 0, g_graphicsContext.GetWidth(), g_graphicsContext.GetHeight(), CTextureInfo(CUtil::GetSplashPath())));
m_image->SetAspectRatio(CAspectRatio::AR_SCALE);
}