Skip to content

Commit

Permalink
[stdstring] get rid of CStdString in video/dialogs/
Browse files Browse the repository at this point in the history
  • Loading branch information
notspiff authored and Montellese committed Jan 7, 2015
1 parent a6345db commit 412f911
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 86 deletions.
8 changes: 4 additions & 4 deletions xbmc/video/dialogs/GUIDialogAudioSubtitleSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void CGUIDialogAudioSubtitleSettings::OnSettingAction(const CSetting *setting)
const std::string &settingId = setting->GetId();
if (settingId == SETTING_SUBTITLE_BROWSER)
{
CStdString strPath;
std::string strPath;
if (URIUtils::IsInRAR(g_application.CurrentFileItem().GetPath()) || URIUtils::IsInZIP(g_application.CurrentFileItem().GetPath()))
strPath = CURL(g_application.CurrentFileItem().GetPath()).GetHostName();
else
Expand Down Expand Up @@ -414,7 +414,7 @@ void CGUIDialogAudioSubtitleSettings::AudioStreamsOptionFiller(const CSetting *s
for (int i = 0; i < audioStreamCount; ++i)
{
std::string strItem;
CStdString strLanguage;
std::string strLanguage;

SPlayerAudioStreamInfo info;
g_application.m_pPlayer->GetAudioStreamInfo(i, info);
Expand Down Expand Up @@ -448,8 +448,8 @@ void CGUIDialogAudioSubtitleSettings::SubtitleStreamsOptionFiller(const CSetting
SPlayerSubtitleStreamInfo info;
g_application.m_pPlayer->GetSubtitleStreamInfo(i, info);

CStdString strItem;
CStdString strLanguage;
std::string strItem;
std::string strLanguage;

if (!g_LangCodeExpander.Lookup(strLanguage, info.language))
strLanguage = g_localizeStrings.Get(13205); // Unknown
Expand Down
2 changes: 1 addition & 1 deletion xbmc/video/dialogs/GUIDialogFileStacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void CGUIDialogFileStacking::OnInitWindow()
SendMessage(GUI_MSG_LABEL_RESET, GetID(), STACK_LIST);
for (int i = 0; i < m_iNumberOfFiles; i++)
{
CStdString label = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), i+1);
std::string label = StringUtils::Format(g_localizeStrings.Get(23051).c_str(), i+1);
CFileItemPtr item(new CFileItem(label));
m_stackItems->Add(item);
}
Expand Down
32 changes: 16 additions & 16 deletions xbmc/video/dialogs/GUIDialogSubtitles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void CGUIDialogSubtitles::Search(const std::string &search/*=""*/)
if(StringUtils::EqualsNoCase(preferredLanguage, "original"))
{
SPlayerAudioStreamInfo info;
CStdString strLanguage;
std::string strLanguage;

int currentAudio = g_application.m_pPlayer->GetAudioStream();
g_application.m_pPlayer->GetAudioStreamInfo(currentAudio, info);
Expand Down Expand Up @@ -446,21 +446,21 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
SUBTITLE_STORAGEMODE storageMode = (SUBTITLE_STORAGEMODE) CSettings::Get().GetInt("subtitles.storagemode");

// Get (unstacked) path
CStdString strCurrentFile = g_application.CurrentUnstackedItem().GetPath();
std::string strCurrentFile = g_application.CurrentUnstackedItem().GetPath();

CStdString strDownloadPath = "special://temp";
CStdString strDestPath;
std::string strDownloadPath = "special://temp";
std::string strDestPath;
std::vector<std::string> vecFiles;

CStdString strCurrentFilePath;
std::string strCurrentFilePath;
if (StringUtils::StartsWith(strCurrentFilePath, "http://"))
{
strCurrentFile = "TempSubtitle";
vecFiles.push_back(strCurrentFile);
}
else
{
CStdString subPath = CSpecialProtocol::TranslatePath("special://subtitles");
std::string subPath = CSpecialProtocol::TranslatePath("special://subtitles");
if (!subPath.empty())
strDownloadPath = subPath;

Expand Down Expand Up @@ -501,23 +501,23 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
strDestPath = strDownloadPath;

// Extract the language and appropriate extension
CStdString strSubLang;
std::string strSubLang;
g_LangCodeExpander.ConvertToTwoCharCode(strSubLang, language);

// Iterate over all items to transfer
for (unsigned int i = 0; i < vecFiles.size() && i < (unsigned int) items->Size(); i++)
{
CStdString strUrl = items->Get(i)->GetPath();
CStdString strFileName = URIUtils::GetFileName(vecFiles[i]);
std::string strUrl = items->Get(i)->GetPath();
std::string strFileName = URIUtils::GetFileName(vecFiles[i]);
URIUtils::RemoveExtension(strFileName);

// construct subtitle path
CStdString strSubExt = URIUtils::GetExtension(strUrl);
CStdString strSubName = StringUtils::Format("%s.%s%s", strFileName.c_str(), strSubLang.c_str(), strSubExt.c_str());
std::string strSubExt = URIUtils::GetExtension(strUrl);
std::string strSubName = StringUtils::Format("%s.%s%s", strFileName.c_str(), strSubLang.c_str(), strSubExt.c_str());

// Handle URL encoding:
CStdString strDownloadFile = URIUtils::ChangeBasePath(strCurrentFilePath, strSubName, strDownloadPath);
CStdString strDestFile = strDownloadFile;
std::string strDownloadFile = URIUtils::ChangeBasePath(strCurrentFilePath, strSubName, strDownloadPath);
std::string strDestFile = strDownloadFile;

if (!CFile::Copy(strUrl, strDownloadFile))
{
Expand All @@ -529,7 +529,7 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
if (strDestPath != strDownloadPath)
{
// Handle URL encoding:
CStdString strTryDestFile = URIUtils::ChangeBasePath(strCurrentFilePath, strSubName, strDestPath);
std::string strTryDestFile = URIUtils::ChangeBasePath(strCurrentFilePath, strSubName, strDestPath);

/* Copy the file from temp to our final destination, if that fails fallback to download path
* (ie. special://subtitles or use special://temp). Note that after the first item strDownloadPath equals strDestpath
Expand All @@ -555,12 +555,12 @@ void CGUIDialogSubtitles::OnDownloadComplete(const CFileItemList *items, const s
}

// for ".sub" subtitles we check if ".idx" counterpart exists and copy that as well
if (strSubExt.Equals(".sub"))
if (StringUtils::EqualsNoCase(strSubExt, ".sub"))
{
strUrl = URIUtils::ReplaceExtension(strUrl, ".idx");
if(CFile::Exists(strUrl))
{
CStdString strSubNameIdx = StringUtils::Format("%s.%s.idx", strFileName.c_str(), strSubLang.c_str());
std::string strSubNameIdx = StringUtils::Format("%s.%s.idx", strFileName.c_str(), strSubLang.c_str());
// Handle URL encoding:
strDestFile = URIUtils::ChangeBasePath(strCurrentFilePath, strSubNameIdx, strDestPath);
CFile::Copy(strUrl, strDestFile);
Expand Down
4 changes: 2 additions & 2 deletions xbmc/video/dialogs/GUIDialogSubtitles.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class CGUIDialogSubtitles : public CGUIDialog, CJobQueue
CFileItemList* m_serviceItems;
std::string m_currentService;
std::string m_status;
CStdString m_strManualSearch;
std::string m_strManualSearch;
bool m_pausedOnRun;
bool m_updateSubsList; ///< true if we need to update our subs list
CStdString m_LastAutoDownloaded; ///< Last video file path which automatically downloaded subtitle
std::string m_LastAutoDownloaded; ///< Last video file path which automatically downloaded subtitle
};
10 changes: 5 additions & 5 deletions xbmc/video/dialogs/GUIDialogVideoBookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void CGUIDialogVideoBookmarks::OnRefreshList()
CBookmark resumemark;

// open the d/b and retrieve the bookmarks for the current movie
CStdString path = g_application.CurrentFile();
std::string path = g_application.CurrentFile();
if (g_application.CurrentFileItem().HasProperty("original_listitem_url") &&
!URIUtils::IsVideoDb(g_application.CurrentFileItem().GetProperty("original_listitem_url").asString()))
path = g_application.CurrentFileItem().GetProperty("original_listitem_url").asString();
Expand All @@ -222,7 +222,7 @@ void CGUIDialogVideoBookmarks::OnRefreshList()
if (m_bookmarks[i].type == CBookmark::RESUME)
m_bookmarks[i].thumbNailImage = "bookmark-resume.png";

CStdString bookmarkTime;
std::string bookmarkTime;
if (m_bookmarks[i].type == CBookmark::EPISODE)
bookmarkTime = StringUtils::Format("%s %li %s %li", g_localizeStrings.Get(20373).c_str(), m_bookmarks[i].seasonNumber, g_localizeStrings.Get(20359).c_str(), m_bookmarks[i].episodeNumber);
else
Expand Down Expand Up @@ -293,7 +293,7 @@ void CGUIDialogVideoBookmarks::ClearBookmarks()
{
CVideoDatabase videoDatabase;
videoDatabase.Open();
CStdString path = g_application.CurrentFile();
std::string path = g_application.CurrentFile();
if (g_application.CurrentFileItem().HasProperty("original_listitem_url") &&
!URIUtils::IsVideoDb(g_application.CurrentFileItem().GetProperty("original_listitem_url").asString()))
path = g_application.CurrentFileItem().GetProperty("original_listitem_url").asString();
Expand Down Expand Up @@ -361,7 +361,7 @@ bool CGUIDialogVideoBookmarks::AddBookmark(CVideoInfoTag* tag)
videoDatabase.AddBookMarkForEpisode(*tag, bookmark);
else
{
CStdString path = g_application.CurrentFile();
std::string path = g_application.CurrentFile();
if (g_application.CurrentFileItem().HasProperty("original_listitem_url") &&
!URIUtils::IsVideoDb(g_application.CurrentFileItem().GetProperty("original_listitem_url").asString()))
path = g_application.CurrentFileItem().GetProperty("original_listitem_url").asString();
Expand Down Expand Up @@ -404,7 +404,7 @@ bool CGUIDialogVideoBookmarks::AddEpisodeBookmark()
CContextButtons choices;
for (unsigned int i=0; i < episodes.size(); ++i)
{
CStdString strButton = StringUtils::Format("%s %i, %s %i",
std::string strButton = StringUtils::Format("%s %i, %s %i",
g_localizeStrings.Get(20373).c_str(), episodes[i].m_iSeason,
g_localizeStrings.Get(20359).c_str(), episodes[i].m_iEpisode);
choices.Add(i, strButton);
Expand Down
Loading

0 comments on commit 412f911

Please sign in to comment.