From 91947fe32854aac2a79a5ef1b44322ce52eb7618 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 28 Oct 2015 18:55:45 +0000 Subject: [PATCH] [stubs] Display requested message when stub files are used and no optical drive is present --- .../resources/strings.po | 10 +--------- xbmc/Application.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 26a64c053f43b..433dcb9ef9184 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -2038,15 +2038,7 @@ msgctxt "#434" msgid "From {0:s} at {1:d} {2:s}" msgstr "" -#: xbmc/Application.cpp -msgctxt "#435" -msgid "No optical disc drive detected" -msgstr "" - -#: xbmc/Application.cpp -msgctxt "#436" -msgid "You need an optical disc drive to play this video" -msgstr "" +#empty strings from id 435 to 436 msgctxt "#437" msgid "Removable disk" diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 53e84ef0ceffa..b045cf395251b 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -2781,10 +2781,23 @@ bool CApplication::PlayFile(CFileItem item, const std::string& player, bool bRes // Can't do better as CGUIDialogPlayEject calls CMediaManager::IsDiscInDrive, which assumes default DVD drive anyway return MEDIA_DETECT::CAutorun::PlayDiscAskResume(); } - else #endif - HELPERS::ShowOKDialogText(CVariant{435}, CVariant{436}); + // Figure out Lines 1 and 2 of the dialog + std::string strLine1, strLine2; + CXBMCTinyXML discStubXML; + if (discStubXML.LoadFile(item.GetPath())) + { + TiXmlElement * pRootElement = discStubXML.RootElement(); + if (!pRootElement || StringUtils::CompareNoCase(pRootElement->Value(), "discstub") != 0) + CLog::Log(LOGERROR, "Error loading %s, no node", item.GetPath().c_str()); + else + { + XMLUtils::GetString(pRootElement, "title", strLine1); + XMLUtils::GetString(pRootElement, "message", strLine2); + } + } + HELPERS::ShowOKDialogText(strLine1, strLine2); return true; }