diff options
author | Jonathan Marshall <jmarshall@never.you.mind> | 2011-04-14 09:59:03 +1200 |
---|---|---|
committer | Jonathan Marshall <jmarshall@never.you.mind> | 2011-04-14 09:59:03 +1200 |
commit | 92f5c6197bd2bd4d6adbab6ebb892816273715a4 (patch) | |
tree | 04ce3e9860b598235256fe670c8aa0890f5c14ce | |
parent | cd956c03a7de45a4032683981d23941b9870de21 (diff) | |
parent | 112d239641d9a98a790b6668e9c14d4ec814424c (diff) |
Merge branch 'HarryMuscle-DiscStub'
* HarryMuscle-DiscStub:
Improve handling of stub files for systems with no DVD drive
Add second line to the PlayEject dialog
Add second line to the PlayEject dialog
-rw-r--r-- | xbmc/Application.cpp | 22 | ||||
-rw-r--r-- | xbmc/dialogs/GUIDialogPlayEject.cpp | 48 | ||||
-rw-r--r-- | xbmc/dialogs/GUIDialogPlayEject.h | 4 |
3 files changed, 47 insertions, 27 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 42e7421a2b..9412971e72 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -219,6 +219,7 @@ #include "guilib/GUIControlFactory.h" #include "dialogs/GUIDialogCache.h" #include "dialogs/GUIDialogPlayEject.h" +#include "utils/XMLUtils.h" #include "addons/AddonInstaller.h" #ifdef HAS_PERFORMANCE_SAMPLE @@ -3556,28 +3557,15 @@ bool CApplication::PlayFile(const CFileItem& item, bool bRestart) CUtil::ClearSubtitles(); } -#ifdef HAS_DVD_DRIVE if (item.IsDiscStub()) { - // Figure out Line 1 of the dialog - CStdString strLine1; - if (item.GetVideoInfoTag()) - { - strLine1 = item.GetVideoInfoTag()->m_strTitle; - } - else - { - strLine1 = URIUtils::GetFileName(item.m_strPath); - URIUtils::RemoveExtension(strLine1); - } - +#ifdef HAS_DVD_DRIVE // Display the Play Eject dialog - if (CGUIDialogPlayEject::ShowAndGetInput(219, 429, strLine1, NULL)) - MEDIA_DETECT::CAutorun::PlayDisc(); - + if (CGUIDialogPlayEject::ShowAndGetInput(item)) + return MEDIA_DETECT::CAutorun::PlayDisc(); +#endif return true; } -#endif if (item.IsPlayList()) return false; diff --git a/xbmc/dialogs/GUIDialogPlayEject.cpp b/xbmc/dialogs/GUIDialogPlayEject.cpp index 87ef4f8c98..4190352e4d 100644 --- a/xbmc/dialogs/GUIDialogPlayEject.cpp +++ b/xbmc/dialogs/GUIDialogPlayEject.cpp @@ -24,6 +24,10 @@ #include "guilib/GUIWindowManager.h" #include "storage/MediaManager.h" #include "storage/IoSupport.h" +#include "utils/log.h" +#include "utils/URIUtils.h" +#include "utils/XMLUtils.h" +#include "video/VideoInfoTag.h" #define ID_BUTTON_PLAY 11 #define ID_BUTTON_EJECT 10 @@ -84,26 +88,54 @@ void CGUIDialogPlayEject::OnInitWindow() CGUIDialogYesNo::OnInitWindow(); } -bool CGUIDialogPlayEject::ShowAndGetInput(CVariant vHeading, CVariant vLine0, - CVariant vLine1, CVariant vLine2, unsigned int uiAutoCloseTime /* = 0 */) +bool CGUIDialogPlayEject::ShowAndGetInput(const CFileItem & item, + unsigned int uiAutoCloseTime /* = 0 */) { + // Make sure we're actually dealing with a Disc Stub + if (!item.IsDiscStub()) + return false; + + // Create the dialog CGUIDialogPlayEject * pDialog = (CGUIDialogPlayEject *)g_windowManager. GetWindow(WINDOW_DIALOG_PLAY_EJECT); - if (!pDialog) return false; - pDialog->SetHeading(vHeading); - pDialog->SetLine(0, vLine0); - pDialog->SetLine(1, vLine1); - pDialog->SetLine(2, vLine2); + // Figure out Line 1 of the dialog + CStdString strLine1; + if (item.GetVideoInfoTag()) + { + strLine1 = item.GetVideoInfoTag()->m_strTitle; + } + else + { + strLine1 = URIUtils::GetFileName(item.m_strPath); + URIUtils::RemoveExtension(strLine1); + } + + // Figure out Line 2 of the dialog + CStdString strLine2; + TiXmlDocument discStubXML; + if (discStubXML.LoadFile(item.m_strPath)) + { + TiXmlElement * pRootElement = discStubXML.RootElement(); + if (!pRootElement || strcmpi(pRootElement->Value(), "discstub") != 0) + CLog::Log(LOGERROR, "Error loading %s, no <discstub> node", item.m_strPath.c_str()); + else + XMLUtils::GetString(pRootElement, "message", strLine2); + } + // Setup dialog parameters + pDialog->SetHeading(219); + pDialog->SetLine(0, 429); + pDialog->SetLine(1, strLine1); + pDialog->SetLine(2, strLine2); pDialog->SetChoice(ID_BUTTON_PLAY - 10, 208); pDialog->SetChoice(ID_BUTTON_EJECT - 10, 13391); - if (uiAutoCloseTime) pDialog->SetAutoClose(uiAutoCloseTime); + // Display the dialog pDialog->DoModal(); return pDialog->IsConfirmed(); diff --git a/xbmc/dialogs/GUIDialogPlayEject.h b/xbmc/dialogs/GUIDialogPlayEject.h index 4fda7ca71a..810d21864e 100644 --- a/xbmc/dialogs/GUIDialogPlayEject.h +++ b/xbmc/dialogs/GUIDialogPlayEject.h @@ -20,6 +20,7 @@ * */ +#include "FileItem.h" #include "GUIDialogYesNo.h" #include "utils/Variant.h" @@ -31,8 +32,7 @@ public: virtual bool OnMessage(CGUIMessage& message); virtual void FrameMove(); - static bool ShowAndGetInput(CVariant vHeading, CVariant vLine0, CVariant vLine1, - CVariant vLine2, unsigned int uiAutoCloseTime = 0); + static bool ShowAndGetInput(const CFileItem & item, unsigned int uiAutoCloseTime = 0); protected: virtual void OnInitWindow(); |