From e54ccf4192c293ccaee1b3258766ec3eb23c6417 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 26 Jun 2014 11:29:48 +0200 Subject: [PATCH] [stdstring] get rid of CStdString in video/windows/ --- xbmc/video/windows/GUIWindowFullScreen.cpp | 28 +++--- xbmc/video/windows/GUIWindowVideoBase.cpp | 91 ++++++++--------- xbmc/video/windows/GUIWindowVideoBase.h | 14 +-- xbmc/video/windows/GUIWindowVideoNav.cpp | 97 ++++++++++--------- xbmc/video/windows/GUIWindowVideoNav.h | 4 +- xbmc/video/windows/GUIWindowVideoPlaylist.cpp | 10 +- 6 files changed, 124 insertions(+), 120 deletions(-) diff --git a/xbmc/video/windows/GUIWindowFullScreen.cpp b/xbmc/video/windows/GUIWindowFullScreen.cpp index dfbf773fdf0ad..eeeda4420aa06 100644 --- a/xbmc/video/windows/GUIWindowFullScreen.cpp +++ b/xbmc/video/windows/GUIWindowFullScreen.cpp @@ -261,7 +261,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) else { int autoCloseTime = CSettings::Get().GetBool("pvrplayback.confirmchannelswitch") ? 0 : g_advancedSettings.m_iPVRNumericChannelSwitchTimeout; - CStdString strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0); + std::string strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0); if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000), autoCloseTime) || autoCloseTime) { int iChannelNumber = atoi(strChannel.c_str()); @@ -281,7 +281,7 @@ bool CGUIWindowFullScreen::OnAction(const CAction &action) { // filesystem provider like slingbox, cmyth, etc int iChannelNumber = -1; - CStdString strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0); + std::string strChannel = StringUtils::Format("%i", action.GetID() - REMOTE_0); if (CGUIDialogNumeric::ShowAndGetNumber(strChannel, g_localizeStrings.Get(19000))) iChannelNumber = atoi(strChannel.c_str()); @@ -466,7 +466,7 @@ bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message) // Get the currently selected label of the Select button CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl); OnMessage(msg); - CStdString strLabel = msg.GetLabel(); + std::string strLabel = msg.GetLabel(); CPVRChannelPtr playingChannel; if (g_PVRManager.GetCurrentChannel(playingChannel)) @@ -561,7 +561,7 @@ void CGUIWindowFullScreen::FrameMove() if (m_showCodec) { // show audio codec info - CStdString strAudio, strVideo, strGeneral; + std::string strAudio, strVideo, strGeneral; g_application.m_pPlayer->GetAudioInfo(strAudio); { CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1); @@ -578,19 +578,19 @@ void CGUIWindowFullScreen::FrameMove() // show general info g_application.m_pPlayer->GetGeneralInfo(strGeneral); { - CStdString strGeneralFPS; + std::string strGeneralFPS; #if defined(TARGET_DARWIN) // We show CPU usage for the entire process, as it's arguably more useful. double dCPU = m_resourceCounter.GetCPUUsage(); - CStdString strCores; + std::string strCores; strCores = StringUtils::Format("cpu:%.0f%%", dCPU); #else - CStdString strCores = g_cpuInfo.GetCoresUsageString(); + std::string strCores = g_cpuInfo.GetCoresUsageString(); #endif int missedvblanks; double refreshrate; double clockspeed; - CStdString strClock; + std::string strClock; if (g_VideoReferenceClock.GetClockInfo(missedvblanks, clockspeed, refreshrate)) strClock = StringUtils::Format("S( refresh:%.3f missed:%i speed:%+.3f%% %s )" @@ -622,9 +622,9 @@ void CGUIWindowFullScreen::FrameMove() { // get the "View Mode" string - CStdString strTitle = g_localizeStrings.Get(629); - CStdString strMode = g_localizeStrings.Get(630 + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); - CStdString strInfo = StringUtils::Format("%s : %s", strTitle.c_str(), strMode.c_str()); + std::string strTitle = g_localizeStrings.Get(629); + std::string strMode = g_localizeStrings.Get(630 + CMediaSettings::Get().GetCurrentVideoSettings().m_ViewMode); + std::string strInfo = StringUtils::Format("%s : %s", strTitle.c_str(), strMode.c_str()); CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1); msg.SetLabel(strInfo); OnMessage(msg); @@ -637,7 +637,7 @@ void CGUIWindowFullScreen::FrameMove() float xscale = (float)res.iScreenWidth / (float)res.iWidth; float yscale = (float)res.iScreenHeight / (float)res.iHeight; - CStdString strSizing = StringUtils::Format(g_localizeStrings.Get(245).c_str(), + std::string strSizing = StringUtils::Format(g_localizeStrings.Get(245).c_str(), (int)info.SrcRect.Width(), (int)info.SrcRect.Height(), (int)(info.DestRect.Width() * xscale), @@ -652,7 +652,7 @@ void CGUIWindowFullScreen::FrameMove() } // show resolution information { - CStdString strStatus; + std::string strStatus; if (g_Windowing.IsFullScreen()) strStatus = StringUtils::Format("%s %ix%i@%.2fHz - %s", g_localizeStrings.Get(13287).c_str(), @@ -680,7 +680,7 @@ void CGUIWindowFullScreen::FrameMove() m_timeCodeShow = false; m_timeCodePosition = 0; } - CStdString strDispTime = "00:00:00"; + std::string strDispTime = "00:00:00"; CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), LABEL_ROW1); diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index aceb11a672ad9..4abf94d8a10a8 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -97,8 +97,8 @@ using namespace PVR; #define PROPERTY_GROUP_BY "group.by" #define PROPERTY_GROUP_MIXED "group.mixed" -CGUIWindowVideoBase::CGUIWindowVideoBase(int id, const CStdString &xmlFile) - : CGUIMediaWindow(id, xmlFile) +CGUIWindowVideoBase::CGUIWindowVideoBase(int id, const std::string &xmlFile) + : CGUIMediaWindow(id, xmlFile.c_str()) { m_thumbLoader.SetObserver(this); m_stackingAvailable = true; @@ -261,7 +261,7 @@ void CGUIWindowVideoBase::UpdateButtons() g_windowManager.SendMessage(msg); // Add labels to the window selection - CStdString strItem = g_localizeStrings.Get(744); // Files + std::string strItem = g_localizeStrings.Get(744); // Files CGUIMessage msg2(GUI_MSG_LABEL_ADD, GetID(), CONTROL_BTNTYPE); msg2.SetLabel(strItem); g_windowManager.SendMessage(msg2); @@ -422,7 +422,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2, boo // NOTE: This will fail for episodes on multipath shares, as the parent path isn't what is stored in the // database. Possible solutions are to store the paths in the db separately and rely on the show // stacking stuff, or to modify GetTvShowId to do support multipath:// shares - CStdString strParentDirectory; + std::string strParentDirectory; URIUtils::GetParentPath(item->GetPath(), strParentDirectory); if (m_database.GetTvShowId(strParentDirectory) < 0) { @@ -487,7 +487,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2, boo return false; // Get the correct movie title - CStdString movieName = item->GetMovieName(settings.parent_name); + std::string movieName = item->GetMovieName(settings.parent_name); CScraperUrl scrUrl; CVideoInfoScanner scanner; @@ -531,7 +531,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2, boo if (!hasDetails && (scrUrl.m_url.size() == 0 || needsRefresh)) { // 4a. show dialog that we're busy querying www.imdb.com - CStdString strHeading = StringUtils::Format(g_localizeStrings.Get(197).c_str(),info->Name().c_str()); + std::string strHeading = StringUtils::Format(g_localizeStrings.Get(197).c_str(),info->Name().c_str()); pDlgProgress->SetHeading(strHeading); pDlgProgress->SetLine(0, movieName); pDlgProgress->SetLine(1, ""); @@ -619,7 +619,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const ScraperPtr &info2, boo item->ClearArt(); CFileItemList list; - CStdString strPath=item->GetPath(); + std::string strPath=item->GetPath(); if (item->IsVideoDb() || fromDB) { vector paths; @@ -808,7 +808,7 @@ void CGUIWindowVideoBase::AddItemToPlayList(const CFileItemPtr &pItem, CFileItem { if (items[i]->m_bIsFolder) { - CStdString strPath = items[i]->GetPath(); + std::string strPath = items[i]->GetPath(); URIUtils::RemoveSlashAtEnd(strPath); if (StringUtils::EndsWithNoCase(strPath, "sample")) // skip sample folders { @@ -886,7 +886,7 @@ void CGUIWindowVideoBase::GetResumeItemOffset(const CFileItem *item, int& starto else { CBookmark bookmark; - CStdString strPath = item->GetPath(); + std::string strPath = item->GetPath(); if ((item->IsVideoDb() || item->IsDVD()) && item->HasVideoInfoTag()) strPath = item->GetVideoInfoTag()->m_strFileNameAndPath; @@ -925,7 +925,7 @@ bool CGUIWindowVideoBase::OnSelect(int iItem) CFileItemPtr item = m_vecItems->Get(iItem); - CStdString path = item->GetPath(); + std::string path = item->GetPath(); if (!item->m_bIsFolder && path != "add" && path != "addons://more/video" && !StringUtils::StartsWith(path, "newsmartplaylist://") && !StringUtils::StartsWith(path, "newplaylist://") && @@ -951,13 +951,13 @@ bool CGUIWindowVideoBase::OnFileAction(int iItem, int action) if (item->IsVideoDb()) { - CStdString itemPath(item->GetPath()); + std::string itemPath(item->GetPath()); itemPath = item->GetVideoInfoTag()->m_strFileNameAndPath; if (URIUtils::IsStack(itemPath) && CFileItem(CStackDirectory::GetFirstStackedFile(itemPath),false).IsDiscImage()) choices.Add(SELECT_ACTION_PLAYPART, 20324); // Play Part } - CStdString resumeString = GetResumeString(*item); + std::string resumeString = GetResumeString(*item); if (!resumeString.empty()) { choices.Add(SELECT_ACTION_RESUME, resumeString); @@ -1015,7 +1015,7 @@ bool CGUIWindowVideoBase::OnInfo(int iItem) ADDON::ScraperPtr scraper; if (!m_vecItems->IsPlugin() && !m_vecItems->IsRSS() && !m_vecItems->IsLiveTV()) { - CStdString strDir; + std::string strDir; if (item->IsVideoDb() && item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strPath.empty()) @@ -1051,9 +1051,9 @@ void CGUIWindowVideoBase::OnRestartItem(int iItem) CGUIMediaWindow::OnClick(iItem); } -CStdString CGUIWindowVideoBase::GetResumeString(const CFileItem &item) +std::string CGUIWindowVideoBase::GetResumeString(const CFileItem &item) { - CStdString resumeString; + std::string resumeString; int startOffset = 0, startPart = 0; GetResumeItemOffset(&item, startOffset, startPart); if (startOffset > 0) @@ -1061,7 +1061,7 @@ CStdString CGUIWindowVideoBase::GetResumeString(const CFileItem &item) resumeString = StringUtils::Format(g_localizeStrings.Get(12022).c_str(), StringUtils::SecondsToTimeString(startOffset/75).c_str()); if (startPart > 0) { - CStdString partString = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), startPart); + std::string partString = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), startPart); resumeString += " (" + partString + ")"; } } @@ -1072,7 +1072,7 @@ bool CGUIWindowVideoBase::ShowResumeMenu(CFileItem &item) { if (!item.m_bIsFolder && !item.IsLiveTV()) { - CStdString resumeString = GetResumeString(item); + std::string resumeString = GetResumeString(item); if (!resumeString.empty()) { // prompt user whether they wish to resume CContextButtons choices; @@ -1097,7 +1097,7 @@ bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item) if (CSettings::Get().GetInt("disc.playback") != BD_PLAYBACK_SIMPLE_MENU) return true; - CStdString path; + std::string path; if (item->IsVideoDb()) path = item->GetVideoInfoTag()->m_strFileNameAndPath; else @@ -1105,7 +1105,7 @@ bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item) if (item->IsBDFile()) { - CStdString root = URIUtils::GetParentPath(path); + std::string root = URIUtils::GetParentPath(path); URIUtils::RemoveSlashAtEnd(root); if(URIUtils::GetFileName(root) == "BDMV") { @@ -1132,7 +1132,7 @@ bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item) return true; } -bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item, const CStdString& directory) +bool CGUIWindowVideoBase::ShowPlaySelection(CFileItemPtr& item, const std::string& directory) { CFileItemList items; @@ -1196,7 +1196,7 @@ bool CGUIWindowVideoBase::OnResumeItem(int iItem) return true; } - CStdString resumeString = GetResumeString(*item); + std::string resumeString = GetResumeString(*item); if (!resumeString.empty()) { @@ -1223,7 +1223,7 @@ void CGUIWindowVideoBase::GetContextButtons(int itemNumber, CContextButtons &but { if (!item->IsParentFolder()) { - CStdString path(item->GetPath()); + std::string path(item->GetPath()); if (item->IsVideoDb() && item->HasVideoInfoTag()) path = item->GetVideoInfoTag()->m_strFileNameAndPath; @@ -1302,7 +1302,7 @@ bool CGUIWindowVideoBase::OnPlayStackPart(int iItem) return false; CFileItemPtr stack = m_vecItems->Get(iItem); - CStdString path(stack->GetPath()); + std::string path(stack->GetPath()); if (stack->IsVideoDb()) path = stack->GetVideoInfoTag()->m_strFileNameAndPath; @@ -1321,7 +1321,7 @@ bool CGUIWindowVideoBase::OnPlayStackPart(int iItem) // ISO stack if (CFileItem(CStackDirectory::GetFirstStackedFile(path),false).IsDiscImage()) { - CStdString resumeString = CGUIWindowVideoBase::GetResumeString(*(parts[selectedFile - 1].get())); + std::string resumeString = CGUIWindowVideoBase::GetResumeString(*(parts[selectedFile - 1].get())); stack->m_lStartOffset = 0; if (!resumeString.empty()) { @@ -1441,7 +1441,7 @@ bool CGUIWindowVideoBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button) ADDON::ScraperPtr info; SScanSettings settings; GetScraperForItem(item.get(), info, settings); - CStdString strPath = item->GetPath(); + std::string strPath = item->GetPath(); if (item->IsVideoDb() && (!item->m_bIsFolder || item->GetVideoInfoTag()->m_strPath.empty())) return false; @@ -1465,7 +1465,7 @@ bool CGUIWindowVideoBase::OnContextButton(int itemNumber, CONTEXT_BUTTON button) return true; case CONTEXT_BUTTON_EDIT_SMART_PLAYLIST: { - CStdString playlist = m_vecItems->Get(itemNumber)->IsSmartPlayList() ? m_vecItems->Get(itemNumber)->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items + std::string playlist = m_vecItems->Get(itemNumber)->IsSmartPlayList() ? m_vecItems->Get(itemNumber)->GetPath() : m_vecItems->GetPath(); // save path as activatewindow will destroy our items if (CGUIDialogSmartPlaylistEditor::EditPlaylist(playlist, "video")) Refresh(true); // need to update return true; @@ -1521,21 +1521,21 @@ bool CGUIWindowVideoBase::OnPlayMedia(int iItem) CFileItemPtr tag = g_PVRRecordings->GetByPath(item.GetPath()); if (tag && tag->HasPVRRecordingInfoTag() && !tag->GetPVRRecordingInfoTag()->m_strStreamURL.empty()) { - CStdString stream = tag->GetPVRRecordingInfoTag()->m_strStreamURL; + std::string stream = tag->GetPVRRecordingInfoTag()->m_strStreamURL; /* Isolate the folder from the filename */ size_t found = stream.find_last_of("/"); - if (found == CStdString::npos) + if (found == std::string::npos) found = stream.find_last_of("\\"); - if (found != CStdString::npos) + if (found != std::string::npos) { /* Check here for asterix at the begin of the filename */ if (stream[found+1] == '*') { /* Create a "stack://" url with all files matching the extension */ - CStdString ext = URIUtils::GetExtension(stream); - CStdString dir = stream.substr(0, found).c_str(); + std::string ext = URIUtils::GetExtension(stream); + std::string dir = stream.substr(0, found).c_str(); CFileItemList items; CDirectory::GetDirectory(dir, items); @@ -1552,7 +1552,7 @@ bool CGUIWindowVideoBase::OnPlayMedia(int iItem) { /* If we have a stack change the path of the item to it */ CStackDirectory dir; - CStdString stackPath = dir.ConstructStackPath(items, stack); + std::string stackPath = dir.ConstructStackPath(items, stack); item.SetPath(stackPath); } } @@ -1816,9 +1816,12 @@ void CGUIWindowVideoBase::GetGroupedItems(CFileItemList &items) bool CGUIWindowVideoBase::CheckFilterAdvanced(CFileItemList &items) const { - CStdString content = items.GetContent(); + std::string content = items.GetContent(); if ((items.IsVideoDb() || CanContainFilter(m_strFilterPath)) && - (content.Equals("movies") || content.Equals("tvshows") || content.Equals("episodes") || content.Equals("musicvideos"))) + (StringUtils::EqualsNoCase(content, "movies") || + StringUtils::EqualsNoCase(content, "tvshows") || + StringUtils::EqualsNoCase(content, "episodes") || + StringUtils::EqualsNoCase(content, "musicvideos"))) return true; return false; @@ -1843,7 +1846,7 @@ void CGUIWindowVideoBase::AddToDatabase(int iItem) // prompt for data // enter a new title - CStdString strTitle = pItem->GetLabel(); + std::string strTitle = pItem->GetLabel(); if (!CGUIKeyboardFactory::ShowAndGetInput(strTitle, g_localizeStrings.Get(528), false)) // Enter Title return; @@ -1860,7 +1863,7 @@ void CGUIWindowVideoBase::AddToDatabase(int iItem) pSelect->SetItems(&items); pSelect->EnableButton(true, 531); // New Genre pSelect->DoModal(); - CStdString strGenre; + std::string strGenre; int iSelected = pSelect->GetSelectedLabel(); if (iSelected >= 0) strGenre = items[iSelected]->GetLabel(); @@ -1898,7 +1901,7 @@ void CGUIWindowVideoBase::AddToDatabase(int iItem) /// \brief Search the current directory for a string got from the virtual keyboard void CGUIWindowVideoBase::OnSearch() { - CStdString strSearch; + std::string strSearch; if (!CGUIKeyboardFactory::ShowAndGetInput(strSearch, g_localizeStrings.Get(16017), false)) return ; @@ -1952,8 +1955,8 @@ void CGUIWindowVideoBase::OnSearchItemFound(const CFileItem* pSelItem) { if (pSelItem->m_bIsFolder) { - CStdString strPath = pSelItem->GetPath(); - CStdString strParentPath; + std::string strPath = pSelItem->GetPath(); + std::string strParentPath; URIUtils::GetParentPath(strPath, strParentPath); Update(strParentPath); @@ -1980,7 +1983,7 @@ void CGUIWindowVideoBase::OnSearchItemFound(const CFileItem* pSelItem) } else { - CStdString strPath = URIUtils::GetDirectory(pSelItem->GetPath()); + std::string strPath = URIUtils::GetDirectory(pSelItem->GetPath()); Update(strPath); @@ -2022,11 +2025,11 @@ int CGUIWindowVideoBase::GetScraperForItem(CFileItem *item, ADDON::ScraperPtr &i } bool foundDirectly = false; - info = m_database.GetScraperForPath(item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strPath.empty() ? CStdString(item->GetVideoInfoTag()->m_strPath) : item->GetPath(), settings, foundDirectly); + info = m_database.GetScraperForPath(item->HasVideoInfoTag() && !item->GetVideoInfoTag()->m_strPath.empty() ? std::string(item->GetVideoInfoTag()->m_strPath) : item->GetPath(), settings, foundDirectly); return foundDirectly ? 1 : 0; } -void CGUIWindowVideoBase::OnScan(const CStdString& strPath, bool scanAll) +void CGUIWindowVideoBase::OnScan(const std::string& strPath, bool scanAll) { g_application.StartVideoScan(strPath, true, scanAll); } @@ -2054,7 +2057,7 @@ void CGUIWindowVideoBase::AppendAndClearSearchItems(CFileItemList &searchItems, searchItems.Clear(); } -bool CGUIWindowVideoBase::OnUnAssignContent(const CStdString &path, int label1, int label2, int label3) +bool CGUIWindowVideoBase::OnUnAssignContent(const std::string &path, int label1, int label2, int label3) { bool bCanceled; CVideoDatabase db; @@ -2082,7 +2085,7 @@ bool CGUIWindowVideoBase::OnUnAssignContent(const CStdString &path, int label1, return false; } -void CGUIWindowVideoBase::OnAssignContent(const CStdString &path) +void CGUIWindowVideoBase::OnAssignContent(const std::string &path) { bool bScan=false; CVideoDatabase db; diff --git a/xbmc/video/windows/GUIWindowVideoBase.h b/xbmc/video/windows/GUIWindowVideoBase.h index 9cb7e7c112427..170f626ec00fe 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.h +++ b/xbmc/video/windows/GUIWindowVideoBase.h @@ -39,7 +39,7 @@ enum VideoSelectAction class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObserver { public: - CGUIWindowVideoBase(int id, const CStdString &xmlFile); + CGUIWindowVideoBase(int id, const std::string &xmlFile); virtual ~CGUIWindowVideoBase(void); virtual bool OnMessage(CGUIMessage& message); virtual bool OnAction(const CAction &action); @@ -53,7 +53,7 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse /*! \brief Show dialog allowing selection of wanted playback item */ static bool ShowPlaySelection(CFileItemPtr& item); - static bool ShowPlaySelection(CFileItemPtr& item, const CStdString& directory); + static bool ShowPlaySelection(CFileItemPtr& item, const std::string& directory); /*! \brief Show the resume menu for this item (if it has a resume bookmark) @@ -81,16 +81,16 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse and optionally start a scan \param path the path to assign content for */ - static void OnAssignContent(const CStdString &path); + static void OnAssignContent(const std::string &path); /*! \brief checks the database for a resume position and puts together a string \param item selected item \return string containing the resume position or an empty string if there is no resume position */ - static CStdString GetResumeString(const CFileItem &item); + static std::string GetResumeString(const CFileItem &item); protected: - void OnScan(const CStdString& strPath, bool scanAll = false); + void OnScan(const std::string& strPath, bool scanAll = false); virtual void OnInitWindow(); virtual void UpdateButtons(); virtual bool Update(const std::string &strDirectory, bool updateFilterPath = true); @@ -106,7 +106,7 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse virtual void OnQueueItem(int iItem); virtual void OnDeleteItem(CFileItemPtr pItem); virtual void OnDeleteItem(int iItem); - virtual void DoSearch(const CStdString& strSearch, CFileItemList& items) {}; + virtual void DoSearch(const std::string& strSearch, CFileItemList& items) {}; virtual std::string GetStartFolder(const std::string &dir); bool OnClick(int iItem); @@ -138,7 +138,7 @@ class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObse void OnSearchItemFound(const CFileItem* pSelItem); int GetScraperForItem(CFileItem *item, ADDON::ScraperPtr &info, VIDEO::SScanSettings& settings); - static bool OnUnAssignContent(const CStdString &path, int label1, int label2, int label3); + static bool OnUnAssignContent(const std::string &path, int label1, int label2, int label3); static bool StackingAvailable(const CFileItemList &items); diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 468e00f984e13..3d60186461571 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -200,66 +200,67 @@ bool CGUIWindowVideoNav::OnMessage(CGUIMessage& message) return CGUIWindowVideoBase::OnMessage(message); } -CStdString CGUIWindowVideoNav::GetQuickpathName(const CStdString& strPath) const +std::string CGUIWindowVideoNav::GetQuickpathName(const std::string& strPath) const { - CStdString path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); - if (path.Equals("videodb://movies/genres/")) + std::string path = CLegacyPathTranslation::TranslateVideoDbPath(strPath); + StringUtils::ToLower(path); + if (path == "videodb://movies/genres/") return "MovieGenres"; - else if (path.Equals("videodb://movies/titles/")) + else if (path == "videodb://movies/titles/") return "MovieTitles"; - else if (path.Equals("videodb://movies/years/")) + else if (path == "videodb://movies/years/") return "MovieYears"; - else if (path.Equals("videodb://movies/actors/")) + else if (path == "videodb://movies/actors/") return "MovieActors"; - else if (path.Equals("videodb://movies/directors/")) + else if (path == "videodb://movies/directors/") return "MovieDirectors"; - else if (path.Equals("videodb://movies/studios/")) + else if (path == "videodb://movies/studios/") return "MovieStudios"; - else if (path.Equals("videodb://movies/sets/")) + else if (path == "videodb://movies/sets/") return "MovieSets"; - else if (path.Equals("videodb://movies/countries/")) + else if (path == "videodb://movies/countries/") return "MovieCountries"; - else if (path.Equals("videodb://movies/tags/")) + else if (path == "videodb://movies/tags/") return "MovieTags"; - else if (path.Equals("videodb://movies/")) + else if (path == "videodb://movies/") return "Movies"; - else if (path.Equals("videodb://tvshows/genres/")) + else if (path == "videodb://tvshows/genres/") return "TvShowGenres"; - else if (path.Equals("videodb://tvshows/titles/")) + else if (path == "videodb://tvshows/titles/") return "TvShowTitles"; - else if (path.Equals("videodb://tvshows/years/")) + else if (path == "videodb://tvshows/years/") return "TvShowYears"; - else if (path.Equals("videodb://tvshows/actors/")) + else if (path == "videodb://tvshows/actors/") return "TvShowActors"; - else if (path.Equals("videodb://tvshows/studios/")) + else if (path == "videodb://tvshows/studios/") return "TvShowStudios"; - else if (path.Equals("videodb://tvshows/tags/")) + else if (path == "videodb://tvshows/tags/") return "TvShowTags"; - else if (path.Equals("videodb://tvshows/")) + else if (path == "videodb://tvshows/") return "TvShows"; - else if (path.Equals("videodb://musicvideos/genres/")) + else if (path == "videodb://musicvideos/genres/") return "MusicVideoGenres"; - else if (path.Equals("videodb://musicvideos/titles/")) + else if (path == "videodb://musicvideos/titles/") return "MusicVideoTitles"; - else if (path.Equals("videodb://musicvideos/years/")) + else if (path == "videodb://musicvideos/years/") return "MusicVideoYears"; - else if (path.Equals("videodb://musicvideos/artists/")) + else if (path == "videodb://musicvideos/artists/") return "MusicVideoArtists"; - else if (path.Equals("videodb://musicvideos/albums/")) + else if (path == "videodb://musicvideos/albums/") return "MusicVideoDirectors"; - else if (path.Equals("videodb://musicvideos/tags/")) + else if (path == "videodb://musicvideos/tags/") return "MusicVideoTags"; - else if (path.Equals("videodb://musicvideos/")) + else if (path == "videodb://musicvideos/") return "MusicVideos"; - else if (path.Equals("videodb://recentlyaddedmovies/")) + else if (path == "videodb://recentlyaddedmovies/") return "RecentlyAddedMovies"; - else if (path.Equals("videodb://recentlyaddedepisodes/")) + else if (path == "videodb://recentlyaddedepisodes/") return "RecentlyAddedEpisodes"; - else if (path.Equals("videodb://recentlyaddedmusicvideos/")) + else if (path == "videodb://recentlyaddedmusicvideos/") return "RecentlyAddedMusicVideos"; - else if (path.Equals("special://videoplaylists/")) + else if (path == "special://videoplaylists/") return "Playlists"; - else if (path.Equals("sources://video/")) + else if (path == "sources://video/") return "Files"; else { @@ -423,7 +424,7 @@ bool CGUIWindowVideoNav::GetDirectory(const std::string &strDirectory, CFileItem } else if (!items.IsVirtualDirectoryRoot()) { // load info from the database - CStdString label; + std::string label; if (items.GetLabel().empty() && m_rootDir.IsSource(items.GetPath(), CMediaSourceSettings::Get().GetSources("video"), &label)) items.SetLabel(label); if (!items.IsSourcesPath()) @@ -456,7 +457,7 @@ void CGUIWindowVideoNav::LoadVideoInfo(CFileItemList &items, CVideoDatabase &dat if (!items.GetContent().empty() && !items.IsPlugin()) return; // don't load for listings that have content set and weren't created from plugins - CStdString content = items.GetContent(); + std::string content = items.GetContent(); // determine content only if it isn't set if (content.empty()) { @@ -561,11 +562,11 @@ void CGUIWindowVideoNav::UpdateButtons() StringUtils::StartsWith(m_vecItems->Get(m_vecItems->Size()-1)->GetPath(), "/-1/")) iItems--; } - CStdString items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); + std::string items = StringUtils::Format("%i %s", iItems, g_localizeStrings.Get(127).c_str()); SET_CONTROL_LABEL(CONTROL_LABELFILES, items); // set the filter label - CStdString strLabel; + std::string strLabel; // "Playlists" if (m_vecItems->IsPath("special://videoplaylists/")) @@ -574,7 +575,7 @@ void CGUIWindowVideoNav::UpdateButtons() else if (m_vecItems->IsPlayList()) { // get playlist name from path - CStdString strDummy; + std::string strDummy; URIUtils::Split(m_vecItems->GetPath(), strDummy, strLabel); } else if (m_vecItems->IsPath("sources://video/")) @@ -612,7 +613,7 @@ bool CGUIWindowVideoNav::GetFilteredItems(const std::string &filter, CFileItemLi /// \brief video databases and return the found \e items /// \param strSearch The search string /// \param items Items Found -void CGUIWindowVideoNav::DoSearch(const CStdString& strSearch, CFileItemList& items) +void CGUIWindowVideoNav::DoSearch(const std::string& strSearch, CFileItemList& items) { CFileItemList tempItems; std::string strGenre = g_localizeStrings.Get(515); // Genre @@ -693,7 +694,7 @@ void CGUIWindowVideoNav::OnInfo(CFileItem* pItem, ADDON::ScraperPtr& scraper) scraper = m_database.GetScraperForPath(pItem->GetVideoInfoTag()->m_strPath); else { - CStdString strPath,strFile; + std::string strPath,strFile; URIUtils::Split(pItem->GetPath(),strPath,strFile); scraper = m_database.GetScraperForPath(strPath); } @@ -719,7 +720,7 @@ void CGUIWindowVideoNav::OnDeleteItem(CFileItemPtr pItem) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(432); - CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(433).c_str(),pItem->GetLabel().c_str()); + std::string strLabel = StringUtils::Format(g_localizeStrings.Get(433).c_str(),pItem->GetLabel().c_str()); pDialog->SetLine(1, strLabel); pDialog->SetLine(2, "");; pDialog->DoModal(); @@ -740,7 +741,7 @@ void CGUIWindowVideoNav::OnDeleteItem(CFileItemPtr pItem) { CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO); pDialog->SetHeading(432); - CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(433).c_str(), pItem->GetLabel().c_str()); + std::string strLabel = StringUtils::Format(g_localizeStrings.Get(433).c_str(), pItem->GetLabel().c_str()); pDialog->SetLine(1, strLabel); pDialog->SetLine(2, ""); pDialog->DoModal(); @@ -921,7 +922,7 @@ void CGUIWindowVideoNav::GetContextButtons(int itemNumber, CContextButtons &butt { // non-video db items, file operations are allowed if ((CSettings::Get().GetBool("filelists.allowfiledeletion") && CUtil::SupportsWriteFileOperations(item->GetPath())) || - (inPlaylists && !URIUtils::GetFileName(item->GetPath()).Equals("PartyMode-Video.xsp") + (inPlaylists && URIUtils::GetFileName(item->GetPath()) != "PartyMode-Video.xsp" && (item->IsPlayList() || item->IsSmartPlayList()))) { buttons.Add(CONTEXT_BUTTON_DELETE, 117); @@ -1001,7 +1002,7 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) } case CONTEXT_BUTTON_GO_TO_ARTIST: { - CStdString strPath; + std::string strPath; CMusicDatabase database; database.Open(); strPath = StringUtils::Format("musicdb://artists/%i/", @@ -1011,7 +1012,7 @@ bool CGUIWindowVideoNav::OnContextButton(int itemNumber, CONTEXT_BUTTON button) } case CONTEXT_BUTTON_GO_TO_ALBUM: { - CStdString strPath; + std::string strPath; CMusicDatabase database; database.Open(); strPath = StringUtils::Format("musicdb://albums/%i/", @@ -1064,7 +1065,7 @@ bool CGUIWindowVideoNav::OnClick(int iItem) } //Get the new title - CStdString strTag; + std::string strTag; if (!CGUIKeyboardFactory::ShowAndGetInput(strTag, g_localizeStrings.Get(20462), false)) return true; @@ -1073,22 +1074,22 @@ bool CGUIWindowVideoNav::OnClick(int iItem) return true; // get the media type and convert from plural to singular (by removing the trailing "s") - CStdString mediaType = item->GetPath().substr(9); + std::string mediaType = item->GetPath().substr(9); mediaType = mediaType.substr(0, mediaType.size() - 1); - CStdString localizedType = CGUIDialogVideoInfo::GetLocalizedVideoType(mediaType); + std::string localizedType = CGUIDialogVideoInfo::GetLocalizedVideoType(mediaType); if (localizedType.empty()) return true; if (!videodb.GetSingleValue("tag", "tag.tag_id", videodb.PrepareSQL("tag.name = '%s' AND tag.tag_id IN (SELECT tag_link.tag_id FROM tag_link WHERE tag_link.media_type = '%s')", strTag.c_str(), mediaType.c_str())).empty()) { - CStdString strError = StringUtils::Format(g_localizeStrings.Get(20463).c_str(), strTag.c_str()); + std::string strError = StringUtils::Format(g_localizeStrings.Get(20463).c_str(), strTag.c_str()); CGUIDialogOK::ShowAndGetInput(20462, "", strError, ""); return true; } int idTag = videodb.AddTag(strTag); CFileItemList items; - CStdString strLabel = StringUtils::Format(g_localizeStrings.Get(20464).c_str(), localizedType.c_str()); + std::string strLabel = StringUtils::Format(g_localizeStrings.Get(20464).c_str(), localizedType.c_str()); if (CGUIDialogVideoInfo::GetItemsForTag(strLabel, mediaType, items, idTag)) { for (int index = 0; index < items.Size(); index++) diff --git a/xbmc/video/windows/GUIWindowVideoNav.h b/xbmc/video/windows/GUIWindowVideoNav.h index 75cceb70f8017..c91c6a652b2a9 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.h +++ b/xbmc/video/windows/GUIWindowVideoNav.h @@ -58,7 +58,7 @@ class CGUIWindowVideoNav : public CGUIWindowVideoBase // override base class methods virtual bool GetDirectory(const std::string &strDirectory, CFileItemList &items); virtual void UpdateButtons(); - virtual void DoSearch(const CStdString& strSearch, CFileItemList& items); + virtual void DoSearch(const std::string& strSearch, CFileItemList& items); virtual void PlayItem(int iItem); virtual void OnDeleteItem(CFileItemPtr pItem); virtual void GetContextButtons(int itemNumber, CContextButtons &buttons); @@ -66,7 +66,7 @@ class CGUIWindowVideoNav : public CGUIWindowVideoBase virtual bool OnClick(int iItem); virtual std::string GetStartFolder(const std::string &dir); - virtual CStdString GetQuickpathName(const CStdString& strPath) const; + virtual std::string GetQuickpathName(const std::string& strPath) const; VECSOURCES m_shares; }; diff --git a/xbmc/video/windows/GUIWindowVideoPlaylist.cpp b/xbmc/video/windows/GUIWindowVideoPlaylist.cpp index 1ed47dc045146..69717a06d4f1e 100644 --- a/xbmc/video/windows/GUIWindowVideoPlaylist.cpp +++ b/xbmc/video/windows/GUIWindowVideoPlaylist.cpp @@ -329,7 +329,7 @@ bool CGUIWindowVideoPlaylist::OnPlayMedia(int iItem) else { CFileItemPtr pItem = m_vecItems->Get(iItem); - CStdString strPath = pItem->GetPath(); + std::string strPath = pItem->GetPath(); g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO); // need to update Playlist FileItem's startOffset and resumePoint based on GUIWindowVideoPlaylist FileItem if (pItem->m_lStartOffset == STARTOFFSET_RESUME) @@ -371,14 +371,14 @@ void CGUIWindowVideoPlaylist::RemovePlayListItem(int iItem) /// \brief Save current playlist to playlist folder void CGUIWindowVideoPlaylist::SavePlayList() { - CStdString strNewFileName; + std::string strNewFileName; if (CGUIKeyboardFactory::ShowAndGetInput(strNewFileName, g_localizeStrings.Get(16012), false)) { // need 2 rename it - CStdString strFolder = URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video"); + std::string strFolder = URIUtils::AddFileToFolder(CSettings::Get().GetString("system.playlistspath"), "video"); strNewFileName = CUtil::MakeLegalFileName(strNewFileName); strNewFileName += ".m3u"; - CStdString strPath = URIUtils::AddFileToFolder(strFolder, strNewFileName); + std::string strPath = URIUtils::AddFileToFolder(strFolder, strNewFileName); CPlayListM3U playlist; playlist.Add(*m_vecItems); @@ -499,7 +499,7 @@ bool CGUIWindowVideoPlaylist::OnContextButton(int itemNumber, CONTEXT_BUTTON but return true; case CONTEXT_BUTTON_EDIT_PARTYMODE: { - CStdString playlist = "special://profile/PartyMode-Video.xsp"; + std::string playlist = "special://profile/PartyMode-Video.xsp"; if (CGUIDialogSmartPlaylistEditor::EditPlaylist(playlist)) { // apply new rules