diff options
author | spiff_ <spiff_@svn> | 2010-04-26 20:33:27 +0000 |
---|---|---|
committer | spiff_ <spiff_@svn> | 2010-04-26 20:33:27 +0000 |
commit | 10af207bd15255b338f4ad6f75aa073e4330a9e6 (patch) | |
tree | 9b333c192aa82578e32a864a692c08684a6a5f8c | |
parent | 3a7c548ef92a1cd88c27780f1320ce514032c938 (diff) |
added: ability to browse for a file in single-list mode
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29518 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/GUIDialogFileBrowser.cpp | 40 | ||||
-rw-r--r-- | xbmc/GUIDialogFileBrowser.h | 2 |
2 files changed, 32 insertions, 10 deletions
diff --git a/xbmc/GUIDialogFileBrowser.cpp b/xbmc/GUIDialogFileBrowser.cpp index ccb0d3cbc5..1b9c94714d 100644 --- a/xbmc/GUIDialogFileBrowser.cpp +++ b/xbmc/GUIDialogFileBrowser.cpp @@ -680,7 +680,7 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const VECSOURCES &shares, const CStdS } // same as above, starting in a single directory -bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */) +bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs /* = false */, bool useFileDirectories /* = false */, bool singleList /* = false */) { CGUIDialogFileBrowser *browser = new CGUIDialogFileBrowser(); if (!browser) @@ -688,16 +688,29 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CS g_windowManager.AddUniqueInstance(browser); browser->m_useFileDirectories = useFileDirectories; - - // add a single share for this directory - VECSOURCES shares; - CMediaSource share; - share.strPath = directory; - CUtil::RemoveSlashAtEnd(share.strPath); // this is needed for the dodgy code in WINDOW_INIT - shares.push_back(share); browser->m_browsingForImages = useThumbs; browser->SetHeading(heading); - browser->SetSources(shares); + + // add a single share for this directory + if (!singleList) + { + VECSOURCES shares; + CMediaSource share; + share.strPath = directory; + CUtil::RemoveSlashAtEnd(share.strPath); // this is needed for the dodgy code in WINDOW_INIT + shares.push_back(share); + browser->SetSources(shares); + } + else + { + browser->m_vecItems->Clear(); + CDirectory::GetDirectory(directory,*browser->m_vecItems); + CFileItemPtr item(new CFileItem("file://Browse", false)); + item->SetLabel(g_localizeStrings.Get(20153)); + item->SetIconImage("DefaultFolder.png"); + browser->m_vecItems->Add(item); + browser->m_singleList = true; + } CStdString strMask = mask; if (mask == "/") browser->m_browsingForFolders=1; @@ -717,6 +730,15 @@ bool CGUIDialogFileBrowser::ShowAndGetFile(const CStdString &directory, const CS bool confirmed(browser->IsConfirmed()); if (confirmed) path = browser->m_selectedPath; + if (path == "file://Browse") + { // "Browse for thumb" + g_windowManager.Remove(browser->GetID()); + delete browser; + VECSOURCES shares; + g_mediaManager.GetLocalDrives(shares); + + return ShowAndGetFile(shares, mask, heading, path, useThumbs,useFileDirectories); + } g_windowManager.Remove(browser->GetID()); delete browser; return confirmed; diff --git a/xbmc/GUIDialogFileBrowser.h b/xbmc/GUIDialogFileBrowser.h index 22074d9fbe..f03f1e4a4c 100644 --- a/xbmc/GUIDialogFileBrowser.h +++ b/xbmc/GUIDialogFileBrowser.h @@ -45,7 +45,7 @@ public: static bool ShowAndGetDirectory(const VECSOURCES &shares, const CStdString &heading, CStdString &path, bool bWriteOnly=false); static bool ShowAndGetFile(const VECSOURCES &shares, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs = false, bool useFileDirectories = false); - static bool ShowAndGetFile(const CStdString &directory, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs = false, bool useFileDirectories = false); + static bool ShowAndGetFile(const CStdString &directory, const CStdString &mask, const CStdString &heading, CStdString &path, bool useThumbs = false, bool useFileDirectories = false, bool singleList = false); static bool ShowAndGetSource(CStdString &path, bool allowNetworkShares, VECSOURCES* additionalShare = NULL, const CStdString& strType=""); static bool ShowAndGetImage(const VECSOURCES &shares, const CStdString &heading, CStdString &path); static bool ShowAndGetImage(const CFileItemList &items, const VECSOURCES &shares, const CStdString &heading, CStdString &path, bool* flip=NULL, int label=21371); |