diff options
-rw-r--r-- | xbmc/GUIMediaWindow.cpp | 36 | ||||
-rw-r--r-- | xbmc/GUIMediaWindow.h | 6 | ||||
-rw-r--r-- | xbmc/GUIWindowAddonBrowser.cpp | 48 | ||||
-rw-r--r-- | xbmc/GUIWindowAddonBrowser.h | 3 | ||||
-rw-r--r-- | xbmc/GUIWindowMusicBase.cpp | 8 | ||||
-rw-r--r-- | xbmc/GUIWindowMusicBase.h | 1 | ||||
-rw-r--r-- | xbmc/GUIWindowMusicNav.cpp | 107 | ||||
-rw-r--r-- | xbmc/GUIWindowMusicNav.h | 2 | ||||
-rw-r--r-- | xbmc/GUIWindowMusicSongs.cpp | 103 | ||||
-rw-r--r-- | xbmc/GUIWindowMusicSongs.h | 1 | ||||
-rw-r--r-- | xbmc/GUIWindowPictures.cpp | 98 | ||||
-rw-r--r-- | xbmc/GUIWindowPictures.h | 1 | ||||
-rw-r--r-- | xbmc/GUIWindowPrograms.cpp | 91 | ||||
-rw-r--r-- | xbmc/GUIWindowPrograms.h | 1 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoBase.cpp | 9 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoBase.h | 1 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoFiles.cpp | 104 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoFiles.h | 1 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoNav.cpp | 158 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoNav.h | 3 |
20 files changed, 266 insertions, 516 deletions
diff --git a/xbmc/GUIMediaWindow.cpp b/xbmc/GUIMediaWindow.cpp index 1a07774dca..0de84f5547 100644 --- a/xbmc/GUIMediaWindow.cpp +++ b/xbmc/GUIMediaWindow.cpp @@ -152,7 +152,7 @@ bool CGUIMediaWindow::OnAction(const CAction &action) { if (action.GetID() == ACTION_PARENT_DIR) { - if (m_vecItems->IsVirtualDirectoryRoot() && g_advancedSettings.m_bUseEvilB) + if ((m_vecItems->IsVirtualDirectoryRoot() || m_vecItems->m_strPath == m_startDirectory) && g_advancedSettings.m_bUseEvilB) g_windowManager.PreviousWindow(); else GoParentFolder(); @@ -451,7 +451,32 @@ bool CGUIMediaWindow::OnMessage(CGUIMessage& message) m_guiState->SetNextSortOrder(); UpdateFileList(); return true; - } + } + break; + case GUI_MSG_WINDOW_INIT: + { + CStdString dir = message.GetStringParam(0); + const CStdString &ret = message.GetStringParam(1); + bool returning = ret.CompareNoCase("return") == 0; + if (!dir.IsEmpty()) + { + m_history.ClearPathHistory(); + // ensure our directory is valid + dir = GetStartFolder(dir); + if (!returning || m_vecItems->m_strPath.Left(dir.GetLength()) != dir) + { // we're not returning to the same path, so set our directory to the requested path + m_vecItems->m_strPath = dir; + } + // check for network up + if (CUtil::IsRemote(m_vecItems->m_strPath) && !WaitForNetwork()) + m_vecItems->m_strPath.Empty(); + SetHistoryForPath(m_vecItems->m_strPath); + } + if (message.GetParam1() != WINDOW_INVALID) + { // first time to this window - make sure we set the root path + m_startDirectory = returning ? dir : ""; + } + } break; } @@ -1488,3 +1513,10 @@ void CGUIMediaWindow::GetFilteredItems(const CStdString &filter, CFileItemList & items.Add(item); } } + +CStdString CGUIMediaWindow::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("$ROOT") || dir.Equals("Root")) + return ""; + return dir; +} diff --git a/xbmc/GUIMediaWindow.h b/xbmc/GUIMediaWindow.h index e4d585680b..8e0876411e 100644 --- a/xbmc/GUIMediaWindow.h +++ b/xbmc/GUIMediaWindow.h @@ -96,6 +96,11 @@ protected: protected: bool WaitForNetwork() const; + /*! \brief Translate the folder to start in from the given quick path + \param dir the folder the user wants + \return the resulting path */ + virtual CStdString GetStartFolder(const CStdString &url); + XFILE::CVirtualDirectory m_rootDir; CGUIViewControl m_viewControl; @@ -108,4 +113,5 @@ protected: // save control state on window exit int m_iLastControl; int m_iSelectedItem; + CStdString m_startDirectory; }; diff --git a/xbmc/GUIWindowAddonBrowser.cpp b/xbmc/GUIWindowAddonBrowser.cpp index 8da565c051..6084aecd2b 100644 --- a/xbmc/GUIWindowAddonBrowser.cpp +++ b/xbmc/GUIWindowAddonBrowser.cpp @@ -76,33 +76,6 @@ bool CGUIWindowAddonBrowser::OnMessage(CGUIMessage& message) case GUI_MSG_WINDOW_INIT: { m_rootDir.AllowNonLocalSources(false); - // check for valid quickpath parameter - CStdString strDestination = message.GetNumStringParams() ? message.GetStringParam(0) : ""; - CStdString strReturn = message.GetNumStringParams() > 1 ? message.GetStringParam(1) : ""; - bool returning = strReturn.CompareNoCase("return") == 0; - - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - CLog::Log(LOGINFO, "Attempting to %s to: %s", returning ? "return" : "quickpath", strDestination.c_str()); - } - - CStdString destPath; - if (!strDestination.IsEmpty()) - { - if (strDestination.Equals("$ROOT") || strDestination.Equals("Root")) - destPath = ""; - else if (strDestination.Left(9).Equals("addons://")) - destPath = strDestination; - else - { - CLog::Log(LOGWARNING, "Warning, destination parameter (%s) may not be valid", strDestination.c_str()); - destPath = strDestination; - } - } - m_vecItems->m_strPath = destPath; - SetHistoryForPath(destPath); - m_startDirectory = returning ? destPath : ""; } break; case GUI_MSG_CLICKED: @@ -136,20 +109,6 @@ bool CGUIWindowAddonBrowser::OnMessage(CGUIMessage& message) return CGUIMediaWindow::OnMessage(message); } -bool CGUIWindowAddonBrowser::OnAction(const CAction& action) -{ - if (action.GetID() == ACTION_PARENT_DIR) - { - if (g_advancedSettings.m_bUseEvilB && - m_vecItems->m_strPath == m_startDirectory) - { - g_windowManager.PreviousWindow(); - return true; - } - } - return CGUIMediaWindow::OnAction(action); -} - void CGUIWindowAddonBrowser::GetContextButtons(int itemNumber, CContextButtons& buttons) { @@ -557,3 +516,10 @@ void CGUIWindowAddonBrowser::InstallAddonsFromXBMCRepo(const set<CStdString> &ad for (set<CStdString>::const_iterator i = addonIDs.begin(); i != addonIDs.end(); ++i) InstallAddon(*i); } + +CStdString CGUIWindowAddonBrowser::GetStartFolder(const CStdString &dir) +{ + if (dir.Left(9).Equals("addons://")) + return dir; + return CGUIMediaWindow::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowAddonBrowser.h b/xbmc/GUIWindowAddonBrowser.h index 66746ae43b..3ebde611d8 100644 --- a/xbmc/GUIWindowAddonBrowser.h +++ b/xbmc/GUIWindowAddonBrowser.h @@ -39,7 +39,6 @@ public: CGUIWindowAddonBrowser(void); virtual ~CGUIWindowAddonBrowser(void); virtual bool OnMessage(CGUIMessage& message); - virtual bool OnAction(const CAction &action); void RegisterJob(const CStdString& id, CFileOperationJob* job, unsigned int jobid); @@ -76,11 +75,11 @@ protected: virtual void UpdateButtons(); virtual bool GetDirectory(const CStdString &strDirectory, CFileItemList &items); virtual bool Update(const CStdString &strDirectory); + virtual CStdString GetStartFolder(const CStdString &dir); std::map<CStdString,CFileOperationJob*> m_idtojob; std::map<CStdString,unsigned int> m_idtojobid; std::map<CFileOperationJob*,CStdString> m_jobtoid; CCriticalSection m_critSection; CPictureThumbLoader m_thumbLoader; - CStdString m_startDirectory; }; diff --git a/xbmc/GUIWindowMusicBase.cpp b/xbmc/GUIWindowMusicBase.cpp index e02cc9b154..a4d716a10a 100644 --- a/xbmc/GUIWindowMusicBase.cpp +++ b/xbmc/GUIWindowMusicBase.cpp @@ -1410,3 +1410,11 @@ void CGUIWindowMusicBase::SetupFanart(CFileItemList& items) } } +CStdString CGUIWindowMusicBase::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("Plugins") || dir.Equals("Addons")) + return "addons://sources/audio/"; + else if (dir.Equals("$PLAYLISTS") || dir.Equals("Playlists")) + return "special://musicplaylists/"; + return ""; +} diff --git a/xbmc/GUIWindowMusicBase.h b/xbmc/GUIWindowMusicBase.h index 928dd2caf1..17f58d4579 100644 --- a/xbmc/GUIWindowMusicBase.h +++ b/xbmc/GUIWindowMusicBase.h @@ -70,6 +70,7 @@ protected: virtual void OnScan(int iItem) {}; void OnRipCD(); virtual void OnPrepareFileItems(CFileItemList &items); + virtual CStdString GetStartFolder(const CStdString &dir); // new methods virtual void PlayItem(int iItem); diff --git a/xbmc/GUIWindowMusicNav.cpp b/xbmc/GUIWindowMusicNav.cpp index 3839f608cc..362bc6394e 100644 --- a/xbmc/GUIWindowMusicNav.cpp +++ b/xbmc/GUIWindowMusicNav.cpp @@ -98,80 +98,16 @@ bool CGUIWindowMusicNav::OnMessage(CGUIMessage& message) { /* We don't want to show Autosourced items (ie removable pendrives, memorycards) in Library mode */ m_rootDir.AllowNonLocalSources(false); - // check for valid quickpath parameter - CStdString strDestination = message.GetNumStringParams() ? message.GetStringParam(0) : ""; - CStdString strReturn = message.GetNumStringParams() > 1 ? message.GetStringParam(1) : ""; - bool returning = strReturn.CompareNoCase("return") == 0; - - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - CLog::Log(LOGINFO, "Attempting to quickpath to: %s", strDestination.c_str()); - } // is this the first time the window is opened? - if (m_vecItems->m_strPath == "?" && strDestination.IsEmpty()) - { - strDestination = g_settings.m_defaultMusicLibSource; - m_vecItems->m_strPath = strDestination; - CLog::Log(LOGINFO, "Attempting to default to: %s", strDestination.c_str()); - } - - CStdString destPath; - if (!strDestination.IsEmpty()) - { - if (strDestination.Equals("$ROOT") || strDestination.Equals("Root")) - destPath = ""; - else if (strDestination.Equals("Genres")) - destPath = "musicdb://1/"; - else if (strDestination.Equals("Artists")) - destPath = "musicdb://2/"; - else if (strDestination.Equals("Albums")) - destPath = "musicdb://3/"; - else if (strDestination.Equals("Singles")) - destPath = "musicdb://10/"; - else if (strDestination.Equals("Songs")) - destPath = "musicdb://4/"; - else if (strDestination.Equals("Top100")) - destPath = "musicdb://5/"; - else if (strDestination.Equals("Top100Songs")) - destPath = "musicdb://5/2/"; - else if (strDestination.Equals("Top100Albums")) - destPath = "musicdb://5/1/"; - else if (strDestination.Equals("RecentlyAddedAlbums")) - destPath = "musicdb://6/"; - else if (strDestination.Equals("RecentlyPlayedAlbums")) - destPath = "musicdb://7/"; - else if (strDestination.Equals("Compilations")) - destPath = "musicdb://8/"; - else if (strDestination.Equals("Playlists")) - destPath = "special://musicplaylists/"; - else if (strDestination.Equals("Years")) - destPath = "musicdb://9/"; - else if (strDestination.Equals("Plugins")) - destPath = "addons://sources/audio/"; - else - { - CLog::Log(LOGWARNING, "Warning, destination parameter (%s) may not be valid", strDestination.c_str()); - destPath = strDestination; - } - if (!returning || m_vecItems->m_strPath.Left(destPath.GetLength()) != destPath) - { // we're not returning to the same path, so set our directory to the requested path - m_vecItems->m_strPath = destPath; - } - SetHistoryForPath(m_vecItems->m_strPath); - } - + if (m_vecItems->m_strPath == "?" && message.GetStringParam().IsEmpty()) + m_vecItems->m_strPath = g_settings.m_defaultMusicLibSource; + DisplayEmptyDatabaseMessage(false); // reset message state if (!CGUIWindowMusicBase::OnMessage(message)) return false; - if (message.GetParam1() != WINDOW_INVALID) - { // first time to this window - make sure we set the root path - m_startDirectory = returning ? destPath : ""; - } - // base class has opened the database, do our check DisplayEmptyDatabaseMessage(m_musicdatabase.GetSongsCount() <= 0); @@ -257,14 +193,6 @@ bool CGUIWindowMusicNav::OnMessage(CGUIMessage& message) bool CGUIWindowMusicNav::OnAction(const CAction& action) { - if (action.GetID() == ACTION_PARENT_DIR) - { - if (g_advancedSettings.m_bUseEvilB && m_vecItems->m_strPath == m_startDirectory) - { - g_windowManager.PreviousWindow(); - return true; - } - } if (action.GetID() == ACTION_SCAN_ITEM) { int item = m_viewControl.GetSelectedItem(); @@ -878,3 +806,32 @@ void CGUIWindowMusicNav::AddSearchFolder() delete viewState; } } + +CStdString CGUIWindowMusicNav::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("Genres")) + return "musicdb://1/"; + else if (dir.Equals("Artists")) + return "musicdb://2/"; + else if (dir.Equals("Albums")) + return "musicdb://3/"; + else if (dir.Equals("Singles")) + return "musicdb://10/"; + else if (dir.Equals("Songs")) + return "musicdb://4/"; + else if (dir.Equals("Top100")) + return "musicdb://5/"; + else if (dir.Equals("Top100Songs")) + return "musicdb://5/2/"; + else if (dir.Equals("Top100Albums")) + return "musicdb://5/1/"; + else if (dir.Equals("RecentlyAddedAlbums")) + return "musicdb://6/"; + else if (dir.Equals("RecentlyPlayedAlbums")) + return "musicdb://7/"; + else if (dir.Equals("Compilations")) + return "musicdb://8/"; + else if (dir.Equals("Years")) + return "musicdb://9/"; + return CGUIWindowMusicBase::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowMusicNav.h b/xbmc/GUIWindowMusicNav.h index fb75c31067..b45afd11fc 100644 --- a/xbmc/GUIWindowMusicNav.h +++ b/xbmc/GUIWindowMusicNav.h @@ -49,6 +49,7 @@ protected: virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); virtual bool OnClick(int iItem); + virtual CStdString GetStartFolder(const CStdString &url); bool GetSongsFromPlayList(const CStdString& strPlayList, CFileItemList &items); void DisplayEmptyDatabaseMessage(bool bDisplay); @@ -63,7 +64,6 @@ protected: // searching void OnSearchUpdate(); void AddSearchFolder(); - CStdString m_startDirectory; CStopWatch m_searchTimer; ///< Timer to delay a search while more characters are entered bool m_searchWithEdit; ///< Whether the skin supports the new edit control searching }; diff --git a/xbmc/GUIWindowMusicSongs.cpp b/xbmc/GUIWindowMusicSongs.cpp index ecd6d55873..67d2140e35 100644 --- a/xbmc/GUIWindowMusicSongs.cpp +++ b/xbmc/GUIWindowMusicSongs.cpp @@ -80,85 +80,9 @@ bool CGUIWindowMusicSongs::OnMessage(CGUIMessage& message) // removed the start window check from files view // the window translator does it by using a virtual window id (5) - // check for a passed destination path - CStdString strDestination = message.GetStringParam(); - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - CLog::Log(LOGINFO, "Attempting to quickpath to: %s", strDestination.c_str()); - m_history.ClearPathHistory(); - } - // is this the first time the window is opened? - if (m_vecItems->m_strPath == "?" && strDestination.IsEmpty()) - { - strDestination = g_settings.m_defaultMusicSource; - m_vecItems->m_strPath=strDestination; - CLog::Log(LOGINFO, "Attempting to default to: %s", strDestination.c_str()); - } - - // try to open the destination path - if (!strDestination.IsEmpty()) - { - // open root - if (strDestination.Equals("$ROOT")) - { - m_vecItems->m_strPath = ""; - CLog::Log(LOGINFO, " Success! Opening root listing."); - } - // open playlists location - else if (strDestination.Equals("$PLAYLISTS")) - { - m_vecItems->m_strPath = "special://musicplaylists/"; - CLog::Log(LOGINFO, " Success! Opening destination path: %s", m_vecItems->m_strPath.c_str()); - } - else - { - // default parameters if the jump fails - m_vecItems->m_strPath.Empty(); - - bool bIsSourceName = false; - - SetupShares(); - VECSOURCES shares; - m_rootDir.GetSources(shares); - int iIndex = CUtil::GetMatchingSource(strDestination, shares, bIsSourceName); - if (iIndex > -1) - { - bool unlocked = true; - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) - { - CFileItem item(shares[iIndex]); - if (!g_passwordManager.IsItemUnlocked(&item,"music")) - { - m_vecItems->m_strPath = ""; // no u don't - unlocked = false; - CLog::Log(LOGINFO, " Failure! Failed to unlock destination path: %s", strDestination.c_str()); - } - } - // set current directory to matching share - if (unlocked) - { - if (bIsSourceName) - m_vecItems->m_strPath=shares[iIndex].strPath; - else - m_vecItems->m_strPath=strDestination; - CLog::Log(LOGINFO, " Success! Opened destination path: %s (%s)", strDestination.c_str(), m_vecItems->m_strPath.c_str()); - } - } - else - { - CLog::Log(LOGERROR, " Failed! Destination parameter (%s) does not match a valid source!", strDestination.c_str()); - } - } - - // check for network up - if (CUtil::IsRemote(m_vecItems->m_strPath) && !WaitForNetwork()) - m_vecItems->m_strPath.Empty(); - - // need file filters or GetDirectory in SetHistoryPath fails - SetHistoryForPath(m_vecItems->m_strPath); - } + if (m_vecItems->m_strPath == "?" && message.GetStringParam().IsEmpty()) + m_vecItems->m_strPath = g_settings.m_defaultMusicSource; return CGUIWindowMusicBase::OnMessage(message); } @@ -589,3 +513,26 @@ void CGUIWindowMusicSongs::OnRemoveSource(int iItem) g_infoManager.ResetLibraryBools(); } } + +CStdString CGUIWindowMusicSongs::GetStartFolder(const CStdString &dir) +{ + SetupShares(); + VECSOURCES shares; + m_rootDir.GetSources(shares); + bool bIsSourceName = false; + int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); + if (iIndex > -1) + { + if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + { + CFileItem item(shares[iIndex]); + if (!g_passwordManager.IsItemUnlocked(&item,"music")) + return ""; + } + // set current directory to matching share + if (bIsSourceName) + return shares[iIndex].strPath; + return dir; + } + return CGUIWindowMusicBase::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowMusicSongs.h b/xbmc/GUIWindowMusicSongs.h index 1c0446ca15..998c39a0c8 100644 --- a/xbmc/GUIWindowMusicSongs.h +++ b/xbmc/GUIWindowMusicSongs.h @@ -44,6 +44,7 @@ protected: virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); virtual void OnScan(int iItem); virtual void OnRemoveSource(int iItem); + virtual CStdString GetStartFolder(const CStdString &dir); // new method virtual void PlayItem(int iItem); diff --git a/xbmc/GUIWindowPictures.cpp b/xbmc/GUIWindowPictures.cpp index 082f511c04..025ed0e699 100644 --- a/xbmc/GUIWindowPictures.cpp +++ b/xbmc/GUIWindowPictures.cpp @@ -80,77 +80,9 @@ bool CGUIWindowPictures::OnMessage(CGUIMessage& message) case GUI_MSG_WINDOW_INIT: { - // check for a passed destination path - CStdString strDestination = message.GetStringParam(); - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - CLog::Log(LOGINFO, "Attempting to quickpath to: %s", strDestination.c_str()); - m_history.ClearPathHistory(); - } - // otherwise, is this the first time accessing this window? - else if (m_vecItems->m_strPath == "?") - { - m_vecItems->m_strPath = strDestination = g_settings.m_defaultPictureSource; - CLog::Log(LOGINFO, "Attempting to default to: %s", strDestination.c_str()); - } - - // try to open the destination path - if (!strDestination.IsEmpty()) - { - // open root - if (strDestination.Equals("$ROOT")) - { - m_vecItems->m_strPath = ""; - CLog::Log(LOGINFO, " Success! Opening root listing."); - } - else - { - // default parameters if the jump fails - m_vecItems->m_strPath = ""; - - bool bIsSourceName = false; - - SetupShares(); - VECSOURCES shares; - m_rootDir.GetSources(shares); - int iIndex = CUtil::GetMatchingSource(strDestination, shares, bIsSourceName); - if (iIndex > -1) - { - bool bDoStuff = true; - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) - { - CFileItem item(shares[iIndex]); - if (!g_passwordManager.IsItemUnlocked(&item,"pictures")) - { - m_vecItems->m_strPath = ""; // no u don't - bDoStuff = false; - CLog::Log(LOGINFO, " Failure! Failed to unlock destination path: %s", strDestination.c_str()); - } - } - // set current directory to matching share - if (bDoStuff) - { - if (bIsSourceName) - m_vecItems->m_strPath=shares[iIndex].strPath; - else - m_vecItems->m_strPath=strDestination; - CUtil::RemoveSlashAtEnd(m_vecItems->m_strPath); - CLog::Log(LOGINFO, " Success! Opened destination path: %s", strDestination.c_str()); - } - } - else - { - CLog::Log(LOGERROR, " Failed! Destination parameter (%s) does not match a valid share!", strDestination.c_str()); - } - } - - // check for network up - if (CUtil::IsRemote(m_vecItems->m_strPath) && !WaitForNetwork()) - m_vecItems->m_strPath.Empty(); - - SetHistoryForPath(m_vecItems->m_strPath); - } + // is this the first time accessing this window? + if (m_vecItems->m_strPath == "?" || message.GetStringParam()) + m_vecItems->m_strPath = g_settings.m_defaultPictureSource; m_dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); @@ -600,3 +532,27 @@ void CGUIWindowPictures::OnInfo(int itemNumber) } } +CStdString CGUIWindowPictures::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("Plugins") || dir.Equals("Addons")) + return "addons://sources/executable/"; + + SetupShares(); + VECSOURCES shares; + m_rootDir.GetSources(shares); + bool bIsSourceName = false; + int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); + if (iIndex > -1) + { + if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + { + CFileItem item(shares[iIndex]); + if (!g_passwordManager.IsItemUnlocked(&item,"pictures")) + return ""; + } + if (bIsSourceName) + return shares[iIndex].strPath; + return dir; + } + return CGUIMediaWindow::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowPictures.h b/xbmc/GUIWindowPictures.h index a2e319b698..79538b4fd8 100644 --- a/xbmc/GUIWindowPictures.h +++ b/xbmc/GUIWindowPictures.h @@ -45,6 +45,7 @@ protected: virtual bool Update(const CStdString &strDirectory); virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); + virtual CStdString GetStartFolder(const CStdString &dir); void OnRegenerateThumbs(); virtual bool OnPlayMedia(int iItem); diff --git a/xbmc/GUIWindowPrograms.cpp b/xbmc/GUIWindowPrograms.cpp index 5060c23321..f4eb4cd15f 100644 --- a/xbmc/GUIWindowPrograms.cpp +++ b/xbmc/GUIWindowPrograms.cpp @@ -78,73 +78,11 @@ bool CGUIWindowPrograms::OnMessage(CGUIMessage& message) m_iRegionSet = 0; m_dlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); - // check for a passed destination path - CStdString strDestination = message.GetStringParam(); - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - CLog::Log(LOGINFO, "Attempting to quickpath to: %s", strDestination.c_str()); - // reset directory path, as we have effectively cleared it here - m_history.ClearPathHistory(); - } // is this the first time accessing this window? - // a quickpath overrides the a default parameter - if (m_vecItems->m_strPath == "?" && strDestination.IsEmpty()) - { - m_vecItems->m_strPath = strDestination = g_settings.m_defaultProgramSource; - CLog::Log(LOGINFO, "Attempting to default to: %s", strDestination.c_str()); - } + if (m_vecItems->m_strPath == "?" && message.GetStringParam().IsEmpty()) + m_vecItems->m_strPath = g_settings.m_defaultProgramSource; m_database.Open(); - // try to open the destination path - if (!strDestination.IsEmpty()) - { - // open root - if (strDestination.Equals("$ROOT")) - { - m_vecItems->m_strPath = ""; - CLog::Log(LOGINFO, " Success! Opening root listing."); - } - else - { - // default parameters if the jump fails - m_vecItems->m_strPath = ""; - - bool bIsSourceName = false; - SetupShares(); - VECSOURCES shares; - m_rootDir.GetSources(shares); - int iIndex = CUtil::GetMatchingSource(strDestination, shares, bIsSourceName); - if (iIndex > -1) - { - bool bDoStuff = true; - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) - { - CFileItem item(shares[iIndex]); - if (!g_passwordManager.IsItemUnlocked(&item,"programs")) - { - m_vecItems->m_strPath = ""; // no u don't - bDoStuff = false; - CLog::Log(LOGINFO, " Failure! Failed to unlock destination path: %s", strDestination.c_str()); - } - } - // set current directory to matching share - if (bDoStuff) - { - if (bIsSourceName) - m_vecItems->m_strPath=shares[iIndex].strPath; - else - m_vecItems->m_strPath=strDestination; - CLog::Log(LOGINFO, " Success! Opened destination path: %s", strDestination.c_str()); - } - } - else - { - CLog::Log(LOGERROR, " Failed! Destination parameter (%s) does not match a valid source!", strDestination.c_str()); - } - } - SetHistoryForPath(m_vecItems->m_strPath); - } return CGUIMediaWindow::OnMessage(message); } @@ -413,3 +351,28 @@ bool CGUIWindowPrograms::GetDirectory(const CStdString &strDirectory, CFileItemL return true; } + +CStdString CGUIWindowPrograms::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("Plugins") || dir.Equals("Addons")) + return "addons://sources/executable/"; + + SetupShares(); + VECSOURCES shares; + m_rootDir.GetSources(shares); + bool bIsSourceName = false; + int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); + if (iIndex > -1) + { + if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + { + CFileItem item(shares[iIndex]); + if (!g_passwordManager.IsItemUnlocked(&item,"programs")) + return ""; + } + if (bIsSourceName) + return shares[iIndex].strPath; + return dir; + } + return CGUIMediaWindow::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowPrograms.h b/xbmc/GUIWindowPrograms.h index 9b66398a19..37c1bc761a 100644 --- a/xbmc/GUIWindowPrograms.h +++ b/xbmc/GUIWindowPrograms.h @@ -40,6 +40,7 @@ protected: virtual bool GetDirectory(const CStdString &strDirectory, CFileItemList &items); virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); + virtual CStdString GetStartFolder(const CStdString &dir); int GetRegion(int iItem, bool bReload=false); diff --git a/xbmc/GUIWindowVideoBase.cpp b/xbmc/GUIWindowVideoBase.cpp index 90725eefcd..e2c107898f 100644 --- a/xbmc/GUIWindowVideoBase.cpp +++ b/xbmc/GUIWindowVideoBase.cpp @@ -1856,3 +1856,12 @@ void CGUIWindowVideoBase::OnScan(const CStdString& strPath) if (pDialog) pDialog->StartScanning(strPath, false); } + +CStdString CGUIWindowVideoBase::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("$PLAYLISTS") || dir.Equals("Playlists")) + return "special://videoplaylists/"; + else if (dir.Equals("Plugins") || dir.Equals("Addons")) + return "addons://sources/video/"; + return CGUIMediaWindow::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowVideoBase.h b/xbmc/GUIWindowVideoBase.h index 78c1f7570b..17a55dbc4f 100644 --- a/xbmc/GUIWindowVideoBase.h +++ b/xbmc/GUIWindowVideoBase.h @@ -65,6 +65,7 @@ protected: virtual void OnDeleteItem(CFileItemPtr pItem); virtual void OnDeleteItem(int iItem); virtual void DoSearch(const CStdString& strSearch, CFileItemList& items) {}; + virtual CStdString GetStartFolder(const CStdString &dir); bool OnClick(int iItem); void OnRestartItem(int iItem); diff --git a/xbmc/GUIWindowVideoFiles.cpp b/xbmc/GUIWindowVideoFiles.cpp index 46c37002aa..7d535626f0 100644 --- a/xbmc/GUIWindowVideoFiles.cpp +++ b/xbmc/GUIWindowVideoFiles.cpp @@ -72,86 +72,9 @@ bool CGUIWindowVideoFiles::OnMessage(CGUIMessage& message) { case GUI_MSG_WINDOW_INIT: { - // check for a passed destination path - CStdString strDestination = message.GetStringParam(); - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - g_settings.m_iVideoStartWindow = GetID(); - CLog::Log(LOGINFO, "Attempting to quickpath to: %s", strDestination.c_str()); - // reset directory path, as we have effectively cleared it here - m_history.ClearPathHistory(); - } - // is this the first time accessing this window? - // a quickpath overrides the a default parameter - if (m_vecItems->m_strPath == "?" && strDestination.IsEmpty()) - { - m_vecItems->m_strPath = strDestination = g_settings.m_defaultVideoSource; - CLog::Log(LOGINFO, "Attempting to default to: %s", strDestination.c_str()); - } - - // try to open the destination path - if (!strDestination.IsEmpty()) - { - // open root - if (strDestination.Equals("$ROOT")) - { - m_vecItems->m_strPath = ""; - CLog::Log(LOGINFO, " Success! Opening root listing."); - } - // open playlists location - else if (strDestination.Equals("$PLAYLISTS")) - { - m_vecItems->m_strPath = "special://videoplaylists/"; - CLog::Log(LOGINFO, " Success! Opening destination path: %s", m_vecItems->m_strPath.c_str()); - } - else - { - // default parameters if the jump fails - m_vecItems->m_strPath = ""; - - bool bIsSourceName = false; - - SetupShares(); - VECSOURCES shares; - m_rootDir.GetSources(shares); - int iIndex = CUtil::GetMatchingSource(strDestination, shares, bIsSourceName); - if (iIndex > -1) - { - bool bDoStuff = true; - if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) - { - CFileItem item(shares[iIndex]); - if (!g_passwordManager.IsItemUnlocked(&item,"video")) - { - m_vecItems->m_strPath = ""; // no u don't - bDoStuff = false; - CLog::Log(LOGINFO, " Failure! Failed to unlock destination path: %s", strDestination.c_str()); - } - } - // set current directory to matching share - if (bDoStuff) - { - if (bIsSourceName) - m_vecItems->m_strPath=shares[iIndex].strPath; - else - m_vecItems->m_strPath=strDestination; - CLog::Log(LOGINFO, " Success! Opened destination path: %s", strDestination.c_str()); - } - } - else - { - CLog::Log(LOGERROR, " Failed! Destination parameter (%s) does not match a valid source!", strDestination.c_str()); - } - } - - // check for network up - if (CUtil::IsRemote(m_vecItems->m_strPath) && !WaitForNetwork()) - m_vecItems->m_strPath.Empty(); - - SetHistoryForPath(m_vecItems->m_strPath); - } + if (m_vecItems->m_strPath == "?" && message.GetStringParam().IsEmpty()) + m_vecItems->m_strPath = g_settings.m_defaultVideoSource; return CGUIWindowVideoBase::OnMessage(message); } @@ -633,3 +556,26 @@ void CGUIWindowVideoFiles::OnQueueItem(int iItem) { CGUIWindowVideoBase::OnQueueItem(iItem); } + +CStdString CGUIWindowVideoFiles::GetStartFolder(const CStdString &dir) +{ + SetupShares(); + VECSOURCES shares; + m_rootDir.GetSources(shares); + bool bIsSourceName = false; + int iIndex = CUtil::GetMatchingSource(dir, shares, bIsSourceName); + if (iIndex > -1) + { + if (iIndex < (int)shares.size() && shares[iIndex].m_iHasLock == 2) + { + CFileItem item(shares[iIndex]); + if (!g_passwordManager.IsItemUnlocked(&item,"video")) + return ""; + } + // set current directory to matching share + if (bIsSourceName) + return shares[iIndex].strPath; + return dir; + } + return CGUIWindowVideoBase::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowVideoFiles.h b/xbmc/GUIWindowVideoFiles.h index 04b25b44b0..d35d8d8166 100644 --- a/xbmc/GUIWindowVideoFiles.h +++ b/xbmc/GUIWindowVideoFiles.h @@ -45,6 +45,7 @@ protected: virtual void UpdateButtons(); virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); + virtual CStdString GetStartFolder(const CStdString &dir); virtual void OnQueueItem(int iItem); virtual void OnAssignContent(int iItem, int iFound, ADDON::ScraperPtr& scraper, VIDEO::SScanSettings& settings); diff --git a/xbmc/GUIWindowVideoNav.cpp b/xbmc/GUIWindowVideoNav.cpp index 72897b2c3f..2d1e03ecb9 100644 --- a/xbmc/GUIWindowVideoNav.cpp +++ b/xbmc/GUIWindowVideoNav.cpp @@ -90,15 +90,6 @@ CGUIWindowVideoNav::~CGUIWindowVideoNav(void) bool CGUIWindowVideoNav::OnAction(const CAction &action) { - if (action.GetID() == ACTION_PARENT_DIR) - { - if (g_advancedSettings.m_bUseEvilB && - m_vecItems->m_strPath == m_startDirectory) - { - g_windowManager.PreviousWindow(); - return true; - } - } if (action.GetID() == ACTION_TOGGLE_WATCHED) { CFileItemPtr pItem = m_vecItems->Get(m_viewControl.GetSelectedItem()); @@ -125,95 +116,10 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message) { /* We don't want to show Autosourced items (ie removable pendrives, memorycards) in Library mode */ m_rootDir.AllowNonLocalSources(false); - // check for valid quickpath parameter - CStdString strDestination = message.GetNumStringParams() ? message.GetStringParam(0) : ""; - CStdString strReturn = message.GetNumStringParams() > 1 ? message.GetStringParam(1) : ""; - bool returning = strReturn.CompareNoCase("return") == 0; - - if (!strDestination.IsEmpty()) - { - message.SetStringParam(""); - CLog::Log(LOGINFO, "Attempting to %s to: %s", returning ? "return" : "quickpath", strDestination.c_str()); - } // is this the first time the window is opened? - if (m_vecItems->m_strPath == "?" && strDestination.IsEmpty()) - { - strDestination = g_settings.m_defaultVideoLibSource; - m_vecItems->m_strPath = strDestination; - CLog::Log(LOGINFO, "Attempting to default to: %s", strDestination.c_str()); - } - - CStdString destPath; - if (!strDestination.IsEmpty()) - { - if (strDestination.Equals("$ROOT") || strDestination.Equals("Root")) - destPath = ""; - else if (strDestination.Equals("MovieGenres")) - destPath = "videodb://1/1/"; - else if (strDestination.Equals("MovieTitles")) - destPath = "videodb://1/2/"; - else if (strDestination.Equals("MovieYears")) - destPath = "videodb://1/3/"; - else if (strDestination.Equals("MovieActors")) - destPath = "videodb://1/4/"; - else if (strDestination.Equals("MovieDirectors")) - destPath = "videodb://1/5/"; - else if (strDestination.Equals("MovieStudios")) - destPath = "videodb://1/6/"; - else if (strDestination.Equals("MovieSets")) - destPath = "videodb://1/7/"; - else if (strDestination.Equals("MovieCountries")) - destPath = "videodb://1/8/"; - else if (strDestination.Equals("Movies")) - destPath = "videodb://1/"; - else if (strDestination.Equals("TvShowGenres")) - destPath = "videodb://2/1/"; - else if (strDestination.Equals("TvShowTitles")) - destPath = "videodb://2/2/"; - else if (strDestination.Equals("TvShowYears")) - destPath = "videodb://2/3/"; - else if (strDestination.Equals("TvShowActors")) - destPath = "videodb://2/4/"; - else if (strDestination.Equals("TvShowStudios")) - destPath = "videodb://2/5/"; - else if (strDestination.Equals("TvShows")) - destPath = "videodb://2/"; - else if (strDestination.Equals("MusicVideoGenres")) - destPath = "videodb://3/1/"; - else if (strDestination.Equals("MusicVideoTitles")) - destPath = "videodb://3/2/"; - else if (strDestination.Equals("MusicVideoYears")) - destPath = "videodb://3/3/"; - else if (strDestination.Equals("MusicVideoArtists")) - destPath = "videodb://3/4/"; - else if (strDestination.Equals("MusicVideoDirectors")) - destPath = "videodb://3/5/"; - else if (strDestination.Equals("MusicVideoStudios")) - destPath = "videodb://3/6/"; - else if (strDestination.Equals("MusicVideos")) - destPath = "videodb://3/"; - else if (strDestination.Equals("RecentlyAddedMovies")) - destPath = "videodb://4/"; - else if (strDestination.Equals("RecentlyAddedEpisodes")) - destPath = "videodb://5/"; - else if (strDestination.Equals("RecentlyAddedMusicVideos")) - destPath = "videodb://6/"; - else if (strDestination.Equals("Playlists")) - destPath = "special://videoplaylists/"; - else if (strDestination.Equals("Plugins")) - destPath = "addons://sources/video/"; - else - { - CLog::Log(LOGWARNING, "Warning, destination parameter (%s) may not be valid", strDestination.c_str()); - destPath = strDestination; - } - if (!returning || m_vecItems->m_strPath.Left(destPath.GetLength()) != destPath) - { // we're not returning to the same path, so set our directory to the requested path - m_vecItems->m_strPath = destPath; - } - SetHistoryForPath(m_vecItems->m_strPath); - } + if (m_vecItems->m_strPath == "?" && message.GetStringParam().IsEmpty()) + m_vecItems->m_strPath = g_settings.m_defaultVideoLibSource; DisplayEmptyDatabaseMessage(false); // reset message state @@ -222,11 +128,6 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message) if (!CGUIWindowVideoBase::OnMessage(message)) return false; - if (message.GetParam1() != WINDOW_INVALID) - { // first time to this window - make sure we set the root path - m_startDirectory = returning ? destPath : ""; - } - // base class has opened the database, do our check m_database.Open(); DisplayEmptyDatabaseMessage(!m_database.HasContent()); @@ -1526,3 +1427,58 @@ bool CGUIWindowVideoNav::OnClick(int iItem) return CGUIWindowVideoBase::OnClick(iItem); } + +CStdString CGUIWindowVideoNav::GetStartFolder(const CStdString &dir) +{ + if (dir.Equals("MovieGenres")) + return "videodb://1/1/"; + else if (dir.Equals("MovieTitles")) + return "videodb://1/2/"; + else if (dir.Equals("MovieYears")) + return "videodb://1/3/"; + else if (dir.Equals("MovieActors")) + return "videodb://1/4/"; + else if (dir.Equals("MovieDirectors")) + return "videodb://1/5/"; + else if (dir.Equals("MovieStudios")) + return "videodb://1/6/"; + else if (dir.Equals("MovieSets")) + return "videodb://1/7/"; + else if (dir.Equals("MovieCountries")) + return "videodb://1/8/"; + else if (dir.Equals("Movies")) + return "videodb://1/"; + else if (dir.Equals("TvShowGenres")) + return "videodb://2/1/"; + else if (dir.Equals("TvShowTitles")) + return "videodb://2/2/"; + else if (dir.Equals("TvShowYears")) + return "videodb://2/3/"; + else if (dir.Equals("TvShowActors")) + return "videodb://2/4/"; + else if (dir.Equals("TvShowStudios")) + return "videodb://2/5/"; + else if (dir.Equals("TvShows")) + return "videodb://2/"; + else if (dir.Equals("MusicVideoGenres")) + return "videodb://3/1/"; + else if (dir.Equals("MusicVideoTitles")) + return "videodb://3/2/"; + else if (dir.Equals("MusicVideoYears")) + return "videodb://3/3/"; + else if (dir.Equals("MusicVideoArtists")) + return "videodb://3/4/"; + else if (dir.Equals("MusicVideoDirectors")) + return "videodb://3/5/"; + else if (dir.Equals("MusicVideoStudios")) + return "videodb://3/6/"; + else if (dir.Equals("MusicVideos")) + return "videodb://3/"; + else if (dir.Equals("RecentlyAddedMovies")) + return "videodb://4/"; + else if (dir.Equals("RecentlyAddedEpisodes")) + return "videodb://5/"; + else if (dir.Equals("RecentlyAddedMusicVideos")) + return "videodb://6/"; + return CGUIWindowVideoBase::GetStartFolder(dir); +} diff --git a/xbmc/GUIWindowVideoNav.h b/xbmc/GUIWindowVideoNav.h index ee79241758..510188ab06 100644 --- a/xbmc/GUIWindowVideoNav.h +++ b/xbmc/GUIWindowVideoNav.h @@ -54,6 +54,7 @@ protected: virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button); virtual bool OnClick(int iItem); + virtual CStdString GetStartFolder(const CStdString &dir); virtual CStdString GetQuickpathName(const CStdString& strPath) const; @@ -62,6 +63,4 @@ protected: VECSOURCES m_shares; bool m_bDisplayEmptyDatabaseMessage; ///< If true we display a message informing the user to switch back to the Files view. - - CStdString m_startDirectory; }; |